@adyen/kyc-components 3.71.3 → 3.73.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-Dsv4mY-k.js → AcceptTermsOfServiceComponent-Ib77t0y9.js} +11 -198
- package/dist/{AccountSetupRejected-Cz2iWdPE.js → AccountSetupRejected-Dcrt_Wjb.js} +3 -3
- package/dist/{BusinessDetailsDropin-CxJ7Ga0q.js → BusinessDetailsDropin-D10LCgSY.js} +199 -98
- package/dist/BusinessFinancingPage-CVRFAPxm.js +35 -0
- package/dist/{BusinessTypeSelection-wbCak0Us.js → BusinessTypeSelectionPage-DK4PY3_p.js} +47 -40
- package/dist/{CXEL7IU7-B9HOZi-H.js → CXEL7IU7-DyO75Uac.js} +3 -3
- package/dist/{CreateIndividualComponent-C3uFsTUT.js → CreateIndividualComponent-BiMYdvQq.js} +265 -1227
- package/dist/CreateTransferInstrumentComponent-CaBD_3yr.js +1082 -0
- package/dist/{CustomerSupport-BuxhbwRm.js → CustomerSupport-BqyayBTP.js} +4 -3
- package/dist/{DebugModal-B_DAGmya.js → DebugModal-CO_clhiW.js} +12 -11
- package/dist/DecisionMakerDetailsPage-C0wmo475.js +80 -0
- package/dist/{DecisionMakers-L6oYW0-J.js → DecisionMakers-B2rmqsfW.js} +6 -5
- package/dist/{EventEmitter-DTdpTyY7.js → EventEmitter-BmWcyurq.js} +1015 -1407
- package/dist/FormNavigation-W4SYacAX.js +205 -0
- package/dist/{HASRA6WW-CBmvzSwj.js → HASRA6WW-Cj_9-H1H.js} +2 -2
- package/dist/{I3HPI4QX-9ko0FQd6.js → I3HPI4QX-CCkDLYPH.js} +3 -3
- package/dist/{Introduction-C16zT64A.js → Introduction-DlsETOX7.js} +14 -6
- package/dist/LegalRepresentativeDetailsPage-Dbp83K05.js +55 -0
- package/dist/ManageIndividualComponent-D-47IZH6.js +190 -0
- package/dist/Modal-6j0jkYFX.js +135 -0
- package/dist/PayoutDetailsPage-CWAOATOb.js +57 -0
- package/dist/{Review-BbsJ9Iv_.js → Review-B0v_A189.js} +4 -3
- package/dist/RootBusinessDetailsPage-D_3xc6YN.js +43 -0
- package/dist/RootIndividualDetailsPage-CT-rsvpD.js +71 -0
- package/dist/{EmbedShell-DpZpuM-4.js → ShadowStylesRoot-DMxqA0py.js} +28 -10
- package/dist/{SingpassSelection-Biuh42TV.js → SingpassSelection-DB5BHBy1.js} +2 -2
- package/dist/SoleProprietorshipPage-CFZ3F57F.js +45 -0
- package/dist/{SourceOfFunds.module-CwVf62zO.js → SourceOfFunds.module-sL22I1gI.js} +2 -2
- package/dist/{SourceOfFundsDropin-Bz8cTP4R.js → SourceOfFundsPage-Tde0WbSG.js} +44 -20
- package/dist/Tag-DdkVScyr.js +41 -0
- package/dist/{TaskItemStatus-DzTphBn7.js → TaskItemStatus-DqNACVFe.js} +4 -32
- package/dist/{TaxReportingDropin-xDar-7mC.js → TaxReportingDropin-CPQZXr1j.js} +6 -5
- package/dist/{TrustOuter-2GEllVo3.js → TrustDetailsPage-BGkbFLaG.js} +20 -29
- package/dist/TrustMemberCompanyPage-CQi1xGDz.js +55 -0
- package/dist/TrustMemberIndividualPage-BI_XyXhS.js +60 -0
- package/dist/UnincorporatedPartnershipIndividualPage-B6gLv55I.js +60 -0
- package/dist/UnincorporatedPartnershipMemberCompanyPage-jHwnxg3n.js +58 -0
- package/dist/adyen-individual.js +41 -0
- package/dist/adyen-kyc-components.js +3 -6
- package/dist/adyen-manage-individual.js +41 -0
- package/dist/adyen-terms-of-service.js +47 -0
- package/dist/adyen-terms-of-service.vue_vue_type_script_lang-CLUMW5mI.js +34 -0
- package/dist/adyen-transfer-instrument.js +59 -0
- package/dist/adyen-transfer-instrument.vue_vue_type_script_lang-uEpG3KG3.js +45 -0
- package/dist/{bg-BG-CzEF3tzV.js → bg-BG-CZRQZyXO.js} +12 -5
- package/dist/{cs-CZ-TMjslGp_.js → cs-CZ-BbUFgifZ.js} +12 -5
- package/dist/{css-CypmaTn8.js → css-CFY1scQ9.js} +2 -2
- package/dist/{da-DK-DWzvDWZJ.js → da-DK-CP71BFS7.js} +12 -5
- package/dist/{de-DE-BtIL-7gp.js → de-DE-DY56JGZt.js} +12 -5
- package/dist/{el-GR-DHSSlqbw.js → el-GR-CnENEp5c.js} +12 -5
- package/dist/{es-ES-OwkE9-Cu.js → es-ES-dV62vQcV.js} +28 -21
- package/dist/{et-EE-DvixWnLd.js → et-EE-BBgAN3Wc.js} +12 -5
- package/dist/{fi-FI-DZiXWe_g.js → fi-FI-DVmGWIxn.js} +12 -5
- package/dist/{fr-FR-BBwiWhiT.js → fr-FR-VwG8Rg7R.js} +12 -5
- package/dist/{hr-HR-DJYofWKU.js → hr-HR-Bs_lxjxQ.js} +12 -5
- package/dist/{hu-HU-k9c6wZld.js → hu-HU-8dVSiOZM.js} +12 -5
- package/dist/{core-BsRrVyKB.js → index-D6YGuPb5.js} +810 -1908
- package/dist/{it-IT-oOwbWW3K.js → it-IT-DvwWMDl1.js} +12 -5
- package/dist/{ja-JP-CT3g8Hhn.js → ja-JP-BB6zzyEg.js} +12 -5
- package/dist/{json-DDReVYSW.js → json-RoVXbcQq.js} +2 -2
- package/dist/localizeDateString-DtxuKMqB.js +27 -0
- package/dist/{lt-LT-CVHIsEF8.js → lt-LT-BQtNojlb.js} +12 -5
- package/dist/{lv-LV-BFx0cvZ2.js → lv-LV-BpEw5uN5.js} +12 -5
- package/dist/mapExistingFile-CwT8TZ5D.js +870 -0
- package/dist/{nl-NL-rmSZu4Rf.js → nl-NL-vBEBXTP-.js} +12 -5
- package/dist/{no-NO-BOnQvimN.js → no-NO-BFhTqUoD.js} +12 -5
- package/dist/{pl-PL-5j22An4E.js → pl-PL-dsGZvzVf.js} +12 -5
- package/dist/{plaintext-Cjcgjaqv.js → plaintext-DpBLPLCO.js} +2 -2
- package/dist/{terms-of-service-preact.js → preact/adyen-individual.js} +4 -4
- package/dist/{individual-react.js → preact/adyen-manage-individual.js} +4 -4
- package/dist/{terms-of-service-react.js → preact/adyen-terms-of-service.js} +5 -4
- package/dist/preact/adyen-transfer-instrument.js +16 -0
- package/dist/{pt-PT-DP8U1qyu.js → pt-PT-BB38pZbh.js} +12 -5
- package/dist/{ro-RO-BTdtoC6P.js → ro-RO-BgxNxoxJ.js} +12 -5
- package/dist/{sk-SK-DYTx4mOB.js → sk-SK-rtDeCztl.js} +12 -5
- package/dist/{sl-SI-D8CiUN69.js → sl-SI-qoGCwUdU.js} +12 -5
- package/dist/style.css +1942 -1990
- package/dist/styles-CLV89_hH.js +1942 -1990
- package/dist/{sv-SE-Daslxeqr.js → sv-SE-f1T7PBSW.js} +12 -5
- package/dist/types/api/transferInstruments/useTransferInstrument.d.ts +2 -1
- package/dist/types/components/BankAccount/forms/BankDocument/types.d.ts +2 -0
- package/dist/types/components/BankAccount/forms/PayoutDetails/types.d.ts +2 -5
- package/dist/types/components/BankAccount/forms/PayoutVerificationMethod/types.d.ts +1 -11
- package/dist/types/components/BankAccount/pages/PayoutDetailsPage.d.ts +14 -0
- package/dist/types/components/BankAccount/tasks/PayoutDetailsDropin/PayoutDetailsDropin.d.ts +1 -1
- package/dist/types/components/BankAccount/tasks/PayoutDetailsDropin/payoutDetailsFormConfig.d.ts +12 -1
- package/dist/types/components/Business/forms/BusinessDetails/forms.d.ts +14 -0
- package/dist/types/components/Business/forms/BusinessDetails/types.d.ts +1 -0
- package/dist/types/components/Business/forms/ProofOfOwnershipDocument/ProofOfOwnershipDocument.d.ts +2 -0
- package/dist/types/components/Business/forms/ProofOfOwnershipDocument/types.d.ts +8 -0
- package/dist/types/components/Business/forms/rules.d.ts +0 -1
- package/dist/types/components/Business/mapping/businessDetails/businessDetailsKeyMappings.d.ts +1 -1
- package/dist/types/components/Business/mapping/businessDetails/solePropBusinessDetailsKeyMappings.d.ts +1 -1
- package/dist/types/components/Business/pages/RootBusinessDetailsPage.d.ts +8 -0
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/types.d.ts +1 -3
- package/dist/types/components/EFP/pages/BusinessFinancingPage.d.ts +7 -0
- package/dist/types/components/EFP/pages/SourceOfFundsPage.d.ts +7 -0
- package/dist/types/components/EmbeddedDropins/OnboardingDropinComponent/DropinComposer/DropinComposer.d.ts +1 -1
- package/dist/types/components/Individual/forms/Individual/IdDocumentUpload/types.d.ts +1 -0
- package/dist/types/components/Individual/forms/Individual/IdVerificationMethod/IdVerificationMethod.d.ts +0 -1
- package/dist/types/components/Individual/forms/IndividualOnfido/IdVerificationMethod/IdVerificationMethod.types.d.ts +0 -2
- package/dist/types/components/Individual/forms/IndividualOnfido/IndividualOnfido.types.d.ts +2 -1
- package/dist/types/components/Individual/pages/DecisionMakerDetailsPage.d.ts +20 -0
- package/dist/types/components/Individual/pages/LegalRepresentativeDetailsPage.d.ts +12 -0
- package/dist/types/components/Individual/pages/RootIndividualDetailsPage.d.ts +16 -0
- package/dist/types/components/Individual/tasks/DecisionMakers/types.d.ts +0 -2
- package/dist/types/components/Shared/Introduction/Introduction.d.ts +4 -2
- package/dist/types/components/Shared/forms/Address/utils.d.ts +1 -1
- package/dist/types/components/Shared/forms/BusinessTypeSelection/BusinessTypeSelection.d.ts +1 -1
- package/dist/types/components/Shared/forms/BusinessTypeSelection/types.d.ts +3 -5
- package/dist/types/components/Shared/forms/DocumentUpload/DocumentUpload.d.ts +1 -1
- package/dist/types/components/Shared/forms/DocumentUpload/types.d.ts +5 -0
- package/dist/types/components/Shared/pages/BusinessTypeSelectionPage.d.ts +2 -0
- package/dist/types/components/Shared/tasks/TaskList/TaskList.d.ts +7 -1
- package/dist/types/components/Shared/tasks/TaskList/types.d.ts +0 -6
- package/dist/types/components/Shared/tasks/TaskList/utils.d.ts +1 -0
- package/dist/types/components/SoleProprietorship/pages/SoleProprietorshipPage.d.ts +8 -0
- package/dist/types/components/Trust/pages/TrustDetailsPage.d.ts +10 -0
- package/dist/types/components/Trust/pages/TrustMemberCompanyPage.d.ts +11 -0
- package/dist/types/components/Trust/pages/TrustMemberIndividualPage.d.ts +16 -0
- package/dist/types/components/Trust/pages/TrustMemberRoleAndTypePage.d.ts +9 -0
- package/dist/types/components/Trust/tasks/TrustMembers/TrustMembersOverview.d.ts +4 -7
- package/dist/types/components/UnincorporatedPartnership/hooks/useUnincorporatedPartnershipNavigation.d.ts +0 -2
- package/dist/types/components/UnincorporatedPartnership/pages/UnincorporatedPartnershipIndividualPage.d.ts +16 -0
- package/dist/types/components/UnincorporatedPartnership/pages/UnincorporatedPartnershipMemberCompanyPage.d.ts +11 -0
- package/dist/types/components/UnincorporatedPartnership/pages/UnincorporatedPartnershipMemberRoleAndTypePage.d.ts +8 -0
- package/dist/types/components/UnincorporatedPartnership/tasks/UnincorporatedPartnershipMembers/UnincorporatedPartnershipMembersOverview.d.ts +1 -5
- package/dist/types/components/UnincorporatedPartnership/tasks/UnincorporatedPartnershipRoleAndType/UnincorporatedPartnershipRoleAndType.d.ts +1 -1
- package/dist/types/components/ui/molecules/Dropzone/types.d.ts +1 -0
- package/dist/types/context/AnalyticsContext/AnalyticsProvider.d.ts +2 -2
- package/dist/types/context/ExperimentContext/ExperimentsContextProvider.d.ts +1 -1
- package/dist/types/context/ExperimentContext/types.d.ts +6 -6
- package/dist/types/core/EmbedShell/EmbedShell.d.ts +3 -4
- package/dist/types/core/environment/resolveEnvironment.d.ts +1 -0
- package/dist/types/core/models/api/document.d.ts +1 -1
- package/dist/types/embeds/ShadowStylesRoot.d.ts +3 -0
- package/dist/types/embeds/baseEmbedProps.d.ts +30 -0
- package/dist/types/embeds/individual/AdyenIndividualPreact.d.ts +3 -0
- package/dist/types/embeds/individual/adyen-individual.types.d.ts +30 -0
- package/dist/types/embeds/manage-individual/AdyenManageIndividualPreact.d.ts +3 -0
- package/dist/types/embeds/manage-individual/adyen-manage-individual.d.ts +1 -0
- package/dist/types/embeds/manage-individual/adyen-manage-individual.types.d.ts +29 -0
- package/dist/types/embeds/terms-of-service/AdyenTermsOfServicePreact.d.ts +3 -0
- package/dist/types/embeds/terms-of-service/adyen-terms-of-service.types.d.ts +30 -0
- package/dist/types/embeds/transfer-instrument/AdyenTransferInstrumentPreact.d.ts +3 -0
- package/dist/types/embeds/transfer-instrument/adyen-transfer-instrument.types.d.ts +36 -0
- package/dist/types/hooks/useDataConflicts.d.ts +1 -5
- package/dist/types/stores/globalStore/taskTypes.d.ts +0 -1
- package/dist/types/utils/country.d.ts +3 -2
- package/dist/types/utils/entityStatusUtil.d.ts +1 -1
- package/dist/types/utils/getDisplayErrorMessage.d.ts +3 -0
- package/dist/useToastContext-DiQ_PGrE.js +33 -0
- package/dist/{utils-Fkk087z-.js → utils-Bl8l2XY4.js} +4 -4
- package/dist/vue/adyen-individual.js +43 -0
- package/dist/vue/adyen-manage-individual.js +46 -0
- package/dist/vue/adyen-terms-of-service.js +26 -0
- package/dist/vue/adyen-transfer-instrument.js +28 -0
- package/dist/{yaml-GnQQmt7i.js → yaml-DEzkYiMR.js} +2 -2
- package/package.json +28 -61
- package/dist/adyenConfig.js +0 -34
- package/dist/individual-preact.js +0 -15
- package/dist/individual-vue.js +0 -35
- package/dist/individual.js +0 -58
- package/dist/listToRecord-CO3M1Q74.js +0 -19
- package/dist/terms-of-service.js +0 -58
- package/dist/transfer-instrument-preact.js +0 -32
- package/dist/transfer-instrument-react.js +0 -32
- package/dist/transfer-instrument-vue.js +0 -41
- package/dist/transfer-instrument.js +0 -38
- package/dist/types/components/BankAccount/forms/PayoutDetails/utils.d.ts +0 -2
- package/dist/types/components/BankAccount/forms/PayoutVerificationMethod/PreferInstantVerificationMethod/PreferInstantVerificationMethod.d.ts +0 -22
- package/dist/types/components/Individual/forms/Individual/IndividualOuter.d.ts +0 -26
- package/dist/types/components/Trust/tasks/TrustDropin/TrustOuter.d.ts +0 -10
- package/dist/types/components/ui/atoms/List/List.d.ts +0 -9
- package/dist/types/embeds/adyenConfig.d.ts +0 -22
- package/dist/types/embeds/individual/individual.types.d.ts +0 -12
- package/dist/types/embeds/individual/preact/Individual.d.ts +0 -15
- package/dist/types/embeds/individual/react/Individual.d.ts +0 -20
- package/dist/types/embeds/individual/vue/individual.types.d.ts +0 -9
- package/dist/types/embeds/terms-of-service/preact/TermsOfService.d.ts +0 -10
- package/dist/types/embeds/terms-of-service/react/TermsOfService.d.ts +0 -20
- package/dist/types/embeds/terms-of-service/terms-of-service.types.d.ts +0 -8
- package/dist/types/embeds/transfer-instrument/preact/TransferInstrument.d.ts +0 -15
- package/dist/types/embeds/transfer-instrument/react/TransferInstrument.d.ts +0 -20
- package/dist/types/embeds/transfer-instrument/transfer-instrument.types.d.ts +0 -17
- package/dist/types/embeds/transfer-instrument/vue/transfer-instrument.types.d.ts +0 -9
- package/dist/types/embeds/types.d.ts +0 -19
- package/dist/types/embeds/utils.d.ts +0 -7
- package/dist/utils-Du6OO4ZK.js +0 -27
|
@@ -0,0 +1,1082 @@
|
|
|
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] = "55f7835b-f348-47c9-ab50-0835dca63db9", e._sentryDebugIdIdentifier = "sentry-dbid-55f7835b-f348-47c9-ab50-0835dca63db9");
|
|
6
|
+
} catch (e) {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
;
|
|
10
|
+
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
11
|
+
import { useState, useCallback, useMemo, useEffect } from "preact/hooks";
|
|
12
|
+
import { b as useI18nContext, x as useAnalyticsContext, al as useExperimentsContext, aj as LoaderWrapper, aW as summaryStep, O as Button, aX as Summary, u as useApiContext, a as useQuery, U as httpPost, h as httpGet, V as useMutation, a6 as skipToken, bv as useQueryClient, bZ as createFormRules, c_ as mapPayoutAccountSchemaToApiBankAccount, c$ as payoutComponentKeyMapping, cI as keysOf, aU as summaryItem, aD as CountryCodes, d0 as payoutSteps, G as useSettingsContext, Q as getLegalEntityCountry, d1 as getPayoutAccountHolderName, g as currencyByCountry, aB as getLegalEntityNameBasedOnType, ah as TaskTypes, am as isInstantVerifiedAccount, D as useStateContext, Y as getCapabilityProblems, H as SettingNames, c as cloneObject, B as datasetUtilities, T as Typography, d2 as PayoutDetails, i as isEmpty, P as useLegalEntity, z as useAssociatedLegalEntity, L as LegalEntityType, M as Loader } from "./EventEmitter-BmWcyurq.js";
|
|
13
|
+
import { b as ModalContent, a as ModalHeader, c as ModalFooter, M as Modal } from "./Modal-6j0jkYFX.js";
|
|
14
|
+
import { M as MaybeModal, S as Spacer, u as useToastContext } from "./useToastContext-DiQ_PGrE.js";
|
|
15
|
+
import { t as trackNavigation, F as FormRouterContextProvider, k as getDocument, m as mapExistingFile, l as getPageName, o as createDocumentRequest, x as mapWith, y as augmentWithCountryConfigs, q as documentApiUtils, u as useScenarioConfiguration, a as getPropsFromConfigurations, z as useUnifyLoadingStatus, b as getRequiredForms, c as addValidityToForms, d as useFormComposer, s as omitObscuredFieldsIfUnchanged, i as isValidationError, p as processValidationErrors, A as isIdDocumentUploadError, B as isBankStatementUploadError, h as isMaintenanceModeError, C as mapCreateOrUpdateTransferInstrumentErrorMessageToTranslatable, w as getFileExtention } from "./mapExistingFile-CwT8TZ5D.js";
|
|
16
|
+
import { F as FormNavigation, S as StepProgressIndicator } from "./FormNavigation-W4SYacAX.js";
|
|
17
|
+
const FormWrapper = ({
|
|
18
|
+
asModal = false,
|
|
19
|
+
summary,
|
|
20
|
+
taskName,
|
|
21
|
+
children,
|
|
22
|
+
handleNextClick,
|
|
23
|
+
handleBackClick,
|
|
24
|
+
handleCloseClick,
|
|
25
|
+
handleHomeClick,
|
|
26
|
+
loadingStatus,
|
|
27
|
+
gotoFormByFormIndex,
|
|
28
|
+
forms,
|
|
29
|
+
activeForm,
|
|
30
|
+
validateForm,
|
|
31
|
+
navigationTrackingParams,
|
|
32
|
+
hideSidebar,
|
|
33
|
+
hideFooter,
|
|
34
|
+
canSubmit,
|
|
35
|
+
onSubmit,
|
|
36
|
+
problems,
|
|
37
|
+
steps,
|
|
38
|
+
showBackButton,
|
|
39
|
+
hideNextButton,
|
|
40
|
+
hideHomeButton
|
|
41
|
+
}) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const { i18n } = useI18nContext();
|
|
44
|
+
const userEvents = useAnalyticsContext();
|
|
45
|
+
const { data: summaryData, omitted, labels } = summary || {};
|
|
46
|
+
const [finishLaterLoading, setFinishLaterLoading] = useState(false);
|
|
47
|
+
const translationKeys = {
|
|
48
|
+
finishLater: "finishLater"
|
|
49
|
+
};
|
|
50
|
+
const showLegalCaption = ["solePropDetails", "companyDetails", "businessDetails"].includes(
|
|
51
|
+
taskName
|
|
52
|
+
);
|
|
53
|
+
const { isExperimentEnabled } = useExperimentsContext();
|
|
54
|
+
const showExtraTaxExemptionReasons = isExperimentEnabled("ShowExtraTaxExemptionReasons");
|
|
55
|
+
const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData == null ? void 0 : summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails", "businessDetails"].includes(taskName);
|
|
56
|
+
const handleTrackNavigation = useCallback(
|
|
57
|
+
(props) => {
|
|
58
|
+
trackNavigation({
|
|
59
|
+
...props,
|
|
60
|
+
additionalTrackingParams: navigationTrackingParams
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
[navigationTrackingParams]
|
|
64
|
+
);
|
|
65
|
+
const summaryContent = /* @__PURE__ */ jsx("div", { className: "adyen-kyc-form-wrapper", children: /* @__PURE__ */ jsx(
|
|
66
|
+
Summary,
|
|
67
|
+
{
|
|
68
|
+
trackNavigation: handleTrackNavigation,
|
|
69
|
+
data: summaryData,
|
|
70
|
+
omitted,
|
|
71
|
+
forms,
|
|
72
|
+
gotoForm: gotoFormByFormIndex,
|
|
73
|
+
labels,
|
|
74
|
+
problems,
|
|
75
|
+
showLegalCaption,
|
|
76
|
+
showTaxExemptedLegalCaption
|
|
77
|
+
}
|
|
78
|
+
) });
|
|
79
|
+
const onHomeClick = () => {
|
|
80
|
+
setFinishLaterLoading(true);
|
|
81
|
+
userEvents.addPageEvent("Clicked button", {
|
|
82
|
+
actionType: "save",
|
|
83
|
+
label: translationKeys.finishLater
|
|
84
|
+
});
|
|
85
|
+
if (canSubmit) {
|
|
86
|
+
onSubmit().then(() => {
|
|
87
|
+
setFinishLaterLoading(false);
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
handleHomeClick == null ? void 0 : handleHomeClick();
|
|
91
|
+
setFinishLaterLoading(false);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const isFirstStep = steps.current === 0;
|
|
95
|
+
const isFinalStep = steps.current === steps.total - 1;
|
|
96
|
+
return /* @__PURE__ */ jsxs(MaybeModal, { inline: !asModal, onClose: handleCloseClick, children: [
|
|
97
|
+
/* @__PURE__ */ jsxs(ModalContent, { children: [
|
|
98
|
+
/* @__PURE__ */ jsx(ModalHeader, {}),
|
|
99
|
+
/* @__PURE__ */ jsx(LoaderWrapper, { status: loadingStatus, formOpacityWhenLoading: 0.3, loaderSize: "large", children: /* @__PURE__ */ jsxs("div", { className: !hideSidebar ? "adyen-kyc-form-with-sidebar" : "", children: [
|
|
100
|
+
!asModal && !hideSidebar && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-dropin__sidebar-wrapper", children: /* @__PURE__ */ jsx(
|
|
101
|
+
FormNavigation,
|
|
102
|
+
{
|
|
103
|
+
forms,
|
|
104
|
+
activeForm,
|
|
105
|
+
gotoForm: gotoFormByFormIndex,
|
|
106
|
+
validateForm,
|
|
107
|
+
taskName,
|
|
108
|
+
trackNavigation: handleTrackNavigation,
|
|
109
|
+
verificationErrors: problems == null ? void 0 : problems.verificationErrors
|
|
110
|
+
}
|
|
111
|
+
) }),
|
|
112
|
+
/* @__PURE__ */ jsxs(FormRouterContextProvider, { setFormIndex: gotoFormByFormIndex, forms, children: [
|
|
113
|
+
children,
|
|
114
|
+
activeForm.formId === summaryStep.formId && summary && summaryContent
|
|
115
|
+
] })
|
|
116
|
+
] }) })
|
|
117
|
+
] }),
|
|
118
|
+
!hideFooter && /* @__PURE__ */ jsxs(ModalFooter, { children: [
|
|
119
|
+
/* @__PURE__ */ jsx("div", { style: { width: "30%", display: asModal ? "unset" : "none" }, children: /* @__PURE__ */ jsx(
|
|
120
|
+
StepProgressIndicator,
|
|
121
|
+
{
|
|
122
|
+
activeStepIndex: steps.current ?? 0,
|
|
123
|
+
stepsCount: steps.total,
|
|
124
|
+
fillBefore: true,
|
|
125
|
+
thick: true
|
|
126
|
+
}
|
|
127
|
+
) }),
|
|
128
|
+
(!isFirstStep || showBackButton) && handleBackClick && /* @__PURE__ */ jsx(Button, { icon: "chevron-left", variant: "secondary", onClick: handleBackClick, children: i18n.get("back") }),
|
|
129
|
+
/* @__PURE__ */ jsx(Spacer, {}),
|
|
130
|
+
!isFirstStep && !isFinalStep && !hideHomeButton && /* @__PURE__ */ jsx(
|
|
131
|
+
Button,
|
|
132
|
+
{
|
|
133
|
+
variant: "secondary",
|
|
134
|
+
icon: "save",
|
|
135
|
+
onClick: onHomeClick,
|
|
136
|
+
loading: finishLaterLoading,
|
|
137
|
+
children: i18n.get(translationKeys.finishLater)
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
!isFinalStep && !hideNextButton && /* @__PURE__ */ jsx(Button, { onClick: handleNextClick, children: i18n.get("continue") }),
|
|
141
|
+
isFinalStep && /* @__PURE__ */ jsx(Button, { onClick: handleNextClick, children: i18n.get("submit") })
|
|
142
|
+
] })
|
|
143
|
+
] });
|
|
144
|
+
};
|
|
145
|
+
const getCheck = async (legalEntityId, baseUrl, data) => {
|
|
146
|
+
return httpPost(
|
|
147
|
+
{
|
|
148
|
+
baseUrl,
|
|
149
|
+
path: `legalEntities/${legalEntityId}/checks/bankAccount`
|
|
150
|
+
},
|
|
151
|
+
data
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
const useCheck = (data, options) => {
|
|
155
|
+
const { rootLegalEntityId, baseUrl: url } = useApiContext();
|
|
156
|
+
return useQuery({
|
|
157
|
+
queryKey: ["checkAsAService", data],
|
|
158
|
+
queryFn: () => getCheck(rootLegalEntityId.value, url.value, data),
|
|
159
|
+
...options
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const getBankVerificationProviders = async (legalEntityId, baseUrl, queryParams) => {
|
|
163
|
+
const { country, locale, configId } = queryParams;
|
|
164
|
+
const providerParams = new URLSearchParams({
|
|
165
|
+
country,
|
|
166
|
+
locale,
|
|
167
|
+
...configId && { configId }
|
|
168
|
+
});
|
|
169
|
+
return httpGet({
|
|
170
|
+
baseUrl,
|
|
171
|
+
path: `legalEntities/${legalEntityId}/transferInstruments/trusted/providers?${providerParams}`
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
const useBankVerificationProviders = (queryParams, options) => {
|
|
175
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
176
|
+
return useQuery({
|
|
177
|
+
queryKey: ["bankVerificationProviders", queryParams],
|
|
178
|
+
queryFn: () => getBankVerificationProviders(rootLegalEntityId.value, baseUrl.value, queryParams),
|
|
179
|
+
...options
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
const createTransferInstrument = async (rootLegalEntityId, baseUrl, transferInstrument) => {
|
|
183
|
+
return httpPost(
|
|
184
|
+
{
|
|
185
|
+
baseUrl,
|
|
186
|
+
path: `legalEntities/${rootLegalEntityId}/transferInstruments`
|
|
187
|
+
},
|
|
188
|
+
transferInstrument
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
const createTrustedTransferInstrument = async (legalEntityId, baseUrl, data) => {
|
|
192
|
+
return httpPost(
|
|
193
|
+
{
|
|
194
|
+
baseUrl,
|
|
195
|
+
path: `legalEntities/${legalEntityId}/transferInstruments/trusted`
|
|
196
|
+
},
|
|
197
|
+
data
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
const useCreateTrustedTransferInstrument = (options) => {
|
|
201
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
202
|
+
return useMutation({
|
|
203
|
+
mutationFn: (data) => createTrustedTransferInstrument(rootLegalEntityId.value, baseUrl.value, data),
|
|
204
|
+
...options
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
const getTransferInstrument = async (legalEntityId, baseUrl, transferInstrumentId) => {
|
|
208
|
+
return httpGet({
|
|
209
|
+
baseUrl,
|
|
210
|
+
path: `legalEntities/${legalEntityId}/transferInstruments/${transferInstrumentId}`
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
const useTransferInstrument = (transferInstrumentId, options) => {
|
|
214
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
215
|
+
return useQuery({
|
|
216
|
+
queryKey: transferInstrumentId === skipToken ? [] : ["transferInstrument", transferInstrumentId],
|
|
217
|
+
queryFn: transferInstrumentId === skipToken ? skipToken : () => getTransferInstrument(rootLegalEntityId.value, baseUrl.value, transferInstrumentId),
|
|
218
|
+
...options
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
const updateTransferInstrument = async (legalEntityId, baseUrl, transferInstrument, transferInstrumentId) => {
|
|
222
|
+
return httpPost(
|
|
223
|
+
{
|
|
224
|
+
baseUrl,
|
|
225
|
+
path: `legalEntities/${legalEntityId}/transferInstruments/${transferInstrumentId}`
|
|
226
|
+
},
|
|
227
|
+
transferInstrument
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
const useUpdateTransferInstrument = (options) => {
|
|
231
|
+
const { rootLegalEntityId, baseUrl } = useApiContext();
|
|
232
|
+
const queryClient = useQueryClient();
|
|
233
|
+
return useMutation({
|
|
234
|
+
mutationFn: ({ transferInstrument, transferInstrumentId }) => updateTransferInstrument(
|
|
235
|
+
rootLegalEntityId.value,
|
|
236
|
+
baseUrl.value,
|
|
237
|
+
transferInstrument,
|
|
238
|
+
transferInstrumentId
|
|
239
|
+
),
|
|
240
|
+
onSuccess: async (transferInstrument) => {
|
|
241
|
+
queryClient.setQueryData(["transferInstrument", transferInstrument.id], transferInstrument);
|
|
242
|
+
await queryClient.invalidateQueries({
|
|
243
|
+
// Invalidate transfer instruments on root LE
|
|
244
|
+
queryKey: ["transferInstruments"]
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
...options
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
const accountFormatsImports = /* @__PURE__ */ Object.assign({ "../accountFormats/AD.json": () => import("./AD-CyP5INSp.js"), "../accountFormats/AE.json": () => import("./AE-mIZ12t47.js"), "../accountFormats/AI.json": () => import("./AI-CYOqGKk2.js"), "../accountFormats/AL.json": () => import("./AL-BX1fEo1A.js"), "../accountFormats/AR.json": () => import("./AR-C9kMRnHG.js"), "../accountFormats/AS.json": () => import("./AS-B0TMZQ6o.js"), "../accountFormats/AT.json": () => import("./AT-DJLlevck.js"), "../accountFormats/AU.json": () => import("./AU-B5LSe4bo.js"), "../accountFormats/AX.json": () => import("./AX-Z6f6EnJc.js"), "../accountFormats/AZ.json": () => import("./AZ-BqrKjWMH.js"), "../accountFormats/BA.json": () => import("./BA-BbP72Tn6.js"), "../accountFormats/BE.json": () => import("./BE-B-m_4F41.js"), "../accountFormats/BG.json": () => import("./BG-BVR5ytc-.js"), "../accountFormats/BH.json": () => import("./BH-Ded1Eyrc.js"), "../accountFormats/BM.json": () => import("./BM-CBl-UQUl.js"), "../accountFormats/BR.json": () => import("./BR-DsY9PZVZ.js"), "../accountFormats/BS.json": () => import("./BS-dBfArxRw.js"), "../accountFormats/BV.json": () => import("./BV-D0QBsH7-.js"), "../accountFormats/BY.json": () => import("./BY-BsQUo3fM.js"), "../accountFormats/CA.json": () => import("./CA-DT4cmOOe.js"), "../accountFormats/CH.json": () => import("./CH-CesIKOYy.js"), "../accountFormats/CN.json": () => import("./CN-BV-5PSpq.js"), "../accountFormats/CR.json": () => import("./CR-Dtv-rXg9.js"), "../accountFormats/CY.json": () => import("./CY-BnJ7k_mN.js"), "../accountFormats/CZ.json": () => import("./CZ-BhoS6sd6.js"), "../accountFormats/DE.json": () => import("./DE-DdcbG-CC.js"), "../accountFormats/DK.json": () => import("./DK-DA8qRrzq.js"), "../accountFormats/DO.json": () => import("./DO-B1BWc3Iy.js"), "../accountFormats/EC.json": () => import("./EC-DbNXe71-.js"), "../accountFormats/EE.json": () => import("./EE-CaXoPgZz.js"), "../accountFormats/ES.json": () => import("./ES-Bt_oaIaf.js"), "../accountFormats/FI.json": () => import("./FI-C5V3lLuN.js"), "../accountFormats/FJ.json": () => import("./FJ-CBdbPf5l.js"), "../accountFormats/FO.json": () => import("./FO-1pD1p939.js"), "../accountFormats/FR.json": () => import("./FR-Bc1tLIC4.js"), "../accountFormats/GB.json": () => import("./GB-CCYHTagl.js"), "../accountFormats/GE.json": () => import("./GE-Deog1a3Z.js"), "../accountFormats/GF.json": () => import("./GF-Cda8N7A4.js"), "../accountFormats/GG.json": () => import("./GG-BGuqxplU.js"), "../accountFormats/GI.json": () => import("./GI-CROkpYrU.js"), "../accountFormats/GL.json": () => import("./GL-0vO9Of9c.js"), "../accountFormats/GP.json": () => import("./GP-za-3opp-.js"), "../accountFormats/GR.json": () => import("./GR-B9c2boG8.js"), "../accountFormats/GT.json": () => import("./GT-C1jhs-Dx.js"), "../accountFormats/GU.json": () => import("./GU-CALV5vh1.js"), "../accountFormats/HK.json": () => import("./HK-BB3PIq-Z.js"), "../accountFormats/HR.json": () => import("./HR-p4luVYpu.js"), "../accountFormats/HU.json": () => import("./HU-v3vOxRm8.js"), "../accountFormats/ID.json": () => import("./ID-BcOv4SXj.js"), "../accountFormats/IE.json": () => import("./IE-Cli_j7Al.js"), "../accountFormats/IL.json": () => import("./IL-CQ0yHRRe.js"), "../accountFormats/IM.json": () => import("./IM-mpIyBn16.js"), "../accountFormats/IN.json": () => import("./IN-BhEI9o7G.js"), "../accountFormats/IS.json": () => import("./IS-02zCAdvq.js"), "../accountFormats/IT.json": () => import("./IT-CzURFhrK.js"), "../accountFormats/JE.json": () => import("./JE-MFwIYti7.js"), "../accountFormats/JM.json": () => import("./JM-BMGgBK6y.js"), "../accountFormats/JO.json": () => import("./JO-rY8A8f9C.js"), "../accountFormats/JP.json": () => import("./JP-BQG5dF1Y.js"), "../accountFormats/KR.json": () => import("./KR-74SwXHka.js"), "../accountFormats/KW.json": () => import("./KW-CcVPOJ8B.js"), "../accountFormats/KY.json": () => import("./KY-DXCeltYA.js"), "../accountFormats/KZ.json": () => import("./KZ-CZNjdp22.js"), "../accountFormats/LB.json": () => import("./LB-DZ5YfAsO.js"), "../accountFormats/LI.json": () => import("./LI-DA06W10W.js"), "../accountFormats/LT.json": () => import("./LT-DuU6E2Ct.js"), "../accountFormats/LU.json": () => import("./LU-BQHhNpDy.js"), "../accountFormats/LV.json": () => import("./LV-DN7wckbP.js"), "../accountFormats/MC.json": () => import("./MC-DtSWC4jS.js"), "../accountFormats/MD.json": () => import("./MD-DVc0183a.js"), "../accountFormats/ME.json": () => import("./ME-DiJhSuli.js"), "../accountFormats/MK.json": () => import("./MK-BZxslBTS.js"), "../accountFormats/MP.json": () => import("./MP-7IpnbfCj.js"), "../accountFormats/MQ.json": () => import("./MQ-DusG_no1.js"), "../accountFormats/MR.json": () => import("./MR-DaBVNHqN.js"), "../accountFormats/MT.json": () => import("./MT-DeDMQ1f_.js"), "../accountFormats/MU.json": () => import("./MU-D3gGVu1R.js"), "../accountFormats/MX.json": () => import("./MX-CZVOFg3D.js"), "../accountFormats/MY.json": () => import("./MY-ym71svTa.js"), "../accountFormats/NC.json": () => import("./NC-xzMvjp9-.js"), "../accountFormats/NL.json": () => import("./NL-aVL0NAp-.js"), "../accountFormats/NO.json": () => import("./NO-D7EOiQA1.js"), "../accountFormats/NZ.json": () => import("./NZ-BP7_Q9Om.js"), "../accountFormats/PE.json": () => import("./PE-CdxgPh3v.js"), "../accountFormats/PF.json": () => import("./PF-CstaOd9Z.js"), "../accountFormats/PH.json": () => import("./PH-BYgMDYIH.js"), "../accountFormats/PK.json": () => import("./PK-bLhtgsEk.js"), "../accountFormats/PL.json": () => import("./PL-Bg7axKQA.js"), "../accountFormats/PM.json": () => import("./PM-BWbxAh4u.js"), "../accountFormats/PR.json": () => import("./PR-CFPKXEXp.js"), "../accountFormats/PS.json": () => import("./PS-B8obOOWY.js"), "../accountFormats/PT.json": () => import("./PT-hB1HnBM2.js"), "../accountFormats/QA.json": () => import("./QA-CSfx-mvb.js"), "../accountFormats/RE.json": () => import("./RE-BApq1FJ6.js"), "../accountFormats/RO.json": () => import("./RO-BLlC4CKq.js"), "../accountFormats/RS.json": () => import("./RS-BCenke-W.js"), "../accountFormats/RU.json": () => import("./RU-D27RC7dq.js"), "../accountFormats/SA.json": () => import("./SA-C9VgxCgm.js"), "../accountFormats/SE.json": () => import("./SE-q25Qt85B.js"), "../accountFormats/SG.json": () => import("./SG-DoCqjlFi.js"), "../accountFormats/SI.json": () => import("./SI-BzA-ozn6.js"), "../accountFormats/SJ.json": () => import("./SJ-Z9jwQQlz.js"), "../accountFormats/SK.json": () => import("./SK-DOTdLJPw.js"), "../accountFormats/SM.json": () => import("./SM-B4BIgmhk.js"), "../accountFormats/TF.json": () => import("./TF-BOWng-Dz.js"), "../accountFormats/TH.json": () => import("./TH-CvyXLcZK.js"), "../accountFormats/TL.json": () => import("./TL-BWslydRz.js"), "../accountFormats/TN.json": () => import("./TN-Cjd3bM_V.js"), "../accountFormats/TR.json": () => import("./TR-BBx5CuWS.js"), "../accountFormats/TT.json": () => import("./TT-D4-z5BA-.js"), "../accountFormats/TW.json": () => import("./TW-BC8YpnMr.js"), "../accountFormats/UA.json": () => import("./UA-DrXUnAe6.js"), "../accountFormats/US.json": () => import("./US-D8dI5_i1.js"), "../accountFormats/UY.json": () => import("./UY-DEHqLXhX.js"), "../accountFormats/VA.json": () => import("./VA-bPXdCnwD.js"), "../accountFormats/VG.json": () => import("./VG-DnKAVCsi.js"), "../accountFormats/VI.json": () => import("./VI-CU9MA9ux.js"), "../accountFormats/VN.json": () => import("./VN-CTSqsmB6.js"), "../accountFormats/WF.json": () => import("./WF-CwHbsjtJ.js"), "../accountFormats/YT.json": () => import("./YT-BCyAAbo7.js"), "../accountFormats/ZA.json": () => import("./ZA-NU7slima.js") });
|
|
251
|
+
const getAccountFormatsForCountry = async (country) => {
|
|
252
|
+
const importForCountry = accountFormatsImports[`../accountFormats/${country}.json`];
|
|
253
|
+
if (!importForCountry) {
|
|
254
|
+
throw Error(`No account formats available for ${country}`);
|
|
255
|
+
}
|
|
256
|
+
return (await importForCountry()).default;
|
|
257
|
+
};
|
|
258
|
+
const rules = ({
|
|
259
|
+
data,
|
|
260
|
+
requiredFields,
|
|
261
|
+
isExperimentEnabled
|
|
262
|
+
}) => createFormRules({
|
|
263
|
+
whenUsingManualVerification: () => {
|
|
264
|
+
var _a;
|
|
265
|
+
if (!data.payoutVerificationMethod) return;
|
|
266
|
+
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) === "manualVerification") {
|
|
267
|
+
return "REQUIRED";
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
whenUsingInstantVerification: () => {
|
|
271
|
+
var _a;
|
|
272
|
+
if (!data.payoutVerificationMethod) {
|
|
273
|
+
return "REQUIRED";
|
|
274
|
+
}
|
|
275
|
+
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) === "instantVerification") {
|
|
276
|
+
return "REQUIRED";
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
verifiedBankAccountNumber: () => {
|
|
280
|
+
var _a;
|
|
281
|
+
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) === "instantVerification") {
|
|
282
|
+
return "REQUIRED";
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
bankStatementRequirement: () => {
|
|
286
|
+
var _a, _b;
|
|
287
|
+
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) !== "instantVerification" && ((isExperimentEnabled == null ? void 0 : isExperimentEnabled("EnableCheckOnCreateBankAccount")) || (isExperimentEnabled == null ? void 0 : isExperimentEnabled("BankVerificationFlowOptimization_CAASIntegration")))) {
|
|
288
|
+
return "REQUIRED";
|
|
289
|
+
}
|
|
290
|
+
if (((_b = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _b.payoutVerificationMethod) === "manualVerification") {
|
|
291
|
+
return requiredFields == null ? void 0 : requiredFields.bankStatementRequirement;
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
// "bankStatement description" field is always "optional" and it's coupled with bank statement document.
|
|
295
|
+
bankStatementDescription: () => {
|
|
296
|
+
var _a;
|
|
297
|
+
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) === "manualVerification" && !!(requiredFields == null ? void 0 : requiredFields.bankStatementRequirement)) {
|
|
298
|
+
return "OPTIONAL";
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
const mapApiDocumentToPayoutDocuments = (entityId) => {
|
|
303
|
+
const bankStatement = getDocument(entityId, "bankStatement") || null;
|
|
304
|
+
return {
|
|
305
|
+
bankStatementDocument: bankStatement ? [mapExistingFile(getPageName(bankStatement))] : null,
|
|
306
|
+
description: bankStatement.description
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
const mapPayoutDetailsToTransferInstrument = ({
|
|
310
|
+
data,
|
|
311
|
+
legalEntity
|
|
312
|
+
}) => ({
|
|
313
|
+
bankAccount: mapPayoutAccountSchemaToApiBankAccount(
|
|
314
|
+
data.payoutAccountDetails,
|
|
315
|
+
data.payoutVerificationMethod.bankCountry
|
|
316
|
+
),
|
|
317
|
+
legalEntityId: legalEntity.id,
|
|
318
|
+
type: "bankAccount"
|
|
319
|
+
});
|
|
320
|
+
const mapPayoutDocumentsToApiDocuments = async (data, entityId) => {
|
|
321
|
+
const { payoutAccountDocuments = {} } = data;
|
|
322
|
+
const { bankStatementDocument, description } = payoutAccountDocuments;
|
|
323
|
+
const entityType = "bankAccount";
|
|
324
|
+
const existingDocument = getDocument(entityId, "bankStatement");
|
|
325
|
+
return createDocumentRequest({
|
|
326
|
+
entityId,
|
|
327
|
+
entityType,
|
|
328
|
+
documentType: "bankStatement",
|
|
329
|
+
page1: bankStatementDocument == null ? void 0 : bankStatementDocument[0],
|
|
330
|
+
description,
|
|
331
|
+
existingDocument
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
const mapTransferInstrumentToPayoutAccount = (transferInstrument) => mapWith(transferInstrument, payoutComponentKeyMapping);
|
|
335
|
+
const CUSTOM_LABELS = {
|
|
336
|
+
verifiedAccountHolder: "accountHolder",
|
|
337
|
+
verifiedBankCountry: "bankCountry",
|
|
338
|
+
verifiedBankName: "bankName",
|
|
339
|
+
verifiedCurrencyCode: "currencyCode",
|
|
340
|
+
verifiedBankAccountNumber: "bankAccountNumber"
|
|
341
|
+
};
|
|
342
|
+
const formatAccountVerificationSummary = (data) => {
|
|
343
|
+
if (!data) return {};
|
|
344
|
+
const summary = {};
|
|
345
|
+
keysOf(CUSTOM_LABELS).forEach((key) => {
|
|
346
|
+
if (!data[key]) return;
|
|
347
|
+
summary[key] = summaryItem(CUSTOM_LABELS[key], data[key]);
|
|
348
|
+
});
|
|
349
|
+
return summary;
|
|
350
|
+
};
|
|
351
|
+
const caasModalFooter = "adyen-kyc-caas-modal-footer";
|
|
352
|
+
const styles = {
|
|
353
|
+
caasModalFooter
|
|
354
|
+
};
|
|
355
|
+
const obscuredPayoutFields = ["bankAccountNumber", "iban"];
|
|
356
|
+
const payoutDetailsCountryConfig = {
|
|
357
|
+
[CountryCodes.Canada]: {
|
|
358
|
+
bankStatementDocument: {
|
|
359
|
+
label: "listitemVoidedChequeBankLetterBankStatementOnline"
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
[CountryCodes.UnitedKingdom]: {
|
|
363
|
+
bankCity: {
|
|
364
|
+
label: "bankCityTown"
|
|
365
|
+
},
|
|
366
|
+
bankStatementDocument: {
|
|
367
|
+
label: "listitemVoidedChequeBankLetterBankStatementOnline"
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
const parseConfiguration = ({
|
|
372
|
+
requiredFields,
|
|
373
|
+
country,
|
|
374
|
+
bankVerificationAvailable
|
|
375
|
+
}) => parsePayoutScenarios({
|
|
376
|
+
requiredFields: requiredFields == null ? void 0 : requiredFields.fields,
|
|
377
|
+
country,
|
|
378
|
+
bankVerificationAvailable
|
|
379
|
+
});
|
|
380
|
+
function parsePayoutScenarios({
|
|
381
|
+
requiredFields,
|
|
382
|
+
country,
|
|
383
|
+
bankVerificationAvailable
|
|
384
|
+
}) {
|
|
385
|
+
if (!requiredFields) return {};
|
|
386
|
+
let formConfig = {
|
|
387
|
+
payoutVerificationMethod: {
|
|
388
|
+
rule: "REQUIRED"
|
|
389
|
+
},
|
|
390
|
+
bankCountry: {
|
|
391
|
+
rule: "REQUIRED"
|
|
392
|
+
},
|
|
393
|
+
bankStatementDocument: {
|
|
394
|
+
rule: "bankStatementRequirement"
|
|
395
|
+
},
|
|
396
|
+
description: {
|
|
397
|
+
rule: "bankStatementDescription"
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
requiredFields.forEach((fieldName) => {
|
|
401
|
+
formConfig[fieldName] = {
|
|
402
|
+
rule: bankVerificationAvailable ? "whenUsingManualVerification" : "REQUIRED",
|
|
403
|
+
obscured: obscuredPayoutFields.includes(fieldName)
|
|
404
|
+
};
|
|
405
|
+
});
|
|
406
|
+
if (bankVerificationAvailable) {
|
|
407
|
+
formConfig = {
|
|
408
|
+
...formConfig,
|
|
409
|
+
verifiedAccountHolder: {
|
|
410
|
+
rule: "whenUsingInstantVerification"
|
|
411
|
+
},
|
|
412
|
+
verifiedBankCountry: {
|
|
413
|
+
rule: "whenUsingInstantVerification"
|
|
414
|
+
},
|
|
415
|
+
verifiedBankName: {
|
|
416
|
+
rule: "whenUsingInstantVerification"
|
|
417
|
+
},
|
|
418
|
+
verifiedCurrencyCode: {
|
|
419
|
+
rule: "whenUsingInstantVerification"
|
|
420
|
+
},
|
|
421
|
+
verifiedBankAccountNumber: {
|
|
422
|
+
rule: "whenUsingInstantVerification"
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
return augmentWithCountryConfigs(payoutDetailsCountryConfig[country], formConfig);
|
|
427
|
+
}
|
|
428
|
+
const getAppropriatePayoutDetailsSteps = (isEditing, instantVerificationAvailable, canChangeCountry) => {
|
|
429
|
+
const dependentSteps = {
|
|
430
|
+
payoutAccountDetails: payoutSteps.payoutAccountDetails,
|
|
431
|
+
payoutAccountDocuments: payoutSteps.payoutAccountDocuments,
|
|
432
|
+
payoutAccountVerification: payoutSteps.payoutAccountVerification
|
|
433
|
+
};
|
|
434
|
+
if (!isEditing && (instantVerificationAvailable || canChangeCountry)) {
|
|
435
|
+
return {
|
|
436
|
+
payoutVerificationMethod: payoutSteps.payoutVerificationMethod,
|
|
437
|
+
...dependentSteps
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
return dependentSteps;
|
|
441
|
+
};
|
|
442
|
+
const getInvalidFieldsErrorHeader = (invalidField) => {
|
|
443
|
+
switch (invalidField) {
|
|
444
|
+
case "LEGAL_BUSINESS_NAME":
|
|
445
|
+
case "FIRST_NAME":
|
|
446
|
+
case "LAST_NAME":
|
|
447
|
+
return "caasBankAccountHolderDoesNotMatch";
|
|
448
|
+
default:
|
|
449
|
+
return "weCouldntCompleteTheAccountCheck";
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
const getInvalidFieldsErrorContent = (invalidField) => {
|
|
453
|
+
switch (invalidField) {
|
|
454
|
+
case "LEGAL_BUSINESS_NAME":
|
|
455
|
+
return "caasBankAccountMustBeInYourNameYourBusinessLegalNameOrDoingBusinessAs";
|
|
456
|
+
case "FIRST_NAME":
|
|
457
|
+
case "LAST_NAME":
|
|
458
|
+
return "caasBankAccountMustBeInYourName";
|
|
459
|
+
default:
|
|
460
|
+
return "weCouldntCompleteTheAccountCheck";
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
const defaultInvalidErrorMessage = {
|
|
464
|
+
header: "weCouldntCompleteTheAccountCheck",
|
|
465
|
+
content: "weCouldntCompleteTheAccountCheck"
|
|
466
|
+
};
|
|
467
|
+
const getInvalidFieldsErrorMessage = (errors) => {
|
|
468
|
+
if (!errors || errors.length === 0) {
|
|
469
|
+
return defaultInvalidErrorMessage;
|
|
470
|
+
}
|
|
471
|
+
const [firstError] = errors;
|
|
472
|
+
const { invalidFields } = firstError;
|
|
473
|
+
if (!invalidFields || invalidFields.length === 0) {
|
|
474
|
+
return defaultInvalidErrorMessage;
|
|
475
|
+
}
|
|
476
|
+
const [firstInvalidField] = invalidFields;
|
|
477
|
+
return {
|
|
478
|
+
header: getInvalidFieldsErrorHeader(firstInvalidField),
|
|
479
|
+
content: getInvalidFieldsErrorContent(firstInvalidField)
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
function PayoutDetailsDropin({
|
|
483
|
+
legalEntityResponse,
|
|
484
|
+
associatedLegalArrangement,
|
|
485
|
+
problems: propProblems,
|
|
486
|
+
onSubmit: externalOnSubmit,
|
|
487
|
+
onChange,
|
|
488
|
+
asModal = false,
|
|
489
|
+
handleCloseClick,
|
|
490
|
+
taskType: propTaskType,
|
|
491
|
+
capabilities,
|
|
492
|
+
handleHomeClick,
|
|
493
|
+
currentTransferInstrumentId,
|
|
494
|
+
setCurrentTransferInstrumentId,
|
|
495
|
+
navigateBackToTaskList,
|
|
496
|
+
handleBackClick: externalBackClick,
|
|
497
|
+
hideSidebar,
|
|
498
|
+
openBankingPartnerConfigId
|
|
499
|
+
}) {
|
|
500
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
501
|
+
const { baseUrl, rootLegalEntityId } = useApiContext();
|
|
502
|
+
const {
|
|
503
|
+
data: transferInstrument,
|
|
504
|
+
refetch: refetchTransferInstrument,
|
|
505
|
+
isLoading: isTransferInstrumentLoading
|
|
506
|
+
} = useTransferInstrument(currentTransferInstrumentId ?? skipToken);
|
|
507
|
+
const { mutateAsync: handleUpdateTransferInstrument } = useUpdateTransferInstrument();
|
|
508
|
+
const { mutateAsync: handleCreateTrustedTransferInstrument } = useCreateTrustedTransferInstrument();
|
|
509
|
+
const { i18n } = useI18nContext();
|
|
510
|
+
const userEvents = useAnalyticsContext();
|
|
511
|
+
const { showToast, clearToasts } = useToastContext();
|
|
512
|
+
const { isExperimentEnabled } = useExperimentsContext();
|
|
513
|
+
const { isSettingEnabled } = useSettingsContext();
|
|
514
|
+
const defaultPayoutCountry = getLegalEntityCountry(legalEntityResponse);
|
|
515
|
+
const existingPayoutDetails = useMemo(
|
|
516
|
+
() => transferInstrument ? mapTransferInstrumentToPayoutAccount(transferInstrument) : void 0,
|
|
517
|
+
[transferInstrument]
|
|
518
|
+
);
|
|
519
|
+
const [documents, setDocuments] = useState();
|
|
520
|
+
const [isCaasCalled, setIsCaasCalled] = useState(false);
|
|
521
|
+
const enableCheckOnCreateBankAccount = isExperimentEnabled("EnableCheckOnCreateBankAccount") || isExperimentEnabled("BankVerificationFlowOptimization_CAASIntegration");
|
|
522
|
+
const accountHolder = getPayoutAccountHolderName(legalEntityResponse, i18n);
|
|
523
|
+
const fallbackCurrency = (_a = currencyByCountry[defaultPayoutCountry]) == null ? void 0 : _a[0];
|
|
524
|
+
const accountHolderName = accountHolder || getLegalEntityNameBasedOnType(legalEntityResponse);
|
|
525
|
+
const instantVerificationEnabled = Boolean(
|
|
526
|
+
!isTransferInstrumentLoading && !transferInstrument && isSettingEnabled("instantBankVerification")
|
|
527
|
+
);
|
|
528
|
+
const taskType = propTaskType ?? TaskTypes.PAYOUT;
|
|
529
|
+
const [trustedTransferInstrumentId, setTrustedTransferInstrumentId] = useState();
|
|
530
|
+
const prefilledData = {
|
|
531
|
+
payoutAccountDetails: {
|
|
532
|
+
accountHolder: accountHolderName,
|
|
533
|
+
currency: fallbackCurrency,
|
|
534
|
+
...existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails
|
|
535
|
+
},
|
|
536
|
+
payoutVerificationMethod: {
|
|
537
|
+
payoutVerificationMethod: transferInstrument ? isInstantVerifiedAccount(transferInstrument) ? "instantVerification" : "manualVerification" : instantVerificationEnabled ? "instantVerification" : void 0,
|
|
538
|
+
bankCountry: defaultPayoutCountry,
|
|
539
|
+
...existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutVerificationMethod
|
|
540
|
+
},
|
|
541
|
+
payoutAccountVerification: {
|
|
542
|
+
verifiedAccountHolder: accountHolderName,
|
|
543
|
+
verifiedBankCountry: defaultPayoutCountry,
|
|
544
|
+
...existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountVerification
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
const documentUtils = documentApiUtils({
|
|
548
|
+
baseUrl: baseUrl.value,
|
|
549
|
+
rootLegalEntityId: rootLegalEntityId.value
|
|
550
|
+
});
|
|
551
|
+
const {
|
|
552
|
+
state: { currentState }
|
|
553
|
+
} = useStateContext();
|
|
554
|
+
const formValidity = currentState.validityByForm;
|
|
555
|
+
const bankAccountCountry = ((_c = (_b = currentState == null ? void 0 : currentState.data) == null ? void 0 : _b.payoutVerificationMethod) == null ? void 0 : _c.bankCountry) ?? defaultPayoutCountry;
|
|
556
|
+
const [hideFooterAndSidebar, setHideFooterAndSidebar] = useState(false);
|
|
557
|
+
const [hideFooter, setHideFooter] = useState(false);
|
|
558
|
+
const [skipSubmit, setSkipSubmit] = useState(false);
|
|
559
|
+
const [loadingStatus, setLoadingStatus] = useState("loading");
|
|
560
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
561
|
+
const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("loading");
|
|
562
|
+
const [data, setData] = useState(prefilledData);
|
|
563
|
+
const [problems, setProblems] = useState(
|
|
564
|
+
propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_e = (_d = getCapabilityProblems(legalEntityResponse, bankAccountCountry)) == null ? void 0 : _d.BankAccount) == null ? void 0 : _e[transferInstrument.id] : void 0)
|
|
565
|
+
);
|
|
566
|
+
const [accountDetailsFromInput, setAccountDetailsFromInput] = useState(
|
|
567
|
+
prefilledData.payoutAccountDetails
|
|
568
|
+
);
|
|
569
|
+
const existingBankAccountFormat = transferInstrument ? ((_f = existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails) == null ? void 0 : _f.iban) ? "iban" : "local" : void 0;
|
|
570
|
+
useEffect(() => {
|
|
571
|
+
userEvents.updateBaseTrackingPayload({ task: taskType });
|
|
572
|
+
userEvents.addTaskEvent("Landed on page", {
|
|
573
|
+
actionType: "start"
|
|
574
|
+
});
|
|
575
|
+
}, []);
|
|
576
|
+
useEffect(() => {
|
|
577
|
+
var _a2, _b2;
|
|
578
|
+
setData({
|
|
579
|
+
...currentState.data,
|
|
580
|
+
payoutAccountDetails: {
|
|
581
|
+
...(_a2 = currentState.data) == null ? void 0 : _a2.payoutAccountDetails,
|
|
582
|
+
currency: (_b2 = currencyByCountry[bankAccountCountry]) == null ? void 0 : _b2[0]
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
onChange == null ? void 0 : onChange(currentState);
|
|
586
|
+
}, [bankAccountCountry, currentState, onChange]);
|
|
587
|
+
const {
|
|
588
|
+
data: providers,
|
|
589
|
+
refetch: refetchBankVerificationProviders,
|
|
590
|
+
status: bankVendorsLoadingStatus
|
|
591
|
+
} = useBankVerificationProviders(
|
|
592
|
+
{
|
|
593
|
+
country: bankAccountCountry,
|
|
594
|
+
configId: openBankingPartnerConfigId,
|
|
595
|
+
locale: i18n.locale
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
enabled: instantVerificationEnabled
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
const instantVerificationAvailable = useMemo(
|
|
602
|
+
() => {
|
|
603
|
+
var _a2;
|
|
604
|
+
return Boolean(instantVerificationEnabled && ((_a2 = providers == null ? void 0 : providers[0]) == null ? void 0 : _a2.redirectUrl));
|
|
605
|
+
},
|
|
606
|
+
[instantVerificationEnabled, providers]
|
|
607
|
+
);
|
|
608
|
+
const getPayoutAccountFormatData = useCallback(
|
|
609
|
+
async () => getAccountFormatsForCountry(bankAccountCountry),
|
|
610
|
+
[bankAccountCountry]
|
|
611
|
+
);
|
|
612
|
+
const { fieldConfigurations, requiredFields } = useScenarioConfiguration({
|
|
613
|
+
parseConfiguration,
|
|
614
|
+
legalEntityType: legalEntityResponse.type,
|
|
615
|
+
getPayoutAccountFormatData,
|
|
616
|
+
instantVerificationAvailable,
|
|
617
|
+
setLoadingStatus: setConfigurationLoadingStatus,
|
|
618
|
+
country: bankAccountCountry,
|
|
619
|
+
existingBankAccountFormat
|
|
620
|
+
});
|
|
621
|
+
const fieldsFromCustomRules = useMemo(
|
|
622
|
+
() => rules({
|
|
623
|
+
data,
|
|
624
|
+
requiredFields,
|
|
625
|
+
isExperimentEnabled
|
|
626
|
+
}),
|
|
627
|
+
[bankAccountCountry, data, taskType, isExperimentEnabled]
|
|
628
|
+
);
|
|
629
|
+
const apiBankAccount = useMemo(() => {
|
|
630
|
+
const payoutAccountDetails = data.payoutAccountDetails ?? { bankAccountNumber: "" };
|
|
631
|
+
return mapPayoutAccountSchemaToApiBankAccount(payoutAccountDetails, bankAccountCountry);
|
|
632
|
+
}, [data, bankAccountCountry]);
|
|
633
|
+
const {
|
|
634
|
+
data: checkAsAServiceData,
|
|
635
|
+
refetch: refetchCheckAsAService,
|
|
636
|
+
isLoading: isCheckAsAServiceLoading,
|
|
637
|
+
isError: isCheckAsAServiceError
|
|
638
|
+
} = useCheck(apiBankAccount.accountIdentification, {
|
|
639
|
+
enabled: false
|
|
640
|
+
});
|
|
641
|
+
const checkAsAServiceResultStatus = checkAsAServiceData == null ? void 0 : checkAsAServiceData.status;
|
|
642
|
+
const checkAsAServiceResultErrors = checkAsAServiceData == null ? void 0 : checkAsAServiceData.errors;
|
|
643
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
644
|
+
const payoutDetailsSteps = useMemo(() => {
|
|
645
|
+
var _a2;
|
|
646
|
+
const appropriatePayoutDetailsSteps = getAppropriatePayoutDetailsSteps(
|
|
647
|
+
Boolean((_a2 = prefilledData == null ? void 0 : prefilledData.payoutAccountDetails) == null ? void 0 : _a2.transferInstrumentId),
|
|
648
|
+
instantVerificationAvailable,
|
|
649
|
+
isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout)
|
|
650
|
+
);
|
|
651
|
+
const { payoutAccountDocuments: _, ...restOfAppropriatePayoutDetailsSteps } = appropriatePayoutDetailsSteps;
|
|
652
|
+
if (enableCheckOnCreateBankAccount && !isCheckAsAServiceError && (checkAsAServiceResultStatus === "VALID" || checkAsAServiceResultStatus === void 0)) {
|
|
653
|
+
return restOfAppropriatePayoutDetailsSteps;
|
|
654
|
+
}
|
|
655
|
+
return appropriatePayoutDetailsSteps;
|
|
656
|
+
}, [
|
|
657
|
+
providers,
|
|
658
|
+
enableCheckOnCreateBankAccount,
|
|
659
|
+
checkAsAServiceResultStatus,
|
|
660
|
+
isCheckAsAServiceError
|
|
661
|
+
]);
|
|
662
|
+
const derivedProps = useMemo(() => {
|
|
663
|
+
return getPropsFromConfigurations(
|
|
664
|
+
fieldConfigurations,
|
|
665
|
+
payoutDetailsSteps,
|
|
666
|
+
(problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [],
|
|
667
|
+
(problems == null ? void 0 : problems.missingData) ?? [],
|
|
668
|
+
[],
|
|
669
|
+
fieldsFromCustomRules,
|
|
670
|
+
{},
|
|
671
|
+
{},
|
|
672
|
+
legalEntityResponse.type
|
|
673
|
+
);
|
|
674
|
+
}, [
|
|
675
|
+
fieldConfigurations,
|
|
676
|
+
fieldsFromCustomRules,
|
|
677
|
+
problems == null ? void 0 : problems.remediationActions,
|
|
678
|
+
legalEntityResponse,
|
|
679
|
+
payoutDetailsSteps
|
|
680
|
+
]);
|
|
681
|
+
useUnifyLoadingStatus(
|
|
682
|
+
setLoadingStatus,
|
|
683
|
+
configurationLoadingStatus,
|
|
684
|
+
// bank vendor loading status only matters when we fetch bank vendors
|
|
685
|
+
instantVerificationEnabled ? bankVendorsLoadingStatus : "success",
|
|
686
|
+
isSubmitting ? "loading" : "success"
|
|
687
|
+
);
|
|
688
|
+
const forms = useMemo(() => {
|
|
689
|
+
const requiredForms = getRequiredForms(
|
|
690
|
+
payoutDetailsSteps,
|
|
691
|
+
derivedProps == null ? void 0 : derivedProps.requiredFields,
|
|
692
|
+
derivedProps == null ? void 0 : derivedProps.optionalFields
|
|
693
|
+
);
|
|
694
|
+
return addValidityToForms(requiredForms, formValidity, problems);
|
|
695
|
+
}, [derivedProps, formValidity, problems, payoutDetailsSteps]);
|
|
696
|
+
useEffect(() => {
|
|
697
|
+
var _a2;
|
|
698
|
+
if (!((_a2 = transferInstrument == null ? void 0 : transferInstrument.documentDetails) == null ? void 0 : _a2.length)) return;
|
|
699
|
+
if (transferInstrument.id) {
|
|
700
|
+
documentUtils.fetchDocuments(transferInstrument.documentDetails, transferInstrument.id).then(() => {
|
|
701
|
+
setDocuments(mapApiDocumentToPayoutDocuments(transferInstrument.id));
|
|
702
|
+
}).catch(() => {
|
|
703
|
+
showToast({ label: i18n.get("failedToFetchRelevantDocuments"), variant: "error" });
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
}, [transferInstrument == null ? void 0 : transferInstrument.documentDetails]);
|
|
707
|
+
const submitDocuments = async ({
|
|
708
|
+
forms: forms2,
|
|
709
|
+
transferInstrument: transferInstrument2,
|
|
710
|
+
dataSubmitted
|
|
711
|
+
}) => {
|
|
712
|
+
const isRequiredDocuments = isDocumentsRequired(forms2);
|
|
713
|
+
if (isRequiredDocuments) {
|
|
714
|
+
const documentToUpload = await mapPayoutDocumentsToApiDocuments(
|
|
715
|
+
dataSubmitted,
|
|
716
|
+
transferInstrument2.id
|
|
717
|
+
);
|
|
718
|
+
if (documentToUpload) {
|
|
719
|
+
try {
|
|
720
|
+
const documents2 = await documentUtils.uploadDocuments(
|
|
721
|
+
[documentToUpload],
|
|
722
|
+
transferInstrument2.id
|
|
723
|
+
);
|
|
724
|
+
documents2.forEach((document) => {
|
|
725
|
+
var _a2, _b2;
|
|
726
|
+
userEvents.addTaskEvent("Success", {
|
|
727
|
+
actionType: "upload",
|
|
728
|
+
documentType: ((_a2 = dataSubmitted.payoutAccountDocuments) == null ? void 0 : _a2.documentType) ?? document.type,
|
|
729
|
+
// tracks BankDocumentTypes
|
|
730
|
+
fileExtention: ((_b2 = document.attachments) == null ? void 0 : _b2.map((item) => getFileExtention(item.pageName ?? ""))) ?? null
|
|
731
|
+
});
|
|
732
|
+
});
|
|
733
|
+
} catch {
|
|
734
|
+
setProblems({
|
|
735
|
+
...problems,
|
|
736
|
+
validationErrors: {
|
|
737
|
+
payoutAccountDocuments: { bankStatementDocument: true }
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
throw new Error(i18n.get("remediationMessage_1_704"));
|
|
741
|
+
} finally {
|
|
742
|
+
await (refetchTransferInstrument == null ? void 0 : refetchTransferInstrument());
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
useEffect(() => {
|
|
748
|
+
var _a2;
|
|
749
|
+
const payoutAccountData = (_a2 = cloneObject(data)) == null ? void 0 : _a2.payoutAccountDetails;
|
|
750
|
+
if (payoutAccountData) setAccountDetailsFromInput(payoutAccountData);
|
|
751
|
+
}, [data]);
|
|
752
|
+
const onSubmit = async () => {
|
|
753
|
+
setIsSubmitting(true);
|
|
754
|
+
const dataSubmitted = cloneObject(data);
|
|
755
|
+
const { payoutAccountDetails, payoutVerificationMethod } = dataSubmitted;
|
|
756
|
+
const baseTracking = {
|
|
757
|
+
actionType: "submit",
|
|
758
|
+
documentType: "bankStatement",
|
|
759
|
+
bankCountry: (payoutVerificationMethod == null ? void 0 : payoutVerificationMethod.bankCountry) ?? defaultPayoutCountry,
|
|
760
|
+
bankCurrency: (payoutAccountDetails == null ? void 0 : payoutAccountDetails.currency) ?? null
|
|
761
|
+
};
|
|
762
|
+
let transferInstrumentFromInput = mapPayoutDetailsToTransferInstrument({
|
|
763
|
+
data: dataSubmitted,
|
|
764
|
+
legalEntity: legalEntityResponse
|
|
765
|
+
});
|
|
766
|
+
transferInstrumentFromInput = omitObscuredFieldsIfUnchanged(
|
|
767
|
+
["bankAccount.accountIdentification.accountNumber", "bankAccount.accountIdentification.iban"],
|
|
768
|
+
transferInstrumentFromInput,
|
|
769
|
+
transferInstrument
|
|
770
|
+
);
|
|
771
|
+
try {
|
|
772
|
+
if (!transferInstrumentFromInput) return;
|
|
773
|
+
const response = await (transferInstrument ? handleUpdateTransferInstrument({
|
|
774
|
+
transferInstrument: transferInstrumentFromInput,
|
|
775
|
+
transferInstrumentId: transferInstrument.id
|
|
776
|
+
}) : createTransferInstrument(
|
|
777
|
+
rootLegalEntityId.value,
|
|
778
|
+
baseUrl.value,
|
|
779
|
+
transferInstrumentFromInput
|
|
780
|
+
));
|
|
781
|
+
setCurrentTransferInstrumentId == null ? void 0 : setCurrentTransferInstrumentId(response == null ? void 0 : response.id);
|
|
782
|
+
userEvents.addTaskEvent("Success", baseTracking);
|
|
783
|
+
try {
|
|
784
|
+
await submitDocuments({ forms, transferInstrument: response, dataSubmitted });
|
|
785
|
+
clearToasts();
|
|
786
|
+
externalOnSubmit == null ? void 0 : externalOnSubmit({ ...dataSubmitted, id: response == null ? void 0 : response.id });
|
|
787
|
+
} catch (e) {
|
|
788
|
+
showToast({ label: e.message, variant: "error" });
|
|
789
|
+
} finally {
|
|
790
|
+
setIsSubmitting(false);
|
|
791
|
+
}
|
|
792
|
+
} catch (e) {
|
|
793
|
+
if (isValidationError(e)) {
|
|
794
|
+
const validationErrors = processValidationErrors(e, taskType);
|
|
795
|
+
setProblems({ ...problems, validationErrors });
|
|
796
|
+
} else if (isIdDocumentUploadError(e)) {
|
|
797
|
+
showToast({ label: i18n.get("idDocumentAlreadyUploaded"), variant: "error" });
|
|
798
|
+
} else if (isBankStatementUploadError(e)) {
|
|
799
|
+
showToast({ label: i18n.get("bankStatementAlreadyUploaded"), variant: "error" });
|
|
800
|
+
} else if (isMaintenanceModeError(e)) {
|
|
801
|
+
showToast({
|
|
802
|
+
label: i18n.get("maintenanceModeMessage"),
|
|
803
|
+
variant: "error",
|
|
804
|
+
duration: "indefinite"
|
|
805
|
+
});
|
|
806
|
+
} else {
|
|
807
|
+
const errorTranslatable = mapCreateOrUpdateTransferInstrumentErrorMessageToTranslatable(e);
|
|
808
|
+
showToast({ label: i18n.get(errorTranslatable), variant: "error" });
|
|
809
|
+
}
|
|
810
|
+
setIsSubmitting(false);
|
|
811
|
+
userEvents.addTaskEvent("Encountered error", {
|
|
812
|
+
...baseTracking,
|
|
813
|
+
returnType: (e == null ? void 0 : e.errorCode) || "backend",
|
|
814
|
+
returnValue: (e == null ? void 0 : e.title) || (e == null ? void 0 : e.message)
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
const isDocumentsRequired = (forms2) => forms2.some((form) => form.formId === payoutSteps.payoutAccountDocuments.formId);
|
|
819
|
+
const formatFileSummaryData = (bankDocuments) => {
|
|
820
|
+
var _a2;
|
|
821
|
+
const bankStatementDocument = (_a2 = bankDocuments == null ? void 0 : bankDocuments.bankStatementDocument) == null ? void 0 : _a2[0];
|
|
822
|
+
return {
|
|
823
|
+
...bankStatementDocument && {
|
|
824
|
+
fileName: bankStatementDocument.name
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
};
|
|
828
|
+
const canSubmit = () => {
|
|
829
|
+
var _a2;
|
|
830
|
+
if (((_a2 = data.payoutVerificationMethod) == null ? void 0 : _a2.payoutVerificationMethod) === "instantVerification") {
|
|
831
|
+
return false;
|
|
832
|
+
}
|
|
833
|
+
const bankDetails = data.payoutAccountDetails;
|
|
834
|
+
return !isEmpty(bankDetails) && Object.values(bankDetails).every(Boolean);
|
|
835
|
+
};
|
|
836
|
+
const datasetUtils = datasetUtilities(i18n.locale);
|
|
837
|
+
const formatDataForSummary = () => {
|
|
838
|
+
var _a2;
|
|
839
|
+
const summaryData = cloneObject(data);
|
|
840
|
+
summaryData.payoutAccountDetails.accountHolder = accountHolderName;
|
|
841
|
+
if (((_a2 = summaryData.payoutVerificationMethod) == null ? void 0 : _a2.bankCountry) && summaryData.payoutAccountDetails) {
|
|
842
|
+
summaryData.payoutAccountDetails.bankCountry = datasetUtils.getCountryName(
|
|
843
|
+
summaryData.payoutVerificationMethod.bankCountry
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
if (summaryData.payoutAccountDocuments) {
|
|
847
|
+
summaryData.payoutAccountDocuments.bankStatementDocument = formatFileSummaryData(
|
|
848
|
+
data == null ? void 0 : data.payoutAccountDocuments
|
|
849
|
+
);
|
|
850
|
+
}
|
|
851
|
+
summaryData.payoutAccountVerification = formatAccountVerificationSummary(
|
|
852
|
+
data.payoutAccountVerification
|
|
853
|
+
);
|
|
854
|
+
return summaryData;
|
|
855
|
+
};
|
|
856
|
+
const createTrustedTransferInstrumentHandler = async (code, state) => {
|
|
857
|
+
try {
|
|
858
|
+
const trustedTransferInstrument = await handleCreateTrustedTransferInstrument({
|
|
859
|
+
code,
|
|
860
|
+
state
|
|
861
|
+
});
|
|
862
|
+
if (trustedTransferInstrument) {
|
|
863
|
+
setTrustedTransferInstrumentId(trustedTransferInstrument.verificationReference);
|
|
864
|
+
return trustedTransferInstrument;
|
|
865
|
+
}
|
|
866
|
+
} catch (e) {
|
|
867
|
+
refetchBankVerificationProviders();
|
|
868
|
+
const errorTranslatable = mapCreateOrUpdateTransferInstrumentErrorMessageToTranslatable(e);
|
|
869
|
+
if (errorTranslatable === "transferInstrumentLimitHasAlreadyBeenMet") {
|
|
870
|
+
showToast({ label: i18n.get(errorTranslatable), variant: "error" });
|
|
871
|
+
}
|
|
872
|
+
throw e;
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
const {
|
|
876
|
+
handleNextClick,
|
|
877
|
+
handleBackClick,
|
|
878
|
+
activeForm,
|
|
879
|
+
shouldValidate,
|
|
880
|
+
setShouldValidate,
|
|
881
|
+
gotoFormByFormIndex,
|
|
882
|
+
steps
|
|
883
|
+
} = useFormComposer({
|
|
884
|
+
problems,
|
|
885
|
+
forms,
|
|
886
|
+
externalBackClick,
|
|
887
|
+
onSubmit: skipSubmit ? () => {
|
|
888
|
+
if (trustedTransferInstrumentId) {
|
|
889
|
+
externalOnSubmit == null ? void 0 : externalOnSubmit({ ...data, id: trustedTransferInstrumentId });
|
|
890
|
+
}
|
|
891
|
+
userEvents.addTaskEvent("Success", {
|
|
892
|
+
actionType: "submit"
|
|
893
|
+
});
|
|
894
|
+
navigateBackToTaskList == null ? void 0 : navigateBackToTaskList();
|
|
895
|
+
} : onSubmit
|
|
896
|
+
});
|
|
897
|
+
useEffect(() => {
|
|
898
|
+
if (isCaasCalled && forms) {
|
|
899
|
+
if (checkAsAServiceResultStatus !== "VALID") {
|
|
900
|
+
const formIndex = forms.findIndex((f) => f.formId === "payoutAccountDocuments");
|
|
901
|
+
if (formIndex > -1) {
|
|
902
|
+
gotoFormByFormIndex(formIndex);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
if (checkAsAServiceResultStatus === "VALID") {
|
|
906
|
+
handleNextClick();
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
setIsCaasCalled(false);
|
|
910
|
+
}, [forms, checkAsAServiceResultStatus, isCaasCalled]);
|
|
911
|
+
const handleFormNextClick = async () => {
|
|
912
|
+
if (enableCheckOnCreateBankAccount && activeForm.formId === "payoutAccountDetails" && activeForm.isValid && data.payoutAccountDetails) {
|
|
913
|
+
try {
|
|
914
|
+
const { data: response } = await refetchCheckAsAService();
|
|
915
|
+
setIsCaasCalled(true);
|
|
916
|
+
if ((response == null ? void 0 : response.status) === "INCOMPLETE_INPUT") {
|
|
917
|
+
setIsModalOpen(true);
|
|
918
|
+
} else {
|
|
919
|
+
handleNextClick();
|
|
920
|
+
}
|
|
921
|
+
} catch {
|
|
922
|
+
handleNextClick();
|
|
923
|
+
}
|
|
924
|
+
} else {
|
|
925
|
+
handleNextClick();
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
const omittedForms = ((_g = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _g.payoutVerificationMethod) === "instantVerification" ? [] : [payoutSteps.payoutVerificationMethod.formId];
|
|
929
|
+
const { header: invalidFieldHeader, content: invalidFieldContent } = getInvalidFieldsErrorMessage(
|
|
930
|
+
checkAsAServiceResultErrors ?? []
|
|
931
|
+
);
|
|
932
|
+
return /* @__PURE__ */ jsxs(
|
|
933
|
+
LoaderWrapper,
|
|
934
|
+
{
|
|
935
|
+
showSpinner: true,
|
|
936
|
+
status: isCheckAsAServiceLoading || isModalOpen ? "loading" : "success",
|
|
937
|
+
formOpacityWhenLoading: 0.3,
|
|
938
|
+
children: [
|
|
939
|
+
isModalOpen && /* @__PURE__ */ jsxs(
|
|
940
|
+
Modal,
|
|
941
|
+
{
|
|
942
|
+
size: "small",
|
|
943
|
+
onClose: () => setIsModalOpen(false),
|
|
944
|
+
ariaLabel: i18n.get("caasBankAccountHolderDoesNotMatch"),
|
|
945
|
+
children: [
|
|
946
|
+
/* @__PURE__ */ jsx(ModalHeader, { children: i18n.get(invalidFieldHeader) }),
|
|
947
|
+
/* @__PURE__ */ jsx(ModalContent, { children: /* @__PURE__ */ jsx(Typography, { el: "p", variant: "body", children: i18n.get(invalidFieldContent) }) }),
|
|
948
|
+
/* @__PURE__ */ jsx(ModalFooter, { children: /* @__PURE__ */ jsxs("div", { className: styles.caasModalFooter, children: [
|
|
949
|
+
/* @__PURE__ */ jsx(
|
|
950
|
+
Button,
|
|
951
|
+
{
|
|
952
|
+
variant: "secondary",
|
|
953
|
+
onClick: () => {
|
|
954
|
+
handleNextClick();
|
|
955
|
+
setIsModalOpen(false);
|
|
956
|
+
},
|
|
957
|
+
children: i18n.get("continueAnyway")
|
|
958
|
+
}
|
|
959
|
+
),
|
|
960
|
+
/* @__PURE__ */ jsx(
|
|
961
|
+
Button,
|
|
962
|
+
{
|
|
963
|
+
onClick: () => {
|
|
964
|
+
gotoFormByFormIndex(0);
|
|
965
|
+
setIsModalOpen(false);
|
|
966
|
+
},
|
|
967
|
+
children: i18n.get("editDetails")
|
|
968
|
+
}
|
|
969
|
+
)
|
|
970
|
+
] }) })
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
),
|
|
974
|
+
/* @__PURE__ */ jsx(
|
|
975
|
+
FormWrapper,
|
|
976
|
+
{
|
|
977
|
+
taskName: taskType === TaskTypes.PAYIN ? "payinDetails" : "payoutDetails",
|
|
978
|
+
activeForm,
|
|
979
|
+
summary: {
|
|
980
|
+
data: formatDataForSummary(),
|
|
981
|
+
omitted: {
|
|
982
|
+
keys: ["transferInstrumentId", "payoutVerificationMethod"],
|
|
983
|
+
forms: omittedForms,
|
|
984
|
+
summaryEditButton: ["payoutVerificationMethod"]
|
|
985
|
+
},
|
|
986
|
+
labels: derivedProps == null ? void 0 : derivedProps.labels
|
|
987
|
+
},
|
|
988
|
+
handleBackClick,
|
|
989
|
+
handleNextClick: handleFormNextClick,
|
|
990
|
+
handleHomeClick,
|
|
991
|
+
handleCloseClick,
|
|
992
|
+
hideSidebar: hideSidebar || hideFooterAndSidebar,
|
|
993
|
+
hideFooter: hideFooter || hideFooterAndSidebar,
|
|
994
|
+
loadingStatus: isTransferInstrumentLoading ? "loading" : loadingStatus,
|
|
995
|
+
asModal,
|
|
996
|
+
forms,
|
|
997
|
+
onSubmit,
|
|
998
|
+
gotoFormByFormIndex,
|
|
999
|
+
validateForm: () => setShouldValidate(true),
|
|
1000
|
+
canSubmit: canSubmit(),
|
|
1001
|
+
problems,
|
|
1002
|
+
steps,
|
|
1003
|
+
children: (!isTransferInstrumentLoading || isSubmitting) && /* @__PURE__ */ jsx(
|
|
1004
|
+
PayoutDetails,
|
|
1005
|
+
{
|
|
1006
|
+
...derivedProps,
|
|
1007
|
+
capabilities,
|
|
1008
|
+
data: { ...prefilledData, payoutAccountDocuments: documents },
|
|
1009
|
+
country: defaultPayoutCountry,
|
|
1010
|
+
activeForm,
|
|
1011
|
+
forms,
|
|
1012
|
+
problems,
|
|
1013
|
+
onBack: handleBackClick,
|
|
1014
|
+
accountHolder: accountHolder ?? getLegalEntityNameBasedOnType(legalEntityResponse),
|
|
1015
|
+
setHideSidebar: setHideFooterAndSidebar,
|
|
1016
|
+
setHideFooter,
|
|
1017
|
+
setSkipSubmit,
|
|
1018
|
+
onChange,
|
|
1019
|
+
legalEntityResponse,
|
|
1020
|
+
associatedLegalArrangement,
|
|
1021
|
+
provider: providers == null ? void 0 : providers[0],
|
|
1022
|
+
bankVendorsLoadingStatus,
|
|
1023
|
+
instantVerificationAvailable,
|
|
1024
|
+
shouldValidate,
|
|
1025
|
+
createTrustedTransferInstrument: createTrustedTransferInstrumentHandler,
|
|
1026
|
+
accountDetailsFromInput,
|
|
1027
|
+
trustedTransferInstrumentId
|
|
1028
|
+
}
|
|
1029
|
+
)
|
|
1030
|
+
}
|
|
1031
|
+
)
|
|
1032
|
+
]
|
|
1033
|
+
}
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
function CreateTransferInstrumentComponent({
|
|
1037
|
+
legalEntityId,
|
|
1038
|
+
transferInstrumentId,
|
|
1039
|
+
openBankingPartnerConfigId,
|
|
1040
|
+
modalView = false,
|
|
1041
|
+
onClose,
|
|
1042
|
+
onUnmount,
|
|
1043
|
+
onSubmitSuccess,
|
|
1044
|
+
handleBackClick
|
|
1045
|
+
}) {
|
|
1046
|
+
const [currentTransferInstrumentId, setCurrentTransferInstrumentId] = useState(transferInstrumentId);
|
|
1047
|
+
const { data: legalEntity, isLoading: isLegalEntityLoading } = useLegalEntity(legalEntityId);
|
|
1048
|
+
const { data: associatedEntity } = useAssociatedLegalEntity(legalEntity, [
|
|
1049
|
+
LegalEntityType.SOLE_PROPRIETORSHIP,
|
|
1050
|
+
LegalEntityType.TRUST,
|
|
1051
|
+
LegalEntityType.UNINCORPORATED_PARTNERSHIP
|
|
1052
|
+
]);
|
|
1053
|
+
const handleOnClose = () => {
|
|
1054
|
+
if (modalView) {
|
|
1055
|
+
onUnmount == null ? void 0 : onUnmount();
|
|
1056
|
+
}
|
|
1057
|
+
onClose == null ? void 0 : onClose();
|
|
1058
|
+
};
|
|
1059
|
+
return isLegalEntityLoading || !legalEntity ? /* @__PURE__ */ jsx(Loader, {}) : /* @__PURE__ */ jsx(
|
|
1060
|
+
PayoutDetailsDropin,
|
|
1061
|
+
{
|
|
1062
|
+
legalEntityResponse: legalEntity,
|
|
1063
|
+
associatedLegalArrangement: associatedEntity,
|
|
1064
|
+
openBankingPartnerConfigId,
|
|
1065
|
+
handleBackClick,
|
|
1066
|
+
handleCloseClick: handleOnClose,
|
|
1067
|
+
currentTransferInstrumentId,
|
|
1068
|
+
setCurrentTransferInstrumentId,
|
|
1069
|
+
onSubmit: onSubmitSuccess,
|
|
1070
|
+
taskType: TaskTypes.PAYOUT,
|
|
1071
|
+
hideSidebar: true,
|
|
1072
|
+
asModal: modalView
|
|
1073
|
+
}
|
|
1074
|
+
);
|
|
1075
|
+
}
|
|
1076
|
+
export {
|
|
1077
|
+
CreateTransferInstrumentComponent as C,
|
|
1078
|
+
FormWrapper as F,
|
|
1079
|
+
PayoutDetailsDropin as P,
|
|
1080
|
+
mapTransferInstrumentToPayoutAccount as m,
|
|
1081
|
+
useTransferInstrument as u
|
|
1082
|
+
};
|