From 0000492e0fc90fbdcb19df8409d12ac9f7699876 Mon Sep 17 00:00:00 2001 From: Martin CAYUELAS <112866305+mcayuelas-ledger@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:17:08 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=8F=EF=B8=8FUpdate=20Analytics=20?= =?UTF-8?q?(#7863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/few-gifts-double.md | 5 +++++ .../WalletSync/__tests__/useFlows.test.ts | 8 ++------ .../newArch/features/WalletSync/hooks/useFlows.ts | 6 ++---- .../WalletSync/hooks/useLedgerSyncAnalytics.ts | 15 ++++++--------- .../Activation/01-CreateOrSynchronizeStep.tsx | 13 ++++++++++++- .../features/WalletSync/screens/Manage/index.tsx | 9 ++++++--- .../screens/ManageBackup/01-DeleteBackupStep.tsx | 4 ++-- .../screens/ManageInstances/04-DeletionError.tsx | 4 ++-- .../screens/Synchronize/05-UnbackedError.tsx | 2 +- .../07-ActivationAlreadyCreatedOther.tsx | 2 +- .../src/renderer/reducers/walletSync.ts | 1 - apps/ledger-live-desktop/static/i18n/en/app.json | 7 +++---- 12 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 .changeset/few-gifts-double.md diff --git a/.changeset/few-gifts-double.md b/.changeset/few-gifts-double.md new file mode 100644 index 000000000000..a60b6de72a6d --- /dev/null +++ b/.changeset/few-gifts-double.md @@ -0,0 +1,5 @@ +--- +"ledger-live-desktop": patch +--- + +Update Analytics diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/__tests__/useFlows.test.ts b/apps/ledger-live-desktop/src/newArch/features/WalletSync/__tests__/useFlows.test.ts index be92425caad1..dc5c9b655d71 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/__tests__/useFlows.test.ts +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/__tests__/useFlows.test.ts @@ -7,7 +7,7 @@ const INITIAL_STATE = { walletSync: { ...initialStateWalletSync, flow: Flow.ManageBackup, - step: Step.ManageBackup, + step: Step.DeleteBackup, }, }; @@ -25,15 +25,11 @@ describe("useFlows", () => { result.current.goToNextScene(); }); expect(result.current.currentStep).toBe(Object.values(steps)[1]); - act(() => { - result.current.goToNextScene(); - }); - expect(result.current.currentStep).toBe(Object.values(steps)[2]); act(() => { result.current.goToPreviousScene(); }); - expect(result.current.currentStep).toBe(Object.values(steps)[1]); + expect(result.current.currentStep).toBe(Object.values(steps)[0]); }); it("should reset Flow and Step", async () => { diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useFlows.ts b/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useFlows.ts index 187b41c72902..a7b46608b976 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useFlows.ts +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useFlows.ts @@ -40,9 +40,8 @@ export const FlowOptions: Record< }, [Flow.ManageBackup]: { steps: { - 1: Step.ManageBackup, - 2: Step.DeleteBackup, - 3: Step.BackupDeleted, + 1: Step.DeleteBackup, + 2: Step.BackupDeleted, }, }, [Flow.ManageInstances]: { @@ -70,7 +69,6 @@ export const FlowOptions: Record< * */ export const STEPS_WITH_BACK: Step[] = [ - Step.ManageBackup, Step.DeleteBackup, Step.SynchronizedInstances, Step.SynchronizeMode, diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useLedgerSyncAnalytics.ts b/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useLedgerSyncAnalytics.ts index c7a6af7acb63..817e88cda338 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useLedgerSyncAnalytics.ts +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useLedgerSyncAnalytics.ts @@ -2,10 +2,9 @@ import { track } from "~/renderer/analytics/segment"; import { Step } from "~/renderer/reducers/walletSync"; export enum AnalyticsPage { - ManageBackup = "Manage Backup", - ConfirmDeleteBackup = "Confirm Delete Backup", - BackupDeleted = "delete backup success", - BackupDeletionError = "Backup Deletion Error", + ConfirmDeleteBackup = "Confirm delete sync", + BackupDeleted = "delete sync success", + BackupDeletionError = "Sync Deletion Error", ManageInstances = "Manage synchronized instances", DeviceActionInstance = "Device Action Manage Instance", @@ -23,14 +22,14 @@ export enum AnalyticsPage { SyncMethod = "Choose sync method", MobileSync = "Sync from a mobile", DesktopSync = "Sync from a desktop", - KeyCreated = "Backup creation success", + KeyCreated = "Ledger Sync turned on", KeyUpdated = "Sync apps success", - Loading = "Loading Trustchain", + Loading = "Loading Sync", SyncWithQR = "Sync with QR code", PinCode = "Pin code", PinCodeError = "Pin code error", - UnbackedError = "Trustchain initialization error", + UnbackedError = "Scan attempt with no sync", SettingsGeneral = "Settings General", LedgerSyncSettings = "Ledger Sync Settings", @@ -52,7 +51,6 @@ type onActionTrack = { }; export const StepMappedToAnalytics: Record = { - [Step.ManageBackup]: AnalyticsPage.ManageBackup, [Step.DeleteBackup]: AnalyticsPage.ConfirmDeleteBackup, [Step.BackupDeleted]: AnalyticsPage.BackupDeleted, [Step.BackupDeletionError]: AnalyticsPage.BackupDeletionError, @@ -92,7 +90,6 @@ export const StepMappedToAnalytics: Record = { export const StepsOutsideFlow: Step[] = [ Step.LedgerSyncActivated, - Step.ManageBackup, Step.AutoRemoveInstance, Step.UnsecuredLedger, Step.BackupDeletionError, diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Activation/01-CreateOrSynchronizeStep.tsx b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Activation/01-CreateOrSynchronizeStep.tsx index 6eb486de4939..c2a1207f4cdf 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Activation/01-CreateOrSynchronizeStep.tsx +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Activation/01-CreateOrSynchronizeStep.tsx @@ -4,7 +4,11 @@ import { useTranslation } from "react-i18next"; import { useTheme } from "styled-components"; import ButtonV3 from "~/renderer/components/ButtonV3"; import TrackPage from "~/renderer/analytics/TrackPage"; -import { AnalyticsPage } from "../../hooks/useLedgerSyncAnalytics"; +import { + AnalyticsFlow, + AnalyticsPage, + useLedgerSyncAnalytics, +} from "../../hooks/useLedgerSyncAnalytics"; import { LogoWrapper } from "../../components/LogoWrapper"; import { useFeature } from "@ledgerhq/live-common/featureFlags/index"; import { openURL } from "~/renderer/linking"; @@ -21,8 +25,15 @@ export default function CreateOrSynchronizeStep({ goToCreateBackup, goToSync }: const learnMoreUrl = ledgerSyncFF?.params?.learnMoreLink; const hasLearnMoreLink = !!learnMoreUrl; + const { onClickTrack } = useLedgerSyncAnalytics(); + const onLearnMore = () => { if (learnMoreUrl) { + onClickTrack({ + button: "How does Ledger Sync work", + page: AnalyticsPage.Activation, + flow: AnalyticsFlow, + }); openURL(learnMoreUrl); } }; diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Manage/index.tsx b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Manage/index.tsx index 6d72ddb11a37..4419002e049e 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Manage/index.tsx +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Manage/index.tsx @@ -36,12 +36,15 @@ const WalletSyncManage = () => { const goToSync = () => { dispatch(setFlow({ flow: Flow.Synchronize, step: Step.SynchronizeWithQRCode })); - onClickTrack({ button: "Synchronize", page: AnalyticsPage.LedgerSyncSettings }); + onClickTrack({ + button: "Synchronize with another app", + page: AnalyticsPage.LedgerSyncSettings, + }); }; const goToManageBackup = () => { - dispatch(setFlow({ flow: Flow.ManageBackup, step: Step.ManageBackup })); - onClickTrack({ button: "Manage Key", page: AnalyticsPage.LedgerSyncSettings }); + dispatch(setFlow({ flow: Flow.ManageBackup, step: Step.DeleteBackup })); + onClickTrack({ button: "Delete sync", page: AnalyticsPage.LedgerSyncSettings }); }; const goToManageInstances = () => { diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageBackup/01-DeleteBackupStep.tsx b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageBackup/01-DeleteBackupStep.tsx index 8f8182470797..3c1a9f25db61 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageBackup/01-DeleteBackupStep.tsx +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageBackup/01-DeleteBackupStep.tsx @@ -15,12 +15,12 @@ export default function DeleteBackupStep({ cancel }: DeleteBackupStepProps) { const { onClickTrack } = useLedgerSyncAnalytics(); const handleDeleteBackup = async () => { - onClickTrack({ button: "delete", page: AnalyticsPage.ConfirmDeleteBackup }); + onClickTrack({ button: "yes Delete", page: AnalyticsPage.ConfirmDeleteBackup }); await deleteMutation.mutateAsync(); }; const handleCancel = () => { - onClickTrack({ button: "cancel", page: AnalyticsPage.ConfirmDeleteBackup }); + onClickTrack({ button: "Keep", page: AnalyticsPage.ConfirmDeleteBackup }); cancel(); }; diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageInstances/04-DeletionError.tsx b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageInstances/04-DeletionError.tsx index 9c0677b248b0..bb2380ef833e 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageInstances/04-DeletionError.tsx +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/ManageInstances/04-DeletionError.tsx @@ -50,8 +50,8 @@ export const DeletionError = ({ error }: Props) => { onClickTrack({ button: "connect new ledger", page: errorConfig[error].analyticsPage }); }; const goToDelete = () => { - dispatch(setFlow({ flow: Flow.ManageBackup, step: Step.ManageBackup })); - onClickTrack({ button: "delete key", page: errorConfig[error].analyticsPage }); + dispatch(setFlow({ flow: Flow.ManageBackup, step: Step.DeleteBackup })); + onClickTrack({ button: "Delete sync", page: errorConfig[error].analyticsPage }); }; const understood = () => { diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/05-UnbackedError.tsx b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/05-UnbackedError.tsx index 352ea6ce0345..7e2fbd48d5b7 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/05-UnbackedError.tsx +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/05-UnbackedError.tsx @@ -13,7 +13,7 @@ export default function UnbackedError() { const dispatch = useDispatch(); const onClick = () => { onClickTrack({ - button: "Create enctryption key", + button: "Turn on Ledger Sync", page: AnalyticsPage.UnbackedError, }); dispatch(setFlow({ flow: Flow.Activation, step: Step.DeviceAction })); diff --git a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/07-ActivationAlreadyCreatedOther.tsx b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/07-ActivationAlreadyCreatedOther.tsx index bd6544fae2a3..89cbfcdd2c7d 100644 --- a/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/07-ActivationAlreadyCreatedOther.tsx +++ b/apps/ledger-live-desktop/src/newArch/features/WalletSync/screens/Synchronize/07-ActivationAlreadyCreatedOther.tsx @@ -13,7 +13,7 @@ export default function AlreadyCreatedOtherSeedStep() { const { onClickTrack } = useLedgerSyncAnalytics(); const deleteKey = () => { - dispatch(setFlow({ flow: Flow.ManageBackup, step: Step.ManageBackup })); + dispatch(setFlow({ flow: Flow.ManageBackup, step: Step.DeleteBackup })); onClickTrack({ button: "Delete sync", page: AnalyticsPage.AlreadySecuredOtherSeed, diff --git a/apps/ledger-live-desktop/src/renderer/reducers/walletSync.ts b/apps/ledger-live-desktop/src/renderer/reducers/walletSync.ts index 49bca4bb680a..72a3b2a50f3a 100644 --- a/apps/ledger-live-desktop/src/renderer/reducers/walletSync.ts +++ b/apps/ledger-live-desktop/src/renderer/reducers/walletSync.ts @@ -12,7 +12,6 @@ export enum Flow { export enum Step { //ManageBackup - ManageBackup = "ManageBackup", DeleteBackup = "DeleteBackup", BackupDeleted = "BackupDeleted", BackupDeletionError = "BackupDeletionError", diff --git a/apps/ledger-live-desktop/static/i18n/en/app.json b/apps/ledger-live-desktop/static/i18n/en/app.json index ce95bc077d6e..19366db0d936 100644 --- a/apps/ledger-live-desktop/static/i18n/en/app.json +++ b/apps/ledger-live-desktop/static/i18n/en/app.json @@ -6517,7 +6517,6 @@ "close": "Close" }, "manageBackup": { - "title": "Manage your key", "deleteBackup": { "title": "Sure you want to delete sync?", "description": "Your crypto accounts across Ledger Live apps on different phones and computers will stop being in sync. This does not impact your funds in any way. ", @@ -6569,9 +6568,9 @@ } }, "unbackedError": { - "title": "You need to create your encryption key first", - "description": "Please make sure you’ve created an encryption key on one of your Ledger Live apps before continuing your synchronization.", - "cta": "Create your encryption key" + "title": "Sync not detected", + "description": "Turn on Ledger Sync on either this Ledger Live or the one you’re syncing with", + "cta": "Turn on Ledger Sync" }, "pinCode": { "title": "Your Ledger Sync code",