Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
28216a8
Enhance TourTooltip component with feature flag for setup flow refresh.
hussain-t Dec 15, 2025
79eceda
Implement SFR FF for customizing floater properties in TourTooltips c…
hussain-t Dec 15, 2025
149b779
Refactor TourTooltips story structure and add Setup Flow Refresh vari…
hussain-t Dec 15, 2025
7cf0069
Add styles for Setup Flow Refresh variant in TourTooltip component.
hussain-t Dec 15, 2025
02481cb
Add a period for the comment.
hussain-t Dec 15, 2025
fba95fd
Fix comment formatting in TourTooltips story by adding a period for c…
hussain-t Dec 15, 2025
6ece239
Merge branch 'develop' into enhancement/#11812-update-tour-tooltip.
hussain-t Jan 2, 2026
60a499e
Update tooltip styles by adjusting font size, letter spacing, and lin…
hussain-t Jan 2, 2026
6e420ba
Update TourTooltip component to conditionally set button text and ter…
hussain-t Jan 2, 2026
ad8de9b
Add wrapper div to TourTooltips story for consistent styling.
hussain-t Jan 2, 2026
63fe862
Update TourTooltip component to use Typography for content and increa…
hussain-t Jan 2, 2026
c6e015f
Refactor TourTooltips story to remove unnecessary wrapper div.
hussain-t Jan 2, 2026
7ffe840
Refactor TourTooltip styles to improve typography and layout, includi…
hussain-t Jan 2, 2026
d7ee0ac
Update TourTooltip component to conditionally adjust typography sizes…
hussain-t Jan 2, 2026
1f4c165
Update TourTooltip component to set typography size for title to medi…
hussain-t Jan 2, 2026
7298718
Remove letter-spacing from TourTooltip title.
hussain-t Jan 2, 2026
5272605
Fix TourTooltip styles by adding medium font weight to title and adju…
hussain-t Jan 4, 2026
c6b6dd2
Fix old TourTooltip styles by adjusting modal step properties, includ…
hussain-t Jan 4, 2026
7c628cd
Fix styles for SFR variant in TourTooltip component.
hussain-t Jan 4, 2026
4c5b748
Replace Typography with a div for content.
hussain-t Jan 4, 2026
73984f3
Merge branch 'develop' into enhancement/#11812-update-tour-tooltip.
hussain-t Jan 6, 2026
5888b8e
Replace line-height with variable and remove box-shadow from primary …
hussain-t Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 43 additions & 15 deletions assets/js/components/TourTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { __ } from '@wordpress/i18n';
*/
import { Button } from 'googlesitekit-components';
import { createIncrementalArrayBySize } from '@/js/util/create-incremental-array-by-size';
import { useFeature } from '@/js/hooks/useFeature';
import CloseIcon from '@/svg/icons/close.svg';
import Typography from './Typography';

