Skip to content

Commit

Permalink
fix: resolve missing analytics issue
Browse files Browse the repository at this point in the history
  • Loading branch information
greatertomi committed May 6, 2024
1 parent dd13595 commit 91dea81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,14 @@ export const WalletSetupWizard = ({
<WalletSetupMnemonicStepRevamp
mnemonic={mnemonic}
mnemonicStage={currentSetupMnemonicStage}
onStageChange={(nextStage) => {
onStageChange={({ nextStage, direction }) => {
if (nextStage === 'input') {
setCurrentSetupMnemonicStage(nextStage);
void sendAnalytics(postHogOnboardingActions.create.SAVE_RECOVERY_PHRASE_NEXT_CLICK);
} else if (nextStage === 'writedown' && direction === 'next') {
void sendAnalytics(postHogOnboardingActions.create.ENTER_RECOVERY_PHRASE_NEXT_CLICK);
} else {
setIsResetMnemonicModalOpen(true);
void sendAnalytics(postHogOnboardingActions.create.ENTER_RECOVERY_PHRASE_NEXT_CLICK);
}
}}
onBack={onCancel}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ import { useKeyboardShortcut } from '@lace/common';

export type MnemonicStage = 'writedown' | 'input';

type StateChangeParams = {
nextStage: MnemonicStage;
direction: 'next' | 'back';
};

export interface WalletSetupMnemonicStepProps {
mnemonic: string[];
mnemonicStage: MnemonicStage;
onBack: () => void;
onNext: () => void;
onStageChange?: (currentStage: MnemonicStage) => void;
onStageChange?: ({ nextStage, direction }: StateChangeParams) => void;
translations: TranslationsFor<{
jsxElementKey: 'copyPasteTooltipText';
stringKey:
Expand Down Expand Up @@ -106,16 +111,17 @@ export const WalletSetupMnemonicStepRevamp = ({
onBack();
}
setMnemonicConfirm(mnemonic.map(() => ''));
onStageChange('writedown');
onStageChange({ nextStage: 'writedown', direction: 'back' });
};

const handleNext = () => {
if (mnemonicStage === 'input') {
onNext();
onStageChange({ nextStage: 'writedown', direction: 'next' });
return;
}
setMnemonicConfirm(mnemonic.map(() => ''));
onStageChange('input');
onStageChange({ nextStage: 'input', direction: 'next' });
};

const title = mnemonicStage === 'writedown' ? translations.writePassphraseTitle : translations.enterPassphrase;
Expand Down

0 comments on commit 91dea81

Please sign in to comment.