diff --git a/apps/legacy/src/localization/locales/en/translation.json b/apps/legacy/src/localization/locales/en/translation.json index 25e5b65a3..0adcae0cb 100644 --- a/apps/legacy/src/localization/locales/en/translation.json +++ b/apps/legacy/src/localization/locales/en/translation.json @@ -500,7 +500,6 @@ "Invalid QR Code": "Invalid QR Code", "Invalid amount": "Invalid amount", "Invalid code": "Invalid code", - "Invalid code. Please try again.": "Invalid code. Please try again.", "Invalid key. Please re-enter the key.": "Invalid key. Please re-enter the key.", "Invalid mnemonic phrase": "Invalid mnemonic phrase", "Invalid params": "Invalid params", @@ -963,9 +962,11 @@ "The active account does not support Bitcoin.": "The active account does not support Bitcoin.", "The amount cannot be lower than the bridging fee": "The amount cannot be lower than the bridging fee", "The bridging fee is unknown": "The bridging fee is unknown", + "The code you entered is incorrect. Please try again": "The code you entered is incorrect. Please try again", "The inputs of this transaction are greater than the output. Continuing will cause you to lose funds associated with this UTXO.": "The inputs of this transaction are greater than the output. Continuing will cause you to lose funds associated with this UTXO.", "The operation either timed out or was not allowed.": "The operation either timed out or was not allowed.", "The operation either timed out or was not allowed. Please try again.": "The operation either timed out or was not allowed. Please try again.", + "The operation was not completed. Please try again.": "The operation was not completed. Please try again.", "The prices of some tokens are missing. The balance might not be accurate currently.": "The prices of some tokens are missing. The balance might not be accurate currently.", "The provided chainID does not match the selected network. Pressing “Continue” will reject the transaction. Please switch networks and try again.": "The provided chainID does not match the selected network. Pressing “Continue” will reject the transaction. Please switch networks and try again.", "The secret key can be assigned by the Fireblocks workspace admin": "The secret key can be assigned by the Fireblocks workspace admin", diff --git a/apps/next/src/localization/locales/en/translation.json b/apps/next/src/localization/locales/en/translation.json index 690ac3481..2d63074e3 100644 --- a/apps/next/src/localization/locales/en/translation.json +++ b/apps/next/src/localization/locales/en/translation.json @@ -226,6 +226,7 @@ "Do you really want to save?": "Do you really want to save?", "Do you want to add Solana to your wallet?": "Do you want to add Solana to your wallet?", "Do you want to allow {{dappUrl}} to access your wallet?": "Do you want to allow {{dappUrl}} to access your wallet?", + "Do you want to go back?": "Do you want to go back?", "Do you want to sign this message?": "Do you want to sign this message?", "Done": "Done", "Download Ledger Live to update": "Download Ledger Live to update", @@ -313,7 +314,9 @@ "Get free gas": "Get free gas", "Get signature": "Get signature", "Get started by adding crypto to your wallet": "Get started by adding crypto to your wallet", + "Go Back": "Go Back", "Go to cross-chain transfer": "Go to cross-chain transfer", + "Going back will take you to the beginning of the onboarding flow. You will need to re-verify the MFA you just set up before continuing with account creation.": "Going back will take you to the beginning of the onboarding flow. You will need to re-verify the MFA you just set up before continuing with account creation.", "Governance": "Governance", "Grant access": "Grant access", "Header name": "Header name", @@ -364,7 +367,6 @@ "Invalid Solana address": "Invalid Solana address", "Invalid amount": "Invalid amount", "Invalid code": "Invalid code", - "Invalid code. Please try again.": "Invalid code. Please try again.", "Invalid params": "Invalid params", "Invalid password": "Invalid password", "Invalid password. Please try again.": "Invalid password. Please try again.", @@ -676,11 +678,13 @@ "The amount cannot be lower than the bridging fee": "The amount cannot be lower than the bridging fee", "The base fee is set by the network and changes frequently. Any difference between the set max base fee and the actual base fee will be refunded.": "The base fee is set by the network and changes frequently. Any difference between the set max base fee and the actual base fee will be refunded.", "The bridging fee is unknown": "The bridging fee is unknown", + "The code you entered is incorrect. Please try again": "The code you entered is incorrect. Please try again", "The displayed token list might be incomplete.": "The displayed token list might be incomplete.", "The export process could not be completed. Please try again.": "The export process could not be completed. Please try again.", "The field is required": "The field is required", "The key you entered is invalid. Please try again": "The key you entered is invalid. Please try again", "The operation either timed out or was not allowed. Please try again.": "The operation either timed out or was not allowed. Please try again.", + "The operation was not completed. Please try again.": "The operation was not completed. Please try again.", "The priority fee is an incentive paid to network operators to prioritize processing of this transaction.": "The priority fee is an incentive paid to network operators to prioritize processing of this transaction.", "The recovery phrase your entered is invalid. Please double check for spelling mistakes or the order of each word": "The recovery phrase your entered is invalid. Please double check for spelling mistakes or the order of each word", "The transaction has been reverted": "The transaction has been reverted", diff --git a/apps/next/src/pages/Onboarding/flows/SeedlessFlow/SeedlessFlow.tsx b/apps/next/src/pages/Onboarding/flows/SeedlessFlow/SeedlessFlow.tsx index 2d83767df..1ef9c228c 100644 --- a/apps/next/src/pages/Onboarding/flows/SeedlessFlow/SeedlessFlow.tsx +++ b/apps/next/src/pages/Onboarding/flows/SeedlessFlow/SeedlessFlow.tsx @@ -1,5 +1,5 @@ import { WalletType } from '@avalabs/types'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import { Route, Switch, useHistory } from 'react-router-dom'; import { useOnboardingContext } from '@core/ui'; @@ -13,6 +13,7 @@ import { SelectAvatarScreen, } from '../../common-screens'; import { SeedlessMfaLoginFlow, SeedlessMfaSetupFlow } from './subflows'; +import { VerifyGoBackModal } from './screens/VerifyGoBackModal'; const BASE_PATH = '/onboarding/seedless'; const TOTAL_STEPS = 6; @@ -22,6 +23,8 @@ export const SeedlessFlow = () => { const { setOnboardingWalletType, oidcToken, onboardingState } = useOnboardingContext(); + const [isVerifyGoBackModalOpen, setIsVerifyGoBackModalOpen] = useState(false); + useEffect(() => { setOnboardingWalletType(WalletType.Seedless); @@ -37,49 +40,60 @@ export const SeedlessFlow = () => { }, [oidcToken, history, onboardingState.isOnBoarded]); return ( - - - - - - - - - - history.push(`${BASE_PATH}/customize-core`)} - /> - - - history.push(`${BASE_PATH}/select-avatar`)} - /> - - - history.push(`${BASE_PATH}/enjoy-your-wallet`)} - /> - - - - - - + <> + setIsVerifyGoBackModalOpen(true)} + > + + + + + + + + + history.push(`${BASE_PATH}/customize-core`)} + /> + + + history.push(`${BASE_PATH}/select-avatar`)} + /> + + + history.push(`${BASE_PATH}/enjoy-your-wallet`)} + /> + + + + + + + { + history.push('/onboarding'); + }} + onCancel={() => { + setIsVerifyGoBackModalOpen(false); + }} + /> + ); }; diff --git a/apps/next/src/pages/Onboarding/flows/SeedlessFlow/screens/SeedlessVerifyWithTotp.tsx b/apps/next/src/pages/Onboarding/flows/SeedlessFlow/screens/SeedlessVerifyWithTotp.tsx index bc0292dbc..8bb52b4ef 100644 --- a/apps/next/src/pages/Onboarding/flows/SeedlessFlow/screens/SeedlessVerifyWithTotp.tsx +++ b/apps/next/src/pages/Onboarding/flows/SeedlessFlow/screens/SeedlessVerifyWithTotp.tsx @@ -12,6 +12,8 @@ import { } from '@/components/FullscreenModal'; import { TotpCodeField } from '@/components/TotpCodeField'; import { NavButton } from '@/pages/Onboarding/components/NavButton'; +import { Stack, Typography, useTheme } from '@avalabs/k2-alpine'; +import { FiAlertCircle } from 'react-icons/fi'; type SeedlessVerifyWithTotpProps = { onSubmit: (code: string) => void; @@ -24,6 +26,7 @@ export const SeedlessVerifyWithTotp: FC = ({ isLoading, error, }) => { + const theme = useTheme(); const { t } = useTranslation(); const [code, setCode] = useState(''); @@ -41,11 +44,12 @@ export const SeedlessVerifyWithTotp: FC = ({ { setCode(e.target.value); if (error && !isLoading) { @@ -59,6 +63,18 @@ export const SeedlessVerifyWithTotp: FC = ({ } }} /> + {isSubmitted && totpError && ( + + + + {totpError} + + + )} void; + onCancel: () => void; +} + +export const VerifyGoBackModal: FC = ({ + isOpen, + onBack, + onCancel, +}: VerifyGoBackModalProps) => { + const theme = useTheme(); + const { t } = useTranslation(); + + return ( + + + + + + + {t('Do you want to go back?')} + + + {t( + 'Going back will take you to the beginning of the onboarding flow. You will need to re-verify the MFA you just set up before continuing with account creation.', + )} + + + + + + + + + + ); +}; diff --git a/apps/next/src/pages/Onboarding/flows/SeedlessFlow/subflows/SeedlessFidoSetupFlow.tsx b/apps/next/src/pages/Onboarding/flows/SeedlessFlow/subflows/SeedlessFidoSetupFlow.tsx index 116d6e283..f61004c79 100644 --- a/apps/next/src/pages/Onboarding/flows/SeedlessFlow/subflows/SeedlessFidoSetupFlow.tsx +++ b/apps/next/src/pages/Onboarding/flows/SeedlessFlow/subflows/SeedlessFidoSetupFlow.tsx @@ -97,6 +97,7 @@ export const SeedlessFidoSetupFlow: FC = ({ isLoading={isLoading} onRetry={() => registerFidoKey(name)} onCancel={history.goBack} + error={error} /> )} {step === 'verify' && ( diff --git a/packages/ui/src/hooks/useFidoErrorMessage.ts b/packages/ui/src/hooks/useFidoErrorMessage.ts index 454d503d7..112d81cee 100644 --- a/packages/ui/src/hooks/useFidoErrorMessage.ts +++ b/packages/ui/src/hooks/useFidoErrorMessage.ts @@ -15,6 +15,10 @@ export const useFidoErrorMessage = (code?: AuthErrorCode): string => { ); } + if (code === AuthErrorCode.FidoConfigurationError) { + return t('The operation was not completed. Please try again.'); + } + if (code === AuthErrorCode.UnknownError) { return t('An unexpected error occurred. Please try again.'); } diff --git a/packages/ui/src/hooks/useTotpErrorMessage.ts b/packages/ui/src/hooks/useTotpErrorMessage.ts index a62f1e565..6cf6d2855 100644 --- a/packages/ui/src/hooks/useTotpErrorMessage.ts +++ b/packages/ui/src/hooks/useTotpErrorMessage.ts @@ -5,7 +5,7 @@ export const useTotpErrorMessage = (code?: AuthErrorCode): string => { const { t } = useTranslation(); if (code === AuthErrorCode.InvalidTotpCode) { - return t('Invalid code. Please try again.'); + return t('The code you entered is incorrect. Please try again'); } if (code === AuthErrorCode.TotpVerificationError) {