diff --git a/apps/browser-extension-wallet/.env.defaults b/apps/browser-extension-wallet/.env.defaults index f31c60662..0296fc349 100644 --- a/apps/browser-extension-wallet/.env.defaults +++ b/apps/browser-extension-wallet/.env.defaults @@ -22,7 +22,6 @@ USE_HIDE_MY_BALANCE=true USE_ADA_HANDLE=true USE_DATA_CHECK=false USE_POSTHOG_ANALYTICS=true -USE_COMBINED_PASSWORD_NAME_STEP_COMPONENT=false # TODO Remove redundant feature flags when Trezor and Ledger are supported (https://input-output.atlassian.net/browse/LW-9480) USE_MULTI_DELEGATION_STAKING_LEDGER=false USE_MULTI_DELEGATION_STAKING_TREZOR=false diff --git a/apps/browser-extension-wallet/.env.developerpreview b/apps/browser-extension-wallet/.env.developerpreview index 80566178a..402fe136f 100644 --- a/apps/browser-extension-wallet/.env.developerpreview +++ b/apps/browser-extension-wallet/.env.developerpreview @@ -23,7 +23,6 @@ USE_MULTI_DELEGATION_STAKING=true USE_ADA_HANDLE=false USE_DATA_CHECK=false USE_POSTHOG_ANALYTICS=true -USE_COMBINED_PASSWORD_NAME_STEP_COMPONENT=false USE_MULTI_DELEGATION_STAKING_ACTIVITY=false USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false diff --git a/apps/browser-extension-wallet/.env.example b/apps/browser-extension-wallet/.env.example index 740202ad9..358e8ed7b 100644 --- a/apps/browser-extension-wallet/.env.example +++ b/apps/browser-extension-wallet/.env.example @@ -25,7 +25,6 @@ USE_HANDLE_AB=false USE_DATA_CHECK=false USE_POSTHOG_ANALYTICS=true USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false -USE_COMBINED_PASSWORD_NAME_STEP_COMPONENT=false USE_MULTI_DELEGATION_STAKING_ACTIVITY=true USE_MULTI_DELEGATION_STAKING_GRID_VIEW=false USE_ROS_STAKING_COLUMN=false diff --git a/apps/browser-extension-wallet/src/lib/translations/en.json b/apps/browser-extension-wallet/src/lib/translations/en.json index 2596248f3..d5e5ef609 100644 --- a/apps/browser-extension-wallet/src/lib/translations/en.json +++ b/apps/browser-extension-wallet/src/lib/translations/en.json @@ -1283,10 +1283,20 @@ "passphraseInfo3": "Find out more.", "passphraseError": "Make sure the words of your recovery phrase are in the right order and spelled correctly." }, - "walletSetupMnemonicIntroStep": { + "walletSetupMnemonicStepRevamp": { + "writePassphraseTitle": "Save your recovery phrase", + "enterPassphrase": "Enter your secret passphrase", + "enterPassphraseDescription": "Please enter each word of your recovery phrase in the right order to verify it and recover your wallet.", + "body": "Now let's check you've got the correct secret passphrase. Enter each word of your passphrase in the right order to verify it.", + "writePassphraseSubtitle1": "Consider your recovery phrase as the master key to your wallet.", + "writePassphraseSubtitle2": "Watch video.", + "passphraseError": "Make sure the words of your recovery phrase are in the right order and spelled correctly." + }, + "mnemonicVideoPopupContent": { "title": "Keeping your wallet secure", - "description": "Consider your recovery phrase as the master key to your wallet, and the only way to access your funds.", - "link": "Read More." + "description": "Learn about what is a recovery phrase, and how to keep it safe from the video below.", + "link": "Read More.", + "closeButton": "Got it" }, "walletSetupMnemonicVerificationStep": { "enterPassphrase": "Enter your secret passphrase" diff --git a/apps/browser-extension-wallet/src/views/browser-view/features/wallet-setup/components/WalletSetupWizard.tsx b/apps/browser-extension-wallet/src/views/browser-view/features/wallet-setup/components/WalletSetupWizard.tsx index eec47d192..dbc60ed77 100644 --- a/apps/browser-extension-wallet/src/views/browser-view/features/wallet-setup/components/WalletSetupWizard.tsx +++ b/apps/browser-extension-wallet/src/views/browser-view/features/wallet-setup/components/WalletSetupWizard.tsx @@ -9,7 +9,7 @@ import { WalletSetupCreationStep, WalletSetupFinalStep, WalletSetupLegalStep, - WalletSetupMnemonicIntroStep, + MnemonicVideoPopupContent, WalletSetupNamePasswordStep, WalletSetupPasswordStep, WalletSetupRecoveryPhraseLengthStep, @@ -44,23 +44,12 @@ import { isScriptAddress } from '@cardano-sdk/wallet'; import { filter, firstValueFrom } from 'rxjs'; import { useWalletStore } from '@src/stores'; -const isCombinedPasswordNameStepEnabled = process.env.USE_COMBINED_PASSWORD_NAME_STEP_COMPONENT === 'true'; -const walletSetupWizardForABTest = { - ...walletSetupWizard, - [WalletSetupSteps.PreMnemonic]: { ...walletSetupWizard['pre-mnemonic'], prev: WalletSetupSteps.Register }, - [WalletSetupSteps.RecoveryPhraseLength]: { - ...walletSetupWizard['recovery-phrase-length'], - prev: WalletSetupSteps.Register - }, - [WalletSetupSteps.Mnemonic]: { ...walletSetupWizard.mnemonic, prev: WalletSetupSteps.Register } -}; - const WalletSetupModeStep = React.lazy(() => import('@lace/core').then((module) => ({ default: module.WalletSetupModeStep })) ); -const WalletSetupMnemonicStep = React.lazy(() => - import('@lace/core').then((module) => ({ default: module.WalletSetupMnemonicStep })) +const WalletSetupMnemonicStepRevamp = React.lazy(() => + import('@lace/core').then((module) => ({ default: module.WalletSetupMnemonicStepRevamp })) ); const WalletSetupMnemonicVerificationStep = React.lazy(() => @@ -145,14 +134,13 @@ export const WalletSetupWizard = ({ }; const walletSetupMnemonicStepTranslations = { - writePassphrase: t('core.walletSetupMnemonicStep.writePassphrase'), - body: t('core.walletSetupMnemonicStep.body'), - enterPassphrase: t('core.walletSetupMnemonicStep.enterPassphrase'), - enterPassphraseDescription: t('core.walletSetupMnemonicStep.enterPassphraseDescription'), - passphraseInfo1: t('core.walletSetupMnemonicStep.passphraseInfo1'), - passphraseInfo2: t('core.walletSetupMnemonicStep.passphraseInfo2'), - passphraseInfo3: t('core.walletSetupMnemonicStep.passphraseInfo3'), - passphraseError: t('core.walletSetupMnemonicStep.passphraseError') + writePassphraseTitle: t('core.walletSetupMnemonicStepRevamp.writePassphraseTitle'), + body: t('core.walletSetupMnemonicStepRevamp.body'), + enterPassphrase: t('core.walletSetupMnemonicStepRevamp.enterPassphrase'), + enterPassphraseDescription: t('core.walletSetupMnemonicStepRevamp.enterPassphraseDescription'), + writePassphraseSubtitle1: t('core.walletSetupMnemonicStepRevamp.writePassphraseSubtitle1'), + writePassphraseSubtitle2: t('core.walletSetupMnemonicStepRevamp.writePassphraseSubtitle2'), + passphraseError: t('core.walletSetupMnemonicStepRevamp.passphraseError') }; const walletSetupModeStepTranslations = { @@ -179,10 +167,11 @@ export const WalletSetupWizard = ({ followDiscord: t('core.walletSetupFinalStep.followDiscord') }; - const walletSetupMnemonicIntroStepTranslations = { - title: t('core.walletSetupMnemonicIntroStep.title'), - description: t('core.walletSetupMnemonicIntroStep.description'), - linkText: t('core.walletSetupMnemonicIntroStep.link') + const mnemonicVideoPopupContentTranslations = { + title: t('core.mnemonicVideoPopupContent.title'), + description: t('core.mnemonicVideoPopupContent.description'), + linkText: t('core.mnemonicVideoPopupContent.link'), + closeButton: t('core.mnemonicVideoPopupContent.closeButton') }; const walletSetupRegisterStepTranslations = { @@ -228,9 +217,7 @@ export const WalletSetupWizard = ({ }, [currentStep, setCurrentStep]); const moveBack = () => { - const prevStep = isCombinedPasswordNameStepEnabled - ? walletSetupWizardForABTest[currentStep].prev - : walletSetupWizard[currentStep].prev; + const prevStep = walletSetupWizard[currentStep].prev; if (prevStep) { setCurrentStep(prevStep); @@ -332,7 +319,7 @@ export const WalletSetupWizard = ({ const createFlowPasswordNextStep = () => { setupType === SetupType.CREATE - ? skipTo(WalletSetupSteps.PreMnemonic) + ? skipTo(WalletSetupSteps.Mnemonic) : useDifferentMnemonicLengths ? skipTo(WalletSetupSteps.RecoveryPhraseLength) : skipTo(WalletSetupSteps.Mnemonic); @@ -400,32 +387,25 @@ export const WalletSetupWizard = ({ } return ( - { setResetMnemonicStage(resetStage); setIsResetMnemonicModalOpen(true); }} + renderVideoPopupContent={({ onClose }) => ( + { + // TODO: https://input-output.atlassian.net/browse/LW-9761 handle analytics here based on the stage argument + }} + videoSrc={process.env.YOUTUBE_RECOVERY_PHRASE_VIDEO_URL} + onClose={onClose} + /> + )} onNext={moveForward} - onStepNext={(stage: MnemonicStage, step: number) => { - /* eslint-disable no-magic-numbers */ - switch (step) { - case 0: - stage === 'input' - ? sendAnalytics(postHogOnboardingActions[setupType]?.ENTER_PASSPHRASE_01_NEXT_CLICK) - : sendAnalytics(postHogOnboardingActions[setupType]?.WRITE_PASSPHRASE_01_NEXT_CLICK); - break; - case 1: - stage === 'input' - ? sendAnalytics(postHogOnboardingActions[setupType]?.ENTER_PASSPHRASE_09_NEXT_CLICK) - : sendAnalytics(postHogOnboardingActions[setupType]?.WRITE_PASSPHRASE_09_NEXT_CLICK); - break; - case 2: - stage === 'input' - ? sendAnalytics(postHogOnboardingActions[setupType]?.ENTER_PASSPHRASE_17_NEXT_CLICK) - : sendAnalytics(postHogOnboardingActions[setupType]?.WRITE_PASSPHRASE_17_NEXT_CLICK); - } - /* eslint-enable no-magic-numbers */ + onStepNext={() => { + // TODO: https://input-output.atlassian.net/browse/LW-9761 handle analytics here based on the stage argument }} translations={walletSetupMnemonicStepTranslations} suggestionList={wordList} @@ -468,20 +448,6 @@ export const WalletSetupWizard = ({ translations={walletSetupAnalyticsStepTranslations} /> )} - {currentStep === WalletSetupSteps.PreMnemonic && ( - { - analytics.sendEventToPostHog(postHogOnboardingActions[setupType]?.PASSPHRASE_INTRO_NEXT_CLICK); - moveForward(); - }} - translations={walletSetupMnemonicIntroStepTranslations} - onClickVideo={() => - analytics.sendEventToPostHog(postHogOnboardingActions[setupType]?.PASSPHRASE_INTRO_PLAY_VIDEO_CLICK) - } - videoSrc={process.env.YOUTUBE_RECOVERY_PHRASE_VIDEO_URL} - /> - )} {currentStep === WalletSetupSteps.Mnemonic && ( }>{renderedMnemonicStep()} )} diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 061156c40..838ed20bc 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -19,6 +19,7 @@ export * from '@ui/components/InfoWallet'; export * from '@ui/components/OutputSummary'; export * from '@ui/components/OutputSummaryList'; export * from '@ui/components/WalletSetup'; +export * from '@ui/components/WalletSetupRevamp'; export * from '@ui/components/ConnectedDapp'; export * from '@ui/components/SendReceive'; export * from '@ui/components/DappInfo'; diff --git a/packages/core/src/ui/components/WalletSetup/wallet-steps.common.ts b/packages/core/src/ui/components/WalletSetup/wallet-steps.common.ts index b41208b11..feb5c94fe 100644 --- a/packages/core/src/ui/components/WalletSetup/wallet-steps.common.ts +++ b/packages/core/src/ui/components/WalletSetup/wallet-steps.common.ts @@ -2,7 +2,6 @@ export enum WalletSetupSteps { Legal = 'legal', Analytics = 'analytics', Mode = 'mode', - PreMnemonic = 'pre-mnemonic', Mnemonic = 'mnemonic', Register = 'register', Password = 'password', diff --git a/packages/core/src/ui/components/WalletSetup/wallet-steps.ts b/packages/core/src/ui/components/WalletSetup/wallet-steps.ts index 6e1e14cd1..c49ca7e67 100644 --- a/packages/core/src/ui/components/WalletSetup/wallet-steps.ts +++ b/packages/core/src/ui/components/WalletSetup/wallet-steps.ts @@ -20,12 +20,8 @@ export const walletSetupWizard: WalletSetupWizard = { prev: WalletSetupSteps.Password, next: WalletSetupSteps.Mnemonic }, - [WalletSetupSteps.PreMnemonic]: { - prev: WalletSetupSteps.Password, - next: WalletSetupSteps.Mnemonic - }, [WalletSetupSteps.Mnemonic]: { - prev: WalletSetupSteps.PreMnemonic, + prev: WalletSetupSteps.Password, next: WalletSetupSteps.Create }, [WalletSetupSteps.Create]: { diff --git a/packages/core/src/ui/components/WalletSetupRevamp/MnemonicVideoPopupContent.module.scss b/packages/core/src/ui/components/WalletSetupRevamp/MnemonicVideoPopupContent.module.scss new file mode 100644 index 000000000..4883ac80d --- /dev/null +++ b/packages/core/src/ui/components/WalletSetupRevamp/MnemonicVideoPopupContent.module.scss @@ -0,0 +1,52 @@ +@import '../../../../../common/src/ui/styles/abstracts/typography'; + +.container { + height: 100%; + display: flex; + flex-direction: column; + gap: size_unit(6); + + .content { + display: flex; + flex-direction: column; + gap: size_unit(2); + + .title { + @include text-heading; + color: var(--text-color-primary, #3d3b39); + margin: 0; + } + + .description { + font-size: var(--body) !important; + line-height: size_unit(3) !important; + color: var(--text-color-primary, #3d3b39); + margin: 0; + } + + .videoContainer { + position: relative; + height: 272px; + border-radius: 16px; + border: 1px solid #efefef; + + .overlay { + z-index: 1; + position: absolute; + width: 100%; + height: 100%; + border-radius: 16px; + top: 0; + left: 0; + opacity: 0; + } + + .video { + width: 100%; + height: 100%; + border-radius: 16px; + border: none; + } + } + } +} diff --git a/packages/core/src/ui/components/WalletSetupRevamp/MnemonicVideoPopupContent.tsx b/packages/core/src/ui/components/WalletSetupRevamp/MnemonicVideoPopupContent.tsx new file mode 100644 index 000000000..b3c003ebd --- /dev/null +++ b/packages/core/src/ui/components/WalletSetupRevamp/MnemonicVideoPopupContent.tsx @@ -0,0 +1,55 @@ +import { Button } from '@lace/ui'; +import { TranslationsFor } from '@ui/utils/types'; +import { urls } from '@ui/utils/constants'; +import React, { ReactElement, useRef, useState } from 'react'; +import styles from './MnemonicVideoPopupContent.module.scss'; + +type MnemonicVideoPopupContentProps = { + onClickVideo: () => void; + onClose: () => void; + translations: TranslationsFor<'title' | 'description' | 'linkText' | 'closeButton'>; + videoSrc: string; +}; + +export const MnemonicVideoPopupContent = ({ + onClickVideo, + onClose, + translations, + videoSrc +}: MnemonicVideoPopupContentProps): ReactElement => { + const [overlayVisible, setOverlayVisible] = useState(true); + const videoRef = useRef(); + + return ( +
+
+

{translations.title}

+

+ {translations.description}{' '} + + {translations.linkText} + +

+
{ + setOverlayVisible(false); + videoRef.current.src += '&autoplay=1'; + onClickVideo(); + }} + > + {overlayVisible &&
} +