-
Notifications
You must be signed in to change notification settings - Fork 331
/
Copy pathUVFactorTwoPhoneCodeCard.tsx
30 lines (25 loc) · 1.12 KB
/
UVFactorTwoPhoneCodeCard.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { useSession } from '@clerk/shared/react';
import type { PhoneCodeFactor } from '@clerk/types';
import { Flow, localizationKeys } from '../../customizables';
import type { UVFactorTwoCodeCard } from './UVFactorTwoCodeForm';
import { UVFactorTwoCodeForm } from './UVFactorTwoCodeForm';
type UVFactorTwoPhoneCodeCardProps = UVFactorTwoCodeCard & { factor: PhoneCodeFactor };
export const UVFactorTwoPhoneCodeCard = (props: UVFactorTwoPhoneCodeCardProps) => {
const { session } = useSession();
const prepare = () => {
const { phoneNumberId, strategy } = props.factor;
return session!.prepareSecondFactorVerification({ phoneNumberId, strategy });
};
return (
<Flow.Part part='phoneCode2Fa'>
<UVFactorTwoCodeForm
{...props}
cardTitle={localizationKeys('reverification.phoneCodeMfa.title')}
cardSubtitle={localizationKeys('reverification.phoneCodeMfa.subtitle')}
inputLabel={localizationKeys('reverification.phoneCodeMfa.formTitle')}
resendButton={localizationKeys('reverification.phoneCodeMfa.resendButton')}
prepare={prepare}
/>
</Flow.Part>
);
};