Skip to content

Commit 8650016

Browse files
committed
Merge branch 'develop' into enhancement/5798-add-global-data-helper
2 parents b12e5fd + 30c6e8c commit 8650016

329 files changed

Lines changed: 20971 additions & 2551 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/blocks/reader-revenue-manager/contribute-with-google/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 2,
44
"name": "google-site-kit/rrm-contribute-with-google",
5-
"version": "1.180.0",
5+
"version": "1.181.0",
66
"title": "Contribute with Google",
77
"category": "widgets",
88
"icon": "google",

assets/blocks/reader-revenue-manager/contribute-with-google/v3/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 3,
44
"name": "google-site-kit/rrm-contribute-with-google",
5-
"version": "1.180.0",
5+
"version": "1.181.0",
66
"title": "Contribute with Google",
77
"category": "widgets",
88
"icon": "google",

assets/blocks/reader-revenue-manager/subscribe-with-google/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 2,
44
"name": "google-site-kit/rrm-subscribe-with-google",
5-
"version": "1.180.0",
5+
"version": "1.181.0",
66
"title": "Subscribe with Google",
77
"category": "widgets",
88
"icon": "google",

assets/blocks/reader-revenue-manager/subscribe-with-google/v3/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 3,
44
"name": "google-site-kit/rrm-subscribe-with-google",
5-
"version": "1.180.0",
5+
"version": "1.181.0",
66
"title": "Subscribe with Google",
77
"category": "widgets",
88
"icon": "google",

assets/blocks/sign-in-with-google/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 2,
44
"name": "google-site-kit/sign-in-with-google",
5-
"version": "1.180.0",
5+
"version": "1.181.0",
66
"title": "Sign in with Google",
77
"category": "widgets",
88
"icon": "google",

assets/blocks/sign-in-with-google/v3/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 3,
44
"name": "google-site-kit/sign-in-with-google",
5-
"version": "1.180.0",
5+
"version": "1.181.0",
66
"title": "Sign in with Google",
77
"category": "widgets",
88
"icon": "google",

assets/js/components/ActivateAnalyticsCTA.js

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ import { __ } from '@wordpress/i18n';
3939
import { Button, SpinnerButton } from 'googlesitekit-components';
4040
import { useDispatch, useSelect } from 'googlesitekit-data';
4141
import Link from '@/js/components/Link';
42+
import Typography from '@/js/components/Typography';
43+
import { SIZE_MEDIUM, TYPE_LABEL } from '@/js/components/Typography/constants';
44+
import P from '@/js/components/Typography/P';
4245
import { CORE_LOCATION } from '@/js/googlesitekit/datastore/location/constants';
4346
import { CORE_SITE } from '@/js/googlesitekit/datastore/site/constants';
4447
import { CORE_USER } from '@/js/googlesitekit/datastore/user/constants';
@@ -48,7 +51,10 @@ import useActivateModuleCallback from '@/js/hooks/useActivateModuleCallback';
4851
import useCompleteModuleActivationCallback from '@/js/hooks/useCompleteModuleActivationCallback';
4952
import { useDebounce } from '@/js/hooks/useDebounce';
5053
import { useFeature } from '@/js/hooks/useFeature';
51-
import { MODULE_SLUG_ANALYTICS_4 } from '@/js/modules/analytics-4/constants';
54+
import {
55+
ANALYTICS_SETUP_ERROR,
56+
MODULE_SLUG_ANALYTICS_4,
57+
} from '@/js/modules/analytics-4/constants';
5258
import { MODULES_ANALYTICS_4 } from '@/js/modules/analytics-4/datastore/constants';
5359
import AnalyticsIcon from '@/svg/graphics/analytics.svg';
5460

