@adyen/kyc-components 3.81.0 → 3.82.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AcceptTermsOfServiceComponent-PDXa81vb.js → AcceptTermsOfServiceComponent-BcmaOZn_.js} +36 -10
- package/dist/{AccountSetupRejected-Du83gH0_.js → AccountSetupRejected-DY2Dr6NS.js} +6 -4
- package/dist/Address-DrcGzzbw.js +1076 -0
- package/dist/Alert-QIcYF1qD.js +231 -0
- package/dist/{Avatar-Cd_8eqbA.js → Avatar-DOeLDY6M.js} +2 -2
- package/dist/BusinessDetailsDropin-BGsHimRA.js +5088 -0
- package/dist/BusinessFinancingComponent-aYQz8gE4.js +45 -0
- package/dist/{BusinessFinancingDropin-DioEfiqH.js → BusinessFinancingDropin-S1KF-NyW.js} +43 -20
- package/dist/BusinessFinancingPage-D2OV4IqT.js +40 -0
- package/dist/{BusinessTypeSelectionPage-uk6eDO5O.js → BusinessTypeSelectionPage-mJaPKHWj.js} +9 -5
- package/dist/Card-D3VCh4en.js +145 -0
- package/dist/Confirm-Dj-igSqL.js +64 -0
- package/dist/{ContractViewer-B2LwC3wV.js → ContractViewer-Byp71k2e.js} +33 -38
- package/dist/CountryField-B2dh1VXh.js +864 -0
- package/dist/CreateIndividualComponent-D6r8z9C9.js +72 -0
- package/dist/CreateTransferInstrumentComponent-Dpj7MNQS.js +67 -0
- package/dist/Currency-BAGjlBuR.js +238 -0
- package/dist/{CustomerSupport-C4n96PMt.js → CustomerSupport-CYHYkHRf.js} +10 -6
- package/dist/{DebugModal-CYO8HZDV.js → DebugModal-B_xZdbHr.js} +8 -5
- package/dist/{DecisionMakerDetailsPage-IT7x1ZRJ.js → DecisionMakerDetailsPage-DMLnRAqQ.js} +11 -4
- package/dist/{DecisionMakers-DkXmcSK4.js → DecisionMakers-CG-_wD3e.js} +224 -96
- package/dist/Dropzone-CWLgt-EE.js +218 -0
- package/dist/{EmbeddedStatus-BS-fmZSm.js → EmbeddedStatus-BIhXDQHZ.js} +4 -4
- package/dist/{EndStateLayout-qrS2Eh-G.js → EndStateLayout-C80dFrcg.js} +2 -2
- package/dist/{FormFlow-BjHYz5-l.js → FormFlow-Df3CEE-c.js} +8 -2
- package/dist/FormNavigation-UiyNK4Uw.js +162 -0
- package/dist/{IndividualOnfidoDropin-B-y2VRFi.js → IndividualOnfidoDropin-CJLptmj_.js} +2796 -64
- package/dist/InputDate-uj7AgGvk.js +43 -0
- package/dist/InputGroup-WBfGDV5F.js +32 -0
- package/dist/InputText-Ds8RrvJq.js +161 -0
- package/dist/{Introduction-CVSG_NSh.js → Introduction-BWWadECu.js} +58 -4
- package/dist/LegalRepresentativeDetailsPage-BYUoJ0JW.js +61 -0
- package/dist/Link-Dc3z0YyP.js +35 -0
- package/dist/ManageIndividualComponent-DQlUh6YC.js +47 -0
- package/dist/ManageTermsOfServiceComponent-B5WnQ4n1.js +47 -0
- package/dist/{ManageTransferInstrumentComponent-Byi222QQ.js → ManageTransferInstrumentComponent-CL8KJIXM.js} +25 -4
- package/dist/MaskedInput-CTOcOcUH.js +799 -0
- package/dist/MaybeModal-BBBahxa3.js +25 -0
- package/dist/Modal-Da5go-OS.js +136 -0
- package/dist/{OnboardingDropinComponent-CDK7PYx0.js → OnboardingDropinComponent-BYFTAjkC.js} +200 -41
- package/dist/PayoutDetailsDropin-UBEJcM6I.js +3694 -0
- package/dist/RadioGroup-DwMTx-4B.js +143 -0
- package/dist/RegistrationAddress-CcHFAuWw.js +2334 -0
- package/dist/{Review-BCxsmMlz.js → Review-B8HKLTsc.js} +8 -4
- package/dist/{RootBusinessDetailsPage-CIWtTZ1z.js → RootBusinessDetailsPage-2rHbq8sK.js} +65 -44
- package/dist/RootIndividualDetailsPage-BYEh8Vlw.js +77 -0
- package/dist/{SignPCIComponent-DzKFISwc.js → SignPCIComponent-DZcOu0WP.js} +17 -8
- package/dist/{SingpassSelection-ChRvdPZF.js → SingpassSelection-D45perGt.js} +6 -6
- package/dist/SoleProprietorshipPage-D4dn0vkS.js +50 -0
- package/dist/{SourceOfFundsPage-DuUOdcam.js → SourceOfFundsPage-By-6cY89.js} +46 -24
- package/dist/Spacer-BK3jDget.js +18 -0
- package/dist/StepProgressIndicator-Jd8MiZZp.js +78 -0
- package/dist/StoreProvider-B_tFiIdr.js +7072 -0
- package/dist/StructuredList-DaepaiVE.js +38 -0
- package/dist/{TaskItemStatus-DDwHsmh8.js → TaskItemStatus-Ccga7-2c.js} +4 -3
- package/dist/{TaskStatusIndicator-Bmm2PsCZ.js → TaskStatusIndicator-CGp1MHRK.js} +2 -2
- package/dist/TaxInformationField-qCHTQShR.js +3062 -0
- package/dist/{TaxReportingDropin-kPcT1Kxt.js → TaxReportingDropin-sxuLHfT9.js} +25 -9
- package/dist/{TileGroup-BC8PSahf.js → TileGroup-B9jBcBJV.js} +4 -2
- package/dist/{TrustDetailsPage-lnVmcLSH.js → TrustDetailsPage-pWuCF62_.js} +506 -19
- package/dist/TrustMemberCompanyPage-Blbw7uAa.js +60 -0
- package/dist/TrustMemberIndividualPage-CkqYu9NE.js +66 -0
- package/dist/UnincorporatedPartnershipIndividualPage-Dd_YBotT.js +66 -0
- package/dist/UnincorporatedPartnershipMemberCompanyPage-Dna06cxg.js +64 -0
- package/dist/{ViewVerificationStatusComponent-D2V-RY2M.js → ViewVerificationStatusComponent-Dnc6ucMj.js} +4 -3
- package/dist/adyen-business-financing.js +33 -22
- package/dist/adyen-individual.js +36 -27
- package/dist/adyen-kyc-components.js +28 -15
- package/dist/adyen-manage-individual.js +25 -26
- package/dist/adyen-manage-terms-of-service.js +26 -27
- package/dist/adyen-manage-transfer-instruments.js +40 -42
- package/dist/adyen-onboarding.js +3 -3
- package/dist/adyen-terms-of-service.js +41 -38
- package/dist/adyen-transfer-instrument.js +38 -29
- package/dist/adyen-verification-status.js +44 -36
- package/dist/analytics-D2q0iFsS.js +61 -0
- package/dist/{bafinUtils-T6TnU7m4.js → bafinUtils-BmLu7dPk.js} +164 -10
- package/dist/basePatterns-BwdnMQxI.js +15 -0
- package/dist/bg-BG-CW9c658c.js +13 -0
- package/dist/bg-BG-CZ8v3rdy.js +30 -0
- package/dist/{bg-BG-Dlzl9Szn.js → bg-BG-D5192UVe.js} +1 -2
- package/dist/{bg-BG-NMIts2sa.js → bg-BG-QC5irNEG.js} +2 -4
- package/dist/commonValidators-DKV_Zthp.js +24 -0
- package/dist/{cs-CZ-BkyFDlAU.js → cs-CZ-DOqH0WeT.js} +1 -2
- package/dist/cs-CZ-Dx6momCa.js +30 -0
- package/dist/cs-CZ-dU9fnQ1g.js +13 -0
- package/dist/{cs-CZ-Csr_35T-.js → cs-CZ-t297LwYw.js} +2 -4
- package/dist/currency-BGwQyxBo.js +36 -0
- package/dist/{da-DK-B5KNtXL8.js → da-DK-B45X2VaJ.js} +1 -2
- package/dist/da-DK-BJ7aTPir.js +13 -0
- package/dist/{da-DK-Dm8o1giq.js → da-DK-BoQic3Gy.js} +2 -4
- package/dist/da-DK-D4H69PX3.js +30 -0
- package/dist/de-DE-C78RLE2G.js +13 -0
- package/dist/{de-DE-BA9tcpNQ.js → de-DE-CWvgMDqU.js} +1 -2
- package/dist/{de-DE-DMFaycio.js → de-DE-Dwagawx1.js} +2 -4
- package/dist/de-DE-wp5-H-ov.js +30 -0
- package/dist/dropinUtils-Bs4XZJuG.js +192 -0
- package/dist/el-GR-BZRKurtr.js +13 -0
- package/dist/{el-GR-DIhHT2q_.js → el-GR-C3rkK_oc.js} +1 -2
- package/dist/el-GR-CK2heqPJ.js +30 -0
- package/dist/{el-GR-CGeBAkDN.js → el-GR-CxwhV-TX.js} +2 -4
- package/dist/emitEvent-CzZf80Am.js +28 -0
- package/dist/{en-US-DX4NHkX-.js → en-US-BbAzROHT.js} +2 -4
- package/dist/{en-US-TrwIHFh-.js → en-US-CAm3meB1.js} +1 -2
- package/dist/{en-US-SbE0c1gn.js → en-US-DIdQJky-.js} +1 -2
- package/dist/en-US.instructions-Ddr7AO05.js +22 -0
- package/dist/{es-ES-pXHx3ODy.js → es-ES-Bsoco8Fj.js} +2 -4
- package/dist/es-ES-BtUSEzkE.js +13 -0
- package/dist/{es-ES-RXwbiHjS.js → es-ES-DKCCgVF8.js} +1 -2
- package/dist/es-ES-Ds3-DtqZ.js +30 -0
- package/dist/et-EE-BCnK305R.js +13 -0
- package/dist/{et-EE-ZssIqWkO.js → et-EE-Bc6ioJRG.js} +1 -2
- package/dist/et-EE-Co-8akjV.js +30 -0
- package/dist/{et-EE-QLVnr6Vl.js → et-EE-DdGlUpaQ.js} +2 -4
- package/dist/{fi-FI-DT351N-G.js → fi-FI-ClnsYt3L.js} +2 -4
- package/dist/fi-FI-Cvar63RH.js +13 -0
- package/dist/fi-FI-DPNeTsJS.js +30 -0
- package/dist/{fi-FI-DmiggQEL.js → fi-FI-Hhku9Lmc.js} +1 -2
- package/dist/fieldConfigurations-Yf8yD64w.js +458 -0
- package/dist/form-rules-DhbF2mY4.js +13 -0
- package/dist/fr-FR-B5543Fe-.js +13 -0
- package/dist/{fr-FR-N5wYE2BZ.js → fr-FR-BYuKsZIb.js} +1 -2
- package/dist/{fr-FR-BNXXNUX_.js → fr-FR-CJI0bIig.js} +2 -4
- package/dist/fr-FR-ChmNQciP.js +30 -0
- package/dist/getName-CNY8xRgy.js +41 -0
- package/dist/{hasDataChanged-e2EDb7Ni.js → hasDataChanged-BaS61ojo.js} +2 -2
- package/dist/{hr-HR-B8AZ4eHJ.js → hr-HR-C0yWizOX.js} +2 -4
- package/dist/{hr-HR-5iwKtfgh.js → hr-HR-CPO5Yw2B.js} +1 -2
- package/dist/hr-HR-DqC8Cgs6.js +30 -0
- package/dist/hr-HR-ZreFlbK9.js +13 -0
- package/dist/hu-HU-B3BihdGh.js +13 -0
- package/dist/hu-HU-BOanVlKb.js +30 -0
- package/dist/{hu-HU-Aq1LsWah.js → hu-HU-mo_0ULJG.js} +1 -2
- package/dist/{hu-HU-DRi6Dz9U.js → hu-HU-wnSie9tz.js} +2 -4
- package/dist/iframeWidget-wJ62Bpmz.js +234 -0
- package/dist/{payout-verification-instant-BIcnFP-p.js → instant-verification-Dvvkyfmp.js} +3 -3
- package/dist/isEmpty-DyzV_vaf.js +23 -0
- package/dist/{it-IT-BeYbInCQ.js → it-IT-BeC2Y1F8.js} +2 -4
- package/dist/it-IT-Dd6xGSe-.js +13 -0
- package/dist/{it-IT-8DEagvb2.js → it-IT-Nl57jui-.js} +1 -2
- package/dist/it-IT-eCrTB65E.js +30 -0
- package/dist/ja-JP-BJljbFIZ.js +30 -0
- package/dist/{ja-JP-BhS-_dIx.js → ja-JP-CbgaW99b.js} +2 -2
- package/dist/{ja-JP-BGAJQs1g.js → ja-JP-D3oQAH7z.js} +1 -2
- package/dist/{ja-JP-C1OQ16fo.js → ja-JP-YoU7mNrK.js} +2 -4
- package/dist/ja-JP-iTbqSPNL.js +13 -0
- package/dist/keys-BpNgnAsD.js +23 -0
- package/dist/{localizeDateString-VqxvPF9j.js → localizeDateString-CEnsnB3Q.js} +2 -2
- package/dist/{lt-LT-HZOWQKZT.js → lt-LT-CVasDmF3.js} +1 -2
- package/dist/lt-LT-DE-4IXNG.js +13 -0
- package/dist/{lt-LT-_MzAcXJo.js → lt-LT-DIe4cKlu.js} +2 -4
- package/dist/lt-LT-DckQGgoT.js +30 -0
- package/dist/lv-LV-CeivEZms.js +13 -0
- package/dist/lv-LV-DP9oRTFv.js +30 -0
- package/dist/{lv-LV-CRhXAjn6.js → lv-LV-DXgW5zWl.js} +2 -4
- package/dist/{lv-LV-F-Z4lDCV.js → lv-LV-Sbsv8-nD.js} +1 -2
- package/dist/{payout-verification-manual-DH9-DdlZ.js → manual-verification-BvZWqA00.js} +3 -3
- package/dist/mapExistingFile-BphSM_zL.js +231 -0
- package/dist/mapScriptLocalization-BgHu6D6K.js +72 -0
- package/dist/mapTransferInstrumentToPayoutAccount-C2sNhjfY.js +30 -0
- package/dist/{nl-NL-C-xUU2N3.js → nl-NL-BHkRnVrj.js} +1 -2
- package/dist/{nl-NL-Dbx0ZmI7.js → nl-NL-Cysslsh2.js} +2 -4
- package/dist/nl-NL-D2QKudfh.js +30 -0
- package/dist/nl-NL-DVENFpd5.js +13 -0
- package/dist/no-NO-C_snYWBc.js +30 -0
- package/dist/no-NO-Dn2UkdoI.js +13 -0
- package/dist/{no-NO-47ncaBZY.js → no-NO-kaAdT9B8.js} +1 -2
- package/dist/{no-NO-C0sfkp82.js → no-NO-zSnPtrDi.js} +2 -4
- package/dist/pl-PL-CQ6c2Qz_.js +30 -0
- package/dist/{pl-PL-CZLzkboH.js → pl-PL-DD8JN4Qf.js} +1 -2
- package/dist/pl-PL-DFAzuceF.js +13 -0
- package/dist/{pl-PL-DAPGaxWi.js → pl-PL-UB5J5JcB.js} +2 -4
- package/dist/pt-PT-C-hbNnsB.js +30 -0
- package/dist/{pt-PT-BY9rcwcF.js → pt-PT-CjsyP_OK.js} +2 -4
- package/dist/{pt-PT-CN4ws8N7.js → pt-PT-Xm-pm3mb.js} +1 -2
- package/dist/pt-PT-_o5xgnxS.js +13 -0
- package/dist/{resolveEnvironment-CDg6ksvB.js → resolveEnvironment-DWnAnjxd.js} +3 -3
- package/dist/ro-RO-BrTWk1Ui.js +30 -0
- package/dist/{ro-RO-RylOvc5g.js → ro-RO-C3m6aJVP.js} +1 -2
- package/dist/{ro-RO-DJLWmWZ4.js → ro-RO-C8yYXQc_.js} +2 -4
- package/dist/ro-RO-D7c_Rj8V.js +13 -0
- package/dist/{rules-BnJSV_NR.js → rules-V2n1q9wP.js} +5 -2
- package/dist/sk-SK-BBSuh2fA.js +13 -0
- package/dist/sk-SK-BTFtoPmI.js +30 -0
- package/dist/{sk-SK-BfJKbtGy.js → sk-SK-BVc-vNQm.js} +1 -2
- package/dist/{sk-SK-B7o3L57C.js → sk-SK-DbOE9C6n.js} +2 -4
- package/dist/sl-SI-BLTuWNf5.js +13 -0
- package/dist/sl-SI-BhVTSmhQ.js +30 -0
- package/dist/{sl-SI-C8CMAkD0.js → sl-SI-Br0UEUPL.js} +2 -4
- package/dist/{sl-SI-DklUFzaY.js → sl-SI-D_rqR0D7.js} +1 -2
- package/dist/style.css +3272 -3254
- package/dist/styles-CLV89_hH.js +3272 -3254
- package/dist/sv-SE-66rqYTxi.js +30 -0
- package/dist/{sv-SE-qduyDIzY.js → sv-SE-B3zoXMuH.js} +1 -2
- package/dist/sv-SE-BUfESAQK.js +13 -0
- package/dist/{sv-SE-Bwh0wKFk.js → sv-SE-BtXmvxx4.js} +2 -4
- package/dist/translation-CPyYrNAr.js +472 -0
- package/dist/types/api/industryCodes/industryCodes.types.d.ts +2 -0
- package/dist/types/api/industryCodes/useIndustryCodes.d.ts +6 -0
- package/dist/types/api/queryKeys.d.ts +2 -1
- package/dist/types/components/BankAccount/forms/PayoutDetails/PayoutDetails.d.ts +1 -0
- package/dist/types/components/BankAccount/forms/PayoutVerificationMethod/payoutVerificationMethodMetadata.d.ts +3 -3
- package/dist/types/components/BankAccount/tasks/PayoutDetailsDropin/payoutDetailsFormConfig.d.ts +0 -9
- package/dist/types/components/Business/forms/BasicInformation/BasicInformationMultiform.d.ts +0 -1
- package/dist/types/components/Business/forms/BusinessDetails/forms.d.ts +6 -0
- package/dist/types/components/Business/forms/rules.d.ts +1 -3
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/utils.d.ts +1 -2
- package/dist/types/components/Business/tasks/BusinessDetailsMultiformDropin/BusinessDetailsMultiform.d.ts +1 -1
- package/dist/types/components/Contract/tasks/ServiceAgreementDropin/ServiceAgreementDropin.d.ts +1 -1
- package/dist/types/components/Contract/tasks/ServiceAgreementDropin/types.d.ts +1 -0
- package/dist/types/components/EFP/tasks/SourceOfFundsDropin/utils.d.ts +0 -1
- package/dist/types/components/EmbeddedDropins/AcceptTermsOfServiceComponent/AcceptTermsOfServiceComponent.d.ts +4 -3
- package/dist/types/components/Individual/forms/Individual/Individual.d.ts +4 -0
- package/dist/types/components/Individual/forms/Individual/ProofOfRelationship/types.d.ts +0 -5
- package/dist/types/components/Shared/fields/IdFieldTypeSelector/countryIdNumberTypes.d.ts +1 -1
- package/dist/types/components/Shared/forms/Address/utils.d.ts +1 -1
- package/dist/types/components/Trust/forms/Trust/Trust.d.ts +1 -0
- package/dist/types/components/Trust/forms/TrustRegistrationDetails/types.d.ts +1 -2
- package/dist/types/components/Trust/tasks/TrustMembers/TrustMembersOverview.d.ts +2 -1
- package/dist/types/components/UnincorporatedPartnership/pages/UnincorporatedPartnershipMemberCompanyPage.d.ts +2 -1
- package/dist/types/components/ui/atoms/ActionsMenu/ActionsMenu.d.ts +2 -1
- package/dist/types/components/ui/atoms/Button/Button.types.d.ts +3 -3
- package/dist/types/components/ui/atoms/ListItem/ListItem.d.ts +2 -1
- package/dist/types/components/ui/atoms/RadioGroupCard/RadioGroupCard.types.d.ts +0 -14
- package/dist/types/components/ui/atoms/RadioWithLabel/RadioWithLabel.d.ts +2 -1
- package/dist/types/components/ui/atoms/SelectList/SelectList.d.ts +1 -0
- package/dist/types/components/ui/atoms/StepProgressIndicator/StepProgressIndicator.d.ts +2 -1
- package/dist/types/components/ui/atoms/StructuredList/StructuredList.d.ts +2 -1
- package/dist/types/components/ui/atoms/Svg/svgs.d.ts +0 -12
- package/dist/types/components/ui/atoms/TaskStatusIndicator/TaskStatusIndicator.d.ts +3 -2
- package/dist/types/components/ui/layout/LandingLayout/LandingLayout.d.ts +1 -1
- package/dist/types/components/ui/layout/StackLayout/StackLayout.d.ts +2 -1
- package/dist/types/components/ui/molecules/InputCurrency/InputCurrency.d.ts +2 -1
- package/dist/types/components/ui/molecules/InputEmail/InputEmail.d.ts +2 -1
- package/dist/types/components/ui/molecules/InputGroup/InputGroup.d.ts +2 -1
- package/dist/types/components/ui/molecules/InputTelephone/InputTelephone.d.ts +2 -1
- package/dist/types/components/ui/molecules/InputText/InputText.d.ts +2 -0
- package/dist/types/components/ui/molecules/MaskedInput/MaskedInput.d.ts +0 -1
- package/dist/types/components/ui/molecules/Tabs/Tabs.d.ts +1 -1
- package/dist/types/context/StateContext/types.d.ts +1 -1
- package/dist/types/core/models/api/accountIdentification.d.ts +5 -4
- package/dist/types/core/models/api/contracts.d.ts +1 -1
- package/dist/types/core/process-field-configurations.d.ts +14 -3
- package/dist/types/embeds/business-financing/AdyenBusinessFinancing.d.ts +1 -1
- package/dist/types/embeds/business-financing/adyen-business-financing.types.d.ts +1 -5
- package/dist/types/embeds/emitEvent.d.ts +14 -0
- package/dist/types/embeds/individual/adyen-individual.types.d.ts +2 -2
- package/dist/types/embeds/manage-individual/AdyenManageIndividual.d.ts +1 -1
- package/dist/types/embeds/manage-individual/adyen-manage-individual.types.d.ts +1 -1
- package/dist/types/embeds/manage-terms-of-service/AdyenManageTermsOfService.d.ts +1 -1
- package/dist/types/embeds/manage-terms-of-service/adyen-manage-terms-of-service.types.d.ts +1 -1
- package/dist/types/embeds/manage-transfer-instruments/AdyenManageTransferInstrument.d.ts +3 -4
- package/dist/types/embeds/manage-transfer-instruments/adyen-manage-transfer-instruments.types.d.ts +3 -4
- package/dist/types/embeds/terms-of-service/adyen-terms-of-service.types.d.ts +4 -3
- package/dist/types/embeds/transfer-instrument/adyen-transfer-instrument.types.d.ts +2 -2
- package/dist/types/embeds/verification-status/adyen-verification-status.types.d.ts +3 -3
- package/dist/types/hooks/introduction/useIntroductionScreens.d.ts +2 -1
- package/dist/types/hooks/introduction/useShouldShowIntroduction.d.ts +2 -1
- package/dist/types/language/utils.d.ts +1 -1
- package/dist/types/utils/addLinkedFields.d.ts +7 -1
- package/dist/types/utils/entityStatusUtil.d.ts +1 -1
- package/dist/types/utils/formUtils.d.ts +1 -1
- package/dist/types/utils/getDisplayErrorMessage.d.ts +1 -1
- package/dist/types/utils/getName.d.ts +1 -1
- package/dist/types/utils/makeSelectItemForRole.d.ts +1 -1
- package/dist/types/utils/masking/masks/businessRegistrationNumberMasks.d.ts +5 -0
- package/dist/types/utils/translation.d.ts +6 -0
- package/dist/types-CAznNNSI.js +160 -0
- package/dist/types-D1xSH_ap.js +74 -0
- package/dist/types-czQuzOK4.js +64 -0
- package/dist/useAssociatedLegalEntity-zrvFkm6w.js +33 -0
- package/dist/useDataset-UxGyu2Za.js +120 -0
- package/dist/useForm-Dah8AZ3S.js +1694 -0
- package/dist/useFormContext-beqGS11A.js +23 -0
- package/dist/useGlobalData-C9KOnjRc.js +205 -0
- package/dist/{useMultiForm-Cbf_MGdG.js → useMultiForm-4axf9sa3.js} +4 -2
- package/dist/{useOnboardingStatus-bmHIDRGr.js → useOnboardingStatus-B-G3ygsd.js} +2 -2
- package/dist/useScenarios-Bs-K4CKb.js +46 -0
- package/dist/{useTermsOfServiceStatus-CMtyaC84.js → useTermsOfServiceStatus-BsBOTabo.js} +2 -2
- package/dist/useToastContext-BA6TVroR.js +51 -0
- package/dist/useUnincorporatedPartnershipMembers-DHPQPPps.js +99 -0
- package/dist/utils-7TgDVOvi.js +29 -0
- package/dist/{utils-B-s8erbM.js → utils-C_6T21UY.js} +46 -4
- package/dist/utils-DNSfZiio.js +70 -0
- package/dist/utils-DxPqN-F5.js +159 -0
- package/dist/{validate-CNlNB2Sq.js → validate-BCgpU6PK.js} +2 -2
- package/dist/validate-CD3D7QeQ.js +382 -0
- package/dist/validate-nbcWPtZJ.js +605 -0
- package/dist/validationError-CInDfoP_.js +86 -0
- package/package.json +44 -45
- package/dist/BusinessDetailsDropin-DR8YA-wz.js +0 -2136
- package/dist/BusinessFinancingComponent-saZxipq7.js +0 -38
- package/dist/BusinessFinancingPage-D7NMT1SV.js +0 -35
- package/dist/CreateIndividualComponent-B_6j8j5H.js +0 -64
- package/dist/CreateTransferInstrumentComponent-DgZq6f2m.js +0 -55
- package/dist/LegalRepresentativeDetailsPage-R9h6n8e1.js +0 -55
- package/dist/ManageIndividualComponent-D3EZWpKz.js +0 -42
- package/dist/ManageTermsOfServiceComponent-C2BMpyzo.js +0 -40
- package/dist/RootIndividualDetailsPage-DGpYhDWo.js +0 -71
- package/dist/SoleProprietorshipPage-CF_TKUfD.js +0 -44
- package/dist/StoreProvider-pdSV8sgb.js +0 -31920
- package/dist/TrustMemberCompanyPage-6_h3PnmT.js +0 -54
- package/dist/TrustMemberIndividualPage-DPlQ6OnQ.js +0 -60
- package/dist/UnincorporatedPartnershipIndividualPage-Bgcip8u6.js +0 -60
- package/dist/UnincorporatedPartnershipMemberCompanyPage-k5Cc0TWw.js +0 -57
- package/dist/VerificationErrorAlert-BEgXW4gA.js +0 -77
- package/dist/bg-BG-BvSUDgGF.js +0 -13
- package/dist/cs-CZ-y4mvq4Lv.js +0 -13
- package/dist/da-DK-qgQOVjDp.js +0 -13
- package/dist/de-DE-pSdsxBpQ.js +0 -13
- package/dist/el-GR-Bvjk5Sw8.js +0 -13
- package/dist/en-US-Bq2Twy6x.js +0 -54
- package/dist/es-ES-Dy1uR2H_.js +0 -13
- package/dist/et-EE-d9V24rcf.js +0 -13
- package/dist/fi-FI-B0fnAFV2.js +0 -13
- package/dist/fr-FR-BoKzVp2q.js +0 -13
- package/dist/getFieldsWithExistingData-BPKk0HGd.js +0 -22
- package/dist/hr-HR-CF0AHQzi.js +0 -13
- package/dist/hu-HU-CSPhOvLC.js +0 -13
- package/dist/it-IT-BH-eqIKH.js +0 -13
- package/dist/ja-JP-B3yqM_FM.js +0 -13
- package/dist/lt-LT-Lzl_Cbw-.js +0 -13
- package/dist/lv-LV-y00wN1pj.js +0 -13
- package/dist/mapFinancialReportsToFinancialInformation-iVvcsDNu.js +0 -66
- package/dist/mapScriptLocalization-H2Re3k5X.js +0 -35
- package/dist/nl-NL-DmnFXAQC.js +0 -13
- package/dist/no-NO-DbvFfP96.js +0 -13
- package/dist/pl-PL--mmxopYA.js +0 -13
- package/dist/pt-PT-BVzXBFp7.js +0 -13
- package/dist/ro-RO-Cdmevo9A.js +0 -13
- package/dist/ru-RU-FZb2upqh.js +0 -13
- package/dist/sk-SK-nfeuTcY5.js +0 -13
- package/dist/sl-SI-DUTZDqkP.js +0 -13
- package/dist/sv-SE-BTx2XKAp.js +0 -13
- package/dist/useUpdateLegalEntity-D91nO-DU.js +0 -57
- package/dist/validate-DhvbSKV4.js +0 -40
- package/dist/zh-CN-wUb4MmTZ.js +0 -13
- package/dist/zh-TW-DNTXHLKa.js +0 -13
|
@@ -0,0 +1,1076 @@
|
|
|
1
|
+
;
|
|
2
|
+
{
|
|
3
|
+
try {
|
|
4
|
+
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
5
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "d1252763-005f-4322-94e9-23a43a5a5b98", e._sentryDebugIdIdentifier = "sentry-dbid-d1252763-005f-4322-94e9-23a43a5a5b98");
|
|
6
|
+
} catch (e) {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
;
|
|
10
|
+
import { az as entriesOf, b as useApiContext, j as useQuery, k as httpPost, o as httpGet, a as useTranslation, V as Icon, U as useAnalyticsContext, w as translateStringOrObject, a8 as CountryCodes, aW as getFormattingRegEx, aU as trimValWithOneSpace, aX as SPECIAL_CHARS, N as createLogger, ap as matchesRegex, an as hasText, ao as isValidMinLength, aq as NO_ALPHABET_REGEX, ar as EMOJI_REGEX, as as hasRepeatedCharacters, at as isInvalidName, aV as INDIVIDUAL_VALID_CHAR_REGEX, u as useI18nContext, X as useExperimentsContext, bt as getMaxLengthByFieldAndCountry } from "./StoreProvider-B_tFiIdr.js";
|
|
11
|
+
import { jsxs, Fragment, jsx } from "preact/jsx-runtime";
|
|
12
|
+
import { useCallback, useState, useMemo, useEffect } from "preact/hooks";
|
|
13
|
+
import { F as Field, c as Select, a as useForm } from "./useForm-Dah8AZ3S.js";
|
|
14
|
+
import { c as createFormUtils, C as CountryField } from "./CountryField-B2dh1VXh.js";
|
|
15
|
+
import { I as InputText } from "./InputText-Ds8RrvJq.js";
|
|
16
|
+
import { u as useDebouncedCallback } from "./analytics-D2q0iFsS.js";
|
|
17
|
+
import { u as useDataset, d as datasetIdentifier } from "./useDataset-UxGyu2Za.js";
|
|
18
|
+
import { C as COUNTRIES_WITH_STATES_DATASET, c as getKeyForField, d as COUNTRIES_WITH_HOUSE_NUMBER_FIRST, g as getAddressSchemaForCountry, e as CONDENSED_ADDRESS_FIELDS } from "./utils-DxPqN-F5.js";
|
|
19
|
+
const operationalAddressIsSameIds = {
|
|
20
|
+
OPERATIONAL_ADDRESS_IS_SAME: "OperationAddressAnswerYes",
|
|
21
|
+
OPERATIONAL_ADDRESS_IS_NOT_SAME: "OperationAddressAnswerNo"
|
|
22
|
+
};
|
|
23
|
+
const operationalAddressIsSameItems = [
|
|
24
|
+
{
|
|
25
|
+
id: operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME,
|
|
26
|
+
name: "operationalAddressIsSameItemName"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME,
|
|
30
|
+
name: "operationalAddressIsNotSameItemName"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
const getNestedTrustedFields = (field, data, trustedFields) => {
|
|
34
|
+
if (trustedFields && data?.[field] && typeof data[field] === "object") {
|
|
35
|
+
return trustedFields.reduce(
|
|
36
|
+
(fields, trustedField) => {
|
|
37
|
+
const splitField = trustedField.split(".");
|
|
38
|
+
if (splitField[0] === field) {
|
|
39
|
+
return [...fields, splitField[1]];
|
|
40
|
+
}
|
|
41
|
+
return fields;
|
|
42
|
+
},
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
};
|
|
48
|
+
const mapAddressData = (verifiedBusiness) => ({
|
|
49
|
+
address: verifiedBusiness.street ?? "",
|
|
50
|
+
otherAddressInformation: verifiedBusiness.street2 ?? "",
|
|
51
|
+
city: verifiedBusiness.city ?? "",
|
|
52
|
+
postalCode: verifiedBusiness.zipCode ?? "",
|
|
53
|
+
stateOrProvince: verifiedBusiness.state ?? ""
|
|
54
|
+
});
|
|
55
|
+
const applyVerifiedBusinessData = (verifiedBusiness, handleChangeFor) => {
|
|
56
|
+
if (!verifiedBusiness) return;
|
|
57
|
+
entriesOf(verifiedBusiness).forEach(([key, value]) => {
|
|
58
|
+
switch (key) {
|
|
59
|
+
case "isPrincipalAddress":
|
|
60
|
+
if (value)
|
|
61
|
+
handleChangeFor(
|
|
62
|
+
"operationalAddressIsSame",
|
|
63
|
+
"input"
|
|
64
|
+
)(operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const isDateOlderThanAYear = (dateString) => {
|
|
70
|
+
if (!dateString) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const inputDate = new Date(dateString);
|
|
74
|
+
if (isNaN(inputDate.getTime())) {
|
|
75
|
+
console.error(`Error: Invalid date format or value for: ${dateString}`);
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const oneYearAgo = /* @__PURE__ */ new Date();
|
|
79
|
+
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
|
|
80
|
+
return inputDate.getTime() < oneYearAgo.getTime();
|
|
81
|
+
};
|
|
82
|
+
const cleanseAddress = async (legalEntityId, baseUrl, data) => {
|
|
83
|
+
return httpPost(
|
|
84
|
+
{
|
|
85
|
+
baseUrl,
|
|
86
|
+
path: `legalEntities/${legalEntityId}/addresses/cleanse`
|
|
87
|
+
},
|
|
88
|
+
data
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
const useAddressCleanse = (data, options) => {
|
|
92
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
93
|
+
return useQuery({
|
|
94
|
+
queryKey: ["addressCleanse", data],
|
|
95
|
+
queryFn: () => cleanseAddress(rootLegalEntityId.value, baseUrl.value, data),
|
|
96
|
+
...options
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const useAddressCleanseImperatively = () => {
|
|
100
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
101
|
+
return useCallback(
|
|
102
|
+
(data) => cleanseAddress(rootLegalEntityId.value, baseUrl.value, data),
|
|
103
|
+
[baseUrl.value, rootLegalEntityId.value]
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
const formatAddressForCleanse = ({
|
|
107
|
+
address,
|
|
108
|
+
city,
|
|
109
|
+
country,
|
|
110
|
+
postalCode
|
|
111
|
+
}) => {
|
|
112
|
+
if (!address || !country) return void 0;
|
|
113
|
+
return `${address} ${city ?? ""} ${country} ${postalCode ?? ""}`.trim();
|
|
114
|
+
};
|
|
115
|
+
const getProvidersStatus = async (legalEntityId, baseUrl, data) => {
|
|
116
|
+
return httpPost(
|
|
117
|
+
{
|
|
118
|
+
baseUrl,
|
|
119
|
+
path: `legalEntities/${legalEntityId}/configurations/providers/status`
|
|
120
|
+
},
|
|
121
|
+
data
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
const useProviderStatus = (data, options) => {
|
|
125
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
126
|
+
return useQuery({
|
|
127
|
+
queryKey: ["providersStatus", data],
|
|
128
|
+
queryFn: () => getProvidersStatus(rootLegalEntityId.value, baseUrl.value, data),
|
|
129
|
+
...options
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
const retrieveAddress = async (legalEntityId, baseUrl, addressId) => {
|
|
133
|
+
return httpGet({
|
|
134
|
+
baseUrl,
|
|
135
|
+
path: `legalEntities/${legalEntityId}/addresses/${addressId}`
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
const useRetrieveAddress = (addressId, options) => {
|
|
139
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
140
|
+
return useQuery({
|
|
141
|
+
queryKey: ["retrieveAddress", addressId],
|
|
142
|
+
queryFn: () => retrieveAddress(rootLegalEntityId.value, baseUrl.value, addressId),
|
|
143
|
+
...options
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const searchAddress = async (legalEntityId, baseUrl, data) => {
|
|
147
|
+
return httpPost(
|
|
148
|
+
{
|
|
149
|
+
baseUrl,
|
|
150
|
+
path: `legalEntities/${legalEntityId}/addresses`
|
|
151
|
+
},
|
|
152
|
+
data
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
const useSearchAddress = (data, options) => {
|
|
156
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
157
|
+
return useQuery({
|
|
158
|
+
queryKey: ["searchAddress", data],
|
|
159
|
+
queryFn: () => searchAddress(rootLegalEntityId.value, baseUrl.value, data),
|
|
160
|
+
...options
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
const getFormattedText = (highlightItems, text) => {
|
|
164
|
+
const formattedText = [];
|
|
165
|
+
let lastHighlightIndex = 0;
|
|
166
|
+
if (highlightItems[0] === "") {
|
|
167
|
+
return [text];
|
|
168
|
+
}
|
|
169
|
+
highlightItems.forEach((highlightValue) => {
|
|
170
|
+
const highlightRange = highlightValue.split("-");
|
|
171
|
+
const highlightInit = parseInt(highlightRange[0]);
|
|
172
|
+
const highlightEnd = parseInt(highlightRange[1]);
|
|
173
|
+
if (lastHighlightIndex < highlightInit) {
|
|
174
|
+
const remain = text.substring(lastHighlightIndex, highlightInit);
|
|
175
|
+
formattedText.push(`${remain}`);
|
|
176
|
+
}
|
|
177
|
+
const boldText = text.substring(highlightInit, highlightEnd);
|
|
178
|
+
formattedText.push(
|
|
179
|
+
/* @__PURE__ */ jsx("span", { className: "adyen-kyc-dropdown-search-element__description--highlight", children: boldText })
|
|
180
|
+
);
|
|
181
|
+
lastHighlightIndex = highlightEnd;
|
|
182
|
+
});
|
|
183
|
+
if (lastHighlightIndex < text.length) {
|
|
184
|
+
formattedText.push(`${text.substring(lastHighlightIndex)}`);
|
|
185
|
+
}
|
|
186
|
+
return formattedText;
|
|
187
|
+
};
|
|
188
|
+
const getHighlightedText = ({
|
|
189
|
+
text = "",
|
|
190
|
+
highlight = "",
|
|
191
|
+
description = ""
|
|
192
|
+
}) => {
|
|
193
|
+
let formattedText = [];
|
|
194
|
+
if (highlight === "") {
|
|
195
|
+
if (description) {
|
|
196
|
+
formattedText.push(`${text}, ${description}`);
|
|
197
|
+
} else {
|
|
198
|
+
formattedText.push(text);
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
const highlightItems = highlight.split(";");
|
|
202
|
+
formattedText = getFormattedText(highlightItems[0].split(","), text);
|
|
203
|
+
if (highlightItems.length > 1) {
|
|
204
|
+
formattedText.push(`, `);
|
|
205
|
+
formattedText.push(/* @__PURE__ */ jsx(Fragment, { children: getFormattedText(highlightItems[1].split(","), description) }));
|
|
206
|
+
} else if (description) {
|
|
207
|
+
formattedText.push(`, ${description}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return formattedText;
|
|
211
|
+
};
|
|
212
|
+
const SearchAddressItem = (item) => {
|
|
213
|
+
const { t } = useTranslation("common");
|
|
214
|
+
const { addressAmount } = item;
|
|
215
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
216
|
+
/* @__PURE__ */ jsx("span", { className: "adyen-kyc-dropdown-search-element__description", children: getHighlightedText(item) }),
|
|
217
|
+
addressAmount && /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-dropdown-search-element__addresses", children: [
|
|
218
|
+
addressAmount,
|
|
219
|
+
" ",
|
|
220
|
+
/* @__PURE__ */ jsxs("span", { className: "adyen-kyc-dropdown-search-element__addresses--text", children: [
|
|
221
|
+
" ",
|
|
222
|
+
t(($) => $["addresses"])
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ jsx(Icon, { name: "arrow-right", className: "adyen-kyc-dropdown-search-element__addresses--icon" })
|
|
225
|
+
] })
|
|
226
|
+
] });
|
|
227
|
+
};
|
|
228
|
+
const SearchAddress = ({
|
|
229
|
+
addressText,
|
|
230
|
+
country,
|
|
231
|
+
labelKey,
|
|
232
|
+
errorMessage,
|
|
233
|
+
isValid,
|
|
234
|
+
readOnly,
|
|
235
|
+
optional,
|
|
236
|
+
handleBlur,
|
|
237
|
+
onAddressTextChange,
|
|
238
|
+
onAutofillAddress
|
|
239
|
+
}) => {
|
|
240
|
+
const { t } = useTranslation("common");
|
|
241
|
+
const userEvents = useAnalyticsContext();
|
|
242
|
+
const [textToSearch, setTextToSearch] = useState();
|
|
243
|
+
const [showSearchList, setShowSearchList] = useState(false);
|
|
244
|
+
const [selectedAddress, setSelectedAddress] = useState();
|
|
245
|
+
const [drilldownContainerId, setDrilldownContainerId] = useState();
|
|
246
|
+
const debouncedSetTextToSearch = useDebouncedCallback(setTextToSearch, 500);
|
|
247
|
+
const searchAddressQuery = useSearchAddress(
|
|
248
|
+
{
|
|
249
|
+
text: textToSearch,
|
|
250
|
+
country,
|
|
251
|
+
container: drilldownContainerId
|
|
252
|
+
},
|
|
253
|
+
{ enabled: showSearchList && Boolean(textToSearch) && Boolean(country) }
|
|
254
|
+
);
|
|
255
|
+
const retrieveAddressQuery = useRetrieveAddress(selectedAddress?.id ?? "", {
|
|
256
|
+
enabled: Boolean(selectedAddress)
|
|
257
|
+
});
|
|
258
|
+
const results = useMemo(
|
|
259
|
+
() => searchAddressQuery.data?.results?.map(formatAddressResult) ?? [],
|
|
260
|
+
[searchAddressQuery.data?.results]
|
|
261
|
+
);
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
if (retrieveAddressQuery.data) {
|
|
264
|
+
userEvents.addPageEvent("Success", {
|
|
265
|
+
actionType: "select",
|
|
266
|
+
actionLevel: "field",
|
|
267
|
+
returnType: "backend",
|
|
268
|
+
returnValue: "retrieveAddress"
|
|
269
|
+
});
|
|
270
|
+
onAutofillAddress(retrieveAddressQuery.data);
|
|
271
|
+
}
|
|
272
|
+
}, [retrieveAddressQuery.data]);
|
|
273
|
+
const onSelectItem = useCallback(
|
|
274
|
+
(selected) => {
|
|
275
|
+
const selectedResult = results.find((i) => i.id === selected.id);
|
|
276
|
+
if (!selectedResult) return;
|
|
277
|
+
if (selectedResult.type === "Address") {
|
|
278
|
+
setSelectedAddress(selected);
|
|
279
|
+
setDrilldownContainerId(void 0);
|
|
280
|
+
} else {
|
|
281
|
+
setDrilldownContainerId(selectedResult.id);
|
|
282
|
+
setTextToSearch(`${selectedResult.text}`);
|
|
283
|
+
setTimeout(() => setShowSearchList(true));
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
[results]
|
|
287
|
+
);
|
|
288
|
+
const items = useMemo(
|
|
289
|
+
() => results.map((item) => ({
|
|
290
|
+
...item,
|
|
291
|
+
name: item.text
|
|
292
|
+
})),
|
|
293
|
+
[results]
|
|
294
|
+
);
|
|
295
|
+
return /* @__PURE__ */ jsx(
|
|
296
|
+
Field,
|
|
297
|
+
{
|
|
298
|
+
name: "address",
|
|
299
|
+
label: translateStringOrObject(t, labelKey),
|
|
300
|
+
errorMessage,
|
|
301
|
+
isValid,
|
|
302
|
+
optional,
|
|
303
|
+
children: (childProps) => /* @__PURE__ */ jsx(
|
|
304
|
+
Select,
|
|
305
|
+
{
|
|
306
|
+
...childProps,
|
|
307
|
+
name: "address",
|
|
308
|
+
filterable: "prefiltered",
|
|
309
|
+
items,
|
|
310
|
+
selected: selectedAddress,
|
|
311
|
+
loading: searchAddressQuery.isLoading || retrieveAddressQuery.isLoading,
|
|
312
|
+
onSelect: onSelectItem,
|
|
313
|
+
getSearchItem: SearchAddressItem,
|
|
314
|
+
behaviour: "textIsData",
|
|
315
|
+
text: addressText,
|
|
316
|
+
setText: (text) => {
|
|
317
|
+
onAddressTextChange(text);
|
|
318
|
+
debouncedSetTextToSearch(text);
|
|
319
|
+
},
|
|
320
|
+
showList: showSearchList,
|
|
321
|
+
setShowList: setShowSearchList,
|
|
322
|
+
readonly: Boolean(readOnly),
|
|
323
|
+
placeholder: t(($) => $["address__placeHolder"]),
|
|
324
|
+
onBlur: handleBlur
|
|
325
|
+
}
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
const formatAddressResult = (item) => {
|
|
331
|
+
if (item.description.includes("Addresses")) {
|
|
332
|
+
const splitDescription = item.description.split(" - ");
|
|
333
|
+
if (splitDescription.length === 1) {
|
|
334
|
+
return {
|
|
335
|
+
...item,
|
|
336
|
+
description: "",
|
|
337
|
+
addressAmount: splitDescription[0].replace("Addresses", "")
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
...item,
|
|
342
|
+
description: splitDescription[0],
|
|
343
|
+
addressAmount: splitDescription[1].replace("Addresses", "")
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
return item;
|
|
347
|
+
};
|
|
348
|
+
const STATE_FIELD = ["stateOrProvince"];
|
|
349
|
+
function StateField({
|
|
350
|
+
data,
|
|
351
|
+
valid,
|
|
352
|
+
errors,
|
|
353
|
+
labels,
|
|
354
|
+
placeholders,
|
|
355
|
+
readonly,
|
|
356
|
+
handleChangeFor,
|
|
357
|
+
selectedCountry,
|
|
358
|
+
handleBlur
|
|
359
|
+
}) {
|
|
360
|
+
const { t } = useTranslation("common");
|
|
361
|
+
const { dataset: states, loaded } = useDataset(
|
|
362
|
+
datasetIdentifier.state(selectedCountry),
|
|
363
|
+
!selectedCountry || !COUNTRIES_WITH_STATES_DATASET.includes(selectedCountry)
|
|
364
|
+
);
|
|
365
|
+
const labelKey = getKeyForField("stateOrProvince", selectedCountry);
|
|
366
|
+
const placeholderKey = getKeyForField("stateOrProvince__placeHolder", selectedCountry);
|
|
367
|
+
if (!loaded || !states.length) return null;
|
|
368
|
+
return /* @__PURE__ */ jsx(
|
|
369
|
+
Field,
|
|
370
|
+
{
|
|
371
|
+
name: "stateOrProvince",
|
|
372
|
+
label: labels?.stateOrProvince || t(($) => $[labelKey]),
|
|
373
|
+
errorMessage: errors.stateOrProvince,
|
|
374
|
+
isValid: valid.stateOrProvince,
|
|
375
|
+
dataTestId: "stateOrProvince",
|
|
376
|
+
children: (childProps) => /* @__PURE__ */ jsx(
|
|
377
|
+
Select,
|
|
378
|
+
{
|
|
379
|
+
...childProps,
|
|
380
|
+
name: "stateOrProvince",
|
|
381
|
+
selected: data.stateOrProvince,
|
|
382
|
+
placeholder: placeholders?.stateOrProvince || t(($) => $[placeholderKey]),
|
|
383
|
+
items: states,
|
|
384
|
+
readonly: readonly && !!data.stateOrProvince,
|
|
385
|
+
onChange: handleChangeFor("stateOrProvince"),
|
|
386
|
+
onBlur: handleBlur
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
function AddressField({
|
|
393
|
+
schema,
|
|
394
|
+
data,
|
|
395
|
+
valid,
|
|
396
|
+
errors,
|
|
397
|
+
fieldProblems,
|
|
398
|
+
fieldName,
|
|
399
|
+
trimOnBlur,
|
|
400
|
+
hideField,
|
|
401
|
+
maxlength,
|
|
402
|
+
readOnly,
|
|
403
|
+
optional,
|
|
404
|
+
handleChangeFor,
|
|
405
|
+
handleBlur
|
|
406
|
+
}) {
|
|
407
|
+
const { t } = useTranslation("common");
|
|
408
|
+
const { data: providerStatus } = useProviderStatus({ providers: ["address"] });
|
|
409
|
+
const addressSearchEnabled = providerStatus?.statuses?.address?.enabled ?? false;
|
|
410
|
+
const formUtils = createFormUtils({}, t);
|
|
411
|
+
const errorMessage = formUtils.getErrorMessage(fieldName, errors ?? {}, fieldProblems);
|
|
412
|
+
const value = data[fieldName];
|
|
413
|
+
const labelKey = getKeyForField(fieldName, data.country);
|
|
414
|
+
const setAddressFieldFromFoundAddress = useCallback(
|
|
415
|
+
({ houseNumberOrName, street, line1 }) => {
|
|
416
|
+
const hasHouseNumber = !!houseNumberOrName;
|
|
417
|
+
if (!street && line1) return handleChangeFor("address", "input")(line1);
|
|
418
|
+
if (hasHouseNumber) {
|
|
419
|
+
const isHouseNumberFirst = data.country ? COUNTRIES_WITH_HOUSE_NUMBER_FIRST.includes(data.country) : false;
|
|
420
|
+
const formattedAddress = isHouseNumberFirst ? `${houseNumberOrName}${" "}${street}` : `${street}${" "}${houseNumberOrName}`;
|
|
421
|
+
return handleChangeFor("address", "input")(formattedAddress);
|
|
422
|
+
}
|
|
423
|
+
return handleChangeFor("address", "input")(street);
|
|
424
|
+
},
|
|
425
|
+
[data.country, handleChangeFor]
|
|
426
|
+
);
|
|
427
|
+
const onAutofillAddress = useCallback(
|
|
428
|
+
(foundAddress) => {
|
|
429
|
+
schema?.forEach((field) => {
|
|
430
|
+
switch (field) {
|
|
431
|
+
case "country":
|
|
432
|
+
handleChangeFor("country", "input")(foundAddress.country ?? " ");
|
|
433
|
+
break;
|
|
434
|
+
case "address":
|
|
435
|
+
setAddressFieldFromFoundAddress(foundAddress);
|
|
436
|
+
break;
|
|
437
|
+
case "otherAddressInformation":
|
|
438
|
+
handleChangeFor("otherAddressInformation", "blur")(foundAddress.street2 ?? " ");
|
|
439
|
+
break;
|
|
440
|
+
case "city":
|
|
441
|
+
handleChangeFor("city", "input")(foundAddress.city ?? " ");
|
|
442
|
+
break;
|
|
443
|
+
case "postalCode":
|
|
444
|
+
handleChangeFor("postalCode", "input")(foundAddress.postalCode ?? " ");
|
|
445
|
+
break;
|
|
446
|
+
case "stateOrProvince":
|
|
447
|
+
handleChangeFor("stateOrProvince", "input")(foundAddress.stateOrProvince ?? " ");
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
},
|
|
452
|
+
[handleChangeFor, schema, setAddressFieldFromFoundAddress]
|
|
453
|
+
);
|
|
454
|
+
if (hideField) return null;
|
|
455
|
+
switch (fieldName) {
|
|
456
|
+
case "address":
|
|
457
|
+
return addressSearchEnabled ? /* @__PURE__ */ jsx(
|
|
458
|
+
SearchAddress,
|
|
459
|
+
{
|
|
460
|
+
addressText: data.address,
|
|
461
|
+
country: data.country,
|
|
462
|
+
labelKey,
|
|
463
|
+
errorMessage,
|
|
464
|
+
isValid: valid?.address,
|
|
465
|
+
readOnly,
|
|
466
|
+
optional,
|
|
467
|
+
handleBlur: (e) => {
|
|
468
|
+
handleChangeFor("address", "blur")(data.address);
|
|
469
|
+
handleBlur?.(e);
|
|
470
|
+
},
|
|
471
|
+
onAddressTextChange: handleChangeFor("address", "input"),
|
|
472
|
+
onAutofillAddress
|
|
473
|
+
}
|
|
474
|
+
) : /* @__PURE__ */ jsx(
|
|
475
|
+
Field,
|
|
476
|
+
{
|
|
477
|
+
name: fieldName,
|
|
478
|
+
label: t(($) => $[labelKey]),
|
|
479
|
+
errorMessage,
|
|
480
|
+
isValid: valid?.[fieldName],
|
|
481
|
+
optional,
|
|
482
|
+
children: (childProps) => /* @__PURE__ */ jsx(
|
|
483
|
+
InputText,
|
|
484
|
+
{
|
|
485
|
+
...childProps,
|
|
486
|
+
name: fieldName,
|
|
487
|
+
value,
|
|
488
|
+
onInput: handleChangeFor(fieldName, "input"),
|
|
489
|
+
onBlur: (e) => {
|
|
490
|
+
handleChangeFor(fieldName, "blur")(e);
|
|
491
|
+
handleBlur?.(e);
|
|
492
|
+
},
|
|
493
|
+
maxLength: maxlength,
|
|
494
|
+
"aria-required": true,
|
|
495
|
+
"aria-invalid": !valid?.[fieldName],
|
|
496
|
+
trimOnBlur,
|
|
497
|
+
readonly: Boolean(readOnly)
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
case "country":
|
|
503
|
+
return /* @__PURE__ */ jsx(
|
|
504
|
+
CountryField,
|
|
505
|
+
{
|
|
506
|
+
data: { country: value },
|
|
507
|
+
valid: { country: valid?.country },
|
|
508
|
+
errors: { country: errorMessage },
|
|
509
|
+
labels: { country: formUtils.getLabel(fieldName, labelKey) },
|
|
510
|
+
readonly: Boolean(readOnly),
|
|
511
|
+
handleChangeFor,
|
|
512
|
+
handleBlur
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
case "stateOrProvince":
|
|
516
|
+
return /* @__PURE__ */ jsx(
|
|
517
|
+
StateField,
|
|
518
|
+
{
|
|
519
|
+
data: { stateOrProvince: value },
|
|
520
|
+
valid: { stateOrProvince: valid?.stateOrProvince },
|
|
521
|
+
errors: { stateOrProvince: errorMessage },
|
|
522
|
+
labels: { stateOrProvince: formUtils.getLabel(fieldName, labelKey) },
|
|
523
|
+
readonly: Boolean(readOnly),
|
|
524
|
+
selectedCountry: data.country,
|
|
525
|
+
handleChangeFor,
|
|
526
|
+
handleBlur
|
|
527
|
+
}
|
|
528
|
+
);
|
|
529
|
+
default:
|
|
530
|
+
return /* @__PURE__ */ jsx(
|
|
531
|
+
Field,
|
|
532
|
+
{
|
|
533
|
+
name: fieldName,
|
|
534
|
+
label: t(($) => $[labelKey]),
|
|
535
|
+
errorMessage,
|
|
536
|
+
isValid: valid?.[fieldName],
|
|
537
|
+
optional,
|
|
538
|
+
children: (childProps) => /* @__PURE__ */ jsx(
|
|
539
|
+
InputText,
|
|
540
|
+
{
|
|
541
|
+
...childProps,
|
|
542
|
+
name: fieldName,
|
|
543
|
+
value: fieldName === "postalCode" ? value?.toUpperCase() : value,
|
|
544
|
+
onInput: handleChangeFor(fieldName, "input"),
|
|
545
|
+
onBlur: (e) => {
|
|
546
|
+
handleChangeFor(fieldName, "blur")(e);
|
|
547
|
+
handleBlur?.(e);
|
|
548
|
+
},
|
|
549
|
+
maxLength: maxlength,
|
|
550
|
+
"aria-required": true,
|
|
551
|
+
"aria-invalid": !valid?.[fieldName],
|
|
552
|
+
trimOnBlur,
|
|
553
|
+
readonly: Boolean(readOnly)
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
}
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
const createRegExpByDigits = (digits) => new RegExp(`^\\d{${digits}}$`);
|
|
561
|
+
const postalCodePatterns = {
|
|
562
|
+
[CountryCodes.Australia]: createRegExpByDigits(4),
|
|
563
|
+
[CountryCodes.Austria]: createRegExpByDigits(4),
|
|
564
|
+
[CountryCodes.Belgium]: /^[1-9]\d{3}$/,
|
|
565
|
+
[CountryCodes.Brazil]: createRegExpByDigits(8),
|
|
566
|
+
[CountryCodes.Bulgaria]: createRegExpByDigits(4),
|
|
567
|
+
[CountryCodes.Canada]: /^[ABCEGHJKLMNPRSTVXY]\d[A-Z][ -]?(?:\d[A-Z]\d)?$/,
|
|
568
|
+
[CountryCodes.Croatia]: /^([1-5])\d{4}$/,
|
|
569
|
+
[CountryCodes.Cyprus]: createRegExpByDigits(4),
|
|
570
|
+
[CountryCodes.CzechRepublic]: /^\d{3} ?\d{2}$/,
|
|
571
|
+
[CountryCodes.Denmark]: /^(?:DK-)?\d{4}$/,
|
|
572
|
+
[CountryCodes.Estonia]: createRegExpByDigits(5),
|
|
573
|
+
[CountryCodes.Finland]: createRegExpByDigits(5),
|
|
574
|
+
[CountryCodes.France]: createRegExpByDigits(5),
|
|
575
|
+
[CountryCodes.Georgia]: createRegExpByDigits(4),
|
|
576
|
+
[CountryCodes.Germany]: createRegExpByDigits(5),
|
|
577
|
+
[CountryCodes.Gibraltar]: /^GX11[ -]?1AA$/,
|
|
578
|
+
[CountryCodes.Greece]: /^\d{3} ?\d{2}$/,
|
|
579
|
+
[CountryCodes.Hungary]: createRegExpByDigits(4),
|
|
580
|
+
[CountryCodes.Iceland]: createRegExpByDigits(3),
|
|
581
|
+
[CountryCodes.Ireland]: /^(?:[ACDEFHKNPRTVWXY]\d{2}|D6W)[ -]?[0-9ACDEFHKNPRTVWXY]{4}$/,
|
|
582
|
+
[CountryCodes.Italy]: createRegExpByDigits(5),
|
|
583
|
+
[CountryCodes.Japan]: createRegExpByDigits(7),
|
|
584
|
+
[CountryCodes.Latvia]: /^(?:LV-)?\d{4}$/,
|
|
585
|
+
[CountryCodes.Liechtenstein]: createRegExpByDigits(4),
|
|
586
|
+
[CountryCodes.Lithuania]: /^(?:LT-)?\d{4,5}$/,
|
|
587
|
+
[CountryCodes.Luxembourg]: createRegExpByDigits(4),
|
|
588
|
+
[CountryCodes.Malaysia]: createRegExpByDigits(5),
|
|
589
|
+
[CountryCodes.Malta]: /^[A-Za-z]{2,3} ?\d{2}(?:\d{2})?$/,
|
|
590
|
+
[CountryCodes.Monaco]: /^980\d{2}$/,
|
|
591
|
+
[CountryCodes.Netherlands]: /^(?:NL-)?[1-9]\d{3} ?(?:[ABCDEFGHIJKLMNOPQRTUVWXYZ][A-Z]|S[BCEFGHIJKLMNOPQRTUVWXYZ])$/,
|
|
592
|
+
[CountryCodes.NewZealand]: createRegExpByDigits(4),
|
|
593
|
+
[CountryCodes.Norway]: createRegExpByDigits(4),
|
|
594
|
+
[CountryCodes.Poland]: /^\d{2}-\d{3}$/,
|
|
595
|
+
[CountryCodes.Portugal]: /^[1-9]\d{3}([- ]?\d{3})?$/,
|
|
596
|
+
[CountryCodes.PuertoRico]: /^\d{5}(?:[ -]?\d{4})?$/,
|
|
597
|
+
// should exactly match CountryCodes.UnitedStates
|
|
598
|
+
[CountryCodes.Romania]: createRegExpByDigits(6),
|
|
599
|
+
[CountryCodes.Slovakia]: /^(SK-)?\d{5}$/,
|
|
600
|
+
[CountryCodes.Slovenia]: /^(SI-)?\d{4}$/,
|
|
601
|
+
[CountryCodes.Singapore]: createRegExpByDigits(6),
|
|
602
|
+
[CountryCodes.Spain]: /(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/,
|
|
603
|
+
[CountryCodes.Sweden]: createRegExpByDigits(5),
|
|
604
|
+
[CountryCodes.Switzerland]: /^[1-9]\d{3}$/,
|
|
605
|
+
// https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation
|
|
606
|
+
// follows most of the bullet points but not all the restrictions
|
|
607
|
+
[CountryCodes.UnitedKingdom]: /^[ABCDEFGHIJKLMNOPRSTUWYZ](?:[ABCDEFGHKLMNOPQRSTUVWXY][0-9][ABEHMNPRVWXY0-9]?|[0-9][ABCDEFGHJKPSTUW0-9]?)(?: ?[0-9][ABDEFGHJLNPQRSTUWXYZ]{1,2})?$/,
|
|
608
|
+
[CountryCodes.UnitedStates]: /^\d{5}(?:[ -]?\d{4})?$/
|
|
609
|
+
};
|
|
610
|
+
const createFormatByDigits = (digits) => {
|
|
611
|
+
const format = new Array(digits).fill("9").join("");
|
|
612
|
+
return {
|
|
613
|
+
// Formatter - excludes non digits and limits to maxlength
|
|
614
|
+
formatter: (val) => val ? val.replace(getFormattingRegEx("^\\d", "g"), "").substring(0, digits) : void 0,
|
|
615
|
+
format,
|
|
616
|
+
maxlength: digits
|
|
617
|
+
};
|
|
618
|
+
};
|
|
619
|
+
const addressDisallowedChars = getFormattingRegEx(SPECIAL_CHARS.replace(/[-(\\/)]/g, ""));
|
|
620
|
+
const addressFormatters = {
|
|
621
|
+
postalCode: {
|
|
622
|
+
formatter: (val, context) => {
|
|
623
|
+
const country = context?.state.data.country;
|
|
624
|
+
const specificRule = countrySpecificFormatters[country]?.postalCode?.formatter;
|
|
625
|
+
if (specificRule) {
|
|
626
|
+
return specificRule(val);
|
|
627
|
+
}
|
|
628
|
+
return val;
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
address: {
|
|
632
|
+
formatter: (val) => val ? trimValWithOneSpace(val).replace(addressDisallowedChars, "") : void 0
|
|
633
|
+
},
|
|
634
|
+
otherAddressInformation: {
|
|
635
|
+
formatter: (val) => val ? trimValWithOneSpace(val).replace(addressDisallowedChars, "") : void 0
|
|
636
|
+
},
|
|
637
|
+
city: {
|
|
638
|
+
formatter: (val) => val ? trimValWithOneSpace(val).replace(addressDisallowedChars, "") : void 0
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
const countrySpecificFormatters = {
|
|
642
|
+
[CountryCodes.Australia]: { postalCode: createFormatByDigits(4) },
|
|
643
|
+
[CountryCodes.Austria]: { postalCode: createFormatByDigits(4) },
|
|
644
|
+
[CountryCodes.Belgium]: { postalCode: createFormatByDigits(4) },
|
|
645
|
+
[CountryCodes.Brazil]: { postalCode: createFormatByDigits(8) },
|
|
646
|
+
[CountryCodes.Bulgaria]: { postalCode: createFormatByDigits(4) },
|
|
647
|
+
[CountryCodes.Canada]: { postalCode: { format: "A9A 9A9 or A9A9A9", maxlength: 7 } },
|
|
648
|
+
[CountryCodes.Croatia]: { postalCode: { format: "[1-5]9999", maxlength: 5 } },
|
|
649
|
+
[CountryCodes.Cyprus]: { postalCode: createFormatByDigits(4) },
|
|
650
|
+
[CountryCodes.CzechRepublic]: { postalCode: { format: "999 99", maxlength: 6 } },
|
|
651
|
+
[CountryCodes.Denmark]: { postalCode: { format: "9999", maxlength: 7 } },
|
|
652
|
+
[CountryCodes.Estonia]: { postalCode: createFormatByDigits(5) },
|
|
653
|
+
[CountryCodes.Finland]: { postalCode: createFormatByDigits(5) },
|
|
654
|
+
[CountryCodes.France]: { postalCode: createFormatByDigits(5) },
|
|
655
|
+
[CountryCodes.Germany]: { postalCode: createFormatByDigits(5) },
|
|
656
|
+
[CountryCodes.Gibraltar]: { postalCode: { format: "GX11 1AA", maxlength: 8 } },
|
|
657
|
+
[CountryCodes.Greece]: { postalCode: { format: "999 99", maxlength: 6 } },
|
|
658
|
+
[CountryCodes.Hungary]: { postalCode: createFormatByDigits(4) },
|
|
659
|
+
[CountryCodes.Iceland]: { postalCode: createFormatByDigits(3) },
|
|
660
|
+
[CountryCodes.Ireland]: { postalCode: { format: "A99 A999", maxlength: 8 } },
|
|
661
|
+
[CountryCodes.Italy]: { postalCode: createFormatByDigits(5) },
|
|
662
|
+
[CountryCodes.Japan]: {
|
|
663
|
+
postalCode: createFormatByDigits(7)
|
|
664
|
+
},
|
|
665
|
+
[CountryCodes.Latvia]: { postalCode: { format: "9999 or LV-9999", maxlength: 7 } },
|
|
666
|
+
[CountryCodes.Liechtenstein]: { postalCode: createFormatByDigits(4) },
|
|
667
|
+
[CountryCodes.Lithuania]: { postalCode: { format: "9999 or 99999 or LT-99999", maxlength: 8 } },
|
|
668
|
+
[CountryCodes.Luxembourg]: { postalCode: createFormatByDigits(4) },
|
|
669
|
+
[CountryCodes.Malaysia]: { postalCode: createFormatByDigits(5) },
|
|
670
|
+
[CountryCodes.Malta]: {
|
|
671
|
+
postalCode: { format: "2 or 3 letters + 2 or 4 digits (with optional space)", maxlength: 8 }
|
|
672
|
+
},
|
|
673
|
+
[CountryCodes.Monaco]: { postalCode: { format: "980NN", maxlength: 5 } },
|
|
674
|
+
[CountryCodes.Netherlands]: { postalCode: { format: "9999AA", maxlength: 7 } },
|
|
675
|
+
[CountryCodes.NewZealand]: { postalCode: createFormatByDigits(4) },
|
|
676
|
+
[CountryCodes.Norway]: { postalCode: createFormatByDigits(4) },
|
|
677
|
+
[CountryCodes.Poland]: {
|
|
678
|
+
postalCode: {
|
|
679
|
+
// Formatter - excludes non digits & hyphens and limits to a maxlength that varies depending on whether a hyphen is present or not
|
|
680
|
+
formatter: (val) => {
|
|
681
|
+
if (!val) return void 0;
|
|
682
|
+
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
683
|
+
const maxlength = nuVal.includes("-") ? 6 : 5;
|
|
684
|
+
return nuVal.substring(0, maxlength);
|
|
685
|
+
},
|
|
686
|
+
format: "99-999",
|
|
687
|
+
maxlength: 6
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
[CountryCodes.Portugal]: {
|
|
691
|
+
postalCode: {
|
|
692
|
+
formatter: (val) => {
|
|
693
|
+
if (!val) return void 0;
|
|
694
|
+
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
695
|
+
return nuVal.substring(0, 8);
|
|
696
|
+
},
|
|
697
|
+
format: "9999-999",
|
|
698
|
+
maxlength: 8
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
[CountryCodes.PuertoRico]: { postalCode: createFormatByDigits(5) },
|
|
702
|
+
[CountryCodes.Romania]: { postalCode: createFormatByDigits(6) },
|
|
703
|
+
[CountryCodes.Singapore]: { postalCode: createFormatByDigits(6) },
|
|
704
|
+
[CountryCodes.Slovakia]: { postalCode: { format: "99999 or SK-99999", maxlength: 8 } },
|
|
705
|
+
[CountryCodes.Slovenia]: { postalCode: { format: "9999 or SI-9999", maxlength: 7 } },
|
|
706
|
+
[CountryCodes.Spain]: { postalCode: createFormatByDigits(5) },
|
|
707
|
+
[CountryCodes.Sweden]: { postalCode: createFormatByDigits(5) },
|
|
708
|
+
[CountryCodes.Switzerland]: { postalCode: createFormatByDigits(4) },
|
|
709
|
+
[CountryCodes.UnitedKingdom]: {
|
|
710
|
+
postalCode: {
|
|
711
|
+
// Disallow special chars & set to maxlength
|
|
712
|
+
formatter: (val) => val ? val.replace(getFormattingRegEx(SPECIAL_CHARS), "").substring(0, 8) : void 0,
|
|
713
|
+
format: "AA99 9AA or A99 9AA or A9 9AA",
|
|
714
|
+
maxlength: 8
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
[CountryCodes.UnitedStates]: {
|
|
718
|
+
postalCode: {
|
|
719
|
+
format: "12345 or 12345-6789",
|
|
720
|
+
maxlength: 10
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
const logger = createLogger();
|
|
725
|
+
const addressValidationRules = (country) => {
|
|
726
|
+
const postalCodeFormat = country ? countrySpecificFormatters[country]?.postalCode?.format : void 0;
|
|
727
|
+
return {
|
|
728
|
+
address: [
|
|
729
|
+
{
|
|
730
|
+
modes: ["blur"],
|
|
731
|
+
validate: (val) => hasText(val),
|
|
732
|
+
errorMessage: "fieldIsRequired"
|
|
733
|
+
}
|
|
734
|
+
],
|
|
735
|
+
postalCode: {
|
|
736
|
+
modes: ["blur"],
|
|
737
|
+
validate: (val) => {
|
|
738
|
+
const pattern = country ? postalCodePatterns[country] : void 0;
|
|
739
|
+
return pattern ? !!val && pattern.test(val) : !!val;
|
|
740
|
+
},
|
|
741
|
+
errorMessage: postalCodeFormat ? {
|
|
742
|
+
key: "invalidFormatExpects",
|
|
743
|
+
values: {
|
|
744
|
+
format: postalCodeFormat
|
|
745
|
+
}
|
|
746
|
+
} : "invalidFormat"
|
|
747
|
+
},
|
|
748
|
+
city: {
|
|
749
|
+
modes: ["blur"],
|
|
750
|
+
validate: hasText,
|
|
751
|
+
errorMessage: "fieldIsRequired"
|
|
752
|
+
},
|
|
753
|
+
stateOrProvince: {
|
|
754
|
+
modes: ["blur"],
|
|
755
|
+
validate: (val) => !!val,
|
|
756
|
+
errorMessage: "fieldIsRequired"
|
|
757
|
+
},
|
|
758
|
+
country: {
|
|
759
|
+
modes: ["blur"],
|
|
760
|
+
validate: (val) => !!val,
|
|
761
|
+
errorMessage: "fieldIsRequired"
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
const addressValidationRulesV4 = (country, i18n) => {
|
|
766
|
+
const postalCodeFormat = country ? countrySpecificFormatters[country]?.postalCode?.format : void 0;
|
|
767
|
+
const MIN_LENGTH_3 = 3;
|
|
768
|
+
const MIN_LENGTH_2 = 2;
|
|
769
|
+
return {
|
|
770
|
+
address: [
|
|
771
|
+
{
|
|
772
|
+
modes: ["blur"],
|
|
773
|
+
validate: (val) => hasText(val),
|
|
774
|
+
errorMessage: "fieldIsRequired"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
modes: ["blur"],
|
|
778
|
+
validate: (input) => !matchesRegex(NO_ALPHABET_REGEX, input),
|
|
779
|
+
errorMessage: "nameMustContainLetters"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
modes: ["blur"],
|
|
783
|
+
validate: (val) => !matchesRegex(EMOJI_REGEX, val) && !hasRepeatedCharacters(val) && !isInvalidName(val) && matchesRegex(INDIVIDUAL_VALID_CHAR_REGEX, val),
|
|
784
|
+
errorMessage: "checkForTypos"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
modes: ["blur"],
|
|
788
|
+
validate: (val) => isValidMinLength(val, MIN_LENGTH_3),
|
|
789
|
+
errorMessage: {
|
|
790
|
+
key: "fieldMustContainAtLeast",
|
|
791
|
+
values: {
|
|
792
|
+
fieldName: i18n.get("address"),
|
|
793
|
+
minLength: String(MIN_LENGTH_3)
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
],
|
|
798
|
+
postalCode: {
|
|
799
|
+
modes: ["blur"],
|
|
800
|
+
validate: (val) => {
|
|
801
|
+
const pattern = country ? postalCodePatterns[country] : void 0;
|
|
802
|
+
return pattern ? !!val && pattern.test(val) : !!val;
|
|
803
|
+
},
|
|
804
|
+
errorMessage: postalCodeFormat ? {
|
|
805
|
+
key: "invalidFormatExpects",
|
|
806
|
+
values: {
|
|
807
|
+
format: postalCodeFormat
|
|
808
|
+
}
|
|
809
|
+
} : "invalidFormat"
|
|
810
|
+
},
|
|
811
|
+
city: [
|
|
812
|
+
{
|
|
813
|
+
modes: ["blur"],
|
|
814
|
+
validate: hasText,
|
|
815
|
+
errorMessage: "fieldIsRequired"
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
modes: ["blur"],
|
|
819
|
+
validate: (input) => !matchesRegex(NO_ALPHABET_REGEX, input),
|
|
820
|
+
errorMessage: "nameMustContainLetters"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
modes: ["blur"],
|
|
824
|
+
validate: (val) => !matchesRegex(EMOJI_REGEX, val) && !hasRepeatedCharacters(val) && !isInvalidName(val) && matchesRegex(INDIVIDUAL_VALID_CHAR_REGEX, val),
|
|
825
|
+
errorMessage: "checkForTypos"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
modes: ["blur"],
|
|
829
|
+
validate: (val) => isValidMinLength(val, MIN_LENGTH_2),
|
|
830
|
+
errorMessage: {
|
|
831
|
+
key: "fieldMustContainAtLeast",
|
|
832
|
+
values: {
|
|
833
|
+
fieldName: i18n.get("city"),
|
|
834
|
+
minLength: String(MIN_LENGTH_2)
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
],
|
|
839
|
+
stateOrProvince: [
|
|
840
|
+
{
|
|
841
|
+
modes: ["blur"],
|
|
842
|
+
validate: (val) => !!val,
|
|
843
|
+
errorMessage: "fieldIsRequired"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
modes: ["blur"],
|
|
847
|
+
validate: (input) => !matchesRegex(NO_ALPHABET_REGEX, input),
|
|
848
|
+
errorMessage: "nameMustContainLetters"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
modes: ["blur"],
|
|
852
|
+
validate: (val) => !hasRepeatedCharacters(val) && !isInvalidName(val),
|
|
853
|
+
errorMessage: "checkForTypos"
|
|
854
|
+
}
|
|
855
|
+
],
|
|
856
|
+
country: [
|
|
857
|
+
{
|
|
858
|
+
modes: ["blur"],
|
|
859
|
+
validate: (val) => !!val,
|
|
860
|
+
errorMessage: "fieldIsRequired"
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
modes: ["blur"],
|
|
864
|
+
validate: (input) => !matchesRegex(NO_ALPHABET_REGEX, input),
|
|
865
|
+
errorMessage: "nameMustContainLetters"
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
modes: ["blur"],
|
|
869
|
+
validate: (val) => !matchesRegex(EMOJI_REGEX, val) && !hasRepeatedCharacters(val) && !isInvalidName(val) && matchesRegex(INDIVIDUAL_VALID_CHAR_REGEX, val),
|
|
870
|
+
errorMessage: "checkForTypos"
|
|
871
|
+
}
|
|
872
|
+
]
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
const addressValidators = ({
|
|
876
|
+
isExperimentEnabled = () => false,
|
|
877
|
+
country,
|
|
878
|
+
i18n
|
|
879
|
+
}) => ({
|
|
880
|
+
...isExperimentEnabled?.("StrictNameAndAddressValidationV4") ? addressValidationRulesV4(country, i18n) : addressValidationRules(country)
|
|
881
|
+
});
|
|
882
|
+
const preventPoBoxValidation = (cleanseAddress2) => ({
|
|
883
|
+
address: {
|
|
884
|
+
modes: ["blur"],
|
|
885
|
+
errorMessage: "addressPoBoxError",
|
|
886
|
+
asyncValidate: async (address, context) => {
|
|
887
|
+
const formData = context?.state?.data ?? {};
|
|
888
|
+
const { country } = formData;
|
|
889
|
+
if (!address || !country) return true;
|
|
890
|
+
const text = formatAddressForCleanse({ ...formData, address });
|
|
891
|
+
if (!text) return true;
|
|
892
|
+
try {
|
|
893
|
+
const { poBox } = await cleanseAddress2({
|
|
894
|
+
text,
|
|
895
|
+
country
|
|
896
|
+
});
|
|
897
|
+
return !poBox;
|
|
898
|
+
} catch (error) {
|
|
899
|
+
logger.error("Error while checking if address is PO box", error);
|
|
900
|
+
return true;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
function Address({
|
|
906
|
+
data: dataProp,
|
|
907
|
+
labels,
|
|
908
|
+
placeholders,
|
|
909
|
+
helperText,
|
|
910
|
+
readOnly,
|
|
911
|
+
hideCountry,
|
|
912
|
+
fieldValidationErrors: propFieldValidationErrors,
|
|
913
|
+
allFields,
|
|
914
|
+
requiredFields,
|
|
915
|
+
optionalFields = ["otherAddressInformation"],
|
|
916
|
+
readOnlyFields,
|
|
917
|
+
obscuredFields,
|
|
918
|
+
trustedFields,
|
|
919
|
+
shouldValidate,
|
|
920
|
+
onChange,
|
|
921
|
+
verifiedAddress,
|
|
922
|
+
condensed,
|
|
923
|
+
handleFieldChange,
|
|
924
|
+
errors: errorProp,
|
|
925
|
+
valid: validProp,
|
|
926
|
+
addressType
|
|
927
|
+
}) {
|
|
928
|
+
const { i18n } = useI18nContext();
|
|
929
|
+
const { t } = useTranslation("common");
|
|
930
|
+
const { isExperimentEnabled } = useExperimentsContext();
|
|
931
|
+
const isStrictNameAndAddressValidationEnabled = isExperimentEnabled(
|
|
932
|
+
"StrictNameAndAddressValidationV4"
|
|
933
|
+
);
|
|
934
|
+
const preventPoBoxes = addressType === "operationalAddress";
|
|
935
|
+
const schema = useMemo(() => {
|
|
936
|
+
if (requiredFields?.length) {
|
|
937
|
+
return requiredFields?.includes("stateOrProvince") || dataProp?.country && COUNTRIES_WITH_STATES_DATASET.includes(dataProp?.country) ? requiredFields : requiredFields?.filter((field) => field !== "stateOrProvince");
|
|
938
|
+
}
|
|
939
|
+
return dataProp?.country && COUNTRIES_WITH_STATES_DATASET.includes(dataProp?.country) ? getAddressSchemaForCountry(dataProp?.country) : getAddressSchemaForCountry(dataProp?.country).filter((ad) => ad !== "stateOrProvince");
|
|
940
|
+
}, [dataProp?.country, requiredFields]);
|
|
941
|
+
const rules = useMemo(() => addressValidationRules(dataProp?.country), [dataProp?.country]);
|
|
942
|
+
const rulesV4 = useMemo(
|
|
943
|
+
() => addressValidationRulesV4(dataProp?.country, i18n),
|
|
944
|
+
[dataProp?.country, i18n]
|
|
945
|
+
);
|
|
946
|
+
const cleanseAddress2 = useAddressCleanseImperatively();
|
|
947
|
+
const asyncRules = useMemo(
|
|
948
|
+
() => preventPoBoxes ? preventPoBoxValidation(cleanseAddress2) : void 0,
|
|
949
|
+
[cleanseAddress2, preventPoBoxes]
|
|
950
|
+
);
|
|
951
|
+
const form = useForm({
|
|
952
|
+
schema,
|
|
953
|
+
defaultData: dataProp,
|
|
954
|
+
formatters: addressFormatters,
|
|
955
|
+
rules: isStrictNameAndAddressValidationEnabled ? rulesV4 : rules,
|
|
956
|
+
asyncRules,
|
|
957
|
+
fieldProblems: propFieldValidationErrors,
|
|
958
|
+
optionalFields,
|
|
959
|
+
obscuredFields,
|
|
960
|
+
trustedFields,
|
|
961
|
+
shouldValidate
|
|
962
|
+
});
|
|
963
|
+
let {
|
|
964
|
+
schema: formSchema,
|
|
965
|
+
data: formData,
|
|
966
|
+
errors: formErrors,
|
|
967
|
+
valid: formValid,
|
|
968
|
+
fieldProblems: formFieldProblems,
|
|
969
|
+
handleChangeFor
|
|
970
|
+
} = form;
|
|
971
|
+
const { isValid } = form;
|
|
972
|
+
if (handleFieldChange && requiredFields && propFieldValidationErrors) {
|
|
973
|
+
const allFields2 = [...requiredFields, ...optionalFields];
|
|
974
|
+
const fieldsInOrder = getAddressSchemaForCountry(dataProp?.country).filter(
|
|
975
|
+
(field) => allFields2.includes(field)
|
|
976
|
+
);
|
|
977
|
+
handleChangeFor = handleFieldChange;
|
|
978
|
+
formData = dataProp ?? {};
|
|
979
|
+
formErrors = errorProp;
|
|
980
|
+
formValid = validProp;
|
|
981
|
+
formFieldProblems = propFieldValidationErrors;
|
|
982
|
+
formSchema = fieldsInOrder;
|
|
983
|
+
}
|
|
984
|
+
useEffect(() => {
|
|
985
|
+
if (verifiedAddress) {
|
|
986
|
+
entriesOf(verifiedAddress).forEach(([key, value]) => {
|
|
987
|
+
if (formData[key] !== value) handleChangeFor(key, "input")(value);
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
}, [verifiedAddress]);
|
|
991
|
+
const formUtils = createFormUtils(
|
|
992
|
+
{
|
|
993
|
+
labels,
|
|
994
|
+
placeholders,
|
|
995
|
+
helperText,
|
|
996
|
+
readOnly,
|
|
997
|
+
requiredFields: schema,
|
|
998
|
+
optionalFields,
|
|
999
|
+
readOnlyFields,
|
|
1000
|
+
trustedFields
|
|
1001
|
+
},
|
|
1002
|
+
t
|
|
1003
|
+
);
|
|
1004
|
+
useEffect(() => {
|
|
1005
|
+
if (hideCountry && dataProp?.country && dataProp.country !== formData.country) {
|
|
1006
|
+
schema.forEach((field) => {
|
|
1007
|
+
return field === "country" ? handleChangeFor("country", "input")(dataProp.country) : handleChangeFor(field, "input")(" ");
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
}, [dataProp?.country, hideCountry]);
|
|
1011
|
+
useEffect(() => {
|
|
1012
|
+
onChange?.({
|
|
1013
|
+
schema: formSchema,
|
|
1014
|
+
data: formData,
|
|
1015
|
+
valid: formValid,
|
|
1016
|
+
errors: formErrors,
|
|
1017
|
+
fieldProblems: formFieldProblems,
|
|
1018
|
+
isValid
|
|
1019
|
+
});
|
|
1020
|
+
}, [formData, formErrors, formFieldProblems, formSchema, formValid, isValid]);
|
|
1021
|
+
const createField = (fieldName) => {
|
|
1022
|
+
if (!formUtils.isRequiredField(fieldName) && !formUtils.isOptionalField(fieldName)) return null;
|
|
1023
|
+
const hideField = fieldName === "country" && hideCountry;
|
|
1024
|
+
return /* @__PURE__ */ jsx(
|
|
1025
|
+
AddressField,
|
|
1026
|
+
{
|
|
1027
|
+
schema: formSchema,
|
|
1028
|
+
data: formData,
|
|
1029
|
+
valid: formValid,
|
|
1030
|
+
errors: formErrors,
|
|
1031
|
+
fieldProblems: formFieldProblems,
|
|
1032
|
+
fieldName,
|
|
1033
|
+
maxlength: getMaxLengthByFieldAndCountry(
|
|
1034
|
+
countrySpecificFormatters,
|
|
1035
|
+
fieldName,
|
|
1036
|
+
formData.country
|
|
1037
|
+
),
|
|
1038
|
+
hideField,
|
|
1039
|
+
readOnly: formUtils.isReadOnly(fieldName) || formUtils.isTrusted(fieldName),
|
|
1040
|
+
optional: formUtils.isOptionalField(fieldName),
|
|
1041
|
+
trimOnBlur: true,
|
|
1042
|
+
handleChangeFor
|
|
1043
|
+
},
|
|
1044
|
+
fieldName
|
|
1045
|
+
);
|
|
1046
|
+
};
|
|
1047
|
+
if (condensed && formData?.country) {
|
|
1048
|
+
const condensedFields = CONDENSED_ADDRESS_FIELDS[formData.country] ?? [];
|
|
1049
|
+
switch (formData?.country) {
|
|
1050
|
+
case "US":
|
|
1051
|
+
return /* @__PURE__ */ jsxs("fieldset", { "aria-label": t(($) => $[addressType]), className: "adyen-kyc-address", children: [
|
|
1052
|
+
formSchema.filter((field) => !condensedFields.includes(field)).map((filteredField) => createField(filteredField)),
|
|
1053
|
+
condensedFields.length && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-address__condensed-fields", children: condensedFields.map((field) => createField(field)) })
|
|
1054
|
+
] });
|
|
1055
|
+
default:
|
|
1056
|
+
return /* @__PURE__ */ jsx("fieldset", { "aria-label": t(($) => $[addressType]), className: "adyen-kyc-address", children: formSchema.map((field) => createField(field)) });
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
return /* @__PURE__ */ jsx("fieldset", { "aria-label": t(($) => $[addressType]), className: "adyen-kyc-address", children: formSchema.map((field) => createField(field)) });
|
|
1060
|
+
}
|
|
1061
|
+
export {
|
|
1062
|
+
Address as A,
|
|
1063
|
+
STATE_FIELD as S,
|
|
1064
|
+
addressValidators as a,
|
|
1065
|
+
addressFormatters as b,
|
|
1066
|
+
useAddressCleanse as c,
|
|
1067
|
+
StateField as d,
|
|
1068
|
+
applyVerifiedBusinessData as e,
|
|
1069
|
+
formatAddressForCleanse as f,
|
|
1070
|
+
getNestedTrustedFields as g,
|
|
1071
|
+
operationalAddressIsSameItems as h,
|
|
1072
|
+
isDateOlderThanAYear as i,
|
|
1073
|
+
mapAddressData as m,
|
|
1074
|
+
operationalAddressIsSameIds as o,
|
|
1075
|
+
useProviderStatus as u
|
|
1076
|
+
};
|