From 5883fd3ed2fef6f774b15d6ae22e04143dbf3ba7 Mon Sep 17 00:00:00 2001 From: Dylan Munson <65001528+CodeyGuyDylan@users.noreply.github.com> Date: Mon, 29 Jul 2024 08:28:19 -0600 Subject: [PATCH] Update/all tracks to snake case (#38576) * Update all tracks to snake case and improve typing * changelog --- .../_inc/components/connection-status-card/index.tsx | 6 +++--- .../my-jetpack/_inc/components/my-jetpack-screen/index.jsx | 2 +- .../protect-card/scan-threats-status.tsx | 2 +- .../packages/my-jetpack/_inc/hooks/use-analytics/index.ts | 6 +++--- .../use-notification-watcher/use-site-connection-notice.tsx | 2 +- .../my-jetpack/changelog/update-all-tracks-to-snake-case | 4 ++++ 6 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 projects/packages/my-jetpack/changelog/update-all-tracks-to-snake-case diff --git a/projects/packages/my-jetpack/_inc/components/connection-status-card/index.tsx b/projects/packages/my-jetpack/_inc/components/connection-status-card/index.tsx index 47348eda19f61..6cd088eb24bf5 100644 --- a/projects/packages/my-jetpack/_inc/components/connection-status-card/index.tsx +++ b/projects/packages/my-jetpack/_inc/components/connection-status-card/index.tsx @@ -196,8 +196,8 @@ const ConnectionStatusCard: ConnectionStatusCardType = ( { const hasSiteConnectionBrokenModules = brokenModules?.needs_site_connection.length > 0; const tracksEventData = useMemo( () => { return { - userConnectionBrokenModules: brokenModules?.needs_user_connection.join( ', ' ), - siteConnectionBrokenModules: brokenModules?.needs_site_connection.join( ', ' ), + user_connection_broken_modules: brokenModules?.needs_user_connection.join( ', ' ), + site_connection_broken_modules: brokenModules?.needs_site_connection.join( ', ' ), }; }, [ brokenModules ] ); @@ -209,7 +209,7 @@ const ConnectionStatusCard: ConnectionStatusCardType = ( { e && e.preventDefault(); recordEvent( 'jetpack_myjetpack_connection_manage_dialog_click', { ...tracksEventData, - connectionType, + connection_type: connectionType, } ); setIsManageConnectionDialogOpen( true ); }, diff --git a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx index 71252950d3a85..519c960226517 100644 --- a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx @@ -44,7 +44,7 @@ const GlobalNotice = ( { message, title, options } ) => { const tracksArgs = options?.tracksArgs || {}; recordEvent( 'jetpack_myjetpack_global_notice_view', { - noticeId: options.id, + notice_id: options.id, ...tracksArgs, } ); }, [ options.id, recordEvent, options?.tracksArgs ] ); diff --git a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx index 15633df50b79f..2ee6fa8ecdab9 100644 --- a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx +++ b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx @@ -208,7 +208,7 @@ function ScanStatus( { status }: { status: 'success' | 'partial' | 'off' } ) { tracksEventProps={ { location: 'scan', status: status, - hasPaidPlan: false, + has_paid_plan: false, threats: 0, } } > diff --git a/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts index 72b5858a0eec5..a6409e984ac89 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts @@ -5,7 +5,7 @@ import useMyJetpackConnection from '../use-my-jetpack-connection'; type TracksRecordEvent = ( event: `jetpack_${ string }`, // Enforces the event name to start with "jetpack_" - properties?: Record< string, unknown > + properties?: Record< Lowercase< string >, unknown > ) => void; const useAnalytics = () => { @@ -44,8 +44,8 @@ const useAnalytics = () => { jetpackAnalytics.tracks.recordEvent( event, { ...properties, version: myJetpackVersion, - isSiteConnected, - isUserConnected, + is_site_connected: isSiteConnected, + is_user_connected: isUserConnected, referring_plugins: connectedPluginsSlugs, } ); // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/projects/packages/my-jetpack/_inc/hooks/use-notification-watcher/use-site-connection-notice.tsx b/projects/packages/my-jetpack/_inc/hooks/use-notification-watcher/use-site-connection-notice.tsx index e66a0b3582766..8c133318a2908 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-notification-watcher/use-site-connection-notice.tsx +++ b/projects/packages/my-jetpack/_inc/hooks/use-notification-watcher/use-site-connection-notice.tsx @@ -113,7 +113,7 @@ const useSiteConnectionNotice = ( redBubbleAlerts: RedBubbleAlerts ) => { isRedBubble: true, tracksArgs: { type: connectionError.type, - isError: connectionError.is_error, + is_error: connectionError.is_error, }, }; diff --git a/projects/packages/my-jetpack/changelog/update-all-tracks-to-snake-case b/projects/packages/my-jetpack/changelog/update-all-tracks-to-snake-case new file mode 100644 index 0000000000000..1abc3a177ca37 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/update-all-tracks-to-snake-case @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Update all tracks to snake case, camel case is not supported