@@ -59,6 +65,9 @@ export default function ActivateAnalyticsCTA( {
5965
} ) {
6066
const trackingRef = useRef();
6167
const setupFlowRefreshEnabled = useFeature( 'setupFlowRefresh' );
68+
const setupFlowRefreshPhase4Enabled = useFeature(
69+
'setupFlowRefreshPhase4'
70+
);
6271

6372
const trackEvents = useNotificationEvents(
6473
'activate-analytics-cta',
@@ -102,6 +111,20 @@ export default function ActivateAnalyticsCTA( {
102111
return select( CORE_SITE ).getDocumentationLinkURL( 'ga4' );
103112
} );
104113

114+
const hasActivationError = useSelect( ( select ) => {
115+
if ( ! setupFlowRefreshEnabled || ! setupFlowRefreshPhase4Enabled ) {
116+
return false;
117+
}
118+
119+
const internalServerError =
120+
select( CORE_SITE ).getInternalServerError();
121+
122+
return (
123+
! analyticsModuleActive &&
124+
internalServerError?.id === ANALYTICS_SETUP_ERROR
125+
);
126+
} );
127+
105128
const [ inProgress, setInProgress ] = useState( false );
106129

107130
const isNavigatingToReauthURL = useSelect( ( select ) => {
@@ -140,10 +163,17 @@ export default function ActivateAnalyticsCTA( {
140163
useEffect( () => {
141164
if ( isActivating || isNavigatingToReauthURL ) {
142165
setInProgress( true );
166+
} else if ( hasActivationError ) {
167+
setInProgress( false );
143168
} else {
144169
debouncedSetInProgress( false );
145170
}
146-
}, [ isActivating, isNavigatingToReauthURL, debouncedSetInProgress ] );
171+
}, [
172+
isActivating,
173+
isNavigatingToReauthURL,
174+
debouncedSetInProgress,
175+
hasActivationError,
176+
] );
147177

148178
const intersectionEntry = useIntersection( trackingRef, {
149179
threshold: 0.25,
@@ -160,12 +190,23 @@ export default function ActivateAnalyticsCTA( {
160190
}, [ inView, hasBeenInView, trackEvents, analyticsEventLabel ] );
161191

162192
const { dismissItem } = useDispatch( CORE_USER );
193+
const { clearInternalServerError } = useDispatch( CORE_SITE );
163194

164195
function handleDismiss() {
165196
trackEvents.dismiss( analyticsEventLabel );
166197
dismissItem( dismissedItemSlug );
167198
}
168199

200+
function handleActivationRetry() {
201+
clearInternalServerError();
202+
activateModuleCallback();
203+
trackEvents.confirm( analyticsEventLabel );
204+
}
205+
206+
function handleActivationErrorDismiss() {
207+
clearInternalServerError();
208+
}
209+
169210
const onClickCallback = analyticsModuleActive
170211
? completeModuleActivationCallback
171212
: activateModuleCallback;
@@ -208,6 +249,49 @@ export default function ActivateAnalyticsCTA( {
208249
);
209250
}
210251

252+
if ( hasActivationError ) {
253+
return (
254+
<div
255+
className="googlesitekit-activate-analytics-cta googlesitekit-activate-analytics-cta--error"
256+
ref={ trackingRef }
257+
>
258+
<div>
259+
<Typography
260+
type={ TYPE_LABEL }
261+
size={ SIZE_MEDIUM }
262+
as="h2"
263+
className="googlesitekit-activate-analytics-cta__title"
264+
>
265+
{ __( 'Analytics setup failed', 'google-site-kit' ) }
266+
</Typography>
267+
<P className="googlesitekit-activate-analytics-cta__description">
268+
{ __(
269+
'Something went wrong, please try again',
270+
'google-site-kit'
271+
) }
272+
</P>
273+
</div>
274+
<div className="googlesitekit-activate-analytics-cta__actions">
275+
<Button
276+
className="googlesitekit-activate-analytics-cta__button--secondary googlesitekit-activate-analytics-cta__dismiss-button--error"
277+
onClick={ handleActivationErrorDismiss }
278+
tertiary
279+
>
280+
{ __( 'Got it', 'google-site-kit' ) }
281+
</Button>
282+
<SpinnerButton
283+
className="googlesitekit-activate-analytics-cta__button--primary"
284+
onClick={ handleActivationRetry }
285+
isSaving={ inProgress }
286+
disabled={ inProgress }
287+
>
288+
{ __( 'Retry Analytics setup', 'google-site-kit' ) }
289+
</SpinnerButton>
290+
</div>
291+
</div>
292+
);
293+
}
294+
211295
return (
212296
<div
213297
className="googlesitekit-activate-analytics-cta"

assets/js/components/ActivateAnalyticsCTA.stories.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
/**
2020
* Internal dependencies
2121
*/
22+
import { CORE_SITE } from '@/js/googlesitekit/datastore/site/constants';
2223
import { CORE_USER } from '@/js/googlesitekit/datastore/user/constants';
24+
import { ANALYTICS_SETUP_ERROR } from '@/js/modules/analytics-4/constants';
2325
import {
2426
provideModuleRegistrations,
2527
provideModules,
@@ -59,6 +61,22 @@ WithSetupFlowRefreshCompleteSetup.parameters = {
5961
features: [ 'setupFlowRefresh' ],
6062
};
6163

64+
export const WithSetupFlowRefreshPhase4ActivationError = Template.bind( {} );
65+
WithSetupFlowRefreshPhase4ActivationError.storyName =
66+
'Setup Flow Refresh Phase 4 - Activation Error';
67+
WithSetupFlowRefreshPhase4ActivationError.args = {
68+
dismissedItemSlug: 'analytics-setup-cta-search-funnel',
69+
setupRegistry: ( registry ) => {
70+
registry.dispatch( CORE_SITE ).setInternalServerError( {
71+
id: ANALYTICS_SETUP_ERROR,
72+
description: 'This is an error',
73+
} );
74+
},
75+
};
76+
WithSetupFlowRefreshPhase4ActivationError.parameters = {
77+
features: [ 'setupFlowRefresh', 'setupFlowRefreshPhase4' ],
78+
};
79+
6280
export default {
6381
title: 'Components/ActivateAnalyticsCTA',
6482
component: ActivateAnalyticsCTA,
@@ -67,6 +85,10 @@ export default {
6785
const analyticsActive = args?.isAnalyticsActive || false;
6886

6987
function setupRegistry( registry ) {
88+
if ( args?.setupRegistry ) {
89+
args.setupRegistry( registry );
90+
}
91+
7092
provideModules( registry, [
7193
{
7294
slug: 'analytics-4',

assets/js/components/DashboardMainApp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ import MetricsSelectionPanel from './KeyMetrics/MetricsSelectionPanel';
8989
import ModuleDashboardEffects from './ModuleDashboardEffects';
9090
import Notifications from './notifications/Notifications';
9191
import OfflineNotification from './notifications/OfflineNotification';
92+
import PDFDownloadButton from './pdf-export/PDFDownloadButton';
9293
import PDFExportRoot from './pdf-export/PDFExportRoot';
93-
import PDFDownloadButton from './pdf-generation/PDFDownloadButton';
94-
import PDFSectionsSelectionPanel from './pdf-generation/PDFSectionsSelectionPanel';
94+
import PDFSectionsSelectionPanel from './pdf-export/PDFSectionsSelectionPanel';
9595
import CurrentSurveyPortal from './surveys/CurrentSurveyPortal';
9696
import SurveyViewTrigger from './surveys/SurveyViewTrigger';
9797
import WelcomeModal from './WelcomeModal';

assets/js/components/DashboardNavigation/Navigation/index.js

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,30 +231,62 @@ export default function Navigation() {
231231
// Handle scroll events to update sticky state and selected chip.
232232
useEvent( 'scroll', throttledOnScroll );
233233

234+
const navigationChipIconSize = 20;
235+
234236
const chips = {
235237
[ ANCHOR_ID_KEY_METRICS ]: {
236238
label: __( 'Key metrics', 'google-site-kit' ),
237-
icon: <NavKeyMetricsIcon width="18" height="16" />,
239+
icon: (
240+
<NavKeyMetricsIcon
241+
width={ navigationChipIconSize }
242+
height={ navigationChipIconSize }
243+
/>
244+
),
238245
},
239246
[ ANCHOR_ID_TRAFFIC ]: {
240247
label: __( 'Traffic', 'google-site-kit' ),
241-
icon: <NavTrafficIcon width="18" height="16" />,
248+
icon: (
249+
<NavTrafficIcon
250+
width={ navigationChipIconSize }
251+
height={ navigationChipIconSize }
252+
/>
253+
),
242254
},
243255
[ ANCHOR_ID_SITE_GOALS ]: {
244256
label: __( 'Site goals', 'google-site-kit' ),
245-
icon: <NavSiteGoalsIcon width="17" height="17" />,
257+
icon: (
258+
<NavSiteGoalsIcon
259+
width={ navigationChipIconSize }
260+
height={ navigationChipIconSize }
261+
/>
262+
),
246263
},
247264
[ ANCHOR_ID_CONTENT ]: {
248265
label: __( 'Content', 'google-site-kit' ),
249-
icon: <NavContentIcon width="18" height="18" />,
266+
icon: (
267+
<NavContentIcon
268+
width={ navigationChipIconSize }
269+
height={ navigationChipIconSize }
270+
/>
271+
),
250272
},
251273
[ ANCHOR_ID_SPEED ]: {
252274
label: __( 'Speed', 'google-site-kit' ),
253-
icon: <NavSpeedIcon width="20" height="16" />,
275+
icon: (
276+
<NavSpeedIcon
277+
width={ navigationChipIconSize }
278+
height={ navigationChipIconSize }
279+
/>
280+
),
254281
},
255282
[ ANCHOR_ID_MONETIZATION ]: {
256283
label: __( 'Monetization', 'google-site-kit' ),
257-
icon: <NavMonetizationIcon width="18" height="16" />,
284+
icon: (
285+
<NavMonetizationIcon
286+
width={ navigationChipIconSize }
287+
height={ navigationChipIconSize }
288+
/>
289+
),
258290
},
259291
};
260292

0 commit comments

Comments
 (0)