1 import type { ReactNode } from 'react';
3 import { c } from 'ttag';
5 import { Button, Card } from '@proton/atoms';
6 import Copy from '@proton/components/components/button/Copy';
7 import Icon from '@proton/components/components/icon/Icon';
8 import Loader from '@proton/components/components/loader/Loader';
9 import useNotifications from '@proton/components/hooks/useNotifications';
10 import downloadFile from '@proton/shared/lib/helpers/downloadFile';
12 export const MnemonicPhraseStepContent = ({
21 const { createNotification } = useNotifications();
23 const onCopy = () => {
24 createNotification({ text: c('Info').t`Recovery phrase copied to clipboard` });
35 .t`Your recovery phrase is a series of 12 randomly generated words in a specific order.`}
38 <p className="color-warning">
39 <Icon className="mr-2 float-left mt-1" name="exclamation-circle-filled" />
42 .t`Please keep it safe. You'll need it to access your account and decrypt your data in case of a password reset.`}
47 {!mnemonic || loading ? (
51 <span className="text-semibold">{c('Label').t`Recovery phrase`}</span>
52 <Card className="mt-2 flex justify-space-between items-center flex-nowrap" bordered={false} rounded>
53 <span className="mr-2" data-testid="account:recovery:generatedRecoveryPhrase">
56 <Copy className="bg-norm shrink-0" value={mnemonic} onCopy={onCopy} />
64 interface MnemonicPhraseStepButtonsProps {
69 export const MnemonicPhraseStepButtons = ({ mnemonic, disabled, onDone }: MnemonicPhraseStepButtonsProps) => {
70 const { createNotification } = useNotifications();
72 const handleDownload = async () => {
77 const blob = new Blob([mnemonic], { type: 'text/plain;charset=utf-8' });
78 downloadFile(blob, `proton_recovery_phrase.txt`);
79 createNotification({ text: c('Info').t`Recovery phrase downloaded` });
84 <Button disabled={!mnemonic || disabled} onClick={onDone}>
87 <Button disabled={!mnemonic || disabled} onClick={handleDownload} color="norm">
88 {c('Action').t`Download`}