1 import { c } from 'ttag';
3 import { Button } from '@proton/atoms';
4 import type { ModalProps } from '@proton/components/components/modalTwo/Modal';
5 import useModalState from '@proton/components/components/modalTwo/useModalState';
6 import Prompt from '@proton/components/components/prompt/Prompt';
7 import AuthModal from '@proton/components/containers/password/AuthModal';
8 import useEventManager from '@proton/components/hooks/useEventManager';
9 import useNotifications from '@proton/components/hooks/useNotifications';
10 import { disableMnemonicPhrase } from '@proton/shared/lib/api/settingsMnemonic';
12 interface DisableMnemonicModalProps {
13 onClose: ModalProps['onClose'];
14 onExit: ModalProps['onExit'];
15 open: ModalProps['open'];
18 const DisableMnemonicModal = ({ open, onClose, onExit }: DisableMnemonicModalProps) => {
19 const [authModalProps, setAuthModalOpen, renderAuthModal] = useModalState();
21 const { createNotification } = useNotifications();
22 const { call } = useEventManager();
29 config={disableMnemonicPhrase()}
32 onSuccess={async () => {
35 createNotification({ text: c('Info').t`Recovery phrase has been disabled` });
41 title={c('Action').t`Disable recovery phrase?`}
43 <Button color="danger" onClick={() => setAuthModalOpen(true)}>
44 {c('Action').t`Disable recovery phrase`}
46 <Button onClick={onClose}>{c('Action').t`Cancel`}</Button>,
51 <p className="mt-0">{c('Info')
52 .t`This will disable your current recovery phrase. You won't be able to use it to access your account or decrypt your data.`}</p>
53 <p className="mb-0">{c('Info')
54 .t`Enabling recovery by phrase again will generate a new recovery phrase.`}</p>
60 export default DisableMnemonicModal;