Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/9281-refactor-audience-segeme…
Browse files Browse the repository at this point in the history
…ntation-setup-success-notification.
  • Loading branch information
jimmymadon committed Sep 29, 2024
2 parents 734bfb0 + 14545e4 commit e6b6ef3
Show file tree
Hide file tree
Showing 169 changed files with 2,636 additions and 457 deletions.
5 changes: 5 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export const decorators = [

export const parameters = {
layout: 'fullscreen',
options: {
storySort: {
method: 'alphabetical',
},
},
async puppeteerTest( page ) {
await page.waitForTimeout( 50 );

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Audience Segmentation PartialDataBadge component.
* BadgeWithTooltip component.
*
* Site Kit by Google, Copyright 2024 Google LLC
*
Expand All @@ -20,26 +20,34 @@
* External dependencies
*/
import PropTypes from 'prop-types';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import classNames from 'classnames';

/**
* Internal dependencies
*/
import InfoTooltip from '../../../../../../../components/InfoTooltip';
import InfoTooltip from './InfoTooltip';

export default function PartialDataBadge( { tooltipTitle } ) {
export default function BadgeWithTooltip( {
className = '',
label,
tooltipTitle,
} ) {
return (
<span className="googlesitekit-audience-segmentation-partial-data-badge">
{ __( 'Partial data', 'google-site-kit' ) }
<span
className={ classNames(
'googlesitekit-badge-with-tooltip',
'googlesitekit-badge',
className
) }
>
{ label }
{ tooltipTitle && <InfoTooltip title={ tooltipTitle } /> }
</span>
);
}

PartialDataBadge.propTypes = {
BadgeWithTooltip.propTypes = {
tooltipTitle: PropTypes.node,
className: PropTypes.string,
label: PropTypes.node.isRequired,
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* PartialDataBadge Component Stories.
* BadgeWithTooltip Component Stories.
*
* Site Kit by Google, Copyright 2024 Google LLC
*
Expand All @@ -19,23 +19,22 @@
/**
* Internal dependencies
*/
import PartialDataBadge from './PartialDataBadge';
import BadgeWithTooltip from './BadgeWithTooltip';

function Template( args ) {
return <PartialDataBadge { ...args } />;
return <BadgeWithTooltip { ...args } />;
}

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

Default.args = {
label: 'Title for badge with tooltip',
tooltipTitle:
'Still collecting full data for this timeframe, partial data is displayed for this group',
};
Default.scenario = {
label: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/PartialDataBadge/Default',
'This is an example of tooltip content for a badge with tooltip',
};
Default.scenario = {};

export default {
title: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/PartialDataBadge',
title: 'Components/BadgeWithTooltip',
};
27 changes: 27 additions & 0 deletions assets/js/components/KeyMetrics/key-metrics-widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
KM_ANALYTICS_POPULAR_PRODUCTS,
KM_ANALYTICS_TOP_CITIES,
KM_ANALYTICS_TOP_CITIES_DRIVING_LEADS,
KM_ANALYTICS_TOP_CITIES_DRIVING_PURCHASES,
KM_ANALYTICS_TOP_COUNTRIES,
KM_ANALYTICS_TOP_CONVERTING_TRAFFIC_SOURCE,
KM_ANALYTICS_PAGES_PER_VISIT,
Expand All @@ -47,6 +48,7 @@ import {
KM_ANALYTICS_TOP_CATEGORIES,
KM_ANALYTICS_POPULAR_AUTHORS,
KM_ANALYTICS_ADSENSE_TOP_EARNING_CONTENT,
KM_ANALYTICS_TOP_CITIES_DRIVING_ADD_TO_CART,
} from '../../googlesitekit/datastore/user/constants';
import { CORE_SITE } from '../../googlesitekit/datastore/site/constants';
import { MODULES_ANALYTICS_4 } from '../../modules/analytics-4/datastore/constants';
Expand Down Expand Up @@ -381,6 +383,31 @@ const KEY_METRICS_WIDGETS = {
],
displayInList: shouldDisplayWidgetWithConversionEvent,
},
[ KM_ANALYTICS_TOP_CITIES_DRIVING_ADD_TO_CART ]: {
title: __( 'Top cities driving add to cart', 'google-site-kit' ),
description: __(
'Cities where visitors most frequently add products to their carts',
'google-site-kit'
),
infoTooltip: __(
'Cities where visitors most frequently add products to their carts',
'google-site-kit'
),
requiredConversionEventName: [ 'add_to_cart' ],
},
[ KM_ANALYTICS_TOP_CITIES_DRIVING_PURCHASES ]: {
title: __( 'Top cities driving purchases', 'google-site-kit' ),
description: __(
'Cities driving the most purchases',
'google-site-kit'
),
infoTooltip: __(
'Cities driving the most purchases',
'google-site-kit'
),
requiredConversionEventName: [ 'purchase' ],
displayInList: shouldDisplayWidgetWithConversionEvent,
},
[ KM_ANALYTICS_TOP_COUNTRIES ]: {
title: __( 'Top countries driving traffic', 'google-site-kit' ),
description: __(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Enabled.scenario = {
delay: 250,
};
Enabled.decorators = [
( Story, { parameters } ) => {
( Story ) => {
const setupRegistry = ( registry ) => {
registry
.dispatch( CORE_SITE )
Expand All @@ -57,10 +57,7 @@ Enabled.decorators = [
);
};
return (
<WithRegistrySetup
func={ setupRegistry }
features={ parameters.features || [] }
>
<WithRegistrySetup func={ setupRegistry }>
<Story />
</WithRegistrySetup>
);
Expand All @@ -74,7 +71,7 @@ Default.scenario = {
delay: 250,
};
Default.decorators = [
( Story, { parameters } ) => {
( Story ) => {
const setupRegistry = ( registry ) => {
registry
.dispatch( CORE_SITE )
Expand All @@ -91,10 +88,7 @@ Default.decorators = [
);
};
return (
<WithRegistrySetup
func={ setupRegistry }
features={ parameters.features || [] }
>
<WithRegistrySetup func={ setupRegistry }>
<Story />
</WithRegistrySetup>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
export const EDITING_USER_ROLE_SELECT_SLUG_KEY =
'editing-user-role-select-slug-key';

export const EXPERIMENTAL_MODULES = [];

export const SETTINGS_DIALOG = 'dashboardSharingDialogOpen';

export const RESET_SETTINGS_DIALOG = 'resetSharingDialogOpen';
Loading

0 comments on commit e6b6ef3

Please sign in to comment.