import { Input } from '@ballerine/ui'; import { CheckIcon, Loader2 } from 'lucide-react'; import { Button } from '@/common/components/atoms/Button/Button'; import { Dialog } from '@/common/components/organisms/Dialog/Dialog'; import { DialogContent } from '@/common/components/organisms/Dialog/Dialog.Content'; import { DialogHeader } from '@/common/components/organisms/Dialog/Dialog.Header'; import { DialogTrigger } from '@/common/components/organisms/Dialog/Dialog.Trigger'; import { Form } from '@/common/components/organisms/Form/Form'; import { FormControl } from '@/common/components/organisms/Form/Form.Control'; import { FormField } from '@/common/components/organisms/Form/Form.Field'; import { FormItem } from '@/common/components/organisms/Form/Form.Item'; import { FormLabel } from '@/common/components/organisms/Form/Form.Label'; import { FormMessage } from '@/common/components/organisms/Form/Form.Message'; import { BusinessReportsLeftCard } from '@/domains/business-reports/components/BusinessReportsLeftCard/BusinessReportsLeftCard'; import { useCustomerQuery } from '@/domains/customer/hooks/queries/useCustomerQuery/useCustomerQuery'; import { useCreateIdentityVerificationCheckDialogLogic } from './hooks/useCreateIdentityVerificationCheckDialogLogic'; import { ctw } from '@/common/utils/ctw/ctw'; import { getCountries, getCountryStates } from '@ballerine/common'; import { Select } from '@/common/components/atoms/Select/Select'; import { SelectTrigger } from '@/common/components/atoms/Select/Select.Trigger'; import { SelectValue } from '@/common/components/atoms/Select/Select.Value'; import { SelectContent } from '@/common/components/atoms/Select/Select.Content'; import { SelectGroup } from '@/common/components/atoms/Select/Select.Group'; import { SelectItem } from '@/common/components/atoms/Select/Select.Item'; type CreateIdentityVerificationCheckDialogProps = { open: boolean; toggleOpen: (val?: boolean) => void; disabled?: boolean; children: React.ReactNode; }; export const CreateIdentityVerificationCheckDialog = ({ disabled, children, open, toggleOpen: toggleOpenProps, }: CreateIdentityVerificationCheckDialogProps) => { const { form, showSuccess, isSubmitting, onSubmit, reportsLeft, demoDaysLeft, toggleOpen } = useCreateIdentityVerificationCheckDialogLogic({ toggleOpen: toggleOpenProps }); const { data: customer } = useCustomerQuery(); const isDemoAccount = customer?.config?.isDemoAccount; return ( {children}

Create Identity Verification Case

{isDemoAccount &&

Try out Ballerine's Identity Verification!

}
{showSuccess ? ( ) : ( )}
); }; const CreateIdentityVerificationSuccessContent = () => { const { data: customer } = useCustomerQuery(); const isDemoAccount = customer?.config?.isDemoAccount; return (

Your identity verification case is being processed.

{isDemoAccount &&

Ready in up to 24 hours

} You will receive an email alert once the verification is complete.
); }; type CreateMerchantReportDialogFormContentProps = Pick< ReturnType, 'form' | 'onSubmit' | 'isSubmitting' | 'demoDaysLeft' | 'reportsLeft' >; const CreateIdentityVerificationCheckDialogFormContent = ({ form, onSubmit, isSubmitting, demoDaysLeft, reportsLeft, }: CreateMerchantReportDialogFormContentProps) => { const shouldDisableForm = (reportsLeft && reportsLeft <= 0) || (demoDaysLeft && demoDaysLeft <= 0); const { data: customer } = useCustomerQuery(); const isDemoAccount = customer?.config?.isDemoAccount; return (
{isDemoAccount && ( )}
{shouldDisableForm && (
)}
( First Name )} /> ( Last Name )} /> ( Date of Birth )} /> { const countries = getCountries('en'); const availableCountries = countries.map(country => ({ value: country.const, label: country.title, })); return ( Country
); }} /> { const selectedCountry = form.watch('country'); const states = selectedCountry ? getCountryStates(selectedCountry) : []; const availableStates = states.map(state => ({ value: state.isoCode, label: state.name, })); const hasStates = availableStates.length > 0; return ( State/Province
); }} />
); };