@adyen/kyc-components 2.27.2 → 2.28.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/es/adyen-kyc-components.es.js +1132 -1284
- package/dist/style.css +4 -0
- package/dist/types/components/Company/rules.d.ts +2 -1
- package/dist/types/components/Company/types.d.ts +0 -1
- package/dist/types/components/CompanyBasics/component/CompanyBasicsComponent.d.ts +1 -1
- package/dist/types/components/CompanyBasics/types.d.ts +3 -0
- package/dist/types/components/CompanyLookup/component/CompanyLookupComponent.d.ts +1 -1
- package/dist/types/components/CompanyLookup/types.d.ts +3 -1
- package/dist/types/components/CompanyOtherDetails/component/CompanyOtherDetailsComponent.d.ts +1 -1
- package/dist/types/components/CompanyOtherDetails/types.d.ts +3 -1
- package/dist/types/components/CompanySearch/types.d.ts +1 -0
- package/dist/types/components/CompanyStructure/component/CompanyStructureComponent.d.ts +1 -1
- package/dist/types/components/CompanyStructure/types.d.ts +4 -1
- package/dist/types/components/Dropins/CompanyDropin/types.d.ts +2 -0
- package/dist/types/components/Dropins/CompanySearchDropin/types.d.ts +1 -1
- package/dist/types/components/Dropins/CompanySearchDropin/utils.d.ts +10 -3
- package/dist/types/components/Dropins/{FormComposer/components/FormNavigation → FormNavigation}/types.d.ts +4 -4
- package/dist/types/components/Dropins/FormWrapper/FormWrapper.d.ts +1 -1
- package/dist/types/components/Dropins/SolePropDropin/components/SolePropDropinComponent.d.ts +1 -1
- package/dist/types/components/Dropins/TrustDropin/components/TrustDropinComponent.d.ts +1 -1
- package/dist/types/components/PayoutDetails/types.d.ts +3 -3
- package/dist/types/components/PersonalDetails/component/labels.d.ts +1 -1
- package/dist/types/components/SoleProp/types.d.ts +1 -1
- package/dist/types/components/Trust/types.d.ts +1 -1
- package/dist/types/components/internal/Address/utils.d.ts +1 -1
- package/dist/types/components/internal/BusinessRegistrationNumber/fieldConfig.d.ts +4 -4
- package/dist/types/components/internal/BusinessRegistrationNumberField/BusinessRegistrationNumberField.d.ts +2 -2
- package/dist/types/components/internal/BusinessRegistrationNumberField/index.d.ts +1 -0
- package/dist/types/components/internal/BusinessRegistrationNumberField/types.d.ts +2 -2
- package/dist/types/components/internal/Summary/Summary.d.ts +0 -1
- package/dist/types/components/internal/TaxId/fieldConfig.d.ts +2 -3
- package/dist/types/components/internal/TaxInformationField/TaxInformationField.d.ts +1 -1
- package/dist/types/components/internal/TaxInformationField/fieldConfig.d.ts +252 -0
- package/dist/types/components/internal/TaxInformationField/index.d.ts +1 -0
- package/dist/types/components/internal/VatNumberField/VatNumberField.d.ts +2 -2
- package/dist/types/components/internal/VatNumberField/index.d.ts +1 -0
- package/dist/types/core/Context/StateContext/types.d.ts +0 -2
- package/dist/types/core/hooks/useCompanySearch/types.d.ts +10 -8
- package/dist/types/core/hooks/useCompanySearch/useCompanySearch.d.ts +1 -1
- package/dist/types/core/hooks/useForm/types.d.ts +1 -0
- package/dist/types/core/process-field-configurations.d.ts +10 -5
- package/dist/types/language/config.d.ts +2 -8
- package/dist/types/utils/entity-status-util.d.ts +1 -1
- package/dist/types/utils/formUtils.d.ts +1 -1
- package/dist/types/utils/mapping/companySearch/index.d.ts +1 -0
- package/dist/types/utils/mapping/companySearch/mapKompanyOrganizationTypeToCompanyType.d.ts +2 -0
- package/dist/types/utils/mapping/componentApiMapping.d.ts +4 -4
- package/package.json +1 -1
- package/dist/types/components/CompanyBasics/validate.d.ts +0 -4
- package/dist/types/components/CompanyOtherDetails/validate.d.ts +0 -10
- package/dist/types/components/Dropins/FormComposer/FormComposer.d.ts +0 -34
- package/dist/types/components/Dropins/FormComposer/types.d.ts +0 -22
- package/dist/types/components/SoleProp/labels.d.ts +0 -5
- /package/dist/types/components/Dropins/{FormComposer/components/FormNavigation → FormNavigation}/FormNavigation.d.ts +0 -0
- /package/dist/types/components/Dropins/{FormComposer/components/FormNavigation → FormNavigation}/FormNavigationItem.d.ts +0 -0
- /package/dist/types/components/Dropins/{FormComposer/components/FormNavigation → FormNavigation}/index.d.ts +0 -0
- /package/dist/types/components/{Dropins/FormComposer/components/StepProgressIndicator → StepProgressIndicator}/StepProgressIndicator.d.ts +0 -0
|
@@ -3,7 +3,7 @@ import { createContext, createElement, render } from "preact";
|
|
|
3
3
|
import { sanitize } from "isomorphic-dompurify";
|
|
4
4
|
import cx from "classnames";
|
|
5
5
|
import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
6
|
-
import { useId, forwardRef, memo, useMemo as useMemo$1, useEffect as useEffect$1, useState as useState$1 } from "preact/compat";
|
|
6
|
+
import { useId, forwardRef, memo, useMemo as useMemo$1, useEffect as useEffect$1, useState as useState$1, useCallback as useCallback$1 } from "preact/compat";
|
|
7
7
|
import { debounce, noop as noop$1, isEmpty as isEmpty$1, range } from "lodash";
|
|
8
8
|
import OpenBankingSDK from "@adyen/openbankingsdk";
|
|
9
9
|
import "@adyen/adyen-document-viewer/dist/adyen-document-viewer.min.css";
|
|
@@ -189,7 +189,7 @@ const doNotHaveHandelsregisternummer = "I do not have a Handelsregisternummer";
|
|
|
189
189
|
const doNotHaveRegonKrsNumber = "I do not have a REGON";
|
|
190
190
|
const taxIdAbsenceReason = "Tax ID absence reason";
|
|
191
191
|
const vatNumberExempted = "Exempted from VAT";
|
|
192
|
-
const
|
|
192
|
+
const vatAbsenceReason = "VAT number absence reason";
|
|
193
193
|
const belowTaxThreshold = "Below tax threshold";
|
|
194
194
|
const industryExemption = "Industry exemption";
|
|
195
195
|
const validationPleaseEnterAValidRegistrationNumber = "Please enter a valid company registration number";
|
|
@@ -841,13 +841,7 @@ const legalCompanyName__helperText__US = "Enter the name exactly as it appears o
|
|
|
841
841
|
const legalCompanyName__helperText__SG = "Enter the name exactly as it is on your Accounting and Corporate Regulatory Authority (ACRA) BizFile.";
|
|
842
842
|
const legalCompanyName__helperText__HK = "Enter the name exactly as it is on your Hong Kong Companies Registry's Certificate of Incorporation.";
|
|
843
843
|
const taxInformationNumber = "Tax Identification Number";
|
|
844
|
-
const
|
|
845
|
-
const taxInformationNumber__helperText__US = "Also known as Employer Identification Number (EIN), this is issued by the IRS to businesses operating in the US.";
|
|
846
|
-
const businessRegistrationNumber = "Business registration number";
|
|
847
|
-
const businessRegistrationNumber__optional = "Business registration number (optional)";
|
|
848
|
-
const businessRegistrationNumber__HK = "Business Registration number (BRN)";
|
|
849
|
-
const businessRegistrationNumber__helperText__US = "This can be found on your registration documents or any documents you receive from the registrar such as account reminders.";
|
|
850
|
-
const businessRegistrationNumber__placeholder__US = "1234567 AB";
|
|
844
|
+
const taxInformationNumber__HK = "Business Registration number (BRN)";
|
|
851
845
|
const stockExchangeMIC = "Stock Exchange MIC";
|
|
852
846
|
const stockExchangeMIC__US = "Market identifier code (MIC)";
|
|
853
847
|
const stockExchangeMIC__placeholder__US = "XABC";
|
|
@@ -1385,7 +1379,7 @@ const defaultTrans = {
|
|
|
1385
1379
|
doNotHaveRegonKrsNumber,
|
|
1386
1380
|
taxIdAbsenceReason,
|
|
1387
1381
|
vatNumberExempted,
|
|
1388
|
-
|
|
1382
|
+
vatAbsenceReason,
|
|
1389
1383
|
belowTaxThreshold,
|
|
1390
1384
|
industryExemption,
|
|
1391
1385
|
validationPleaseEnterAValidRegistrationNumber,
|
|
@@ -2045,13 +2039,7 @@ const defaultTrans = {
|
|
|
2045
2039
|
legalCompanyName__helperText__SG,
|
|
2046
2040
|
legalCompanyName__helperText__HK,
|
|
2047
2041
|
taxInformationNumber,
|
|
2048
|
-
|
|
2049
|
-
taxInformationNumber__helperText__US,
|
|
2050
|
-
businessRegistrationNumber,
|
|
2051
|
-
businessRegistrationNumber__optional,
|
|
2052
|
-
businessRegistrationNumber__HK,
|
|
2053
|
-
businessRegistrationNumber__helperText__US,
|
|
2054
|
-
businessRegistrationNumber__placeholder__US,
|
|
2042
|
+
taxInformationNumber__HK,
|
|
2055
2043
|
stockExchangeMIC,
|
|
2056
2044
|
stockExchangeMIC__US,
|
|
2057
2045
|
stockExchangeMIC__placeholder__US,
|
|
@@ -3291,36 +3279,36 @@ var LegalEntityType = /* @__PURE__ */ ((LegalEntityType2) => {
|
|
|
3291
3279
|
})(LegalEntityType || {});
|
|
3292
3280
|
function getFormProps(props, innerFormId) {
|
|
3293
3281
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
3294
|
-
if (innerFormId) {
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3282
|
+
if (!innerFormId) {
|
|
3283
|
+
return null;
|
|
3284
|
+
}
|
|
3285
|
+
const activeFormId = (_a = props.activeForm) == null ? void 0 : _a.formId;
|
|
3286
|
+
return {
|
|
3287
|
+
placeholders: ((_b = props.placeholders) == null ? void 0 : _b[innerFormId]) ?? {},
|
|
3288
|
+
labels: ((_c = props.labels) == null ? void 0 : _c[innerFormId]) ?? {},
|
|
3289
|
+
helperText: ((_d = props.helperText) == null ? void 0 : _d[innerFormId]) ?? {},
|
|
3290
|
+
masks: ((_e = props.masks) == null ? void 0 : _e[innerFormId]) ?? {},
|
|
3291
|
+
data: ((_f = props.data) == null ? void 0 : _f[innerFormId]) ?? {},
|
|
3292
|
+
readOnlyFields: ((_g = props.readOnlyFields) == null ? void 0 : _g[innerFormId]) ?? [],
|
|
3293
|
+
requiredFields: ((_h = props.requiredFields) == null ? void 0 : _h[innerFormId]) ?? [],
|
|
3294
|
+
optionalFields: ((_i = props.optionalFields) == null ? void 0 : _i[innerFormId]) ?? [],
|
|
3295
|
+
maskedFields: ((_j = props.maskedFields) == null ? void 0 : _j[innerFormId]) ?? [],
|
|
3296
|
+
verifyFields: ((_k = props.verifyFields) == null ? void 0 : _k[innerFormId]) ?? [],
|
|
3297
|
+
formVerificationErrors: ((_m = (_l = props.problems) == null ? void 0 : _l.verificationErrors) == null ? void 0 : _m[innerFormId]) ?? {},
|
|
3298
|
+
fieldValidationErrors: ((_o = (_n = props.problems) == null ? void 0 : _n.validationErrors) == null ? void 0 : _o[innerFormId]) ?? {},
|
|
3299
|
+
/*
|
|
3309
3300
|
Validators should be `null` and not `{}` by default to make it easier to short circuit it with predetermined validators.
|
|
3310
3301
|
For example `rules: props.validators || personalDetailsValidationRules`.
|
|
3311
3302
|
*/
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
activeForm check is required for shouldValidate because
|
|
3303
|
+
validators: ((_p = props.validators) == null ? void 0 : _p[innerFormId]) ? {
|
|
3304
|
+
...(_q = props.validators) == null ? void 0 : _q[innerFormId]
|
|
3305
|
+
} : null,
|
|
3306
|
+
/*
|
|
3307
|
+
activeForm check is required for shouldValidate because we render all forms in a multistep form.
|
|
3317
3308
|
Should be changed once stateManagement is fixed and this is no longer the case
|
|
3318
3309
|
*/
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
return nestedFormProps;
|
|
3322
|
-
}
|
|
3323
|
-
return null;
|
|
3310
|
+
shouldValidate: (activeFormId ? activeFormId === innerFormId : true) && props.shouldValidate
|
|
3311
|
+
};
|
|
3324
3312
|
}
|
|
3325
3313
|
function getFieldProps(props, innerFormFields) {
|
|
3326
3314
|
if (innerFormFields) {
|
|
@@ -6682,10 +6670,10 @@ const validatePatternOnBlur = (pattern) => ({
|
|
|
6682
6670
|
modes: ["blur"],
|
|
6683
6671
|
validate: (val) => !!val && pattern.test(val)
|
|
6684
6672
|
});
|
|
6685
|
-
const defaultFieldMetadata$
|
|
6673
|
+
const defaultFieldMetadata$3 = {
|
|
6686
6674
|
label: "registrationNumber"
|
|
6687
6675
|
};
|
|
6688
|
-
const defaultFieldConfig$
|
|
6676
|
+
const defaultFieldConfig$3 = {
|
|
6689
6677
|
[CountryCodes.Australia]: {
|
|
6690
6678
|
label: "australianBusinessNumberAcn",
|
|
6691
6679
|
mask: businessRegistrationNumberMasks[CountryCodes.Australia].default,
|
|
@@ -6780,7 +6768,7 @@ const defaultFieldConfig$2 = {
|
|
|
6780
6768
|
key: "enterNDigitsForExample",
|
|
6781
6769
|
values: {
|
|
6782
6770
|
numDigits: "9",
|
|
6783
|
-
example: "
|
|
6771
|
+
example: "080020970"
|
|
6784
6772
|
}
|
|
6785
6773
|
}
|
|
6786
6774
|
},
|
|
@@ -6992,13 +6980,17 @@ const defaultFieldConfig$2 = {
|
|
|
6992
6980
|
default:
|
|
6993
6981
|
return {
|
|
6994
6982
|
label: "partitaIVA",
|
|
6995
|
-
|
|
6996
|
-
|
|
6983
|
+
validators: validatePatternOnBlur(/^\d{11}$/),
|
|
6984
|
+
mask: {
|
|
6985
|
+
mask: makeMask(...nonInputs("IT", {
|
|
6986
|
+
includeInValue: false
|
|
6987
|
+
}), spacer, ...numericInputs(11))
|
|
6988
|
+
},
|
|
6997
6989
|
guidanceText: {
|
|
6998
|
-
key: "
|
|
6990
|
+
key: "enterTheRemainingNDigitsForExample",
|
|
6999
6991
|
values: {
|
|
7000
6992
|
numDigits: "11",
|
|
7001
|
-
example: "
|
|
6993
|
+
example: "IT47040001100"
|
|
7002
6994
|
}
|
|
7003
6995
|
}
|
|
7004
6996
|
};
|
|
@@ -7334,7 +7326,7 @@ const defaultFieldConfig$2 = {
|
|
|
7334
7326
|
const businessRegistrationNumberFields = ["registrationNumber", "exemptedFromRegistrationNumber"];
|
|
7335
7327
|
function BusinessRegistrationNumber(props) {
|
|
7336
7328
|
var _a;
|
|
7337
|
-
const fieldConfig = props.fieldConfig ?? defaultFieldConfig$
|
|
7329
|
+
const fieldConfig = props.fieldConfig ?? defaultFieldConfig$3;
|
|
7338
7330
|
const {
|
|
7339
7331
|
i18n
|
|
7340
7332
|
} = useI18nContext();
|
|
@@ -7350,7 +7342,7 @@ function BusinessRegistrationNumber(props) {
|
|
|
7350
7342
|
const metadata = resolveFieldMetadata(fieldConfig[country2], {
|
|
7351
7343
|
companyType: companyType2,
|
|
7352
7344
|
registrationNumberType
|
|
7353
|
-
}, defaultFieldMetadata$
|
|
7345
|
+
}, defaultFieldMetadata$3);
|
|
7354
7346
|
const mergedProps = mergeFieldMetadataIntoProps("registrationNumber", metadata, {
|
|
7355
7347
|
requiredFields: schema
|
|
7356
7348
|
});
|
|
@@ -7912,7 +7904,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
7912
7904
|
}
|
|
7913
7905
|
const inferCompanyRegistrationNumberType = (registrationNumber2, country2, companyType2) => {
|
|
7914
7906
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
7915
|
-
const metadataFn = defaultFieldConfig$
|
|
7907
|
+
const metadataFn = defaultFieldConfig$3[country2];
|
|
7916
7908
|
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
7917
7909
|
return void 0;
|
|
7918
7910
|
for (const option of optionsForCountry) {
|
|
@@ -7928,10 +7920,10 @@ const inferCompanyRegistrationNumberType = (registrationNumber2, country2, compa
|
|
|
7928
7920
|
}
|
|
7929
7921
|
}
|
|
7930
7922
|
};
|
|
7931
|
-
const defaultFieldMetadata$
|
|
7923
|
+
const defaultFieldMetadata$2 = {
|
|
7932
7924
|
label: "taxId"
|
|
7933
7925
|
};
|
|
7934
|
-
const defaultFieldConfig$
|
|
7926
|
+
const defaultFieldConfig$2 = {
|
|
7935
7927
|
[CountryCodes.Canada]: {
|
|
7936
7928
|
label: "businessNumber",
|
|
7937
7929
|
validators: validatePatternOnBlur(/^\d{9}$/),
|
|
@@ -7947,7 +7939,7 @@ const defaultFieldConfig$1 = {
|
|
|
7947
7939
|
}
|
|
7948
7940
|
},
|
|
7949
7941
|
[CountryCodes.HongKong]: {
|
|
7950
|
-
label: "
|
|
7942
|
+
label: "taxInformationNumber__HK",
|
|
7951
7943
|
validators: validatePatternOnBlur(/^\d{8}$/),
|
|
7952
7944
|
mask: {
|
|
7953
7945
|
mask: makeMask(...numericInputs(8))
|
|
@@ -8032,7 +8024,7 @@ const defaultFieldConfig$1 = {
|
|
|
8032
8024
|
mask: {
|
|
8033
8025
|
mask: makeMask(...numericInputs(9))
|
|
8034
8026
|
},
|
|
8035
|
-
|
|
8027
|
+
guidanceText: {
|
|
8036
8028
|
key: "validationPleaseEnterAValidTaxIdNumberWithFormat",
|
|
8037
8029
|
values: {
|
|
8038
8030
|
format: "XXXXXXXXX"
|
|
@@ -8060,10 +8052,10 @@ const defaultFieldConfig$1 = {
|
|
|
8060
8052
|
validators: validatePatternOnBlur(/^\d{12}$/)
|
|
8061
8053
|
}
|
|
8062
8054
|
};
|
|
8063
|
-
const defaultFieldMetadata = {
|
|
8055
|
+
const defaultFieldMetadata$1 = {
|
|
8064
8056
|
label: "vatNumber"
|
|
8065
8057
|
};
|
|
8066
|
-
const defaultFieldConfig = {
|
|
8058
|
+
const defaultFieldConfig$1 = {
|
|
8067
8059
|
[CountryCodes.Austria]: {
|
|
8068
8060
|
label: "UST-ID",
|
|
8069
8061
|
validators: validatePatternOnBlur(/^ATU\d{8}$/),
|
|
@@ -8353,7 +8345,7 @@ const defaultFieldConfig = {
|
|
|
8353
8345
|
key: "enterTheRemainingNDigitsForExample",
|
|
8354
8346
|
values: {
|
|
8355
8347
|
numDigits: "11",
|
|
8356
|
-
example: "
|
|
8348
|
+
example: "IT47040001100"
|
|
8357
8349
|
}
|
|
8358
8350
|
}
|
|
8359
8351
|
},
|
|
@@ -8618,7 +8610,7 @@ const defaultFieldConfig = {
|
|
|
8618
8610
|
numDigits: "9",
|
|
8619
8611
|
minLetters: "3",
|
|
8620
8612
|
maxLetters: "4",
|
|
8621
|
-
example: "
|
|
8613
|
+
example: "CHE-123.456.789 TVA"
|
|
8622
8614
|
}
|
|
8623
8615
|
}
|
|
8624
8616
|
},
|
|
@@ -8692,7 +8684,7 @@ const defaultFieldConfig = {
|
|
|
8692
8684
|
};
|
|
8693
8685
|
const inferTaxIdNumberType = (taxId2, country2) => {
|
|
8694
8686
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
8695
|
-
const metadataFn = defaultFieldConfig[country2] ?? defaultFieldConfig$
|
|
8687
|
+
const metadataFn = defaultFieldConfig$1[country2] ?? defaultFieldConfig$2[country2];
|
|
8696
8688
|
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
8697
8689
|
return void 0;
|
|
8698
8690
|
for (const option of optionsForCountry) {
|
|
@@ -8748,11 +8740,11 @@ function TaxId(props) {
|
|
|
8748
8740
|
fieldValidationErrors,
|
|
8749
8741
|
dataStoreId,
|
|
8750
8742
|
taxIdNumberType,
|
|
8751
|
-
fieldConfig = defaultFieldConfig$
|
|
8743
|
+
fieldConfig = defaultFieldConfig$2
|
|
8752
8744
|
} = props;
|
|
8753
8745
|
const metadata = resolveFieldMetadata(fieldConfig[country2], {
|
|
8754
8746
|
taxIdNumberType
|
|
8755
|
-
}, defaultFieldMetadata$
|
|
8747
|
+
}, defaultFieldMetadata$2);
|
|
8756
8748
|
const mergedProps = mergeFieldMetadataIntoProps("taxId", metadata, props);
|
|
8757
8749
|
const {
|
|
8758
8750
|
i18n
|
|
@@ -8867,12 +8859,12 @@ function VatNumber(props) {
|
|
|
8867
8859
|
country: country2,
|
|
8868
8860
|
fieldValidationErrors,
|
|
8869
8861
|
dataStoreId,
|
|
8870
|
-
fieldConfig = defaultFieldConfig,
|
|
8862
|
+
fieldConfig = defaultFieldConfig$1,
|
|
8871
8863
|
vatNumberType
|
|
8872
8864
|
} = props;
|
|
8873
8865
|
const metadata = resolveFieldMetadata(fieldConfig[country2], {
|
|
8874
8866
|
vatNumberType
|
|
8875
|
-
}, defaultFieldMetadata);
|
|
8867
|
+
}, defaultFieldMetadata$1);
|
|
8876
8868
|
const mergedProps = mergeFieldMetadataIntoProps("vatNumber", metadata, props);
|
|
8877
8869
|
const {
|
|
8878
8870
|
i18n
|
|
@@ -8954,7 +8946,7 @@ function VatNumber(props) {
|
|
|
8954
8946
|
}), data.exemptedFromVat ? jsx(Field, {
|
|
8955
8947
|
name: "vatAbsenceReason",
|
|
8956
8948
|
classNameModifiers: ["tax-id-absence-reason"],
|
|
8957
|
-
label: formUtils.getLabel("vatAbsenceReason", "
|
|
8949
|
+
label: formUtils.getLabel("vatAbsenceReason", "vatAbsenceReason"),
|
|
8958
8950
|
errorMessage: formUtils.getErrorMessage("vatAbsenceReason", errors, fieldProblems),
|
|
8959
8951
|
isValid: valid.vatAbsenceReason,
|
|
8960
8952
|
children: (childProps) => jsx(Select, {
|
|
@@ -8966,7 +8958,7 @@ function VatNumber(props) {
|
|
|
8966
8958
|
id: reason,
|
|
8967
8959
|
name: i18n.get(reason)
|
|
8968
8960
|
})),
|
|
8969
|
-
placeholder: i18n.get("
|
|
8961
|
+
placeholder: i18n.get("vatAbsenceReason")
|
|
8970
8962
|
})
|
|
8971
8963
|
}) : null]
|
|
8972
8964
|
});
|
|
@@ -9359,6 +9351,9 @@ const companySearchBase = {
|
|
|
9359
9351
|
},
|
|
9360
9352
|
dateOfIncorporation: {
|
|
9361
9353
|
rule: "countryRequiresDateOfIncorporationForCompanies"
|
|
9354
|
+
},
|
|
9355
|
+
registrationNumber: {
|
|
9356
|
+
rule: "countryRequiresRegistrationNumberForCompanies"
|
|
9362
9357
|
}
|
|
9363
9358
|
};
|
|
9364
9359
|
const taxIdBase$1 = {
|
|
@@ -9474,10 +9469,7 @@ const companySearchFieldsPerScenario = {
|
|
|
9474
9469
|
}
|
|
9475
9470
|
},
|
|
9476
9471
|
L1: {
|
|
9477
|
-
...companySearchBase
|
|
9478
|
-
taxInformation: {
|
|
9479
|
-
rule: "countryRequiresTaxInformationForSearch"
|
|
9480
|
-
}
|
|
9472
|
+
...companySearchBase
|
|
9481
9473
|
},
|
|
9482
9474
|
L: {
|
|
9483
9475
|
...companySearchBase,
|
|
@@ -9506,9 +9498,6 @@ const countryConfig$4 = {
|
|
|
9506
9498
|
},
|
|
9507
9499
|
legalEntityType: {
|
|
9508
9500
|
label: "companyType"
|
|
9509
|
-
},
|
|
9510
|
-
taxInformation: {
|
|
9511
|
-
label: "australianBusinessNumberAbn"
|
|
9512
9501
|
}
|
|
9513
9502
|
},
|
|
9514
9503
|
[CountryCodes.Austria]: {
|
|
@@ -9516,13 +9505,10 @@ const countryConfig$4 = {
|
|
|
9516
9505
|
label: "vatNumberExempted"
|
|
9517
9506
|
},
|
|
9518
9507
|
vatAbsenceReason: {
|
|
9519
|
-
label: "
|
|
9508
|
+
label: "vatAbsenceReason"
|
|
9520
9509
|
},
|
|
9521
9510
|
exemptedFromRegistrationNumber: {
|
|
9522
9511
|
label: "doNotHaveFirmenbuchnummer"
|
|
9523
|
-
},
|
|
9524
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9525
|
-
label: "doNotHaveFirmenbuchnummer"
|
|
9526
9512
|
}
|
|
9527
9513
|
},
|
|
9528
9514
|
[CountryCodes.Belgium]: {
|
|
@@ -9530,7 +9516,7 @@ const countryConfig$4 = {
|
|
|
9530
9516
|
label: "vatNumberExempted"
|
|
9531
9517
|
},
|
|
9532
9518
|
vatAbsenceReason: {
|
|
9533
|
-
label: "
|
|
9519
|
+
label: "vatAbsenceReason"
|
|
9534
9520
|
}
|
|
9535
9521
|
},
|
|
9536
9522
|
[CountryCodes.Brazil]: {},
|
|
@@ -9546,14 +9532,8 @@ const countryConfig$4 = {
|
|
|
9546
9532
|
exemptedFromRegistrationNumber: {
|
|
9547
9533
|
label: "doNotHaveBusinessIncorporationNumber"
|
|
9548
9534
|
},
|
|
9549
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9550
|
-
label: "doNotHaveBusinessIncorporationNumber"
|
|
9551
|
-
},
|
|
9552
9535
|
exemptedFromTax: {
|
|
9553
9536
|
label: "doNotHaveBusinessNumber"
|
|
9554
|
-
},
|
|
9555
|
-
taxInformation: {
|
|
9556
|
-
label: "businessNumber"
|
|
9557
9537
|
}
|
|
9558
9538
|
},
|
|
9559
9539
|
[CountryCodes.Croatia]: {
|
|
@@ -9568,7 +9548,7 @@ const countryConfig$4 = {
|
|
|
9568
9548
|
},
|
|
9569
9549
|
[CountryCodes.CzechRepublic]: {
|
|
9570
9550
|
vatAbsenceReason: {
|
|
9571
|
-
label: "
|
|
9551
|
+
label: "vatAbsenceReason"
|
|
9572
9552
|
},
|
|
9573
9553
|
exemptedFromVat: {
|
|
9574
9554
|
label: "vatNumberExempted"
|
|
@@ -9588,9 +9568,6 @@ const countryConfig$4 = {
|
|
|
9588
9568
|
exemptedFromRegistrationNumber: {
|
|
9589
9569
|
label: "doNotHaveYTunnus"
|
|
9590
9570
|
},
|
|
9591
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9592
|
-
label: "doNotHaveYTunnus"
|
|
9593
|
-
},
|
|
9594
9571
|
exemptedFromVat: {
|
|
9595
9572
|
label: "vatNumberExempted"
|
|
9596
9573
|
}
|
|
@@ -9600,14 +9577,11 @@ const countryConfig$4 = {
|
|
|
9600
9577
|
exemptedFromRegistrationNumber: {
|
|
9601
9578
|
label: "doNotHaveHandelsregisternummer"
|
|
9602
9579
|
},
|
|
9603
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9604
|
-
label: "doNotHaveHandelsregisternummer"
|
|
9605
|
-
},
|
|
9606
9580
|
exemptedFromVat: {
|
|
9607
9581
|
label: "vatNumberExempted"
|
|
9608
9582
|
},
|
|
9609
9583
|
vatAbsenceReason: {
|
|
9610
|
-
label: "
|
|
9584
|
+
label: "vatAbsenceReason"
|
|
9611
9585
|
}
|
|
9612
9586
|
},
|
|
9613
9587
|
[CountryCodes.Gibraltar]: {},
|
|
@@ -9647,7 +9621,7 @@ const countryConfig$4 = {
|
|
|
9647
9621
|
label: "vatNumberExempted"
|
|
9648
9622
|
},
|
|
9649
9623
|
vatAbsenceReason: {
|
|
9650
|
-
label: "
|
|
9624
|
+
label: "vatAbsenceReason"
|
|
9651
9625
|
}
|
|
9652
9626
|
},
|
|
9653
9627
|
[CountryCodes.Japan]: {
|
|
@@ -9670,9 +9644,6 @@ const countryConfig$4 = {
|
|
|
9670
9644
|
exemptedFromRegistrationNumber: {
|
|
9671
9645
|
label: "doNotHaveLtRegistrationNumber"
|
|
9672
9646
|
},
|
|
9673
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9674
|
-
label: "doNotHaveLtRegistrationNumber"
|
|
9675
|
-
},
|
|
9676
9647
|
exemptedFromVat: {
|
|
9677
9648
|
label: "vatNumberExempted"
|
|
9678
9649
|
}
|
|
@@ -9681,9 +9652,6 @@ const countryConfig$4 = {
|
|
|
9681
9652
|
exemptedFromRegistrationNumber: {
|
|
9682
9653
|
label: "doNotHaveLuRegistrationNumber"
|
|
9683
9654
|
},
|
|
9684
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9685
|
-
label: "doNotHaveLuRegistrationNumber"
|
|
9686
|
-
},
|
|
9687
9655
|
exemptedFromVat: {
|
|
9688
9656
|
label: "vatNumberExempted"
|
|
9689
9657
|
}
|
|
@@ -9708,7 +9676,7 @@ const countryConfig$4 = {
|
|
|
9708
9676
|
label: "vatNumberExempted"
|
|
9709
9677
|
},
|
|
9710
9678
|
vatAbsenceReason: {
|
|
9711
|
-
label: "
|
|
9679
|
+
label: "vatAbsenceReason"
|
|
9712
9680
|
}
|
|
9713
9681
|
},
|
|
9714
9682
|
[CountryCodes.NewZealand]: {
|
|
@@ -9727,21 +9695,18 @@ const countryConfig$4 = {
|
|
|
9727
9695
|
label: "vatNumberExempted"
|
|
9728
9696
|
},
|
|
9729
9697
|
vatAbsenceReason: {
|
|
9730
|
-
label: "
|
|
9698
|
+
label: "vatAbsenceReason"
|
|
9731
9699
|
}
|
|
9732
9700
|
},
|
|
9733
9701
|
[CountryCodes.Poland]: {
|
|
9734
9702
|
exemptedFromRegistrationNumber: {
|
|
9735
9703
|
label: "doNotHaveRegonKrsNumber"
|
|
9736
9704
|
},
|
|
9737
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9738
|
-
label: "doNotHaveRegonKrsNumber"
|
|
9739
|
-
},
|
|
9740
9705
|
exemptedFromVat: {
|
|
9741
9706
|
label: "vatNumberExempted"
|
|
9742
9707
|
},
|
|
9743
9708
|
vatAbsenceReason: {
|
|
9744
|
-
label: "
|
|
9709
|
+
label: "vatAbsenceReason"
|
|
9745
9710
|
}
|
|
9746
9711
|
},
|
|
9747
9712
|
[CountryCodes.Portugal]: {
|
|
@@ -9749,7 +9714,7 @@ const countryConfig$4 = {
|
|
|
9749
9714
|
label: "vatNumberExempted"
|
|
9750
9715
|
},
|
|
9751
9716
|
vatAbsenceReason: {
|
|
9752
|
-
label: "
|
|
9717
|
+
label: "vatAbsenceReason"
|
|
9753
9718
|
}
|
|
9754
9719
|
},
|
|
9755
9720
|
[CountryCodes.PuertoRico]: {},
|
|
@@ -9773,7 +9738,7 @@ const countryConfig$4 = {
|
|
|
9773
9738
|
label: "vatNumberExempted"
|
|
9774
9739
|
},
|
|
9775
9740
|
vatAbsenceReason: {
|
|
9776
|
-
label: "
|
|
9741
|
+
label: "vatAbsenceReason"
|
|
9777
9742
|
}
|
|
9778
9743
|
},
|
|
9779
9744
|
[CountryCodes.Singapore]: {
|
|
@@ -9794,23 +9759,17 @@ const countryConfig$4 = {
|
|
|
9794
9759
|
exemptedFromRegistrationNumber: {
|
|
9795
9760
|
label: "doNotHaveOrganisationsnummer"
|
|
9796
9761
|
},
|
|
9797
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9798
|
-
label: "doNotHaveOrganisationsnummer"
|
|
9799
|
-
},
|
|
9800
9762
|
exemptedFromVat: {
|
|
9801
9763
|
label: "vatNumberExempted"
|
|
9802
9764
|
},
|
|
9803
9765
|
vatAbsenceReason: {
|
|
9804
|
-
label: "
|
|
9766
|
+
label: "vatAbsenceReason"
|
|
9805
9767
|
}
|
|
9806
9768
|
},
|
|
9807
9769
|
[CountryCodes.Switzerland]: {
|
|
9808
9770
|
exemptedFromRegistrationNumber: {
|
|
9809
9771
|
label: "doNotHaveChRegistrationNumber"
|
|
9810
9772
|
},
|
|
9811
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9812
|
-
label: "doNotHaveChRegistrationNumber"
|
|
9813
|
-
},
|
|
9814
9773
|
exemptedFromVat: {
|
|
9815
9774
|
label: "vatNumberExempted"
|
|
9816
9775
|
}
|
|
@@ -9836,14 +9795,6 @@ const countryConfig$4 = {
|
|
|
9836
9795
|
label: "employerIdentificationNumber"
|
|
9837
9796
|
},
|
|
9838
9797
|
/* CompanySearchComponent specific fields */
|
|
9839
|
-
taxInformation: {
|
|
9840
|
-
label: "taxInformationNumber__US",
|
|
9841
|
-
helperText: "taxInformationNumber__helperText__US"
|
|
9842
|
-
},
|
|
9843
|
-
businessRegistrationNumber: {
|
|
9844
|
-
label: "businessRegistrationNumber",
|
|
9845
|
-
placeholder: "businessRegistrationNumber__placeholder__US"
|
|
9846
|
-
},
|
|
9847
9798
|
stockExchangeMIC: {
|
|
9848
9799
|
label: "stockExchangeMIC__US",
|
|
9849
9800
|
placeholder: "stockExchangeMIC__placeholder__US"
|
|
@@ -12617,13 +12568,13 @@ const rules$2 = ({
|
|
|
12617
12568
|
},
|
|
12618
12569
|
stockExchangeMICIfTypePublic: () => {
|
|
12619
12570
|
var _a, _b;
|
|
12620
|
-
if (
|
|
12571
|
+
if ("companyType" in data && (((_a = data.companyType) == null ? void 0 : _a.entityType) === CompanyTypesValue.PUBLIC_COMPANY || ((_b = data.companyStructure) == null ? void 0 : _b.entityType) === CompanyTypesValue.PUBLIC_COMPANY)) {
|
|
12621
12572
|
return "REQUIRED";
|
|
12622
12573
|
}
|
|
12623
12574
|
},
|
|
12624
12575
|
stockISINIfTypePublic: () => {
|
|
12625
12576
|
var _a, _b;
|
|
12626
|
-
if (
|
|
12577
|
+
if ("companyType" in data && (((_a = data.companyType) == null ? void 0 : _a.entityType) === CompanyTypesValue.PUBLIC_COMPANY || ((_b = data.companyStructure) == null ? void 0 : _b.entityType) === CompanyTypesValue.PUBLIC_COMPANY)) {
|
|
12627
12578
|
return "REQUIRED";
|
|
12628
12579
|
}
|
|
12629
12580
|
},
|
|
@@ -12633,7 +12584,7 @@ const rules$2 = ({
|
|
|
12633
12584
|
}
|
|
12634
12585
|
},
|
|
12635
12586
|
countryUsesTaxId: () => {
|
|
12636
|
-
if (COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country2) && !(
|
|
12587
|
+
if (COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country2) && !(taskType === TaskTypes.SOLE_PROPRIETOR_COMPANY && COUNTRIES_THAT_DO_NOT_USE_TAX_ID_FOR_SOLE_PROP.includes(country2))) {
|
|
12637
12588
|
return "REQUIRED";
|
|
12638
12589
|
}
|
|
12639
12590
|
},
|
|
@@ -12644,7 +12595,7 @@ const rules$2 = ({
|
|
|
12644
12595
|
},
|
|
12645
12596
|
companyRegistrationNumberExemptionAllowed: () => {
|
|
12646
12597
|
var _a, _b;
|
|
12647
|
-
const companyType2 =
|
|
12598
|
+
const companyType2 = "companyType" in data && (((_a = data.companyType) == null ? void 0 : _a.entityType) || ((_b = data.companyStructure) == null ? void 0 : _b.entityType));
|
|
12648
12599
|
if (country2 === "DE" && (companyType2 === CompanyTypesValue.GOVERNMENTAL_ORGANIZATION || companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE)) {
|
|
12649
12600
|
return "REQUIRED";
|
|
12650
12601
|
}
|
|
@@ -13007,7 +12958,7 @@ const companySearchBaseMapping = {
|
|
|
13007
12958
|
"companyRegistrationAddress.operationalAddress.otherAddressInformation": "organization.principalPlaceOfBusiness.street2",
|
|
13008
12959
|
"companyStructure.entityType": "organization.type",
|
|
13009
12960
|
"companyOtherDetails.tradingName": "organization.doingBusinessAs",
|
|
13010
|
-
"companyOtherDetails.
|
|
12961
|
+
"companyOtherDetails.registrationNumber": "organization.registrationNumber",
|
|
13011
12962
|
"companyOtherDetails.taxInformation": "organization.taxInformation",
|
|
13012
12963
|
"companyOtherDetails.vatNumber": "organization.vatNumber",
|
|
13013
12964
|
"companyOtherDetails.vatAbsenceReason": "organization.vatAbsenceReason",
|
|
@@ -21395,7 +21346,7 @@ const trackNavigation = ({
|
|
|
21395
21346
|
}
|
|
21396
21347
|
});
|
|
21397
21348
|
};
|
|
21398
|
-
const getOpeningStep
|
|
21349
|
+
const getOpeningStep = (forms2, remediationActions) => {
|
|
21399
21350
|
var _a;
|
|
21400
21351
|
if (remediationActions && Object.keys(remediationActions).length > 0) {
|
|
21401
21352
|
const allRemediationActions = Object.values(remediationActions).flat().filter((rem) => {
|
|
@@ -21443,7 +21394,7 @@ const useFormComposer = ({
|
|
|
21443
21394
|
useEffect(() => {
|
|
21444
21395
|
if (hasAlreadyNavigatedForm)
|
|
21445
21396
|
return;
|
|
21446
|
-
const openingStep = getOpeningStep
|
|
21397
|
+
const openingStep = getOpeningStep(forms2, problems == null ? void 0 : problems.remediationActions);
|
|
21447
21398
|
if (activeForm !== openingStep) {
|
|
21448
21399
|
setActiveForm(openingStep);
|
|
21449
21400
|
}
|
|
@@ -23015,7 +22966,7 @@ const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, c
|
|
|
23015
22966
|
}
|
|
23016
22967
|
return currentLegalEntityType;
|
|
23017
22968
|
};
|
|
23018
|
-
const
|
|
22969
|
+
const FormWrapper$1 = "";
|
|
23019
22970
|
const logger$c = createLogger("FormRouterContextProvider");
|
|
23020
22971
|
function FormRouterContextProvider({
|
|
23021
22972
|
children,
|
|
@@ -23270,16 +23221,16 @@ const FormWrapper = ({
|
|
|
23270
23221
|
})
|
|
23271
23222
|
});
|
|
23272
23223
|
};
|
|
23273
|
-
const parseConfiguration$
|
|
23224
|
+
const parseConfiguration$5 = ({
|
|
23274
23225
|
country: country2,
|
|
23275
23226
|
matchingScenario
|
|
23276
23227
|
}) => parseCompanyScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.ORGANIZATION], country2);
|
|
23277
|
-
const canSubmit$
|
|
23228
|
+
const canSubmit$2 = (data) => mandatoryApiFields.ORGANIZATION.every((detail) => {
|
|
23278
23229
|
const value = getProp(data, detail);
|
|
23279
23230
|
return !isEmpty(value);
|
|
23280
23231
|
});
|
|
23281
|
-
const isDocumentsRequired$
|
|
23282
|
-
const formatFileSummaryData = (companyRegistrationDocument2, companyTaxDocument) => {
|
|
23232
|
+
const isDocumentsRequired$2 = (forms2) => forms2.some((form) => [companyForms.companyRegistrationDocument.formId, companyForms.companyTaxDocument.formId].includes(form.formId));
|
|
23233
|
+
const formatFileSummaryData$1 = (companyRegistrationDocument2, companyTaxDocument) => {
|
|
23283
23234
|
var _a, _b;
|
|
23284
23235
|
const registrationDocument2 = (_a = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0];
|
|
23285
23236
|
const taxDocument2 = (_b = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _b[0];
|
|
@@ -23367,7 +23318,7 @@ function CompanyDropinComponent({
|
|
|
23367
23318
|
fieldConfigurations,
|
|
23368
23319
|
requiredFields
|
|
23369
23320
|
} = useScenarioConfiguration({
|
|
23370
|
-
parseConfiguration: parseConfiguration$
|
|
23321
|
+
parseConfiguration: parseConfiguration$5,
|
|
23371
23322
|
getConfigurationData,
|
|
23372
23323
|
setLoadingStatus,
|
|
23373
23324
|
country: country2
|
|
@@ -23403,7 +23354,7 @@ function CompanyDropinComponent({
|
|
|
23403
23354
|
legalEntity,
|
|
23404
23355
|
dataSubmitted
|
|
23405
23356
|
}) => {
|
|
23406
|
-
if (!isDocumentsRequired$
|
|
23357
|
+
if (!isDocumentsRequired$2(forms22))
|
|
23407
23358
|
return;
|
|
23408
23359
|
const formattedDocument = await mapCompanyDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
23409
23360
|
if (formattedDocument) {
|
|
@@ -23571,16 +23522,16 @@ function CompanyDropinComponent({
|
|
|
23571
23522
|
summaryData.companyRegistrationAddress.operationalAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.companyRegistrationAddress.operationalAddress, datasetUtils);
|
|
23572
23523
|
}
|
|
23573
23524
|
if ((_h = summaryData.companyRegistrationDetails) == null ? void 0 : _h.vatAbsenceReason) {
|
|
23574
|
-
const
|
|
23575
|
-
if (
|
|
23576
|
-
summaryData.companyRegistrationDetails.vatAbsenceReason = i18n.get(
|
|
23525
|
+
const vatAbsenceReason2 = vatAbsenceReasons.find((absenceReason) => absenceReason === summaryData.companyRegistrationDetails.vatAbsenceReason);
|
|
23526
|
+
if (vatAbsenceReason2) {
|
|
23527
|
+
summaryData.companyRegistrationDetails.vatAbsenceReason = i18n.get(vatAbsenceReason2);
|
|
23577
23528
|
}
|
|
23578
23529
|
}
|
|
23579
|
-
if (isDocumentsRequired$
|
|
23530
|
+
if (isDocumentsRequired$2(forms22)) {
|
|
23580
23531
|
companyDocumentForms.forEach((formId) => delete summaryData[formId]);
|
|
23581
23532
|
summaryData = {
|
|
23582
23533
|
...summaryData,
|
|
23583
|
-
...formatFileSummaryData(data2.companyRegistrationDocument, data2.companyTaxDocument)
|
|
23534
|
+
...formatFileSummaryData$1(data2.companyRegistrationDocument, data2.companyTaxDocument)
|
|
23584
23535
|
};
|
|
23585
23536
|
}
|
|
23586
23537
|
return summaryData;
|
|
@@ -23616,7 +23567,7 @@ function CompanyDropinComponent({
|
|
|
23616
23567
|
baseTrackingPayload,
|
|
23617
23568
|
onSubmit,
|
|
23618
23569
|
problems,
|
|
23619
|
-
canSubmit: canSubmit$
|
|
23570
|
+
canSubmit: canSubmit$2(data) && hasDataChanged(dataFromResponse, data),
|
|
23620
23571
|
summary: {
|
|
23621
23572
|
data: formatDataForSummary2(data, forms2),
|
|
23622
23573
|
omittedKeys: ["operationalAddressIsSame"]
|
|
@@ -23650,6 +23601,7 @@ function useCompanySearch({
|
|
|
23650
23601
|
taxIdentificationNumber: taxIdentificationNumber2,
|
|
23651
23602
|
canVerify,
|
|
23652
23603
|
limit = 15,
|
|
23604
|
+
setKompanyAddress,
|
|
23653
23605
|
handleChangeFor,
|
|
23654
23606
|
handleCompanyIndexSearch,
|
|
23655
23607
|
handleCompanyDeepSearch,
|
|
@@ -23705,7 +23657,7 @@ function useCompanySearch({
|
|
|
23705
23657
|
} finally {
|
|
23706
23658
|
setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
|
|
23707
23659
|
}
|
|
23708
|
-
},
|
|
23660
|
+
}, 700), []);
|
|
23709
23661
|
const retrySearch = useCallback(async () => {
|
|
23710
23662
|
if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
|
|
23711
23663
|
return setStatus("idle");
|
|
@@ -23789,17 +23741,17 @@ function useCompanySearch({
|
|
|
23789
23741
|
setStatus("loading");
|
|
23790
23742
|
setSelectedCompanyId(void 0);
|
|
23791
23743
|
setVerifiedCompany(void 0);
|
|
23744
|
+
setKompanyAddress(void 0);
|
|
23792
23745
|
setCompaniesList([]);
|
|
23793
23746
|
if (defaultData) {
|
|
23794
|
-
|
|
23795
|
-
handleChangeFor(field)(value);
|
|
23796
|
-
});
|
|
23747
|
+
handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
|
|
23797
23748
|
}
|
|
23798
|
-
}, [defaultData, handleChangeFor]);
|
|
23749
|
+
}, [defaultData, handleChangeFor, setKompanyAddress]);
|
|
23799
23750
|
useEffect(() => {
|
|
23800
23751
|
var _a;
|
|
23801
23752
|
setError(void 0);
|
|
23802
|
-
|
|
23753
|
+
const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
|
|
23754
|
+
if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
|
|
23803
23755
|
return setStatus("idle");
|
|
23804
23756
|
}
|
|
23805
23757
|
if (!verifiedCompany) {
|
|
@@ -23834,6 +23786,15 @@ function useCompanySearch({
|
|
|
23834
23786
|
reset
|
|
23835
23787
|
};
|
|
23836
23788
|
}
|
|
23789
|
+
const mapKompanyOrganizationTypeToCompanyType = (organizationType) => {
|
|
23790
|
+
const organizationTypeValue = organizationType == null ? void 0 : organizationType.toLowerCase();
|
|
23791
|
+
switch (organizationTypeValue) {
|
|
23792
|
+
case "business":
|
|
23793
|
+
return CompanyTypesValue.PRIVATE_COMPANY;
|
|
23794
|
+
default:
|
|
23795
|
+
return void 0;
|
|
23796
|
+
}
|
|
23797
|
+
};
|
|
23837
23798
|
const mapCompanyDataResponseToFormSchema = (company2) => ({
|
|
23838
23799
|
companyBasics: {
|
|
23839
23800
|
country: company2.country,
|
|
@@ -23848,8 +23809,11 @@ const mapCompanyDataResponseToFormSchema = (company2) => ({
|
|
|
23848
23809
|
postalCode: company2.zipcode
|
|
23849
23810
|
}
|
|
23850
23811
|
},
|
|
23812
|
+
companyStructure: {
|
|
23813
|
+
entityType: mapKompanyOrganizationTypeToCompanyType(company2.organizationType)
|
|
23814
|
+
},
|
|
23851
23815
|
companyOtherDetails: {
|
|
23852
|
-
|
|
23816
|
+
registrationNumber: company2.registrationNumber
|
|
23853
23817
|
}
|
|
23854
23818
|
});
|
|
23855
23819
|
const CompanyLookupResultsHeader = ({
|
|
@@ -23971,13 +23935,17 @@ const LookupResult = ({
|
|
|
23971
23935
|
return "verified";
|
|
23972
23936
|
}
|
|
23973
23937
|
}, [status, isError]);
|
|
23974
|
-
const selectAndVerify = (companyTin, company2) => {
|
|
23975
|
-
|
|
23976
|
-
|
|
23977
|
-
|
|
23978
|
-
|
|
23938
|
+
const selectAndVerify = async (companyTin, company2) => {
|
|
23939
|
+
try {
|
|
23940
|
+
await onSelect(companyTin, company2);
|
|
23941
|
+
} finally {
|
|
23942
|
+
if (ref.current) {
|
|
23943
|
+
ref.current.scrollIntoView({
|
|
23944
|
+
behavior: "smooth",
|
|
23945
|
+
block: "center"
|
|
23946
|
+
});
|
|
23947
|
+
}
|
|
23979
23948
|
}
|
|
23980
|
-
return onSelect(companyTin, company2);
|
|
23981
23949
|
};
|
|
23982
23950
|
if (isSelected && verifiedCompany) {
|
|
23983
23951
|
return jsxs("div", {
|
|
@@ -24047,9 +24015,17 @@ const CompanyLookupResultsList = ({
|
|
|
24047
24015
|
}
|
|
24048
24016
|
return "adyen-company-lookup-results-list__result-option";
|
|
24049
24017
|
};
|
|
24018
|
+
const resultsList = useMemo(() => {
|
|
24019
|
+
if (verifiedCompany) {
|
|
24020
|
+
const filtered = results.filter((option) => option.id !== verifiedCompany.id);
|
|
24021
|
+
const verified2 = results.find((option) => option.id === verifiedCompany.id);
|
|
24022
|
+
return verified2 ? [verified2, ...filtered] : results;
|
|
24023
|
+
}
|
|
24024
|
+
return results;
|
|
24025
|
+
}, [verifiedCompany, results]);
|
|
24050
24026
|
return jsx("div", {
|
|
24051
24027
|
className: "adyen-company-lookup-results-list",
|
|
24052
|
-
children:
|
|
24028
|
+
children: resultsList.map((option) => jsx("div", {
|
|
24053
24029
|
children: jsx(LookupResult, {
|
|
24054
24030
|
classes: optionClasses(option),
|
|
24055
24031
|
option,
|
|
@@ -24091,6 +24067,7 @@ function CompanyLookup({
|
|
|
24091
24067
|
taxInformationNumber: taxInformationNumber2,
|
|
24092
24068
|
setLoading,
|
|
24093
24069
|
setKompanyAddress,
|
|
24070
|
+
setKompanyVerifiedData,
|
|
24094
24071
|
handleChangeFor,
|
|
24095
24072
|
handleCompanyIndexSearch,
|
|
24096
24073
|
handleCompanyDeepSearch,
|
|
@@ -24118,6 +24095,7 @@ function CompanyLookup({
|
|
|
24118
24095
|
stateOrProvince: stateOrProvince2,
|
|
24119
24096
|
taxIdentificationNumber: taxInformationNumber2,
|
|
24120
24097
|
canVerify,
|
|
24098
|
+
setKompanyAddress,
|
|
24121
24099
|
handleChangeFor,
|
|
24122
24100
|
handleCompanyIndexSearch,
|
|
24123
24101
|
handleCompanyDeepSearch,
|
|
@@ -24131,11 +24109,14 @@ function CompanyLookup({
|
|
|
24131
24109
|
const companyLookupClasses = status === "idle" || !canVerify ? "adyen-kyc-company-lookup adyen-kyc-company-lookup--hidden" : "adyen-kyc-company-lookup";
|
|
24132
24110
|
const mappedData = useMemo$1(() => {
|
|
24133
24111
|
if (verifiedCompany) {
|
|
24112
|
+
const verifiedData = mapCompanyDataResponseToFormSchema(verifiedCompany);
|
|
24134
24113
|
setKompanyAddress(verifiedCompany.address);
|
|
24135
|
-
|
|
24114
|
+
setKompanyVerifiedData(verifiedData);
|
|
24115
|
+
return verifiedData;
|
|
24136
24116
|
}
|
|
24117
|
+
setKompanyVerifiedData(void 0);
|
|
24137
24118
|
setKompanyAddress(void 0);
|
|
24138
|
-
}, [setKompanyAddress, verifiedCompany]);
|
|
24119
|
+
}, [setKompanyAddress, setKompanyVerifiedData, verifiedCompany]);
|
|
24139
24120
|
useEffect$1(() => {
|
|
24140
24121
|
if (mappedData == null ? void 0 : mappedData.companyBasics) {
|
|
24141
24122
|
entriesOf(mappedData.companyBasics).forEach(([field, data]) => {
|
|
@@ -24171,13 +24152,36 @@ function CompanyLookup({
|
|
|
24171
24152
|
});
|
|
24172
24153
|
}
|
|
24173
24154
|
const CompanyLookupComponent = memo(CompanyLookup, (prevProps, nextProps) => objectsDeepEqual(prevProps.defaultData, nextProps.defaultData) && prevProps.canVerify === nextProps.canVerify && prevProps.legalCompanyName === nextProps.legalCompanyName && prevProps.country === nextProps.country && prevProps.stateOrProvince === nextProps.stateOrProvince && prevProps.taxInformationNumber === nextProps.taxInformationNumber && prevProps.setLoading === nextProps.setLoading && prevProps.setKompanyAddress === nextProps.setKompanyAddress && prevProps.handleCompanyIndexSearch === nextProps.handleCompanyIndexSearch && prevProps.handleCompanyDeepSearch === nextProps.handleCompanyDeepSearch && prevProps.handleGetCompanyDataset === nextProps.handleGetCompanyDataset && prevProps.handleRefreshCompanyDataset === nextProps.handleRefreshCompanyDataset && prevProps.handleVerifyTin === nextProps.handleVerifyTin);
|
|
24155
|
+
const CountryFieldValidation = () => ({
|
|
24156
|
+
country: {
|
|
24157
|
+
modes: ["blur"],
|
|
24158
|
+
validate: (country2) => !isEmpty(country2),
|
|
24159
|
+
errorMessage: "fieldIsRequired"
|
|
24160
|
+
}
|
|
24161
|
+
});
|
|
24162
|
+
const LegalCompanyNameFieldValidation = () => ({
|
|
24163
|
+
legalCompanyName: {
|
|
24164
|
+
modes: ["blur"],
|
|
24165
|
+
validate: (legalCompanyName2) => !isEmpty(legalCompanyName2),
|
|
24166
|
+
errorMessage: "fieldIsRequired"
|
|
24167
|
+
}
|
|
24168
|
+
});
|
|
24169
|
+
const StateFieldValidation = () => ({
|
|
24170
|
+
stateOrProvince: {
|
|
24171
|
+
modes: ["blur"],
|
|
24172
|
+
validate: (stateOrProvince2) => !isEmpty(stateOrProvince2),
|
|
24173
|
+
errorMessage: "fieldIsRequired"
|
|
24174
|
+
}
|
|
24175
|
+
});
|
|
24174
24176
|
const TAX_INFORMATION_FIELD = ["taxInformation", "exemptedFromTax", "isUen"];
|
|
24175
24177
|
function TaxInformationField({
|
|
24176
24178
|
data,
|
|
24177
24179
|
valid,
|
|
24178
24180
|
errors,
|
|
24179
24181
|
labels: labels2,
|
|
24180
|
-
|
|
24182
|
+
mask,
|
|
24183
|
+
guidanceText,
|
|
24184
|
+
placeholders,
|
|
24181
24185
|
readonly,
|
|
24182
24186
|
handleChangeFor,
|
|
24183
24187
|
country: country2,
|
|
@@ -24187,11 +24191,7 @@ function TaxInformationField({
|
|
|
24187
24191
|
var _a;
|
|
24188
24192
|
return (_a = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === country2);
|
|
24189
24193
|
}, [data, country2]);
|
|
24190
|
-
const handleTaxInformationInput = (
|
|
24191
|
-
var _a;
|
|
24192
|
-
const {
|
|
24193
|
-
value
|
|
24194
|
-
} = e.target;
|
|
24194
|
+
const handleTaxInformationInput = (value) => {
|
|
24195
24195
|
if (!data.taxInformation) {
|
|
24196
24196
|
const updatedTaxInformation2 = [{
|
|
24197
24197
|
country: country2,
|
|
@@ -24200,7 +24200,12 @@ function TaxInformationField({
|
|
|
24200
24200
|
}];
|
|
24201
24201
|
return handleChangeFor("taxInformation", "input")(updatedTaxInformation2);
|
|
24202
24202
|
}
|
|
24203
|
-
const
|
|
24203
|
+
const taxInformation = currentCountryTaxInformation ? data.taxInformation : [...data.taxInformation, {
|
|
24204
|
+
country: country2,
|
|
24205
|
+
number: value,
|
|
24206
|
+
type: countryToTaxInfoTypeMap[country2]
|
|
24207
|
+
}];
|
|
24208
|
+
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
24204
24209
|
if (taxInfo.country !== country2)
|
|
24205
24210
|
return taxInfo;
|
|
24206
24211
|
return {
|
|
@@ -24212,7 +24217,6 @@ function TaxInformationField({
|
|
|
24212
24217
|
return handleChangeFor("taxInformation", "input")(updatedTaxInformation);
|
|
24213
24218
|
};
|
|
24214
24219
|
const handleTaxInformationBlur = (e) => {
|
|
24215
|
-
var _a;
|
|
24216
24220
|
const {
|
|
24217
24221
|
value
|
|
24218
24222
|
} = e.target;
|
|
@@ -24224,7 +24228,12 @@ function TaxInformationField({
|
|
|
24224
24228
|
}];
|
|
24225
24229
|
return handleChangeFor("taxInformation", "blur")(updatedTaxInformation2);
|
|
24226
24230
|
}
|
|
24227
|
-
const
|
|
24231
|
+
const taxInformation = currentCountryTaxInformation ? data.taxInformation : [...data.taxInformation, {
|
|
24232
|
+
country: country2,
|
|
24233
|
+
number: value,
|
|
24234
|
+
type: countryToTaxInfoTypeMap[country2]
|
|
24235
|
+
}];
|
|
24236
|
+
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
24228
24237
|
if (taxInfo.country !== country2)
|
|
24229
24238
|
return taxInfo;
|
|
24230
24239
|
return {
|
|
@@ -24236,23 +24245,22 @@ function TaxInformationField({
|
|
|
24236
24245
|
return handleChangeFor("taxInformation", "blur")(updatedTaxInformation);
|
|
24237
24246
|
};
|
|
24238
24247
|
return jsxs(Fragment, {
|
|
24239
|
-
children: [jsx(
|
|
24240
|
-
name: "
|
|
24241
|
-
label: labels2.taxInformation,
|
|
24242
|
-
|
|
24248
|
+
children: [jsx(MaskedInputText, {
|
|
24249
|
+
name: "taxInformationNumber",
|
|
24250
|
+
label: labels2.taxInformation ?? "",
|
|
24251
|
+
formatGuidance: (guidanceText == null ? void 0 : guidanceText.taxInformation) ?? "",
|
|
24252
|
+
value: (currentCountryTaxInformation == null ? void 0 : currentCountryTaxInformation.number) ?? "",
|
|
24243
24253
|
errorMessage: errors.taxInformation,
|
|
24244
|
-
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
|
|
24250
|
-
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
|
|
24254
|
-
readonly
|
|
24255
|
-
})
|
|
24254
|
+
placeholder: placeholders == null ? void 0 : placeholders.taxInformation,
|
|
24255
|
+
isValid: Boolean(valid.taxInformation),
|
|
24256
|
+
"aria-required": true,
|
|
24257
|
+
"aria-label": labels2.taxInformation,
|
|
24258
|
+
"aria-invalid": !valid.taxInformation,
|
|
24259
|
+
onInput: handleTaxInformationInput,
|
|
24260
|
+
onBlur: handleTaxInformationBlur,
|
|
24261
|
+
disabled: data.exemptedFromTax,
|
|
24262
|
+
readonly,
|
|
24263
|
+
...mask
|
|
24256
24264
|
}), canExempt && jsx(Checkbox, {
|
|
24257
24265
|
"aria-required": false,
|
|
24258
24266
|
"aria-label": labels2.exemptedFromTax,
|
|
@@ -24266,116 +24274,37 @@ function TaxInformationField({
|
|
|
24266
24274
|
})]
|
|
24267
24275
|
});
|
|
24268
24276
|
}
|
|
24269
|
-
const
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
errorMessage: "fieldIsRequired"
|
|
24274
|
-
}, {
|
|
24275
|
-
modes: ["blur"],
|
|
24276
|
-
validate: (dateOfIncorporation2) => dateOfIncorporation2 ? new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date() : false,
|
|
24277
|
-
errorMessage: "invalidDateOfIncorporation"
|
|
24278
|
-
}]
|
|
24279
|
-
});
|
|
24280
|
-
const StockExchangeMICFieldValidation = () => ({
|
|
24281
|
-
stockExchangeMIC: [{
|
|
24282
|
-
modes: ["blur"],
|
|
24283
|
-
validate: (stockExchangeMIC2) => !isEmpty(stockExchangeMIC2),
|
|
24284
|
-
errorMessage: "fieldIsRequired"
|
|
24285
|
-
}]
|
|
24286
|
-
});
|
|
24287
|
-
const StockISINFieldValidation = () => ({
|
|
24288
|
-
stockISIN: [{
|
|
24289
|
-
modes: ["blur"],
|
|
24290
|
-
validate: (stockISIN2) => !isEmpty(stockISIN2),
|
|
24291
|
-
errorMessage: "fieldIsRequired"
|
|
24292
|
-
}, {
|
|
24293
|
-
modes: ["blur"],
|
|
24294
|
-
validate: (input) => exactLength(input, 12),
|
|
24295
|
-
errorMessage: "validationPleaseEnterAValidStockISIN"
|
|
24296
|
-
}]
|
|
24297
|
-
});
|
|
24298
|
-
const TradingNameFieldValidation = () => ({
|
|
24299
|
-
tradingName: [{
|
|
24300
|
-
modes: ["blur"],
|
|
24301
|
-
validate: (tradingName2) => !isEmpty(tradingName2),
|
|
24302
|
-
errorMessage: "fieldIsRequired"
|
|
24303
|
-
}]
|
|
24304
|
-
});
|
|
24305
|
-
const BusinessRegistrationNumberValidation = (country2, companyType2, registrationNumberType) => {
|
|
24306
|
-
const metadata = resolveFieldMetadata(defaultFieldConfig$2[country2], {
|
|
24307
|
-
companyType: companyType2,
|
|
24308
|
-
registrationNumberType
|
|
24309
|
-
}, defaultFieldMetadata$2);
|
|
24310
|
-
return {
|
|
24311
|
-
businessRegistrationNumber: metadata.validators
|
|
24312
|
-
};
|
|
24313
|
-
};
|
|
24314
|
-
const TaxInformationFieldValidation = (country2, taxIdNumberType) => {
|
|
24315
|
-
const metadata = resolveFieldMetadata(defaultFieldConfig$1[country2], {
|
|
24277
|
+
const defaultFieldMetadata = defaultFieldMetadata$2;
|
|
24278
|
+
const defaultFieldConfig = entriesOf(defaultFieldConfig$2).reduce((fieldConfig, [country2, countryEntry]) => ({
|
|
24279
|
+
...fieldConfig,
|
|
24280
|
+
[country2]: ({
|
|
24316
24281
|
taxIdNumberType
|
|
24317
|
-
}
|
|
24318
|
-
|
|
24319
|
-
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
24323
|
-
modes: ["blur"],
|
|
24324
|
-
validate: (taxInfos) => (taxInfos == null ? void 0 : taxInfos.every((taxInfo) => validator.validate(taxInfo.number))) ?? false,
|
|
24325
|
-
errorMessage: metadata.helperText
|
|
24326
|
-
}))
|
|
24327
|
-
};
|
|
24328
|
-
};
|
|
24329
|
-
const VatNumberFieldValidation = (country2, vatNumberType) => {
|
|
24330
|
-
const metadata = resolveFieldMetadata(defaultFieldConfig[country2], {
|
|
24331
|
-
vatNumberType
|
|
24332
|
-
}, defaultFieldMetadata);
|
|
24333
|
-
if (!metadata.validators)
|
|
24334
|
-
return {};
|
|
24335
|
-
const validators = Array.isArray(metadata.validators) ? metadata.validators : [metadata.validators];
|
|
24336
|
-
return {
|
|
24337
|
-
vatNumber: validators.map((validator) => ({
|
|
24282
|
+
}) => {
|
|
24283
|
+
const fieldMetadata = resolveFieldMetadata(countryEntry, {
|
|
24284
|
+
taxIdNumberType
|
|
24285
|
+
}, defaultFieldMetadata$2);
|
|
24286
|
+
const taxIdValidators = fieldMetadata.validators ? Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators] : [];
|
|
24287
|
+
const mappedValidators = taxIdValidators.map((validator) => ({
|
|
24338
24288
|
...validator,
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24350
|
-
|
|
24351
|
-
});
|
|
24352
|
-
|
|
24353
|
-
|
|
24354
|
-
|
|
24355
|
-
|
|
24356
|
-
errorMessage: "fieldIsRequired"
|
|
24357
|
-
}
|
|
24358
|
-
});
|
|
24359
|
-
const LegalCompanyNameFieldValidation = () => ({
|
|
24360
|
-
legalCompanyName: {
|
|
24361
|
-
modes: ["blur"],
|
|
24362
|
-
validate: (legalCompanyName2) => !isEmpty(legalCompanyName2),
|
|
24363
|
-
errorMessage: "fieldIsRequired"
|
|
24364
|
-
}
|
|
24365
|
-
});
|
|
24366
|
-
const StateFieldValidation = () => ({
|
|
24367
|
-
stateOrProvince: {
|
|
24368
|
-
modes: ["blur"],
|
|
24369
|
-
validate: (stateOrProvince2) => !isEmpty(stateOrProvince2),
|
|
24370
|
-
errorMessage: "fieldIsRequired"
|
|
24289
|
+
validate: (taxInformation) => {
|
|
24290
|
+
var _a;
|
|
24291
|
+
const taxIdNumber2 = (_a = taxInformation == null ? void 0 : taxInformation.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _a.number;
|
|
24292
|
+
return taxIdNumber2 ? validator.validate(taxIdNumber2) : false;
|
|
24293
|
+
},
|
|
24294
|
+
errorMessage: (taxInformation) => {
|
|
24295
|
+
var _a;
|
|
24296
|
+
const taxIdNumber2 = (_a = taxInformation == null ? void 0 : taxInformation.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _a.number;
|
|
24297
|
+
if (!taxIdNumber2)
|
|
24298
|
+
return void 0;
|
|
24299
|
+
return typeof validator.errorMessage === "function" ? validator.errorMessage(taxIdNumber2) : validator.errorMessage;
|
|
24300
|
+
}
|
|
24301
|
+
}));
|
|
24302
|
+
return {
|
|
24303
|
+
...fieldMetadata,
|
|
24304
|
+
validators: mappedValidators
|
|
24305
|
+
};
|
|
24371
24306
|
}
|
|
24372
|
-
});
|
|
24373
|
-
const CompanyBasicsValidationRules = (country2) => ({
|
|
24374
|
-
...LegalCompanyNameFieldValidation(),
|
|
24375
|
-
...CountryFieldValidation(),
|
|
24376
|
-
...StateFieldValidation(),
|
|
24377
|
-
...TaxInformationFieldValidation(country2)
|
|
24378
|
-
});
|
|
24307
|
+
}), {});
|
|
24379
24308
|
const COMPANY_BASICS_FORM_ID = "companyBasics";
|
|
24380
24309
|
const companyBasicsFields = [...LEGAL_COMPANY_NAME_FIELD, ...COUNTRY_FIELD, ...STATE_FIELD, ...TAX_INFORMATION_FIELD];
|
|
24381
24310
|
function CompanyBasics({
|
|
@@ -24398,8 +24327,11 @@ function CompanyBasics({
|
|
|
24398
24327
|
handleGetCompanyDataset,
|
|
24399
24328
|
handleRefreshCompanyDataset,
|
|
24400
24329
|
handleVerifyTin,
|
|
24330
|
+
country: country2,
|
|
24331
|
+
isTopLevelEntity,
|
|
24401
24332
|
kompanyAddress,
|
|
24402
|
-
setKompanyAddress
|
|
24333
|
+
setKompanyAddress,
|
|
24334
|
+
setKompanyVerifiedData
|
|
24403
24335
|
}) {
|
|
24404
24336
|
var _a, _b;
|
|
24405
24337
|
const {
|
|
@@ -24409,12 +24341,59 @@ function CompanyBasics({
|
|
|
24409
24341
|
isSettingEnabled
|
|
24410
24342
|
} = useSettingsContext();
|
|
24411
24343
|
const {
|
|
24412
|
-
sliceData,
|
|
24413
24344
|
updateStateSlice
|
|
24414
24345
|
} = useGlobalDataSlice(COMPANY_BASICS_FORM_ID);
|
|
24415
|
-
const schema = (requiredFields == null ? void 0 : requiredFields.length) ? requiredFields : ["legalCompanyName", "country"];
|
|
24416
|
-
const validationRules = CompanyBasicsValidationRules((sliceData == null ? void 0 : sliceData.country) ?? (data == null ? void 0 : data.country));
|
|
24417
24346
|
const [loading2, setLoading] = useState$1(false);
|
|
24347
|
+
const allowedCountries = useAllowedCountries();
|
|
24348
|
+
const initialFormUtilsProps = useMemo$1(() => ({
|
|
24349
|
+
labels: labels2,
|
|
24350
|
+
placeholders,
|
|
24351
|
+
helperText,
|
|
24352
|
+
readOnly,
|
|
24353
|
+
requiredFields,
|
|
24354
|
+
readOnlyFields,
|
|
24355
|
+
optionalFields,
|
|
24356
|
+
maskedFields,
|
|
24357
|
+
shouldValidate
|
|
24358
|
+
}), [helperText, labels2, maskedFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
24359
|
+
const mergedFieldProps = useMemo$1(() => {
|
|
24360
|
+
var _a2;
|
|
24361
|
+
return (_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.reduce((acc, field) => {
|
|
24362
|
+
switch (field) {
|
|
24363
|
+
case "legalCompanyName":
|
|
24364
|
+
return {
|
|
24365
|
+
...acc,
|
|
24366
|
+
validators: {
|
|
24367
|
+
...acc.validators,
|
|
24368
|
+
...LegalCompanyNameFieldValidation()
|
|
24369
|
+
}
|
|
24370
|
+
};
|
|
24371
|
+
case "country":
|
|
24372
|
+
return {
|
|
24373
|
+
...acc,
|
|
24374
|
+
validators: {
|
|
24375
|
+
...acc.validators,
|
|
24376
|
+
...CountryFieldValidation()
|
|
24377
|
+
}
|
|
24378
|
+
};
|
|
24379
|
+
case "stateOrProvince":
|
|
24380
|
+
return {
|
|
24381
|
+
...acc,
|
|
24382
|
+
validators: {
|
|
24383
|
+
...acc.validators,
|
|
24384
|
+
...StateFieldValidation()
|
|
24385
|
+
}
|
|
24386
|
+
};
|
|
24387
|
+
case "taxInformation":
|
|
24388
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
|
|
24389
|
+
taxIdNumberType: countryToTaxInfoTypeMap[country2]
|
|
24390
|
+
}, defaultFieldMetadata), acc);
|
|
24391
|
+
default:
|
|
24392
|
+
return acc;
|
|
24393
|
+
}
|
|
24394
|
+
}, initialFormUtilsProps);
|
|
24395
|
+
}, [country2, initialFormUtilsProps]);
|
|
24396
|
+
const schema = (requiredFields == null ? void 0 : requiredFields.length) ? requiredFields : ["legalCompanyName", "country"];
|
|
24418
24397
|
const {
|
|
24419
24398
|
schema: formSchema,
|
|
24420
24399
|
data: formData,
|
|
@@ -24426,35 +24405,17 @@ function CompanyBasics({
|
|
|
24426
24405
|
} = useForm({
|
|
24427
24406
|
schema,
|
|
24428
24407
|
defaultData: data,
|
|
24429
|
-
rules:
|
|
24408
|
+
rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
|
|
24409
|
+
optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
|
|
24410
|
+
maskedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.maskedFields,
|
|
24430
24411
|
fieldProblems: fieldValidationErrors,
|
|
24431
|
-
optionalFields,
|
|
24432
|
-
maskedFields,
|
|
24433
24412
|
shouldValidate
|
|
24434
24413
|
});
|
|
24435
24414
|
const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
|
|
24436
|
-
const formUtils = formUtilities(
|
|
24437
|
-
labels: labels2,
|
|
24438
|
-
placeholders,
|
|
24439
|
-
helperText,
|
|
24440
|
-
readOnly,
|
|
24441
|
-
requiredFields,
|
|
24442
|
-
readOnlyFields,
|
|
24443
|
-
optionalFields
|
|
24444
|
-
}, i18n);
|
|
24415
|
+
const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
|
|
24445
24416
|
const hasCompanySearchProvider = formData.country && COUNTRIES_WITH_IN_APP_SEARCH_COMPANY_VERIFICATION.includes(formData.country);
|
|
24446
24417
|
const currentCountryTaxIdNumber = (_b = (_a = formData.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === formData.country)) == null ? void 0 : _b.number;
|
|
24447
|
-
const
|
|
24448
|
-
legalCompanyNameDisabled,
|
|
24449
|
-
countryDisabled,
|
|
24450
|
-
stateOrProvinceDisabled,
|
|
24451
|
-
taxInformationDisabled
|
|
24452
|
-
} = useMemo$1(() => ({
|
|
24453
|
-
legalCompanyNameDisabled: formUtils.isReadOnly("legalCompanyName") || Boolean(kompanyAddress) || loading2,
|
|
24454
|
-
countryDisabled: !isAllowedEditPrefilledCountry || formUtils.isReadOnly("country") || Boolean(kompanyAddress) || loading2,
|
|
24455
|
-
stateOrProvinceDisabled: formUtils.isReadOnly("stateOrProvince") || Boolean(kompanyAddress) || loading2,
|
|
24456
|
-
taxInformationDisabled: formUtils.isReadOnly("taxInformation") || Boolean(kompanyAddress) || loading2
|
|
24457
|
-
}), [kompanyAddress, formUtils, isAllowedEditPrefilledCountry, loading2]);
|
|
24418
|
+
const disabled = (field) => formUtils.isReadOnly(field) || Boolean(kompanyAddress) || loading2;
|
|
24458
24419
|
useEffect$1(() => {
|
|
24459
24420
|
updateStateSlice({
|
|
24460
24421
|
schema: formSchema,
|
|
@@ -24485,7 +24446,7 @@ function CompanyBasics({
|
|
|
24485
24446
|
helperText: formUtils.getFieldHelperText(LEGAL_COMPANY_NAME_FIELD, {
|
|
24486
24447
|
legalCompanyName: "legalCompanyName__helperText"
|
|
24487
24448
|
}),
|
|
24488
|
-
readonly:
|
|
24449
|
+
readonly: disabled("legalCompanyName"),
|
|
24489
24450
|
handleChangeFor
|
|
24490
24451
|
})
|
|
24491
24452
|
}), formUtils.isRequiredField("country") && jsx("div", {
|
|
@@ -24495,8 +24456,9 @@ function CompanyBasics({
|
|
|
24495
24456
|
valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
|
|
24496
24457
|
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
|
|
24497
24458
|
labels: formUtils.getFieldLabels(COUNTRY_FIELD),
|
|
24498
|
-
readonly:
|
|
24499
|
-
handleChangeFor
|
|
24459
|
+
readonly: disabled("country") || !isAllowedEditPrefilledCountry,
|
|
24460
|
+
handleChangeFor,
|
|
24461
|
+
allowedCountries: isTopLevelEntity ? allowedCountries : void 0
|
|
24500
24462
|
})
|
|
24501
24463
|
}), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
|
|
24502
24464
|
className: "adyen-kyc-field-wrapper",
|
|
@@ -24505,7 +24467,7 @@ function CompanyBasics({
|
|
|
24505
24467
|
valid: formUtils.getFieldValid(formValid, STATE_FIELD),
|
|
24506
24468
|
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
|
|
24507
24469
|
labels: formUtils.getFieldLabels(STATE_FIELD),
|
|
24508
|
-
readonly:
|
|
24470
|
+
readonly: disabled("stateOrProvince"),
|
|
24509
24471
|
handleChangeFor,
|
|
24510
24472
|
selectedCountry: formData.country
|
|
24511
24473
|
})
|
|
@@ -24516,11 +24478,14 @@ function CompanyBasics({
|
|
|
24516
24478
|
valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
|
|
24517
24479
|
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
|
|
24518
24480
|
labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
|
|
24519
|
-
|
|
24481
|
+
mask: formUtils.getMask("taxInformation"),
|
|
24482
|
+
helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
|
|
24483
|
+
guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
|
|
24484
|
+
readonly: disabled("taxInformation"),
|
|
24520
24485
|
handleChangeFor,
|
|
24521
|
-
country: formData.country,
|
|
24522
24486
|
canExempt: formUtils.isRequiredField("exemptedFromTax"),
|
|
24523
|
-
isUen: formUtils.isRequiredField("isUen")
|
|
24487
|
+
isUen: formUtils.isRequiredField("isUen"),
|
|
24488
|
+
country: formData.country
|
|
24524
24489
|
})
|
|
24525
24490
|
}), hasCompanySearchProvider && jsx(CompanyLookupComponent, {
|
|
24526
24491
|
defaultData: data,
|
|
@@ -24532,6 +24497,7 @@ function CompanyBasics({
|
|
|
24532
24497
|
handleChangeFor,
|
|
24533
24498
|
setLoading,
|
|
24534
24499
|
setKompanyAddress,
|
|
24500
|
+
setKompanyVerifiedData,
|
|
24535
24501
|
handleCompanyIndexSearch,
|
|
24536
24502
|
handleCompanyDeepSearch,
|
|
24537
24503
|
handleGetCompanyDataset,
|
|
@@ -24543,54 +24509,52 @@ function CompanyBasics({
|
|
|
24543
24509
|
}
|
|
24544
24510
|
const CompanyBasicsComponent = memo(CompanyBasics, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.placeholders, nextProps.placeholders) && objectsDeepEqual(prevProps.helperText, nextProps.helperText) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.heading === nextProps.heading && prevProps.description === nextProps.description && prevProps.readOnly === nextProps.readOnly && prevProps.requiredFields === nextProps.requiredFields && prevProps.maskedFields === nextProps.maskedFields && prevProps.optionalFields === nextProps.optionalFields && prevProps.readOnlyFields === nextProps.readOnlyFields && prevProps.shouldValidate === nextProps.shouldValidate && prevProps.kompanyAddress === nextProps.kompanyAddress);
|
|
24545
24511
|
const CompanyOtherDetailsComponent$1 = "";
|
|
24546
|
-
const BUSINESS_REGISTRATION_NUMBER_FIELD = ["
|
|
24512
|
+
const BUSINESS_REGISTRATION_NUMBER_FIELD = ["registrationNumber", "exemptedFromRegistrationNumber"];
|
|
24547
24513
|
function BusinessRegistrationNumberField({
|
|
24548
24514
|
data,
|
|
24549
24515
|
valid,
|
|
24550
24516
|
errors,
|
|
24551
24517
|
labels: labels2,
|
|
24518
|
+
mask,
|
|
24519
|
+
guidanceText,
|
|
24552
24520
|
placeholders,
|
|
24553
|
-
helperText,
|
|
24554
24521
|
readonly,
|
|
24555
|
-
classNameModifiers,
|
|
24556
24522
|
canExempt,
|
|
24557
24523
|
handleChangeFor
|
|
24558
24524
|
}) {
|
|
24559
24525
|
return jsxs(Fragment, {
|
|
24560
|
-
children: [jsx(
|
|
24561
|
-
|
|
24562
|
-
label: labels2
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24566
|
-
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
|
|
24577
|
-
|
|
24578
|
-
|
|
24579
|
-
|
|
24580
|
-
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
"aria-
|
|
24584
|
-
"
|
|
24585
|
-
"
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
onChange: handleChangeFor("exemptedFromBusinessRegistrationNumber")
|
|
24593
|
-
})]
|
|
24526
|
+
children: [jsx(MaskedInputText, {
|
|
24527
|
+
"aria-required": true,
|
|
24528
|
+
"aria-label": labels2.registrationNumber,
|
|
24529
|
+
"aria-invalid": !valid.registrationNumber,
|
|
24530
|
+
classNameModifiers: {
|
|
24531
|
+
field: ["registrationNumber"],
|
|
24532
|
+
input: ["registrationNumber"]
|
|
24533
|
+
},
|
|
24534
|
+
name: "registrationNumber",
|
|
24535
|
+
value: (data == null ? void 0 : data.registrationNumber) ?? "",
|
|
24536
|
+
label: labels2.registrationNumber ?? "",
|
|
24537
|
+
formatGuidance: (guidanceText == null ? void 0 : guidanceText.registrationNumber) ?? "",
|
|
24538
|
+
placeholder: placeholders == null ? void 0 : placeholders.registrationNumber,
|
|
24539
|
+
errorMessage: errors.registrationNumber,
|
|
24540
|
+
isValid: Boolean(valid.registrationNumber),
|
|
24541
|
+
onInput: handleChangeFor("registrationNumber", "input"),
|
|
24542
|
+
onBlur: handleChangeFor("registrationNumber", "blur"),
|
|
24543
|
+
disabled: data.exemptedFromRegistrationNumber,
|
|
24544
|
+
readonly,
|
|
24545
|
+
...mask
|
|
24546
|
+
}), canExempt && jsx(Checkbox, {
|
|
24547
|
+
"aria-required": false,
|
|
24548
|
+
"aria-label": labels2 == null ? void 0 : labels2.exemptedFromRegistrationNumber,
|
|
24549
|
+
"aria-invalid": false,
|
|
24550
|
+
name: "exemptedFromRegistrationNumber",
|
|
24551
|
+
value: "exemptedFromRegistrationNumber",
|
|
24552
|
+
checked: Boolean(data.exemptedFromRegistrationNumber),
|
|
24553
|
+
label: labels2 == null ? void 0 : labels2.exemptedFromRegistrationNumber,
|
|
24554
|
+
readonly,
|
|
24555
|
+
classNameModifiers: ["exempted-from-registration"],
|
|
24556
|
+
onChange: handleChangeFor("exemptedFromRegistrationNumber")
|
|
24557
|
+
})]
|
|
24594
24558
|
});
|
|
24595
24559
|
}
|
|
24596
24560
|
const DATE_OF_INCORPORATION_FIELD = ["dateOfIncorporation"];
|
|
@@ -24624,6 +24588,17 @@ function DateOfIncorporationField({
|
|
|
24624
24588
|
})
|
|
24625
24589
|
});
|
|
24626
24590
|
}
|
|
24591
|
+
const DateOfIncorporationFieldValidation = () => ({
|
|
24592
|
+
dateOfIncorporation: [{
|
|
24593
|
+
modes: ["blur"],
|
|
24594
|
+
validate: (dateOfIncorporation2) => !isEmpty(dateOfIncorporation2),
|
|
24595
|
+
errorMessage: "fieldIsRequired"
|
|
24596
|
+
}, {
|
|
24597
|
+
modes: ["blur"],
|
|
24598
|
+
validate: (dateOfIncorporation2) => dateOfIncorporation2 ? new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date() : false,
|
|
24599
|
+
errorMessage: "invalidDateOfIncorporation"
|
|
24600
|
+
}]
|
|
24601
|
+
});
|
|
24627
24602
|
const STOCK_EXCHANGE_MIC_FIELD = ["stockExchangeMIC"];
|
|
24628
24603
|
function StockExchangeMICField({
|
|
24629
24604
|
data,
|
|
@@ -24657,6 +24632,13 @@ function StockExchangeMICField({
|
|
|
24657
24632
|
})
|
|
24658
24633
|
});
|
|
24659
24634
|
}
|
|
24635
|
+
const StockExchangeMICFieldValidation = () => ({
|
|
24636
|
+
stockExchangeMIC: [{
|
|
24637
|
+
modes: ["blur"],
|
|
24638
|
+
validate: (stockExchangeMIC2) => !isEmpty(stockExchangeMIC2),
|
|
24639
|
+
errorMessage: "fieldIsRequired"
|
|
24640
|
+
}]
|
|
24641
|
+
});
|
|
24660
24642
|
const STOCK_ISIN_FIELD = ["stockISIN"];
|
|
24661
24643
|
function StockISINField({
|
|
24662
24644
|
data,
|
|
@@ -24690,6 +24672,17 @@ function StockISINField({
|
|
|
24690
24672
|
})
|
|
24691
24673
|
});
|
|
24692
24674
|
}
|
|
24675
|
+
const StockISINFieldValidation = () => ({
|
|
24676
|
+
stockISIN: [{
|
|
24677
|
+
modes: ["blur"],
|
|
24678
|
+
validate: (stockISIN2) => !isEmpty(stockISIN2),
|
|
24679
|
+
errorMessage: "fieldIsRequired"
|
|
24680
|
+
}, {
|
|
24681
|
+
modes: ["blur"],
|
|
24682
|
+
validate: (input) => exactLength(input, 12),
|
|
24683
|
+
errorMessage: "validationPleaseEnterAValidStockISIN"
|
|
24684
|
+
}]
|
|
24685
|
+
});
|
|
24693
24686
|
const TRADING_NAME_FIELD = ["tradingName", "sameNameAsLegalName"];
|
|
24694
24687
|
function TradingNameField({
|
|
24695
24688
|
data,
|
|
@@ -24741,12 +24734,21 @@ function TradingNameField({
|
|
|
24741
24734
|
})]
|
|
24742
24735
|
});
|
|
24743
24736
|
}
|
|
24737
|
+
const TradingNameFieldValidation = () => ({
|
|
24738
|
+
tradingName: [{
|
|
24739
|
+
modes: ["blur"],
|
|
24740
|
+
validate: (tradingName2) => !isEmpty(tradingName2),
|
|
24741
|
+
errorMessage: "fieldIsRequired"
|
|
24742
|
+
}]
|
|
24743
|
+
});
|
|
24744
24744
|
const VAT_NUMBER_FIELD = ["vatNumber", "exemptedFromVat", "vatAbsenceReason"];
|
|
24745
24745
|
function VatNumberField({
|
|
24746
24746
|
data,
|
|
24747
24747
|
valid,
|
|
24748
24748
|
errors,
|
|
24749
24749
|
labels: labels2,
|
|
24750
|
+
mask,
|
|
24751
|
+
guidanceText,
|
|
24750
24752
|
placeholders,
|
|
24751
24753
|
readonly,
|
|
24752
24754
|
handleChangeFor,
|
|
@@ -24756,25 +24758,26 @@ function VatNumberField({
|
|
|
24756
24758
|
i18n
|
|
24757
24759
|
} = useI18nContext();
|
|
24758
24760
|
return jsxs(Fragment, {
|
|
24759
|
-
children: [jsx(
|
|
24761
|
+
children: [jsx(MaskedInputText, {
|
|
24762
|
+
"aria-required": true,
|
|
24763
|
+
"aria-label": labels2.vatNumber,
|
|
24764
|
+
"aria-invalid": !valid.vatNumber,
|
|
24765
|
+
classNameModifiers: {
|
|
24766
|
+
field: ["tax-id"],
|
|
24767
|
+
input: ["vatNumber"]
|
|
24768
|
+
},
|
|
24760
24769
|
name: "vatNumber",
|
|
24761
|
-
|
|
24762
|
-
|
|
24770
|
+
value: (data == null ? void 0 : data.vatNumber) ?? "",
|
|
24771
|
+
label: labels2.vatNumber ?? "",
|
|
24772
|
+
formatGuidance: (guidanceText == null ? void 0 : guidanceText.vatNumber) ?? "",
|
|
24773
|
+
placeholder: placeholders == null ? void 0 : placeholders.vatNumber,
|
|
24763
24774
|
errorMessage: errors.vatNumber,
|
|
24764
|
-
isValid: valid.vatNumber,
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
name: "vatNumber",
|
|
24771
|
-
value: data.vatNumber,
|
|
24772
|
-
readonly,
|
|
24773
|
-
classNameModifiers: ["vatNumber"],
|
|
24774
|
-
onInput: handleChangeFor("vatNumber", "input"),
|
|
24775
|
-
onBlur: handleChangeFor("vatNumber", "blur"),
|
|
24776
|
-
disabled: data.exemptedFromVat
|
|
24777
|
-
})
|
|
24775
|
+
isValid: Boolean(valid.vatNumber),
|
|
24776
|
+
onInput: handleChangeFor("vatNumber", "input"),
|
|
24777
|
+
onBlur: handleChangeFor("vatNumber", "blur"),
|
|
24778
|
+
disabled: data.exemptedFromVat,
|
|
24779
|
+
readonly,
|
|
24780
|
+
...mask
|
|
24778
24781
|
}), canExempt && jsx(Checkbox, {
|
|
24779
24782
|
"aria-required": false,
|
|
24780
24783
|
"aria-label": labels2 == null ? void 0 : labels2.exemptedFromVat,
|
|
@@ -24824,43 +24827,119 @@ function CompanyOtherDetails({
|
|
|
24824
24827
|
readOnlyFields,
|
|
24825
24828
|
country: country2,
|
|
24826
24829
|
legalCompanyName: legalCompanyName2,
|
|
24827
|
-
companyType: companyType2
|
|
24830
|
+
companyType: companyType2,
|
|
24831
|
+
kompanyVerifiedData
|
|
24828
24832
|
}) {
|
|
24833
|
+
var _a, _b, _c, _d;
|
|
24829
24834
|
const {
|
|
24830
24835
|
i18n
|
|
24831
24836
|
} = useI18nContext();
|
|
24837
|
+
const {
|
|
24838
|
+
isExperimentEnabled
|
|
24839
|
+
} = useExperimentsContext();
|
|
24832
24840
|
const {
|
|
24833
24841
|
sliceData,
|
|
24834
24842
|
updateStateSlice
|
|
24835
24843
|
} = useGlobalDataSlice(COMPANY_OTHER_DETAILS_FORM_ID);
|
|
24844
|
+
const [registrationNumberType, setRegistrationNumberType] = useState$1((data == null ? void 0 : data.registrationNumber) ? inferCompanyRegistrationNumberType(data == null ? void 0 : data.registrationNumber, country2, companyType2) : (_a = companyRegistrationNumberOptions[country2]) == null ? void 0 : _a[0].id);
|
|
24845
|
+
const existingTaxIdentificationNumber = (data == null ? void 0 : data.vatNumber) ?? ((_c = (_b = data == null ? void 0 : data.taxInformation) == null ? void 0 : _b.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _c.number);
|
|
24846
|
+
const [taxIdentificationNumberType, setTaxIdentificationNumberType] = useState$1(existingTaxIdentificationNumber ? inferTaxIdNumberType(existingTaxIdentificationNumber, country2) : (_d = taxIdNumberOptions[country2]) == null ? void 0 : _d[0].id);
|
|
24847
|
+
const isTypeSelectorEnabled = isExperimentEnabled(ExperimentNames.EnableIdentityFieldTypeSelector);
|
|
24836
24848
|
const directChildFields = companyOtherDetailsFields.filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
|
|
24837
24849
|
const schema = useMemo$1(() => !(sliceData == null ? void 0 : sliceData.exemptedFromVat) ? (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatAbsenceReason")) ?? directChildFields : (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatNumber")) ?? directChildFields, [requiredFields, directChildFields, sliceData]);
|
|
24838
|
-
const
|
|
24850
|
+
const initialFormUtilsProps = useMemo$1(() => ({
|
|
24851
|
+
labels: labels2,
|
|
24852
|
+
placeholders,
|
|
24853
|
+
helperText,
|
|
24854
|
+
readOnly,
|
|
24855
|
+
requiredFields,
|
|
24856
|
+
readOnlyFields,
|
|
24857
|
+
optionalFields,
|
|
24858
|
+
maskedFields,
|
|
24859
|
+
shouldValidate
|
|
24860
|
+
}), [helperText, labels2, maskedFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
24861
|
+
const mergedFieldProps = useMemo$1(() => {
|
|
24862
|
+
var _a2;
|
|
24863
|
+
return (_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.reduce((acc, field) => {
|
|
24864
|
+
switch (field) {
|
|
24865
|
+
case "tradingName":
|
|
24866
|
+
return {
|
|
24867
|
+
...acc,
|
|
24868
|
+
validators: {
|
|
24869
|
+
...acc.validators,
|
|
24870
|
+
...TradingNameFieldValidation()
|
|
24871
|
+
}
|
|
24872
|
+
};
|
|
24873
|
+
case "dateOfIncorporation":
|
|
24874
|
+
return {
|
|
24875
|
+
...acc,
|
|
24876
|
+
validators: {
|
|
24877
|
+
...acc.validators,
|
|
24878
|
+
...DateOfIncorporationFieldValidation()
|
|
24879
|
+
}
|
|
24880
|
+
};
|
|
24881
|
+
case "stockExchangeMIC":
|
|
24882
|
+
return {
|
|
24883
|
+
...acc,
|
|
24884
|
+
validators: {
|
|
24885
|
+
...acc.validators,
|
|
24886
|
+
...StockExchangeMICFieldValidation()
|
|
24887
|
+
}
|
|
24888
|
+
};
|
|
24889
|
+
case "stockISIN":
|
|
24890
|
+
return {
|
|
24891
|
+
...acc,
|
|
24892
|
+
validators: {
|
|
24893
|
+
...acc.validators,
|
|
24894
|
+
...StockISINFieldValidation()
|
|
24895
|
+
}
|
|
24896
|
+
};
|
|
24897
|
+
case "registrationNumber":
|
|
24898
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$3[country2], {
|
|
24899
|
+
companyType: companyType2,
|
|
24900
|
+
registrationNumberType
|
|
24901
|
+
}, defaultFieldMetadata$3), acc);
|
|
24902
|
+
case "taxInformation":
|
|
24903
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
|
|
24904
|
+
taxIdNumberType: taxIdentificationNumberType
|
|
24905
|
+
}, defaultFieldMetadata), acc);
|
|
24906
|
+
case "vatNumber":
|
|
24907
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$1[country2], {
|
|
24908
|
+
vatNumberType: taxIdentificationNumberType
|
|
24909
|
+
}, defaultFieldMetadata$1), acc);
|
|
24910
|
+
default:
|
|
24911
|
+
return acc;
|
|
24912
|
+
}
|
|
24913
|
+
}, initialFormUtilsProps);
|
|
24914
|
+
}, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdentificationNumberType]);
|
|
24839
24915
|
const {
|
|
24840
24916
|
schema: formSchema,
|
|
24841
24917
|
data: formData,
|
|
24842
24918
|
errors: formErrors,
|
|
24843
24919
|
valid: formValid,
|
|
24844
24920
|
fieldProblems: formFieldProblems,
|
|
24845
|
-
handleChangeFor
|
|
24921
|
+
handleChangeFor,
|
|
24922
|
+
triggerValidation
|
|
24846
24923
|
} = useForm({
|
|
24847
24924
|
schema,
|
|
24848
24925
|
defaultData: data,
|
|
24849
|
-
rules:
|
|
24926
|
+
rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
|
|
24927
|
+
optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
|
|
24928
|
+
maskedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.maskedFields,
|
|
24850
24929
|
fieldProblems: fieldValidationErrors,
|
|
24851
|
-
optionalFields,
|
|
24852
|
-
maskedFields,
|
|
24853
24930
|
shouldValidate
|
|
24854
24931
|
});
|
|
24855
|
-
const formUtils = formUtilities(
|
|
24856
|
-
|
|
24857
|
-
|
|
24858
|
-
|
|
24859
|
-
|
|
24860
|
-
|
|
24861
|
-
|
|
24862
|
-
|
|
24863
|
-
},
|
|
24932
|
+
const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
|
|
24933
|
+
const handleBusinessRegistrationNumberTypeChange = useCallback$1((type) => {
|
|
24934
|
+
setRegistrationNumberType(type);
|
|
24935
|
+
triggerValidation(["registrationNumber"]);
|
|
24936
|
+
}, [triggerValidation]);
|
|
24937
|
+
const handleTaxIdentificationNumberTypeChange = useCallback$1((type) => {
|
|
24938
|
+
setTaxIdentificationNumberType(type);
|
|
24939
|
+
triggerValidation(["vatNumber", "taxInformation"]);
|
|
24940
|
+
}, [triggerValidation]);
|
|
24941
|
+
useEffect$1(() => {
|
|
24942
|
+
}, [kompanyVerifiedData]);
|
|
24864
24943
|
useEffect$1(() => {
|
|
24865
24944
|
updateStateSlice({
|
|
24866
24945
|
schema: formSchema,
|
|
@@ -24898,6 +24977,61 @@ function CompanyOtherDetails({
|
|
|
24898
24977
|
handleChangeFor,
|
|
24899
24978
|
legalCompanyName: legalCompanyName2
|
|
24900
24979
|
})
|
|
24980
|
+
}), isTypeSelectorEnabled && companyType2 && formUtils.isRequiredField("registrationNumber") && jsx(CompanyRegistrationNumberTypeSelector, {
|
|
24981
|
+
companyType: companyType2,
|
|
24982
|
+
country: country2,
|
|
24983
|
+
setSelected: handleBusinessRegistrationNumberTypeChange,
|
|
24984
|
+
selected: registrationNumberType
|
|
24985
|
+
}), formUtils.isRequiredField("registrationNumber") && jsx("div", {
|
|
24986
|
+
className: "adyen-kyc-field-wrapper",
|
|
24987
|
+
children: jsx(BusinessRegistrationNumberField, {
|
|
24988
|
+
data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24989
|
+
valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24990
|
+
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24991
|
+
labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24992
|
+
mask: formUtils.getMask("registrationNumber"),
|
|
24993
|
+
guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24994
|
+
placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24995
|
+
helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24996
|
+
readonly: formUtils.isReadOnly("registrationNumber"),
|
|
24997
|
+
handleChangeFor,
|
|
24998
|
+
canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber")
|
|
24999
|
+
})
|
|
25000
|
+
}), isTypeSelectorEnabled && formUtils.isRequiredField("vatNumber") && jsx(TaxIdNumberTypeSelector, {
|
|
25001
|
+
country: country2,
|
|
25002
|
+
setSelected: handleTaxIdentificationNumberTypeChange,
|
|
25003
|
+
selected: taxIdentificationNumberType
|
|
25004
|
+
}), formUtils.isRequiredField("vatNumber") && jsx("div", {
|
|
25005
|
+
className: "adyen-kyc-field-wrapper",
|
|
25006
|
+
children: jsx(VatNumberField, {
|
|
25007
|
+
data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
|
|
25008
|
+
valid: formUtils.getFieldValid(formValid, VAT_NUMBER_FIELD),
|
|
25009
|
+
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, VAT_NUMBER_FIELD),
|
|
25010
|
+
labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD),
|
|
25011
|
+
mask: formUtils.getMask("vatNumber"),
|
|
25012
|
+
guidanceText: formUtils.getFieldGuidanceText(VAT_NUMBER_FIELD),
|
|
25013
|
+
placeholders: formUtils.getFieldPlaceholders(VAT_NUMBER_FIELD),
|
|
25014
|
+
readonly: formUtils.isReadOnly("vatNumber"),
|
|
25015
|
+
handleChangeFor,
|
|
25016
|
+
country: country2,
|
|
25017
|
+
canExempt: formUtils.isRequiredField("exemptedFromVat")
|
|
25018
|
+
})
|
|
25019
|
+
}), formUtils.isRequiredField("taxInformation") && jsx("div", {
|
|
25020
|
+
className: "adyen-kyc-field-wrapper",
|
|
25021
|
+
children: jsx(TaxInformationField, {
|
|
25022
|
+
data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
|
|
25023
|
+
valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
|
|
25024
|
+
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
|
|
25025
|
+
labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
|
|
25026
|
+
mask: formUtils.getMask("taxInformation"),
|
|
25027
|
+
helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
|
|
25028
|
+
guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
|
|
25029
|
+
readonly: formUtils.isReadOnly("taxInformation"),
|
|
25030
|
+
handleChangeFor,
|
|
25031
|
+
country: country2,
|
|
25032
|
+
canExempt: formUtils.isRequiredField("exemptedFromTax"),
|
|
25033
|
+
isUen: formUtils.isRequiredField("isUen")
|
|
25034
|
+
})
|
|
24901
25035
|
}), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
|
|
24902
25036
|
className: "adyen-kyc-field-wrapper",
|
|
24903
25037
|
children: jsx(DateOfIncorporationField, {
|
|
@@ -24936,50 +25070,11 @@ function CompanyOtherDetails({
|
|
|
24936
25070
|
readonly: formUtils.isReadOnly("stockISIN"),
|
|
24937
25071
|
handleChangeFor
|
|
24938
25072
|
})
|
|
24939
|
-
}), formUtils.isRequiredField("businessRegistrationNumber") && jsx("div", {
|
|
24940
|
-
className: "adyen-kyc-field-wrapper",
|
|
24941
|
-
children: jsx(BusinessRegistrationNumberField, {
|
|
24942
|
-
data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24943
|
-
valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24944
|
-
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24945
|
-
labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24946
|
-
placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24947
|
-
helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
24948
|
-
readonly: formUtils.isReadOnly("businessRegistrationNumber"),
|
|
24949
|
-
handleChangeFor,
|
|
24950
|
-
canExempt: formUtils.isRequiredField("exemptedFromBusinessRegistrationNumber")
|
|
24951
|
-
})
|
|
24952
|
-
}), formUtils.isRequiredField("taxInformation") && jsx("div", {
|
|
24953
|
-
className: "adyen-kyc-field-wrapper",
|
|
24954
|
-
children: jsx(TaxInformationField, {
|
|
24955
|
-
data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
|
|
24956
|
-
valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
|
|
24957
|
-
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
|
|
24958
|
-
labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
|
|
24959
|
-
readonly: formUtils.isReadOnly("taxInformation"),
|
|
24960
|
-
handleChangeFor,
|
|
24961
|
-
country: country2,
|
|
24962
|
-
canExempt: formUtils.isRequiredField("exemptedFromTax"),
|
|
24963
|
-
isUen: formUtils.isRequiredField("isUen")
|
|
24964
|
-
})
|
|
24965
|
-
}), formUtils.isRequiredField("vatNumber") && jsx("div", {
|
|
24966
|
-
className: "adyen-kyc-field-wrapper",
|
|
24967
|
-
children: jsx(VatNumberField, {
|
|
24968
|
-
data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
|
|
24969
|
-
valid: formUtils.getFieldValid(formValid, VAT_NUMBER_FIELD),
|
|
24970
|
-
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, VAT_NUMBER_FIELD),
|
|
24971
|
-
labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD),
|
|
24972
|
-
placeholders: formUtils.getFieldPlaceholders(VAT_NUMBER_FIELD),
|
|
24973
|
-
readonly: formUtils.isReadOnly("vatNumber"),
|
|
24974
|
-
handleChangeFor,
|
|
24975
|
-
country: country2,
|
|
24976
|
-
canExempt: formUtils.isRequiredField("exemptedFromVat")
|
|
24977
|
-
})
|
|
24978
25073
|
})]
|
|
24979
25074
|
})]
|
|
24980
25075
|
});
|
|
24981
25076
|
}
|
|
24982
|
-
const CompanyOtherDetailsComponent = memo(CompanyOtherDetails, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.placeholders, nextProps.placeholders) && objectsDeepEqual(prevProps.helperText, nextProps.helperText) && objectsDeepEqual(prevProps.
|
|
25077
|
+
const CompanyOtherDetailsComponent = memo(CompanyOtherDetails, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.placeholders, nextProps.placeholders) && objectsDeepEqual(prevProps.helperText, nextProps.helperText) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.heading === nextProps.heading && prevProps.description === nextProps.description && prevProps.requiredFields === nextProps.requiredFields && prevProps.maskedFields === nextProps.maskedFields && prevProps.optionalFields === nextProps.optionalFields && prevProps.readOnlyFields === nextProps.readOnlyFields && prevProps.shouldValidate === nextProps.shouldValidate && prevProps.readOnly === nextProps.readOnly && prevProps.country === nextProps.country && prevProps.legalCompanyName === nextProps.legalCompanyName && prevProps.companyType === nextProps.companyType && prevProps.kompanyVerifiedData === nextProps.kompanyVerifiedData);
|
|
24983
25078
|
const CompanyStructureComponent$1 = "";
|
|
24984
25079
|
const CompanyStructureValidation = {
|
|
24985
25080
|
entityType: {
|
|
@@ -24997,7 +25092,8 @@ function CompanyStructure({
|
|
|
24997
25092
|
description: description2,
|
|
24998
25093
|
formVerificationErrors,
|
|
24999
25094
|
fieldValidationErrors,
|
|
25000
|
-
requiredFields
|
|
25095
|
+
requiredFields,
|
|
25096
|
+
kompanyVerifiedData
|
|
25001
25097
|
}) {
|
|
25002
25098
|
const {
|
|
25003
25099
|
i18n
|
|
@@ -25023,6 +25119,12 @@ function CompanyStructure({
|
|
|
25023
25119
|
labels: labels2,
|
|
25024
25120
|
requiredFields
|
|
25025
25121
|
}, i18n);
|
|
25122
|
+
useEffect(() => {
|
|
25123
|
+
var _a, _b;
|
|
25124
|
+
if ((_a = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a.entityType) {
|
|
25125
|
+
handleChangeFor("entityType")((_b = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _b.entityType);
|
|
25126
|
+
}
|
|
25127
|
+
}, [kompanyVerifiedData]);
|
|
25026
25128
|
useEffect(() => {
|
|
25027
25129
|
updateStateSlice({
|
|
25028
25130
|
schema: formSchema,
|
|
@@ -25060,7 +25162,7 @@ function CompanyStructure({
|
|
|
25060
25162
|
})]
|
|
25061
25163
|
});
|
|
25062
25164
|
}
|
|
25063
|
-
const CompanyStructureComponent = memo(CompanyStructure, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.heading, nextProps.heading) && objectsDeepEqual(prevProps.description, nextProps.description) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields));
|
|
25165
|
+
const CompanyStructureComponent = memo(CompanyStructure, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.heading, nextProps.heading) && objectsDeepEqual(prevProps.description, nextProps.description) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && prevProps.kompanyVerifiedData === nextProps.kompanyVerifiedData);
|
|
25064
25166
|
const forms = {
|
|
25065
25167
|
companyBasics: {
|
|
25066
25168
|
formId: "companyBasics",
|
|
@@ -25097,32 +25199,40 @@ const forms = {
|
|
|
25097
25199
|
fields: ["taxDocument"]
|
|
25098
25200
|
}
|
|
25099
25201
|
};
|
|
25100
|
-
const parseConfiguration$
|
|
25202
|
+
const parseConfiguration$4 = ({
|
|
25101
25203
|
country: country2,
|
|
25102
25204
|
matchingScenario
|
|
25103
25205
|
}) => parseCompanySearchScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.ORGANIZATION], country2);
|
|
25104
25206
|
const mandatoryApiFieldsForCompanySearch = ["companyBasics.legalCompanyName", "companyBasics.country"];
|
|
25105
|
-
const canSubmit = (data) => mandatoryApiFieldsForCompanySearch.every((detail) => {
|
|
25207
|
+
const canSubmit$1 = (data) => mandatoryApiFieldsForCompanySearch.every((detail) => {
|
|
25106
25208
|
const value = getProp(data, detail);
|
|
25107
25209
|
return !isEmpty$1(value);
|
|
25108
25210
|
});
|
|
25109
|
-
const isDocumentsRequired = (forms$1) => forms$1.some((form) => [forms.companyRegistrationDocument.formId, forms.companyTaxDocument.formId].includes(form.formId));
|
|
25110
|
-
const formatOtherDetails = (formData, i18n) => {
|
|
25211
|
+
const isDocumentsRequired$1 = (forms$1) => forms$1.some((form) => [forms.companyRegistrationDocument.formId, forms.companyTaxDocument.formId].includes(form.formId));
|
|
25212
|
+
const formatOtherDetails = (formData, i18n, country2, labels2) => {
|
|
25213
|
+
var _a, _b, _c;
|
|
25214
|
+
const summaryData = {
|
|
25215
|
+
...formData,
|
|
25216
|
+
[((_a = labels2 == null ? void 0 : labels2.companyOtherDetails) == null ? void 0 : _a.taxInformation) ?? "taxId"]: (_c = (_b = formData.taxInformation) == null ? void 0 : _b.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _c.number
|
|
25217
|
+
};
|
|
25218
|
+
if (formData.taxInformation) {
|
|
25219
|
+
delete summaryData.taxInformation;
|
|
25220
|
+
}
|
|
25111
25221
|
if (formData.exemptedFromVat) {
|
|
25112
|
-
|
|
25113
|
-
...formData,
|
|
25114
|
-
"VAT absence reason": i18n.get(formData.vatAbsenceReason)
|
|
25115
|
-
};
|
|
25116
|
-
delete summaryData.vatAbsenceReason;
|
|
25222
|
+
summaryData.vatAbsenceReason = i18n.get(formData.vatAbsenceReason);
|
|
25117
25223
|
delete summaryData.vatNumber;
|
|
25118
|
-
return summaryData;
|
|
25119
25224
|
}
|
|
25120
|
-
return
|
|
25225
|
+
return summaryData;
|
|
25121
25226
|
};
|
|
25122
|
-
const formatDataForSummary = (data, forms2, i18n) => {
|
|
25227
|
+
const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
25228
|
+
var _a;
|
|
25123
25229
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
25230
|
+
const country2 = (_a = data.companyBasics) == null ? void 0 : _a.country;
|
|
25231
|
+
const taxIdLabel = resolveFieldMetadata(defaultFieldConfig[country2], {
|
|
25232
|
+
taxIdNumberType: countryToTaxInfoTypeMap[country2]
|
|
25233
|
+
}, defaultFieldMetadata).label;
|
|
25124
25234
|
return entriesOf(data).reduce((summaryData, [form, formData]) => {
|
|
25125
|
-
var
|
|
25235
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
25126
25236
|
if (!form)
|
|
25127
25237
|
return summaryData;
|
|
25128
25238
|
switch (form) {
|
|
@@ -25130,10 +25240,10 @@ const formatDataForSummary = (data, forms2, i18n) => {
|
|
|
25130
25240
|
return {
|
|
25131
25241
|
...summaryData,
|
|
25132
25242
|
[form]: {
|
|
25133
|
-
legalCompanyName: formData.legalCompanyName,
|
|
25134
|
-
country: datasetUtils.getCountryName(formData.country),
|
|
25243
|
+
[((_a2 = labels2 == null ? void 0 : labels2.companyBasics) == null ? void 0 : _a2.legalCompanyName) ?? "legalCompanyName"]: formData.legalCompanyName,
|
|
25244
|
+
[((_b = labels2 == null ? void 0 : labels2.companyBasics) == null ? void 0 : _b.country) ?? "country"]: datasetUtils.getCountryName(formData.country),
|
|
25135
25245
|
[getKeyForField("stateOrProvince", formData.country)]: datasetUtils.getStateName(formData.stateOrProvince, formData.country),
|
|
25136
|
-
|
|
25246
|
+
[taxIdLabel]: (_d = (_c = formData.taxInformation) == null ? void 0 : _c.find((taxId2) => formData.country === taxId2.country)) == null ? void 0 : _d.number
|
|
25137
25247
|
}
|
|
25138
25248
|
};
|
|
25139
25249
|
case "companyRegistrationAddress":
|
|
@@ -25149,33 +25259,33 @@ const formatDataForSummary = (data, forms2, i18n) => {
|
|
|
25149
25259
|
return {
|
|
25150
25260
|
...summaryData,
|
|
25151
25261
|
[form]: {
|
|
25152
|
-
entityType: i18n.get((
|
|
25262
|
+
entityType: i18n.get((_e = companyTypes.find((type) => type.id === formData.entityType)) == null ? void 0 : _e.name)
|
|
25153
25263
|
}
|
|
25154
25264
|
};
|
|
25155
25265
|
case "companyOtherDetails":
|
|
25156
25266
|
return {
|
|
25157
25267
|
...summaryData,
|
|
25158
|
-
[form]: formatOtherDetails(formData, i18n)
|
|
25268
|
+
[form]: formatOtherDetails(formData, i18n, (_f = data.companyBasics) == null ? void 0 : _f.country, labels2)
|
|
25159
25269
|
};
|
|
25160
25270
|
case "companyRegistrationDocument":
|
|
25161
|
-
if (!isDocumentsRequired(forms2))
|
|
25271
|
+
if (!isDocumentsRequired$1(forms2))
|
|
25162
25272
|
return summaryData;
|
|
25163
25273
|
return {
|
|
25164
25274
|
...summaryData,
|
|
25165
25275
|
[form]: {
|
|
25166
25276
|
companyRegistrationDocument: {
|
|
25167
|
-
fileName: (
|
|
25277
|
+
fileName: (_h = (_g = formData == null ? void 0 : formData.registrationDocument) == null ? void 0 : _g[0]) == null ? void 0 : _h.name
|
|
25168
25278
|
}
|
|
25169
25279
|
}
|
|
25170
25280
|
};
|
|
25171
25281
|
case "companyTaxDocument":
|
|
25172
|
-
if (!isDocumentsRequired(forms2))
|
|
25282
|
+
if (!isDocumentsRequired$1(forms2))
|
|
25173
25283
|
return summaryData;
|
|
25174
25284
|
return {
|
|
25175
25285
|
...summaryData,
|
|
25176
25286
|
[form]: {
|
|
25177
25287
|
companyTaxDocument: {
|
|
25178
|
-
fileName: (
|
|
25288
|
+
fileName: (_j = (_i = formData == null ? void 0 : formData.taxDocument) == null ? void 0 : _i[0]) == null ? void 0 : _j.name
|
|
25179
25289
|
}
|
|
25180
25290
|
}
|
|
25181
25291
|
};
|
|
@@ -25335,7 +25445,7 @@ function useCompanySearchTaskSubmit({
|
|
|
25335
25445
|
legalEntity,
|
|
25336
25446
|
currentForms
|
|
25337
25447
|
}) => {
|
|
25338
|
-
if (!isDocumentsRequired(currentForms))
|
|
25448
|
+
if (!isDocumentsRequired$1(currentForms))
|
|
25339
25449
|
return;
|
|
25340
25450
|
const formattedDocument = await mapCompanySearchDocumentToApiDocument(data, legalEntity.id);
|
|
25341
25451
|
try {
|
|
@@ -25446,6 +25556,7 @@ function CompanySearchComponent(props) {
|
|
|
25446
25556
|
} = useI18nContext();
|
|
25447
25557
|
const {
|
|
25448
25558
|
country: country2,
|
|
25559
|
+
isTopLevelEntity,
|
|
25449
25560
|
activeForm,
|
|
25450
25561
|
problems,
|
|
25451
25562
|
handleAddressSearch,
|
|
@@ -25458,6 +25569,7 @@ function CompanySearchComponent(props) {
|
|
|
25458
25569
|
} = props;
|
|
25459
25570
|
const globalData = useGlobalData();
|
|
25460
25571
|
const [kompanyAddress, setKompanyAddress] = useState();
|
|
25572
|
+
const [kompanyVerifiedData, setKompanyVerifiedData] = useState();
|
|
25461
25573
|
const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
|
|
25462
25574
|
return jsxs("div", {
|
|
25463
25575
|
className: "adyen-kyc-company",
|
|
@@ -25468,13 +25580,15 @@ function CompanySearchComponent(props) {
|
|
|
25468
25580
|
id: forms.companyBasics.formId,
|
|
25469
25581
|
heading: i18n.get(forms.companyBasics.formName),
|
|
25470
25582
|
country: country2,
|
|
25583
|
+
isTopLevelEntity,
|
|
25471
25584
|
handleCompanyIndexSearch,
|
|
25472
25585
|
handleCompanyDeepSearch,
|
|
25473
25586
|
handleGetCompanyDataset,
|
|
25474
25587
|
handleRefreshCompanyDataset,
|
|
25475
25588
|
handleVerifyTin,
|
|
25476
25589
|
kompanyAddress,
|
|
25477
|
-
setKompanyAddress
|
|
25590
|
+
setKompanyAddress,
|
|
25591
|
+
setKompanyVerifiedData
|
|
25478
25592
|
})
|
|
25479
25593
|
}), jsx("div", {
|
|
25480
25594
|
className: formWrapperClasses(forms.companyRegistrationAddress.formId),
|
|
@@ -25497,7 +25611,8 @@ function CompanySearchComponent(props) {
|
|
|
25497
25611
|
...getFormProps(props, forms.companyStructure.formId),
|
|
25498
25612
|
id: forms.companyStructure.formId,
|
|
25499
25613
|
heading: i18n.get(forms.companyStructure.formName),
|
|
25500
|
-
description: i18n.get(forms.companyStructure.formDescription)
|
|
25614
|
+
description: i18n.get(forms.companyStructure.formDescription),
|
|
25615
|
+
kompanyVerifiedData
|
|
25501
25616
|
})
|
|
25502
25617
|
}), jsx("div", {
|
|
25503
25618
|
className: formWrapperClasses(forms.companyOtherDetails.formId),
|
|
@@ -25507,7 +25622,8 @@ function CompanySearchComponent(props) {
|
|
|
25507
25622
|
heading: i18n.get(forms.companyOtherDetails.formName),
|
|
25508
25623
|
country: country2,
|
|
25509
25624
|
legalCompanyName: (_a = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _a.legalCompanyName,
|
|
25510
|
-
companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType
|
|
25625
|
+
companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
|
|
25626
|
+
kompanyVerifiedData
|
|
25511
25627
|
})
|
|
25512
25628
|
}), jsx("div", {
|
|
25513
25629
|
className: formWrapperClasses(forms.companyRegistrationDocument.formId),
|
|
@@ -25652,13 +25768,13 @@ function CompanySearchDropinComponent({
|
|
|
25652
25768
|
}, [documentUtils, eventEmitter, i18n, initialData, legalEntityResponse, setLocale, showToast]);
|
|
25653
25769
|
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
25654
25770
|
legalEntityType: LegalEntityType.ORGANIZATION,
|
|
25655
|
-
capabilities: capabilities ??
|
|
25771
|
+
capabilities: capabilities ?? Object.keys(legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities),
|
|
25656
25772
|
country: country2
|
|
25657
|
-
}), [getConfiguration2, capabilities, country2]);
|
|
25773
|
+
}), [getConfiguration2, capabilities, country2, legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities]);
|
|
25658
25774
|
const {
|
|
25659
25775
|
fieldConfigurations
|
|
25660
25776
|
} = useScenarioConfiguration({
|
|
25661
|
-
parseConfiguration: parseConfiguration$
|
|
25777
|
+
parseConfiguration: parseConfiguration$4,
|
|
25662
25778
|
getConfigurationData,
|
|
25663
25779
|
setLoadingStatus,
|
|
25664
25780
|
country: country2
|
|
@@ -25694,10 +25810,10 @@ function CompanySearchDropinComponent({
|
|
|
25694
25810
|
return addValidityToForms(requiredForms, currentState.validityByForm, problems);
|
|
25695
25811
|
}, [derivedProps, problems, currentState.validityByForm]);
|
|
25696
25812
|
const summaryData = useMemo(() => ({
|
|
25697
|
-
data: formatDataForSummary(currentState.data, forms$1, i18n),
|
|
25813
|
+
data: formatDataForSummary(currentState.data, forms$1, derivedProps == null ? void 0 : derivedProps.labels, i18n),
|
|
25698
25814
|
omittedKeys: ["operationalAddressIsSame"]
|
|
25699
|
-
}), [currentState.data, forms$1, i18n]);
|
|
25700
|
-
const canSubmitForm = useMemo(() => canSubmit(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
|
|
25815
|
+
}), [currentState.data, derivedProps == null ? void 0 : derivedProps.labels, forms$1, i18n]);
|
|
25816
|
+
const canSubmitForm = useMemo(() => canSubmit$1(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
|
|
25701
25817
|
const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
|
|
25702
25818
|
trackingConfig,
|
|
25703
25819
|
parentLegalEntity,
|
|
@@ -25769,6 +25885,7 @@ function CompanySearchDropinComponent({
|
|
|
25769
25885
|
problems,
|
|
25770
25886
|
activeForm,
|
|
25771
25887
|
shouldValidate,
|
|
25888
|
+
isTopLevelEntity: taskType === TaskTypes.COMPANY_SEARCH,
|
|
25772
25889
|
handleAddressSearch,
|
|
25773
25890
|
handleFindAddress,
|
|
25774
25891
|
handleCompanyIndexSearch,
|
|
@@ -28036,7 +28153,7 @@ const omitMaskedFieldsIfUnchanged = (maskedFields, dataSubmitted, savedData) =>
|
|
|
28036
28153
|
});
|
|
28037
28154
|
return filtered;
|
|
28038
28155
|
};
|
|
28039
|
-
const parseConfiguration$
|
|
28156
|
+
const parseConfiguration$3 = ({
|
|
28040
28157
|
country: country2,
|
|
28041
28158
|
matchingScenario
|
|
28042
28159
|
}) => parseIndividualScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.INDIVIDUAL], country2);
|
|
@@ -28120,7 +28237,7 @@ function IndividualDropinComponent({
|
|
|
28120
28237
|
const {
|
|
28121
28238
|
fieldConfigurations
|
|
28122
28239
|
} = useScenarioConfiguration({
|
|
28123
|
-
parseConfiguration: parseConfiguration$
|
|
28240
|
+
parseConfiguration: parseConfiguration$3,
|
|
28124
28241
|
getConfigurationData,
|
|
28125
28242
|
setLoadingStatus,
|
|
28126
28243
|
country: country2
|
|
@@ -28592,14 +28709,14 @@ const rules$1 = ({
|
|
|
28592
28709
|
}
|
|
28593
28710
|
});
|
|
28594
28711
|
const getRegistrationCountry = (legalEntityResponse) => legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? legalEntityResponse.individual.residentialAddress.country : legalEntityResponse.organization.registeredAddress.country;
|
|
28595
|
-
const labels
|
|
28712
|
+
const labels = () => ({
|
|
28596
28713
|
verifiedAccountHolder: () => "accountHolder",
|
|
28597
28714
|
verifiedBankCountry: () => "bankCountry",
|
|
28598
28715
|
verifiedBankName: () => "bankName",
|
|
28599
28716
|
verifiedCurrencyCode: () => "currencyCode",
|
|
28600
28717
|
verifiedBankAccountNumber: () => "bankAccountNumber"
|
|
28601
28718
|
});
|
|
28602
|
-
const parseConfiguration = ({
|
|
28719
|
+
const parseConfiguration$2 = ({
|
|
28603
28720
|
requiredFields,
|
|
28604
28721
|
country: country2,
|
|
28605
28722
|
bankVerificationAvailable
|
|
@@ -28725,7 +28842,7 @@ function PayoutDetailsDropinComponent({
|
|
|
28725
28842
|
requiredFields,
|
|
28726
28843
|
bankVerificationVendors
|
|
28727
28844
|
} = useScenarioConfiguration({
|
|
28728
|
-
parseConfiguration,
|
|
28845
|
+
parseConfiguration: parseConfiguration$2,
|
|
28729
28846
|
getConfigurationData,
|
|
28730
28847
|
getPayoutAccountFormatData,
|
|
28731
28848
|
instantVerificationEnabled,
|
|
@@ -28739,7 +28856,7 @@ function PayoutDetailsDropinComponent({
|
|
|
28739
28856
|
taskType,
|
|
28740
28857
|
requiredFields
|
|
28741
28858
|
}), [bankAccountCountry2, data, taskType]);
|
|
28742
|
-
const fieldsFormCustomLabels = useMemo(() => labels
|
|
28859
|
+
const fieldsFormCustomLabels = useMemo(() => labels ? labels() : {}, [data, bankAccountCountry2]);
|
|
28743
28860
|
const payoutDetailsSteps = useMemo(() => {
|
|
28744
28861
|
var _a2;
|
|
28745
28862
|
return getAppropriatePayoutDetailsSteps(taskType, Boolean((_a2 = prefilledData == null ? void 0 : prefilledData.payoutAccountDetails) == null ? void 0 : _a2.transferInstrumentId), !transferInstrument && isInstantVerificationAvailable({
|
|
@@ -30202,668 +30319,61 @@ function ServiceAgreementDropinComponent({
|
|
|
30202
30319
|
})
|
|
30203
30320
|
});
|
|
30204
30321
|
}
|
|
30205
|
-
|
|
30206
|
-
|
|
30207
|
-
|
|
30208
|
-
|
|
30209
|
-
|
|
30210
|
-
|
|
30211
|
-
|
|
30212
|
-
const
|
|
30213
|
-
|
|
30214
|
-
|
|
30215
|
-
|
|
30216
|
-
|
|
30217
|
-
|
|
30218
|
-
|
|
30219
|
-
isValid: false
|
|
30220
|
-
};
|
|
30221
|
-
function StateReducer() {
|
|
30222
|
-
const [schemas, setSchemas] = useState({});
|
|
30223
|
-
const [activeForms, setActiveForms] = useState([]);
|
|
30224
|
-
const setCurrentForms = (forms2) => {
|
|
30225
|
-
setActiveForms(forms2);
|
|
30322
|
+
const parseConfiguration$1 = ({
|
|
30323
|
+
matchingScenario,
|
|
30324
|
+
country: country2
|
|
30325
|
+
}) => parseSolePropScenarios(matchingScenario[LegalEntityType.SOLE_PROPRIETORSHIP], country2);
|
|
30326
|
+
const isDocumentsRequired = (forms2) => forms2.some((form) => [solePropForms.solePropConstitutionalDocument.formId].includes(form.formId));
|
|
30327
|
+
const formatFileSummaryData = (solePropConstitutionalDocument) => {
|
|
30328
|
+
var _a;
|
|
30329
|
+
const constitutionalDocument2 = (_a = solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0];
|
|
30330
|
+
return {
|
|
30331
|
+
...constitutionalDocument2 && {
|
|
30332
|
+
solePropConstitutionalDocument: {
|
|
30333
|
+
fileName: constitutionalDocument2.name
|
|
30334
|
+
}
|
|
30335
|
+
}
|
|
30226
30336
|
};
|
|
30227
|
-
function reducer2({
|
|
30228
|
-
currentState: currState
|
|
30229
|
-
}, action) {
|
|
30230
|
-
var _a, _b, _c, _d, _e;
|
|
30231
|
-
switch (action.type) {
|
|
30232
|
-
case "addToState": {
|
|
30233
|
-
const state2 = structuredClone(currState);
|
|
30234
|
-
const dataStoreId = action.value.dataStoreId ?? action.value.caller;
|
|
30235
|
-
const schema = action.value.schema || null;
|
|
30236
|
-
const schemaHasChanged = schema && ((_a = schemas == null ? void 0 : schemas[dataStoreId]) == null ? void 0 : _a.toString()) !== schema.toString();
|
|
30237
|
-
const mergedState = {
|
|
30238
|
-
...state2,
|
|
30239
|
-
data: {
|
|
30240
|
-
...state2.data,
|
|
30241
|
-
[dataStoreId]: {
|
|
30242
|
-
...state2.data[dataStoreId],
|
|
30243
|
-
...action.value.data
|
|
30244
|
-
}
|
|
30245
|
-
},
|
|
30246
|
-
// Add data in allData state prop in case we will need them later
|
|
30247
|
-
allData: {
|
|
30248
|
-
...state2.allData,
|
|
30249
|
-
[dataStoreId]: {
|
|
30250
|
-
...state2.allData[dataStoreId],
|
|
30251
|
-
...removeObjectPropsWithEmptyValues(action.value.data)
|
|
30252
|
-
}
|
|
30253
|
-
},
|
|
30254
|
-
errors: {
|
|
30255
|
-
...state2.errors,
|
|
30256
|
-
[dataStoreId]: {
|
|
30257
|
-
...state2.errors[dataStoreId],
|
|
30258
|
-
...action.value.errors
|
|
30259
|
-
}
|
|
30260
|
-
},
|
|
30261
|
-
valid: {
|
|
30262
|
-
...state2.valid,
|
|
30263
|
-
[dataStoreId]: {
|
|
30264
|
-
...state2.valid[dataStoreId],
|
|
30265
|
-
...action.value.valid
|
|
30266
|
-
}
|
|
30267
|
-
},
|
|
30268
|
-
fieldProblems: {
|
|
30269
|
-
...state2.fieldProblems,
|
|
30270
|
-
[dataStoreId]: {
|
|
30271
|
-
...state2.fieldProblems[dataStoreId],
|
|
30272
|
-
...action.value.fieldProblems
|
|
30273
|
-
}
|
|
30274
|
-
}
|
|
30275
|
-
};
|
|
30276
|
-
if (schemaHasChanged) {
|
|
30277
|
-
setSchemas({
|
|
30278
|
-
...schemas,
|
|
30279
|
-
[dataStoreId]: schema
|
|
30280
|
-
});
|
|
30281
|
-
const processedBySchema = schema.reduce((acc, fieldKey) => {
|
|
30282
|
-
const dataObjByFormId = mergedState.data[dataStoreId];
|
|
30283
|
-
const allDataObjByFormId = mergedState.allData[dataStoreId];
|
|
30284
|
-
const validObjByFormId = mergedState.valid[dataStoreId];
|
|
30285
|
-
const errorsObjByFormId = mergedState.errors[dataStoreId];
|
|
30286
|
-
const fieldProblemsObjByFormId = mergedState.fieldProblems[dataStoreId];
|
|
30287
|
-
return {
|
|
30288
|
-
data: {
|
|
30289
|
-
...acc.data,
|
|
30290
|
-
[fieldKey]: dataObjByFormId[fieldKey] ?? allDataObjByFormId[fieldKey]
|
|
30291
|
-
},
|
|
30292
|
-
valid: {
|
|
30293
|
-
...acc.valid,
|
|
30294
|
-
[fieldKey]: validObjByFormId[fieldKey]
|
|
30295
|
-
},
|
|
30296
|
-
errors: {
|
|
30297
|
-
...acc.errors,
|
|
30298
|
-
[fieldKey]: errorsObjByFormId[fieldKey]
|
|
30299
|
-
},
|
|
30300
|
-
fieldProblems: {
|
|
30301
|
-
...acc.fieldProblems,
|
|
30302
|
-
[fieldKey]: fieldProblemsObjByFormId[fieldKey]
|
|
30303
|
-
}
|
|
30304
|
-
};
|
|
30305
|
-
}, {
|
|
30306
|
-
data: {},
|
|
30307
|
-
valid: {},
|
|
30308
|
-
errors: {},
|
|
30309
|
-
fieldProblems: {}
|
|
30310
|
-
});
|
|
30311
|
-
mergedState.data[dataStoreId] = processedBySchema.data;
|
|
30312
|
-
mergedState.valid[dataStoreId] = processedBySchema.valid;
|
|
30313
|
-
mergedState.errors[dataStoreId] = processedBySchema.errors;
|
|
30314
|
-
mergedState.fieldProblems[dataStoreId] = processedBySchema.fieldProblems;
|
|
30315
|
-
}
|
|
30316
|
-
mergedState.validityByForm = {
|
|
30317
|
-
...mergedState.validityByForm,
|
|
30318
|
-
[dataStoreId]: Object.values(mergedState.valid[dataStoreId]).every((isValid) => isValid)
|
|
30319
|
-
};
|
|
30320
|
-
mergedState.hasDataChanged = {
|
|
30321
|
-
...state2.hasDataChanged,
|
|
30322
|
-
[dataStoreId]: {
|
|
30323
|
-
hasDataChanged: hasDataChanged((_b = state2.initialData) == null ? void 0 : _b[dataStoreId], (_c = mergedState.data) == null ? void 0 : _c[dataStoreId])
|
|
30324
|
-
}
|
|
30325
|
-
};
|
|
30326
|
-
mergedState.hasAnyDataChanged = Object.values(mergedState.hasDataChanged).some(({
|
|
30327
|
-
hasDataChanged: hasDataChanged2
|
|
30328
|
-
}) => hasDataChanged2);
|
|
30329
|
-
mergedState.allValid = Object.values(mergedState.validityByForm).every((isValid) => isValid);
|
|
30330
|
-
mergedState.isValid = !activeForms.length ? mergedState.allValid : activeForms.every((item) => mergedState.validityByForm[item]);
|
|
30331
|
-
mergedState.initialData = structuredClone(state2.initialData);
|
|
30332
|
-
return {
|
|
30333
|
-
currentState: mergedState,
|
|
30334
|
-
prevState: state2,
|
|
30335
|
-
changeInitiatedBy: dataStoreId
|
|
30336
|
-
};
|
|
30337
|
-
}
|
|
30338
|
-
case "resetState": {
|
|
30339
|
-
const dataStoreId = ((_d = action.value) == null ? void 0 : _d.dataStoreId) ?? ((_e = action.value) == null ? void 0 : _e.caller);
|
|
30340
|
-
return {
|
|
30341
|
-
currentState: INITIAL_STATE,
|
|
30342
|
-
prevState: currState,
|
|
30343
|
-
changeInitiatedBy: dataStoreId
|
|
30344
|
-
};
|
|
30345
|
-
}
|
|
30346
|
-
default: {
|
|
30347
|
-
throw new Error(`Unhandled action type: ${action.type}`);
|
|
30348
|
-
}
|
|
30349
|
-
}
|
|
30350
|
-
}
|
|
30351
|
-
return {
|
|
30352
|
-
reducer: reducer2,
|
|
30353
|
-
setCurrentForms
|
|
30354
|
-
};
|
|
30355
|
-
}
|
|
30356
|
-
function StateProvider({
|
|
30357
|
-
defaultData = {},
|
|
30358
|
-
children
|
|
30359
|
-
}) {
|
|
30360
|
-
const defaultState = {
|
|
30361
|
-
currentState: {
|
|
30362
|
-
data: defaultData,
|
|
30363
|
-
allData: defaultData,
|
|
30364
|
-
valid: {},
|
|
30365
|
-
errors: {},
|
|
30366
|
-
fieldProblems: {},
|
|
30367
|
-
validityByForm: {},
|
|
30368
|
-
initialData: defaultData
|
|
30369
|
-
},
|
|
30370
|
-
prevState: {},
|
|
30371
|
-
changeInitiatedBy: null
|
|
30372
|
-
};
|
|
30373
|
-
const reducerObj = StateReducer();
|
|
30374
|
-
const [state2, dispatch] = useReducer(reducerObj.reducer, defaultState);
|
|
30375
|
-
const contextValue = useMemo(() => ({
|
|
30376
|
-
state: state2,
|
|
30377
|
-
dispatch,
|
|
30378
|
-
setActiveForms: reducerObj.setCurrentForms,
|
|
30379
|
-
getData: () => {
|
|
30380
|
-
var _a;
|
|
30381
|
-
return ((_a = state2 == null ? void 0 : state2.currentState) == null ? void 0 : _a.data) ?? {};
|
|
30382
|
-
},
|
|
30383
|
-
getState: () => state2 == null ? void 0 : state2.currentState
|
|
30384
|
-
}), [reducerObj, state2]);
|
|
30385
|
-
return jsx(StateContext.Provider, {
|
|
30386
|
-
value: contextValue,
|
|
30387
|
-
children
|
|
30388
|
-
});
|
|
30389
|
-
}
|
|
30390
|
-
const labels = (data, country2) => ({
|
|
30391
|
-
registrationNumber: () => {
|
|
30392
|
-
var _a;
|
|
30393
|
-
if (country2 === CountryCodes.Monaco && ((_a = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _a.country) === CountryCodes.Monaco) {
|
|
30394
|
-
return "mcRegistrationNumberSoleProp";
|
|
30395
|
-
}
|
|
30396
|
-
}
|
|
30397
|
-
});
|
|
30398
|
-
const fontFormats = ["eot", "woff", "woff2", "ttf", "otf"];
|
|
30399
|
-
const formatFullNames = {
|
|
30400
|
-
eot: "embedded-opentype",
|
|
30401
|
-
woff: "woff",
|
|
30402
|
-
woff2: "woff2",
|
|
30403
|
-
ttf: "truetype",
|
|
30404
|
-
otf: "opentype"
|
|
30405
|
-
};
|
|
30406
|
-
const getFontFaceRule = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
30407
|
-
const fontSources = formats.map((format) => `url(${fontPath}.${format}) format(${formatFullNames[format]})`);
|
|
30408
|
-
const ruleLines = [`font-family: '${fontFamily}'`, `font-style: ${fontStyle}`, `font-weight: ${fontWeight}`, `src: ${fontSources.join(",")}`];
|
|
30409
|
-
return `@font-face {${ruleLines.join(";")}}`;
|
|
30410
|
-
};
|
|
30411
|
-
const addStyleTagForFont = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
30412
|
-
const style = document.createElement("style");
|
|
30413
|
-
style.setAttribute("type", "text/css");
|
|
30414
|
-
style.innerText = getFontFaceRule(fontFamily, fontStyle, fontWeight, fontPath, formats);
|
|
30415
|
-
document.head.insertBefore(style, document.head.firstChild);
|
|
30416
|
-
};
|
|
30417
|
-
const addStyleTagForADLIconFont = (loadingContext) => {
|
|
30418
|
-
const fontPath = `${loadingContext}static/fonts`;
|
|
30419
|
-
const iconFontPath = `${fontPath}/adyen-kyc-icons`;
|
|
30420
|
-
addStyleTagForFont("adyen-kyc-icons", "normal", "normal", iconFontPath, fontFormats);
|
|
30421
|
-
};
|
|
30422
|
-
let isFlagsLoaded = false;
|
|
30423
|
-
let isDocumentGuidanceLoaded = false;
|
|
30424
|
-
const getIconContainer = () => {
|
|
30425
|
-
const container = document.createElement("div");
|
|
30426
|
-
container.setAttribute("aria-hidden", "true");
|
|
30427
|
-
container.setAttribute("id", "adl-icon-container");
|
|
30428
|
-
container.style.height = "0";
|
|
30429
|
-
return container;
|
|
30430
|
-
};
|
|
30431
|
-
const buildSpriteDOMFromResponse = (responseData) => {
|
|
30432
|
-
const iconContainer = getIconContainer();
|
|
30433
|
-
iconContainer.innerHTML = responseData;
|
|
30434
|
-
return iconContainer;
|
|
30435
|
-
};
|
|
30436
|
-
const loadFlags = async (loadingContext) => {
|
|
30437
|
-
if (isFlagsLoaded)
|
|
30438
|
-
return;
|
|
30439
|
-
isFlagsLoaded = true;
|
|
30440
|
-
const responseData = await http({
|
|
30441
|
-
loadingContext,
|
|
30442
|
-
path: "static/images/country-flags.svg"
|
|
30443
|
-
}, null, "text");
|
|
30444
|
-
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
30445
|
-
};
|
|
30446
|
-
const loadDocumentGuidance = async (loadingContext) => {
|
|
30447
|
-
if (isDocumentGuidanceLoaded)
|
|
30448
|
-
return;
|
|
30449
|
-
isDocumentGuidanceLoaded = true;
|
|
30450
|
-
const responseData = await http({
|
|
30451
|
-
loadingContext,
|
|
30452
|
-
path: "static/images/document-guidance.svg"
|
|
30453
|
-
}, null, "text");
|
|
30454
|
-
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
30455
30337
|
};
|
|
30456
|
-
const
|
|
30338
|
+
const canSubmit = (data) => mandatoryApiFields.SOLE_PROPRIETORSHIP.every((detail) => {
|
|
30339
|
+
const value = getProp(data, detail);
|
|
30340
|
+
return !isEmpty(value);
|
|
30341
|
+
});
|
|
30342
|
+
const hasRegisteredAddress = (dataFromResponse) => {
|
|
30457
30343
|
var _a;
|
|
30458
|
-
|
|
30459
|
-
|
|
30460
|
-
|
|
30461
|
-
|
|
30462
|
-
|
|
30463
|
-
|
|
30464
|
-
|
|
30465
|
-
|
|
30466
|
-
|
|
30467
|
-
|
|
30468
|
-
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
|
|
30344
|
+
const registeredAddress2 = ((_a = dataFromResponse == null ? void 0 : dataFromResponse.solePropRegistrationAddress) == null ? void 0 : _a.registrationAddress) || {};
|
|
30345
|
+
return Object.entries(registeredAddress2).some(([key, value]) => key !== "country" && Boolean(value));
|
|
30346
|
+
};
|
|
30347
|
+
const getDataWithDefaultAddress = (legalEntityResponse, parentLegalEntity) => {
|
|
30348
|
+
var _a;
|
|
30349
|
+
let solePropData = mapLegalEntityToSoleProp(legalEntityResponse);
|
|
30350
|
+
if (!hasRegisteredAddress(solePropData)) {
|
|
30351
|
+
const defaultAddress = (_a = mapLegalEntityToIndividual(parentLegalEntity, false)) == null ? void 0 : _a.address;
|
|
30352
|
+
solePropData = {
|
|
30353
|
+
...solePropData,
|
|
30354
|
+
solePropRegistrationAddress: {
|
|
30355
|
+
...solePropData == null ? void 0 : solePropData.solePropRegistrationAddress,
|
|
30356
|
+
registrationAddress: {
|
|
30357
|
+
...defaultAddress
|
|
30358
|
+
}
|
|
30359
|
+
}
|
|
30360
|
+
};
|
|
30361
|
+
}
|
|
30362
|
+
return solePropData;
|
|
30474
30363
|
};
|
|
30475
|
-
function withFormComposer(WrappedComponent, {
|
|
30476
|
-
getComponentForms,
|
|
30477
|
-
parseConfiguration: parseConfiguration2,
|
|
30478
|
-
rules: rules2,
|
|
30479
|
-
labels: labels2,
|
|
30480
|
-
defaultTaskName,
|
|
30481
|
-
getConfigFor = "contextCountry"
|
|
30482
|
-
}) {
|
|
30483
|
-
const WithFormComposer = (props) => {
|
|
30484
|
-
var _a, _b, _c, _d;
|
|
30485
|
-
const {
|
|
30486
|
-
i18n
|
|
30487
|
-
} = useI18nContext();
|
|
30488
|
-
const {
|
|
30489
|
-
contextCountry: initialContextCountry,
|
|
30490
|
-
setContextCountry: setInitialContextCountry
|
|
30491
|
-
} = useCoreContext();
|
|
30492
|
-
const {
|
|
30493
|
-
loadingContext
|
|
30494
|
-
} = useAuthContext();
|
|
30495
|
-
const {
|
|
30496
|
-
getConfiguration: getConfiguration2,
|
|
30497
|
-
getPayoutAccountFormat: getPayoutAccountFormat2
|
|
30498
|
-
} = useConfigurationApi();
|
|
30499
|
-
const {
|
|
30500
|
-
isSettingEnabled
|
|
30501
|
-
} = useSettingsContext();
|
|
30502
|
-
const {
|
|
30503
|
-
getData,
|
|
30504
|
-
getState
|
|
30505
|
-
} = useStateContext();
|
|
30506
|
-
const {
|
|
30507
|
-
getOmittedKeys: getSummaryOmittedKeys = null,
|
|
30508
|
-
formatData: formatDataForSummary2 = null,
|
|
30509
|
-
omittedForms
|
|
30510
|
-
} = props.summary || {};
|
|
30511
|
-
const taskName = props.taskName ?? defaultTaskName;
|
|
30512
|
-
const [hideDropinLayout, setHideDropinLayout] = useState(false);
|
|
30513
|
-
const [hideNavigation, setHideNavigation] = useState(false);
|
|
30514
|
-
const [hideFooter, setHideFooter] = useState(false);
|
|
30515
|
-
const [hideOnHomeButton, setHideOnHomeButton] = useState(false);
|
|
30516
|
-
const [hideBackButton, setHideBackButton] = useState(false);
|
|
30517
|
-
const [submitButtonLabel, setSubmitButtonLabel] = useState(null);
|
|
30518
|
-
const [skipSubmitAndGoTaskList, setSkipSubmitAndGoTaskList] = useState(false);
|
|
30519
|
-
const [customFormNavigationHandlers, setCustomFormNavigationHandlers] = useState({});
|
|
30520
|
-
const [shouldValidate, setShouldValidate] = useState(false);
|
|
30521
|
-
const [formValidity, setFormValidity] = useState({});
|
|
30522
|
-
const formRef = useRef(null);
|
|
30523
|
-
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
30524
|
-
const [derivedProps, setDerivedProps] = useState(props);
|
|
30525
|
-
const [contextCountry, setContextCountry] = useState(props.country || initialContextCountry);
|
|
30526
|
-
const {
|
|
30527
|
-
sliceData: payoutMethodData
|
|
30528
|
-
} = useGlobalDataSlice("payoutVerificationMethod");
|
|
30529
|
-
const configCountry = (getConfigFor === "bankCountry" ? payoutMethodData == null ? void 0 : payoutMethodData.bankCountry : contextCountry) ?? contextCountry;
|
|
30530
|
-
useEffect(() => {
|
|
30531
|
-
loadDocumentGuidance(loadingContext);
|
|
30532
|
-
}, [loadingContext]);
|
|
30533
|
-
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
30534
|
-
legalEntityType: props.legalEntityType,
|
|
30535
|
-
capabilities: props.capabilities,
|
|
30536
|
-
// for payout forms, we need to get config for the selected bankCountry, not necessarily the same as the residency/registration country
|
|
30537
|
-
country: configCountry
|
|
30538
|
-
}), [configCountry, props.capabilities, props.legalEntityType]);
|
|
30539
|
-
const getPayoutAccountFormatData = useCallback(() => getPayoutAccountFormat2(configCountry), [configCountry]);
|
|
30540
|
-
const {
|
|
30541
|
-
fieldConfigurations,
|
|
30542
|
-
requiredFields,
|
|
30543
|
-
bankVerificationVendors
|
|
30544
|
-
} = useScenarioConfiguration({
|
|
30545
|
-
getConfigurationData,
|
|
30546
|
-
getPayoutAccountFormatData,
|
|
30547
|
-
parseConfiguration: parseConfiguration2,
|
|
30548
|
-
country: configCountry,
|
|
30549
|
-
instantVerificationEnabled: derivedProps.instantVerificationEnabled && derivedProps.handleGetBankVerificationVendors,
|
|
30550
|
-
setLoadingStatus
|
|
30551
|
-
});
|
|
30552
|
-
const isFormStepVisible = (formId) => {
|
|
30553
|
-
if (derivedProps.requiredFields || derivedProps.optionalFields) {
|
|
30554
|
-
return !!derivedProps.requiredFields[formId] || !!derivedProps.optionalFields[formId];
|
|
30555
|
-
}
|
|
30556
|
-
return true;
|
|
30557
|
-
};
|
|
30558
|
-
const isFormSummaryStep = (form) => form.formId === summaryStep.formId;
|
|
30559
|
-
const componentForms = useMemo(() => getComponentForms({
|
|
30560
|
-
...props,
|
|
30561
|
-
bankVerificationVendors
|
|
30562
|
-
}, isSettingEnabled), [bankVerificationVendors, isSettingEnabled, props]);
|
|
30563
|
-
const componentFormsWithSummary = [...Object.values(componentForms), summaryStep];
|
|
30564
|
-
const allowedForms = componentFormsWithSummary.filter((form) => isFormStepVisible(form.formId) || isFormSummaryStep(form));
|
|
30565
|
-
const [activeForm, setActiveForm] = useState(getOpeningStep(allowedForms, (_a = props == null ? void 0 : props.problems) == null ? void 0 : _a.remediationActions));
|
|
30566
|
-
const [hasAlreadyNavigatedForm, setHasAlreadyNavigatedForm] = useState(false);
|
|
30567
|
-
const getFormIndex = (formId) => allowedForms.findIndex((form) => form.formId === formId);
|
|
30568
|
-
const isFinalStep = getFormIndex(activeForm.formId) === allowedForms.length - 1;
|
|
30569
|
-
const isFirstStep = getFormIndex(activeForm.formId) === 0;
|
|
30570
|
-
useEffect(() => {
|
|
30571
|
-
var _a2;
|
|
30572
|
-
if (hasAlreadyNavigatedForm)
|
|
30573
|
-
return;
|
|
30574
|
-
const openingStep = getOpeningStep(allowedForms, (_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.remediationActions);
|
|
30575
|
-
if (activeForm !== openingStep) {
|
|
30576
|
-
setActiveForm(openingStep);
|
|
30577
|
-
}
|
|
30578
|
-
}, [activeForm, allowedForms, (_b = props == null ? void 0 : props.problems) == null ? void 0 : _b.remediationActions, hasAlreadyNavigatedForm]);
|
|
30579
|
-
const evaluateConfiguration = useCallback((scenarioConfiguration, country2, formData, isSettingEnabled2, requiredFields2) => {
|
|
30580
|
-
var _a2, _b2, _c2;
|
|
30581
|
-
const fieldsFromCustomRules = rules2 ? rules2({
|
|
30582
|
-
data: formData,
|
|
30583
|
-
country: country2,
|
|
30584
|
-
taskType: props.taskType,
|
|
30585
|
-
isSettingEnabled: isSettingEnabled2,
|
|
30586
|
-
requiredFields: requiredFields2
|
|
30587
|
-
}) : {};
|
|
30588
|
-
const fieldsFormCustomLabels = labels2 ? labels2(formData, country2) : {};
|
|
30589
|
-
const scenarioProps = getPropsFromConfigurations(scenarioConfiguration, componentForms, ((_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.remediationActions) ? Object.values((_b2 = props == null ? void 0 : props.problems) == null ? void 0 : _b2.remediationActions) : [], ((_c2 = props.problems) == null ? void 0 : _c2.missingData) ?? [], props.legalEntityResponse ? getFieldsWithExistingData(props.legalEntityResponse) : [], fieldsFromCustomRules, fieldsFormCustomLabels);
|
|
30590
|
-
setShouldValidate(false);
|
|
30591
|
-
setDerivedProps({
|
|
30592
|
-
...props,
|
|
30593
|
-
...scenarioProps,
|
|
30594
|
-
country: configCountry
|
|
30595
|
-
});
|
|
30596
|
-
}, [componentForms, configCountry, props]);
|
|
30597
|
-
useEffect(() => {
|
|
30598
|
-
if (!fieldConfigurations)
|
|
30599
|
-
return;
|
|
30600
|
-
evaluateConfiguration(fieldConfigurations, configCountry, getData(), isSettingEnabled, requiredFields);
|
|
30601
|
-
}, [fieldConfigurations, configCountry, evaluateConfiguration, getData, isSettingEnabled, requiredFields]);
|
|
30602
|
-
const trackNavigation2 = ({
|
|
30603
|
-
fromForm,
|
|
30604
|
-
toForm,
|
|
30605
|
-
component
|
|
30606
|
-
}) => {
|
|
30607
|
-
userEvents.addEvent("Navigated form", {
|
|
30608
|
-
segmentation: {
|
|
30609
|
-
...props == null ? void 0 : props.baseTrackingPayload,
|
|
30610
|
-
component,
|
|
30611
|
-
from: fromForm.formId,
|
|
30612
|
-
fromLabel: i18n.get(fromForm.formName),
|
|
30613
|
-
to: toForm.formId,
|
|
30614
|
-
toLabel: i18n.get(toForm.formName)
|
|
30615
|
-
}
|
|
30616
|
-
});
|
|
30617
|
-
};
|
|
30618
|
-
const trackSectionCompletion = (form) => {
|
|
30619
|
-
userEvents.addEvent("Completed form section", {
|
|
30620
|
-
segmentation: {
|
|
30621
|
-
...props == null ? void 0 : props.baseTrackingPayload,
|
|
30622
|
-
sectionName: form.formId
|
|
30623
|
-
}
|
|
30624
|
-
});
|
|
30625
|
-
};
|
|
30626
|
-
const gotoFormByFormIndex = (nextFormIndex) => {
|
|
30627
|
-
if (formRef.current.verifyForm) {
|
|
30628
|
-
formRef.current.verifyForm(activeForm.formId).then((isVerified) => {
|
|
30629
|
-
if (isVerified) {
|
|
30630
|
-
setHasAlreadyNavigatedForm(true);
|
|
30631
|
-
setActiveForm(allowedForms[nextFormIndex]);
|
|
30632
|
-
}
|
|
30633
|
-
});
|
|
30634
|
-
} else {
|
|
30635
|
-
setHasAlreadyNavigatedForm(true);
|
|
30636
|
-
setActiveForm(allowedForms[nextFormIndex]);
|
|
30637
|
-
}
|
|
30638
|
-
};
|
|
30639
|
-
const validateCurrentForm = () => {
|
|
30640
|
-
setShouldValidate(true);
|
|
30641
|
-
};
|
|
30642
|
-
const handleNextClick = () => {
|
|
30643
|
-
var _a2, _b2;
|
|
30644
|
-
if (formRef.current.customNavigationHandler) {
|
|
30645
|
-
formRef.current.customNavigationHandler();
|
|
30646
|
-
return;
|
|
30647
|
-
}
|
|
30648
|
-
if ((_a2 = customFormNavigationHandlers[activeForm.formId]) == null ? void 0 : _a2.onNext) {
|
|
30649
|
-
(_b2 = customFormNavigationHandlers[activeForm.formId]) == null ? void 0 : _b2.onNext();
|
|
30650
|
-
return;
|
|
30651
|
-
}
|
|
30652
|
-
const allFields = (derivedProps == null ? void 0 : derivedProps.allFields) || {};
|
|
30653
|
-
if (isFormSummaryStep(activeForm)) {
|
|
30654
|
-
if (skipSubmitAndGoTaskList) {
|
|
30655
|
-
props.navigateBackToTaskList();
|
|
30656
|
-
} else {
|
|
30657
|
-
props.onSubmit({
|
|
30658
|
-
data: getData(),
|
|
30659
|
-
forms: allowedForms,
|
|
30660
|
-
allFields,
|
|
30661
|
-
setLoadingStatus
|
|
30662
|
-
});
|
|
30663
|
-
}
|
|
30664
|
-
return;
|
|
30665
|
-
}
|
|
30666
|
-
if (formValidity[activeForm.formId]) {
|
|
30667
|
-
if (isFinalStep) {
|
|
30668
|
-
props.onSubmit({
|
|
30669
|
-
data: getData(),
|
|
30670
|
-
forms: allowedForms,
|
|
30671
|
-
allFields,
|
|
30672
|
-
setLoadingStatus
|
|
30673
|
-
});
|
|
30674
|
-
return;
|
|
30675
|
-
}
|
|
30676
|
-
setShouldValidate(false);
|
|
30677
|
-
const toFormIndex = allowedForms.findIndex((form) => form.formId === activeForm.formId) + 1;
|
|
30678
|
-
gotoFormByFormIndex(toFormIndex);
|
|
30679
|
-
const toForm = allowedForms[toFormIndex];
|
|
30680
|
-
trackNavigation2({
|
|
30681
|
-
fromForm: activeForm,
|
|
30682
|
-
toForm,
|
|
30683
|
-
component: "ActionBar"
|
|
30684
|
-
});
|
|
30685
|
-
trackSectionCompletion(activeForm);
|
|
30686
|
-
} else {
|
|
30687
|
-
validateCurrentForm();
|
|
30688
|
-
}
|
|
30689
|
-
};
|
|
30690
|
-
const handleBackClick = () => {
|
|
30691
|
-
const currentFormIndex = allowedForms.findIndex((form) => form.formId === activeForm.formId);
|
|
30692
|
-
if (currentFormIndex) {
|
|
30693
|
-
const fromForm = allowedForms[currentFormIndex];
|
|
30694
|
-
const toForm = allowedForms[currentFormIndex - 1];
|
|
30695
|
-
setActiveForm(toForm);
|
|
30696
|
-
setHasAlreadyNavigatedForm(true);
|
|
30697
|
-
trackNavigation2({
|
|
30698
|
-
fromForm,
|
|
30699
|
-
toForm,
|
|
30700
|
-
component: "ActionBar"
|
|
30701
|
-
});
|
|
30702
|
-
}
|
|
30703
|
-
};
|
|
30704
|
-
const setCustomHandlers = (formId, onNext, onBack) => {
|
|
30705
|
-
setCustomFormNavigationHandlers({
|
|
30706
|
-
...customFormNavigationHandlers,
|
|
30707
|
-
[formId]: {
|
|
30708
|
-
onNext,
|
|
30709
|
-
onBack
|
|
30710
|
-
}
|
|
30711
|
-
});
|
|
30712
|
-
};
|
|
30713
|
-
const nextButtonText = isFinalStep ? i18n.get(submitButtonLabel ?? "submit") : i18n.get("next");
|
|
30714
|
-
useEffect(() => {
|
|
30715
|
-
props.eventEmitter.on("next", handleNextClick);
|
|
30716
|
-
props.eventEmitter.on("back", handleBackClick);
|
|
30717
|
-
props.eventEmitter.on("validate", validateCurrentForm);
|
|
30718
|
-
return () => {
|
|
30719
|
-
props.eventEmitter.off("next", handleNextClick);
|
|
30720
|
-
props.eventEmitter.off("back", handleNextClick);
|
|
30721
|
-
props.eventEmitter.off("validate", validateCurrentForm);
|
|
30722
|
-
};
|
|
30723
|
-
}, [activeForm, allowedForms]);
|
|
30724
|
-
const onCountryChange = (country2) => {
|
|
30725
|
-
setContextCountry(country2);
|
|
30726
|
-
};
|
|
30727
|
-
const onWrappedComponentChange = (state2) => {
|
|
30728
|
-
var _a2;
|
|
30729
|
-
setFormValidity(state2.validityByForm);
|
|
30730
|
-
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, state2);
|
|
30731
|
-
};
|
|
30732
|
-
const handleStateChange = ({
|
|
30733
|
-
currentState
|
|
30734
|
-
}) => {
|
|
30735
|
-
onWrappedComponentChange(currentState);
|
|
30736
|
-
};
|
|
30737
|
-
const handleLeaveDropin = async () => {
|
|
30738
|
-
var _a2;
|
|
30739
|
-
const data = getData();
|
|
30740
|
-
const hasDataChanged2 = getState().hasAnyDataChanged;
|
|
30741
|
-
if (hasDataChanged2 && ((_a2 = props.canSubmit) == null ? void 0 : _a2.call(props, data))) {
|
|
30742
|
-
setInitialContextCountry(contextCountry);
|
|
30743
|
-
const allFields = (derivedProps == null ? void 0 : derivedProps.allFields) || {};
|
|
30744
|
-
await props.onSubmit({
|
|
30745
|
-
data,
|
|
30746
|
-
forms: allowedForms,
|
|
30747
|
-
allFields,
|
|
30748
|
-
setLoadingStatus
|
|
30749
|
-
});
|
|
30750
|
-
} else {
|
|
30751
|
-
props.handleHomeClick();
|
|
30752
|
-
}
|
|
30753
|
-
};
|
|
30754
|
-
const formFooter = !hideDropinLayout && !hideFooter && jsx(ActionBar, {
|
|
30755
|
-
onNext: handleNextClick,
|
|
30756
|
-
onBack: isFirstStep ? props.handleBackClick : handleBackClick,
|
|
30757
|
-
backButtonLabel: i18n.get("back"),
|
|
30758
|
-
nextButtonLabel: nextButtonText,
|
|
30759
|
-
onHome: handleLeaveDropin,
|
|
30760
|
-
homeButtonLabel: props.homeButtonLabel,
|
|
30761
|
-
hideOnHomeButton,
|
|
30762
|
-
hideBackButton
|
|
30763
|
-
});
|
|
30764
|
-
const wrappedComponent = jsx("div", {
|
|
30765
|
-
className: "adyen-kyc-form-container",
|
|
30766
|
-
children: jsx(LoaderWrapper, {
|
|
30767
|
-
status: loadingStatus,
|
|
30768
|
-
formOpacityWhenLoading: 0.3,
|
|
30769
|
-
loaderSize: "large",
|
|
30770
|
-
children: jsxs(FormRouterContextProvider, {
|
|
30771
|
-
setFormIndex: gotoFormByFormIndex,
|
|
30772
|
-
forms: allowedForms,
|
|
30773
|
-
handleGetIdVerificationToken: props.handleGetIdVerificationToken,
|
|
30774
|
-
children: [jsx(StateContextWatcher, {
|
|
30775
|
-
owner: "FormComposer",
|
|
30776
|
-
onChange: handleStateChange
|
|
30777
|
-
}), jsx(WrappedComponent, {
|
|
30778
|
-
ref: formRef,
|
|
30779
|
-
forms: allowedForms,
|
|
30780
|
-
activeForm,
|
|
30781
|
-
...derivedProps,
|
|
30782
|
-
data: props.data,
|
|
30783
|
-
onChange: onWrappedComponentChange,
|
|
30784
|
-
evaluateConfiguration: (data) => evaluateConfiguration(fieldConfigurations, configCountry, data, isSettingEnabled, requiredFields),
|
|
30785
|
-
country: contextCountry,
|
|
30786
|
-
onCountryChange,
|
|
30787
|
-
legalEntityId: (_c = props.legalEntityResponse) == null ? void 0 : _c.id,
|
|
30788
|
-
problems: props == null ? void 0 : props.problems,
|
|
30789
|
-
shouldValidate,
|
|
30790
|
-
onNext: handleNextClick,
|
|
30791
|
-
onBack: handleBackClick,
|
|
30792
|
-
setHideDropinLayout,
|
|
30793
|
-
setHideNavigation,
|
|
30794
|
-
setHideFooter,
|
|
30795
|
-
setCustomFormNavigationHandlers: setCustomHandlers,
|
|
30796
|
-
setHideOnHomeButton,
|
|
30797
|
-
setHideBackButton,
|
|
30798
|
-
setSubmitButtonLabel,
|
|
30799
|
-
setSkipSubmitAndGoTaskList,
|
|
30800
|
-
bankVerificationVendors
|
|
30801
|
-
}), activeForm.formId === summaryStep.formId && jsx("div", {
|
|
30802
|
-
className: "adyen-kyc-form-wrapper",
|
|
30803
|
-
children: jsx(Summary, {
|
|
30804
|
-
trackNavigation: trackNavigation2,
|
|
30805
|
-
data: formatDataForSummary2 ? formatDataForSummary2(getData(), allowedForms) : getData(),
|
|
30806
|
-
omittedKeys: getSummaryOmittedKeys ? getSummaryOmittedKeys(getData()) : null,
|
|
30807
|
-
omittedForms,
|
|
30808
|
-
forms: allowedForms,
|
|
30809
|
-
gotoForm: gotoFormByFormIndex,
|
|
30810
|
-
labels: derivedProps.labels,
|
|
30811
|
-
problems: props == null ? void 0 : props.problems
|
|
30812
|
-
})
|
|
30813
|
-
}), formFooter]
|
|
30814
|
-
})
|
|
30815
|
-
})
|
|
30816
|
-
});
|
|
30817
|
-
const allowedFormsWithValidity = addValidityToForms(allowedForms, formValidity, props.problems);
|
|
30818
|
-
const sidebar = !hideDropinLayout && !hideNavigation && jsx(LoaderWrapper, {
|
|
30819
|
-
status: loadingStatus,
|
|
30820
|
-
formOpacityWhenLoading: 0.3,
|
|
30821
|
-
showSpinner: false,
|
|
30822
|
-
className: "adyen-kyc-dropin__sidebar-wrapper",
|
|
30823
|
-
children: jsx(FormNavigation, {
|
|
30824
|
-
forms: allowedFormsWithValidity,
|
|
30825
|
-
activeForm: allowedFormsWithValidity.find((form) => form.formId === activeForm.formId),
|
|
30826
|
-
gotoForm: gotoFormByFormIndex,
|
|
30827
|
-
validateForm: validateCurrentForm,
|
|
30828
|
-
taskName,
|
|
30829
|
-
trackNavigation: trackNavigation2,
|
|
30830
|
-
verificationErrors: (_d = props == null ? void 0 : props.problems) == null ? void 0 : _d.verificationErrors
|
|
30831
|
-
})
|
|
30832
|
-
});
|
|
30833
|
-
const content = jsxs(Fragment, {
|
|
30834
|
-
children: [sidebar, wrappedComponent]
|
|
30835
|
-
});
|
|
30836
|
-
if (!props.hideDropinLayout) {
|
|
30837
|
-
return jsx(DropinLayout, {
|
|
30838
|
-
content
|
|
30839
|
-
});
|
|
30840
|
-
}
|
|
30841
|
-
return wrappedComponent;
|
|
30842
|
-
};
|
|
30843
|
-
return WithFormComposer;
|
|
30844
|
-
}
|
|
30845
|
-
const SolePropWithFormComposer = withFormComposer(SolePropComponent, {
|
|
30846
|
-
getComponentForms: () => solePropForms,
|
|
30847
|
-
// TODO: change trust to soleprop once the configurations for soleprops are added in backend.
|
|
30848
|
-
parseConfiguration: ({
|
|
30849
|
-
matchingScenario,
|
|
30850
|
-
country: country2
|
|
30851
|
-
}) => parseSolePropScenarios([matchingScenario[LegalEntityType.TRUST]], country2),
|
|
30852
|
-
rules: rules$2,
|
|
30853
|
-
labels,
|
|
30854
|
-
defaultTaskName: "solePropDetails"
|
|
30855
|
-
});
|
|
30856
30364
|
function SolePropDropinComponent({
|
|
30857
30365
|
problems: problemsProp,
|
|
30858
30366
|
capabilities,
|
|
30859
|
-
country:
|
|
30367
|
+
country: externalCountry,
|
|
30860
30368
|
parentLegalEntity,
|
|
30861
30369
|
legalEntityResponse,
|
|
30862
30370
|
eventEmitter,
|
|
30863
30371
|
homeButtonLabel,
|
|
30864
30372
|
hideDropinLayout,
|
|
30865
|
-
onSubmit,
|
|
30373
|
+
onSubmit: onExternalSubmit,
|
|
30866
30374
|
onChange,
|
|
30375
|
+
taskType,
|
|
30376
|
+
trackingConfig,
|
|
30867
30377
|
handleHomeClick,
|
|
30868
30378
|
handleCreateDocument,
|
|
30869
30379
|
handleGetDocument,
|
|
@@ -30873,7 +30383,7 @@ function SolePropDropinComponent({
|
|
|
30873
30383
|
handleUpdateLegalEntity,
|
|
30874
30384
|
handleCreateLegalEntity
|
|
30875
30385
|
}) {
|
|
30876
|
-
var _a;
|
|
30386
|
+
var _a, _b;
|
|
30877
30387
|
const {
|
|
30878
30388
|
i18n,
|
|
30879
30389
|
setLocale
|
|
@@ -30883,43 +30393,72 @@ function SolePropDropinComponent({
|
|
|
30883
30393
|
} = useExperimentsContext();
|
|
30884
30394
|
const [problems, setProblems] = useState(problemsProp);
|
|
30885
30395
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
30886
|
-
const getOmittedKeys = () => ["operationalAddressIsSame"];
|
|
30887
30396
|
const [newSoleProp, setNewSoleProp] = useState(null);
|
|
30888
30397
|
const {
|
|
30889
|
-
showToast
|
|
30890
|
-
clearToasts
|
|
30398
|
+
showToast
|
|
30891
30399
|
} = useToastContext();
|
|
30892
|
-
const
|
|
30893
|
-
|
|
30894
|
-
|
|
30895
|
-
|
|
30896
|
-
|
|
30897
|
-
|
|
30898
|
-
|
|
30899
|
-
|
|
30900
|
-
|
|
30901
|
-
|
|
30902
|
-
|
|
30903
|
-
|
|
30904
|
-
|
|
30905
|
-
|
|
30906
|
-
|
|
30907
|
-
|
|
30908
|
-
|
|
30909
|
-
|
|
30910
|
-
|
|
30400
|
+
const {
|
|
30401
|
+
getConfiguration: getConfiguration2
|
|
30402
|
+
} = useConfigurationApi();
|
|
30403
|
+
const {
|
|
30404
|
+
isSettingEnabled
|
|
30405
|
+
} = useSettingsContext();
|
|
30406
|
+
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
30407
|
+
const formRef = useRef(null);
|
|
30408
|
+
const dataFromResponse = getDataWithDefaultAddress(legalEntityResponse, parentLegalEntity);
|
|
30409
|
+
const [data, setData] = useState(dataFromResponse);
|
|
30410
|
+
const country2 = ((_a = dataFromResponse == null ? void 0 : dataFromResponse.solePropRegistrationAddress) == null ? void 0 : _a.registrationAddress.country) || externalCountry;
|
|
30411
|
+
const baseTrackingPayload = getBaseTrackingPayload({
|
|
30412
|
+
trackingConfig,
|
|
30413
|
+
parentLegalEntity,
|
|
30414
|
+
legalEntity: legalEntityResponse,
|
|
30415
|
+
task: taskType
|
|
30416
|
+
});
|
|
30417
|
+
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
30418
|
+
legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP,
|
|
30419
|
+
capabilities,
|
|
30420
|
+
country: country2
|
|
30421
|
+
}), [country2, capabilities]);
|
|
30422
|
+
const {
|
|
30423
|
+
fieldConfigurations,
|
|
30424
|
+
requiredFields
|
|
30425
|
+
} = useScenarioConfiguration({
|
|
30426
|
+
parseConfiguration: parseConfiguration$1,
|
|
30427
|
+
getConfigurationData,
|
|
30428
|
+
setLoadingStatus,
|
|
30429
|
+
country: country2
|
|
30430
|
+
});
|
|
30431
|
+
const fieldsFromCustomRules = useMemo(() => rules$2({
|
|
30432
|
+
data,
|
|
30433
|
+
country: country2,
|
|
30434
|
+
taskType,
|
|
30435
|
+
requiredFields,
|
|
30436
|
+
isSettingEnabled
|
|
30437
|
+
}), [country2, data, taskType, requiredFields, isSettingEnabled]);
|
|
30438
|
+
const derivedProps = useMemo(() => getPropsFromConfigurations(fieldConfigurations, solePropForms, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], legalEntityResponse ? getFieldsWithExistingData(legalEntityResponse) : [], fieldsFromCustomRules), [fieldConfigurations, fieldsFromCustomRules, problems == null ? void 0 : problems.remediationActions]);
|
|
30439
|
+
const {
|
|
30440
|
+
state: {
|
|
30441
|
+
currentState
|
|
30911
30442
|
}
|
|
30912
|
-
|
|
30913
|
-
|
|
30914
|
-
|
|
30915
|
-
|
|
30443
|
+
} = useStateContext();
|
|
30444
|
+
const formValidity = currentState.validityByForm;
|
|
30445
|
+
useEffect(() => {
|
|
30446
|
+
setData({
|
|
30447
|
+
...currentState.data
|
|
30448
|
+
});
|
|
30449
|
+
onChange == null ? void 0 : onChange(currentState);
|
|
30450
|
+
}, [currentState]);
|
|
30451
|
+
const forms2 = useMemo(() => {
|
|
30452
|
+
const requiredForms = getRequiredForms(solePropForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
|
|
30453
|
+
return addValidityToForms(requiredForms, formValidity, problems);
|
|
30454
|
+
}, [derivedProps, formValidity, problems]);
|
|
30916
30455
|
const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
|
|
30917
30456
|
const submitDocuments = async ({
|
|
30918
|
-
forms:
|
|
30457
|
+
forms: forms22,
|
|
30919
30458
|
legalEntity,
|
|
30920
30459
|
dataSubmitted
|
|
30921
30460
|
}) => {
|
|
30922
|
-
if (
|
|
30461
|
+
if (isDocumentsRequired(forms22)) {
|
|
30923
30462
|
const formattedDocument = await mapSolePropDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
30924
30463
|
if (formattedDocument) {
|
|
30925
30464
|
await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
|
|
@@ -30974,11 +30513,8 @@ function SolePropDropinComponent({
|
|
|
30974
30513
|
const updatedLegalEntity = await handleUpdateLegalEntity(drop("type").from(mappedLegalEntity), (legalEntityResponse == null ? void 0 : legalEntityResponse.id) || (newSoleProp == null ? void 0 : newSoleProp.id));
|
|
30975
30514
|
return updatedLegalEntity;
|
|
30976
30515
|
};
|
|
30977
|
-
const handleOnSubmit = async ({
|
|
30978
|
-
|
|
30979
|
-
forms: forms2,
|
|
30980
|
-
setLoadingStatus
|
|
30981
|
-
}) => {
|
|
30516
|
+
const handleOnSubmit = async () => {
|
|
30517
|
+
const dataSubmitted = data;
|
|
30982
30518
|
setLoadingStatus("loading");
|
|
30983
30519
|
try {
|
|
30984
30520
|
const legalEntity = await handleSubmitLegalEntity(mapSolePropToLegalEntity(dataSubmitted));
|
|
@@ -30995,7 +30531,7 @@ function SolePropDropinComponent({
|
|
|
30995
30531
|
label: i18n.get("successfullyUpdatedDetails"),
|
|
30996
30532
|
type: ToastType.SUCCESS
|
|
30997
30533
|
});
|
|
30998
|
-
|
|
30534
|
+
onExternalSubmit == null ? void 0 : onExternalSubmit(dataSubmitted);
|
|
30999
30535
|
} catch (e) {
|
|
31000
30536
|
showToast({
|
|
31001
30537
|
label: i18n.get("failedToUpdateDetails"),
|
|
@@ -31018,15 +30554,12 @@ function SolePropDropinComponent({
|
|
|
31018
30554
|
setLoadingStatus("success");
|
|
31019
30555
|
}
|
|
31020
30556
|
};
|
|
31021
|
-
const formatDataForSummary2 = (data2,
|
|
31022
|
-
var _a2,
|
|
30557
|
+
const formatDataForSummary2 = (data2, forms22) => {
|
|
30558
|
+
var _a2, _b2, _c, _d;
|
|
31023
30559
|
let summaryData = cloneObject(data2);
|
|
31024
|
-
|
|
31025
|
-
if ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.country) {
|
|
31026
|
-
solePropCountry = datasetUtils.getCountryName(summaryData.solePropNameAndCountry.country);
|
|
31027
|
-
}
|
|
30560
|
+
const solePropCountry = ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.country) ? datasetUtils.getCountryName(summaryData.solePropNameAndCountry.country) : void 0;
|
|
31028
30561
|
summaryData.solePropNameAndCountry = {
|
|
31029
|
-
legalNameOfSoleProprietor: (
|
|
30562
|
+
legalNameOfSoleProprietor: (_b2 = data2.solePropNameAndCountry) == null ? void 0 : _b2.legalCompanyName,
|
|
31030
30563
|
countryOfEstablishment: solePropCountry
|
|
31031
30564
|
};
|
|
31032
30565
|
if ((_c = summaryData == null ? void 0 : summaryData.solePropRegistrationAddress) == null ? void 0 : _c.registrationAddress) {
|
|
@@ -31036,53 +30569,62 @@ function SolePropDropinComponent({
|
|
|
31036
30569
|
if ((_d = summaryData == null ? void 0 : summaryData.solePropRegistrationAddress) == null ? void 0 : _d.operationalAddress) {
|
|
31037
30570
|
summaryData.solePropRegistrationAddress.operationalAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.solePropRegistrationAddress.operationalAddress, datasetUtils);
|
|
31038
30571
|
}
|
|
31039
|
-
if (
|
|
30572
|
+
if (isDocumentsRequired(forms22)) {
|
|
31040
30573
|
delete summaryData[solePropDocumentFormId];
|
|
31041
30574
|
summaryData = {
|
|
31042
30575
|
...summaryData,
|
|
31043
|
-
...
|
|
30576
|
+
...formatFileSummaryData(data2.solePropConstitutionalDocument)
|
|
31044
30577
|
};
|
|
31045
30578
|
}
|
|
31046
30579
|
return summaryData;
|
|
31047
30580
|
};
|
|
31048
|
-
const
|
|
31049
|
-
|
|
31050
|
-
|
|
31051
|
-
|
|
31052
|
-
|
|
31053
|
-
|
|
31054
|
-
|
|
31055
|
-
|
|
31056
|
-
|
|
31057
|
-
|
|
31058
|
-
|
|
31059
|
-
|
|
31060
|
-
|
|
31061
|
-
|
|
30581
|
+
const {
|
|
30582
|
+
handleNextClick,
|
|
30583
|
+
handleBackClick,
|
|
30584
|
+
activeForm,
|
|
30585
|
+
shouldValidate,
|
|
30586
|
+
setShouldValidate,
|
|
30587
|
+
gotoFormByFormIndex,
|
|
30588
|
+
nextButtonLabel
|
|
30589
|
+
} = useFormComposer({
|
|
30590
|
+
problems,
|
|
30591
|
+
baseTrackingPayload,
|
|
30592
|
+
forms: forms2,
|
|
30593
|
+
formRef,
|
|
30594
|
+
onSubmit: handleOnSubmit
|
|
31062
30595
|
});
|
|
31063
|
-
return jsx(
|
|
31064
|
-
|
|
31065
|
-
|
|
30596
|
+
return jsx(FormWrapper, {
|
|
30597
|
+
taskName: isExperimentEnabled("EnableNewEntryFlow") ? "soleProprietorshipDetails" : "solePropDetails",
|
|
30598
|
+
handleBackClick,
|
|
30599
|
+
handleNextClick,
|
|
30600
|
+
gotoFormByFormIndex,
|
|
30601
|
+
handleHomeClick,
|
|
30602
|
+
hideDropinLayout,
|
|
30603
|
+
nextButtonLabel,
|
|
30604
|
+
homeButtonLabel,
|
|
30605
|
+
loadingStatus,
|
|
30606
|
+
forms: forms2,
|
|
30607
|
+
activeForm,
|
|
30608
|
+
onSubmit: handleOnSubmit,
|
|
30609
|
+
validateForm: () => setShouldValidate(true),
|
|
30610
|
+
canSubmit: canSubmit(data) && hasDataChanged(dataFromResponse, data),
|
|
30611
|
+
baseTrackingPayload,
|
|
30612
|
+
problems,
|
|
30613
|
+
summary: {
|
|
30614
|
+
data: formatDataForSummary2(data, forms2),
|
|
30615
|
+
omittedKeys: ["operationalAddressIsSame"]
|
|
30616
|
+
},
|
|
30617
|
+
children: jsx(SolePropComponent, {
|
|
30618
|
+
...derivedProps,
|
|
30619
|
+
activeForm,
|
|
31066
30620
|
capabilities,
|
|
31067
|
-
data,
|
|
31068
|
-
country: ((
|
|
30621
|
+
data: dataFromResponse,
|
|
30622
|
+
country: ((_b = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _b.country) || country2,
|
|
31069
30623
|
problems,
|
|
31070
|
-
eventEmitter,
|
|
31071
|
-
hideDropinLayout,
|
|
31072
|
-
legalEntityType: LegalEntityType.TRUST,
|
|
31073
|
-
taskName: isExperimentEnabled("EnableNewEntryFlow") ? "soleProprietorshipDetails" : "solePropDetails",
|
|
31074
|
-
legalEntityResponse,
|
|
31075
|
-
summary: {
|
|
31076
|
-
formatData: formatDataForSummary2,
|
|
31077
|
-
getOmittedKeys
|
|
31078
|
-
},
|
|
31079
|
-
canSubmit: canSubmit2,
|
|
31080
|
-
onChange,
|
|
31081
|
-
onSubmit: handleOnSubmit,
|
|
31082
|
-
handleHomeClick,
|
|
31083
|
-
homeButtonLabel,
|
|
31084
30624
|
handleAddressSearch,
|
|
31085
|
-
handleFindAddress
|
|
30625
|
+
handleFindAddress,
|
|
30626
|
+
ref: formRef,
|
|
30627
|
+
shouldValidate
|
|
31086
30628
|
})
|
|
31087
30629
|
});
|
|
31088
30630
|
}
|
|
@@ -31109,53 +30651,99 @@ const rules = ({
|
|
|
31109
30651
|
}
|
|
31110
30652
|
}
|
|
31111
30653
|
});
|
|
31112
|
-
const
|
|
31113
|
-
|
|
31114
|
-
|
|
31115
|
-
|
|
31116
|
-
|
|
31117
|
-
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
|
|
31127
|
-
|
|
31128
|
-
|
|
31129
|
-
|
|
31130
|
-
|
|
31131
|
-
|
|
30654
|
+
const parseConfiguration = ({
|
|
30655
|
+
matchingScenario,
|
|
30656
|
+
country: country2
|
|
30657
|
+
}) => parseTrustScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.TRUST], country2);
|
|
30658
|
+
function TrustDropinComponent({
|
|
30659
|
+
parentLegalEntity,
|
|
30660
|
+
capabilities,
|
|
30661
|
+
country: country2,
|
|
30662
|
+
legalEntityResponse,
|
|
30663
|
+
handleCreateLegalEntity,
|
|
30664
|
+
handleUpdateLegalEntity,
|
|
30665
|
+
handleCreateDocument,
|
|
30666
|
+
handleGetDocument,
|
|
30667
|
+
handleUpdateDocument,
|
|
30668
|
+
handleAddressSearch,
|
|
30669
|
+
handleFindAddress,
|
|
30670
|
+
trackingConfig,
|
|
30671
|
+
taskType,
|
|
30672
|
+
problems: problemsProp,
|
|
30673
|
+
onSubmit: externalOnSubmit,
|
|
30674
|
+
onChange,
|
|
30675
|
+
hideDropinLayout,
|
|
30676
|
+
handleHomeClick,
|
|
30677
|
+
homeButtonLabel
|
|
30678
|
+
}) {
|
|
30679
|
+
var _a;
|
|
31132
30680
|
const {
|
|
31133
30681
|
i18n
|
|
31134
30682
|
} = useI18nContext();
|
|
31135
30683
|
const dataFromResponse = mapLegalEntityToTrust(legalEntityResponse);
|
|
31136
|
-
const [data] = useState(dataFromResponse
|
|
31137
|
-
const [problems, setProblems] = useState(
|
|
30684
|
+
const [data, setData] = useState(dataFromResponse);
|
|
30685
|
+
const [problems, setProblems] = useState(problemsProp);
|
|
31138
30686
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
31139
|
-
const getOmittedKeys = () => ["operationalAddressIsSame"];
|
|
31140
30687
|
const [newTrust, setNewTrust] = useState(null);
|
|
30688
|
+
const {
|
|
30689
|
+
getConfiguration: getConfiguration2
|
|
30690
|
+
} = useConfigurationApi();
|
|
30691
|
+
const {
|
|
30692
|
+
isSettingEnabled
|
|
30693
|
+
} = useSettingsContext();
|
|
31141
30694
|
const {
|
|
31142
30695
|
showToast,
|
|
31143
30696
|
clearToasts
|
|
31144
30697
|
} = useToastContext();
|
|
31145
|
-
const
|
|
31146
|
-
|
|
30698
|
+
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
30699
|
+
const formRef = useRef(null);
|
|
30700
|
+
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
30701
|
+
legalEntityType: LegalEntityType.TRUST,
|
|
30702
|
+
capabilities,
|
|
30703
|
+
country: country2
|
|
30704
|
+
}), [country2, capabilities]);
|
|
30705
|
+
const {
|
|
30706
|
+
fieldConfigurations,
|
|
30707
|
+
requiredFields
|
|
30708
|
+
} = useScenarioConfiguration({
|
|
30709
|
+
parseConfiguration,
|
|
30710
|
+
getConfigurationData,
|
|
31147
30711
|
setLoadingStatus,
|
|
31148
|
-
|
|
31149
|
-
})
|
|
31150
|
-
|
|
30712
|
+
country: country2
|
|
30713
|
+
});
|
|
30714
|
+
const fieldsFromCustomRules = useMemo(() => rules({
|
|
30715
|
+
data,
|
|
30716
|
+
country: country2,
|
|
30717
|
+
taskType,
|
|
30718
|
+
requiredFields,
|
|
30719
|
+
isSettingEnabled
|
|
30720
|
+
}), [country2, data, taskType, requiredFields, isSettingEnabled]);
|
|
30721
|
+
const derivedProps = useMemo(() => getPropsFromConfigurations(fieldConfigurations, trustForms, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], legalEntityResponse ? getFieldsWithExistingData(legalEntityResponse) : [], fieldsFromCustomRules), [fieldConfigurations, fieldsFromCustomRules, problems == null ? void 0 : problems.remediationActions]);
|
|
30722
|
+
const {
|
|
30723
|
+
state: {
|
|
30724
|
+
currentState
|
|
30725
|
+
}
|
|
30726
|
+
} = useStateContext();
|
|
30727
|
+
const formValidity = currentState.validityByForm;
|
|
30728
|
+
useEffect(() => {
|
|
30729
|
+
setData({
|
|
30730
|
+
...currentState.data
|
|
30731
|
+
});
|
|
30732
|
+
onChange == null ? void 0 : onChange(currentState);
|
|
30733
|
+
}, [currentState]);
|
|
30734
|
+
const forms2 = useMemo(() => {
|
|
30735
|
+
const requiredForms = getRequiredForms(trustForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
|
|
30736
|
+
return addValidityToForms(requiredForms, formValidity, problems);
|
|
30737
|
+
}, [derivedProps, formValidity, problems]);
|
|
30738
|
+
const onSubmit = async () => {
|
|
31151
30739
|
setLoadingStatus("loading");
|
|
31152
|
-
const trustDetails2 = mapTrustToLegalEntity(
|
|
30740
|
+
const trustDetails2 = mapTrustToLegalEntity(data);
|
|
31153
30741
|
try {
|
|
31154
30742
|
const updatedTrust = await submitTrustDetails(trustDetails2);
|
|
31155
30743
|
await submitDocuments({
|
|
31156
30744
|
forms: forms2,
|
|
31157
30745
|
legalEntity: updatedTrust,
|
|
31158
|
-
dataSubmitted:
|
|
30746
|
+
dataSubmitted: data
|
|
31159
30747
|
});
|
|
31160
30748
|
await attachTrustToParentLegalEntity(updatedTrust);
|
|
31161
30749
|
setLoadingStatus("success");
|
|
@@ -31163,7 +30751,7 @@ function TrustDropinComponent(props) {
|
|
|
31163
30751
|
label: i18n.get("successfullyUpdatedDetails"),
|
|
31164
30752
|
type: ToastType.SUCCESS
|
|
31165
30753
|
});
|
|
31166
|
-
|
|
30754
|
+
externalOnSubmit == null ? void 0 : externalOnSubmit(data);
|
|
31167
30755
|
} catch (e) {
|
|
31168
30756
|
showToast({
|
|
31169
30757
|
label: i18n.get("failedToUpdateDetails"),
|
|
@@ -31189,27 +30777,27 @@ function TrustDropinComponent(props) {
|
|
|
31189
30777
|
const submitTrustDetails = async (legalEntity) => {
|
|
31190
30778
|
let updatedTrust;
|
|
31191
30779
|
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.id) && !(newTrust == null ? void 0 : newTrust.id)) {
|
|
31192
|
-
updatedTrust = await
|
|
30780
|
+
updatedTrust = await handleCreateLegalEntity(legalEntity);
|
|
31193
30781
|
setNewTrust(legalEntity);
|
|
31194
30782
|
} else {
|
|
31195
|
-
updatedTrust = await
|
|
30783
|
+
updatedTrust = await handleUpdateLegalEntity(drop("type").from(legalEntity), (legalEntityResponse == null ? void 0 : legalEntityResponse.id) || (newTrust == null ? void 0 : newTrust.id));
|
|
31196
30784
|
}
|
|
31197
30785
|
return updatedTrust;
|
|
31198
30786
|
};
|
|
31199
30787
|
const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
|
|
31200
30788
|
const submitDocuments = async ({
|
|
31201
|
-
forms:
|
|
30789
|
+
forms: forms22,
|
|
31202
30790
|
legalEntity,
|
|
31203
30791
|
dataSubmitted
|
|
31204
30792
|
}) => {
|
|
31205
|
-
if (isDocumentsRequired2(
|
|
30793
|
+
if (isDocumentsRequired2(forms22)) {
|
|
31206
30794
|
const formattedDocument = await mapTrustDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
31207
30795
|
if (formattedDocument) {
|
|
31208
30796
|
await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
|
|
31209
30797
|
}
|
|
31210
30798
|
}
|
|
31211
30799
|
};
|
|
31212
|
-
const isDocumentsRequired2 = (
|
|
30800
|
+
const isDocumentsRequired2 = (forms22) => forms22.some((form) => [trustForms.trustConstitutionalDocument.formId].includes(form.formId));
|
|
31213
30801
|
const attachTrustToParentLegalEntity = async (trust2) => {
|
|
31214
30802
|
if (legalEntityResponse == null ? void 0 : legalEntityResponse.id) {
|
|
31215
30803
|
return;
|
|
@@ -31221,30 +30809,25 @@ function TrustDropinComponent(props) {
|
|
|
31221
30809
|
legalEntityId: trust2.id
|
|
31222
30810
|
}, ...existingEntityAssociations]
|
|
31223
30811
|
};
|
|
31224
|
-
await
|
|
30812
|
+
await handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
|
|
31225
30813
|
};
|
|
31226
|
-
const formatDataForSummary2 = (data2,
|
|
31227
|
-
var
|
|
31228
|
-
let summaryData = cloneObject(data2);
|
|
31229
|
-
|
|
31230
|
-
|
|
31231
|
-
|
|
31232
|
-
|
|
30814
|
+
const formatDataForSummary2 = (data2, forms22) => {
|
|
30815
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
30816
|
+
let summaryData = cloneObject(data2) || {};
|
|
30817
|
+
if (summaryData == null ? void 0 : summaryData.trustRegistrationDetails) {
|
|
30818
|
+
const trustCountry = ((_a2 = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _a2.country) ? datasetUtils.getCountryName(summaryData.trustRegistrationDetails.country) : void 0;
|
|
30819
|
+
const trustType2 = ((_b = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _b.trustType) ? i18n.get((_c = trustTypeOptions.find((trustType22) => {
|
|
30820
|
+
var _a3;
|
|
30821
|
+
return trustType22.id === ((_a3 = summaryData.trustRegistrationDetails) == null ? void 0 : _a3.trustType);
|
|
30822
|
+
})) == null ? void 0 : _c.name) : void 0;
|
|
30823
|
+
summaryData.trustRegistrationDetails = {
|
|
30824
|
+
nameOfTrustAgreement: (_d = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _d.legalName,
|
|
30825
|
+
countryOfEstablishment: trustCountry,
|
|
30826
|
+
typeOfTrustAgreement: trustType2,
|
|
30827
|
+
objectOfTrust: (_e = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _e.objectOfTrust,
|
|
30828
|
+
taxId: (_f = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _f.taxId
|
|
30829
|
+
};
|
|
31233
30830
|
}
|
|
31234
|
-
if ((_b = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _b.trustType) {
|
|
31235
|
-
const selectedTrustType = (_c = trustTypeOptions.find((trustType22) => {
|
|
31236
|
-
var _a2;
|
|
31237
|
-
return trustType22.id === ((_a2 = summaryData.trustRegistrationDetails) == null ? void 0 : _a2.trustType);
|
|
31238
|
-
})) == null ? void 0 : _c.name;
|
|
31239
|
-
trustType2 = i18n.get(selectedTrustType);
|
|
31240
|
-
}
|
|
31241
|
-
summaryData.trustRegistrationDetails = {
|
|
31242
|
-
nameOfTrustAgreement: (_d = data2.trustRegistrationDetails) == null ? void 0 : _d.legalName,
|
|
31243
|
-
countryOfEstablishment: trustCountry,
|
|
31244
|
-
typeOfTrustAgreement: trustType2,
|
|
31245
|
-
objectOfTrust: (_e = data2.trustRegistrationDetails) == null ? void 0 : _e.objectOfTrust,
|
|
31246
|
-
taxId: (_f = data2.trustRegistrationDetails) == null ? void 0 : _f.taxId
|
|
31247
|
-
};
|
|
31248
30831
|
if ((_g = summaryData == null ? void 0 : summaryData.trustRegistrationAddress) == null ? void 0 : _g.registrationAddress) {
|
|
31249
30832
|
summaryData.trustRegistrationAddress.hasInnerForms = true;
|
|
31250
30833
|
summaryData.trustRegistrationAddress.registrationAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.trustRegistrationAddress.registrationAddress, datasetUtils);
|
|
@@ -31252,18 +30835,18 @@ function TrustDropinComponent(props) {
|
|
|
31252
30835
|
if ((_h = summaryData == null ? void 0 : summaryData.trustRegistrationAddress) == null ? void 0 : _h.operationalAddress) {
|
|
31253
30836
|
summaryData.trustRegistrationAddress.operationalAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.trustRegistrationAddress.operationalAddress, datasetUtils);
|
|
31254
30837
|
}
|
|
31255
|
-
if (isDocumentsRequired2(
|
|
30838
|
+
if (isDocumentsRequired2(forms22)) {
|
|
31256
30839
|
delete summaryData[trustConstitutionalDocumentFormId];
|
|
31257
30840
|
summaryData = {
|
|
31258
30841
|
...summaryData,
|
|
31259
|
-
...formatFileSummaryData2(
|
|
30842
|
+
...formatFileSummaryData2(summaryData == null ? void 0 : summaryData.trustConstitutionalDocument)
|
|
31260
30843
|
};
|
|
31261
30844
|
}
|
|
31262
30845
|
return summaryData;
|
|
31263
30846
|
};
|
|
31264
30847
|
const formatFileSummaryData2 = (trustConstitutionalDocument) => {
|
|
31265
|
-
var
|
|
31266
|
-
const constitutionalDocument2 = (
|
|
30848
|
+
var _a2;
|
|
30849
|
+
const constitutionalDocument2 = (_a2 = trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0];
|
|
31267
30850
|
return {
|
|
31268
30851
|
...constitutionalDocument2 && {
|
|
31269
30852
|
trustConstitutionalDocument: {
|
|
@@ -31276,28 +30859,59 @@ function TrustDropinComponent(props) {
|
|
|
31276
30859
|
const value = getProp(data2, detail);
|
|
31277
30860
|
return !isEmpty(value);
|
|
31278
30861
|
});
|
|
31279
|
-
|
|
31280
|
-
|
|
31281
|
-
|
|
31282
|
-
|
|
30862
|
+
const baseTrackingPayload = getBaseTrackingPayload({
|
|
30863
|
+
trackingConfig,
|
|
30864
|
+
parentLegalEntity,
|
|
30865
|
+
legalEntity: legalEntityResponse,
|
|
30866
|
+
task: taskType
|
|
30867
|
+
});
|
|
30868
|
+
const {
|
|
30869
|
+
handleNextClick,
|
|
30870
|
+
handleBackClick,
|
|
30871
|
+
activeForm,
|
|
30872
|
+
shouldValidate,
|
|
30873
|
+
setShouldValidate,
|
|
30874
|
+
gotoFormByFormIndex,
|
|
30875
|
+
nextButtonLabel
|
|
30876
|
+
} = useFormComposer({
|
|
30877
|
+
problems,
|
|
30878
|
+
baseTrackingPayload,
|
|
30879
|
+
forms: forms2,
|
|
30880
|
+
formRef,
|
|
30881
|
+
onSubmit
|
|
30882
|
+
});
|
|
30883
|
+
return jsx(FormWrapper, {
|
|
30884
|
+
taskName: "trustDetails",
|
|
30885
|
+
handleNextClick,
|
|
30886
|
+
handleBackClick,
|
|
30887
|
+
gotoFormByFormIndex,
|
|
30888
|
+
nextButtonLabel,
|
|
30889
|
+
loadingStatus,
|
|
30890
|
+
forms: forms2,
|
|
30891
|
+
activeForm,
|
|
30892
|
+
baseTrackingPayload,
|
|
30893
|
+
onSubmit,
|
|
30894
|
+
hideDropinLayout,
|
|
30895
|
+
handleHomeClick,
|
|
30896
|
+
homeButtonLabel,
|
|
30897
|
+
validateForm: () => setShouldValidate(true),
|
|
30898
|
+
canSubmit: canSubmit2(data) && hasDataChanged(dataFromResponse, data),
|
|
30899
|
+
problems,
|
|
30900
|
+
summary: {
|
|
30901
|
+
data: formatDataForSummary2(data, forms2),
|
|
30902
|
+
omittedKeys: ["operationalAddressIsSame"]
|
|
30903
|
+
},
|
|
30904
|
+
children: jsx(TrustComponent, {
|
|
30905
|
+
...derivedProps,
|
|
30906
|
+
activeForm,
|
|
30907
|
+
capabilities,
|
|
31283
30908
|
data,
|
|
31284
|
-
country:
|
|
30909
|
+
country: ((_a = data == null ? void 0 : data.trustRegistrationDetails) == null ? void 0 : _a.country) ?? country2,
|
|
31285
30910
|
problems,
|
|
31286
|
-
eventEmitter: props.eventEmitter,
|
|
31287
|
-
hideDropinLayout: props.hideDropinLayout,
|
|
31288
|
-
onChange: props.onChange,
|
|
31289
|
-
handleHomeClick: props.handleHomeClick,
|
|
31290
|
-
homeButtonLabel: props.homeButtonLabel,
|
|
31291
|
-
onSubmit,
|
|
31292
|
-
legalEntityType: LegalEntityType.TRUST,
|
|
31293
|
-
legalEntityResponse,
|
|
31294
|
-
summary: {
|
|
31295
|
-
formatData: formatDataForSummary2,
|
|
31296
|
-
getOmittedKeys
|
|
31297
|
-
},
|
|
31298
|
-
canSubmit: canSubmit2,
|
|
31299
30911
|
handleAddressSearch,
|
|
31300
|
-
handleFindAddress
|
|
30912
|
+
handleFindAddress,
|
|
30913
|
+
shouldValidate,
|
|
30914
|
+
ref: formRef
|
|
31301
30915
|
})
|
|
31302
30916
|
});
|
|
31303
30917
|
}
|
|
@@ -31315,7 +30929,7 @@ function DropinComposerComponent({
|
|
|
31315
30929
|
onNavigate = noop,
|
|
31316
30930
|
...args
|
|
31317
30931
|
}) {
|
|
31318
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
30932
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
31319
30933
|
const {
|
|
31320
30934
|
contextCountry,
|
|
31321
30935
|
accountHolder: accountHolder2,
|
|
@@ -32209,7 +31823,7 @@ function DropinComposerComponent({
|
|
|
32209
31823
|
onSubmit: componentOnSubmit,
|
|
32210
31824
|
handleHomeClick: navigateBack,
|
|
32211
31825
|
homeButtonLabel: i18n.get("saveAndGoToOverview"),
|
|
32212
|
-
country: (
|
|
31826
|
+
country: (((_k = solePropietor == null ? void 0 : solePropietor.soleProprietorship) == null ? void 0 : _k.countryOfGoverningLaw) || ((_m = (_l = solePropietor == null ? void 0 : solePropietor.soleProprietorship) == null ? void 0 : _l.registeredAddress) == null ? void 0 : _m.country)) ?? rootLegalEntityCountry,
|
|
32213
31827
|
handleAddressSearch: args == null ? void 0 : args.handleAddressSearch,
|
|
32214
31828
|
handleFindAddress: args == null ? void 0 : args.handleFindAddress
|
|
32215
31829
|
});
|
|
@@ -32800,6 +32414,64 @@ const AuthProvider = ({
|
|
|
32800
32414
|
children
|
|
32801
32415
|
});
|
|
32802
32416
|
};
|
|
32417
|
+
const fontFormats = ["eot", "woff", "woff2", "ttf", "otf"];
|
|
32418
|
+
const formatFullNames = {
|
|
32419
|
+
eot: "embedded-opentype",
|
|
32420
|
+
woff: "woff",
|
|
32421
|
+
woff2: "woff2",
|
|
32422
|
+
ttf: "truetype",
|
|
32423
|
+
otf: "opentype"
|
|
32424
|
+
};
|
|
32425
|
+
const getFontFaceRule = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
32426
|
+
const fontSources = formats.map((format) => `url(${fontPath}.${format}) format(${formatFullNames[format]})`);
|
|
32427
|
+
const ruleLines = [`font-family: '${fontFamily}'`, `font-style: ${fontStyle}`, `font-weight: ${fontWeight}`, `src: ${fontSources.join(",")}`];
|
|
32428
|
+
return `@font-face {${ruleLines.join(";")}}`;
|
|
32429
|
+
};
|
|
32430
|
+
const addStyleTagForFont = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
32431
|
+
const style = document.createElement("style");
|
|
32432
|
+
style.setAttribute("type", "text/css");
|
|
32433
|
+
style.innerText = getFontFaceRule(fontFamily, fontStyle, fontWeight, fontPath, formats);
|
|
32434
|
+
document.head.insertBefore(style, document.head.firstChild);
|
|
32435
|
+
};
|
|
32436
|
+
const addStyleTagForADLIconFont = (loadingContext) => {
|
|
32437
|
+
const fontPath = `${loadingContext}static/fonts`;
|
|
32438
|
+
const iconFontPath = `${fontPath}/adyen-kyc-icons`;
|
|
32439
|
+
addStyleTagForFont("adyen-kyc-icons", "normal", "normal", iconFontPath, fontFormats);
|
|
32440
|
+
};
|
|
32441
|
+
let isFlagsLoaded = false;
|
|
32442
|
+
let isDocumentGuidanceLoaded = false;
|
|
32443
|
+
const getIconContainer = () => {
|
|
32444
|
+
const container = document.createElement("div");
|
|
32445
|
+
container.setAttribute("aria-hidden", "true");
|
|
32446
|
+
container.setAttribute("id", "adl-icon-container");
|
|
32447
|
+
container.style.height = "0";
|
|
32448
|
+
return container;
|
|
32449
|
+
};
|
|
32450
|
+
const buildSpriteDOMFromResponse = (responseData) => {
|
|
32451
|
+
const iconContainer = getIconContainer();
|
|
32452
|
+
iconContainer.innerHTML = responseData;
|
|
32453
|
+
return iconContainer;
|
|
32454
|
+
};
|
|
32455
|
+
const loadFlags = async (loadingContext) => {
|
|
32456
|
+
if (isFlagsLoaded)
|
|
32457
|
+
return;
|
|
32458
|
+
isFlagsLoaded = true;
|
|
32459
|
+
const responseData = await http({
|
|
32460
|
+
loadingContext,
|
|
32461
|
+
path: "static/images/country-flags.svg"
|
|
32462
|
+
}, null, "text");
|
|
32463
|
+
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
32464
|
+
};
|
|
32465
|
+
const loadDocumentGuidance = async (loadingContext) => {
|
|
32466
|
+
if (isDocumentGuidanceLoaded)
|
|
32467
|
+
return;
|
|
32468
|
+
isDocumentGuidanceLoaded = true;
|
|
32469
|
+
const responseData = await http({
|
|
32470
|
+
loadingContext,
|
|
32471
|
+
path: "static/images/document-guidance.svg"
|
|
32472
|
+
}, null, "text");
|
|
32473
|
+
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
32474
|
+
};
|
|
32803
32475
|
const accountFormatsImports = /* @__PURE__ */ Object.assign({ "./AD.json": () => import("./AD-43128b9f.mjs"), "./AE.json": () => import("./AE-81598d61.mjs"), "./AG.json": () => import("./AG-ed98ae0e.mjs"), "./AI.json": () => import("./AI-3e78c886.mjs"), "./AL.json": () => import("./AL-3ad2778a.mjs"), "./AM.json": () => import("./AM-6a5175fb.mjs"), "./AN.json": () => import("./AN-311f7139.mjs"), "./AO.json": () => import("./AO-99b5ef59.mjs"), "./AQ.json": () => import("./AQ-effe27c7.mjs"), "./AR.json": () => import("./AR-4013d95c.mjs"), "./AS.json": () => import("./AS-f15d56b2.mjs"), "./AT.json": () => import("./AT-d4d62b74.mjs"), "./AU.json": () => import("./AU-b9cba969.mjs"), "./AW.json": () => import("./AW-581f73fb.mjs"), "./AX.json": () => import("./AX-07af957a.mjs"), "./AZ.json": () => import("./AZ-be214142.mjs"), "./BA.json": () => import("./BA-af4be83f.mjs"), "./BB.json": () => import("./BB-df28f015.mjs"), "./BD.json": () => import("./BD-7aef0af6.mjs"), "./BE.json": () => import("./BE-fc7cf8d5.mjs"), "./BF.json": () => import("./BF-090b06e2.mjs"), "./BG.json": () => import("./BG-1f54cf4f.mjs"), "./BH.json": () => import("./BH-1e9cc2b9.mjs"), "./BJ.json": () => import("./BJ-d5dd5c6f.mjs"), "./BM.json": () => import("./BM-a808b13f.mjs"), "./BN.json": () => import("./BN-b13f6f6a.mjs"), "./BR.json": () => import("./BR-55d93100.mjs"), "./BS.json": () => import("./BS-db6a5bce.mjs"), "./BT.json": () => import("./BT-dfed2604.mjs"), "./BV.json": () => import("./BV-e123b0a8.mjs"), "./BW.json": () => import("./BW-08473bd7.mjs"), "./BY.json": () => import("./BY-2762d989.mjs"), "./BZ.json": () => import("./BZ-7f28b1ff.mjs"), "./CA.json": () => import("./CA-aa1f78ab.mjs"), "./CC.json": () => import("./CC-2cc6ac39.mjs"), "./CF.json": () => import("./CF-78ae0244.mjs"), "./CH.json": () => import("./CH-47f538c0.mjs"), "./CI.json": () => import("./CI-10feb889.mjs"), "./CK.json": () => import("./CK-e308c734.mjs"), "./CL.json": () => import("./CL-4a6c3e0b.mjs"), "./CM.json": () => import("./CM-fddc630d.mjs"), "./CN.json": () => import("./CN-46bb9203.mjs"), "./CO.json": () => import("./CO-1b150cda.mjs"), "./CR.json": () => import("./CR-2bf50f66.mjs"), "./CU.json": () => import("./CU-904aea8f.mjs"), "./CX.json": () => import("./CX-750ccd92.mjs"), "./CY.json": () => import("./CY-1508b23e.mjs"), "./CZ.json": () => import("./CZ-b6eaa1d5.mjs"), "./DE.json": () => import("./DE-e02051d4.mjs"), "./DJ.json": () => import("./DJ-0032728a.mjs"), "./DK.json": () => import("./DK-6116657e.mjs"), "./DM.json": () => import("./DM-a2c158c9.mjs"), "./DO.json": () => import("./DO-cedffa27.mjs"), "./DZ.json": () => import("./DZ-d44be6f8.mjs"), "./EC.json": () => import("./EC-c2e5813b.mjs"), "./EE.json": () => import("./EE-1a10f52d.mjs"), "./EG.json": () => import("./EG-8f29aebd.mjs"), "./EH.json": () => import("./EH-2dafda3e.mjs"), "./ES.json": () => import("./ES-42b3562e.mjs"), "./ET.json": () => import("./ET-ffa87ef0.mjs"), "./FI.json": () => import("./FI-8e3bb2bb.mjs"), "./FJ.json": () => import("./FJ-088ea689.mjs"), "./FK.json": () => import("./FK-16d84ff5.mjs"), "./FM.json": () => import("./FM-32616e6f.mjs"), "./FO.json": () => import("./FO-62c08e45.mjs"), "./FR.json": () => import("./FR-3db03e20.mjs"), "./GA.json": () => import("./GA-4de2f994.mjs"), "./GB.json": () => import("./GB-28ea0b5a.mjs"), "./GD.json": () => import("./GD-0ad67069.mjs"), "./GE.json": () => import("./GE-0f594b35.mjs"), "./GF.json": () => import("./GF-a062cea7.mjs"), "./GG.json": () => import("./GG-e00581ea.mjs"), "./GH.json": () => import("./GH-80209e7e.mjs"), "./GI.json": () => import("./GI-b0f7c8b3.mjs"), "./GL.json": () => import("./GL-8f5e8ba9.mjs"), "./GM.json": () => import("./GM-ff3ca013.mjs"), "./GN.json": () => import("./GN-fc7c0f8c.mjs"), "./GP.json": () => import("./GP-68f23382.mjs"), "./GQ.json": () => import("./GQ-f9867fbd.mjs"), "./GR.json": () => import("./GR-64a2d25c.mjs"), "./GS.json": () => import("./GS-49ce0f4c.mjs"), "./GT.json": () => import("./GT-fa779b14.mjs"), "./GU.json": () => import("./GU-f0dceb37.mjs"), "./GW.json": () => import("./GW-471336ea.mjs"), "./GY.json": () => import("./GY-2889ae39.mjs"), "./HK.json": () => import("./HK-675b8651.mjs"), "./HM.json": () => import("./HM-924a724f.mjs"), "./HN.json": () => import("./HN-6dae206e.mjs"), "./HR.json": () => import("./HR-85763090.mjs"), "./HT.json": () => import("./HT-a659da85.mjs"), "./HU.json": () => import("./HU-f9ea5037.mjs"), "./ID.json": () => import("./ID-cb5cfce1.mjs"), "./IE.json": () => import("./IE-b341cbd2.mjs"), "./IL.json": () => import("./IL-657901df.mjs"), "./IM.json": () => import("./IM-5bd6279a.mjs"), "./IN.json": () => import("./IN-3c11df0e.mjs"), "./IO.json": () => import("./IO-24f6d2e7.mjs"), "./IQ.json": () => import("./IQ-241c0148.mjs"), "./IS.json": () => import("./IS-4a7e436f.mjs"), "./IT.json": () => import("./IT-f9755e76.mjs"), "./JE.json": () => import("./JE-46968fa2.mjs"), "./JM.json": () => import("./JM-a6657a34.mjs"), "./JO.json": () => import("./JO-bd1eabea.mjs"), "./JP.json": () => import("./JP-9b5a30fa.mjs"), "./KE.json": () => import("./KE-2a866579.mjs"), "./KG.json": () => import("./KG-7713761d.mjs"), "./KH.json": () => import("./KH-a5f0f831.mjs"), "./KI.json": () => import("./KI-8376e298.mjs"), "./KM.json": () => import("./KM-48c8c9c0.mjs"), "./KN.json": () => import("./KN-b34777c7.mjs"), "./KR.json": () => import("./KR-8bcf8499.mjs"), "./KW.json": () => import("./KW-4dd6ab01.mjs"), "./KY.json": () => import("./KY-4f921c93.mjs"), "./KZ.json": () => import("./KZ-68b655f3.mjs"), "./LA.json": () => import("./LA-582a34e2.mjs"), "./LB.json": () => import("./LB-7e5023a3.mjs"), "./LC.json": () => import("./LC-4e610f91.mjs"), "./LI.json": () => import("./LI-3979434e.mjs"), "./LK.json": () => import("./LK-23f5002d.mjs"), "./LT.json": () => import("./LT-2076ca77.mjs"), "./LU.json": () => import("./LU-b0538582.mjs"), "./LV.json": () => import("./LV-440617df.mjs"), "./MA.json": () => import("./MA-f2af9aa6.mjs"), "./MC.json": () => import("./MC-f619d821.mjs"), "./MD.json": () => import("./MD-ffe4e2f4.mjs"), "./ME.json": () => import("./ME-46686aa8.mjs"), "./MH.json": () => import("./MH-c535387d.mjs"), "./MK.json": () => import("./MK-11442cf1.mjs"), "./ML.json": () => import("./ML-b2c3720e.mjs"), "./MM.json": () => import("./MM-0ae1a124.mjs"), "./MN.json": () => import("./MN-baba0d9d.mjs"), "./MO.json": () => import("./MO-2c51f9f7.mjs"), "./MP.json": () => import("./MP-55044c4b.mjs"), "./MQ.json": () => import("./MQ-aaefd2b2.mjs"), "./MR.json": () => import("./MR-f122a6f0.mjs"), "./MS.json": () => import("./MS-7623ec5f.mjs"), "./MT.json": () => import("./MT-315c76bb.mjs"), "./MU.json": () => import("./MU-126673fe.mjs"), "./MV.json": () => import("./MV-d8748aca.mjs"), "./MW.json": () => import("./MW-26492427.mjs"), "./MX.json": () => import("./MX-ca79b44b.mjs"), "./MY.json": () => import("./MY-443e729e.mjs"), "./MZ.json": () => import("./MZ-192a5094.mjs"), "./NC.json": () => import("./NC-3849aac0.mjs"), "./NE.json": () => import("./NE-bf76bc84.mjs"), "./NF.json": () => import("./NF-46f5dffa.mjs"), "./NG.json": () => import("./NG-458396e5.mjs"), "./NI.json": () => import("./NI-efe8c864.mjs"), "./NL.json": () => import("./NL-3e38d0eb.mjs"), "./NO.json": () => import("./NO-088fac56.mjs"), "./NP.json": () => import("./NP-26b20587.mjs"), "./NR.json": () => import("./NR-ba1f7da1.mjs"), "./NU.json": () => import("./NU-6dc3ed45.mjs"), "./NZ.json": () => import("./NZ-12ed2cb9.mjs"), "./OM.json": () => import("./OM-4976855b.mjs"), "./PA.json": () => import("./PA-3b45122a.mjs"), "./PE.json": () => import("./PE-ad6e8281.mjs"), "./PF.json": () => import("./PF-2b1b6f30.mjs"), "./PG.json": () => import("./PG-b94ea47f.mjs"), "./PH.json": () => import("./PH-1b96a1eb.mjs"), "./PK.json": () => import("./PK-35cadd30.mjs"), "./PL.json": () => import("./PL-6a490cd1.mjs"), "./PM.json": () => import("./PM-d508f3c5.mjs"), "./PN.json": () => import("./PN-1f6ccf43.mjs"), "./PR.json": () => import("./PR-730f2830.mjs"), "./PS.json": () => import("./PS-f3ef78cd.mjs"), "./PT.json": () => import("./PT-66954cea.mjs"), "./PW.json": () => import("./PW-0d1c7797.mjs"), "./PY.json": () => import("./PY-c8e58794.mjs"), "./QA.json": () => import("./QA-35be8b1e.mjs"), "./RE.json": () => import("./RE-9f92ed9b.mjs"), "./RO.json": () => import("./RO-5c62edb1.mjs"), "./RS.json": () => import("./RS-bc256d90.mjs"), "./RU.json": () => import("./RU-bbee5e73.mjs"), "./RW.json": () => import("./RW-95b5d859.mjs"), "./SA.json": () => import("./SA-69b2f72a.mjs"), "./SB.json": () => import("./SB-567c239a.mjs"), "./SC.json": () => import("./SC-9e5a0d31.mjs"), "./SE.json": () => import("./SE-4ed53265.mjs"), "./SG.json": () => import("./SG-970463e3.mjs"), "./SH.json": () => import("./SH-d8ab21b7.mjs"), "./SI.json": () => import("./SI-3b6d3545.mjs"), "./SJ.json": () => import("./SJ-e3430cfd.mjs"), "./SK.json": () => import("./SK-2385e057.mjs"), "./SL.json": () => import("./SL-92bf45d9.mjs"), "./SM.json": () => import("./SM-bafbc267.mjs"), "./SN.json": () => import("./SN-5733e740.mjs"), "./SO.json": () => import("./SO-d5b69054.mjs"), "./SR.json": () => import("./SR-0a8c71c0.mjs"), "./ST.json": () => import("./ST-d40d86c1.mjs"), "./TC.json": () => import("./TC-ccbc7116.mjs"), "./TD.json": () => import("./TD-679d137c.mjs"), "./TF.json": () => import("./TF-6bfcf75d.mjs"), "./TG.json": () => import("./TG-a20ef9ed.mjs"), "./TH.json": () => import("./TH-e39a447c.mjs"), "./TK.json": () => import("./TK-89a81d38.mjs"), "./TL.json": () => import("./TL-8d6ca9b7.mjs"), "./TN.json": () => import("./TN-6e746476.mjs"), "./TO.json": () => import("./TO-a8c55d73.mjs"), "./TR.json": () => import("./TR-b1175ddc.mjs"), "./TT.json": () => import("./TT-5c4a3940.mjs"), "./TV.json": () => import("./TV-e1a267b9.mjs"), "./TW.json": () => import("./TW-9e0e34fa.mjs"), "./TZ.json": () => import("./TZ-c8a8159b.mjs"), "./UA.json": () => import("./UA-7014199a.mjs"), "./UG.json": () => import("./UG-1fe39fa7.mjs"), "./UM.json": () => import("./UM-3fcbf872.mjs"), "./US.json": () => import("./US-6fbdfc0c.mjs"), "./UY.json": () => import("./UY-e6d05d75.mjs"), "./UZ.json": () => import("./UZ-433656c8.mjs"), "./VA.json": () => import("./VA-e8e13d32.mjs"), "./VC.json": () => import("./VC-331669c0.mjs"), "./VE.json": () => import("./VE-5e7b0d3b.mjs"), "./VG.json": () => import("./VG-43e85e33.mjs"), "./VI.json": () => import("./VI-3d9d6d8b.mjs"), "./VN.json": () => import("./VN-9442a8c1.mjs"), "./VU.json": () => import("./VU-96fae02f.mjs"), "./WF.json": () => import("./WF-90a27056.mjs"), "./WS.json": () => import("./WS-ddcb2b71.mjs"), "./YE.json": () => import("./YE-02c4c81e.mjs"), "./YT.json": () => import("./YT-33751cc9.mjs"), "./ZA.json": () => import("./ZA-0084b083.mjs"), "./ZM.json": () => import("./ZM-c6a4d6cc.mjs") });
|
|
32804
32476
|
const getAccountFormatsForCountry = async (country2) => {
|
|
32805
32477
|
const importForCountry = accountFormatsImports[`./${country2}.json`];
|
|
@@ -33248,6 +32920,182 @@ function SettingsContextProvider({
|
|
|
33248
32920
|
children
|
|
33249
32921
|
});
|
|
33250
32922
|
}
|
|
32923
|
+
function removeObjectPropsWithEmptyValues(obj) {
|
|
32924
|
+
keysOf(obj).forEach((key) => {
|
|
32925
|
+
if (obj[key] === null || isEmpty(obj[key]))
|
|
32926
|
+
delete obj[key];
|
|
32927
|
+
});
|
|
32928
|
+
return obj;
|
|
32929
|
+
}
|
|
32930
|
+
const INITIAL_STATE = {
|
|
32931
|
+
data: {},
|
|
32932
|
+
allData: {},
|
|
32933
|
+
initialData: {},
|
|
32934
|
+
errors: {},
|
|
32935
|
+
valid: {},
|
|
32936
|
+
fieldProblems: {},
|
|
32937
|
+
isValid: false
|
|
32938
|
+
};
|
|
32939
|
+
function StateReducer() {
|
|
32940
|
+
const [schemas, setSchemas] = useState({});
|
|
32941
|
+
const [activeForms, setActiveForms] = useState([]);
|
|
32942
|
+
const setCurrentForms = (forms2) => {
|
|
32943
|
+
setActiveForms(forms2);
|
|
32944
|
+
};
|
|
32945
|
+
function reducer2({
|
|
32946
|
+
currentState: currState
|
|
32947
|
+
}, action) {
|
|
32948
|
+
var _a, _b, _c;
|
|
32949
|
+
switch (action.type) {
|
|
32950
|
+
case "addToState": {
|
|
32951
|
+
const state2 = structuredClone(currState);
|
|
32952
|
+
const dataStoreId = action.value.dataStoreId ?? action.value.caller;
|
|
32953
|
+
const schema = action.value.schema || null;
|
|
32954
|
+
const schemaHasChanged = schema && ((_a = schemas == null ? void 0 : schemas[dataStoreId]) == null ? void 0 : _a.toString()) !== schema.toString();
|
|
32955
|
+
const mergedState = {
|
|
32956
|
+
...state2,
|
|
32957
|
+
data: {
|
|
32958
|
+
...state2.data,
|
|
32959
|
+
[dataStoreId]: {
|
|
32960
|
+
...state2.data[dataStoreId],
|
|
32961
|
+
...action.value.data
|
|
32962
|
+
}
|
|
32963
|
+
},
|
|
32964
|
+
// Add data in allData state prop in case we will need them later
|
|
32965
|
+
allData: {
|
|
32966
|
+
...state2.allData,
|
|
32967
|
+
[dataStoreId]: {
|
|
32968
|
+
...state2.allData[dataStoreId],
|
|
32969
|
+
...removeObjectPropsWithEmptyValues(action.value.data)
|
|
32970
|
+
}
|
|
32971
|
+
},
|
|
32972
|
+
errors: {
|
|
32973
|
+
...state2.errors,
|
|
32974
|
+
[dataStoreId]: {
|
|
32975
|
+
...state2.errors[dataStoreId],
|
|
32976
|
+
...action.value.errors
|
|
32977
|
+
}
|
|
32978
|
+
},
|
|
32979
|
+
valid: {
|
|
32980
|
+
...state2.valid,
|
|
32981
|
+
[dataStoreId]: {
|
|
32982
|
+
...state2.valid[dataStoreId],
|
|
32983
|
+
...action.value.valid
|
|
32984
|
+
}
|
|
32985
|
+
},
|
|
32986
|
+
fieldProblems: {
|
|
32987
|
+
...state2.fieldProblems,
|
|
32988
|
+
[dataStoreId]: {
|
|
32989
|
+
...state2.fieldProblems[dataStoreId],
|
|
32990
|
+
...action.value.fieldProblems
|
|
32991
|
+
}
|
|
32992
|
+
}
|
|
32993
|
+
};
|
|
32994
|
+
if (schemaHasChanged) {
|
|
32995
|
+
setSchemas({
|
|
32996
|
+
...schemas,
|
|
32997
|
+
[dataStoreId]: schema
|
|
32998
|
+
});
|
|
32999
|
+
const processedBySchema = schema.reduce((acc, fieldKey) => {
|
|
33000
|
+
const dataObjByFormId = mergedState.data[dataStoreId];
|
|
33001
|
+
const allDataObjByFormId = mergedState.allData[dataStoreId];
|
|
33002
|
+
const validObjByFormId = mergedState.valid[dataStoreId];
|
|
33003
|
+
const errorsObjByFormId = mergedState.errors[dataStoreId];
|
|
33004
|
+
const fieldProblemsObjByFormId = mergedState.fieldProblems[dataStoreId];
|
|
33005
|
+
return {
|
|
33006
|
+
data: {
|
|
33007
|
+
...acc.data,
|
|
33008
|
+
[fieldKey]: dataObjByFormId[fieldKey] ?? allDataObjByFormId[fieldKey]
|
|
33009
|
+
},
|
|
33010
|
+
valid: {
|
|
33011
|
+
...acc.valid,
|
|
33012
|
+
[fieldKey]: validObjByFormId[fieldKey]
|
|
33013
|
+
},
|
|
33014
|
+
errors: {
|
|
33015
|
+
...acc.errors,
|
|
33016
|
+
[fieldKey]: errorsObjByFormId[fieldKey]
|
|
33017
|
+
},
|
|
33018
|
+
fieldProblems: {
|
|
33019
|
+
...acc.fieldProblems,
|
|
33020
|
+
[fieldKey]: fieldProblemsObjByFormId[fieldKey]
|
|
33021
|
+
}
|
|
33022
|
+
};
|
|
33023
|
+
}, {
|
|
33024
|
+
data: {},
|
|
33025
|
+
valid: {},
|
|
33026
|
+
errors: {},
|
|
33027
|
+
fieldProblems: {}
|
|
33028
|
+
});
|
|
33029
|
+
mergedState.data[dataStoreId] = processedBySchema.data;
|
|
33030
|
+
mergedState.valid[dataStoreId] = processedBySchema.valid;
|
|
33031
|
+
mergedState.errors[dataStoreId] = processedBySchema.errors;
|
|
33032
|
+
mergedState.fieldProblems[dataStoreId] = processedBySchema.fieldProblems;
|
|
33033
|
+
}
|
|
33034
|
+
mergedState.validityByForm = {
|
|
33035
|
+
...mergedState.validityByForm,
|
|
33036
|
+
[dataStoreId]: Object.values(mergedState.valid[dataStoreId]).every((isValid) => isValid)
|
|
33037
|
+
};
|
|
33038
|
+
mergedState.allValid = Object.values(mergedState.validityByForm).every((isValid) => isValid);
|
|
33039
|
+
mergedState.isValid = !activeForms.length ? mergedState.allValid : activeForms.every((item) => mergedState.validityByForm[item]);
|
|
33040
|
+
mergedState.initialData = structuredClone(state2.initialData);
|
|
33041
|
+
return {
|
|
33042
|
+
currentState: mergedState,
|
|
33043
|
+
prevState: state2,
|
|
33044
|
+
changeInitiatedBy: dataStoreId
|
|
33045
|
+
};
|
|
33046
|
+
}
|
|
33047
|
+
case "resetState": {
|
|
33048
|
+
const dataStoreId = ((_b = action.value) == null ? void 0 : _b.dataStoreId) ?? ((_c = action.value) == null ? void 0 : _c.caller);
|
|
33049
|
+
return {
|
|
33050
|
+
currentState: INITIAL_STATE,
|
|
33051
|
+
prevState: currState,
|
|
33052
|
+
changeInitiatedBy: dataStoreId
|
|
33053
|
+
};
|
|
33054
|
+
}
|
|
33055
|
+
default: {
|
|
33056
|
+
throw new Error(`Unhandled action type: ${action.type}`);
|
|
33057
|
+
}
|
|
33058
|
+
}
|
|
33059
|
+
}
|
|
33060
|
+
return {
|
|
33061
|
+
reducer: reducer2,
|
|
33062
|
+
setCurrentForms
|
|
33063
|
+
};
|
|
33064
|
+
}
|
|
33065
|
+
function StateProvider({
|
|
33066
|
+
defaultData = {},
|
|
33067
|
+
children
|
|
33068
|
+
}) {
|
|
33069
|
+
const defaultState = {
|
|
33070
|
+
currentState: {
|
|
33071
|
+
data: defaultData,
|
|
33072
|
+
allData: defaultData,
|
|
33073
|
+
valid: {},
|
|
33074
|
+
errors: {},
|
|
33075
|
+
fieldProblems: {},
|
|
33076
|
+
validityByForm: {},
|
|
33077
|
+
initialData: defaultData
|
|
33078
|
+
},
|
|
33079
|
+
prevState: {},
|
|
33080
|
+
changeInitiatedBy: null
|
|
33081
|
+
};
|
|
33082
|
+
const reducerObj = StateReducer();
|
|
33083
|
+
const [state2, dispatch] = useReducer(reducerObj.reducer, defaultState);
|
|
33084
|
+
const contextValue = useMemo(() => ({
|
|
33085
|
+
state: state2,
|
|
33086
|
+
dispatch,
|
|
33087
|
+
setActiveForms: reducerObj.setCurrentForms,
|
|
33088
|
+
getData: () => {
|
|
33089
|
+
var _a;
|
|
33090
|
+
return ((_a = state2 == null ? void 0 : state2.currentState) == null ? void 0 : _a.data) ?? {};
|
|
33091
|
+
},
|
|
33092
|
+
getState: () => state2 == null ? void 0 : state2.currentState
|
|
33093
|
+
}), [reducerObj, state2]);
|
|
33094
|
+
return jsx(StateContext.Provider, {
|
|
33095
|
+
value: contextValue,
|
|
33096
|
+
children
|
|
33097
|
+
});
|
|
33098
|
+
}
|
|
33251
33099
|
function ToastContextProvider({
|
|
33252
33100
|
children
|
|
33253
33101
|
}) {
|