Expand All @@ -45,18 +46,26 @@ export default function TourTooltip( {
step,
tooltipProps,
} ) {
const setupFlowRefreshEnabled = useFeature( 'setupFlowRefresh' );
const indicatorArray = size > 1 ? createIncrementalArrayBySize( size ) : [];
function getIndicatorClassName( indicatorIndex ) {
return classnames( 'googlesitekit-tooltip-indicator', {
active: indicatorIndex === index,
} );
}

// Determine close icon size based on feature flag.
const closeIconSize = setupFlowRefreshEnabled ? 10 : 14;

return (
<div
className={ classnames(
'googlesitekit-tour-tooltip',
step.className
step.className,
{
'googlesitekit-tour-tooltip--setupFlowRefresh':
setupFlowRefreshEnabled,
}
) }
{ ...tooltipProps }
>
Expand All @@ -75,21 +84,29 @@ export default function TourTooltip( {
</div>
</div>
<CardActions className="googlesitekit-tooltip-actions">
<ul className="googlesitekit-tooltip-indicators">
{ indicatorArray.map( ( indicatorIndex ) => (
<li
key={ `indicator-${ indicatorIndex }` }
className={ getIndicatorClassName(
indicatorIndex
) }
/>
) ) }
</ul>
{ ! setupFlowRefreshEnabled && (
<ul className="googlesitekit-tooltip-indicators">
{ indicatorArray.map( ( indicatorIndex ) => (
<li
key={ `indicator-${ indicatorIndex }` }
className={ getIndicatorClassName(
indicatorIndex
) }
/>
) ) }
</ul>
) }
{ setupFlowRefreshEnabled && (
<p className="googlesitekit-tooltip-steps">
{ index + 1 } / { size }
</p>
) }
<div className="googlesitekit-tooltip-buttons">
{ index !== 0 && (
<Button
className="googlesitekit-tooltip-button"
text
text={ ! setupFlowRefreshEnabled }
tertiary={ setupFlowRefreshEnabled }
{ ...backProps }
>
{ backProps.title }
Expand All @@ -98,8 +115,14 @@ export default function TourTooltip( {
{ step.cta }
{ primaryProps.title && (
<Button
className="googlesitekit-tooltip-button"
text
className={ classnames(
'googlesitekit-tooltip-button',
{
'googlesitekit-tooltip-button--primary':
setupFlowRefreshEnabled,
}
) }
text={ ! setupFlowRefreshEnabled }
{ ...primaryProps }
>
{ primaryProps.title }
Expand All @@ -109,7 +132,12 @@ export default function TourTooltip( {
</CardActions>
<Button
className="googlesitekit-tooltip-close"
icon={ <CloseIcon width="14" height="14" /> }
icon={
<CloseIcon
width={ closeIconSize }
height={ closeIconSize }
/>
}
onClick={ closeProps.onClick }
aria-label={ __( 'Close', 'google-site-kit' ) }
text
Expand Down
21 changes: 18 additions & 3 deletions assets/js/components/TourTooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { useSelect, useDispatch, useRegistry } from 'googlesitekit-data';
import { CORE_UI } from '@/js/googlesitekit/datastore/ui/constants';
import { CORE_USER } from '@/js/googlesitekit/datastore/user/constants';
import { trackEvent } from '@/js/util/tracking';
import { useFeature } from '@/js/hooks/useFeature';
import TourTooltip from './TourTooltip';
import useViewContext from '@/js/hooks/useViewContext';

Expand Down Expand Up @@ -99,6 +100,7 @@ export default function TourTooltips( {
const registry = useRegistry();

const viewContext = useViewContext();
const setupFlowRefreshEnabled = useFeature( 'setupFlowRefresh' );

const stepIndex = useSelect(
( select ) => select( CORE_UI ).getValue( stepKey ) || 0
Expand Down Expand Up @@ -241,7 +243,7 @@ export default function TourTooltips( {
}
}

// Start tour on initial render
// Start tour on initial render.
useMount( startTour );

const parsedSteps = steps.map( ( step ) => ( {
Expand All @@ -251,20 +253,33 @@ export default function TourTooltips( {
...step,
} ) );

// Customize floater props based on feature flag.
const customFloaterProps = setupFlowRefreshEnabled
? {
...floaterProps,
styles: {
...floaterProps.styles,
floater: {
filter: 'drop-shadow(rgba(0, 0, 0, 0.25) 0px 4px 16px)',
},
},
}
: floaterProps;

return (
<Joyride
callback={ handleJoyrideCallback }
floaterProps={ floaterProps }
floaterProps={ customFloaterProps }
locale={ joyrideLocale }
run={ run }
stepIndex={ stepIndex }
steps={ parsedSteps }
styles={ joyrideStyles }
tooltipComponent={ TourTooltip }
showProgress={ ! setupFlowRefreshEnabled }
continuous
disableOverlayClose
disableScrolling
showProgress
/>
);
}
Expand Down
106 changes: 63 additions & 43 deletions assets/js/components/TourTooltips.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,50 +375,47 @@ function TourControls() {
);
}

export function Default() {
const steps = [
{
target: '.step-1',
title: 'See where your visitors are coming from',
content:
'Click on a slice of the chart to see how it changed over time just for that source',
placement: 'bottom-start',
},
{
target: '.step-2',
title: "It's now easier to see your site's traffic at a glance",
content:
'Check the trend graph to see how your traffic changed over time',
placement: 'top-end',
},
{
target: '.step-3',
title: 'Check how your traffic changed since you last looked',
content:
'Select a time frame to see the comparison with the previous time period',
},
{
target: '.step-4',
title: 'Generic step title for the fourth step',
content: (
<div>
{ createInterpolateElement(
'This is the fourth step with an external link that should go to Google, <a>link</a>.',
{
a: <Link href="http://google.com" external />,
}
) }
</div>
),
floaterProps: {
target: '.step-4-anchor',
},
const steps = [
{
target: '.step-1',
title: 'See where your visitors are coming from',
content:
'Click on a slice of the chart to see how it changed over time just for that source',
placement: 'bottom-start',
},
{
target: '.step-2',
title: "It's now easier to see your site's traffic at a glance",
content:
'Check the trend graph to see how your traffic changed over time',
placement: 'top-end',
},
{
target: '.step-3',
title: 'Check how your traffic changed since you last looked',
content:
'Select a time frame to see the comparison with the previous time period',
},
{
target: '.step-4',
title: 'Generic step title for the fourth step',
content: (
<div>
{ createInterpolateElement(
'This is the fourth step with an external link that should go to Google, <a>link</a>.',
{
a: <Link href="http://google.com" external />,
}
) }
</div>
),
floaterProps: {
target: '.step-4-anchor',
},
];
fetchMock.post( /^\/google-site-kit\/v1\/core\/user\/data\/dismiss-tour/, {
body: JSON.stringify( [ 'feature' ] ),
status: 200,
} );
},
];

function Template() {
function setupRegistry( registry ) {
registry.dispatch( CORE_USER ).receiveGetDismissedTours( [] );
}
Expand All @@ -436,6 +433,8 @@ export function Default() {
);
}

export const Default = Template.bind( {} );

function RepeatableTour() {
const tour = useSelect( ( select ) =>
select( CORE_USER ).getCurrentTour()
Expand Down Expand Up @@ -500,7 +499,28 @@ export function Repeatable() {
);
}

export const SetupFlowRefresh = Template.bind( {} );
SetupFlowRefresh.storyName = 'Setup Flow Refresh';
SetupFlowRefresh.parameters = {
features: [ 'setupFlowRefresh' ],
};

export default {
title: 'Components/TourTooltips',
component: TourTooltips,
decorators: [
( Story ) => {
// Set up fetchMock with overwriteRoutes to handle story switching.
fetchMock.post(
/^\/google-site-kit\/v1\/core\/user\/data\/dismiss-tour/,
{
body: JSON.stringify( [ 'feature' ] ),
status: 200,
},
{ overwriteRoutes: true }
);

return <Story />;
},
],
};
Loading
Loading