Skip to content

Commit

Permalink
Merge branch 'main' into LW-10137-onboarding-tech-debt
Browse files Browse the repository at this point in the history
  • Loading branch information
oldGreg5 committed Mar 27, 2024
2 parents 9594e0e + 007b6fe commit 524429b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
Expand Up @@ -11,8 +11,8 @@ export const postHogOnboardingActions: PostHogOnboardingActionsType = {
create: {
SETUP_OPTION_CLICK: PostHogAction.OnboardingCreateClick,
SAVE_RECOVERY_PHRASE_NEXT_CLICK: PostHogAction.OnboardingCreateSaveRecoveryPhraseNextClick,
ENTER_RECOVERY_PHRASE_NEXT_CLICK: PostHogAction.OnboardingCreateEnterRecoveryPhraseNextClick,
ENTER_WALLET: PostHogAction.OnboardingCreateEnterWalletClick,
WALLET_NAME_PASSWORD_NEXT_CLICK: PostHogAction.OnboardingCreateWalletNamePasswordNextClick,
RECOVERY_PHRASE_INTRO_WATCH_VIDEO_CLICK: PostHogAction.OnboardingCreateSaveRecoveryPhraseIntroPlayVideoClick,
RECOVERY_PHRASE_INTRO_VIDEO_GOTIT_CLICK: PostHogAction.OnboardingCreateKeepWalletSecureGotItClick,
RECOVERY_PHRASE_COPY_TO_CLIPBOARD_CLICK: PostHogAction.OnboardingCreateSaveRecoveryPhraseCopyToClipboardClick,
Expand All @@ -21,7 +21,7 @@ export const postHogOnboardingActions: PostHogOnboardingActionsType = {
restore: {
SETUP_OPTION_CLICK: PostHogAction.OnboardingRestoreClick,
ENTER_WALLET: PostHogAction.OnboardingRestoreEnterWalletClick,
WALLET_NAME_PASSWORD_NEXT_CLICK: PostHogAction.OnboardingRestoreWalletNamePasswordNextClick,
ENTER_RECOVERY_PHRASE_NEXT_CLICK: PostHogAction.OnboardingRestoreEnterRecoveryPhraseNextClick,
RECOVERY_PHRASE_PASTE_FROM_CLIPBOARD_CLICK:
PostHogAction.OnboardingRestoreEnterRecoveryPhrasePasteFromClipboardClick
},
Expand All @@ -34,10 +34,9 @@ export const postHogOnboardingActions: PostHogOnboardingActionsType = {
},
// eslint-disable-next-line camelcase
forgot_password: {
WALLET_PASSWORD_NEXT_CLICK: PostHogAction.UnlockWalletForgotPasswordNextClick,
RECOVERY_PASSPHRASE_LENGTH_NEXT_CLICK: PostHogAction.UnlockWalletForgotPasswordRecoveryPhraseLengthNextClick,
ENTER_PASSPHRASE_01_NEXT_CLICK: PostHogAction.UnlockWalletForgotPasswordEnterPassphrase01NextClick,
ENTER_PASSPHRASE_09_NEXT_CLICK: PostHogAction.UnlockWalletForgotPasswordEnterPassphrase09NextClick,
ENTER_PASSPHRASE_17_NEXT_CLICK: PostHogAction.UnlockWalletForgotPasswordEnterPassphrase17NextClick
ENTER_RECOVERY_PHRASE_NEXT_CLICK: PostHogAction.UnlockWalletForgotPasswordRecoveryPhraseNextClick,
ENTER_WALLET: PostHogAction.UnlockWalletForgotPasswordEnterWalletClick,
RECOVERY_PHRASE_PASTE_FROM_CLIPBOARD_CLICK:
PostHogAction.UnlockWalletForgotPasswordRecoveryPhrasePasteFromClipboardClick
}
};
Expand Up @@ -45,23 +45,20 @@ export type PostHogActionsKeys =
| 'LEARN_MORE_CLICK'
| 'ANALYTICS_REJECT_CLICK'
| 'WALLET_NAME_NEXT_CLICK'
| 'WALLET_PASSWORD_NEXT_CLICK'
| 'SAVE_RECOVERY_PHRASE_NEXT_CLICK'
| 'ENTER_RECOVERY_PHRASE_NEXT_CLICK'
| 'ENTER_WALLET'
| 'GOT_IT_CLICK'
| 'PIN_EXTENSION_CLICK'
| 'ENTER_PASSPHRASE_01_NEXT_CLICK'
| 'ENTER_PASSPHRASE_09_NEXT_CLICK'
| 'ENTER_PASSPHRASE_17_NEXT_CLICK'
| 'RECOVERY_PASSPHRASE_LENGTH_NEXT_CLICK'
| 'CONNECT_HW_NEXT_CLICK'
| 'SETUP_HW_WALLET_NEXT_CLICK'
| 'DONE_GO_TO_WALLET'
| 'WALLET_NAME_PASSWORD_NEXT_CLICK'
| 'RECOVERY_PHRASE_INTRO_WATCH_VIDEO_CLICK'
| 'RECOVERY_PHRASE_INTRO_VIDEO_GOTIT_CLICK'
| 'RECOVERY_PHRASE_COPY_TO_CLIPBOARD_CLICK'
| 'RECOVERY_PHRASE_PASTE_FROM_CLIPBOARD_CLICK';
| 'RECOVERY_PHRASE_PASTE_FROM_CLIPBOARD_CLICK'
| 'RECOVERY_PASSPHRASE_VERIFICATION_NEXT_CLICK';
export type PostHogOnboardingActionsValueType = Partial<Record<PostHogActionsKeys, PostHogAction>>;
export type PostHogOnboardingActionsType = Partial<Record<OnboardingFlows, PostHogOnboardingActionsValueType>>;
export type PostHogPersonProperties = {
Expand Down
Expand Up @@ -213,9 +213,15 @@ export const WalletSetupWizard = ({
);

const handleSubmit = async (result: { password: string; walletName: string }) => {
sendAnalytics(postHogOnboardingActions[setupType]?.ENTER_WALLET);
await handleCompleteCreation(result.walletName, result.password);
};

const handleMnemonicVerification = () => {
sendAnalytics(postHogOnboardingActions[setupType]?.ENTER_RECOVERY_PHRASE_NEXT_CLICK);
moveForward();
};

const renderedMnemonicStep = () => {
if ([SetupType.RESTORE, SetupType.FORGOT_PASSWORD].includes(setupType)) {
const isMnemonicSubmitEnabled = util.validateMnemonic(util.joinMnemonicWords(mnemonic));
Expand All @@ -224,14 +230,14 @@ export const WalletSetupWizard = ({
mnemonic={mnemonic}
onChange={setMnemonic}
onCancel={setupType !== SetupType.FORGOT_PASSWORD && moveBack}
onSubmit={moveForward}
onSubmit={handleMnemonicVerification}
isSubmitEnabled={isMnemonicSubmitEnabled}
translations={walletSetupMnemonicStepTranslations}
suggestionList={wordList}
defaultMnemonicLength={DEFAULT_MNEMONIC_LENGTH}
onSetMnemonicLength={(value: number) => setMnemonicLength(value)}
onPasteFromClipboard={() =>
sendAnalytics(postHogOnboardingActions.restore.RECOVERY_PHRASE_PASTE_FROM_CLIPBOARD_CLICK)
sendAnalytics(postHogOnboardingActions[setupType]?.RECOVERY_PHRASE_PASTE_FROM_CLIPBOARD_CLICK)
}
/>
);
Expand Down Expand Up @@ -259,7 +265,7 @@ export const WalletSetupWizard = ({
onStepNext={(mnemonicStage) => {
mnemonicStage === 'writedown'
? sendAnalytics(postHogOnboardingActions.create.SAVE_RECOVERY_PHRASE_NEXT_CLICK)
: sendAnalytics(postHogOnboardingActions.create.ENTER_WALLET);
: sendAnalytics(postHogOnboardingActions.create.ENTER_RECOVERY_PHRASE_NEXT_CLICK);
}}
translations={walletSetupMnemonicStepTranslations}
suggestionList={wordList}
Expand Down
14 changes: 7 additions & 7 deletions packages/common/src/analytics/types.ts
Expand Up @@ -17,19 +17,19 @@ export enum PostHogAction {
OnboardingHWDoneGoToWallet = 'onboarding | hardware wallet | all done | go to my wallet | click',
// Restore wallet
OnboardingRestoreClick = 'onboarding | restore wallet revamp | restore | click',
OnboardingRestoreWalletNamePasswordNextClick = "onboarding | restore wallet revamp | let's set up your new wallet | next | click",
OnboardingRestoreEnterRecoveryPhraseNextClick = 'onboarding | restore wallet revamp | enter your recovery phrase | next | click',
OnboardingRestoreEnterRecoveryPhrasePasteFromClipboardClick = 'onboarding | restore wallet revamp | enter your recovery phrase | paste from clipboard | click',
OnboardingRestoreHdWallet = 'onboarding | restore wallet | hd wallet',
OnboardingRestoreEnterWalletClick = 'onboarding | restore wallet revamp | enter your recovery phrase | enter wallet | click',
OnboardingRestoreEnterWalletClick = "onboarding | restore wallet revamp | let's set up your new wallet | enter wallet | click",
// Create new wallet
OnboardingCreateClick = 'onboarding | new wallet revamp | create | click',
OnboardingCreateWalletNamePasswordNextClick = "onboarding | new wallet revamp | let's set up your new wallet | next | click",
OnboardingCreateSaveRecoveryPhraseNextClick = 'onboarding | new wallet revamp | save your recovery phrase | next | click',
OnboardingCreateEnterRecoveryPhraseNextClick = 'onboarding | new wallet revamp | enter your recovery phrase | next | click',
OnboardingCreateSaveRecoveryPhraseIntroPlayVideoClick = 'onboarding | new wallet revamp | save your recovery phrase | watch video | click',
OnboardingCreateSaveRecoveryPhraseCopyToClipboardClick = 'onboarding | new wallet revamp | save your recovery phrase | copy to clipboard | click',
OnboardingCreateKeepWalletSecureGotItClick = 'onboarding | new wallet revamp | keeping your wallet secure | got it | click',
OnboardingCreateEnterRecoveryPhrasePasteFromClipboardClick = 'onboarding | new wallet revamp | enter your recovery phrase | paste from clipboard | click',
OnboardingCreateEnterWalletClick = 'onboarding | new wallet revamp | enter your recovery phrase | enter wallet | click',
OnboardingCreateEnterWalletClick = "onboarding | new wallet revamp | let's set up your new wallet | enter wallet | click",
// Multi wallet
MultiWalletSwitchWallet = 'multiwallet | switch wallet | click',
MultiWalletSwitchAccount = 'multiwallet | switch account | click',
Expand Down Expand Up @@ -255,9 +255,9 @@ export enum PostHogAction {
UnlockWalletForgotPasswordCancelClick = 'unlock wallet | forgot password? | cancel | click',
UnlockWalletForgotPasswordNextClick = 'unlock wallet | forgot password? | set up your password | next | click',
UnlockWalletForgotPasswordRecoveryPhraseLengthNextClick = 'unlock wallet | forgot password? | recovery phrase length | next | click',
UnlockWalletForgotPasswordEnterPassphrase01NextClick = 'unlock wallet | forgot password? | enter passphrase #01 | next | click',
UnlockWalletForgotPasswordEnterPassphrase09NextClick = 'unlock wallet | forgot password? | enter passphrase #09 | next | click',
UnlockWalletForgotPasswordEnterPassphrase17NextClick = 'unlock wallet | forgot password? | enter passphrase #17 | next | click'
UnlockWalletForgotPasswordRecoveryPhraseNextClick = 'unlock wallet | forgot password? | enter your recovery phrase | next | click',
UnlockWalletForgotPasswordEnterWalletClick = 'unlock wallet | forgot password? | set up your password | enter wallet | click',
UnlockWalletForgotPasswordRecoveryPhrasePasteFromClipboardClick = 'unlock wallet | forgot password? | enter your recovery phrase | paste from clipboard | click'
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit 524429b

Please sign in to comment.