@adyen/kyc-components 3.1.1 → 3.2.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 +1186 -1275
- 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 +10 -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 +1 -1
- 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/internal/Summary/index.d.ts +0 -1
- /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";
|
|
@@ -278,7 +278,7 @@ const serviceAgreementSignFailed = "Service agreement signing failed";
|
|
|
278
278
|
const failedToGetServiceAgreementStatus = "Failed to get the service agreement status";
|
|
279
279
|
const failedToGetServiceAgreement = "Failed to get the service agreement";
|
|
280
280
|
const failedToGetServiceAgreementInSelectedLanguageFallbackToEn = "Failed to get the service agreement in the selected language. Falling back to English.";
|
|
281
|
-
const iHaveReadAndIAcceptTheseTerms = "I have read and I accept these terms and confirm that I am a legal representative authorized to accept these terms on behalf of the company. I have taken notice of the privacy statement (www.adyen.com/privacy) and I consent to my (personal) data being used for the purposes described therein.";
|
|
281
|
+
const iHaveReadAndIAcceptTheseTerms = "I have read and I accept these terms and confirm that I am a legal representative authorized to accept these terms on behalf of the company. I have taken notice of the privacy statement (www.adyen.com/policies-and-disclaimer/privacy-policy) and I consent to my (personal) data being used for the purposes described therein.";
|
|
282
282
|
const verified = "Verified";
|
|
283
283
|
const signed = "Signed";
|
|
284
284
|
const invalidRole = "Please select a role";
|
|
@@ -847,13 +847,7 @@ const legalCompanyName__helperText__US = "Enter the name exactly as it appears o
|
|
|
847
847
|
const legalCompanyName__helperText__SG = "Enter the name exactly as it is on your Accounting and Corporate Regulatory Authority (ACRA) BizFile.";
|
|
848
848
|
const legalCompanyName__helperText__HK = "Enter the name exactly as it is on your Hong Kong Companies Registry's Certificate of Incorporation.";
|
|
849
849
|
const taxInformationNumber = "Tax Identification Number";
|
|
850
|
-
const
|
|
851
|
-
const taxInformationNumber__helperText__US = "Also known as Employer Identification Number (EIN), this is issued by the IRS to businesses operating in the US.";
|
|
852
|
-
const businessRegistrationNumber = "Business registration number";
|
|
853
|
-
const businessRegistrationNumber__optional = "Business registration number (optional)";
|
|
854
|
-
const businessRegistrationNumber__HK = "Business Registration number (BRN)";
|
|
855
|
-
const businessRegistrationNumber__helperText__US = "This can be found on your registration documents or any documents you receive from the registrar such as account reminders.";
|
|
856
|
-
const businessRegistrationNumber__placeholder__US = "1234567 AB";
|
|
850
|
+
const taxInformationNumber__HK = "Business Registration number (BRN)";
|
|
857
851
|
const stockExchangeMIC = "Stock Exchange MIC";
|
|
858
852
|
const stockExchangeMIC__US = "Market identifier code (MIC)";
|
|
859
853
|
const stockExchangeMIC__placeholder__US = "XABC";
|
|
@@ -1404,7 +1398,7 @@ const defaultTrans = {
|
|
|
1404
1398
|
doNotHaveRegonKrsNumber,
|
|
1405
1399
|
taxIdAbsenceReason,
|
|
1406
1400
|
vatNumberExempted,
|
|
1407
|
-
|
|
1401
|
+
vatAbsenceReason,
|
|
1408
1402
|
belowTaxThreshold,
|
|
1409
1403
|
industryExemption,
|
|
1410
1404
|
validationPleaseEnterAValidRegistrationNumber,
|
|
@@ -2070,13 +2064,7 @@ const defaultTrans = {
|
|
|
2070
2064
|
legalCompanyName__helperText__SG,
|
|
2071
2065
|
legalCompanyName__helperText__HK,
|
|
2072
2066
|
taxInformationNumber,
|
|
2073
|
-
|
|
2074
|
-
taxInformationNumber__helperText__US,
|
|
2075
|
-
businessRegistrationNumber,
|
|
2076
|
-
businessRegistrationNumber__optional,
|
|
2077
|
-
businessRegistrationNumber__HK,
|
|
2078
|
-
businessRegistrationNumber__helperText__US,
|
|
2079
|
-
businessRegistrationNumber__placeholder__US,
|
|
2067
|
+
taxInformationNumber__HK,
|
|
2080
2068
|
stockExchangeMIC,
|
|
2081
2069
|
stockExchangeMIC__US,
|
|
2082
2070
|
stockExchangeMIC__placeholder__US,
|
|
@@ -3341,36 +3329,36 @@ var LegalEntityType = /* @__PURE__ */ ((LegalEntityType2) => {
|
|
|
3341
3329
|
})(LegalEntityType || {});
|
|
3342
3330
|
function getFormProps(props, innerFormId) {
|
|
3343
3331
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
3344
|
-
if (innerFormId) {
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3332
|
+
if (!innerFormId) {
|
|
3333
|
+
return null;
|
|
3334
|
+
}
|
|
3335
|
+
const activeFormId = (_a = props.activeForm) == null ? void 0 : _a.formId;
|
|
3336
|
+
return {
|
|
3337
|
+
placeholders: ((_b = props.placeholders) == null ? void 0 : _b[innerFormId]) ?? {},
|
|
3338
|
+
labels: ((_c = props.labels) == null ? void 0 : _c[innerFormId]) ?? {},
|
|
3339
|
+
helperText: ((_d = props.helperText) == null ? void 0 : _d[innerFormId]) ?? {},
|
|
3340
|
+
masks: ((_e = props.masks) == null ? void 0 : _e[innerFormId]) ?? {},
|
|
3341
|
+
data: ((_f = props.data) == null ? void 0 : _f[innerFormId]) ?? {},
|
|
3342
|
+
readOnlyFields: ((_g = props.readOnlyFields) == null ? void 0 : _g[innerFormId]) ?? [],
|
|
3343
|
+
requiredFields: ((_h = props.requiredFields) == null ? void 0 : _h[innerFormId]) ?? [],
|
|
3344
|
+
optionalFields: ((_i = props.optionalFields) == null ? void 0 : _i[innerFormId]) ?? [],
|
|
3345
|
+
maskedFields: ((_j = props.maskedFields) == null ? void 0 : _j[innerFormId]) ?? [],
|
|
3346
|
+
verifyFields: ((_k = props.verifyFields) == null ? void 0 : _k[innerFormId]) ?? [],
|
|
3347
|
+
formVerificationErrors: ((_m = (_l = props.problems) == null ? void 0 : _l.verificationErrors) == null ? void 0 : _m[innerFormId]) ?? {},
|
|
3348
|
+
fieldValidationErrors: ((_o = (_n = props.problems) == null ? void 0 : _n.validationErrors) == null ? void 0 : _o[innerFormId]) ?? {},
|
|
3349
|
+
/*
|
|
3359
3350
|
Validators should be `null` and not `{}` by default to make it easier to short circuit it with predetermined validators.
|
|
3360
3351
|
For example `rules: props.validators || personalDetailsValidationRules`.
|
|
3361
3352
|
*/
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
activeForm check is required for shouldValidate because
|
|
3353
|
+
validators: ((_p = props.validators) == null ? void 0 : _p[innerFormId]) ? {
|
|
3354
|
+
...(_q = props.validators) == null ? void 0 : _q[innerFormId]
|
|
3355
|
+
} : null,
|
|
3356
|
+
/*
|
|
3357
|
+
activeForm check is required for shouldValidate because we render all forms in a multistep form.
|
|
3367
3358
|
Should be changed once stateManagement is fixed and this is no longer the case
|
|
3368
3359
|
*/
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
return nestedFormProps;
|
|
3372
|
-
}
|
|
3373
|
-
return null;
|
|
3360
|
+
shouldValidate: (activeFormId ? activeFormId === innerFormId : true) && props.shouldValidate
|
|
3361
|
+
};
|
|
3374
3362
|
}
|
|
3375
3363
|
function getFieldProps(props, innerFormFields) {
|
|
3376
3364
|
if (innerFormFields) {
|
|
@@ -6010,7 +5998,11 @@ const matchAgainstMask = (pureValue, mask) => {
|
|
|
6010
5998
|
}
|
|
6011
5999
|
}
|
|
6012
6000
|
};
|
|
6013
|
-
const deriveInputState = (isValid, isFocused, hasBlurred, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
|
|
6001
|
+
const deriveInputState = (isValid, isFocused, hasBlurred, isDisabled, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
|
|
6002
|
+
if (isDisabled)
|
|
6003
|
+
return {
|
|
6004
|
+
isError: false
|
|
6005
|
+
};
|
|
6014
6006
|
if (isValid && (!potentiallyMoreOptionalCharacters || !isFocused))
|
|
6015
6007
|
return {
|
|
6016
6008
|
isError: false,
|
|
@@ -6095,7 +6087,7 @@ const MaskedInputText = ({
|
|
|
6095
6087
|
}, [mask]);
|
|
6096
6088
|
const maskResult = useMemo(() => getMaskResult(value), [getMaskResult, value]);
|
|
6097
6089
|
const displayValue = maskResult.outcome === "mismatch" ? maskResult.partialDisplayValue : maskResult.displayValue;
|
|
6098
|
-
const inputState = deriveInputState(validationIsValid && maskResult.outcome !== "mismatch", isFocused, hasBlurred, errorMessage, shouldValidate, maskResult.outcome === "correct" && !!maskResult.potentialForMoreOptionalInput, formatGuidance, i18n);
|
|
6090
|
+
const inputState = deriveInputState(validationIsValid && maskResult.outcome !== "mismatch", isFocused, hasBlurred, disabled, errorMessage, shouldValidate, maskResult.outcome === "correct" && !!maskResult.potentialForMoreOptionalInput, formatGuidance, i18n);
|
|
6099
6091
|
useEffect(() => {
|
|
6100
6092
|
if (mask && maskResult.outcome === "mismatch") {
|
|
6101
6093
|
const strippedValue = displayValueToPure(value);
|
|
@@ -6123,6 +6115,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
6123
6115
|
helper: inputState.isError ? void 0 : inputState.text,
|
|
6124
6116
|
helperPosition: "below",
|
|
6125
6117
|
classNameModifiers: classNameModifiers == null ? void 0 : classNameModifiers.field,
|
|
6118
|
+
disabled,
|
|
6126
6119
|
children: ({
|
|
6127
6120
|
onBlurHandler: fieldOnBlur,
|
|
6128
6121
|
onFocusHandler: fieldOnFocus,
|
|
@@ -6727,10 +6720,10 @@ const validatePatternOnBlur = (pattern) => ({
|
|
|
6727
6720
|
modes: ["blur"],
|
|
6728
6721
|
validate: (val) => !!val && pattern.test(val)
|
|
6729
6722
|
});
|
|
6730
|
-
const defaultFieldMetadata$
|
|
6723
|
+
const defaultFieldMetadata$3 = {
|
|
6731
6724
|
label: "registrationNumber"
|
|
6732
6725
|
};
|
|
6733
|
-
const defaultFieldConfig$
|
|
6726
|
+
const defaultFieldConfig$3 = {
|
|
6734
6727
|
[CountryCodes.Australia]: {
|
|
6735
6728
|
label: "australianBusinessNumberAcn",
|
|
6736
6729
|
mask: businessRegistrationNumberMasks[CountryCodes.Australia].default,
|
|
@@ -6825,7 +6818,7 @@ const defaultFieldConfig$2 = {
|
|
|
6825
6818
|
key: "enterNDigitsForExample",
|
|
6826
6819
|
values: {
|
|
6827
6820
|
numDigits: "9",
|
|
6828
|
-
example: "
|
|
6821
|
+
example: "080020970"
|
|
6829
6822
|
}
|
|
6830
6823
|
}
|
|
6831
6824
|
},
|
|
@@ -7037,13 +7030,17 @@ const defaultFieldConfig$2 = {
|
|
|
7037
7030
|
default:
|
|
7038
7031
|
return {
|
|
7039
7032
|
label: "partitaIVA",
|
|
7040
|
-
|
|
7041
|
-
|
|
7033
|
+
validators: validatePatternOnBlur(/^\d{11}$/),
|
|
7034
|
+
mask: {
|
|
7035
|
+
mask: makeMask(...nonInputs("IT", {
|
|
7036
|
+
includeInValue: false
|
|
7037
|
+
}), spacer, ...numericInputs(11))
|
|
7038
|
+
},
|
|
7042
7039
|
guidanceText: {
|
|
7043
|
-
key: "
|
|
7040
|
+
key: "enterTheRemainingNDigitsForExample",
|
|
7044
7041
|
values: {
|
|
7045
7042
|
numDigits: "11",
|
|
7046
|
-
example: "
|
|
7043
|
+
example: "IT47040001100"
|
|
7047
7044
|
}
|
|
7048
7045
|
}
|
|
7049
7046
|
};
|
|
@@ -7379,7 +7376,7 @@ const defaultFieldConfig$2 = {
|
|
|
7379
7376
|
const businessRegistrationNumberFields = ["registrationNumber", "exemptedFromRegistrationNumber"];
|
|
7380
7377
|
function BusinessRegistrationNumber(props) {
|
|
7381
7378
|
var _a;
|
|
7382
|
-
const fieldConfig = props.fieldConfig ?? defaultFieldConfig$
|
|
7379
|
+
const fieldConfig = props.fieldConfig ?? defaultFieldConfig$3;
|
|
7383
7380
|
const {
|
|
7384
7381
|
i18n
|
|
7385
7382
|
} = useI18nContext();
|
|
@@ -7395,7 +7392,7 @@ function BusinessRegistrationNumber(props) {
|
|
|
7395
7392
|
const metadata = resolveFieldMetadata(fieldConfig[country2], {
|
|
7396
7393
|
companyType: companyType2,
|
|
7397
7394
|
registrationNumberType
|
|
7398
|
-
}, defaultFieldMetadata$
|
|
7395
|
+
}, defaultFieldMetadata$3);
|
|
7399
7396
|
const mergedProps = mergeFieldMetadataIntoProps("registrationNumber", metadata, {
|
|
7400
7397
|
requiredFields: schema
|
|
7401
7398
|
});
|
|
@@ -7964,7 +7961,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
7964
7961
|
}
|
|
7965
7962
|
const inferCompanyRegistrationNumberType = (registrationNumber2, country2, companyType2) => {
|
|
7966
7963
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
7967
|
-
const metadataFn = defaultFieldConfig$
|
|
7964
|
+
const metadataFn = defaultFieldConfig$3[country2];
|
|
7968
7965
|
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
7969
7966
|
return void 0;
|
|
7970
7967
|
for (const option of optionsForCountry) {
|
|
@@ -7980,10 +7977,10 @@ const inferCompanyRegistrationNumberType = (registrationNumber2, country2, compa
|
|
|
7980
7977
|
}
|
|
7981
7978
|
}
|
|
7982
7979
|
};
|
|
7983
|
-
const defaultFieldMetadata$
|
|
7980
|
+
const defaultFieldMetadata$2 = {
|
|
7984
7981
|
label: "taxId"
|
|
7985
7982
|
};
|
|
7986
|
-
const defaultFieldConfig$
|
|
7983
|
+
const defaultFieldConfig$2 = {
|
|
7987
7984
|
[CountryCodes.Canada]: {
|
|
7988
7985
|
label: "businessNumber",
|
|
7989
7986
|
validators: validatePatternOnBlur(/^\d{9}$/),
|
|
@@ -7999,7 +7996,7 @@ const defaultFieldConfig$1 = {
|
|
|
7999
7996
|
}
|
|
8000
7997
|
},
|
|
8001
7998
|
[CountryCodes.HongKong]: {
|
|
8002
|
-
label: "
|
|
7999
|
+
label: "taxInformationNumber__HK",
|
|
8003
8000
|
validators: validatePatternOnBlur(/^\d{8}$/),
|
|
8004
8001
|
mask: {
|
|
8005
8002
|
mask: makeMask(...numericInputs(8))
|
|
@@ -8084,7 +8081,7 @@ const defaultFieldConfig$1 = {
|
|
|
8084
8081
|
mask: {
|
|
8085
8082
|
mask: makeMask(...numericInputs(9))
|
|
8086
8083
|
},
|
|
8087
|
-
|
|
8084
|
+
guidanceText: {
|
|
8088
8085
|
key: "validationPleaseEnterAValidTaxIdNumberWithFormat",
|
|
8089
8086
|
values: {
|
|
8090
8087
|
format: "XXXXXXXXX"
|
|
@@ -8112,10 +8109,10 @@ const defaultFieldConfig$1 = {
|
|
|
8112
8109
|
validators: validatePatternOnBlur(/^\d{12}$/)
|
|
8113
8110
|
}
|
|
8114
8111
|
};
|
|
8115
|
-
const defaultFieldMetadata = {
|
|
8112
|
+
const defaultFieldMetadata$1 = {
|
|
8116
8113
|
label: "vatNumber"
|
|
8117
8114
|
};
|
|
8118
|
-
const defaultFieldConfig = {
|
|
8115
|
+
const defaultFieldConfig$1 = {
|
|
8119
8116
|
[CountryCodes.Austria]: {
|
|
8120
8117
|
label: "UST-ID",
|
|
8121
8118
|
validators: validatePatternOnBlur(/^ATU\d{8}$/),
|
|
@@ -8405,7 +8402,7 @@ const defaultFieldConfig = {
|
|
|
8405
8402
|
key: "enterTheRemainingNDigitsForExample",
|
|
8406
8403
|
values: {
|
|
8407
8404
|
numDigits: "11",
|
|
8408
|
-
example: "
|
|
8405
|
+
example: "IT47040001100"
|
|
8409
8406
|
}
|
|
8410
8407
|
}
|
|
8411
8408
|
},
|
|
@@ -8670,7 +8667,7 @@ const defaultFieldConfig = {
|
|
|
8670
8667
|
numDigits: "9",
|
|
8671
8668
|
minLetters: "3",
|
|
8672
8669
|
maxLetters: "4",
|
|
8673
|
-
example: "
|
|
8670
|
+
example: "CHE-123.456.789 TVA"
|
|
8674
8671
|
}
|
|
8675
8672
|
}
|
|
8676
8673
|
},
|
|
@@ -8744,7 +8741,7 @@ const defaultFieldConfig = {
|
|
|
8744
8741
|
};
|
|
8745
8742
|
const inferTaxIdNumberType = (taxId2, country2) => {
|
|
8746
8743
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
8747
|
-
const metadataFn = defaultFieldConfig[country2] ?? defaultFieldConfig$
|
|
8744
|
+
const metadataFn = defaultFieldConfig$1[country2] ?? defaultFieldConfig$2[country2];
|
|
8748
8745
|
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
8749
8746
|
return void 0;
|
|
8750
8747
|
for (const option of optionsForCountry) {
|
|
@@ -8800,11 +8797,11 @@ function TaxId(props) {
|
|
|
8800
8797
|
fieldValidationErrors,
|
|
8801
8798
|
dataStoreId,
|
|
8802
8799
|
taxIdNumberType,
|
|
8803
|
-
fieldConfig = defaultFieldConfig$
|
|
8800
|
+
fieldConfig = defaultFieldConfig$2
|
|
8804
8801
|
} = props;
|
|
8805
8802
|
const metadata = resolveFieldMetadata(fieldConfig[country2], {
|
|
8806
8803
|
taxIdNumberType
|
|
8807
|
-
}, defaultFieldMetadata$
|
|
8804
|
+
}, defaultFieldMetadata$2);
|
|
8808
8805
|
const mergedProps = mergeFieldMetadataIntoProps("taxId", metadata, props);
|
|
8809
8806
|
const {
|
|
8810
8807
|
i18n
|
|
@@ -8919,12 +8916,12 @@ function VatNumber(props) {
|
|
|
8919
8916
|
country: country2,
|
|
8920
8917
|
fieldValidationErrors,
|
|
8921
8918
|
dataStoreId,
|
|
8922
|
-
fieldConfig = defaultFieldConfig,
|
|
8919
|
+
fieldConfig = defaultFieldConfig$1,
|
|
8923
8920
|
vatNumberType
|
|
8924
8921
|
} = props;
|
|
8925
8922
|
const metadata = resolveFieldMetadata(fieldConfig[country2], {
|
|
8926
8923
|
vatNumberType
|
|
8927
|
-
}, defaultFieldMetadata);
|
|
8924
|
+
}, defaultFieldMetadata$1);
|
|
8928
8925
|
const mergedProps = mergeFieldMetadataIntoProps("vatNumber", metadata, props);
|
|
8929
8926
|
const {
|
|
8930
8927
|
i18n
|
|
@@ -9006,7 +9003,7 @@ function VatNumber(props) {
|
|
|
9006
9003
|
}), data.exemptedFromVat ? jsx(Field, {
|
|
9007
9004
|
name: "vatAbsenceReason",
|
|
9008
9005
|
classNameModifiers: ["tax-id-absence-reason"],
|
|
9009
|
-
label: formUtils.getLabel("vatAbsenceReason", "
|
|
9006
|
+
label: formUtils.getLabel("vatAbsenceReason", "vatAbsenceReason"),
|
|
9010
9007
|
errorMessage: formUtils.getErrorMessage("vatAbsenceReason", errors, fieldProblems),
|
|
9011
9008
|
isValid: valid.vatAbsenceReason,
|
|
9012
9009
|
children: (childProps) => jsx(Select, {
|
|
@@ -9018,7 +9015,7 @@ function VatNumber(props) {
|
|
|
9018
9015
|
id: reason,
|
|
9019
9016
|
name: i18n.get(reason)
|
|
9020
9017
|
})),
|
|
9021
|
-
placeholder: i18n.get("
|
|
9018
|
+
placeholder: i18n.get("vatAbsenceReason")
|
|
9022
9019
|
})
|
|
9023
9020
|
}) : null]
|
|
9024
9021
|
});
|
|
@@ -9411,6 +9408,9 @@ const companySearchBase = {
|
|
|
9411
9408
|
},
|
|
9412
9409
|
dateOfIncorporation: {
|
|
9413
9410
|
rule: "countryRequiresDateOfIncorporationForCompanies"
|
|
9411
|
+
},
|
|
9412
|
+
registrationNumber: {
|
|
9413
|
+
rule: "countryRequiresRegistrationNumberForCompanies"
|
|
9414
9414
|
}
|
|
9415
9415
|
};
|
|
9416
9416
|
const taxIdBase$1 = {
|
|
@@ -9526,10 +9526,7 @@ const companySearchFieldsPerScenario = {
|
|
|
9526
9526
|
}
|
|
9527
9527
|
},
|
|
9528
9528
|
L1: {
|
|
9529
|
-
...companySearchBase
|
|
9530
|
-
taxInformation: {
|
|
9531
|
-
rule: "countryRequiresTaxInformationForSearch"
|
|
9532
|
-
}
|
|
9529
|
+
...companySearchBase
|
|
9533
9530
|
},
|
|
9534
9531
|
L: {
|
|
9535
9532
|
...companySearchBase,
|
|
@@ -9558,9 +9555,6 @@ const countryConfig$4 = {
|
|
|
9558
9555
|
},
|
|
9559
9556
|
legalEntityType: {
|
|
9560
9557
|
label: "companyType"
|
|
9561
|
-
},
|
|
9562
|
-
taxInformation: {
|
|
9563
|
-
label: "australianBusinessNumberAbn"
|
|
9564
9558
|
}
|
|
9565
9559
|
},
|
|
9566
9560
|
[CountryCodes.Austria]: {
|
|
@@ -9568,13 +9562,10 @@ const countryConfig$4 = {
|
|
|
9568
9562
|
label: "vatNumberExempted"
|
|
9569
9563
|
},
|
|
9570
9564
|
vatAbsenceReason: {
|
|
9571
|
-
label: "
|
|
9565
|
+
label: "vatAbsenceReason"
|
|
9572
9566
|
},
|
|
9573
9567
|
exemptedFromRegistrationNumber: {
|
|
9574
9568
|
label: "doNotHaveFirmenbuchnummer"
|
|
9575
|
-
},
|
|
9576
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9577
|
-
label: "doNotHaveFirmenbuchnummer"
|
|
9578
9569
|
}
|
|
9579
9570
|
},
|
|
9580
9571
|
[CountryCodes.Belgium]: {
|
|
@@ -9582,7 +9573,7 @@ const countryConfig$4 = {
|
|
|
9582
9573
|
label: "vatNumberExempted"
|
|
9583
9574
|
},
|
|
9584
9575
|
vatAbsenceReason: {
|
|
9585
|
-
label: "
|
|
9576
|
+
label: "vatAbsenceReason"
|
|
9586
9577
|
}
|
|
9587
9578
|
},
|
|
9588
9579
|
[CountryCodes.Brazil]: {},
|
|
@@ -9598,14 +9589,8 @@ const countryConfig$4 = {
|
|
|
9598
9589
|
exemptedFromRegistrationNumber: {
|
|
9599
9590
|
label: "doNotHaveBusinessIncorporationNumber"
|
|
9600
9591
|
},
|
|
9601
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9602
|
-
label: "doNotHaveBusinessIncorporationNumber"
|
|
9603
|
-
},
|
|
9604
9592
|
exemptedFromTax: {
|
|
9605
9593
|
label: "doNotHaveBusinessNumber"
|
|
9606
|
-
},
|
|
9607
|
-
taxInformation: {
|
|
9608
|
-
label: "businessNumber"
|
|
9609
9594
|
}
|
|
9610
9595
|
},
|
|
9611
9596
|
[CountryCodes.Croatia]: {
|
|
@@ -9620,7 +9605,7 @@ const countryConfig$4 = {
|
|
|
9620
9605
|
},
|
|
9621
9606
|
[CountryCodes.CzechRepublic]: {
|
|
9622
9607
|
vatAbsenceReason: {
|
|
9623
|
-
label: "
|
|
9608
|
+
label: "vatAbsenceReason"
|
|
9624
9609
|
},
|
|
9625
9610
|
exemptedFromVat: {
|
|
9626
9611
|
label: "vatNumberExempted"
|
|
@@ -9640,9 +9625,6 @@ const countryConfig$4 = {
|
|
|
9640
9625
|
exemptedFromRegistrationNumber: {
|
|
9641
9626
|
label: "doNotHaveYTunnus"
|
|
9642
9627
|
},
|
|
9643
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9644
|
-
label: "doNotHaveYTunnus"
|
|
9645
|
-
},
|
|
9646
9628
|
exemptedFromVat: {
|
|
9647
9629
|
label: "vatNumberExempted"
|
|
9648
9630
|
}
|
|
@@ -9652,14 +9634,11 @@ const countryConfig$4 = {
|
|
|
9652
9634
|
exemptedFromRegistrationNumber: {
|
|
9653
9635
|
label: "doNotHaveHandelsregisternummer"
|
|
9654
9636
|
},
|
|
9655
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9656
|
-
label: "doNotHaveHandelsregisternummer"
|
|
9657
|
-
},
|
|
9658
9637
|
exemptedFromVat: {
|
|
9659
9638
|
label: "vatNumberExempted"
|
|
9660
9639
|
},
|
|
9661
9640
|
vatAbsenceReason: {
|
|
9662
|
-
label: "
|
|
9641
|
+
label: "vatAbsenceReason"
|
|
9663
9642
|
}
|
|
9664
9643
|
},
|
|
9665
9644
|
[CountryCodes.Gibraltar]: {},
|
|
@@ -9699,7 +9678,7 @@ const countryConfig$4 = {
|
|
|
9699
9678
|
label: "vatNumberExempted"
|
|
9700
9679
|
},
|
|
9701
9680
|
vatAbsenceReason: {
|
|
9702
|
-
label: "
|
|
9681
|
+
label: "vatAbsenceReason"
|
|
9703
9682
|
}
|
|
9704
9683
|
},
|
|
9705
9684
|
[CountryCodes.Japan]: {
|
|
@@ -9722,9 +9701,6 @@ const countryConfig$4 = {
|
|
|
9722
9701
|
exemptedFromRegistrationNumber: {
|
|
9723
9702
|
label: "doNotHaveLtRegistrationNumber"
|
|
9724
9703
|
},
|
|
9725
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9726
|
-
label: "doNotHaveLtRegistrationNumber"
|
|
9727
|
-
},
|
|
9728
9704
|
exemptedFromVat: {
|
|
9729
9705
|
label: "vatNumberExempted"
|
|
9730
9706
|
}
|
|
@@ -9733,9 +9709,6 @@ const countryConfig$4 = {
|
|
|
9733
9709
|
exemptedFromRegistrationNumber: {
|
|
9734
9710
|
label: "doNotHaveLuRegistrationNumber"
|
|
9735
9711
|
},
|
|
9736
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9737
|
-
label: "doNotHaveLuRegistrationNumber"
|
|
9738
|
-
},
|
|
9739
9712
|
exemptedFromVat: {
|
|
9740
9713
|
label: "vatNumberExempted"
|
|
9741
9714
|
}
|
|
@@ -9760,7 +9733,7 @@ const countryConfig$4 = {
|
|
|
9760
9733
|
label: "vatNumberExempted"
|
|
9761
9734
|
},
|
|
9762
9735
|
vatAbsenceReason: {
|
|
9763
|
-
label: "
|
|
9736
|
+
label: "vatAbsenceReason"
|
|
9764
9737
|
}
|
|
9765
9738
|
},
|
|
9766
9739
|
[CountryCodes.NewZealand]: {
|
|
@@ -9779,21 +9752,18 @@ const countryConfig$4 = {
|
|
|
9779
9752
|
label: "vatNumberExempted"
|
|
9780
9753
|
},
|
|
9781
9754
|
vatAbsenceReason: {
|
|
9782
|
-
label: "
|
|
9755
|
+
label: "vatAbsenceReason"
|
|
9783
9756
|
}
|
|
9784
9757
|
},
|
|
9785
9758
|
[CountryCodes.Poland]: {
|
|
9786
9759
|
exemptedFromRegistrationNumber: {
|
|
9787
9760
|
label: "doNotHaveRegonKrsNumber"
|
|
9788
9761
|
},
|
|
9789
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9790
|
-
label: "doNotHaveRegonKrsNumber"
|
|
9791
|
-
},
|
|
9792
9762
|
exemptedFromVat: {
|
|
9793
9763
|
label: "vatNumberExempted"
|
|
9794
9764
|
},
|
|
9795
9765
|
vatAbsenceReason: {
|
|
9796
|
-
label: "
|
|
9766
|
+
label: "vatAbsenceReason"
|
|
9797
9767
|
}
|
|
9798
9768
|
},
|
|
9799
9769
|
[CountryCodes.Portugal]: {
|
|
@@ -9801,7 +9771,7 @@ const countryConfig$4 = {
|
|
|
9801
9771
|
label: "vatNumberExempted"
|
|
9802
9772
|
},
|
|
9803
9773
|
vatAbsenceReason: {
|
|
9804
|
-
label: "
|
|
9774
|
+
label: "vatAbsenceReason"
|
|
9805
9775
|
}
|
|
9806
9776
|
},
|
|
9807
9777
|
[CountryCodes.PuertoRico]: {},
|
|
@@ -9825,7 +9795,7 @@ const countryConfig$4 = {
|
|
|
9825
9795
|
label: "vatNumberExempted"
|
|
9826
9796
|
},
|
|
9827
9797
|
vatAbsenceReason: {
|
|
9828
|
-
label: "
|
|
9798
|
+
label: "vatAbsenceReason"
|
|
9829
9799
|
}
|
|
9830
9800
|
},
|
|
9831
9801
|
[CountryCodes.Singapore]: {
|
|
@@ -9846,23 +9816,17 @@ const countryConfig$4 = {
|
|
|
9846
9816
|
exemptedFromRegistrationNumber: {
|
|
9847
9817
|
label: "doNotHaveOrganisationsnummer"
|
|
9848
9818
|
},
|
|
9849
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9850
|
-
label: "doNotHaveOrganisationsnummer"
|
|
9851
|
-
},
|
|
9852
9819
|
exemptedFromVat: {
|
|
9853
9820
|
label: "vatNumberExempted"
|
|
9854
9821
|
},
|
|
9855
9822
|
vatAbsenceReason: {
|
|
9856
|
-
label: "
|
|
9823
|
+
label: "vatAbsenceReason"
|
|
9857
9824
|
}
|
|
9858
9825
|
},
|
|
9859
9826
|
[CountryCodes.Switzerland]: {
|
|
9860
9827
|
exemptedFromRegistrationNumber: {
|
|
9861
9828
|
label: "doNotHaveChRegistrationNumber"
|
|
9862
9829
|
},
|
|
9863
|
-
exemptedFromBusinessRegistrationNumber: {
|
|
9864
|
-
label: "doNotHaveChRegistrationNumber"
|
|
9865
|
-
},
|
|
9866
9830
|
exemptedFromVat: {
|
|
9867
9831
|
label: "vatNumberExempted"
|
|
9868
9832
|
}
|
|
@@ -9888,14 +9852,6 @@ const countryConfig$4 = {
|
|
|
9888
9852
|
label: "employerIdentificationNumber"
|
|
9889
9853
|
},
|
|
9890
9854
|
/* CompanySearchComponent specific fields */
|
|
9891
|
-
taxInformation: {
|
|
9892
|
-
label: "taxInformationNumber__US",
|
|
9893
|
-
helperText: "taxInformationNumber__helperText__US"
|
|
9894
|
-
},
|
|
9895
|
-
businessRegistrationNumber: {
|
|
9896
|
-
label: "businessRegistrationNumber",
|
|
9897
|
-
placeholder: "businessRegistrationNumber__placeholder__US"
|
|
9898
|
-
},
|
|
9899
9855
|
stockExchangeMIC: {
|
|
9900
9856
|
label: "stockExchangeMIC__US",
|
|
9901
9857
|
placeholder: "stockExchangeMIC__placeholder__US"
|
|
@@ -12669,13 +12625,13 @@ const rules$2 = ({
|
|
|
12669
12625
|
},
|
|
12670
12626
|
stockExchangeMICIfTypePublic: () => {
|
|
12671
12627
|
var _a, _b;
|
|
12672
|
-
if (
|
|
12628
|
+
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)) {
|
|
12673
12629
|
return "REQUIRED";
|
|
12674
12630
|
}
|
|
12675
12631
|
},
|
|
12676
12632
|
stockISINIfTypePublic: () => {
|
|
12677
12633
|
var _a, _b;
|
|
12678
|
-
if (
|
|
12634
|
+
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)) {
|
|
12679
12635
|
return "REQUIRED";
|
|
12680
12636
|
}
|
|
12681
12637
|
},
|
|
@@ -12685,7 +12641,7 @@ const rules$2 = ({
|
|
|
12685
12641
|
}
|
|
12686
12642
|
},
|
|
12687
12643
|
countryUsesTaxId: () => {
|
|
12688
|
-
if (COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country2) && !(
|
|
12644
|
+
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))) {
|
|
12689
12645
|
return "REQUIRED";
|
|
12690
12646
|
}
|
|
12691
12647
|
},
|
|
@@ -12696,7 +12652,7 @@ const rules$2 = ({
|
|
|
12696
12652
|
},
|
|
12697
12653
|
companyRegistrationNumberExemptionAllowed: () => {
|
|
12698
12654
|
var _a, _b;
|
|
12699
|
-
const companyType2 =
|
|
12655
|
+
const companyType2 = "companyType" in data && (((_a = data.companyType) == null ? void 0 : _a.entityType) || ((_b = data.companyStructure) == null ? void 0 : _b.entityType));
|
|
12700
12656
|
if (country2 === "DE" && (companyType2 === CompanyTypesValue.GOVERNMENTAL_ORGANIZATION || companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE)) {
|
|
12701
12657
|
return "REQUIRED";
|
|
12702
12658
|
}
|
|
@@ -13141,7 +13097,7 @@ const companySearchBaseMapping = {
|
|
|
13141
13097
|
"companyRegistrationAddress.operationalAddress.otherAddressInformation": "organization.principalPlaceOfBusiness.street2",
|
|
13142
13098
|
"companyStructure.entityType": "organization.type",
|
|
13143
13099
|
"companyOtherDetails.tradingName": "organization.doingBusinessAs",
|
|
13144
|
-
"companyOtherDetails.
|
|
13100
|
+
"companyOtherDetails.registrationNumber": "organization.registrationNumber",
|
|
13145
13101
|
"companyOtherDetails.taxInformation": "organization.taxInformation",
|
|
13146
13102
|
"companyOtherDetails.vatNumber": "organization.vatNumber",
|
|
13147
13103
|
"companyOtherDetails.vatAbsenceReason": "organization.vatAbsenceReason",
|
|
@@ -21684,7 +21640,7 @@ const trackNavigation = ({
|
|
|
21684
21640
|
}
|
|
21685
21641
|
});
|
|
21686
21642
|
};
|
|
21687
|
-
const getOpeningStep
|
|
21643
|
+
const getOpeningStep = (forms2, remediationActions) => {
|
|
21688
21644
|
var _a;
|
|
21689
21645
|
if (remediationActions && Object.keys(remediationActions).length > 0) {
|
|
21690
21646
|
const allRemediationActions = Object.values(remediationActions).flat().filter((rem) => {
|
|
@@ -21730,7 +21686,7 @@ const useFormComposer = ({
|
|
|
21730
21686
|
useEffect(() => {
|
|
21731
21687
|
if (hasAlreadyNavigatedForm)
|
|
21732
21688
|
return;
|
|
21733
|
-
const openingStep = getOpeningStep
|
|
21689
|
+
const openingStep = getOpeningStep(forms2, problems == null ? void 0 : problems.remediationActions);
|
|
21734
21690
|
if (activeForm !== openingStep) {
|
|
21735
21691
|
setActiveForm(openingStep);
|
|
21736
21692
|
}
|
|
@@ -23310,7 +23266,7 @@ const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, c
|
|
|
23310
23266
|
}
|
|
23311
23267
|
return currentLegalEntityType;
|
|
23312
23268
|
};
|
|
23313
|
-
const
|
|
23269
|
+
const FormWrapper$1 = "";
|
|
23314
23270
|
const logger$e = createLogger("FormRouterContextProvider");
|
|
23315
23271
|
function FormRouterContextProvider({
|
|
23316
23272
|
children,
|
|
@@ -23565,16 +23521,16 @@ const FormWrapper = ({
|
|
|
23565
23521
|
})
|
|
23566
23522
|
});
|
|
23567
23523
|
};
|
|
23568
|
-
const parseConfiguration$
|
|
23524
|
+
const parseConfiguration$5 = ({
|
|
23569
23525
|
country: country2,
|
|
23570
23526
|
matchingScenario
|
|
23571
23527
|
}) => parseCompanyScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.ORGANIZATION], country2);
|
|
23572
|
-
const canSubmit$
|
|
23528
|
+
const canSubmit$2 = (data) => mandatoryApiFields.ORGANIZATION.every((detail) => {
|
|
23573
23529
|
const value = getProp(data, detail);
|
|
23574
23530
|
return !isEmpty(value);
|
|
23575
23531
|
});
|
|
23576
|
-
const isDocumentsRequired$
|
|
23577
|
-
const formatFileSummaryData = (companyRegistrationDocument2, companyTaxDocument) => {
|
|
23532
|
+
const isDocumentsRequired$2 = (forms2) => forms2.some((form) => [companyForms.companyRegistrationDocument.formId, companyForms.companyTaxDocument.formId].includes(form.formId));
|
|
23533
|
+
const formatFileSummaryData$1 = (companyRegistrationDocument2, companyTaxDocument) => {
|
|
23578
23534
|
var _a, _b;
|
|
23579
23535
|
const registrationDocument2 = (_a = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0];
|
|
23580
23536
|
const taxDocument2 = (_b = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _b[0];
|
|
@@ -23662,7 +23618,7 @@ function CompanyDropinComponent({
|
|
|
23662
23618
|
fieldConfigurations,
|
|
23663
23619
|
requiredFields
|
|
23664
23620
|
} = useScenarioConfiguration({
|
|
23665
|
-
parseConfiguration: parseConfiguration$
|
|
23621
|
+
parseConfiguration: parseConfiguration$5,
|
|
23666
23622
|
getConfigurationData,
|
|
23667
23623
|
setLoadingStatus,
|
|
23668
23624
|
country: country2
|
|
@@ -23698,7 +23654,7 @@ function CompanyDropinComponent({
|
|
|
23698
23654
|
legalEntity,
|
|
23699
23655
|
dataSubmitted
|
|
23700
23656
|
}) => {
|
|
23701
|
-
if (!isDocumentsRequired$
|
|
23657
|
+
if (!isDocumentsRequired$2(forms22))
|
|
23702
23658
|
return;
|
|
23703
23659
|
const formattedDocument = await mapCompanyDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
23704
23660
|
if (formattedDocument) {
|
|
@@ -23866,16 +23822,16 @@ function CompanyDropinComponent({
|
|
|
23866
23822
|
summaryData.companyRegistrationAddress.operationalAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.companyRegistrationAddress.operationalAddress, datasetUtils);
|
|
23867
23823
|
}
|
|
23868
23824
|
if ((_h = summaryData.companyRegistrationDetails) == null ? void 0 : _h.vatAbsenceReason) {
|
|
23869
|
-
const
|
|
23870
|
-
if (
|
|
23871
|
-
summaryData.companyRegistrationDetails.vatAbsenceReason = i18n.get(
|
|
23825
|
+
const vatAbsenceReason2 = vatAbsenceReasons.find((absenceReason) => absenceReason === summaryData.companyRegistrationDetails.vatAbsenceReason);
|
|
23826
|
+
if (vatAbsenceReason2) {
|
|
23827
|
+
summaryData.companyRegistrationDetails.vatAbsenceReason = i18n.get(vatAbsenceReason2);
|
|
23872
23828
|
}
|
|
23873
23829
|
}
|
|
23874
|
-
if (isDocumentsRequired$
|
|
23830
|
+
if (isDocumentsRequired$2(forms22)) {
|
|
23875
23831
|
companyDocumentForms.forEach((formId) => delete summaryData[formId]);
|
|
23876
23832
|
summaryData = {
|
|
23877
23833
|
...summaryData,
|
|
23878
|
-
...formatFileSummaryData(data2.companyRegistrationDocument, data2.companyTaxDocument)
|
|
23834
|
+
...formatFileSummaryData$1(data2.companyRegistrationDocument, data2.companyTaxDocument)
|
|
23879
23835
|
};
|
|
23880
23836
|
}
|
|
23881
23837
|
return summaryData;
|
|
@@ -23911,7 +23867,7 @@ function CompanyDropinComponent({
|
|
|
23911
23867
|
baseTrackingPayload,
|
|
23912
23868
|
onSubmit,
|
|
23913
23869
|
problems,
|
|
23914
|
-
canSubmit: canSubmit$
|
|
23870
|
+
canSubmit: canSubmit$2(data) && hasDataChanged(dataFromResponse, data),
|
|
23915
23871
|
summary: {
|
|
23916
23872
|
data: formatDataForSummary2(data, forms2),
|
|
23917
23873
|
omittedKeys: ["operationalAddressIsSame"]
|
|
@@ -23945,6 +23901,7 @@ function useCompanySearch({
|
|
|
23945
23901
|
taxIdentificationNumber: taxIdentificationNumber2,
|
|
23946
23902
|
canVerify,
|
|
23947
23903
|
limit = 15,
|
|
23904
|
+
setKompanyAddress,
|
|
23948
23905
|
handleChangeFor,
|
|
23949
23906
|
handleCompanyIndexSearch,
|
|
23950
23907
|
handleCompanyDeepSearch,
|
|
@@ -24000,7 +23957,7 @@ function useCompanySearch({
|
|
|
24000
23957
|
} finally {
|
|
24001
23958
|
setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
|
|
24002
23959
|
}
|
|
24003
|
-
},
|
|
23960
|
+
}, 700), []);
|
|
24004
23961
|
const retrySearch = useCallback(async () => {
|
|
24005
23962
|
if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
|
|
24006
23963
|
return setStatus("idle");
|
|
@@ -24084,17 +24041,17 @@ function useCompanySearch({
|
|
|
24084
24041
|
setStatus("loading");
|
|
24085
24042
|
setSelectedCompanyId(void 0);
|
|
24086
24043
|
setVerifiedCompany(void 0);
|
|
24044
|
+
setKompanyAddress(void 0);
|
|
24087
24045
|
setCompaniesList([]);
|
|
24088
24046
|
if (defaultData) {
|
|
24089
|
-
|
|
24090
|
-
handleChangeFor(field)(value);
|
|
24091
|
-
});
|
|
24047
|
+
handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
|
|
24092
24048
|
}
|
|
24093
|
-
}, [defaultData, handleChangeFor]);
|
|
24049
|
+
}, [defaultData, handleChangeFor, setKompanyAddress]);
|
|
24094
24050
|
useEffect(() => {
|
|
24095
24051
|
var _a;
|
|
24096
24052
|
setError(void 0);
|
|
24097
|
-
|
|
24053
|
+
const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
|
|
24054
|
+
if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
|
|
24098
24055
|
return setStatus("idle");
|
|
24099
24056
|
}
|
|
24100
24057
|
if (!verifiedCompany) {
|
|
@@ -24129,6 +24086,15 @@ function useCompanySearch({
|
|
|
24129
24086
|
reset
|
|
24130
24087
|
};
|
|
24131
24088
|
}
|
|
24089
|
+
const mapKompanyOrganizationTypeToCompanyType = (organizationType) => {
|
|
24090
|
+
const organizationTypeValue = organizationType == null ? void 0 : organizationType.toLowerCase();
|
|
24091
|
+
switch (organizationTypeValue) {
|
|
24092
|
+
case "business":
|
|
24093
|
+
return CompanyTypesValue.PRIVATE_COMPANY;
|
|
24094
|
+
default:
|
|
24095
|
+
return void 0;
|
|
24096
|
+
}
|
|
24097
|
+
};
|
|
24132
24098
|
const mapCompanyDataResponseToFormSchema = (company2) => ({
|
|
24133
24099
|
companyBasics: {
|
|
24134
24100
|
country: company2.country,
|
|
@@ -24143,8 +24109,11 @@ const mapCompanyDataResponseToFormSchema = (company2) => ({
|
|
|
24143
24109
|
postalCode: company2.zipcode
|
|
24144
24110
|
}
|
|
24145
24111
|
},
|
|
24112
|
+
companyStructure: {
|
|
24113
|
+
entityType: mapKompanyOrganizationTypeToCompanyType(company2.organizationType)
|
|
24114
|
+
},
|
|
24146
24115
|
companyOtherDetails: {
|
|
24147
|
-
|
|
24116
|
+
registrationNumber: company2.registrationNumber
|
|
24148
24117
|
}
|
|
24149
24118
|
});
|
|
24150
24119
|
const CompanyLookupResultsHeader = ({
|
|
@@ -24266,13 +24235,17 @@ const LookupResult = ({
|
|
|
24266
24235
|
return "verified";
|
|
24267
24236
|
}
|
|
24268
24237
|
}, [status, isError]);
|
|
24269
|
-
const selectAndVerify = (companyTin, company2) => {
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24238
|
+
const selectAndVerify = async (companyTin, company2) => {
|
|
24239
|
+
try {
|
|
24240
|
+
await onSelect(companyTin, company2);
|
|
24241
|
+
} finally {
|
|
24242
|
+
if (ref.current) {
|
|
24243
|
+
ref.current.scrollIntoView({
|
|
24244
|
+
behavior: "smooth",
|
|
24245
|
+
block: "center"
|
|
24246
|
+
});
|
|
24247
|
+
}
|
|
24274
24248
|
}
|
|
24275
|
-
return onSelect(companyTin, company2);
|
|
24276
24249
|
};
|
|
24277
24250
|
if (isSelected && verifiedCompany) {
|
|
24278
24251
|
return jsxs("div", {
|
|
@@ -24342,9 +24315,17 @@ const CompanyLookupResultsList = ({
|
|
|
24342
24315
|
}
|
|
24343
24316
|
return "adyen-company-lookup-results-list__result-option";
|
|
24344
24317
|
};
|
|
24318
|
+
const resultsList = useMemo(() => {
|
|
24319
|
+
if (verifiedCompany) {
|
|
24320
|
+
const filtered = results.filter((option) => option.id !== verifiedCompany.id);
|
|
24321
|
+
const verified2 = results.find((option) => option.id === verifiedCompany.id);
|
|
24322
|
+
return verified2 ? [verified2, ...filtered] : results;
|
|
24323
|
+
}
|
|
24324
|
+
return results;
|
|
24325
|
+
}, [verifiedCompany, results]);
|
|
24345
24326
|
return jsx("div", {
|
|
24346
24327
|
className: "adyen-company-lookup-results-list",
|
|
24347
|
-
children:
|
|
24328
|
+
children: resultsList.map((option) => jsx("div", {
|
|
24348
24329
|
children: jsx(LookupResult, {
|
|
24349
24330
|
classes: optionClasses(option),
|
|
24350
24331
|
option,
|
|
@@ -24386,6 +24367,7 @@ function CompanyLookup({
|
|
|
24386
24367
|
taxInformationNumber: taxInformationNumber2,
|
|
24387
24368
|
setLoading,
|
|
24388
24369
|
setKompanyAddress,
|
|
24370
|
+
setKompanyVerifiedData,
|
|
24389
24371
|
handleChangeFor,
|
|
24390
24372
|
handleCompanyIndexSearch,
|
|
24391
24373
|
handleCompanyDeepSearch,
|
|
@@ -24413,6 +24395,7 @@ function CompanyLookup({
|
|
|
24413
24395
|
stateOrProvince: stateOrProvince2,
|
|
24414
24396
|
taxIdentificationNumber: taxInformationNumber2,
|
|
24415
24397
|
canVerify,
|
|
24398
|
+
setKompanyAddress,
|
|
24416
24399
|
handleChangeFor,
|
|
24417
24400
|
handleCompanyIndexSearch,
|
|
24418
24401
|
handleCompanyDeepSearch,
|
|
@@ -24426,11 +24409,14 @@ function CompanyLookup({
|
|
|
24426
24409
|
const companyLookupClasses = status === "idle" || !canVerify ? "adyen-kyc-company-lookup adyen-kyc-company-lookup--hidden" : "adyen-kyc-company-lookup";
|
|
24427
24410
|
const mappedData = useMemo$1(() => {
|
|
24428
24411
|
if (verifiedCompany) {
|
|
24412
|
+
const verifiedData = mapCompanyDataResponseToFormSchema(verifiedCompany);
|
|
24429
24413
|
setKompanyAddress(verifiedCompany.address);
|
|
24430
|
-
|
|
24414
|
+
setKompanyVerifiedData(verifiedData);
|
|
24415
|
+
return verifiedData;
|
|
24431
24416
|
}
|
|
24417
|
+
setKompanyVerifiedData(void 0);
|
|
24432
24418
|
setKompanyAddress(void 0);
|
|
24433
|
-
}, [setKompanyAddress, verifiedCompany]);
|
|
24419
|
+
}, [setKompanyAddress, setKompanyVerifiedData, verifiedCompany]);
|
|
24434
24420
|
useEffect$1(() => {
|
|
24435
24421
|
if (mappedData == null ? void 0 : mappedData.companyBasics) {
|
|
24436
24422
|
entriesOf(mappedData.companyBasics).forEach(([field, data]) => {
|
|
@@ -24466,13 +24452,36 @@ function CompanyLookup({
|
|
|
24466
24452
|
});
|
|
24467
24453
|
}
|
|
24468
24454
|
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);
|
|
24455
|
+
const CountryFieldValidation = () => ({
|
|
24456
|
+
country: {
|
|
24457
|
+
modes: ["blur"],
|
|
24458
|
+
validate: (country2) => !isEmpty(country2),
|
|
24459
|
+
errorMessage: "fieldIsRequired"
|
|
24460
|
+
}
|
|
24461
|
+
});
|
|
24462
|
+
const LegalCompanyNameFieldValidation = () => ({
|
|
24463
|
+
legalCompanyName: {
|
|
24464
|
+
modes: ["blur"],
|
|
24465
|
+
validate: (legalCompanyName2) => !isEmpty(legalCompanyName2),
|
|
24466
|
+
errorMessage: "fieldIsRequired"
|
|
24467
|
+
}
|
|
24468
|
+
});
|
|
24469
|
+
const StateFieldValidation = () => ({
|
|
24470
|
+
stateOrProvince: {
|
|
24471
|
+
modes: ["blur"],
|
|
24472
|
+
validate: (stateOrProvince2) => !isEmpty(stateOrProvince2),
|
|
24473
|
+
errorMessage: "fieldIsRequired"
|
|
24474
|
+
}
|
|
24475
|
+
});
|
|
24469
24476
|
const TAX_INFORMATION_FIELD = ["taxInformation", "exemptedFromTax", "isUen"];
|
|
24470
24477
|
function TaxInformationField({
|
|
24471
24478
|
data,
|
|
24472
24479
|
valid,
|
|
24473
24480
|
errors,
|
|
24474
24481
|
labels: labels2,
|
|
24475
|
-
|
|
24482
|
+
mask,
|
|
24483
|
+
guidanceText,
|
|
24484
|
+
placeholders,
|
|
24476
24485
|
readonly,
|
|
24477
24486
|
handleChangeFor,
|
|
24478
24487
|
country: country2,
|
|
@@ -24482,11 +24491,7 @@ function TaxInformationField({
|
|
|
24482
24491
|
var _a;
|
|
24483
24492
|
return (_a = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === country2);
|
|
24484
24493
|
}, [data, country2]);
|
|
24485
|
-
const handleTaxInformationInput = (
|
|
24486
|
-
var _a;
|
|
24487
|
-
const {
|
|
24488
|
-
value
|
|
24489
|
-
} = e.target;
|
|
24494
|
+
const handleTaxInformationInput = (value) => {
|
|
24490
24495
|
if (!data.taxInformation) {
|
|
24491
24496
|
const updatedTaxInformation2 = [{
|
|
24492
24497
|
country: country2,
|
|
@@ -24495,7 +24500,12 @@ function TaxInformationField({
|
|
|
24495
24500
|
}];
|
|
24496
24501
|
return handleChangeFor("taxInformation", "input")(updatedTaxInformation2);
|
|
24497
24502
|
}
|
|
24498
|
-
const
|
|
24503
|
+
const taxInformation = currentCountryTaxInformation ? data.taxInformation : [...data.taxInformation, {
|
|
24504
|
+
country: country2,
|
|
24505
|
+
number: value,
|
|
24506
|
+
type: countryToTaxInfoTypeMap[country2]
|
|
24507
|
+
}];
|
|
24508
|
+
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
24499
24509
|
if (taxInfo.country !== country2)
|
|
24500
24510
|
return taxInfo;
|
|
24501
24511
|
return {
|
|
@@ -24507,7 +24517,6 @@ function TaxInformationField({
|
|
|
24507
24517
|
return handleChangeFor("taxInformation", "input")(updatedTaxInformation);
|
|
24508
24518
|
};
|
|
24509
24519
|
const handleTaxInformationBlur = (e) => {
|
|
24510
|
-
var _a;
|
|
24511
24520
|
const {
|
|
24512
24521
|
value
|
|
24513
24522
|
} = e.target;
|
|
@@ -24519,7 +24528,12 @@ function TaxInformationField({
|
|
|
24519
24528
|
}];
|
|
24520
24529
|
return handleChangeFor("taxInformation", "blur")(updatedTaxInformation2);
|
|
24521
24530
|
}
|
|
24522
|
-
const
|
|
24531
|
+
const taxInformation = currentCountryTaxInformation ? data.taxInformation : [...data.taxInformation, {
|
|
24532
|
+
country: country2,
|
|
24533
|
+
number: value,
|
|
24534
|
+
type: countryToTaxInfoTypeMap[country2]
|
|
24535
|
+
}];
|
|
24536
|
+
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
24523
24537
|
if (taxInfo.country !== country2)
|
|
24524
24538
|
return taxInfo;
|
|
24525
24539
|
return {
|
|
@@ -24531,23 +24545,22 @@ function TaxInformationField({
|
|
|
24531
24545
|
return handleChangeFor("taxInformation", "blur")(updatedTaxInformation);
|
|
24532
24546
|
};
|
|
24533
24547
|
return jsxs(Fragment, {
|
|
24534
|
-
children: [jsx(
|
|
24535
|
-
name: "
|
|
24536
|
-
label: labels2.taxInformation,
|
|
24537
|
-
|
|
24548
|
+
children: [jsx(MaskedInputText, {
|
|
24549
|
+
name: "taxInformationNumber",
|
|
24550
|
+
label: labels2.taxInformation ?? "",
|
|
24551
|
+
formatGuidance: (guidanceText == null ? void 0 : guidanceText.taxInformation) ?? "",
|
|
24552
|
+
value: (currentCountryTaxInformation == null ? void 0 : currentCountryTaxInformation.number) ?? "",
|
|
24538
24553
|
errorMessage: errors.taxInformation,
|
|
24539
|
-
|
|
24540
|
-
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
|
|
24544
|
-
|
|
24545
|
-
|
|
24546
|
-
|
|
24547
|
-
|
|
24548
|
-
|
|
24549
|
-
readonly
|
|
24550
|
-
})
|
|
24554
|
+
placeholder: placeholders == null ? void 0 : placeholders.taxInformation,
|
|
24555
|
+
isValid: Boolean(valid.taxInformation),
|
|
24556
|
+
"aria-required": true,
|
|
24557
|
+
"aria-label": labels2.taxInformation,
|
|
24558
|
+
"aria-invalid": !valid.taxInformation,
|
|
24559
|
+
onInput: handleTaxInformationInput,
|
|
24560
|
+
onBlur: handleTaxInformationBlur,
|
|
24561
|
+
disabled: data.exemptedFromTax,
|
|
24562
|
+
readonly,
|
|
24563
|
+
...mask
|
|
24551
24564
|
}), canExempt && jsx(Checkbox, {
|
|
24552
24565
|
"aria-required": false,
|
|
24553
24566
|
"aria-label": labels2.exemptedFromTax,
|
|
@@ -24561,116 +24574,95 @@ function TaxInformationField({
|
|
|
24561
24574
|
})]
|
|
24562
24575
|
});
|
|
24563
24576
|
}
|
|
24564
|
-
const
|
|
24565
|
-
|
|
24566
|
-
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
validate: (dateOfIncorporation2) => dateOfIncorporation2 ? new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date() : false,
|
|
24572
|
-
errorMessage: "invalidDateOfIncorporation"
|
|
24573
|
-
}]
|
|
24574
|
-
});
|
|
24575
|
-
const StockExchangeMICFieldValidation = () => ({
|
|
24576
|
-
stockExchangeMIC: [{
|
|
24577
|
-
modes: ["blur"],
|
|
24578
|
-
validate: (stockExchangeMIC2) => !isEmpty(stockExchangeMIC2),
|
|
24579
|
-
errorMessage: "fieldIsRequired"
|
|
24580
|
-
}]
|
|
24581
|
-
});
|
|
24582
|
-
const StockISINFieldValidation = () => ({
|
|
24583
|
-
stockISIN: [{
|
|
24584
|
-
modes: ["blur"],
|
|
24585
|
-
validate: (stockISIN2) => !isEmpty(stockISIN2),
|
|
24586
|
-
errorMessage: "fieldIsRequired"
|
|
24587
|
-
}, {
|
|
24588
|
-
modes: ["blur"],
|
|
24589
|
-
validate: (input) => exactLength(input, 12),
|
|
24590
|
-
errorMessage: "validationPleaseEnterAValidStockISIN"
|
|
24591
|
-
}]
|
|
24592
|
-
});
|
|
24593
|
-
const TradingNameFieldValidation = () => ({
|
|
24594
|
-
tradingName: [{
|
|
24595
|
-
modes: ["blur"],
|
|
24596
|
-
validate: (tradingName2) => !isEmpty(tradingName2),
|
|
24597
|
-
errorMessage: "fieldIsRequired"
|
|
24598
|
-
}]
|
|
24577
|
+
const taxInformationFieldValidation = (pattern, country2) => ({
|
|
24578
|
+
modes: ["blur"],
|
|
24579
|
+
validate: (taxInformation) => {
|
|
24580
|
+
var _a;
|
|
24581
|
+
const taxIdNumber2 = (_a = taxInformation == null ? void 0 : taxInformation.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _a.number;
|
|
24582
|
+
return taxIdNumber2 ? pattern.test(taxIdNumber2) : false;
|
|
24583
|
+
}
|
|
24599
24584
|
});
|
|
24600
|
-
const
|
|
24601
|
-
|
|
24602
|
-
companyType: companyType2,
|
|
24603
|
-
registrationNumberType
|
|
24604
|
-
}, defaultFieldMetadata$2);
|
|
24605
|
-
return {
|
|
24606
|
-
businessRegistrationNumber: metadata.validators
|
|
24607
|
-
};
|
|
24585
|
+
const defaultFieldMetadata = {
|
|
24586
|
+
label: "taxId"
|
|
24608
24587
|
};
|
|
24609
|
-
const
|
|
24610
|
-
|
|
24588
|
+
const defaultFieldConfig = {
|
|
24589
|
+
...defaultFieldConfig$2,
|
|
24590
|
+
[CountryCodes.Canada]: {
|
|
24591
|
+
...defaultFieldConfig$2.CA,
|
|
24592
|
+
validators: taxInformationFieldValidation(/^\d{9}$/, CountryCodes.Canada)
|
|
24593
|
+
},
|
|
24594
|
+
[CountryCodes.HongKong]: {
|
|
24595
|
+
...defaultFieldConfig$2.HK,
|
|
24596
|
+
validators: taxInformationFieldValidation(/^\d{8}$/, CountryCodes.HongKong)
|
|
24597
|
+
},
|
|
24598
|
+
[CountryCodes.Australia]: {
|
|
24599
|
+
...defaultFieldConfig$2.AU,
|
|
24600
|
+
validators: taxInformationFieldValidation(/^\d{11}$/, CountryCodes.Australia)
|
|
24601
|
+
},
|
|
24602
|
+
[CountryCodes.NewZealand]: {
|
|
24603
|
+
...defaultFieldConfig$2.NZ,
|
|
24604
|
+
validators: taxInformationFieldValidation(/^\d{8,9}$/, CountryCodes.NewZealand)
|
|
24605
|
+
},
|
|
24606
|
+
[CountryCodes.Singapore]: {
|
|
24607
|
+
...defaultFieldConfig$2.SG,
|
|
24608
|
+
validators: taxInformationFieldValidation(/^[A-Z0-9]{9,10}$/, CountryCodes.Singapore)
|
|
24609
|
+
},
|
|
24610
|
+
[CountryCodes.UnitedStates]: ({
|
|
24611
24611
|
taxIdNumberType
|
|
24612
|
-
}
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24628
|
-
|
|
24629
|
-
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
}
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
}
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
|
|
24653
|
-
})
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
validate: (stateOrProvince2) => !isEmpty(stateOrProvince2),
|
|
24665
|
-
errorMessage: "fieldIsRequired"
|
|
24612
|
+
}) => {
|
|
24613
|
+
switch (taxIdNumberType) {
|
|
24614
|
+
case "ssn":
|
|
24615
|
+
return {
|
|
24616
|
+
label: "socialSecurityNumber9Digits",
|
|
24617
|
+
validators: taxInformationFieldValidation(/^\d{9}$/, CountryCodes.UnitedStates),
|
|
24618
|
+
mask: {
|
|
24619
|
+
mask: makeMask(...numericInputs(9))
|
|
24620
|
+
}
|
|
24621
|
+
};
|
|
24622
|
+
case "ssnLastFour":
|
|
24623
|
+
return {
|
|
24624
|
+
label: "last4DigitsOfSocialSecurityNumber",
|
|
24625
|
+
validators: taxInformationFieldValidation(/^\d{4}$/, CountryCodes.UnitedStates),
|
|
24626
|
+
mask: {
|
|
24627
|
+
mask: makeMask(...nonInputs("*** — ** — "), ...numericInputs(4))
|
|
24628
|
+
}
|
|
24629
|
+
};
|
|
24630
|
+
case "ein":
|
|
24631
|
+
default:
|
|
24632
|
+
return {
|
|
24633
|
+
label: "employerIdentificationNumber",
|
|
24634
|
+
validators: taxInformationFieldValidation(/^\d{9}$/, CountryCodes.UnitedStates),
|
|
24635
|
+
mask: {
|
|
24636
|
+
mask: makeMask(...numericInputs(9))
|
|
24637
|
+
},
|
|
24638
|
+
guidanceText: {
|
|
24639
|
+
key: "validationPleaseEnterAValidTaxIdNumberWithFormat",
|
|
24640
|
+
values: {
|
|
24641
|
+
format: "XXXXXXXXX"
|
|
24642
|
+
}
|
|
24643
|
+
}
|
|
24644
|
+
};
|
|
24645
|
+
}
|
|
24646
|
+
},
|
|
24647
|
+
/**
|
|
24648
|
+
* NOT YET SUPPORTED
|
|
24649
|
+
* These are brought over from the old pattern files. We have no idea if they are accurate or not.
|
|
24650
|
+
* See https://en.wikipedia.org/wiki/VAT_identification_number
|
|
24651
|
+
*/
|
|
24652
|
+
[CountryCodes.India]: {
|
|
24653
|
+
validators: taxInformationFieldValidation(/^[A-Z0-9]{15}$/, CountryCodes.India)
|
|
24654
|
+
},
|
|
24655
|
+
[CountryCodes.Japan]: {
|
|
24656
|
+
validators: taxInformationFieldValidation(/^\d{13}$/, CountryCodes.Japan)
|
|
24657
|
+
},
|
|
24658
|
+
[CountryCodes.Mexico]: {
|
|
24659
|
+
validators: taxInformationFieldValidation(/^\D{3}\d{6}\w{3}$/, CountryCodes.Mexico)
|
|
24660
|
+
// Examples: P&G851223B24, LFM200817DGA
|
|
24661
|
+
},
|
|
24662
|
+
[CountryCodes.Philippines]: {
|
|
24663
|
+
validators: taxInformationFieldValidation(/^\d{12}$/, CountryCodes.Philippines)
|
|
24666
24664
|
}
|
|
24667
|
-
}
|
|
24668
|
-
const CompanyBasicsValidationRules = (country2) => ({
|
|
24669
|
-
...LegalCompanyNameFieldValidation(),
|
|
24670
|
-
...CountryFieldValidation(),
|
|
24671
|
-
...StateFieldValidation(),
|
|
24672
|
-
...TaxInformationFieldValidation(country2)
|
|
24673
|
-
});
|
|
24665
|
+
};
|
|
24674
24666
|
const COMPANY_BASICS_FORM_ID = "companyBasics";
|
|
24675
24667
|
const companyBasicsFields = [...LEGAL_COMPANY_NAME_FIELD, ...COUNTRY_FIELD, ...STATE_FIELD, ...TAX_INFORMATION_FIELD];
|
|
24676
24668
|
function CompanyBasics({
|
|
@@ -24693,8 +24685,11 @@ function CompanyBasics({
|
|
|
24693
24685
|
handleGetCompanyDataset,
|
|
24694
24686
|
handleRefreshCompanyDataset,
|
|
24695
24687
|
handleVerifyTin,
|
|
24688
|
+
country: country2,
|
|
24689
|
+
isTopLevelEntity,
|
|
24696
24690
|
kompanyAddress,
|
|
24697
|
-
setKompanyAddress
|
|
24691
|
+
setKompanyAddress,
|
|
24692
|
+
setKompanyVerifiedData
|
|
24698
24693
|
}) {
|
|
24699
24694
|
var _a, _b;
|
|
24700
24695
|
const {
|
|
@@ -24704,12 +24699,59 @@ function CompanyBasics({
|
|
|
24704
24699
|
isSettingEnabled
|
|
24705
24700
|
} = useSettingsContext();
|
|
24706
24701
|
const {
|
|
24707
|
-
sliceData,
|
|
24708
24702
|
updateStateSlice
|
|
24709
24703
|
} = useGlobalDataSlice(COMPANY_BASICS_FORM_ID);
|
|
24710
|
-
const schema = (requiredFields == null ? void 0 : requiredFields.length) ? requiredFields : ["legalCompanyName", "country"];
|
|
24711
|
-
const validationRules = CompanyBasicsValidationRules((sliceData == null ? void 0 : sliceData.country) ?? (data == null ? void 0 : data.country));
|
|
24712
24704
|
const [loading2, setLoading] = useState$1(false);
|
|
24705
|
+
const allowedCountries = useAllowedCountries();
|
|
24706
|
+
const initialFormUtilsProps = useMemo$1(() => ({
|
|
24707
|
+
labels: labels2,
|
|
24708
|
+
placeholders,
|
|
24709
|
+
helperText,
|
|
24710
|
+
readOnly,
|
|
24711
|
+
requiredFields,
|
|
24712
|
+
readOnlyFields,
|
|
24713
|
+
optionalFields,
|
|
24714
|
+
maskedFields,
|
|
24715
|
+
shouldValidate
|
|
24716
|
+
}), [helperText, labels2, maskedFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
24717
|
+
const mergedFieldProps = useMemo$1(() => {
|
|
24718
|
+
var _a2;
|
|
24719
|
+
return (_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.reduce((acc, field) => {
|
|
24720
|
+
switch (field) {
|
|
24721
|
+
case "legalCompanyName":
|
|
24722
|
+
return {
|
|
24723
|
+
...acc,
|
|
24724
|
+
validators: {
|
|
24725
|
+
...acc.validators,
|
|
24726
|
+
...LegalCompanyNameFieldValidation()
|
|
24727
|
+
}
|
|
24728
|
+
};
|
|
24729
|
+
case "country":
|
|
24730
|
+
return {
|
|
24731
|
+
...acc,
|
|
24732
|
+
validators: {
|
|
24733
|
+
...acc.validators,
|
|
24734
|
+
...CountryFieldValidation()
|
|
24735
|
+
}
|
|
24736
|
+
};
|
|
24737
|
+
case "stateOrProvince":
|
|
24738
|
+
return {
|
|
24739
|
+
...acc,
|
|
24740
|
+
validators: {
|
|
24741
|
+
...acc.validators,
|
|
24742
|
+
...StateFieldValidation()
|
|
24743
|
+
}
|
|
24744
|
+
};
|
|
24745
|
+
case "taxInformation":
|
|
24746
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
|
|
24747
|
+
taxIdNumberType: countryToTaxInfoTypeMap[country2]
|
|
24748
|
+
}, defaultFieldMetadata), acc);
|
|
24749
|
+
default:
|
|
24750
|
+
return acc;
|
|
24751
|
+
}
|
|
24752
|
+
}, initialFormUtilsProps);
|
|
24753
|
+
}, [country2, initialFormUtilsProps]);
|
|
24754
|
+
const schema = (requiredFields == null ? void 0 : requiredFields.length) ? requiredFields : ["legalCompanyName", "country"];
|
|
24713
24755
|
const {
|
|
24714
24756
|
schema: formSchema,
|
|
24715
24757
|
data: formData,
|
|
@@ -24721,35 +24763,17 @@ function CompanyBasics({
|
|
|
24721
24763
|
} = useForm({
|
|
24722
24764
|
schema,
|
|
24723
24765
|
defaultData: data,
|
|
24724
|
-
rules:
|
|
24766
|
+
rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
|
|
24767
|
+
optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
|
|
24768
|
+
maskedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.maskedFields,
|
|
24725
24769
|
fieldProblems: fieldValidationErrors,
|
|
24726
|
-
optionalFields,
|
|
24727
|
-
maskedFields,
|
|
24728
24770
|
shouldValidate
|
|
24729
24771
|
});
|
|
24730
24772
|
const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
|
|
24731
|
-
const formUtils = formUtilities(
|
|
24732
|
-
labels: labels2,
|
|
24733
|
-
placeholders,
|
|
24734
|
-
helperText,
|
|
24735
|
-
readOnly,
|
|
24736
|
-
requiredFields,
|
|
24737
|
-
readOnlyFields,
|
|
24738
|
-
optionalFields
|
|
24739
|
-
}, i18n);
|
|
24773
|
+
const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
|
|
24740
24774
|
const hasCompanySearchProvider = formData.country && COUNTRIES_WITH_IN_APP_SEARCH_COMPANY_VERIFICATION.includes(formData.country);
|
|
24741
24775
|
const currentCountryTaxIdNumber = (_b = (_a = formData.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === formData.country)) == null ? void 0 : _b.number;
|
|
24742
|
-
const
|
|
24743
|
-
legalCompanyNameDisabled,
|
|
24744
|
-
countryDisabled,
|
|
24745
|
-
stateOrProvinceDisabled,
|
|
24746
|
-
taxInformationDisabled
|
|
24747
|
-
} = useMemo$1(() => ({
|
|
24748
|
-
legalCompanyNameDisabled: formUtils.isReadOnly("legalCompanyName") || Boolean(kompanyAddress) || loading2,
|
|
24749
|
-
countryDisabled: !isAllowedEditPrefilledCountry || formUtils.isReadOnly("country") || Boolean(kompanyAddress) || loading2,
|
|
24750
|
-
stateOrProvinceDisabled: formUtils.isReadOnly("stateOrProvince") || Boolean(kompanyAddress) || loading2,
|
|
24751
|
-
taxInformationDisabled: formUtils.isReadOnly("taxInformation") || Boolean(kompanyAddress) || loading2
|
|
24752
|
-
}), [kompanyAddress, formUtils, isAllowedEditPrefilledCountry, loading2]);
|
|
24776
|
+
const disabled = (field) => formUtils.isReadOnly(field) || Boolean(kompanyAddress) || loading2;
|
|
24753
24777
|
useEffect$1(() => {
|
|
24754
24778
|
updateStateSlice({
|
|
24755
24779
|
schema: formSchema,
|
|
@@ -24780,7 +24804,7 @@ function CompanyBasics({
|
|
|
24780
24804
|
helperText: formUtils.getFieldHelperText(LEGAL_COMPANY_NAME_FIELD, {
|
|
24781
24805
|
legalCompanyName: "legalCompanyName__helperText"
|
|
24782
24806
|
}),
|
|
24783
|
-
readonly:
|
|
24807
|
+
readonly: disabled("legalCompanyName"),
|
|
24784
24808
|
handleChangeFor
|
|
24785
24809
|
})
|
|
24786
24810
|
}), formUtils.isRequiredField("country") && jsx("div", {
|
|
@@ -24790,8 +24814,9 @@ function CompanyBasics({
|
|
|
24790
24814
|
valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
|
|
24791
24815
|
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
|
|
24792
24816
|
labels: formUtils.getFieldLabels(COUNTRY_FIELD),
|
|
24793
|
-
readonly:
|
|
24794
|
-
handleChangeFor
|
|
24817
|
+
readonly: disabled("country") || !isAllowedEditPrefilledCountry,
|
|
24818
|
+
handleChangeFor,
|
|
24819
|
+
allowedCountries: isTopLevelEntity ? allowedCountries : void 0
|
|
24795
24820
|
})
|
|
24796
24821
|
}), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
|
|
24797
24822
|
className: "adyen-kyc-field-wrapper",
|
|
@@ -24800,7 +24825,7 @@ function CompanyBasics({
|
|
|
24800
24825
|
valid: formUtils.getFieldValid(formValid, STATE_FIELD),
|
|
24801
24826
|
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
|
|
24802
24827
|
labels: formUtils.getFieldLabels(STATE_FIELD),
|
|
24803
|
-
readonly:
|
|
24828
|
+
readonly: disabled("stateOrProvince"),
|
|
24804
24829
|
handleChangeFor,
|
|
24805
24830
|
selectedCountry: formData.country
|
|
24806
24831
|
})
|
|
@@ -24811,11 +24836,14 @@ function CompanyBasics({
|
|
|
24811
24836
|
valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
|
|
24812
24837
|
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
|
|
24813
24838
|
labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
|
|
24814
|
-
|
|
24839
|
+
mask: formUtils.getMask("taxInformation"),
|
|
24840
|
+
helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
|
|
24841
|
+
guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
|
|
24842
|
+
readonly: disabled("taxInformation"),
|
|
24815
24843
|
handleChangeFor,
|
|
24816
|
-
country: formData.country,
|
|
24817
24844
|
canExempt: formUtils.isRequiredField("exemptedFromTax"),
|
|
24818
|
-
isUen: formUtils.isRequiredField("isUen")
|
|
24845
|
+
isUen: formUtils.isRequiredField("isUen"),
|
|
24846
|
+
country: formData.country
|
|
24819
24847
|
})
|
|
24820
24848
|
}), hasCompanySearchProvider && jsx(CompanyLookupComponent, {
|
|
24821
24849
|
defaultData: data,
|
|
@@ -24827,6 +24855,7 @@ function CompanyBasics({
|
|
|
24827
24855
|
handleChangeFor,
|
|
24828
24856
|
setLoading,
|
|
24829
24857
|
setKompanyAddress,
|
|
24858
|
+
setKompanyVerifiedData,
|
|
24830
24859
|
handleCompanyIndexSearch,
|
|
24831
24860
|
handleCompanyDeepSearch,
|
|
24832
24861
|
handleGetCompanyDataset,
|
|
@@ -24838,53 +24867,51 @@ function CompanyBasics({
|
|
|
24838
24867
|
}
|
|
24839
24868
|
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);
|
|
24840
24869
|
const CompanyOtherDetailsComponent$1 = "";
|
|
24841
|
-
const BUSINESS_REGISTRATION_NUMBER_FIELD = ["
|
|
24870
|
+
const BUSINESS_REGISTRATION_NUMBER_FIELD = ["registrationNumber", "exemptedFromRegistrationNumber"];
|
|
24842
24871
|
function BusinessRegistrationNumberField({
|
|
24843
24872
|
data,
|
|
24844
24873
|
valid,
|
|
24845
24874
|
errors,
|
|
24846
24875
|
labels: labels2,
|
|
24876
|
+
mask,
|
|
24877
|
+
guidanceText,
|
|
24847
24878
|
placeholders,
|
|
24848
|
-
helperText,
|
|
24849
24879
|
readonly,
|
|
24850
|
-
classNameModifiers,
|
|
24851
24880
|
canExempt,
|
|
24852
24881
|
handleChangeFor
|
|
24853
24882
|
}) {
|
|
24854
24883
|
return jsxs(Fragment, {
|
|
24855
|
-
children: [jsx(
|
|
24856
|
-
|
|
24857
|
-
label: labels2
|
|
24858
|
-
|
|
24859
|
-
|
|
24860
|
-
|
|
24861
|
-
|
|
24862
|
-
|
|
24863
|
-
|
|
24864
|
-
|
|
24865
|
-
|
|
24866
|
-
|
|
24867
|
-
|
|
24868
|
-
|
|
24869
|
-
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
24874
|
-
|
|
24875
|
-
onBlur: handleChangeFor("businessRegistrationNumber", "blur")
|
|
24876
|
-
})
|
|
24884
|
+
children: [jsx(MaskedInputText, {
|
|
24885
|
+
"aria-required": true,
|
|
24886
|
+
"aria-label": labels2.registrationNumber,
|
|
24887
|
+
"aria-invalid": !valid.registrationNumber,
|
|
24888
|
+
classNameModifiers: {
|
|
24889
|
+
field: ["registrationNumber"],
|
|
24890
|
+
input: ["registrationNumber"]
|
|
24891
|
+
},
|
|
24892
|
+
name: "registrationNumber",
|
|
24893
|
+
value: (data == null ? void 0 : data.registrationNumber) ?? "",
|
|
24894
|
+
label: labels2.registrationNumber ?? "",
|
|
24895
|
+
formatGuidance: (guidanceText == null ? void 0 : guidanceText.registrationNumber) ?? "",
|
|
24896
|
+
placeholder: placeholders == null ? void 0 : placeholders.registrationNumber,
|
|
24897
|
+
errorMessage: errors.registrationNumber,
|
|
24898
|
+
isValid: Boolean(valid.registrationNumber),
|
|
24899
|
+
onInput: handleChangeFor("registrationNumber", "input"),
|
|
24900
|
+
onBlur: handleChangeFor("registrationNumber", "blur"),
|
|
24901
|
+
disabled: data.exemptedFromRegistrationNumber,
|
|
24902
|
+
readonly,
|
|
24903
|
+
...mask
|
|
24877
24904
|
}), canExempt && jsx(Checkbox, {
|
|
24878
24905
|
"aria-required": false,
|
|
24879
|
-
"aria-label": labels2 == null ? void 0 : labels2.
|
|
24906
|
+
"aria-label": labels2 == null ? void 0 : labels2.exemptedFromRegistrationNumber,
|
|
24880
24907
|
"aria-invalid": false,
|
|
24881
|
-
name: "
|
|
24882
|
-
value: "
|
|
24883
|
-
checked: Boolean(data.
|
|
24884
|
-
label: labels2 == null ? void 0 : labels2.
|
|
24908
|
+
name: "exemptedFromRegistrationNumber",
|
|
24909
|
+
value: "exemptedFromRegistrationNumber",
|
|
24910
|
+
checked: Boolean(data.exemptedFromRegistrationNumber),
|
|
24911
|
+
label: labels2 == null ? void 0 : labels2.exemptedFromRegistrationNumber,
|
|
24885
24912
|
readonly,
|
|
24886
24913
|
classNameModifiers: ["exempted-from-registration"],
|
|
24887
|
-
onChange: handleChangeFor("
|
|
24914
|
+
onChange: handleChangeFor("exemptedFromRegistrationNumber")
|
|
24888
24915
|
})]
|
|
24889
24916
|
});
|
|
24890
24917
|
}
|
|
@@ -24919,6 +24946,17 @@ function DateOfIncorporationField({
|
|
|
24919
24946
|
})
|
|
24920
24947
|
});
|
|
24921
24948
|
}
|
|
24949
|
+
const DateOfIncorporationFieldValidation = () => ({
|
|
24950
|
+
dateOfIncorporation: [{
|
|
24951
|
+
modes: ["blur"],
|
|
24952
|
+
validate: (dateOfIncorporation2) => !isEmpty(dateOfIncorporation2),
|
|
24953
|
+
errorMessage: "fieldIsRequired"
|
|
24954
|
+
}, {
|
|
24955
|
+
modes: ["blur"],
|
|
24956
|
+
validate: (dateOfIncorporation2) => dateOfIncorporation2 ? new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date() : false,
|
|
24957
|
+
errorMessage: "invalidDateOfIncorporation"
|
|
24958
|
+
}]
|
|
24959
|
+
});
|
|
24922
24960
|
const STOCK_EXCHANGE_MIC_FIELD = ["stockExchangeMIC"];
|
|
24923
24961
|
function StockExchangeMICField({
|
|
24924
24962
|
data,
|
|
@@ -24952,6 +24990,13 @@ function StockExchangeMICField({
|
|
|
24952
24990
|
})
|
|
24953
24991
|
});
|
|
24954
24992
|
}
|
|
24993
|
+
const StockExchangeMICFieldValidation = () => ({
|
|
24994
|
+
stockExchangeMIC: [{
|
|
24995
|
+
modes: ["blur"],
|
|
24996
|
+
validate: (stockExchangeMIC2) => !isEmpty(stockExchangeMIC2),
|
|
24997
|
+
errorMessage: "fieldIsRequired"
|
|
24998
|
+
}]
|
|
24999
|
+
});
|
|
24955
25000
|
const STOCK_ISIN_FIELD = ["stockISIN"];
|
|
24956
25001
|
function StockISINField({
|
|
24957
25002
|
data,
|
|
@@ -24985,6 +25030,17 @@ function StockISINField({
|
|
|
24985
25030
|
})
|
|
24986
25031
|
});
|
|
24987
25032
|
}
|
|
25033
|
+
const StockISINFieldValidation = () => ({
|
|
25034
|
+
stockISIN: [{
|
|
25035
|
+
modes: ["blur"],
|
|
25036
|
+
validate: (stockISIN2) => !isEmpty(stockISIN2),
|
|
25037
|
+
errorMessage: "fieldIsRequired"
|
|
25038
|
+
}, {
|
|
25039
|
+
modes: ["blur"],
|
|
25040
|
+
validate: (input) => exactLength(input, 12),
|
|
25041
|
+
errorMessage: "validationPleaseEnterAValidStockISIN"
|
|
25042
|
+
}]
|
|
25043
|
+
});
|
|
24988
25044
|
const TRADING_NAME_FIELD = ["tradingName", "sameNameAsLegalName"];
|
|
24989
25045
|
function TradingNameField({
|
|
24990
25046
|
data,
|
|
@@ -25036,12 +25092,21 @@ function TradingNameField({
|
|
|
25036
25092
|
})]
|
|
25037
25093
|
});
|
|
25038
25094
|
}
|
|
25095
|
+
const TradingNameFieldValidation = () => ({
|
|
25096
|
+
tradingName: [{
|
|
25097
|
+
modes: ["blur"],
|
|
25098
|
+
validate: (tradingName2) => !isEmpty(tradingName2),
|
|
25099
|
+
errorMessage: "fieldIsRequired"
|
|
25100
|
+
}]
|
|
25101
|
+
});
|
|
25039
25102
|
const VAT_NUMBER_FIELD = ["vatNumber", "exemptedFromVat", "vatAbsenceReason"];
|
|
25040
25103
|
function VatNumberField({
|
|
25041
25104
|
data,
|
|
25042
25105
|
valid,
|
|
25043
25106
|
errors,
|
|
25044
25107
|
labels: labels2,
|
|
25108
|
+
mask,
|
|
25109
|
+
guidanceText,
|
|
25045
25110
|
placeholders,
|
|
25046
25111
|
readonly,
|
|
25047
25112
|
handleChangeFor,
|
|
@@ -25051,25 +25116,26 @@ function VatNumberField({
|
|
|
25051
25116
|
i18n
|
|
25052
25117
|
} = useI18nContext();
|
|
25053
25118
|
return jsxs(Fragment, {
|
|
25054
|
-
children: [jsx(
|
|
25119
|
+
children: [jsx(MaskedInputText, {
|
|
25120
|
+
"aria-required": true,
|
|
25121
|
+
"aria-label": labels2.vatNumber,
|
|
25122
|
+
"aria-invalid": !valid.vatNumber,
|
|
25123
|
+
classNameModifiers: {
|
|
25124
|
+
field: ["tax-id"],
|
|
25125
|
+
input: ["vatNumber"]
|
|
25126
|
+
},
|
|
25055
25127
|
name: "vatNumber",
|
|
25056
|
-
|
|
25057
|
-
|
|
25128
|
+
value: (data == null ? void 0 : data.vatNumber) ?? "",
|
|
25129
|
+
label: labels2.vatNumber ?? "",
|
|
25130
|
+
formatGuidance: (guidanceText == null ? void 0 : guidanceText.vatNumber) ?? "",
|
|
25131
|
+
placeholder: placeholders == null ? void 0 : placeholders.vatNumber,
|
|
25058
25132
|
errorMessage: errors.vatNumber,
|
|
25059
|
-
isValid: valid.vatNumber,
|
|
25060
|
-
|
|
25061
|
-
|
|
25062
|
-
|
|
25063
|
-
|
|
25064
|
-
|
|
25065
|
-
name: "vatNumber",
|
|
25066
|
-
value: data.vatNumber,
|
|
25067
|
-
readonly,
|
|
25068
|
-
classNameModifiers: ["vatNumber"],
|
|
25069
|
-
onInput: handleChangeFor("vatNumber", "input"),
|
|
25070
|
-
onBlur: handleChangeFor("vatNumber", "blur"),
|
|
25071
|
-
disabled: data.exemptedFromVat
|
|
25072
|
-
})
|
|
25133
|
+
isValid: Boolean(valid.vatNumber),
|
|
25134
|
+
onInput: handleChangeFor("vatNumber", "input"),
|
|
25135
|
+
onBlur: handleChangeFor("vatNumber", "blur"),
|
|
25136
|
+
disabled: data.exemptedFromVat,
|
|
25137
|
+
readonly,
|
|
25138
|
+
...mask
|
|
25073
25139
|
}), canExempt && jsx(Checkbox, {
|
|
25074
25140
|
"aria-required": false,
|
|
25075
25141
|
"aria-label": labels2 == null ? void 0 : labels2.exemptedFromVat,
|
|
@@ -25119,43 +25185,119 @@ function CompanyOtherDetails({
|
|
|
25119
25185
|
readOnlyFields,
|
|
25120
25186
|
country: country2,
|
|
25121
25187
|
legalCompanyName: legalCompanyName2,
|
|
25122
|
-
companyType: companyType2
|
|
25188
|
+
companyType: companyType2,
|
|
25189
|
+
kompanyVerifiedData
|
|
25123
25190
|
}) {
|
|
25191
|
+
var _a, _b, _c, _d;
|
|
25124
25192
|
const {
|
|
25125
25193
|
i18n
|
|
25126
25194
|
} = useI18nContext();
|
|
25195
|
+
const {
|
|
25196
|
+
isExperimentEnabled
|
|
25197
|
+
} = useExperimentsContext();
|
|
25127
25198
|
const {
|
|
25128
25199
|
sliceData,
|
|
25129
25200
|
updateStateSlice
|
|
25130
25201
|
} = useGlobalDataSlice(COMPANY_OTHER_DETAILS_FORM_ID);
|
|
25202
|
+
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);
|
|
25203
|
+
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);
|
|
25204
|
+
const [taxIdentificationNumberType, setTaxIdentificationNumberType] = useState$1(existingTaxIdentificationNumber ? inferTaxIdNumberType(existingTaxIdentificationNumber, country2) : (_d = taxIdNumberOptions[country2]) == null ? void 0 : _d[0].id);
|
|
25205
|
+
const isTypeSelectorEnabled = isExperimentEnabled(ExperimentNames.EnableIdentityFieldTypeSelector);
|
|
25131
25206
|
const directChildFields = companyOtherDetailsFields.filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
|
|
25132
25207
|
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]);
|
|
25133
|
-
const
|
|
25208
|
+
const initialFormUtilsProps = useMemo$1(() => ({
|
|
25209
|
+
labels: labels2,
|
|
25210
|
+
placeholders,
|
|
25211
|
+
helperText,
|
|
25212
|
+
readOnly,
|
|
25213
|
+
requiredFields,
|
|
25214
|
+
readOnlyFields,
|
|
25215
|
+
optionalFields,
|
|
25216
|
+
maskedFields,
|
|
25217
|
+
shouldValidate
|
|
25218
|
+
}), [helperText, labels2, maskedFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
25219
|
+
const mergedFieldProps = useMemo$1(() => {
|
|
25220
|
+
var _a2;
|
|
25221
|
+
return (_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.reduce((acc, field) => {
|
|
25222
|
+
switch (field) {
|
|
25223
|
+
case "tradingName":
|
|
25224
|
+
return {
|
|
25225
|
+
...acc,
|
|
25226
|
+
validators: {
|
|
25227
|
+
...acc.validators,
|
|
25228
|
+
...TradingNameFieldValidation()
|
|
25229
|
+
}
|
|
25230
|
+
};
|
|
25231
|
+
case "dateOfIncorporation":
|
|
25232
|
+
return {
|
|
25233
|
+
...acc,
|
|
25234
|
+
validators: {
|
|
25235
|
+
...acc.validators,
|
|
25236
|
+
...DateOfIncorporationFieldValidation()
|
|
25237
|
+
}
|
|
25238
|
+
};
|
|
25239
|
+
case "stockExchangeMIC":
|
|
25240
|
+
return {
|
|
25241
|
+
...acc,
|
|
25242
|
+
validators: {
|
|
25243
|
+
...acc.validators,
|
|
25244
|
+
...StockExchangeMICFieldValidation()
|
|
25245
|
+
}
|
|
25246
|
+
};
|
|
25247
|
+
case "stockISIN":
|
|
25248
|
+
return {
|
|
25249
|
+
...acc,
|
|
25250
|
+
validators: {
|
|
25251
|
+
...acc.validators,
|
|
25252
|
+
...StockISINFieldValidation()
|
|
25253
|
+
}
|
|
25254
|
+
};
|
|
25255
|
+
case "registrationNumber":
|
|
25256
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$3[country2], {
|
|
25257
|
+
companyType: companyType2,
|
|
25258
|
+
registrationNumberType
|
|
25259
|
+
}, defaultFieldMetadata$3), acc);
|
|
25260
|
+
case "taxInformation":
|
|
25261
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
|
|
25262
|
+
taxIdNumberType: taxIdentificationNumberType
|
|
25263
|
+
}, defaultFieldMetadata), acc);
|
|
25264
|
+
case "vatNumber":
|
|
25265
|
+
return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$1[country2], {
|
|
25266
|
+
vatNumberType: taxIdentificationNumberType
|
|
25267
|
+
}, defaultFieldMetadata$1), acc);
|
|
25268
|
+
default:
|
|
25269
|
+
return acc;
|
|
25270
|
+
}
|
|
25271
|
+
}, initialFormUtilsProps);
|
|
25272
|
+
}, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdentificationNumberType]);
|
|
25134
25273
|
const {
|
|
25135
25274
|
schema: formSchema,
|
|
25136
25275
|
data: formData,
|
|
25137
25276
|
errors: formErrors,
|
|
25138
25277
|
valid: formValid,
|
|
25139
25278
|
fieldProblems: formFieldProblems,
|
|
25140
|
-
handleChangeFor
|
|
25279
|
+
handleChangeFor,
|
|
25280
|
+
triggerValidation
|
|
25141
25281
|
} = useForm({
|
|
25142
25282
|
schema,
|
|
25143
25283
|
defaultData: data,
|
|
25144
|
-
rules:
|
|
25284
|
+
rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
|
|
25285
|
+
optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
|
|
25286
|
+
maskedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.maskedFields,
|
|
25145
25287
|
fieldProblems: fieldValidationErrors,
|
|
25146
|
-
optionalFields,
|
|
25147
|
-
maskedFields,
|
|
25148
25288
|
shouldValidate
|
|
25149
25289
|
});
|
|
25150
|
-
const formUtils = formUtilities(
|
|
25151
|
-
|
|
25152
|
-
|
|
25153
|
-
|
|
25154
|
-
|
|
25155
|
-
|
|
25156
|
-
|
|
25157
|
-
|
|
25158
|
-
},
|
|
25290
|
+
const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
|
|
25291
|
+
const handleBusinessRegistrationNumberTypeChange = useCallback$1((type) => {
|
|
25292
|
+
setRegistrationNumberType(type);
|
|
25293
|
+
triggerValidation(["registrationNumber"]);
|
|
25294
|
+
}, [triggerValidation]);
|
|
25295
|
+
const handleTaxIdentificationNumberTypeChange = useCallback$1((type) => {
|
|
25296
|
+
setTaxIdentificationNumberType(type);
|
|
25297
|
+
triggerValidation(["vatNumber", "taxInformation"]);
|
|
25298
|
+
}, [triggerValidation]);
|
|
25299
|
+
useEffect$1(() => {
|
|
25300
|
+
}, [kompanyVerifiedData]);
|
|
25159
25301
|
useEffect$1(() => {
|
|
25160
25302
|
updateStateSlice({
|
|
25161
25303
|
schema: formSchema,
|
|
@@ -25193,6 +25335,61 @@ function CompanyOtherDetails({
|
|
|
25193
25335
|
handleChangeFor,
|
|
25194
25336
|
legalCompanyName: legalCompanyName2
|
|
25195
25337
|
})
|
|
25338
|
+
}), isTypeSelectorEnabled && companyType2 && formUtils.isRequiredField("registrationNumber") && jsx(CompanyRegistrationNumberTypeSelector, {
|
|
25339
|
+
companyType: companyType2,
|
|
25340
|
+
country: country2,
|
|
25341
|
+
setSelected: handleBusinessRegistrationNumberTypeChange,
|
|
25342
|
+
selected: registrationNumberType
|
|
25343
|
+
}), formUtils.isRequiredField("registrationNumber") && jsx("div", {
|
|
25344
|
+
className: "adyen-kyc-field-wrapper",
|
|
25345
|
+
children: jsx(BusinessRegistrationNumberField, {
|
|
25346
|
+
data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25347
|
+
valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25348
|
+
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25349
|
+
labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25350
|
+
mask: formUtils.getMask("registrationNumber"),
|
|
25351
|
+
guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25352
|
+
placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25353
|
+
helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25354
|
+
readonly: formUtils.isReadOnly("registrationNumber"),
|
|
25355
|
+
handleChangeFor,
|
|
25356
|
+
canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber")
|
|
25357
|
+
})
|
|
25358
|
+
}), isTypeSelectorEnabled && formUtils.isRequiredField("vatNumber") && jsx(TaxIdNumberTypeSelector, {
|
|
25359
|
+
country: country2,
|
|
25360
|
+
setSelected: handleTaxIdentificationNumberTypeChange,
|
|
25361
|
+
selected: taxIdentificationNumberType
|
|
25362
|
+
}), formUtils.isRequiredField("vatNumber") && jsx("div", {
|
|
25363
|
+
className: "adyen-kyc-field-wrapper",
|
|
25364
|
+
children: jsx(VatNumberField, {
|
|
25365
|
+
data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
|
|
25366
|
+
valid: formUtils.getFieldValid(formValid, VAT_NUMBER_FIELD),
|
|
25367
|
+
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, VAT_NUMBER_FIELD),
|
|
25368
|
+
labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD),
|
|
25369
|
+
mask: formUtils.getMask("vatNumber"),
|
|
25370
|
+
guidanceText: formUtils.getFieldGuidanceText(VAT_NUMBER_FIELD),
|
|
25371
|
+
placeholders: formUtils.getFieldPlaceholders(VAT_NUMBER_FIELD),
|
|
25372
|
+
readonly: formUtils.isReadOnly("vatNumber"),
|
|
25373
|
+
handleChangeFor,
|
|
25374
|
+
country: country2,
|
|
25375
|
+
canExempt: formUtils.isRequiredField("exemptedFromVat")
|
|
25376
|
+
})
|
|
25377
|
+
}), formUtils.isRequiredField("taxInformation") && jsx("div", {
|
|
25378
|
+
className: "adyen-kyc-field-wrapper",
|
|
25379
|
+
children: jsx(TaxInformationField, {
|
|
25380
|
+
data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
|
|
25381
|
+
valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
|
|
25382
|
+
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
|
|
25383
|
+
labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
|
|
25384
|
+
mask: formUtils.getMask("taxInformation"),
|
|
25385
|
+
helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
|
|
25386
|
+
guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
|
|
25387
|
+
readonly: formUtils.isReadOnly("taxInformation"),
|
|
25388
|
+
handleChangeFor,
|
|
25389
|
+
country: country2,
|
|
25390
|
+
canExempt: formUtils.isRequiredField("exemptedFromTax"),
|
|
25391
|
+
isUen: formUtils.isRequiredField("isUen")
|
|
25392
|
+
})
|
|
25196
25393
|
}), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
|
|
25197
25394
|
className: "adyen-kyc-field-wrapper",
|
|
25198
25395
|
children: jsx(DateOfIncorporationField, {
|
|
@@ -25231,50 +25428,11 @@ function CompanyOtherDetails({
|
|
|
25231
25428
|
readonly: formUtils.isReadOnly("stockISIN"),
|
|
25232
25429
|
handleChangeFor
|
|
25233
25430
|
})
|
|
25234
|
-
}), formUtils.isRequiredField("businessRegistrationNumber") && jsx("div", {
|
|
25235
|
-
className: "adyen-kyc-field-wrapper",
|
|
25236
|
-
children: jsx(BusinessRegistrationNumberField, {
|
|
25237
|
-
data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25238
|
-
valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25239
|
-
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25240
|
-
labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25241
|
-
placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25242
|
-
helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
|
|
25243
|
-
readonly: formUtils.isReadOnly("businessRegistrationNumber"),
|
|
25244
|
-
handleChangeFor,
|
|
25245
|
-
canExempt: formUtils.isRequiredField("exemptedFromBusinessRegistrationNumber")
|
|
25246
|
-
})
|
|
25247
|
-
}), formUtils.isRequiredField("taxInformation") && jsx("div", {
|
|
25248
|
-
className: "adyen-kyc-field-wrapper",
|
|
25249
|
-
children: jsx(TaxInformationField, {
|
|
25250
|
-
data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
|
|
25251
|
-
valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
|
|
25252
|
-
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
|
|
25253
|
-
labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
|
|
25254
|
-
readonly: formUtils.isReadOnly("taxInformation"),
|
|
25255
|
-
handleChangeFor,
|
|
25256
|
-
country: country2,
|
|
25257
|
-
canExempt: formUtils.isRequiredField("exemptedFromTax"),
|
|
25258
|
-
isUen: formUtils.isRequiredField("isUen")
|
|
25259
|
-
})
|
|
25260
|
-
}), formUtils.isRequiredField("vatNumber") && jsx("div", {
|
|
25261
|
-
className: "adyen-kyc-field-wrapper",
|
|
25262
|
-
children: jsx(VatNumberField, {
|
|
25263
|
-
data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
|
|
25264
|
-
valid: formUtils.getFieldValid(formValid, VAT_NUMBER_FIELD),
|
|
25265
|
-
errors: formUtils.getFieldErrors(formErrors, formFieldProblems, VAT_NUMBER_FIELD),
|
|
25266
|
-
labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD),
|
|
25267
|
-
placeholders: formUtils.getFieldPlaceholders(VAT_NUMBER_FIELD),
|
|
25268
|
-
readonly: formUtils.isReadOnly("vatNumber"),
|
|
25269
|
-
handleChangeFor,
|
|
25270
|
-
country: country2,
|
|
25271
|
-
canExempt: formUtils.isRequiredField("exemptedFromVat")
|
|
25272
|
-
})
|
|
25273
25431
|
})]
|
|
25274
25432
|
})]
|
|
25275
25433
|
});
|
|
25276
25434
|
}
|
|
25277
|
-
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.
|
|
25435
|
+
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);
|
|
25278
25436
|
const CompanyStructureComponent$1 = "";
|
|
25279
25437
|
const CompanyStructureValidation = {
|
|
25280
25438
|
entityType: {
|
|
@@ -25292,7 +25450,8 @@ function CompanyStructure({
|
|
|
25292
25450
|
description: description2,
|
|
25293
25451
|
formVerificationErrors,
|
|
25294
25452
|
fieldValidationErrors,
|
|
25295
|
-
requiredFields
|
|
25453
|
+
requiredFields,
|
|
25454
|
+
kompanyVerifiedData
|
|
25296
25455
|
}) {
|
|
25297
25456
|
const {
|
|
25298
25457
|
i18n
|
|
@@ -25318,6 +25477,12 @@ function CompanyStructure({
|
|
|
25318
25477
|
labels: labels2,
|
|
25319
25478
|
requiredFields
|
|
25320
25479
|
}, i18n);
|
|
25480
|
+
useEffect(() => {
|
|
25481
|
+
var _a, _b;
|
|
25482
|
+
if ((_a = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a.entityType) {
|
|
25483
|
+
handleChangeFor("entityType")((_b = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _b.entityType);
|
|
25484
|
+
}
|
|
25485
|
+
}, [kompanyVerifiedData]);
|
|
25321
25486
|
useEffect(() => {
|
|
25322
25487
|
updateStateSlice({
|
|
25323
25488
|
schema: formSchema,
|
|
@@ -25355,7 +25520,7 @@ function CompanyStructure({
|
|
|
25355
25520
|
})]
|
|
25356
25521
|
});
|
|
25357
25522
|
}
|
|
25358
|
-
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));
|
|
25523
|
+
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);
|
|
25359
25524
|
const forms = {
|
|
25360
25525
|
companyBasics: {
|
|
25361
25526
|
formId: "companyBasics",
|
|
@@ -25392,32 +25557,40 @@ const forms = {
|
|
|
25392
25557
|
fields: ["taxDocument"]
|
|
25393
25558
|
}
|
|
25394
25559
|
};
|
|
25395
|
-
const parseConfiguration$
|
|
25560
|
+
const parseConfiguration$4 = ({
|
|
25396
25561
|
country: country2,
|
|
25397
25562
|
matchingScenario
|
|
25398
25563
|
}) => parseCompanySearchScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.ORGANIZATION], country2);
|
|
25399
25564
|
const mandatoryApiFieldsForCompanySearch = ["companyBasics.legalCompanyName", "companyBasics.country"];
|
|
25400
|
-
const canSubmit = (data) => mandatoryApiFieldsForCompanySearch.every((detail) => {
|
|
25565
|
+
const canSubmit$1 = (data) => mandatoryApiFieldsForCompanySearch.every((detail) => {
|
|
25401
25566
|
const value = getProp(data, detail);
|
|
25402
25567
|
return !isEmpty$1(value);
|
|
25403
25568
|
});
|
|
25404
|
-
const isDocumentsRequired = (forms$1) => forms$1.some((form) => [forms.companyRegistrationDocument.formId, forms.companyTaxDocument.formId].includes(form.formId));
|
|
25405
|
-
const formatOtherDetails = (formData, i18n) => {
|
|
25569
|
+
const isDocumentsRequired$1 = (forms$1) => forms$1.some((form) => [forms.companyRegistrationDocument.formId, forms.companyTaxDocument.formId].includes(form.formId));
|
|
25570
|
+
const formatOtherDetails = (formData, i18n, country2, labels2) => {
|
|
25571
|
+
var _a, _b, _c;
|
|
25572
|
+
const summaryData = {
|
|
25573
|
+
...formData,
|
|
25574
|
+
[((_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
|
|
25575
|
+
};
|
|
25576
|
+
if (formData.taxInformation) {
|
|
25577
|
+
delete summaryData.taxInformation;
|
|
25578
|
+
}
|
|
25406
25579
|
if (formData.exemptedFromVat) {
|
|
25407
|
-
|
|
25408
|
-
...formData,
|
|
25409
|
-
"VAT absence reason": i18n.get(formData.vatAbsenceReason)
|
|
25410
|
-
};
|
|
25411
|
-
delete summaryData.vatAbsenceReason;
|
|
25580
|
+
summaryData.vatAbsenceReason = i18n.get(formData.vatAbsenceReason);
|
|
25412
25581
|
delete summaryData.vatNumber;
|
|
25413
|
-
return summaryData;
|
|
25414
25582
|
}
|
|
25415
|
-
return
|
|
25583
|
+
return summaryData;
|
|
25416
25584
|
};
|
|
25417
|
-
const formatDataForSummary = (data, forms2, i18n) => {
|
|
25585
|
+
const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
25586
|
+
var _a;
|
|
25418
25587
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
25588
|
+
const country2 = (_a = data.companyBasics) == null ? void 0 : _a.country;
|
|
25589
|
+
const taxIdLabel = resolveFieldMetadata(defaultFieldConfig[country2], {
|
|
25590
|
+
taxIdNumberType: countryToTaxInfoTypeMap[country2]
|
|
25591
|
+
}, defaultFieldMetadata).label;
|
|
25419
25592
|
return entriesOf(data).reduce((summaryData, [form, formData]) => {
|
|
25420
|
-
var
|
|
25593
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
25421
25594
|
if (!form)
|
|
25422
25595
|
return summaryData;
|
|
25423
25596
|
switch (form) {
|
|
@@ -25425,10 +25598,10 @@ const formatDataForSummary = (data, forms2, i18n) => {
|
|
|
25425
25598
|
return {
|
|
25426
25599
|
...summaryData,
|
|
25427
25600
|
[form]: {
|
|
25428
|
-
legalCompanyName: formData.legalCompanyName,
|
|
25429
|
-
country: datasetUtils.getCountryName(formData.country),
|
|
25601
|
+
[((_a2 = labels2 == null ? void 0 : labels2.companyBasics) == null ? void 0 : _a2.legalCompanyName) ?? "legalCompanyName"]: formData.legalCompanyName,
|
|
25602
|
+
[((_b = labels2 == null ? void 0 : labels2.companyBasics) == null ? void 0 : _b.country) ?? "country"]: datasetUtils.getCountryName(formData.country),
|
|
25430
25603
|
[getKeyForField("stateOrProvince", formData.country)]: datasetUtils.getStateName(formData.stateOrProvince, formData.country),
|
|
25431
|
-
|
|
25604
|
+
[taxIdLabel]: (_d = (_c = formData.taxInformation) == null ? void 0 : _c.find((taxId2) => formData.country === taxId2.country)) == null ? void 0 : _d.number
|
|
25432
25605
|
}
|
|
25433
25606
|
};
|
|
25434
25607
|
case "companyRegistrationAddress":
|
|
@@ -25444,33 +25617,33 @@ const formatDataForSummary = (data, forms2, i18n) => {
|
|
|
25444
25617
|
return {
|
|
25445
25618
|
...summaryData,
|
|
25446
25619
|
[form]: {
|
|
25447
|
-
entityType: i18n.get((
|
|
25620
|
+
entityType: i18n.get((_e = companyTypes.find((type) => type.id === formData.entityType)) == null ? void 0 : _e.name)
|
|
25448
25621
|
}
|
|
25449
25622
|
};
|
|
25450
25623
|
case "companyOtherDetails":
|
|
25451
25624
|
return {
|
|
25452
25625
|
...summaryData,
|
|
25453
|
-
[form]: formatOtherDetails(formData, i18n)
|
|
25626
|
+
[form]: formatOtherDetails(formData, i18n, (_f = data.companyBasics) == null ? void 0 : _f.country, labels2)
|
|
25454
25627
|
};
|
|
25455
25628
|
case "companyRegistrationDocument":
|
|
25456
|
-
if (!isDocumentsRequired(forms2))
|
|
25629
|
+
if (!isDocumentsRequired$1(forms2))
|
|
25457
25630
|
return summaryData;
|
|
25458
25631
|
return {
|
|
25459
25632
|
...summaryData,
|
|
25460
25633
|
[form]: {
|
|
25461
25634
|
companyRegistrationDocument: {
|
|
25462
|
-
fileName: (
|
|
25635
|
+
fileName: (_h = (_g = formData == null ? void 0 : formData.registrationDocument) == null ? void 0 : _g[0]) == null ? void 0 : _h.name
|
|
25463
25636
|
}
|
|
25464
25637
|
}
|
|
25465
25638
|
};
|
|
25466
25639
|
case "companyTaxDocument":
|
|
25467
|
-
if (!isDocumentsRequired(forms2))
|
|
25640
|
+
if (!isDocumentsRequired$1(forms2))
|
|
25468
25641
|
return summaryData;
|
|
25469
25642
|
return {
|
|
25470
25643
|
...summaryData,
|
|
25471
25644
|
[form]: {
|
|
25472
25645
|
companyTaxDocument: {
|
|
25473
|
-
fileName: (
|
|
25646
|
+
fileName: (_j = (_i = formData == null ? void 0 : formData.taxDocument) == null ? void 0 : _i[0]) == null ? void 0 : _j.name
|
|
25474
25647
|
}
|
|
25475
25648
|
}
|
|
25476
25649
|
};
|
|
@@ -25630,7 +25803,7 @@ function useCompanySearchTaskSubmit({
|
|
|
25630
25803
|
legalEntity,
|
|
25631
25804
|
currentForms
|
|
25632
25805
|
}) => {
|
|
25633
|
-
if (!isDocumentsRequired(currentForms))
|
|
25806
|
+
if (!isDocumentsRequired$1(currentForms))
|
|
25634
25807
|
return;
|
|
25635
25808
|
const formattedDocument = await mapCompanySearchDocumentToApiDocument(data, legalEntity.id);
|
|
25636
25809
|
try {
|
|
@@ -25741,6 +25914,7 @@ function CompanySearchComponent(props) {
|
|
|
25741
25914
|
} = useI18nContext();
|
|
25742
25915
|
const {
|
|
25743
25916
|
country: country2,
|
|
25917
|
+
isTopLevelEntity,
|
|
25744
25918
|
activeForm,
|
|
25745
25919
|
problems,
|
|
25746
25920
|
handleAddressSearch,
|
|
@@ -25753,6 +25927,7 @@ function CompanySearchComponent(props) {
|
|
|
25753
25927
|
} = props;
|
|
25754
25928
|
const globalData = useGlobalData();
|
|
25755
25929
|
const [kompanyAddress, setKompanyAddress] = useState();
|
|
25930
|
+
const [kompanyVerifiedData, setKompanyVerifiedData] = useState();
|
|
25756
25931
|
const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
|
|
25757
25932
|
return jsxs("div", {
|
|
25758
25933
|
className: "adyen-kyc-company",
|
|
@@ -25763,13 +25938,15 @@ function CompanySearchComponent(props) {
|
|
|
25763
25938
|
id: forms.companyBasics.formId,
|
|
25764
25939
|
heading: i18n.get(forms.companyBasics.formName),
|
|
25765
25940
|
country: country2,
|
|
25941
|
+
isTopLevelEntity,
|
|
25766
25942
|
handleCompanyIndexSearch,
|
|
25767
25943
|
handleCompanyDeepSearch,
|
|
25768
25944
|
handleGetCompanyDataset,
|
|
25769
25945
|
handleRefreshCompanyDataset,
|
|
25770
25946
|
handleVerifyTin,
|
|
25771
25947
|
kompanyAddress,
|
|
25772
|
-
setKompanyAddress
|
|
25948
|
+
setKompanyAddress,
|
|
25949
|
+
setKompanyVerifiedData
|
|
25773
25950
|
})
|
|
25774
25951
|
}), jsx("div", {
|
|
25775
25952
|
className: formWrapperClasses(forms.companyRegistrationAddress.formId),
|
|
@@ -25792,7 +25969,8 @@ function CompanySearchComponent(props) {
|
|
|
25792
25969
|
...getFormProps(props, forms.companyStructure.formId),
|
|
25793
25970
|
id: forms.companyStructure.formId,
|
|
25794
25971
|
heading: i18n.get(forms.companyStructure.formName),
|
|
25795
|
-
description: i18n.get(forms.companyStructure.formDescription)
|
|
25972
|
+
description: i18n.get(forms.companyStructure.formDescription),
|
|
25973
|
+
kompanyVerifiedData
|
|
25796
25974
|
})
|
|
25797
25975
|
}), jsx("div", {
|
|
25798
25976
|
className: formWrapperClasses(forms.companyOtherDetails.formId),
|
|
@@ -25802,7 +25980,8 @@ function CompanySearchComponent(props) {
|
|
|
25802
25980
|
heading: i18n.get(forms.companyOtherDetails.formName),
|
|
25803
25981
|
country: country2,
|
|
25804
25982
|
legalCompanyName: (_a = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _a.legalCompanyName,
|
|
25805
|
-
companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType
|
|
25983
|
+
companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
|
|
25984
|
+
kompanyVerifiedData
|
|
25806
25985
|
})
|
|
25807
25986
|
}), jsx("div", {
|
|
25808
25987
|
className: formWrapperClasses(forms.companyRegistrationDocument.formId),
|
|
@@ -25947,13 +26126,13 @@ function CompanySearchDropinComponent({
|
|
|
25947
26126
|
}, [documentUtils, eventEmitter, i18n, initialData, legalEntityResponse, setLocale, showToast]);
|
|
25948
26127
|
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
25949
26128
|
legalEntityType: LegalEntityType.ORGANIZATION,
|
|
25950
|
-
capabilities: capabilities ??
|
|
26129
|
+
capabilities: capabilities ?? Object.keys(legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities),
|
|
25951
26130
|
country: country2
|
|
25952
|
-
}), [getConfiguration2, capabilities, country2]);
|
|
26131
|
+
}), [getConfiguration2, capabilities, country2, legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities]);
|
|
25953
26132
|
const {
|
|
25954
26133
|
fieldConfigurations
|
|
25955
26134
|
} = useScenarioConfiguration({
|
|
25956
|
-
parseConfiguration: parseConfiguration$
|
|
26135
|
+
parseConfiguration: parseConfiguration$4,
|
|
25957
26136
|
getConfigurationData,
|
|
25958
26137
|
setLoadingStatus,
|
|
25959
26138
|
country: country2
|
|
@@ -25989,10 +26168,10 @@ function CompanySearchDropinComponent({
|
|
|
25989
26168
|
return addValidityToForms(requiredForms, currentState.validityByForm, problems);
|
|
25990
26169
|
}, [derivedProps, problems, currentState.validityByForm]);
|
|
25991
26170
|
const summaryData = useMemo(() => ({
|
|
25992
|
-
data: formatDataForSummary(currentState.data, forms$1, i18n),
|
|
26171
|
+
data: formatDataForSummary(currentState.data, forms$1, derivedProps == null ? void 0 : derivedProps.labels, i18n),
|
|
25993
26172
|
omittedKeys: ["operationalAddressIsSame"]
|
|
25994
|
-
}), [currentState.data, forms$1, i18n]);
|
|
25995
|
-
const canSubmitForm = useMemo(() => canSubmit(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
|
|
26173
|
+
}), [currentState.data, derivedProps == null ? void 0 : derivedProps.labels, forms$1, i18n]);
|
|
26174
|
+
const canSubmitForm = useMemo(() => canSubmit$1(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
|
|
25996
26175
|
const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
|
|
25997
26176
|
trackingConfig,
|
|
25998
26177
|
parentLegalEntity,
|
|
@@ -26064,6 +26243,7 @@ function CompanySearchDropinComponent({
|
|
|
26064
26243
|
problems,
|
|
26065
26244
|
activeForm,
|
|
26066
26245
|
shouldValidate,
|
|
26246
|
+
isTopLevelEntity: taskType === TaskTypes.COMPANY_SEARCH,
|
|
26067
26247
|
handleAddressSearch,
|
|
26068
26248
|
handleFindAddress,
|
|
26069
26249
|
handleCompanyIndexSearch,
|
|
@@ -28351,7 +28531,7 @@ const omitMaskedFieldsIfUnchanged = (maskedFields, dataSubmitted, savedData) =>
|
|
|
28351
28531
|
});
|
|
28352
28532
|
return filtered;
|
|
28353
28533
|
};
|
|
28354
|
-
const parseConfiguration$
|
|
28534
|
+
const parseConfiguration$3 = ({
|
|
28355
28535
|
country: country2,
|
|
28356
28536
|
matchingScenario
|
|
28357
28537
|
}) => parseIndividualScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.INDIVIDUAL], country2);
|
|
@@ -28435,7 +28615,7 @@ function IndividualDropinComponent({
|
|
|
28435
28615
|
const {
|
|
28436
28616
|
fieldConfigurations
|
|
28437
28617
|
} = useScenarioConfiguration({
|
|
28438
|
-
parseConfiguration: parseConfiguration$
|
|
28618
|
+
parseConfiguration: parseConfiguration$3,
|
|
28439
28619
|
getConfigurationData,
|
|
28440
28620
|
setLoadingStatus,
|
|
28441
28621
|
country: country2
|
|
@@ -28907,14 +29087,14 @@ const rules$1 = ({
|
|
|
28907
29087
|
}
|
|
28908
29088
|
});
|
|
28909
29089
|
const getRegistrationCountry = (legalEntityResponse) => legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? legalEntityResponse.individual.residentialAddress.country : legalEntityResponse.organization.registeredAddress.country;
|
|
28910
|
-
const labels
|
|
29090
|
+
const labels = () => ({
|
|
28911
29091
|
verifiedAccountHolder: () => "accountHolder",
|
|
28912
29092
|
verifiedBankCountry: () => "bankCountry",
|
|
28913
29093
|
verifiedBankName: () => "bankName",
|
|
28914
29094
|
verifiedCurrencyCode: () => "currencyCode",
|
|
28915
29095
|
verifiedBankAccountNumber: () => "bankAccountNumber"
|
|
28916
29096
|
});
|
|
28917
|
-
const parseConfiguration = ({
|
|
29097
|
+
const parseConfiguration$2 = ({
|
|
28918
29098
|
requiredFields,
|
|
28919
29099
|
country: country2,
|
|
28920
29100
|
bankVerificationAvailable
|
|
@@ -29057,7 +29237,7 @@ function PayoutDetailsDropinComponent({
|
|
|
29057
29237
|
requiredFields,
|
|
29058
29238
|
bankVerificationVendors
|
|
29059
29239
|
} = useScenarioConfiguration({
|
|
29060
|
-
parseConfiguration,
|
|
29240
|
+
parseConfiguration: parseConfiguration$2,
|
|
29061
29241
|
getConfigurationData,
|
|
29062
29242
|
getPayoutAccountFormatData,
|
|
29063
29243
|
instantVerificationEnabled,
|
|
@@ -29071,7 +29251,7 @@ function PayoutDetailsDropinComponent({
|
|
|
29071
29251
|
taskType,
|
|
29072
29252
|
requiredFields
|
|
29073
29253
|
}), [bankAccountCountry2, data, taskType]);
|
|
29074
|
-
const fieldsFormCustomLabels = useMemo(() => labels
|
|
29254
|
+
const fieldsFormCustomLabels = useMemo(() => labels ? labels() : {}, [data, bankAccountCountry2]);
|
|
29075
29255
|
const payoutDetailsSteps = useMemo(() => {
|
|
29076
29256
|
var _a2;
|
|
29077
29257
|
return getAppropriatePayoutDetailsSteps(taskType, Boolean((_a2 = prefilledData == null ? void 0 : prefilledData.payoutAccountDetails) == null ? void 0 : _a2.transferInstrumentId), !transferInstrument && isInstantVerificationAvailable({
|
|
@@ -30511,668 +30691,61 @@ function ServiceAgreementDropinComponent({
|
|
|
30511
30691
|
})
|
|
30512
30692
|
});
|
|
30513
30693
|
}
|
|
30514
|
-
|
|
30515
|
-
|
|
30516
|
-
|
|
30517
|
-
|
|
30518
|
-
|
|
30519
|
-
|
|
30520
|
-
|
|
30521
|
-
const
|
|
30522
|
-
|
|
30523
|
-
|
|
30524
|
-
|
|
30525
|
-
|
|
30526
|
-
valid: {},
|
|
30527
|
-
fieldProblems: {},
|
|
30528
|
-
isValid: false
|
|
30529
|
-
};
|
|
30530
|
-
function StateReducer() {
|
|
30531
|
-
const [schemas, setSchemas] = useState({});
|
|
30532
|
-
const [activeForms, setActiveForms] = useState([]);
|
|
30533
|
-
const setCurrentForms = (forms2) => {
|
|
30534
|
-
setActiveForms(forms2);
|
|
30535
|
-
};
|
|
30536
|
-
function reducer2({
|
|
30537
|
-
currentState: currState
|
|
30538
|
-
}, action) {
|
|
30539
|
-
var _a, _b, _c, _d, _e;
|
|
30540
|
-
switch (action.type) {
|
|
30541
|
-
case "addToState": {
|
|
30542
|
-
const state2 = structuredClone(currState);
|
|
30543
|
-
const dataStoreId = action.value.dataStoreId ?? action.value.caller;
|
|
30544
|
-
const schema = action.value.schema || null;
|
|
30545
|
-
const schemaHasChanged = schema && ((_a = schemas == null ? void 0 : schemas[dataStoreId]) == null ? void 0 : _a.toString()) !== schema.toString();
|
|
30546
|
-
const mergedState = {
|
|
30547
|
-
...state2,
|
|
30548
|
-
data: {
|
|
30549
|
-
...state2.data,
|
|
30550
|
-
[dataStoreId]: {
|
|
30551
|
-
...state2.data[dataStoreId],
|
|
30552
|
-
...action.value.data
|
|
30553
|
-
}
|
|
30554
|
-
},
|
|
30555
|
-
// Add data in allData state prop in case we will need them later
|
|
30556
|
-
allData: {
|
|
30557
|
-
...state2.allData,
|
|
30558
|
-
[dataStoreId]: {
|
|
30559
|
-
...state2.allData[dataStoreId],
|
|
30560
|
-
...removeObjectPropsWithEmptyValues(action.value.data)
|
|
30561
|
-
}
|
|
30562
|
-
},
|
|
30563
|
-
errors: {
|
|
30564
|
-
...state2.errors,
|
|
30565
|
-
[dataStoreId]: {
|
|
30566
|
-
...state2.errors[dataStoreId],
|
|
30567
|
-
...action.value.errors
|
|
30568
|
-
}
|
|
30569
|
-
},
|
|
30570
|
-
valid: {
|
|
30571
|
-
...state2.valid,
|
|
30572
|
-
[dataStoreId]: {
|
|
30573
|
-
...state2.valid[dataStoreId],
|
|
30574
|
-
...action.value.valid
|
|
30575
|
-
}
|
|
30576
|
-
},
|
|
30577
|
-
fieldProblems: {
|
|
30578
|
-
...state2.fieldProblems,
|
|
30579
|
-
[dataStoreId]: {
|
|
30580
|
-
...state2.fieldProblems[dataStoreId],
|
|
30581
|
-
...action.value.fieldProblems
|
|
30582
|
-
}
|
|
30583
|
-
}
|
|
30584
|
-
};
|
|
30585
|
-
if (schemaHasChanged) {
|
|
30586
|
-
setSchemas({
|
|
30587
|
-
...schemas,
|
|
30588
|
-
[dataStoreId]: schema
|
|
30589
|
-
});
|
|
30590
|
-
const processedBySchema = schema.reduce((acc, fieldKey) => {
|
|
30591
|
-
const dataObjByFormId = mergedState.data[dataStoreId];
|
|
30592
|
-
const allDataObjByFormId = mergedState.allData[dataStoreId];
|
|
30593
|
-
const validObjByFormId = mergedState.valid[dataStoreId];
|
|
30594
|
-
const errorsObjByFormId = mergedState.errors[dataStoreId];
|
|
30595
|
-
const fieldProblemsObjByFormId = mergedState.fieldProblems[dataStoreId];
|
|
30596
|
-
return {
|
|
30597
|
-
data: {
|
|
30598
|
-
...acc.data,
|
|
30599
|
-
[fieldKey]: dataObjByFormId[fieldKey] ?? allDataObjByFormId[fieldKey]
|
|
30600
|
-
},
|
|
30601
|
-
valid: {
|
|
30602
|
-
...acc.valid,
|
|
30603
|
-
[fieldKey]: validObjByFormId[fieldKey]
|
|
30604
|
-
},
|
|
30605
|
-
errors: {
|
|
30606
|
-
...acc.errors,
|
|
30607
|
-
[fieldKey]: errorsObjByFormId[fieldKey]
|
|
30608
|
-
},
|
|
30609
|
-
fieldProblems: {
|
|
30610
|
-
...acc.fieldProblems,
|
|
30611
|
-
[fieldKey]: fieldProblemsObjByFormId[fieldKey]
|
|
30612
|
-
}
|
|
30613
|
-
};
|
|
30614
|
-
}, {
|
|
30615
|
-
data: {},
|
|
30616
|
-
valid: {},
|
|
30617
|
-
errors: {},
|
|
30618
|
-
fieldProblems: {}
|
|
30619
|
-
});
|
|
30620
|
-
mergedState.data[dataStoreId] = processedBySchema.data;
|
|
30621
|
-
mergedState.valid[dataStoreId] = processedBySchema.valid;
|
|
30622
|
-
mergedState.errors[dataStoreId] = processedBySchema.errors;
|
|
30623
|
-
mergedState.fieldProblems[dataStoreId] = processedBySchema.fieldProblems;
|
|
30624
|
-
}
|
|
30625
|
-
mergedState.validityByForm = {
|
|
30626
|
-
...mergedState.validityByForm,
|
|
30627
|
-
[dataStoreId]: Object.values(mergedState.valid[dataStoreId]).every((isValid) => isValid)
|
|
30628
|
-
};
|
|
30629
|
-
mergedState.hasDataChanged = {
|
|
30630
|
-
...state2.hasDataChanged,
|
|
30631
|
-
[dataStoreId]: {
|
|
30632
|
-
hasDataChanged: hasDataChanged((_b = state2.initialData) == null ? void 0 : _b[dataStoreId], (_c = mergedState.data) == null ? void 0 : _c[dataStoreId])
|
|
30633
|
-
}
|
|
30634
|
-
};
|
|
30635
|
-
mergedState.hasAnyDataChanged = Object.values(mergedState.hasDataChanged).some(({
|
|
30636
|
-
hasDataChanged: hasDataChanged2
|
|
30637
|
-
}) => hasDataChanged2);
|
|
30638
|
-
mergedState.allValid = Object.values(mergedState.validityByForm).every((isValid) => isValid);
|
|
30639
|
-
mergedState.isValid = !activeForms.length ? mergedState.allValid : activeForms.every((item) => mergedState.validityByForm[item]);
|
|
30640
|
-
mergedState.initialData = structuredClone(state2.initialData);
|
|
30641
|
-
return {
|
|
30642
|
-
currentState: mergedState,
|
|
30643
|
-
prevState: state2,
|
|
30644
|
-
changeInitiatedBy: dataStoreId
|
|
30645
|
-
};
|
|
30646
|
-
}
|
|
30647
|
-
case "resetState": {
|
|
30648
|
-
const dataStoreId = ((_d = action.value) == null ? void 0 : _d.dataStoreId) ?? ((_e = action.value) == null ? void 0 : _e.caller);
|
|
30649
|
-
return {
|
|
30650
|
-
currentState: INITIAL_STATE,
|
|
30651
|
-
prevState: currState,
|
|
30652
|
-
changeInitiatedBy: dataStoreId
|
|
30653
|
-
};
|
|
30654
|
-
}
|
|
30655
|
-
default: {
|
|
30656
|
-
throw new Error(`Unhandled action type: ${action.type}`);
|
|
30694
|
+
const parseConfiguration$1 = ({
|
|
30695
|
+
matchingScenario,
|
|
30696
|
+
country: country2
|
|
30697
|
+
}) => parseSolePropScenarios(matchingScenario[LegalEntityType.SOLE_PROPRIETORSHIP], country2);
|
|
30698
|
+
const isDocumentsRequired = (forms2) => forms2.some((form) => [solePropForms.solePropConstitutionalDocument.formId].includes(form.formId));
|
|
30699
|
+
const formatFileSummaryData = (solePropConstitutionalDocument) => {
|
|
30700
|
+
var _a;
|
|
30701
|
+
const constitutionalDocument2 = (_a = solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0];
|
|
30702
|
+
return {
|
|
30703
|
+
...constitutionalDocument2 && {
|
|
30704
|
+
solePropConstitutionalDocument: {
|
|
30705
|
+
fileName: constitutionalDocument2.name
|
|
30657
30706
|
}
|
|
30658
30707
|
}
|
|
30659
|
-
}
|
|
30660
|
-
return {
|
|
30661
|
-
reducer: reducer2,
|
|
30662
|
-
setCurrentForms
|
|
30663
30708
|
};
|
|
30664
|
-
}
|
|
30665
|
-
function StateProvider({
|
|
30666
|
-
defaultData = {},
|
|
30667
|
-
children
|
|
30668
|
-
}) {
|
|
30669
|
-
const defaultState = {
|
|
30670
|
-
currentState: {
|
|
30671
|
-
data: defaultData,
|
|
30672
|
-
allData: defaultData,
|
|
30673
|
-
valid: {},
|
|
30674
|
-
errors: {},
|
|
30675
|
-
fieldProblems: {},
|
|
30676
|
-
validityByForm: {},
|
|
30677
|
-
initialData: defaultData
|
|
30678
|
-
},
|
|
30679
|
-
prevState: {},
|
|
30680
|
-
changeInitiatedBy: null
|
|
30681
|
-
};
|
|
30682
|
-
const reducerObj = StateReducer();
|
|
30683
|
-
const [state2, dispatch] = useReducer(reducerObj.reducer, defaultState);
|
|
30684
|
-
const contextValue = useMemo(() => ({
|
|
30685
|
-
state: state2,
|
|
30686
|
-
dispatch,
|
|
30687
|
-
setActiveForms: reducerObj.setCurrentForms,
|
|
30688
|
-
getData: () => {
|
|
30689
|
-
var _a;
|
|
30690
|
-
return ((_a = state2 == null ? void 0 : state2.currentState) == null ? void 0 : _a.data) ?? {};
|
|
30691
|
-
},
|
|
30692
|
-
getState: () => state2 == null ? void 0 : state2.currentState
|
|
30693
|
-
}), [reducerObj, state2]);
|
|
30694
|
-
return jsx(StateContext.Provider, {
|
|
30695
|
-
value: contextValue,
|
|
30696
|
-
children
|
|
30697
|
-
});
|
|
30698
|
-
}
|
|
30699
|
-
const labels = (data, country2) => ({
|
|
30700
|
-
registrationNumber: () => {
|
|
30701
|
-
var _a;
|
|
30702
|
-
if (country2 === CountryCodes.Monaco && ((_a = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _a.country) === CountryCodes.Monaco) {
|
|
30703
|
-
return "mcRegistrationNumberSoleProp";
|
|
30704
|
-
}
|
|
30705
|
-
}
|
|
30706
|
-
});
|
|
30707
|
-
const fontFormats = ["eot", "woff", "woff2", "ttf", "otf"];
|
|
30708
|
-
const formatFullNames = {
|
|
30709
|
-
eot: "embedded-opentype",
|
|
30710
|
-
woff: "woff",
|
|
30711
|
-
woff2: "woff2",
|
|
30712
|
-
ttf: "truetype",
|
|
30713
|
-
otf: "opentype"
|
|
30714
|
-
};
|
|
30715
|
-
const getFontFaceRule = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
30716
|
-
const fontSources = formats.map((format) => `url(${fontPath}.${format}) format(${formatFullNames[format]})`);
|
|
30717
|
-
const ruleLines = [`font-family: '${fontFamily}'`, `font-style: ${fontStyle}`, `font-weight: ${fontWeight}`, `src: ${fontSources.join(",")}`];
|
|
30718
|
-
return `@font-face {${ruleLines.join(";")}}`;
|
|
30719
|
-
};
|
|
30720
|
-
const addStyleTagForFont = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
30721
|
-
const style = document.createElement("style");
|
|
30722
|
-
style.setAttribute("type", "text/css");
|
|
30723
|
-
style.innerText = getFontFaceRule(fontFamily, fontStyle, fontWeight, fontPath, formats);
|
|
30724
|
-
document.head.insertBefore(style, document.head.firstChild);
|
|
30725
30709
|
};
|
|
30726
|
-
const
|
|
30727
|
-
const
|
|
30728
|
-
|
|
30729
|
-
|
|
30730
|
-
|
|
30731
|
-
let isFlagsLoaded = false;
|
|
30732
|
-
let isDocumentGuidanceLoaded = false;
|
|
30733
|
-
const getIconContainer = () => {
|
|
30734
|
-
const container = document.createElement("div");
|
|
30735
|
-
container.setAttribute("aria-hidden", "true");
|
|
30736
|
-
container.setAttribute("id", "adl-icon-container");
|
|
30737
|
-
container.style.height = "0";
|
|
30738
|
-
return container;
|
|
30739
|
-
};
|
|
30740
|
-
const buildSpriteDOMFromResponse = (responseData) => {
|
|
30741
|
-
const iconContainer = getIconContainer();
|
|
30742
|
-
iconContainer.innerHTML = responseData;
|
|
30743
|
-
return iconContainer;
|
|
30744
|
-
};
|
|
30745
|
-
const loadFlags = async (loadingContext) => {
|
|
30746
|
-
if (isFlagsLoaded)
|
|
30747
|
-
return;
|
|
30748
|
-
isFlagsLoaded = true;
|
|
30749
|
-
const responseData = await http({
|
|
30750
|
-
loadingContext,
|
|
30751
|
-
path: "static/images/country-flags.svg"
|
|
30752
|
-
}, null, "text");
|
|
30753
|
-
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
30754
|
-
};
|
|
30755
|
-
const loadDocumentGuidance = async (loadingContext) => {
|
|
30756
|
-
if (isDocumentGuidanceLoaded)
|
|
30757
|
-
return;
|
|
30758
|
-
isDocumentGuidanceLoaded = true;
|
|
30759
|
-
const responseData = await http({
|
|
30760
|
-
loadingContext,
|
|
30761
|
-
path: "static/images/document-guidance.svg"
|
|
30762
|
-
}, null, "text");
|
|
30763
|
-
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
30764
|
-
};
|
|
30765
|
-
const getOpeningStep = (forms2, remediationActions) => {
|
|
30710
|
+
const canSubmit = (data) => mandatoryApiFields.SOLE_PROPRIETORSHIP.every((detail) => {
|
|
30711
|
+
const value = getProp(data, detail);
|
|
30712
|
+
return !isEmpty(value);
|
|
30713
|
+
});
|
|
30714
|
+
const hasRegisteredAddress = (dataFromResponse) => {
|
|
30766
30715
|
var _a;
|
|
30767
|
-
|
|
30768
|
-
|
|
30769
|
-
var _a2;
|
|
30770
|
-
return ((_a2 = rem.forms) == null ? void 0 : _a2.length) > 0;
|
|
30771
|
-
});
|
|
30772
|
-
if (allRemediationActions.length === 1 && ((_a = allRemediationActions[0]) == null ? void 0 : _a.forms.length) === 1) {
|
|
30773
|
-
const form = forms2.find((form2) => {
|
|
30774
|
-
var _a2;
|
|
30775
|
-
return (form2 == null ? void 0 : form2.formId) === ((_a2 = allRemediationActions[0]) == null ? void 0 : _a2.forms[0]);
|
|
30776
|
-
});
|
|
30777
|
-
if (form)
|
|
30778
|
-
return form;
|
|
30779
|
-
}
|
|
30780
|
-
return forms2[forms2.length - 1];
|
|
30781
|
-
}
|
|
30782
|
-
return forms2[0];
|
|
30716
|
+
const registeredAddress2 = ((_a = dataFromResponse == null ? void 0 : dataFromResponse.solePropRegistrationAddress) == null ? void 0 : _a.registrationAddress) || {};
|
|
30717
|
+
return Object.entries(registeredAddress2).some(([key, value]) => key !== "country" && Boolean(value));
|
|
30783
30718
|
};
|
|
30784
|
-
|
|
30785
|
-
|
|
30786
|
-
|
|
30787
|
-
|
|
30788
|
-
|
|
30789
|
-
|
|
30790
|
-
|
|
30791
|
-
|
|
30792
|
-
|
|
30793
|
-
|
|
30794
|
-
|
|
30795
|
-
i18n
|
|
30796
|
-
} = useI18nContext();
|
|
30797
|
-
const {
|
|
30798
|
-
contextCountry: initialContextCountry,
|
|
30799
|
-
setContextCountry: setInitialContextCountry
|
|
30800
|
-
} = useCoreContext();
|
|
30801
|
-
const {
|
|
30802
|
-
loadingContext
|
|
30803
|
-
} = useAuthContext();
|
|
30804
|
-
const {
|
|
30805
|
-
getConfiguration: getConfiguration2,
|
|
30806
|
-
getPayoutAccountFormat: getPayoutAccountFormat2
|
|
30807
|
-
} = useConfigurationApi();
|
|
30808
|
-
const {
|
|
30809
|
-
isSettingEnabled
|
|
30810
|
-
} = useSettingsContext();
|
|
30811
|
-
const {
|
|
30812
|
-
getData,
|
|
30813
|
-
getState
|
|
30814
|
-
} = useStateContext();
|
|
30815
|
-
const {
|
|
30816
|
-
getOmittedKeys: getSummaryOmittedKeys = null,
|
|
30817
|
-
formatData: formatDataForSummary2 = null,
|
|
30818
|
-
omittedForms
|
|
30819
|
-
} = props.summary || {};
|
|
30820
|
-
const taskName = props.taskName ?? defaultTaskName;
|
|
30821
|
-
const [hideDropinLayout, setHideDropinLayout] = useState(false);
|
|
30822
|
-
const [hideNavigation, setHideNavigation] = useState(false);
|
|
30823
|
-
const [hideFooter, setHideFooter] = useState(false);
|
|
30824
|
-
const [hideOnHomeButton, setHideOnHomeButton] = useState(false);
|
|
30825
|
-
const [hideBackButton, setHideBackButton] = useState(false);
|
|
30826
|
-
const [submitButtonLabel, setSubmitButtonLabel] = useState(null);
|
|
30827
|
-
const [skipSubmitAndGoTaskList, setSkipSubmitAndGoTaskList] = useState(false);
|
|
30828
|
-
const [customFormNavigationHandlers, setCustomFormNavigationHandlers] = useState({});
|
|
30829
|
-
const [shouldValidate, setShouldValidate] = useState(false);
|
|
30830
|
-
const [formValidity, setFormValidity] = useState({});
|
|
30831
|
-
const formRef = useRef(null);
|
|
30832
|
-
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
30833
|
-
const [derivedProps, setDerivedProps] = useState(props);
|
|
30834
|
-
const [contextCountry, setContextCountry] = useState(props.country || initialContextCountry);
|
|
30835
|
-
const {
|
|
30836
|
-
sliceData: payoutMethodData
|
|
30837
|
-
} = useGlobalDataSlice("payoutVerificationMethod");
|
|
30838
|
-
const configCountry = (getConfigFor === "bankCountry" ? payoutMethodData == null ? void 0 : payoutMethodData.bankCountry : contextCountry) ?? contextCountry;
|
|
30839
|
-
useEffect(() => {
|
|
30840
|
-
loadDocumentGuidance(loadingContext);
|
|
30841
|
-
}, [loadingContext]);
|
|
30842
|
-
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
30843
|
-
legalEntityType: props.legalEntityType,
|
|
30844
|
-
capabilities: props.capabilities,
|
|
30845
|
-
// for payout forms, we need to get config for the selected bankCountry, not necessarily the same as the residency/registration country
|
|
30846
|
-
country: configCountry
|
|
30847
|
-
}), [configCountry, props.capabilities, props.legalEntityType]);
|
|
30848
|
-
const getPayoutAccountFormatData = useCallback(() => getPayoutAccountFormat2(configCountry), [configCountry]);
|
|
30849
|
-
const {
|
|
30850
|
-
fieldConfigurations,
|
|
30851
|
-
requiredFields,
|
|
30852
|
-
bankVerificationVendors
|
|
30853
|
-
} = useScenarioConfiguration({
|
|
30854
|
-
getConfigurationData,
|
|
30855
|
-
getPayoutAccountFormatData,
|
|
30856
|
-
parseConfiguration: parseConfiguration2,
|
|
30857
|
-
country: configCountry,
|
|
30858
|
-
instantVerificationEnabled: derivedProps.instantVerificationEnabled && derivedProps.handleGetBankVerificationVendors,
|
|
30859
|
-
setLoadingStatus
|
|
30860
|
-
});
|
|
30861
|
-
const isFormStepVisible = (formId) => {
|
|
30862
|
-
if (derivedProps.requiredFields || derivedProps.optionalFields) {
|
|
30863
|
-
return !!derivedProps.requiredFields[formId] || !!derivedProps.optionalFields[formId];
|
|
30864
|
-
}
|
|
30865
|
-
return true;
|
|
30866
|
-
};
|
|
30867
|
-
const isFormSummaryStep = (form) => form.formId === summaryStep.formId;
|
|
30868
|
-
const componentForms = useMemo(() => getComponentForms({
|
|
30869
|
-
...props,
|
|
30870
|
-
bankVerificationVendors
|
|
30871
|
-
}, isSettingEnabled), [bankVerificationVendors, isSettingEnabled, props]);
|
|
30872
|
-
const componentFormsWithSummary = [...Object.values(componentForms), summaryStep];
|
|
30873
|
-
const allowedForms = componentFormsWithSummary.filter((form) => isFormStepVisible(form.formId) || isFormSummaryStep(form));
|
|
30874
|
-
const [activeForm, setActiveForm] = useState(getOpeningStep(allowedForms, (_a = props == null ? void 0 : props.problems) == null ? void 0 : _a.remediationActions));
|
|
30875
|
-
const [hasAlreadyNavigatedForm, setHasAlreadyNavigatedForm] = useState(false);
|
|
30876
|
-
const getFormIndex = (formId) => allowedForms.findIndex((form) => form.formId === formId);
|
|
30877
|
-
const isFinalStep = getFormIndex(activeForm.formId) === allowedForms.length - 1;
|
|
30878
|
-
const isFirstStep = getFormIndex(activeForm.formId) === 0;
|
|
30879
|
-
useEffect(() => {
|
|
30880
|
-
var _a2;
|
|
30881
|
-
if (hasAlreadyNavigatedForm)
|
|
30882
|
-
return;
|
|
30883
|
-
const openingStep = getOpeningStep(allowedForms, (_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.remediationActions);
|
|
30884
|
-
if (activeForm !== openingStep) {
|
|
30885
|
-
setActiveForm(openingStep);
|
|
30886
|
-
}
|
|
30887
|
-
}, [activeForm, allowedForms, (_b = props == null ? void 0 : props.problems) == null ? void 0 : _b.remediationActions, hasAlreadyNavigatedForm]);
|
|
30888
|
-
const evaluateConfiguration = useCallback((scenarioConfiguration, country2, formData, isSettingEnabled2, requiredFields2) => {
|
|
30889
|
-
var _a2, _b2, _c2;
|
|
30890
|
-
const fieldsFromCustomRules = rules2 ? rules2({
|
|
30891
|
-
data: formData,
|
|
30892
|
-
country: country2,
|
|
30893
|
-
taskType: props.taskType,
|
|
30894
|
-
isSettingEnabled: isSettingEnabled2,
|
|
30895
|
-
requiredFields: requiredFields2
|
|
30896
|
-
}) : {};
|
|
30897
|
-
const fieldsFormCustomLabels = labels2 ? labels2(formData, country2) : {};
|
|
30898
|
-
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);
|
|
30899
|
-
setShouldValidate(false);
|
|
30900
|
-
setDerivedProps({
|
|
30901
|
-
...props,
|
|
30902
|
-
...scenarioProps,
|
|
30903
|
-
country: configCountry
|
|
30904
|
-
});
|
|
30905
|
-
}, [componentForms, configCountry, props]);
|
|
30906
|
-
useEffect(() => {
|
|
30907
|
-
if (!fieldConfigurations)
|
|
30908
|
-
return;
|
|
30909
|
-
evaluateConfiguration(fieldConfigurations, configCountry, getData(), isSettingEnabled, requiredFields);
|
|
30910
|
-
}, [fieldConfigurations, configCountry, evaluateConfiguration, getData, isSettingEnabled, requiredFields]);
|
|
30911
|
-
const trackNavigation2 = ({
|
|
30912
|
-
fromForm,
|
|
30913
|
-
toForm,
|
|
30914
|
-
component
|
|
30915
|
-
}) => {
|
|
30916
|
-
userEvents.addEvent("Navigated form", {
|
|
30917
|
-
segmentation: {
|
|
30918
|
-
...props == null ? void 0 : props.baseTrackingPayload,
|
|
30919
|
-
component,
|
|
30920
|
-
from: fromForm.formId,
|
|
30921
|
-
fromLabel: i18n.get(fromForm.formName),
|
|
30922
|
-
to: toForm.formId,
|
|
30923
|
-
toLabel: i18n.get(toForm.formName)
|
|
30924
|
-
}
|
|
30925
|
-
});
|
|
30926
|
-
};
|
|
30927
|
-
const trackSectionCompletion = (form) => {
|
|
30928
|
-
userEvents.addEvent("Completed form section", {
|
|
30929
|
-
segmentation: {
|
|
30930
|
-
...props == null ? void 0 : props.baseTrackingPayload,
|
|
30931
|
-
sectionName: form.formId
|
|
30932
|
-
}
|
|
30933
|
-
});
|
|
30934
|
-
};
|
|
30935
|
-
const gotoFormByFormIndex = (nextFormIndex) => {
|
|
30936
|
-
if (formRef.current.verifyForm) {
|
|
30937
|
-
formRef.current.verifyForm(activeForm.formId).then((isVerified) => {
|
|
30938
|
-
if (isVerified) {
|
|
30939
|
-
setHasAlreadyNavigatedForm(true);
|
|
30940
|
-
setActiveForm(allowedForms[nextFormIndex]);
|
|
30941
|
-
}
|
|
30942
|
-
});
|
|
30943
|
-
} else {
|
|
30944
|
-
setHasAlreadyNavigatedForm(true);
|
|
30945
|
-
setActiveForm(allowedForms[nextFormIndex]);
|
|
30946
|
-
}
|
|
30947
|
-
};
|
|
30948
|
-
const validateCurrentForm = () => {
|
|
30949
|
-
setShouldValidate(true);
|
|
30950
|
-
};
|
|
30951
|
-
const handleNextClick = () => {
|
|
30952
|
-
var _a2, _b2;
|
|
30953
|
-
if (formRef.current.customNavigationHandler) {
|
|
30954
|
-
formRef.current.customNavigationHandler();
|
|
30955
|
-
return;
|
|
30956
|
-
}
|
|
30957
|
-
if ((_a2 = customFormNavigationHandlers[activeForm.formId]) == null ? void 0 : _a2.onNext) {
|
|
30958
|
-
(_b2 = customFormNavigationHandlers[activeForm.formId]) == null ? void 0 : _b2.onNext();
|
|
30959
|
-
return;
|
|
30960
|
-
}
|
|
30961
|
-
const allFields = (derivedProps == null ? void 0 : derivedProps.allFields) || {};
|
|
30962
|
-
if (isFormSummaryStep(activeForm)) {
|
|
30963
|
-
if (skipSubmitAndGoTaskList) {
|
|
30964
|
-
props.navigateBackToTaskList();
|
|
30965
|
-
} else {
|
|
30966
|
-
props.onSubmit({
|
|
30967
|
-
data: getData(),
|
|
30968
|
-
forms: allowedForms,
|
|
30969
|
-
allFields,
|
|
30970
|
-
setLoadingStatus
|
|
30971
|
-
});
|
|
30972
|
-
}
|
|
30973
|
-
return;
|
|
30974
|
-
}
|
|
30975
|
-
if (formValidity[activeForm.formId]) {
|
|
30976
|
-
if (isFinalStep) {
|
|
30977
|
-
props.onSubmit({
|
|
30978
|
-
data: getData(),
|
|
30979
|
-
forms: allowedForms,
|
|
30980
|
-
allFields,
|
|
30981
|
-
setLoadingStatus
|
|
30982
|
-
});
|
|
30983
|
-
return;
|
|
30984
|
-
}
|
|
30985
|
-
setShouldValidate(false);
|
|
30986
|
-
const toFormIndex = allowedForms.findIndex((form) => form.formId === activeForm.formId) + 1;
|
|
30987
|
-
gotoFormByFormIndex(toFormIndex);
|
|
30988
|
-
const toForm = allowedForms[toFormIndex];
|
|
30989
|
-
trackNavigation2({
|
|
30990
|
-
fromForm: activeForm,
|
|
30991
|
-
toForm,
|
|
30992
|
-
component: "ActionBar"
|
|
30993
|
-
});
|
|
30994
|
-
trackSectionCompletion(activeForm);
|
|
30995
|
-
} else {
|
|
30996
|
-
validateCurrentForm();
|
|
30997
|
-
}
|
|
30998
|
-
};
|
|
30999
|
-
const handleBackClick = () => {
|
|
31000
|
-
const currentFormIndex = allowedForms.findIndex((form) => form.formId === activeForm.formId);
|
|
31001
|
-
if (currentFormIndex) {
|
|
31002
|
-
const fromForm = allowedForms[currentFormIndex];
|
|
31003
|
-
const toForm = allowedForms[currentFormIndex - 1];
|
|
31004
|
-
setActiveForm(toForm);
|
|
31005
|
-
setHasAlreadyNavigatedForm(true);
|
|
31006
|
-
trackNavigation2({
|
|
31007
|
-
fromForm,
|
|
31008
|
-
toForm,
|
|
31009
|
-
component: "ActionBar"
|
|
31010
|
-
});
|
|
31011
|
-
}
|
|
31012
|
-
};
|
|
31013
|
-
const setCustomHandlers = (formId, onNext, onBack) => {
|
|
31014
|
-
setCustomFormNavigationHandlers({
|
|
31015
|
-
...customFormNavigationHandlers,
|
|
31016
|
-
[formId]: {
|
|
31017
|
-
onNext,
|
|
31018
|
-
onBack
|
|
30719
|
+
const getDataWithDefaultAddress = (legalEntityResponse, parentLegalEntity) => {
|
|
30720
|
+
var _a;
|
|
30721
|
+
let solePropData = mapLegalEntityToSoleProp(legalEntityResponse);
|
|
30722
|
+
if (!hasRegisteredAddress(solePropData)) {
|
|
30723
|
+
const defaultAddress = (_a = mapLegalEntityToIndividual(parentLegalEntity, false)) == null ? void 0 : _a.address;
|
|
30724
|
+
solePropData = {
|
|
30725
|
+
...solePropData,
|
|
30726
|
+
solePropRegistrationAddress: {
|
|
30727
|
+
...solePropData == null ? void 0 : solePropData.solePropRegistrationAddress,
|
|
30728
|
+
registrationAddress: {
|
|
30729
|
+
...defaultAddress
|
|
31019
30730
|
}
|
|
31020
|
-
});
|
|
31021
|
-
};
|
|
31022
|
-
const nextButtonText = isFinalStep ? i18n.get(submitButtonLabel ?? "submit") : i18n.get("next");
|
|
31023
|
-
useEffect(() => {
|
|
31024
|
-
props.eventEmitter.on("next", handleNextClick);
|
|
31025
|
-
props.eventEmitter.on("back", handleBackClick);
|
|
31026
|
-
props.eventEmitter.on("validate", validateCurrentForm);
|
|
31027
|
-
return () => {
|
|
31028
|
-
props.eventEmitter.off("next", handleNextClick);
|
|
31029
|
-
props.eventEmitter.off("back", handleNextClick);
|
|
31030
|
-
props.eventEmitter.off("validate", validateCurrentForm);
|
|
31031
|
-
};
|
|
31032
|
-
}, [activeForm, allowedForms]);
|
|
31033
|
-
const onCountryChange = (country2) => {
|
|
31034
|
-
setContextCountry(country2);
|
|
31035
|
-
};
|
|
31036
|
-
const onWrappedComponentChange = (state2) => {
|
|
31037
|
-
var _a2;
|
|
31038
|
-
setFormValidity(state2.validityByForm);
|
|
31039
|
-
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, state2);
|
|
31040
|
-
};
|
|
31041
|
-
const handleStateChange = ({
|
|
31042
|
-
currentState
|
|
31043
|
-
}) => {
|
|
31044
|
-
onWrappedComponentChange(currentState);
|
|
31045
|
-
};
|
|
31046
|
-
const handleLeaveDropin = async () => {
|
|
31047
|
-
var _a2;
|
|
31048
|
-
const data = getData();
|
|
31049
|
-
const hasDataChanged2 = getState().hasAnyDataChanged;
|
|
31050
|
-
if (hasDataChanged2 && ((_a2 = props.canSubmit) == null ? void 0 : _a2.call(props, data))) {
|
|
31051
|
-
setInitialContextCountry(contextCountry);
|
|
31052
|
-
const allFields = (derivedProps == null ? void 0 : derivedProps.allFields) || {};
|
|
31053
|
-
await props.onSubmit({
|
|
31054
|
-
data,
|
|
31055
|
-
forms: allowedForms,
|
|
31056
|
-
allFields,
|
|
31057
|
-
setLoadingStatus
|
|
31058
|
-
});
|
|
31059
|
-
} else {
|
|
31060
|
-
props.handleHomeClick();
|
|
31061
30731
|
}
|
|
31062
30732
|
};
|
|
31063
|
-
|
|
31064
|
-
|
|
31065
|
-
|
|
31066
|
-
backButtonLabel: i18n.get("back"),
|
|
31067
|
-
nextButtonLabel: nextButtonText,
|
|
31068
|
-
onHome: handleLeaveDropin,
|
|
31069
|
-
homeButtonLabel: props.homeButtonLabel,
|
|
31070
|
-
hideOnHomeButton,
|
|
31071
|
-
hideBackButton
|
|
31072
|
-
});
|
|
31073
|
-
const wrappedComponent = jsx("div", {
|
|
31074
|
-
className: "adyen-kyc-form-container",
|
|
31075
|
-
children: jsx(LoaderWrapper, {
|
|
31076
|
-
status: loadingStatus,
|
|
31077
|
-
formOpacityWhenLoading: 0.3,
|
|
31078
|
-
loaderSize: "large",
|
|
31079
|
-
children: jsxs(FormRouterContextProvider, {
|
|
31080
|
-
setFormIndex: gotoFormByFormIndex,
|
|
31081
|
-
forms: allowedForms,
|
|
31082
|
-
handleGetIdVerificationToken: props.handleGetIdVerificationToken,
|
|
31083
|
-
children: [jsx(StateContextWatcher, {
|
|
31084
|
-
owner: "FormComposer",
|
|
31085
|
-
onChange: handleStateChange
|
|
31086
|
-
}), jsx(WrappedComponent, {
|
|
31087
|
-
ref: formRef,
|
|
31088
|
-
forms: allowedForms,
|
|
31089
|
-
activeForm,
|
|
31090
|
-
...derivedProps,
|
|
31091
|
-
data: props.data,
|
|
31092
|
-
onChange: onWrappedComponentChange,
|
|
31093
|
-
evaluateConfiguration: (data) => evaluateConfiguration(fieldConfigurations, configCountry, data, isSettingEnabled, requiredFields),
|
|
31094
|
-
country: contextCountry,
|
|
31095
|
-
onCountryChange,
|
|
31096
|
-
legalEntityId: (_c = props.legalEntityResponse) == null ? void 0 : _c.id,
|
|
31097
|
-
problems: props == null ? void 0 : props.problems,
|
|
31098
|
-
shouldValidate,
|
|
31099
|
-
onNext: handleNextClick,
|
|
31100
|
-
onBack: handleBackClick,
|
|
31101
|
-
setHideDropinLayout,
|
|
31102
|
-
setHideNavigation,
|
|
31103
|
-
setHideFooter,
|
|
31104
|
-
setCustomFormNavigationHandlers: setCustomHandlers,
|
|
31105
|
-
setHideOnHomeButton,
|
|
31106
|
-
setHideBackButton,
|
|
31107
|
-
setSubmitButtonLabel,
|
|
31108
|
-
setSkipSubmitAndGoTaskList,
|
|
31109
|
-
bankVerificationVendors
|
|
31110
|
-
}), activeForm.formId === summaryStep.formId && jsx("div", {
|
|
31111
|
-
className: "adyen-kyc-form-wrapper",
|
|
31112
|
-
children: jsx(Summary, {
|
|
31113
|
-
trackNavigation: trackNavigation2,
|
|
31114
|
-
data: formatDataForSummary2 ? formatDataForSummary2(getData(), allowedForms) : getData(),
|
|
31115
|
-
omittedKeys: getSummaryOmittedKeys ? getSummaryOmittedKeys(getData()) : null,
|
|
31116
|
-
omittedForms,
|
|
31117
|
-
forms: allowedForms,
|
|
31118
|
-
gotoForm: gotoFormByFormIndex,
|
|
31119
|
-
labels: derivedProps.labels,
|
|
31120
|
-
problems: props == null ? void 0 : props.problems
|
|
31121
|
-
})
|
|
31122
|
-
}), formFooter]
|
|
31123
|
-
})
|
|
31124
|
-
})
|
|
31125
|
-
});
|
|
31126
|
-
const allowedFormsWithValidity = addValidityToForms(allowedForms, formValidity, props.problems);
|
|
31127
|
-
const sidebar = !hideDropinLayout && !hideNavigation && jsx(LoaderWrapper, {
|
|
31128
|
-
status: loadingStatus,
|
|
31129
|
-
formOpacityWhenLoading: 0.3,
|
|
31130
|
-
showSpinner: false,
|
|
31131
|
-
className: "adyen-kyc-dropin__sidebar-wrapper",
|
|
31132
|
-
children: jsx(FormNavigation, {
|
|
31133
|
-
forms: allowedFormsWithValidity,
|
|
31134
|
-
activeForm: allowedFormsWithValidity.find((form) => form.formId === activeForm.formId),
|
|
31135
|
-
gotoForm: gotoFormByFormIndex,
|
|
31136
|
-
validateForm: validateCurrentForm,
|
|
31137
|
-
taskName,
|
|
31138
|
-
trackNavigation: trackNavigation2,
|
|
31139
|
-
verificationErrors: (_d = props == null ? void 0 : props.problems) == null ? void 0 : _d.verificationErrors
|
|
31140
|
-
})
|
|
31141
|
-
});
|
|
31142
|
-
const content = jsxs(Fragment, {
|
|
31143
|
-
children: [sidebar, wrappedComponent]
|
|
31144
|
-
});
|
|
31145
|
-
if (!props.hideDropinLayout) {
|
|
31146
|
-
return jsx(DropinLayout, {
|
|
31147
|
-
content
|
|
31148
|
-
});
|
|
31149
|
-
}
|
|
31150
|
-
return wrappedComponent;
|
|
31151
|
-
};
|
|
31152
|
-
return WithFormComposer;
|
|
31153
|
-
}
|
|
31154
|
-
const SolePropWithFormComposer = withFormComposer(SolePropComponent, {
|
|
31155
|
-
getComponentForms: () => solePropForms,
|
|
31156
|
-
// TODO: change trust to soleprop once the configurations for soleprops are added in backend.
|
|
31157
|
-
parseConfiguration: ({
|
|
31158
|
-
matchingScenario,
|
|
31159
|
-
country: country2
|
|
31160
|
-
}) => parseSolePropScenarios([matchingScenario[LegalEntityType.TRUST]], country2),
|
|
31161
|
-
rules: rules$2,
|
|
31162
|
-
labels,
|
|
31163
|
-
defaultTaskName: "solePropDetails"
|
|
31164
|
-
});
|
|
30733
|
+
}
|
|
30734
|
+
return solePropData;
|
|
30735
|
+
};
|
|
31165
30736
|
function SolePropDropinComponent({
|
|
31166
30737
|
problems: problemsProp,
|
|
31167
30738
|
capabilities,
|
|
31168
|
-
country:
|
|
30739
|
+
country: externalCountry,
|
|
31169
30740
|
parentLegalEntity,
|
|
31170
30741
|
legalEntityResponse,
|
|
31171
30742
|
eventEmitter,
|
|
31172
30743
|
homeButtonLabel,
|
|
31173
30744
|
hideDropinLayout,
|
|
31174
|
-
onSubmit,
|
|
30745
|
+
onSubmit: onExternalSubmit,
|
|
31175
30746
|
onChange,
|
|
30747
|
+
taskType,
|
|
30748
|
+
trackingConfig,
|
|
31176
30749
|
handleHomeClick,
|
|
31177
30750
|
handleCreateDocument,
|
|
31178
30751
|
handleGetDocument,
|
|
@@ -31182,7 +30755,7 @@ function SolePropDropinComponent({
|
|
|
31182
30755
|
handleUpdateLegalEntity,
|
|
31183
30756
|
handleCreateLegalEntity
|
|
31184
30757
|
}) {
|
|
31185
|
-
var _a;
|
|
30758
|
+
var _a, _b;
|
|
31186
30759
|
const {
|
|
31187
30760
|
i18n,
|
|
31188
30761
|
setLocale
|
|
@@ -31192,43 +30765,72 @@ function SolePropDropinComponent({
|
|
|
31192
30765
|
} = useExperimentsContext();
|
|
31193
30766
|
const [problems, setProblems] = useState(problemsProp);
|
|
31194
30767
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
31195
|
-
const getOmittedKeys = () => ["operationalAddressIsSame"];
|
|
31196
30768
|
const [newSoleProp, setNewSoleProp] = useState(null);
|
|
31197
30769
|
const {
|
|
31198
|
-
showToast
|
|
31199
|
-
clearToasts
|
|
30770
|
+
showToast
|
|
31200
30771
|
} = useToastContext();
|
|
31201
|
-
const
|
|
31202
|
-
|
|
31203
|
-
|
|
31204
|
-
|
|
31205
|
-
|
|
31206
|
-
|
|
31207
|
-
|
|
31208
|
-
|
|
31209
|
-
|
|
31210
|
-
|
|
31211
|
-
|
|
31212
|
-
|
|
31213
|
-
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
30772
|
+
const {
|
|
30773
|
+
getConfiguration: getConfiguration2
|
|
30774
|
+
} = useConfigurationApi();
|
|
30775
|
+
const {
|
|
30776
|
+
isSettingEnabled
|
|
30777
|
+
} = useSettingsContext();
|
|
30778
|
+
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
30779
|
+
const formRef = useRef(null);
|
|
30780
|
+
const dataFromResponse = getDataWithDefaultAddress(legalEntityResponse, parentLegalEntity);
|
|
30781
|
+
const [data, setData] = useState(dataFromResponse);
|
|
30782
|
+
const country2 = ((_a = dataFromResponse == null ? void 0 : dataFromResponse.solePropRegistrationAddress) == null ? void 0 : _a.registrationAddress.country) || externalCountry;
|
|
30783
|
+
const baseTrackingPayload = getBaseTrackingPayload({
|
|
30784
|
+
trackingConfig,
|
|
30785
|
+
parentLegalEntity,
|
|
30786
|
+
legalEntity: legalEntityResponse,
|
|
30787
|
+
task: taskType
|
|
30788
|
+
});
|
|
30789
|
+
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
30790
|
+
legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP,
|
|
30791
|
+
capabilities,
|
|
30792
|
+
country: country2
|
|
30793
|
+
}), [country2, capabilities]);
|
|
30794
|
+
const {
|
|
30795
|
+
fieldConfigurations,
|
|
30796
|
+
requiredFields
|
|
30797
|
+
} = useScenarioConfiguration({
|
|
30798
|
+
parseConfiguration: parseConfiguration$1,
|
|
30799
|
+
getConfigurationData,
|
|
30800
|
+
setLoadingStatus,
|
|
30801
|
+
country: country2
|
|
30802
|
+
});
|
|
30803
|
+
const fieldsFromCustomRules = useMemo(() => rules$2({
|
|
30804
|
+
data,
|
|
30805
|
+
country: country2,
|
|
30806
|
+
taskType,
|
|
30807
|
+
requiredFields,
|
|
30808
|
+
isSettingEnabled
|
|
30809
|
+
}), [country2, data, taskType, requiredFields, isSettingEnabled]);
|
|
30810
|
+
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]);
|
|
30811
|
+
const {
|
|
30812
|
+
state: {
|
|
30813
|
+
currentState
|
|
31220
30814
|
}
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
30815
|
+
} = useStateContext();
|
|
30816
|
+
const formValidity = currentState.validityByForm;
|
|
30817
|
+
useEffect(() => {
|
|
30818
|
+
setData({
|
|
30819
|
+
...currentState.data
|
|
30820
|
+
});
|
|
30821
|
+
onChange == null ? void 0 : onChange(currentState);
|
|
30822
|
+
}, [currentState]);
|
|
30823
|
+
const forms2 = useMemo(() => {
|
|
30824
|
+
const requiredForms = getRequiredForms(solePropForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
|
|
30825
|
+
return addValidityToForms(requiredForms, formValidity, problems);
|
|
30826
|
+
}, [derivedProps, formValidity, problems]);
|
|
31225
30827
|
const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
|
|
31226
30828
|
const submitDocuments = async ({
|
|
31227
|
-
forms:
|
|
30829
|
+
forms: forms22,
|
|
31228
30830
|
legalEntity,
|
|
31229
30831
|
dataSubmitted
|
|
31230
30832
|
}) => {
|
|
31231
|
-
if (
|
|
30833
|
+
if (isDocumentsRequired(forms22)) {
|
|
31232
30834
|
const formattedDocument = await mapSolePropDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
31233
30835
|
if (formattedDocument) {
|
|
31234
30836
|
await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
|
|
@@ -31283,11 +30885,8 @@ function SolePropDropinComponent({
|
|
|
31283
30885
|
const updatedLegalEntity = await handleUpdateLegalEntity(drop("type").from(mappedLegalEntity), (legalEntityResponse == null ? void 0 : legalEntityResponse.id) || (newSoleProp == null ? void 0 : newSoleProp.id));
|
|
31284
30886
|
return updatedLegalEntity;
|
|
31285
30887
|
};
|
|
31286
|
-
const handleOnSubmit = async ({
|
|
31287
|
-
|
|
31288
|
-
forms: forms2,
|
|
31289
|
-
setLoadingStatus
|
|
31290
|
-
}) => {
|
|
30888
|
+
const handleOnSubmit = async () => {
|
|
30889
|
+
const dataSubmitted = data;
|
|
31291
30890
|
setLoadingStatus("loading");
|
|
31292
30891
|
try {
|
|
31293
30892
|
const legalEntity = await handleSubmitLegalEntity(mapSolePropToLegalEntity(dataSubmitted));
|
|
@@ -31304,7 +30903,7 @@ function SolePropDropinComponent({
|
|
|
31304
30903
|
label: i18n.get("successfullyUpdatedDetails"),
|
|
31305
30904
|
type: ToastType.SUCCESS
|
|
31306
30905
|
});
|
|
31307
|
-
|
|
30906
|
+
onExternalSubmit == null ? void 0 : onExternalSubmit(dataSubmitted);
|
|
31308
30907
|
} catch (e) {
|
|
31309
30908
|
showToast({
|
|
31310
30909
|
label: i18n.get("failedToUpdateDetails"),
|
|
@@ -31327,15 +30926,12 @@ function SolePropDropinComponent({
|
|
|
31327
30926
|
setLoadingStatus("success");
|
|
31328
30927
|
}
|
|
31329
30928
|
};
|
|
31330
|
-
const formatDataForSummary2 = (data2,
|
|
31331
|
-
var _a2,
|
|
30929
|
+
const formatDataForSummary2 = (data2, forms22) => {
|
|
30930
|
+
var _a2, _b2, _c, _d;
|
|
31332
30931
|
let summaryData = cloneObject(data2);
|
|
31333
|
-
|
|
31334
|
-
if ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.country) {
|
|
31335
|
-
solePropCountry = datasetUtils.getCountryName(summaryData.solePropNameAndCountry.country);
|
|
31336
|
-
}
|
|
30932
|
+
const solePropCountry = ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.country) ? datasetUtils.getCountryName(summaryData.solePropNameAndCountry.country) : void 0;
|
|
31337
30933
|
summaryData.solePropNameAndCountry = {
|
|
31338
|
-
legalNameOfSoleProprietor: (
|
|
30934
|
+
legalNameOfSoleProprietor: (_b2 = data2.solePropNameAndCountry) == null ? void 0 : _b2.legalCompanyName,
|
|
31339
30935
|
countryOfEstablishment: solePropCountry
|
|
31340
30936
|
};
|
|
31341
30937
|
if ((_c = summaryData == null ? void 0 : summaryData.solePropRegistrationAddress) == null ? void 0 : _c.registrationAddress) {
|
|
@@ -31345,53 +30941,62 @@ function SolePropDropinComponent({
|
|
|
31345
30941
|
if ((_d = summaryData == null ? void 0 : summaryData.solePropRegistrationAddress) == null ? void 0 : _d.operationalAddress) {
|
|
31346
30942
|
summaryData.solePropRegistrationAddress.operationalAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.solePropRegistrationAddress.operationalAddress, datasetUtils);
|
|
31347
30943
|
}
|
|
31348
|
-
if (
|
|
30944
|
+
if (isDocumentsRequired(forms22)) {
|
|
31349
30945
|
delete summaryData[solePropDocumentFormId];
|
|
31350
30946
|
summaryData = {
|
|
31351
30947
|
...summaryData,
|
|
31352
|
-
...
|
|
30948
|
+
...formatFileSummaryData(data2.solePropConstitutionalDocument)
|
|
31353
30949
|
};
|
|
31354
30950
|
}
|
|
31355
30951
|
return summaryData;
|
|
31356
30952
|
};
|
|
31357
|
-
const
|
|
31358
|
-
|
|
31359
|
-
|
|
31360
|
-
|
|
31361
|
-
|
|
31362
|
-
|
|
31363
|
-
|
|
31364
|
-
|
|
31365
|
-
|
|
31366
|
-
|
|
31367
|
-
|
|
31368
|
-
|
|
31369
|
-
|
|
31370
|
-
|
|
30953
|
+
const {
|
|
30954
|
+
handleNextClick,
|
|
30955
|
+
handleBackClick,
|
|
30956
|
+
activeForm,
|
|
30957
|
+
shouldValidate,
|
|
30958
|
+
setShouldValidate,
|
|
30959
|
+
gotoFormByFormIndex,
|
|
30960
|
+
nextButtonLabel
|
|
30961
|
+
} = useFormComposer({
|
|
30962
|
+
problems,
|
|
30963
|
+
baseTrackingPayload,
|
|
30964
|
+
forms: forms2,
|
|
30965
|
+
formRef,
|
|
30966
|
+
onSubmit: handleOnSubmit
|
|
31371
30967
|
});
|
|
31372
|
-
return jsx(
|
|
31373
|
-
|
|
31374
|
-
|
|
30968
|
+
return jsx(FormWrapper, {
|
|
30969
|
+
taskName: isExperimentEnabled("EnableNewEntryFlow") ? "soleProprietorshipDetails" : "solePropDetails",
|
|
30970
|
+
handleBackClick,
|
|
30971
|
+
handleNextClick,
|
|
30972
|
+
gotoFormByFormIndex,
|
|
30973
|
+
handleHomeClick,
|
|
30974
|
+
hideDropinLayout,
|
|
30975
|
+
nextButtonLabel,
|
|
30976
|
+
homeButtonLabel,
|
|
30977
|
+
loadingStatus,
|
|
30978
|
+
forms: forms2,
|
|
30979
|
+
activeForm,
|
|
30980
|
+
onSubmit: handleOnSubmit,
|
|
30981
|
+
validateForm: () => setShouldValidate(true),
|
|
30982
|
+
canSubmit: canSubmit(data) && hasDataChanged(dataFromResponse, data),
|
|
30983
|
+
baseTrackingPayload,
|
|
30984
|
+
problems,
|
|
30985
|
+
summary: {
|
|
30986
|
+
data: formatDataForSummary2(data, forms2),
|
|
30987
|
+
omittedKeys: ["operationalAddressIsSame"]
|
|
30988
|
+
},
|
|
30989
|
+
children: jsx(SolePropComponent, {
|
|
30990
|
+
...derivedProps,
|
|
30991
|
+
activeForm,
|
|
31375
30992
|
capabilities,
|
|
31376
|
-
data,
|
|
31377
|
-
country: ((
|
|
30993
|
+
data: dataFromResponse,
|
|
30994
|
+
country: ((_b = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _b.country) || country2,
|
|
31378
30995
|
problems,
|
|
31379
|
-
eventEmitter,
|
|
31380
|
-
hideDropinLayout,
|
|
31381
|
-
legalEntityType: LegalEntityType.TRUST,
|
|
31382
|
-
taskName: isExperimentEnabled("EnableNewEntryFlow") ? "soleProprietorshipDetails" : "solePropDetails",
|
|
31383
|
-
legalEntityResponse,
|
|
31384
|
-
summary: {
|
|
31385
|
-
formatData: formatDataForSummary2,
|
|
31386
|
-
getOmittedKeys
|
|
31387
|
-
},
|
|
31388
|
-
canSubmit: canSubmit2,
|
|
31389
|
-
onChange,
|
|
31390
|
-
onSubmit: handleOnSubmit,
|
|
31391
|
-
handleHomeClick,
|
|
31392
|
-
homeButtonLabel,
|
|
31393
30996
|
handleAddressSearch,
|
|
31394
|
-
handleFindAddress
|
|
30997
|
+
handleFindAddress,
|
|
30998
|
+
ref: formRef,
|
|
30999
|
+
shouldValidate
|
|
31395
31000
|
})
|
|
31396
31001
|
});
|
|
31397
31002
|
}
|
|
@@ -31418,53 +31023,99 @@ const rules = ({
|
|
|
31418
31023
|
}
|
|
31419
31024
|
}
|
|
31420
31025
|
});
|
|
31421
|
-
const
|
|
31422
|
-
|
|
31423
|
-
|
|
31424
|
-
|
|
31425
|
-
|
|
31426
|
-
|
|
31427
|
-
|
|
31428
|
-
|
|
31429
|
-
|
|
31430
|
-
|
|
31431
|
-
|
|
31432
|
-
|
|
31433
|
-
|
|
31434
|
-
|
|
31435
|
-
|
|
31436
|
-
|
|
31437
|
-
|
|
31438
|
-
|
|
31439
|
-
|
|
31440
|
-
|
|
31026
|
+
const parseConfiguration = ({
|
|
31027
|
+
matchingScenario,
|
|
31028
|
+
country: country2
|
|
31029
|
+
}) => parseTrustScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.TRUST], country2);
|
|
31030
|
+
function TrustDropinComponent({
|
|
31031
|
+
parentLegalEntity,
|
|
31032
|
+
capabilities,
|
|
31033
|
+
country: country2,
|
|
31034
|
+
legalEntityResponse,
|
|
31035
|
+
handleCreateLegalEntity,
|
|
31036
|
+
handleUpdateLegalEntity,
|
|
31037
|
+
handleCreateDocument,
|
|
31038
|
+
handleGetDocument,
|
|
31039
|
+
handleUpdateDocument,
|
|
31040
|
+
handleAddressSearch,
|
|
31041
|
+
handleFindAddress,
|
|
31042
|
+
trackingConfig,
|
|
31043
|
+
taskType,
|
|
31044
|
+
problems: problemsProp,
|
|
31045
|
+
onSubmit: externalOnSubmit,
|
|
31046
|
+
onChange,
|
|
31047
|
+
hideDropinLayout,
|
|
31048
|
+
handleHomeClick,
|
|
31049
|
+
homeButtonLabel
|
|
31050
|
+
}) {
|
|
31051
|
+
var _a;
|
|
31441
31052
|
const {
|
|
31442
31053
|
i18n
|
|
31443
31054
|
} = useI18nContext();
|
|
31444
31055
|
const dataFromResponse = mapLegalEntityToTrust(legalEntityResponse);
|
|
31445
|
-
const [data] = useState(dataFromResponse
|
|
31446
|
-
const [problems, setProblems] = useState(
|
|
31056
|
+
const [data, setData] = useState(dataFromResponse);
|
|
31057
|
+
const [problems, setProblems] = useState(problemsProp);
|
|
31447
31058
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
31448
|
-
const getOmittedKeys = () => ["operationalAddressIsSame"];
|
|
31449
31059
|
const [newTrust, setNewTrust] = useState(null);
|
|
31060
|
+
const {
|
|
31061
|
+
getConfiguration: getConfiguration2
|
|
31062
|
+
} = useConfigurationApi();
|
|
31063
|
+
const {
|
|
31064
|
+
isSettingEnabled
|
|
31065
|
+
} = useSettingsContext();
|
|
31450
31066
|
const {
|
|
31451
31067
|
showToast,
|
|
31452
31068
|
clearToasts
|
|
31453
31069
|
} = useToastContext();
|
|
31454
|
-
const
|
|
31455
|
-
|
|
31070
|
+
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
31071
|
+
const formRef = useRef(null);
|
|
31072
|
+
const getConfigurationData = useCallback(() => getConfiguration2({
|
|
31073
|
+
legalEntityType: LegalEntityType.TRUST,
|
|
31074
|
+
capabilities,
|
|
31075
|
+
country: country2
|
|
31076
|
+
}), [country2, capabilities]);
|
|
31077
|
+
const {
|
|
31078
|
+
fieldConfigurations,
|
|
31079
|
+
requiredFields
|
|
31080
|
+
} = useScenarioConfiguration({
|
|
31081
|
+
parseConfiguration,
|
|
31082
|
+
getConfigurationData,
|
|
31456
31083
|
setLoadingStatus,
|
|
31457
|
-
|
|
31458
|
-
})
|
|
31459
|
-
|
|
31084
|
+
country: country2
|
|
31085
|
+
});
|
|
31086
|
+
const fieldsFromCustomRules = useMemo(() => rules({
|
|
31087
|
+
data,
|
|
31088
|
+
country: country2,
|
|
31089
|
+
taskType,
|
|
31090
|
+
requiredFields,
|
|
31091
|
+
isSettingEnabled
|
|
31092
|
+
}), [country2, data, taskType, requiredFields, isSettingEnabled]);
|
|
31093
|
+
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]);
|
|
31094
|
+
const {
|
|
31095
|
+
state: {
|
|
31096
|
+
currentState
|
|
31097
|
+
}
|
|
31098
|
+
} = useStateContext();
|
|
31099
|
+
const formValidity = currentState.validityByForm;
|
|
31100
|
+
useEffect(() => {
|
|
31101
|
+
setData({
|
|
31102
|
+
...currentState.data
|
|
31103
|
+
});
|
|
31104
|
+
onChange == null ? void 0 : onChange(currentState);
|
|
31105
|
+
}, [currentState]);
|
|
31106
|
+
const forms2 = useMemo(() => {
|
|
31107
|
+
const requiredForms = getRequiredForms(trustForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
|
|
31108
|
+
return addValidityToForms(requiredForms, formValidity, problems);
|
|
31109
|
+
}, [derivedProps, formValidity, problems]);
|
|
31110
|
+
const onSubmit = async () => {
|
|
31460
31111
|
setLoadingStatus("loading");
|
|
31461
|
-
const trustDetails2 = mapTrustToLegalEntity(
|
|
31112
|
+
const trustDetails2 = mapTrustToLegalEntity(data);
|
|
31462
31113
|
try {
|
|
31463
31114
|
const updatedTrust = await submitTrustDetails(trustDetails2);
|
|
31464
31115
|
await submitDocuments({
|
|
31465
31116
|
forms: forms2,
|
|
31466
31117
|
legalEntity: updatedTrust,
|
|
31467
|
-
dataSubmitted:
|
|
31118
|
+
dataSubmitted: data
|
|
31468
31119
|
});
|
|
31469
31120
|
await attachTrustToParentLegalEntity(updatedTrust);
|
|
31470
31121
|
setLoadingStatus("success");
|
|
@@ -31472,7 +31123,7 @@ function TrustDropinComponent(props) {
|
|
|
31472
31123
|
label: i18n.get("successfullyUpdatedDetails"),
|
|
31473
31124
|
type: ToastType.SUCCESS
|
|
31474
31125
|
});
|
|
31475
|
-
|
|
31126
|
+
externalOnSubmit == null ? void 0 : externalOnSubmit(data);
|
|
31476
31127
|
} catch (e) {
|
|
31477
31128
|
showToast({
|
|
31478
31129
|
label: i18n.get("failedToUpdateDetails"),
|
|
@@ -31498,27 +31149,27 @@ function TrustDropinComponent(props) {
|
|
|
31498
31149
|
const submitTrustDetails = async (legalEntity) => {
|
|
31499
31150
|
let updatedTrust;
|
|
31500
31151
|
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.id) && !(newTrust == null ? void 0 : newTrust.id)) {
|
|
31501
|
-
updatedTrust = await
|
|
31152
|
+
updatedTrust = await handleCreateLegalEntity(legalEntity);
|
|
31502
31153
|
setNewTrust(legalEntity);
|
|
31503
31154
|
} else {
|
|
31504
|
-
updatedTrust = await
|
|
31155
|
+
updatedTrust = await handleUpdateLegalEntity(drop("type").from(legalEntity), (legalEntityResponse == null ? void 0 : legalEntityResponse.id) || (newTrust == null ? void 0 : newTrust.id));
|
|
31505
31156
|
}
|
|
31506
31157
|
return updatedTrust;
|
|
31507
31158
|
};
|
|
31508
31159
|
const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
|
|
31509
31160
|
const submitDocuments = async ({
|
|
31510
|
-
forms:
|
|
31161
|
+
forms: forms22,
|
|
31511
31162
|
legalEntity,
|
|
31512
31163
|
dataSubmitted
|
|
31513
31164
|
}) => {
|
|
31514
|
-
if (isDocumentsRequired2(
|
|
31165
|
+
if (isDocumentsRequired2(forms22)) {
|
|
31515
31166
|
const formattedDocument = await mapTrustDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
31516
31167
|
if (formattedDocument) {
|
|
31517
31168
|
await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
|
|
31518
31169
|
}
|
|
31519
31170
|
}
|
|
31520
31171
|
};
|
|
31521
|
-
const isDocumentsRequired2 = (
|
|
31172
|
+
const isDocumentsRequired2 = (forms22) => forms22.some((form) => [trustForms.trustConstitutionalDocument.formId].includes(form.formId));
|
|
31522
31173
|
const attachTrustToParentLegalEntity = async (trust2) => {
|
|
31523
31174
|
if (legalEntityResponse == null ? void 0 : legalEntityResponse.id) {
|
|
31524
31175
|
return;
|
|
@@ -31530,30 +31181,25 @@ function TrustDropinComponent(props) {
|
|
|
31530
31181
|
legalEntityId: trust2.id
|
|
31531
31182
|
}, ...existingEntityAssociations]
|
|
31532
31183
|
};
|
|
31533
|
-
await
|
|
31184
|
+
await handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
|
|
31534
31185
|
};
|
|
31535
|
-
const formatDataForSummary2 = (data2,
|
|
31536
|
-
var
|
|
31537
|
-
let summaryData = cloneObject(data2);
|
|
31538
|
-
|
|
31539
|
-
|
|
31540
|
-
|
|
31541
|
-
|
|
31186
|
+
const formatDataForSummary2 = (data2, forms22) => {
|
|
31187
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
31188
|
+
let summaryData = cloneObject(data2) || {};
|
|
31189
|
+
if (summaryData == null ? void 0 : summaryData.trustRegistrationDetails) {
|
|
31190
|
+
const trustCountry = ((_a2 = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _a2.country) ? datasetUtils.getCountryName(summaryData.trustRegistrationDetails.country) : void 0;
|
|
31191
|
+
const trustType2 = ((_b = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _b.trustType) ? i18n.get((_c = trustTypeOptions.find((trustType22) => {
|
|
31192
|
+
var _a3;
|
|
31193
|
+
return trustType22.id === ((_a3 = summaryData.trustRegistrationDetails) == null ? void 0 : _a3.trustType);
|
|
31194
|
+
})) == null ? void 0 : _c.name) : void 0;
|
|
31195
|
+
summaryData.trustRegistrationDetails = {
|
|
31196
|
+
nameOfTrustAgreement: (_d = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _d.legalName,
|
|
31197
|
+
countryOfEstablishment: trustCountry,
|
|
31198
|
+
typeOfTrustAgreement: trustType2,
|
|
31199
|
+
objectOfTrust: (_e = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _e.objectOfTrust,
|
|
31200
|
+
taxId: (_f = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _f.taxId
|
|
31201
|
+
};
|
|
31542
31202
|
}
|
|
31543
|
-
if ((_b = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _b.trustType) {
|
|
31544
|
-
const selectedTrustType = (_c = trustTypeOptions.find((trustType22) => {
|
|
31545
|
-
var _a2;
|
|
31546
|
-
return trustType22.id === ((_a2 = summaryData.trustRegistrationDetails) == null ? void 0 : _a2.trustType);
|
|
31547
|
-
})) == null ? void 0 : _c.name;
|
|
31548
|
-
trustType2 = i18n.get(selectedTrustType);
|
|
31549
|
-
}
|
|
31550
|
-
summaryData.trustRegistrationDetails = {
|
|
31551
|
-
nameOfTrustAgreement: (_d = data2.trustRegistrationDetails) == null ? void 0 : _d.legalName,
|
|
31552
|
-
countryOfEstablishment: trustCountry,
|
|
31553
|
-
typeOfTrustAgreement: trustType2,
|
|
31554
|
-
objectOfTrust: (_e = data2.trustRegistrationDetails) == null ? void 0 : _e.objectOfTrust,
|
|
31555
|
-
taxId: (_f = data2.trustRegistrationDetails) == null ? void 0 : _f.taxId
|
|
31556
|
-
};
|
|
31557
31203
|
if ((_g = summaryData == null ? void 0 : summaryData.trustRegistrationAddress) == null ? void 0 : _g.registrationAddress) {
|
|
31558
31204
|
summaryData.trustRegistrationAddress.hasInnerForms = true;
|
|
31559
31205
|
summaryData.trustRegistrationAddress.registrationAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.trustRegistrationAddress.registrationAddress, datasetUtils);
|
|
@@ -31561,18 +31207,18 @@ function TrustDropinComponent(props) {
|
|
|
31561
31207
|
if ((_h = summaryData == null ? void 0 : summaryData.trustRegistrationAddress) == null ? void 0 : _h.operationalAddress) {
|
|
31562
31208
|
summaryData.trustRegistrationAddress.operationalAddress = mapAddressLabels(summaryData == null ? void 0 : summaryData.trustRegistrationAddress.operationalAddress, datasetUtils);
|
|
31563
31209
|
}
|
|
31564
|
-
if (isDocumentsRequired2(
|
|
31210
|
+
if (isDocumentsRequired2(forms22)) {
|
|
31565
31211
|
delete summaryData[trustConstitutionalDocumentFormId];
|
|
31566
31212
|
summaryData = {
|
|
31567
31213
|
...summaryData,
|
|
31568
|
-
...formatFileSummaryData2(
|
|
31214
|
+
...formatFileSummaryData2(summaryData == null ? void 0 : summaryData.trustConstitutionalDocument)
|
|
31569
31215
|
};
|
|
31570
31216
|
}
|
|
31571
31217
|
return summaryData;
|
|
31572
31218
|
};
|
|
31573
31219
|
const formatFileSummaryData2 = (trustConstitutionalDocument) => {
|
|
31574
|
-
var
|
|
31575
|
-
const constitutionalDocument2 = (
|
|
31220
|
+
var _a2;
|
|
31221
|
+
const constitutionalDocument2 = (_a2 = trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0];
|
|
31576
31222
|
return {
|
|
31577
31223
|
...constitutionalDocument2 && {
|
|
31578
31224
|
trustConstitutionalDocument: {
|
|
@@ -31585,28 +31231,59 @@ function TrustDropinComponent(props) {
|
|
|
31585
31231
|
const value = getProp(data2, detail);
|
|
31586
31232
|
return !isEmpty(value);
|
|
31587
31233
|
});
|
|
31588
|
-
|
|
31589
|
-
|
|
31590
|
-
|
|
31591
|
-
|
|
31234
|
+
const baseTrackingPayload = getBaseTrackingPayload({
|
|
31235
|
+
trackingConfig,
|
|
31236
|
+
parentLegalEntity,
|
|
31237
|
+
legalEntity: legalEntityResponse,
|
|
31238
|
+
task: taskType
|
|
31239
|
+
});
|
|
31240
|
+
const {
|
|
31241
|
+
handleNextClick,
|
|
31242
|
+
handleBackClick,
|
|
31243
|
+
activeForm,
|
|
31244
|
+
shouldValidate,
|
|
31245
|
+
setShouldValidate,
|
|
31246
|
+
gotoFormByFormIndex,
|
|
31247
|
+
nextButtonLabel
|
|
31248
|
+
} = useFormComposer({
|
|
31249
|
+
problems,
|
|
31250
|
+
baseTrackingPayload,
|
|
31251
|
+
forms: forms2,
|
|
31252
|
+
formRef,
|
|
31253
|
+
onSubmit
|
|
31254
|
+
});
|
|
31255
|
+
return jsx(FormWrapper, {
|
|
31256
|
+
taskName: "trustDetails",
|
|
31257
|
+
handleNextClick,
|
|
31258
|
+
handleBackClick,
|
|
31259
|
+
gotoFormByFormIndex,
|
|
31260
|
+
nextButtonLabel,
|
|
31261
|
+
loadingStatus,
|
|
31262
|
+
forms: forms2,
|
|
31263
|
+
activeForm,
|
|
31264
|
+
baseTrackingPayload,
|
|
31265
|
+
onSubmit,
|
|
31266
|
+
hideDropinLayout,
|
|
31267
|
+
handleHomeClick,
|
|
31268
|
+
homeButtonLabel,
|
|
31269
|
+
validateForm: () => setShouldValidate(true),
|
|
31270
|
+
canSubmit: canSubmit2(data) && hasDataChanged(dataFromResponse, data),
|
|
31271
|
+
problems,
|
|
31272
|
+
summary: {
|
|
31273
|
+
data: formatDataForSummary2(data, forms2),
|
|
31274
|
+
omittedKeys: ["operationalAddressIsSame"]
|
|
31275
|
+
},
|
|
31276
|
+
children: jsx(TrustComponent, {
|
|
31277
|
+
...derivedProps,
|
|
31278
|
+
activeForm,
|
|
31279
|
+
capabilities,
|
|
31592
31280
|
data,
|
|
31593
|
-
country:
|
|
31281
|
+
country: ((_a = data == null ? void 0 : data.trustRegistrationDetails) == null ? void 0 : _a.country) ?? country2,
|
|
31594
31282
|
problems,
|
|
31595
|
-
eventEmitter: props.eventEmitter,
|
|
31596
|
-
hideDropinLayout: props.hideDropinLayout,
|
|
31597
|
-
onChange: props.onChange,
|
|
31598
|
-
handleHomeClick: props.handleHomeClick,
|
|
31599
|
-
homeButtonLabel: props.homeButtonLabel,
|
|
31600
|
-
onSubmit,
|
|
31601
|
-
legalEntityType: LegalEntityType.TRUST,
|
|
31602
|
-
legalEntityResponse,
|
|
31603
|
-
summary: {
|
|
31604
|
-
formatData: formatDataForSummary2,
|
|
31605
|
-
getOmittedKeys
|
|
31606
|
-
},
|
|
31607
|
-
canSubmit: canSubmit2,
|
|
31608
31283
|
handleAddressSearch,
|
|
31609
|
-
handleFindAddress
|
|
31284
|
+
handleFindAddress,
|
|
31285
|
+
shouldValidate,
|
|
31286
|
+
ref: formRef
|
|
31610
31287
|
})
|
|
31611
31288
|
});
|
|
31612
31289
|
}
|
|
@@ -31624,7 +31301,7 @@ function DropinComposerComponent({
|
|
|
31624
31301
|
onNavigate = noop,
|
|
31625
31302
|
...args
|
|
31626
31303
|
}) {
|
|
31627
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
31304
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
31628
31305
|
const {
|
|
31629
31306
|
contextCountry,
|
|
31630
31307
|
accountHolder: accountHolder2,
|
|
@@ -32518,7 +32195,7 @@ function DropinComposerComponent({
|
|
|
32518
32195
|
onSubmit: componentOnSubmit,
|
|
32519
32196
|
handleHomeClick: navigateBack,
|
|
32520
32197
|
homeButtonLabel: i18n.get("saveAndGoToOverview"),
|
|
32521
|
-
country: (
|
|
32198
|
+
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,
|
|
32522
32199
|
handleAddressSearch: args == null ? void 0 : args.handleAddressSearch,
|
|
32523
32200
|
handleFindAddress: args == null ? void 0 : args.handleFindAddress
|
|
32524
32201
|
});
|
|
@@ -33457,6 +33134,64 @@ const AuthProvider = ({
|
|
|
33457
33134
|
children
|
|
33458
33135
|
});
|
|
33459
33136
|
};
|
|
33137
|
+
const fontFormats = ["eot", "woff", "woff2", "ttf", "otf"];
|
|
33138
|
+
const formatFullNames = {
|
|
33139
|
+
eot: "embedded-opentype",
|
|
33140
|
+
woff: "woff",
|
|
33141
|
+
woff2: "woff2",
|
|
33142
|
+
ttf: "truetype",
|
|
33143
|
+
otf: "opentype"
|
|
33144
|
+
};
|
|
33145
|
+
const getFontFaceRule = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
33146
|
+
const fontSources = formats.map((format) => `url(${fontPath}.${format}) format(${formatFullNames[format]})`);
|
|
33147
|
+
const ruleLines = [`font-family: '${fontFamily}'`, `font-style: ${fontStyle}`, `font-weight: ${fontWeight}`, `src: ${fontSources.join(",")}`];
|
|
33148
|
+
return `@font-face {${ruleLines.join(";")}}`;
|
|
33149
|
+
};
|
|
33150
|
+
const addStyleTagForFont = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
|
|
33151
|
+
const style = document.createElement("style");
|
|
33152
|
+
style.setAttribute("type", "text/css");
|
|
33153
|
+
style.innerText = getFontFaceRule(fontFamily, fontStyle, fontWeight, fontPath, formats);
|
|
33154
|
+
document.head.insertBefore(style, document.head.firstChild);
|
|
33155
|
+
};
|
|
33156
|
+
const addStyleTagForADLIconFont = (loadingContext) => {
|
|
33157
|
+
const fontPath = `${loadingContext}static/fonts`;
|
|
33158
|
+
const iconFontPath = `${fontPath}/adyen-kyc-icons`;
|
|
33159
|
+
addStyleTagForFont("adyen-kyc-icons", "normal", "normal", iconFontPath, fontFormats);
|
|
33160
|
+
};
|
|
33161
|
+
let isFlagsLoaded = false;
|
|
33162
|
+
let isDocumentGuidanceLoaded = false;
|
|
33163
|
+
const getIconContainer = () => {
|
|
33164
|
+
const container = document.createElement("div");
|
|
33165
|
+
container.setAttribute("aria-hidden", "true");
|
|
33166
|
+
container.setAttribute("id", "adl-icon-container");
|
|
33167
|
+
container.style.height = "0";
|
|
33168
|
+
return container;
|
|
33169
|
+
};
|
|
33170
|
+
const buildSpriteDOMFromResponse = (responseData) => {
|
|
33171
|
+
const iconContainer = getIconContainer();
|
|
33172
|
+
iconContainer.innerHTML = responseData;
|
|
33173
|
+
return iconContainer;
|
|
33174
|
+
};
|
|
33175
|
+
const loadFlags = async (loadingContext) => {
|
|
33176
|
+
if (isFlagsLoaded)
|
|
33177
|
+
return;
|
|
33178
|
+
isFlagsLoaded = true;
|
|
33179
|
+
const responseData = await http({
|
|
33180
|
+
loadingContext,
|
|
33181
|
+
path: "static/images/country-flags.svg"
|
|
33182
|
+
}, null, "text");
|
|
33183
|
+
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
33184
|
+
};
|
|
33185
|
+
const loadDocumentGuidance = async (loadingContext) => {
|
|
33186
|
+
if (isDocumentGuidanceLoaded)
|
|
33187
|
+
return;
|
|
33188
|
+
isDocumentGuidanceLoaded = true;
|
|
33189
|
+
const responseData = await http({
|
|
33190
|
+
loadingContext,
|
|
33191
|
+
path: "static/images/document-guidance.svg"
|
|
33192
|
+
}, null, "text");
|
|
33193
|
+
document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
|
|
33194
|
+
};
|
|
33460
33195
|
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-d7a003bc.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") });
|
|
33461
33196
|
const getAccountFormatsForCountry = async (country2) => {
|
|
33462
33197
|
const importForCountry = accountFormatsImports[`./${country2}.json`];
|
|
@@ -33929,6 +33664,182 @@ function SettingsContextProvider({
|
|
|
33929
33664
|
children
|
|
33930
33665
|
});
|
|
33931
33666
|
}
|
|
33667
|
+
function removeObjectPropsWithEmptyValues(obj) {
|
|
33668
|
+
keysOf(obj).forEach((key) => {
|
|
33669
|
+
if (obj[key] === null || isEmpty(obj[key]))
|
|
33670
|
+
delete obj[key];
|
|
33671
|
+
});
|
|
33672
|
+
return obj;
|
|
33673
|
+
}
|
|
33674
|
+
const INITIAL_STATE = {
|
|
33675
|
+
data: {},
|
|
33676
|
+
allData: {},
|
|
33677
|
+
initialData: {},
|
|
33678
|
+
errors: {},
|
|
33679
|
+
valid: {},
|
|
33680
|
+
fieldProblems: {},
|
|
33681
|
+
isValid: false
|
|
33682
|
+
};
|
|
33683
|
+
function StateReducer() {
|
|
33684
|
+
const [schemas, setSchemas] = useState({});
|
|
33685
|
+
const [activeForms, setActiveForms] = useState([]);
|
|
33686
|
+
const setCurrentForms = (forms2) => {
|
|
33687
|
+
setActiveForms(forms2);
|
|
33688
|
+
};
|
|
33689
|
+
function reducer2({
|
|
33690
|
+
currentState: currState
|
|
33691
|
+
}, action) {
|
|
33692
|
+
var _a, _b, _c;
|
|
33693
|
+
switch (action.type) {
|
|
33694
|
+
case "addToState": {
|
|
33695
|
+
const state2 = structuredClone(currState);
|
|
33696
|
+
const dataStoreId = action.value.dataStoreId ?? action.value.caller;
|
|
33697
|
+
const schema = action.value.schema || null;
|
|
33698
|
+
const schemaHasChanged = schema && ((_a = schemas == null ? void 0 : schemas[dataStoreId]) == null ? void 0 : _a.toString()) !== schema.toString();
|
|
33699
|
+
const mergedState = {
|
|
33700
|
+
...state2,
|
|
33701
|
+
data: {
|
|
33702
|
+
...state2.data,
|
|
33703
|
+
[dataStoreId]: {
|
|
33704
|
+
...state2.data[dataStoreId],
|
|
33705
|
+
...action.value.data
|
|
33706
|
+
}
|
|
33707
|
+
},
|
|
33708
|
+
// Add data in allData state prop in case we will need them later
|
|
33709
|
+
allData: {
|
|
33710
|
+
...state2.allData,
|
|
33711
|
+
[dataStoreId]: {
|
|
33712
|
+
...state2.allData[dataStoreId],
|
|
33713
|
+
...removeObjectPropsWithEmptyValues(action.value.data)
|
|
33714
|
+
}
|
|
33715
|
+
},
|
|
33716
|
+
errors: {
|
|
33717
|
+
...state2.errors,
|
|
33718
|
+
[dataStoreId]: {
|
|
33719
|
+
...state2.errors[dataStoreId],
|
|
33720
|
+
...action.value.errors
|
|
33721
|
+
}
|
|
33722
|
+
},
|
|
33723
|
+
valid: {
|
|
33724
|
+
...state2.valid,
|
|
33725
|
+
[dataStoreId]: {
|
|
33726
|
+
...state2.valid[dataStoreId],
|
|
33727
|
+
...action.value.valid
|
|
33728
|
+
}
|
|
33729
|
+
},
|
|
33730
|
+
fieldProblems: {
|
|
33731
|
+
...state2.fieldProblems,
|
|
33732
|
+
[dataStoreId]: {
|
|
33733
|
+
...state2.fieldProblems[dataStoreId],
|
|
33734
|
+
...action.value.fieldProblems
|
|
33735
|
+
}
|
|
33736
|
+
}
|
|
33737
|
+
};
|
|
33738
|
+
if (schemaHasChanged) {
|
|
33739
|
+
setSchemas({
|
|
33740
|
+
...schemas,
|
|
33741
|
+
[dataStoreId]: schema
|
|
33742
|
+
});
|
|
33743
|
+
const processedBySchema = schema.reduce((acc, fieldKey) => {
|
|
33744
|
+
const dataObjByFormId = mergedState.data[dataStoreId];
|
|
33745
|
+
const allDataObjByFormId = mergedState.allData[dataStoreId];
|
|
33746
|
+
const validObjByFormId = mergedState.valid[dataStoreId];
|
|
33747
|
+
const errorsObjByFormId = mergedState.errors[dataStoreId];
|
|
33748
|
+
const fieldProblemsObjByFormId = mergedState.fieldProblems[dataStoreId];
|
|
33749
|
+
return {
|
|
33750
|
+
data: {
|
|
33751
|
+
...acc.data,
|
|
33752
|
+
[fieldKey]: dataObjByFormId[fieldKey] ?? allDataObjByFormId[fieldKey]
|
|
33753
|
+
},
|
|
33754
|
+
valid: {
|
|
33755
|
+
...acc.valid,
|
|
33756
|
+
[fieldKey]: validObjByFormId[fieldKey]
|
|
33757
|
+
},
|
|
33758
|
+
errors: {
|
|
33759
|
+
...acc.errors,
|
|
33760
|
+
[fieldKey]: errorsObjByFormId[fieldKey]
|
|
33761
|
+
},
|
|
33762
|
+
fieldProblems: {
|
|
33763
|
+
...acc.fieldProblems,
|
|
33764
|
+
[fieldKey]: fieldProblemsObjByFormId[fieldKey]
|
|
33765
|
+
}
|
|
33766
|
+
};
|
|
33767
|
+
}, {
|
|
33768
|
+
data: {},
|
|
33769
|
+
valid: {},
|
|
33770
|
+
errors: {},
|
|
33771
|
+
fieldProblems: {}
|
|
33772
|
+
});
|
|
33773
|
+
mergedState.data[dataStoreId] = processedBySchema.data;
|
|
33774
|
+
mergedState.valid[dataStoreId] = processedBySchema.valid;
|
|
33775
|
+
mergedState.errors[dataStoreId] = processedBySchema.errors;
|
|
33776
|
+
mergedState.fieldProblems[dataStoreId] = processedBySchema.fieldProblems;
|
|
33777
|
+
}
|
|
33778
|
+
mergedState.validityByForm = {
|
|
33779
|
+
...mergedState.validityByForm,
|
|
33780
|
+
[dataStoreId]: Object.values(mergedState.valid[dataStoreId]).every((isValid) => isValid)
|
|
33781
|
+
};
|
|
33782
|
+
mergedState.allValid = Object.values(mergedState.validityByForm).every((isValid) => isValid);
|
|
33783
|
+
mergedState.isValid = !activeForms.length ? mergedState.allValid : activeForms.every((item) => mergedState.validityByForm[item]);
|
|
33784
|
+
mergedState.initialData = structuredClone(state2.initialData);
|
|
33785
|
+
return {
|
|
33786
|
+
currentState: mergedState,
|
|
33787
|
+
prevState: state2,
|
|
33788
|
+
changeInitiatedBy: dataStoreId
|
|
33789
|
+
};
|
|
33790
|
+
}
|
|
33791
|
+
case "resetState": {
|
|
33792
|
+
const dataStoreId = ((_b = action.value) == null ? void 0 : _b.dataStoreId) ?? ((_c = action.value) == null ? void 0 : _c.caller);
|
|
33793
|
+
return {
|
|
33794
|
+
currentState: INITIAL_STATE,
|
|
33795
|
+
prevState: currState,
|
|
33796
|
+
changeInitiatedBy: dataStoreId
|
|
33797
|
+
};
|
|
33798
|
+
}
|
|
33799
|
+
default: {
|
|
33800
|
+
throw new Error(`Unhandled action type: ${action.type}`);
|
|
33801
|
+
}
|
|
33802
|
+
}
|
|
33803
|
+
}
|
|
33804
|
+
return {
|
|
33805
|
+
reducer: reducer2,
|
|
33806
|
+
setCurrentForms
|
|
33807
|
+
};
|
|
33808
|
+
}
|
|
33809
|
+
function StateProvider({
|
|
33810
|
+
defaultData = {},
|
|
33811
|
+
children
|
|
33812
|
+
}) {
|
|
33813
|
+
const defaultState = {
|
|
33814
|
+
currentState: {
|
|
33815
|
+
data: defaultData,
|
|
33816
|
+
allData: defaultData,
|
|
33817
|
+
valid: {},
|
|
33818
|
+
errors: {},
|
|
33819
|
+
fieldProblems: {},
|
|
33820
|
+
validityByForm: {},
|
|
33821
|
+
initialData: defaultData
|
|
33822
|
+
},
|
|
33823
|
+
prevState: {},
|
|
33824
|
+
changeInitiatedBy: null
|
|
33825
|
+
};
|
|
33826
|
+
const reducerObj = StateReducer();
|
|
33827
|
+
const [state2, dispatch] = useReducer(reducerObj.reducer, defaultState);
|
|
33828
|
+
const contextValue = useMemo(() => ({
|
|
33829
|
+
state: state2,
|
|
33830
|
+
dispatch,
|
|
33831
|
+
setActiveForms: reducerObj.setCurrentForms,
|
|
33832
|
+
getData: () => {
|
|
33833
|
+
var _a;
|
|
33834
|
+
return ((_a = state2 == null ? void 0 : state2.currentState) == null ? void 0 : _a.data) ?? {};
|
|
33835
|
+
},
|
|
33836
|
+
getState: () => state2 == null ? void 0 : state2.currentState
|
|
33837
|
+
}), [reducerObj, state2]);
|
|
33838
|
+
return jsx(StateContext.Provider, {
|
|
33839
|
+
value: contextValue,
|
|
33840
|
+
children
|
|
33841
|
+
});
|
|
33842
|
+
}
|
|
33932
33843
|
function ToastContextProvider({
|
|
33933
33844
|
children
|
|
33934
33845
|
}) {
|