UNPKG

@adyen/kyc-components

Version:

This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.

1,236 lines 203 kB
try { let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack; n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "8960788a-b45f-4234-ba3e-f20864f53168", e._sentryDebugIdIdentifier = "sentry-dbid-8960788a-b45f-4234-ba3e-f20864f53168"); } catch (e) {} import { i as Typography, o as createLogger, r as useTranslation, t as Trans } from "./translation-BFxyJ1c5.js"; import { n as IconButton, r as Loader, t as Button } from "./Button-oj6H8OrC.js"; import { n as httpGet, r as httpPost, s as useApiContext } from "./http-D1NDkBxF.js"; import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js"; import { t as getLegalEntityCountry } from "./getLegalEntityCountry-C6bSV6sB.js"; import { t as useAccountHolder } from "./useAccountHolder-ClppK4-L.js"; import { t as useSettingsContext } from "./useSettingsContext-DzwVt0W0.js"; import { a as drop, c as objectsDeepEqual, d as keysOf, f as valuesOf, i as doArraysMatch, l as pick, r as cloneObject, t as useAnalyticsContext } from "./useAnalyticsContext-BVFDMrVE.js"; import { t as useToggleContext } from "./useToggleContext-DaQUBF8O.js"; import { a as translateTranslatable } from "./utils-B807QaDx.js"; import { E as standardKatakanaValidator, T as standardKanjiValidator, _ as hasText, a as NO_ALPHABET_REGEX, c as SPECIAL_CHARS, f as getFormattingRegEx, g as hasRepeatedCharacters, h as hasMaximumTwoRepeatedCharacters, n as EMOJI_REGEX, r as INDIVIDUAL_VALID_CHAR_REGEX, w as matchesRegex, x as isInvalidName, y as isEmpty } from "./validatorUtils-DRapRJ6z.js"; import { t as listToRecord } from "./listToRecord-4wGOf00H.js"; import { t as Header } from "./Header-CPmJyuoP.js"; import { t as useAllowedCountries } from "./useAllowedCountries-x3yZO5Qw.js"; import { r as euCountries, t as CountryCodes } from "./country-code-CX5KqMBr.js"; import { t as useCapabilities } from "./useCapabilities-BW9uTmoB.js"; import { t as useDataset } from "./useDataset-ZHrWhmsh.js"; import { n as datasetUtilities, t as datasetIdentifier } from "./datasetUtil-Zd4TCTDn.js"; import { t as Alert } from "./Alert-C6gL3JIt.js"; import { l as individualDocumentMapping, s as individualApiKeyMapping, u as individualObscuredFields } from "./processCapabilities-DlZY9-Jc.js"; import { n as attachNomineeToRole, p as TaskTypes, r as filterOutUnwantedAssociationsIfRootLE, s as getOwnEntityAssociations, u as hasNomineesChanged } from "./entityAssociationUtil-BEzUdPbm.js"; import { t as DecisionMakerTypes } from "./decision-maker-type-Cow3CpUd.js"; import { t as Scenarios } from "./get-scenarios-DnCVdYIC.js"; import { t as getAllowedDecisionMakerRoles } from "./decisionMakerRoles-CAy-eeNV.js"; import { i as isLegalRepresentativeNeeded, n as getAgeRangeForLegalRepresentative, r as getAgeToday } from "./birthDateUtils-C686KOxO.js"; import { t as SettingNames } from "./types-CNZsK2dZ.js"; import { t as useToastContext } from "./useToastContext-CYgfHjSb.js"; import { t as LoaderWrapper } from "./LoaderWrapper-Dq8TNJCi.js"; import { t as Modal } from "./Modal-CioQJ7Q7.js"; import { t as Confirm } from "./Confirm-B6TWSuab.js"; import { t as TrustedFieldsProviders } from "./trusted-fields-provider-BHbX2hsp.js"; import { t as Image } from "./Image-BEzOZ1tt.js"; import { a as shouldShowIdNowModal, i as idNowPostSubmit, o as showIdNowModal, r as idNowModalChildEntityId } from "./bafinUtils-kBPs58Au.js"; import { t as getIndividualLegalEntityName } from "./getName-Bdwp_hkV.js"; import { t as useScenarios } from "./useScenarios-BxrbVsQp.js"; import { t as useCreateLegalEntity } from "./useCreateLegalEntity-BK1XURnK.js"; import { a as individualFormDefaultData, i as GuidanceQuestionValues, n as getOnfidoIdentityTypeToApiIdentityTypeMap, o as useCreateInvitation, r as GuidanceQuestion, t as mapLegalEntityToIndividualSchema } from "./mapLegalEntityToIndividualSchema-D9JCcC77.js"; import { t as useUpdateLegalEntity } from "./useUpdateLegalEntity-CtaRaKZ6.js"; import { l as useProviderStatus, t as Address } from "./Address-D5EL-3iQ.js"; import { a as defaultFieldMetadata$1, c as getPhonePlaceholder, i as contactDetailsValidationRules, l as useValidatePhoneNumberImperatively, n as contactDetailFields, o as fieldConfig, r as PhoneField, s as getAsyncPhoneValidationRules, t as ContactDetails } from "./ContactDetails-h7TVEsb_.js"; import { n as FormFlow, r as FormContextProvider, t as useFormContext } from "./useFormContext-Cx9-3iXR.js"; import { n as composePerScenarioFormConfigurations, r as getPropsFromConfigurations } from "./process-field-configurations-C7MuEj5q.js"; import { i as useFormComposer, n as getRequiredForms, t as addValidityToForms } from "./dropinUtils-IdasFZCU.js"; import { n as useFormRouterContext, t as ErrorPanel } from "./ErrorPanel-B536hgSc.js"; import { n as mergeFieldMetadataIntoProps, t as createFormUtils } from "./formUtils-DCvL3uZG.js"; import { n as preTranslatedSummaryItem } from "./summaryItem-Dehjwp8D.js"; import { t as useMultiForm } from "./useMultiForm-B3e1ImN3.js"; import { n as isTruthyValidator } from "./commonValidators-DCdet-gH.js"; import { a as useScenarioConfiguration, c as AdyenKycSdkError, i as uppercase, n as getPage, r as getPageName, t as mapExistingFile } from "./mapExistingFile-wp3Nf1-m.js"; import { t as useTaskLandedEvent } from "./useTaskLandedEvent-DInxWeqN.js"; import { a as alphanumericInputs, c as nonInputs, i as alphaInputs, l as numericInputs, n as InputEmail, o as customInputs, s as makeMask, t as MaskedInput, u as spacer } from "./MaskedInput-BFPSwRto.js"; import { t as JP_ADDRESS_REQUIRED_FIELDS } from "./jpAddressSchema-BQTiMBSQ.js"; import { n as mapJpAddressSummary, t as mapJpAddressSchemaToAddressLocalizations } from "./mapJpAddressSchemaToAddressLocalizations-C-Kwjo9Q.js"; import { i as mapAddressLabels, l as addressFields, n as getAddressSchemaLabelsByCountry } from "./utils-CfTVU2Hq.js"; import { i as isValidationError, o as processValidationErrors, s as isMaintenanceModeError } from "./validationError-BzQCrJPn.js"; import { c as getDocument, d as getIdDocument, f as mergeAttachments, o as createDocumentRequest, s as documentApiUtils, u as getFileExtention } from "./validate-DDKy88ac.js"; import { t as getLocalizedIdDocumentTypeOptions } from "./utils-CzW6YqAz.js"; import { r as formatObject } from "./utils-oc3EdK6K.js"; import { T as getFieldsWithExistingData, b as taxInformationDefaultFieldConfig, d as getDefaultTaxIdNumberType, g as DocumentGuidance, h as MemoizedDocumentUpload, m as taxIdNumberOptions, n as TaxInformationField, x as taxInformationDefaultFieldMetadata } from "./TaxInformationField-DVc2iorX.js"; import { t as isJapanLocalizationEnabled } from "./japanSupportUtils-DcDqwV81.js"; import { t as localizeDateString } from "./localizeDateString-1A3eC6hp.js"; import { t as omitObscuredFieldsIfUnchanged } from "./omitObscuredFieldsIfUnchanged-Cx1OCZuB.js"; import { o as validatePatternOnBlur } from "./patternValidators-BaQxw3ki.js"; import { r as addressValidators } from "./validate-qd_17no4.js"; import { n as emailPattern } from "./basePatterns-VqSYMnkh.js"; import { t as resolveFieldMetadata } from "./fieldConfigurations-m7oWP1DZ.js"; import { t as Field } from "./Field-pcJkjIG_.js"; import { t as LandingLayout } from "./LandingLayout-z8j2xiqg.js"; import { t as Select } from "./Select-CcSRI-H0.js"; import { t as Checkbox } from "./Checkbox-BCYjFPa4.js"; import { t as TextArea } from "./TextArea-CRLeP4x6.js"; import { t as Dropzone } from "./Dropzone-68UX-Puq.js"; import { n as getFormProps, t as getFieldProps } from "./getProps-CkZCnNxW.js"; import { t as Link } from "./Link-6M1PZnz2.js"; import { t as InputText } from "./InputText-C30dZxS4.js"; import { n as formatDateObj, t as InputDate } from "./InputDate-XX9jaw9v.js"; import { n as CountryField } from "./CountryField-Dh4DfjBf.js"; import { n as RadioWithLabel, t as RadioGroup } from "./RadioGroup-7g7Xv9rl.js"; import { t as ContextGuidance } from "./ContextGuidance-DdoORtLt.js"; import { i as individualRules, n as DECISION_MAKER_TYPES_WITH_JOBTITLE, t as COUNTRIES_WHICH_USE_MULTIPLE_IDENTITY_TYPES } from "./Individual.rules-DvMQmx90.js"; import { n as nameFields, t as Name } from "./Name-G92OEGxs.js"; import { t as toFullWidth } from "./toFullWidth-CSa3Sffs.js"; import { t as isEmpty$1 } from "./isEmpty-Dw2W8jeR.js"; import { t as Spacer } from "./Spacer-CvT0ELty.js"; import { t as phonePrefixes_default } from "./phonePrefixes-DcdX_CFz.js"; import { r as mapSchemaFieldsToApiScriptLocalization } from "./mapAddressLocalizationToJpAddressSchema-Cu5HfF7K.js"; import { Suspense, lazy, memo } from "preact/compat"; import { useCallback as useCallback$1, useEffect as useEffect$1, useMemo as useMemo$1, useRef as useRef$1, useState as useState$1 } from "preact/hooks"; import { Fragment as Fragment$1, jsx, jsxs } from "preact/jsx-runtime"; import { signal } from "@preact/signals"; import { skipToken, useMutation, useQuery, useQueryClient } from "@tanstack/preact-query"; import { Show } from "@preact/signals/utils"; import { Onfido } from "onfido-sdk-ui"; import parsePhoneNumber from "libphonenumber-js/mobile"; //#region src/api/entityVerifications/useVerifyIdNumber.ts var verifyIdNumber = async (legalEntityId, baseUrl, data) => { return await httpPost({ baseUrl, path: `legalEntities/${legalEntityId}/verifications/idNumber`, errorHandler: async (response) => { const responseData = await response; if (responseData.status === 422) return { status: 422, message: responseData.detail, errorCode: responseData.errorCode }; if (responseData.status === 500) return { status: 500, message: "Service did not respond, do not block verification" }; } }, data); }; var useVerifyIdNumber = (options) => { const { rootLegalEntityId, baseUrl } = useApiContext(); return useMutation({ mutationFn: (data) => verifyIdNumber(rootLegalEntityId.value, baseUrl.value, data), ...options }); }; //#endregion //#region src/api/idVerificationProviders/idVerificationStartCheck.ts var startVerificationCheck = async (rootLegalEntityId, baseUrl, data) => { return httpPost({ baseUrl, path: `legalEntities/${rootLegalEntityId}/providers/idVerification/process` }, data); }; var useIdVerificationStartCheck = (options) => { const { rootLegalEntityId, baseUrl } = useApiContext(); return useMutation({ mutationFn: (data) => startVerificationCheck(rootLegalEntityId.value, baseUrl.value, data), ...options }); }; //#endregion //#region src/utils/customerSupportUtils.ts var customerSupportPresubmitProcess = (legalEntityResponse, legalEntityToSubmit) => { if (legalEntityResponse.type === "individual") return processCustomerSupportForIndividual(legalEntityResponse, legalEntityToSubmit); if (legalEntityResponse.type === "organization") return processCustomerSupportForOrganization(legalEntityResponse, legalEntityToSubmit); }; var processCustomerSupportForOrganization = (legalEntityResponse, legalEntityToSubmit) => { if (!legalEntityResponse.organization?.support) return legalEntityToSubmit.organization?.support ?? void 0; if (legalEntityResponse.organization?.countryOfGoverningLaw !== legalEntityToSubmit.organization?.countryOfGoverningLaw) { const customerSupport = legalEntityResponse.organization?.support; switch (legalEntityToSubmit.organization?.countryOfGoverningLaw) { case CountryCodes.Japan: return unsetCustomerSupportNumber(customerSupport); default: return customerSupport; } } }; var processCustomerSupportForIndividual = (legalEntityResponse, legalEntityToSubmit) => { if (!legalEntityResponse.individual?.support) return legalEntityToSubmit.individual?.support ?? void 0; if (legalEntityResponse.individual?.residentialAddress.country !== legalEntityToSubmit.individual?.residentialAddress.country) { const customerSupport = legalEntityResponse.individual?.support; switch (legalEntityToSubmit.individual?.residentialAddress.country) { case CountryCodes.Japan: return unsetCustomerSupportNumber(customerSupport); default: return customerSupport; } } }; var unsetCustomerSupportNumber = (customerSupport) => { return customerSupport ? { email: customerSupport.email, phone: { number: "", type: "mobile" } } : void 0; }; //#endregion //#region src/utils/getSSNType.ts var ERROR_CODES = { SSN_REMEDIATION: "1_316", SSN_4_DIGITS_VALIDATION: "1_3062", PERSONAL_DETAILS_VALIDATION: "1_30" }; var getSSNType = (formVerifcationErrors, existingIdNumber) => { return check4DigitSsnFailed(formVerifcationErrors) || existingIdNumber?.length === 9 ? "ssn" : "ssnLastFour"; }; var check4DigitSsnFailed = (formVerifcationErrors) => { return (formVerifcationErrors?.[ERROR_CODES.PERSONAL_DETAILS_VALIDATION])?.[ERROR_CODES.SSN_4_DIGITS_VALIDATION]?.some((error) => error.code === ERROR_CODES.SSN_REMEDIATION); }; //#endregion //#region src/utils/regex/countryIdNumberPatterns.ts var CountryIdNumberPatterns = { [CountryCodes.Brazil]: /^\d{11}$/, [CountryCodes.Canada]: /^\d{9}$/, [CountryCodes.Croatia]: /^\d{11}$/, [CountryCodes.Denmark]: /^\d{10}$/, [CountryCodes.Italy]: /^[A-Z]{6}[0-9]{2}[ABCDEHLMPRST][0-9]{2}[A-Z][0-9]{3}[A-Z]$/, [CountryCodes.Poland]: /^\d{11}$/, [CountryCodes.Romania]: /^\d{13}$/, [CountryCodes.Singapore]: /^[A-Z][0-9]{7}[A-Z]$/, [CountryCodes.Spain]: { dni: /(^[KL]?\d{8}[A-Z]$)/, nie: /(^[MXYZ]\d{7,8}[A-Z]$)/ }, [CountryCodes.Sweden]: /^\d{10}$|^\d{12}$/, [CountryCodes.UnitedStates]: { ssn: /^\d{9}$/, ssnLastFour: /^\d{4}$/ } }; //#endregion //#region src/utils/regex/driversLicenseCardNumberPatterns.ts var DriversLicenseCardNumberPatterns = { [CountryCodes.NewZealand]: /^[\d]{3}$/, [CountryCodes.Australia]: /^[A-Z0-9]{5,11}$/ }; //#endregion //#region src/utils/regex/driversLicenseNumberPatterns.ts var DriversLicenseNumberPatterns = { [CountryCodes.Australia]: /^[A-Za-z0-9]{5,11}$/, [CountryCodes.HongKong]: /^[A-Z0-9]{8}$/, [CountryCodes.NewZealand]: /^[A-Z]{2}[0-9]{6}$/ }; //#endregion //#region src/utils/regex/passportNumberPatterns.ts var PassportNumberPatterns = { [CountryCodes.Australia]: /^[A-Z0-9]{8,9}$/, [CountryCodes.HongKong]: /^[A-Z0-9]{9}$/, [CountryCodes.NewZealand]: /^[A-Z0-9]{8,9}$/ }; //#endregion //#region src/utils/regex/proofOfIdentityCardPatterns.ts var ProofOfIdentityCardPatterns = { [CountryCodes.HongKong]: /^[A-Z]{1,2}[0-9]{6}[0-9A]$/ }; //#endregion //#region src/utils/verification/helpers/verifyIdNumber.ts var COUNTRY_ID_NUMBER_MASKS = { [CountryCodes.PuertoRico]: { length: 4 }, [CountryCodes.UnitedStates]: { length: 4 } }; var COUNTRY_ID_NUMBER_UNMASKED = { [CountryCodes.PuertoRico]: { length: 9 }, [CountryCodes.UnitedStates]: { length: 9 } }; var ID_NUMBER_VERIFICATION_COUNTRIES = [CountryCodes.PuertoRico, CountryCodes.UnitedStates]; var FIELD = "idNumber"; var handleVerifyIdNumber = async (formData, basicDetails, verifyFn) => { const country = formData.country; const verified = { field: "idNumber", isVerified: true }; if (formData.idNumberExempt || !country) return verified; if (!ID_NUMBER_VERIFICATION_COUNTRIES.includes(country)) return verified; const isCountryWithMaskedIdNumber = Object.keys(COUNTRY_ID_NUMBER_MASKS).includes(country); const isValueMasked = formData.idNumber?.length === COUNTRY_ID_NUMBER_MASKS[country]?.length; const hasCompleteValue = formData.idNumber?.length === COUNTRY_ID_NUMBER_UNMASKED[country]?.length; if (isCountryWithMaskedIdNumber && isValueMasked) return verified; if (!hasCompleteValue) return { field: "idNumber", isVerified: false }; const response = await verifyFn({ name: { firstName: basicDetails.firstName || "", lastName: basicDetails.lastName || "" }, countryCode: country, idNumber: formData.idNumber || "" }); if (response?.status === 422 || response?.verified === "false") return { field: FIELD, isVerified: false }; return { field: FIELD, isVerified: true }; }; //#endregion //#region src/components/Individual/fields/IdentityNumber/fieldConfig.ts var getAsyncIdNumberValidationRule = (verifyIdNumber, additionalPersonalDetails, basicDetails) => ({ idNumber: { asyncValidate: async (idNumber) => { if (!idNumber || !additionalPersonalDetails || !basicDetails) return false; return (await handleVerifyIdNumber(additionalPersonalDetails, basicDetails, verifyIdNumber)).isVerified; }, errorMessage: "unableToVerifyTheIdNumber", modes: ["blur", "input"] } }); var defaultFieldMetadata = { label: "idNumber" }; var defaultFieldConfig = { [CountryCodes.Brazil]: { label: "cadastroDePessoasFisicas", mask: { mask: makeMask(...numericInputs(3), ...nonInputs(" . "), ...numericInputs(3), ...nonInputs(" . "), ...numericInputs(3), ...nonInputs(" - "), ...numericInputs(2)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Brazil]), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "11", example: "231.002.999-00" } } }, [CountryCodes.Canada]: { label: "socialInsuranceNumber", mask: { mask: makeMask(...numericInputs(3), spacer, ...numericInputs(3), spacer, ...numericInputs(3)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Canada]), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "9", example: "046 454 286" } } }, [CountryCodes.Croatia]: { label: "oib", mask: { mask: makeMask(...numericInputs(11)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Croatia]), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "11", example: "94577403194" } } }, [CountryCodes.Denmark]: { label: "detCentralePersonregister", mask: { mask: makeMask(...numericInputs(6), ...nonInputs(" - "), ...numericInputs(4)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Denmark]), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "10", example: "010111-1113" } } }, [CountryCodes.Italy]: { label: "codiceFiscale", mask: { mask: makeMask(...alphaInputs(6), ...numericInputs(2), ...customInputs(1, /^[ABCDEHLMPRST]$/), ...numericInputs(2), ...alphaInputs(1), ...numericInputs(3), ...alphaInputs(1)), transformOnType: uppercase }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Italy]), guidanceText: { key: "enterNCharactersWithAMixForExample", values: { numChars: "16", example: "YULSQG40E60L271T" } } }, [CountryCodes.Poland]: { label: "peselNumber", mask: { mask: makeMask(...numericInputs(11)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Poland]), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "11", example: "23012224757" } } }, [CountryCodes.PuertoRico]: ({ idNumberType }) => { switch (idNumberType) { case "ssn": return { label: "socialSecurityNumber", mask: { mask: makeMask(...numericInputs(3), ...nonInputs(" - "), ...numericInputs(2), ...nonInputs(" - "), ...numericInputs(4)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.UnitedStates].ssn), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "9", example: "123-12-1234" } } }; default: return { label: "last4DigitsOfSocialSecurityNumber", mask: { mask: makeMask(...numericInputs(4)) }, validators: { modes: ["blur"], validate: (val) => !!val && CountryIdNumberPatterns[CountryCodes.UnitedStates].ssnLastFour.test(val), errorMessage: "mustContain4Digits" } }; } }, [CountryCodes.Romania]: { label: "codNumericPersonal", mask: { mask: makeMask(...numericInputs(13)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Romania]), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "13", example: "8001011234567" } } }, [CountryCodes.Singapore]: { label: "nric", mask: { mask: makeMask(...alphaInputs(1), ...numericInputs(7), ...alphaInputs(1)), transformOnType: uppercase }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Singapore]), guidanceText: { key: "enterNCharactersWithAMixForExample", values: { numChars: "9", example: "T9123456J" } } }, [CountryCodes.Spain]: ({ idNumberType }) => { switch (idNumberType) { case "dni": return { label: "dni", mask: { mask: makeMask(...customInputs(1, /^[KL]$/, true), ...numericInputs(8), ...alphaInputs(1)), transformOnType: uppercase }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Spain].dni), guidanceText: { key: "enterXToYCharactersWithAMixForExample", values: { minChars: "9", maxChars: "10", example: "12345678A or L12345678A" } } }; default: return { label: "nie", mask: { mask: makeMask(...customInputs(1, /^[MXYZ]$/), ...numericInputs(7), ...numericInputs(1, true), ...alphaInputs(1)), transformOnType: uppercase }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Spain].nie), guidanceText: { key: "enterXToYCharactersWithAMixForExample", values: { minChars: "9", maxChars: "10", example: "X12345678A or Z6527153N" } } }; } }, [CountryCodes.Sweden]: { label: "personnummer", mask: { mask: makeMask(...numericInputs(6), ...numericInputs(2, true), ...nonInputs(" - "), ...numericInputs(4)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.Sweden]), guidanceText: { key: "enterXOrYDigitsForExample", values: { xDigits: "10", yDigits: "12", example: "640823-3234 or 19640823-3234" } } }, [CountryCodes.UnitedStates]: ({ idNumberType }) => { switch (idNumberType) { case "ssn": return { label: "socialSecurityNumber", mask: { mask: makeMask(...numericInputs(3), ...nonInputs(" - "), ...numericInputs(2), ...nonInputs(" - "), ...numericInputs(4)) }, validators: validatePatternOnBlur(CountryIdNumberPatterns[CountryCodes.UnitedStates].ssn), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "9", example: "123-12-1234" } } }; default: return { label: "last4DigitsOfSocialSecurityNumber", mask: { mask: makeMask(...numericInputs(4)) }, validators: { modes: ["blur"], validate: (val) => !!val && CountryIdNumberPatterns[CountryCodes.UnitedStates].ssnLastFour.test(val), errorMessage: "mustContain4Digits" } }; } }, [CountryCodes.NewZealand]: ({ idNumberType }) => { switch (idNumberType) { case "passport": return { label: "passportNumber", mask: { mask: makeMask(...alphanumericInputs(9)), transformOnType: uppercase }, validators: validatePatternOnBlur(PassportNumberPatterns[CountryCodes.NewZealand]), guidanceText: { key: "enterXToYCharactersWithAMixForExample", values: { minChars: "8", maxChars: "9", example: "RA000750" } } }; default: return { label: "licenseNumber", mask: { mask: makeMask(...alphaInputs(2), ...numericInputs(6)), transformOnType: uppercase }, validators: validatePatternOnBlur(DriversLicenseNumberPatterns[CountryCodes.NewZealand]), guidanceText: { key: "enterNCharactersWithAMixForExample", values: { numChars: "8", example: "KA111112" } } }; } }, [CountryCodes.HongKong]: ({ idNumberType }) => { switch (idNumberType) { case "proofOfIdentityCard": return { label: "hkid", mask: { mask: makeMask(...alphaInputs(1), ...alphaInputs(1, true), ...numericInputs(6), ...nonInputs("(", { displayEagerly: false }), ...customInputs(1, /^[0-9A]$/), ...nonInputs(")")), transformOnType: uppercase }, validators: validatePatternOnBlur(ProofOfIdentityCardPatterns[CountryCodes.HongKong]), guidanceText: { key: "enterXToYCharactersWithAMixForExample", values: { minChars: "8", maxChars: "9", example: "Z683365(5) or AB123456(A)" } } }; case "passport": return { label: "passportNumber", mask: { mask: makeMask(...alphanumericInputs(9)), transformOnType: uppercase }, validators: validatePatternOnBlur(PassportNumberPatterns[CountryCodes.HongKong]), guidanceText: { key: "enterNCharactersWithAMixForExample", values: { numChars: "9", example: "H12345678" } } }; default: return { label: "licenseNumber", mask: { mask: makeMask(...alphanumericInputs(7), spacer, ...alphanumericInputs(1)), transformOnType: uppercase }, validators: validatePatternOnBlur(DriversLicenseNumberPatterns[CountryCodes.HongKong]), guidanceText: { key: "enterNCharactersForExample", values: { numChars: "8", example: "A123452 0" } } }; } }, [CountryCodes.Australia]: ({ idNumberType }) => { switch (idNumberType) { case "passport": return { label: "passportNumber", mask: { mask: makeMask(...alphanumericInputs(9)), transformOnType: uppercase }, validators: validatePatternOnBlur(PassportNumberPatterns[CountryCodes.Australia]), guidanceText: { key: "enterXToYCharactersWithAMixForExample", values: { minChars: "8", maxChars: "9", example: "RA0123456" } } }; default: return { label: "licenseNumber", mask: { mask: makeMask(...alphanumericInputs(6), ...alphanumericInputs(5, true)), transformOnType: uppercase }, validators: validatePatternOnBlur(DriversLicenseNumberPatterns[CountryCodes.Australia]), guidanceText: { key: "enterXToYCharactersWithAMixForExample", values: { minChars: "5", maxChars: "11", example: "2093628291" } } }; } } }; var licenseCardNumberDefaultMetadata = { label: "licenseCardNumber" }; var licenseCardNumberDefaultConfig = { [CountryCodes.NewZealand]: { label: "licenceVersionNumber", mask: { mask: makeMask(...numericInputs(3)) }, validators: validatePatternOnBlur(DriversLicenseCardNumberPatterns[CountryCodes.NewZealand]), guidanceText: { key: "enterNDigitsForExample", values: { numDigits: "3", example: "108" } } }, [CountryCodes.Australia]: { label: "licenseCardNumber", mask: { mask: makeMask(...alphanumericInputs(6), ...alphanumericInputs(5, true)), transformOnType: uppercase }, validators: validatePatternOnBlur(DriversLicenseCardNumberPatterns[CountryCodes.Australia]), guidanceText: { key: "enterXToYCharactersWithAMixForExample", values: { minChars: "5", maxChars: "11", example: "2093628291" } } } }; var idNumberExemptDefaultMetadata = { label: "identityNumberExempt" }; var idNumberExemptDefaultConfig = { [CountryCodes.UnitedStates]: { label: "identityNumberExempt__US" }, [CountryCodes.Canada]: { label: "identityNumberExempt__CA" }, [CountryCodes.Singapore]: { label: "uploadDocumentForNric" } }; //#endregion //#region src/components/Shared/fields/Name/validate.ts var nameValidationRulesV4 = (isFeatureEnabled = () => false) => { return { firstName: [{ modes: ["blur"], validate: (input) => !matchesRegex(NO_ALPHABET_REGEX, input), errorMessage: "nameMustContainLetters" }, { modes: ["blur"], validate: (input) => !matchesRegex(EMOJI_REGEX, input) && (isFeatureEnabled("EnableAllowTwoRepeatedCharactersInName") ? !hasMaximumTwoRepeatedCharacters(input) : !hasRepeatedCharacters(input)) && !isInvalidName(input) && matchesRegex(INDIVIDUAL_VALID_CHAR_REGEX, input), errorMessage: "checkForTypos" }], lastName: [{ modes: ["blur"], validate: (input) => !matchesRegex(NO_ALPHABET_REGEX, input), errorMessage: "nameMustContainLetters" }, { modes: ["blur"], validate: (input) => !matchesRegex(EMOJI_REGEX, input) && (isFeatureEnabled("EnableAllowTwoRepeatedCharactersInName") ? !hasMaximumTwoRepeatedCharacters(input) : !hasRepeatedCharacters(input)) && !isInvalidName(input) && matchesRegex(INDIVIDUAL_VALID_CHAR_REGEX, input), errorMessage: "checkForTypos" }] }; }; getFormattingRegEx(SPECIAL_CHARS.replace("-", "")); //#endregion //#region src/components/Individual/forms/AdditionalPersonalDetails/validate.ts var isNotOutOfRangeBirthDateValidatorRule = { modes: ["blur"], validate: (birthDate) => !isEmpty(birthDate) && new Date(birthDate) < /* @__PURE__ */ new Date(), errorMessage: "invalidDateOfBirth" }; var buildMinimumAgeValidationRule = (minimumAge) => ({ modes: ["blur"], validate: (birthDate) => !!birthDate && getAgeToday(birthDate) >= minimumAge, errorMessage: { key: "youMustXYearsOldToContinue", values: { minimumAge: minimumAge.toString() } } }); var getCountrySpecificMinimumAgeValidationRule = (country) => { if (!country) return buildMinimumAgeValidationRule(13); if ([ ...euCountries, CountryCodes.UnitedKingdom, CountryCodes.Switzerland ].some((c) => c === country)) return buildMinimumAgeValidationRule(16); switch (country) { case CountryCodes.HongKong: case CountryCodes.Singapore: return buildMinimumAgeValidationRule(18); default: return buildMinimumAgeValidationRule(13); } }; var additionalPersonalDetailsValidators = ({ country, isFeatureEnabled = () => false, isSettingEnabled = () => false, taskType, idNumberType, idNumberExempt, idNumber, existingIdNumber, formVerificationErrors, t, taxIdNumberType }) => ({ taxInformation: resolveFieldMetadata(taxInformationDefaultFieldConfig[country], { taxIdNumberType, companyType: LegalEntityTypes.INDIVIDUAL }, taxInformationDefaultFieldMetadata)?.validators, birthDate: (() => { const baseValidators = [isNotOutOfRangeBirthDateValidatorRule]; if (isSettingEnabled("enforceLegalAge")) return [...baseValidators, buildMinimumAgeValidationRule(18)]; if (isFeatureEnabled("EnableAgeVerification")) { if (taskType === TaskTypes.LEGAL_REPRESENTATIVE_DETAILS) return [...baseValidators, buildMinimumAgeValidationRule(18)]; return [...baseValidators, getCountrySpecificMinimumAgeValidationRule(country)]; } return baseValidators; })(), ...isFeatureEnabled("StrictNameAndAddressValidationV4") ? nameValidationRulesV4(isFeatureEnabled) : void 0, ...contactDetailsValidationRules, idNumber: (() => { const derivedIdNumberType = country === CountryCodes.UnitedStates || country === CountryCodes.PuertoRico ? getSSNType(formVerificationErrors, existingIdNumber) : idNumberType; return idNumberExempt ? { validate: () => { return idNumberExempt || !isEmpty(idNumber); }, modes: ["blur"] } : resolveFieldMetadata(defaultFieldConfig[country], { idNumberType: derivedIdNumberType }, defaultFieldMetadata)?.validators; })(), ...addressValidators({ isFeatureEnabled, country, t }) }); //#endregion //#region src/components/Shared/fields/LocalizedNameFields/validate.ts var localizedNameValidationRulesV4 = (isFeatureEnabled = () => false, country) => { if (isJapanLocalizationEnabled(isFeatureEnabled, country)) return { jaHaniFirstName: [{ modes: ["blur"], validate: hasText, errorMessage: "fieldIsRequired" }, { modes: ["blur"], validate: (input) => standardKanjiValidator(input), errorMessage: "checkForTypos" }], jaHaniLastName: [{ modes: ["blur"], validate: hasText, errorMessage: "fieldIsRequired" }, { modes: ["blur"], validate: (input) => standardKanjiValidator(input), errorMessage: "checkForTypos" }], jaKanaFirstName: [{ modes: ["blur"], validate: hasText, errorMessage: "fieldIsRequired" }, { modes: ["blur"], validate: (input) => standardKatakanaValidator(input), errorMessage: "ensureValidFullWidthKatakana" }], jaKanaLastName: [{ modes: ["blur"], validate: hasText, errorMessage: "fieldIsRequired" }, { modes: ["blur"], validate: (input) => standardKatakanaValidator(input), errorMessage: "ensureValidFullWidthKatakana" }] }; return {}; }; //#endregion //#region src/components/Individual/forms/BasicDetails/validate.ts var basicDetailsValidators = ({ isFeatureEnabled = () => false, country }) => ({ ...contactDetailsValidationRules, ...isFeatureEnabled("StrictNameAndAddressValidationV4") ? nameValidationRulesV4(isFeatureEnabled) : void 0, ...localizedNameValidationRulesV4(isFeatureEnabled, country) }); //#endregion //#region src/components/Individual/forms/IdDocumentUpload/types.ts var onfidoDocumentTypeMapping = [ { id: "driversLicense", name: "driversLicense", hasBackPage: true }, { id: "identityCard", name: "identityCard", hasBackPage: true }, { id: "passport", name: "passport", hasBackPage: false } ]; //#endregion //#region src/api/idNowProvider/useIdNowProvider.ts var getIdNowProviderIdentificationStatus = async (rootLegalEntityId, baseUrl, legalEntityId) => { return httpGet({ baseUrl, path: `legalEntities/${rootLegalEntityId}/child/${legalEntityId}/provider/idnow/identification/status`, errorHandler: async (response) => { const responseData = await response; if (responseData.status === 404) return { status: 404, message: responseData.detail, errorCode: responseData.errorCode }; } }); }; var useIdNowIdentificationStatus = (legalEntityId, options) => { const { rootLegalEntityId, baseUrl } = useApiContext(); return useQuery({ queryKey: legalEntityId === skipToken ? [] : ["idNowProviderIdentificationStatus", legalEntityId], queryFn: legalEntityId === skipToken ? skipToken : () => getIdNowProviderIdentificationStatus(rootLegalEntityId.value, baseUrl.value, legalEntityId), ...options }); }; var idNowProviderStartIdentification = async (rootLegalEntityId, baseUrl, legalEntityId) => { return httpPost({ baseUrl, path: `legalEntities/${rootLegalEntityId}/child/${legalEntityId}/provider/idnow/identification/start` }); }; var useIdNowStartIdentification = (legalEntityId, options) => { const { rootLegalEntityId, baseUrl } = useApiContext(); return useQuery({ queryKey: legalEntityId === skipToken ? [] : ["idNowProviderStartIdentification", legalEntityId], queryFn: legalEntityId === skipToken ? skipToken : () => idNowProviderStartIdentification(rootLegalEntityId.value, baseUrl.value, legalEntityId), ...options }); }; var IdNowVerificationModal_module_default = { "idnow-header": "adyen-kyc-idnow-header", idnowHeader: "adyen-kyc-idnow-header", "idnow-verification-header-iframe-container": "adyen-kyc-idnow-verification-header-iframe-container", idnowVerificationHeaderIframeContainer: "adyen-kyc-idnow-verification-header-iframe-container", "idnow-verification-header-iframe": "adyen-kyc-idnow-verification-header-iframe", idnowVerificationHeaderIframe: "adyen-kyc-idnow-verification-header-iframe", "idnow-verification-header-image": "adyen-kyc-idnow-verification-header-image", idnowVerificationHeaderImage: "adyen-kyc-idnow-verification-header-image" }; //#endregion //#region src/components/Individual/forms/IdNowVerificationModal/IFrameWidget.ts var MOUNT_TIMEOUT = 10 * 1e3; var activeWidget; var IFrameWidget = class { iframeUrl; iframeElement; mountInProgress = false; constructor(iframeElement, url, _vendor, _sdkToken) { try { this.iframeUrl = new URL(url); } catch (err) { throw new AdyenKycSdkError("WIDGET_URL_MALFORMED", err); } this.iframeElement = iframeElement; } unmount() { if (this.mountInProgress) throw new AdyenKycSdkError("Cannot unmount widget, mounting is still in progress"); this.iframeElement.remove(); activeWidget = null; } async mount() { if (activeWidget) throw new AdyenKycSdkError(`You can only have one ${this.constructor.name} mounted at a time`); activeWidget = this; if (this.mountInProgress) throw new AdyenKycSdkError("Cannot mount widget, mounting is already in progress"); this.mountInProgress = true; try { await new Promise((resolve, reject) => { const timeoutId = setTimeout(() => { this.mountInProgress = false; reject(new AdyenKycSdkError("WIDGET_TIMEOUT")); }, MOUNT_TIMEOUT); const cancelTimeout = () => { if (timeoutId) clearTimeout(timeoutId); }; this.iframeElement.addEventListener("load", () => { cancelTimeout(); this.mountInProgress = false; resolve(); }); requestAnimationFrame(() => { try { this.iframeElement.setAttribute("src", this.iframeUrl.href); } catch (ex) { cancelTimeout(); this.mountInProgress = false; reject(ex); } }); }); } catch (err) { throw new AdyenKycSdkError("WIDGET_LAUNCH_FAILED", err); } } async mountAndWaitForResponse() { await this.mount(); } }; //#endregion //#region src/components/Individual/forms/IdNowVerificationModal/IdNowVerificationModal.tsx var passportFrontGreenImage$1 = lazy(() => import("./passport-front-green-DmIh7YIG.js")); /** * Checks if the IDnow identification status is considered successful. * @param status - The status object from the IDnow provider. * @returns True if the provider status is 'SUCCESS', 'SUCCESS_DATA_CHANGED', or 'REVIEW_PENDING'. */ var isIdNowSuccessful = (status) => { const providerStatus = status?.providerStatus; return providerStatus === "SUCCESS" || providerStatus === "SUCCESS_DATA_CHANGED" || providerStatus === "REVIEW_PENDING"; }; var IdNowVerificationModal = ({ handleFinish }) => { const { t } = useTranslation(["individual", "common"]); const [isConfirmPresented, setIsConfirmPresented] = useState$1(false); const [genericError, setGenericError] = useState$1(false); const widgetContainerRef = useRef$1(null); const iFrameRef = useRef$1(null); const iFrameWidgetRef = useRef$1(null); const [page, setPage] = useState$1(1); const queryClient = useQueryClient(); const { showToast } = useToastContext(); const { data: idNowStatus, isLoading: isStatusLoading, refetch: refetchIdNowIdentificationStatus } = useIdNowIdentificationStatus(idNowModalChildEntityId.value?.id ?? skipToken, { enabled: !!idNowModalChildEntityId.value?.id, refetchOnMount: "always", refetchInterval: 1e4, retry: (failureCount, error) => { if ("status" in error && error.status === 404) return false; return failureCount < 3; } }); const { data: idNowStart, isLoading, isError: idNowStartError, refetch: refetchIdNowStartIdentification } = useIdNowStartIdentification(idNowModalChildEntityId.value?.id ?? skipToken, { enabled: !!idNowModalChildEntityId.value?.id && page === 2 }); const handleDismiss = () => { setIsConfirmPresented(true); }; const handleCancelDismiss = () => { setIsConfirmPresented(false); }; const handleConfirmDismiss = () => { setPage(1); setGenericError(false); setIsConfirmPresented(false); showIdNowModal.value = false; if (idNowStartError && idNowModalChildEntityId.value?.id) queryClient.resetQueries({ queryKey: ["idNowProviderStartIdentification", idNowModalChildEntityId.value?.id] }); idNowModalChildEntityId.value = void 0; iFrameWidgetRef.current?.unmount(); iFrameRef.current?.remove(); if (idNowPostSubmit.value) handleFinish?.(); idNowPostSubmit.value = false; }; if (idNowStatus?.status === "finished") { if (isIdNowSuccessful(idNowStatus)) { idNowPostSubmit.value = true; showToast({ label: t(($) => $["successfullyUpdatedDetails"], { ns: "common" }), variant: "success" }); handleConfirmDismiss(); } else if (page === 2) handleConfirmDismiss(); } if (!isLoading && idNowStartError) { setGenericError(true); setPage(1); } const initializeIdNowWidget = useCallback$1(async (url) => { const container = widgetContainerRef.current; if (!container) return; const iFrame = document.createElement("iframe"); iFrameRef.current = iFrame; iFrame.setAttribute("allowFullscreen", "true"); iFrame.setAttribute("name", "idnow"); iFrame.classList.add(IdNowVerificationModal_module_default.idnowVerificationHeaderIframe); iFrame.setAttribute("height", "800"); iFrame.setAttribute("allow", "camera *;microphone *;geolocation *;clipboard-read *;clipboard-write *"); container.appendChild(iFrame); try { iFrameWidgetRef.current = new IFrameWidget(iFrame, url, "idnow", ""); await iFrameWidgetRef.current.mountAndWaitForResponse(); } catch (err) { console.error("Error occurred:", err); setGenericError(true); setPage(1); } }, []); useEffect$1(() => { if (page === 2 && !isLoading && idNowStart && idNowStart?.url) (async () => { await refetchIdNowIdentificationStatus(); await initializeIdNowWidget(idNowStart.url); })(); return () => { iFrameWidgetRef.current?.unmount(); iFrameRef.current?.remove(); }; }, [ isLoading, page, initializeIdNowWidget, refetchIdNowIdentificationStatus, idNowStart ]); return /* @__PURE__ */ jsxs(Fragment$1, { children: [!isStatusLoading && /* @__PURE__ */ jsxs(Modal, { size: page === 2 ? "large" : "medium", showCloseButton: !isLoading && !isStatusLoading, onClose: handleDismiss, ariaLabel: t(($) => $["identityVerification"]), children: [page === 1 && /* @__PURE__ */ jsx("div", { className: IdNowVerificationModal_module_default.idnowHeader, children: /* @__PURE__ */ jsx(LandingLayout, { media: /* @__PURE__ */ jsx(Image, { className: IdNowVerificationModal_module_default.idnowVerificationHeaderImage, lazyLoadedImage: passportFrontGreenImage$1 }), title: t(($) => $["identityVerification"]), description: /* @__PURE__ */ jsxs(Fragment$1, { children: [ t(($) => $["idNowDescription"], { ns: "individual" }), /* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("br", {}), getIndividualLegalEntityName(idNowModalChildEntityId.value) && t(($) => $["idNowDescriptionName"], { ns: "individual", name: getIndividualLegalEntityName(idNowModalChildEntityId.value) }) ] }), error: !isLoading && genericError ? /* @__PURE__ */ jsx(Alert, { variant: "error", title: t(($) => $["thereWasAnErrorTryAgain"], { ns: "common" }) }) : void 0, actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, { onClick: async () => { setGenericError(false); setPage(2); await refetchIdNowStartIdentification(); }, disabled: isLoading || isStatusLoading || idNowStatus?.status === "finished" && isIdNowSuccessful(idNowStatus), fullWidth: true, children: idNowStatus?.status === "pending" ? t(($) => $["continueVerification"], { ns: "common" }) : t(($) => $["startVerification"], { ns: "common" }) }), /* @__PURE__ */ jsx(Button, { disabled: isLoading || isStatusLoading, variant: "tertiary", onClick: handleConfirmDismiss, fullWidth: true, children: idNowPostSubmit.value ? t(($) => $["finishLater"], { ns: "common" }) : t(($) => $["editDetails"], { ns: "common" }) })] }) }) }), page === 2 && (isLoading ? /* @__PURE__ */ jsx(Loader, {}) : /* @__PURE__ */ jsx("div", { ref: widgetContainerRef, className: IdNowVerificationModal_module_default.idnowVerificationHeaderIframeContainer }))] }), isConfirmPresented && /* @__PURE__ */ jsx(Confirm, { confirmText: t(($) => $["leave"], { ns: "common" }), onCancel: handleCancelDismiss, onConfirm: handleConfirmDismiss, title: t(($) => $["unsavedChanges"], { ns: "common" }) })] }); }; //#endregion //#region src/components/Individual/forms/IdVerification/idVerificationProviderId.ts var idVerificationProviderId = signal(); //#endregion //#region src/utils/areArraysDifferent.ts var areArraysDifferent = (a = [], b = []) => { if (a.length !== b.length) return true; const sortedA = [...a].sort(); const sortedB = [...b].sort(); return sortedA.some((item, index) => item !== sortedB[index]); }; //#endregion //#region src/components/Individual/helpers/roleUtils.ts var calculateRoles = (data) => { return [ { isApplicable: data?.signatoryQuestionnaire?.isSignatory === GuidanceQuestionValues.YES, role: DecisionMakerTypes.SIGNATORY }, { isApplicable: data?.uboQuestionnaire?.isOwner === GuidanceQuestionValues.YES, role: DecisionMakerTypes.OWNER }, { isApplicable: data?.uboQuestionnaire?.isControllingPerson === GuidanceQuestionValues.YES, role: DecisionMakerTypes.CONTROLLING_PERSON }, { isApplicable: data?.uboQuestionnaire?.isDirector === GuidanceQuestionValues.YES, role: DecisionMakerTypes.DIRECTOR } ].filter(({ isApplicable }) => isApplicable).map(({ role }) => role); }; //#endregion //#region src/components/Individual/helpers/shouldShowMotionCapture.ts var showIndividualMotionCapture = signal(void 0); var setShowIndividualMotionCapture = (showMotionCapture) => { showIndividualMotionCapture.value = showMotionCapture; }; var hasMotionCaptureScenario = signal(void 0); var setHasMotionCaptureScenario = (scenarios) => { hasMotionCaptureScenario.value = scenarios?.some((scenario) => scenario === Scenarios.L_MOTION || scenario === Scenarios.L1_ID); }; var allowedRolesForMotionCapture = [DecisionMakerTypes.SIGNATORY]; var shouldShowMotionCapture = ({ capabilities, userRoles, taskType, hasMotionScenario, isInvitedEntity = false }) => { if (isInvitedEntity) return shouldShowMotionCaptureForInvitedEntity({ capabilities, userRoles }); if (!hasMotionScenario) return false; const isIndividual = taskType === TaskTypes.INDIVIDUAL; const hasRequiredRole = userRoles?.some((role) => allowedRolesForMotionCapture.includes(role)); const hasRequiredCapability = capabilities?.issueBankAccount?.requested ?? false; return (isIndividual || hasRequiredRole) && hasRequiredCapability; }; var shouldShowMotionCaptureForInvitedEntity = ({ capabilities, userRoles }) => { if (!userRoles || !userRoles.includes("signatory") || capabilities === void 0) return false; const rootCapabilitiesToShowMotionCaptureFor = [ "issueBankAccount", "receiveFromThirdParty", "sendToThirdParty" ]; return Object.keys(capabilities).some((capabilityName) => rootCapabilitiesToShowMotionCaptureFor.includes(capabilityName) && capabilities[capabilityName]?.requested); }; //#endregion //#region src/components/Shared/fields/IdFieldTypeSelector/countryIdNumberTypes.ts var individualIdNumberOptions = { [CountryCodes.Spain]: [{ id: "dni", name: "dni" }, { id: "nie", name: "nie" }] }; var additionallIdNumberOptions = { [CountryCodes.NewZealand]: [{ id: "driversLicense", name: "driversLicense" }, { id: "passport", name: "passportNumber" }], [CountryCodes.HongKong]: [ { id: "proofOfIdentityCard", name: "stateIssuedProofOfIdentityCard" }, { id: "driversLicense", name: "driversLicense" }, { id: "passport", name: "passportNumber" } ], [CountryCodes.Australia]: [{ id: "driversLicense", name: "driversLicense" }, { id: "passport", name: "passportNumber" }] }; //#endregion //#region src/components/Shared/fields/IdFieldTypeSelector/IndividualIdNumberTypeSelector.tsx function IndividualIdNumberTypeSelector({ country, selected, handleFieldChange }) { const { t } = useTranslation("common"); const options = useMemo$1(() => individualIdNumberOptions[country] ?? [], [country]); useEffect$1(() => { if (!selected && options.length > 0) handleFieldChange(options[0].id); }, [ options, selected, handleFieldChange ]); if (options.length <= 1) return null; return /* @__PURE__ */ jsx(Field, { el: "fieldset", name: "individualIdNumberType", label: t(($) => $["whichTypeOfIdNumberDoYouHave"]), children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, { ...childProps, name: "individualIdNumberType", items: options, value: selected, onChange: (value) => handleFieldChange(value) }) }); } //#endregion //#region src/components/Shared/PatriotActDisclosure/PatriotActDisclosure.tsx var PatriotActDisclosure = () => { const { t } = useTranslation("common"); return /* @__PURE__ */ jsx("div", { className: "adyen-kyc-u-margin-bottom-12", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: t(($) => $["toHelpTheGovernmentFight"]) }) }); }; //#endregion //#region src/components/Individual/fields/IdentityNumber/IdentityNumber.tsx var idNumberFields = ["idNumber", "idNumberExempt"]; function IdentityNumber(props) { const { t } = useTranslation("common"); const { country, data, errors, fieldValidationErrors, idNumberType, obscuredFields, requiredFields, optionalFields, fieldConfig: propFieldConfig, readOnlyFields, handleFieldChange, valid } = props; if (!handleFieldChange) return; const metadata = resolveFieldMetadata((propFieldConfig ?? defaultFieldConfig)[country], { idNumberType }, defaultFieldMetadata); const formUtils = createFormUtils(mergeFieldMetadataIntoProps("idNumberExempt", resolveFieldMetadata(idNumberExemptDefaultConfig[country], {}, idNumberExemptDefaultMetadata), mergeFieldMetadataIntoProps("idNumber", metadata, { requiredFields, optionalFields, obscuredFields, readOnlyFields })), t); const errorMessage = formUtils.getErrorMessage("idNumber", errors, fieldValidationErrors); return /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field__id-number", children: formUtils.isVisibleField("idNumber") && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MaskedInput, { name: "idNumber", type: "text", label: formUtils.getLabel("idNumber", "idNumber"), formatGuidance: translateTranslatable(t, metadata.guidanceText), errorMessage, shouldValidate: errors?.idNumber?.hasError, isValid: !!valid?.idNumber, "aria-required": formUtils.isRequiredField("idNumber"), "aria-invalid": !valid?.idNumber, disabled: data?.idNumberExempt, onBlur: handleFieldChange("idNumber", "blur"), readonly: formUtils.isReadOnly("idNumber"), value: data?.idNumberExempt ? "" : data?.idNumber ?? "", onInput: (e) => { hand