@adyen/kyc-components 3.17.1 → 3.18.1
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 +234 -327
- package/dist/style.css +76 -195
- package/dist/types/components/BusinessTypeSelection/utils.d.ts +2 -2
- package/dist/types/components/CompanyBasics/component/CompanyBasicsComponent.d.ts +1 -1
- package/dist/types/components/CompanyOtherDetails/component/CompanyOtherDetailsComponent.d.ts +1 -1
- package/dist/types/components/EventEmitter.d.ts +3 -3
- package/dist/types/components/internal/Accordion/Accordion.d.ts +11 -3
- package/dist/types/components/internal/ContextGuidance/ContextGuidance.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Field/Field.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Field/types.d.ts +1 -0
- package/dist/types/components/internal/FormFields/InputRadio/InputRadio.d.ts +1 -1
- package/dist/types/components/internal/FormFields/MaskedInputText/MaskedInputText.d.ts +2 -1
- package/dist/types/components/internal/IdFieldTypeSelector/countryIdNumberTypes.d.ts +1 -1
- package/dist/types/components/internal/IdFieldTypeSelector/inferCompanyRegistrationNumberType.d.ts +1 -1
- package/dist/types/core/Context/ExperimentContext/types.d.ts +3 -1
- package/dist/types/core/Context/SettingsContext/useSetting.d.ts +2 -2
- package/dist/types/core/SDKValidation/index.d.ts +2 -2
- package/dist/types/core/Services/componentApi/delete-transferInstrument.d.ts +1 -1
- package/dist/types/core/Services/session.d.ts +1 -1
- package/dist/types/core/core.d.ts +4 -4
- package/dist/types/core/hooks/useAsyncValidator.d.ts +1 -1
- package/dist/types/core/hooks/useBankConfigurationHandlers.d.ts +1 -1
- package/dist/types/core/hooks/useForm/reducer.d.ts +5 -3
- package/dist/types/core/hooks/useForm/types.d.ts +3 -0
- package/dist/types/core/hooks/useIdVerificationToken.d.ts +2 -2
- package/dist/types/core/hooks/useInterval.d.ts +0 -1
- package/dist/types/core/hooks/useLocalStorage.d.ts +1 -5
- package/dist/types/core/hooks/useStaticValidator/useStaticValidator.d.ts +2 -2
- package/dist/types/core/models/errors/validation-error.d.ts +2 -1
- package/dist/types/core/models/field-configurations.d.ts +1 -1
- package/dist/types/utils/api/documentUtils.d.ts +1 -1
- package/dist/types/utils/company-util.d.ts +1 -1
- package/dist/types/utils/entriesOf.d.ts +2 -2
- package/dist/types/utils/mapping/mapping.d.ts +2 -2
- package/dist/types/utils/omitObscuredFieldsIfUnchanged.d.ts +1 -1
- package/dist/types/utils/regex/patternValidators.d.ts +1 -1
- package/dist/types/utils/trustMembers/handlers/addOrUpdateAssociatedTrustMember.d.ts +2 -2
- package/dist/types/utils/trustMembers/handlers/addOrUpdateUndefinedBeneficiary.d.ts +1 -1
- package/dist/types/utils/trustMembers/handlers/createExemptSettlor.d.ts +2 -2
- package/dist/types/utils/trustMembers/handlers/deleteAssociatedTrustMember.d.ts +1 -1
- package/dist/types/utils/trustMembers/handlers/deleteUndefinedBeneficiary.d.ts +1 -1
- package/dist/types/utils/trustMembers/handlers/updateExemptSettlorName.d.ts +2 -2
- package/dist/types/utils/validatorUtils.d.ts +3 -3
- package/dist/types/utils/verification/verificationUtils.d.ts +1 -1
- package/package.json +2 -2
- package/dist/types/components/internal/Accordion/AccordionContext.d.ts +0 -2
- package/dist/types/components/internal/Accordion/index.d.ts +0 -1
- package/dist/types/components/internal/Accordion/types.d.ts +0 -22
- package/dist/types/components/internal/AccordionItem/AccordionItem.d.ts +0 -3
- package/dist/types/components/internal/AccordionItem/index.d.ts +0 -1
- package/dist/types/components/internal/AccordionItem/types.d.ts +0 -15
- package/dist/types/components/internal/AccordionItem/useAccordionContext.d.ts +0 -1
- package/dist/types/components/internal/CollapsibleContainer/CollapsibleContainer.d.ts +0 -3
- package/dist/types/components/internal/CollapsibleContainer/index.d.ts +0 -1
- package/dist/types/components/internal/CollapsibleContainer/types.d.ts +0 -6
|
@@ -75,6 +75,7 @@ const SINFormatCA = "XXXXXXXXX";
|
|
|
75
75
|
const invalidFormat = "Invalid format";
|
|
76
76
|
const formatIsCorrect = "Format is correct";
|
|
77
77
|
const fieldIsRequired = "Field is required";
|
|
78
|
+
const optional = "(optional)";
|
|
78
79
|
const tooManyFiles = "Too many files";
|
|
79
80
|
const duplicatedFiles = "Duplicated files";
|
|
80
81
|
const unsupportedFiletype = "Unsupported filetype";
|
|
@@ -427,7 +428,8 @@ const invalidDateOfBirth = "Please enter a valid date of birth";
|
|
|
427
428
|
const invalidDateOfIncorporation = "Please enter a valid date of incorporation";
|
|
428
429
|
const successfullyUpdatedDetails = "Successfully updated details";
|
|
429
430
|
const failedToUpdateDetails = "Failed to update details";
|
|
430
|
-
const
|
|
431
|
+
const idDocumentAlreadyUploaded = "Identity document has already been uploaded or is too large; try another";
|
|
432
|
+
const bankStatementAlreadyUploaded = "Bank statement has already been uploaded, is too large, or the the account has already been added; try another";
|
|
431
433
|
const successfullyVerifiedIdNumber = "Successfully verified %{idNumber}";
|
|
432
434
|
const failedFetchingDecisionMaker = "Failed to get decision maker details";
|
|
433
435
|
const fileUpload = "File upload";
|
|
@@ -1383,6 +1385,7 @@ const defaultTrans = {
|
|
|
1383
1385
|
invalidFormat,
|
|
1384
1386
|
formatIsCorrect,
|
|
1385
1387
|
fieldIsRequired,
|
|
1388
|
+
optional,
|
|
1386
1389
|
tooManyFiles,
|
|
1387
1390
|
duplicatedFiles,
|
|
1388
1391
|
unsupportedFiletype,
|
|
@@ -1735,7 +1738,8 @@ const defaultTrans = {
|
|
|
1735
1738
|
invalidDateOfIncorporation,
|
|
1736
1739
|
successfullyUpdatedDetails,
|
|
1737
1740
|
failedToUpdateDetails,
|
|
1738
|
-
|
|
1741
|
+
idDocumentAlreadyUploaded,
|
|
1742
|
+
bankStatementAlreadyUploaded,
|
|
1739
1743
|
successfullyVerifiedIdNumber,
|
|
1740
1744
|
failedFetchingDecisionMaker,
|
|
1741
1745
|
fileUpload,
|
|
@@ -3666,12 +3670,32 @@ const useAllowedCountries = () => {
|
|
|
3666
3670
|
}, [acceptedCountries]);
|
|
3667
3671
|
return allowedCountries;
|
|
3668
3672
|
};
|
|
3673
|
+
class ValidationResult {
|
|
3674
|
+
constructor(results) {
|
|
3675
|
+
this.validationResults = results;
|
|
3676
|
+
}
|
|
3677
|
+
/** Checks if all validation rules have passed */
|
|
3678
|
+
get isValid() {
|
|
3679
|
+
return this.validationResults.reduce((acc, result) => acc && result.isValid, true);
|
|
3680
|
+
}
|
|
3681
|
+
/** Checks if any validation rule returned an error */
|
|
3682
|
+
hasError() {
|
|
3683
|
+
return Boolean(this.getError());
|
|
3684
|
+
}
|
|
3685
|
+
/** Returns the first validation result that returned an error */
|
|
3686
|
+
getError() {
|
|
3687
|
+
return this.validationResults.find((result) => result.hasError);
|
|
3688
|
+
}
|
|
3689
|
+
/** Returns all validation results that returned an error */
|
|
3690
|
+
getAllErrors() {
|
|
3691
|
+
return this.validationResults.filter((result) => result.hasError);
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3669
3694
|
const processField = ({
|
|
3670
3695
|
key,
|
|
3671
3696
|
value = null,
|
|
3672
3697
|
mode,
|
|
3673
3698
|
defaultData,
|
|
3674
|
-
obscuredFields,
|
|
3675
3699
|
fieldContext,
|
|
3676
3700
|
formatters,
|
|
3677
3701
|
staticValidate,
|
|
@@ -3680,7 +3704,7 @@ const processField = ({
|
|
|
3680
3704
|
var _a, _b;
|
|
3681
3705
|
const formatterFn = ((_a = formatters == null ? void 0 : formatters[key]) == null ? void 0 : _a.formatter) ? (_b = formatters[key]) == null ? void 0 : _b.formatter : formatters == null ? void 0 : formatters[key];
|
|
3682
3706
|
const formattedValue = formatterFn && typeof formatterFn === "function" ? formatterFn(value, fieldContext) : value;
|
|
3683
|
-
const shouldValidateField = !((
|
|
3707
|
+
const shouldValidateField = !((defaultData == null ? void 0 : defaultData[key]) === value && !!(defaultData == null ? void 0 : defaultData[key]));
|
|
3684
3708
|
if (shouldValidateField && value) {
|
|
3685
3709
|
asyncValidate(key, fieldContext.state, mode);
|
|
3686
3710
|
}
|
|
@@ -3688,11 +3712,10 @@ const processField = ({
|
|
|
3688
3712
|
key,
|
|
3689
3713
|
value: formattedValue,
|
|
3690
3714
|
mode
|
|
3691
|
-
}, fieldContext) : {
|
|
3715
|
+
}, fieldContext) : new ValidationResult([{
|
|
3692
3716
|
isValid: true,
|
|
3693
|
-
hasError:
|
|
3694
|
-
|
|
3695
|
-
};
|
|
3717
|
+
hasError: false
|
|
3718
|
+
}]);
|
|
3696
3719
|
return [formattedValue, validationResult];
|
|
3697
3720
|
};
|
|
3698
3721
|
function init({
|
|
@@ -3700,6 +3723,7 @@ function init({
|
|
|
3700
3723
|
defaultData,
|
|
3701
3724
|
fieldProblems,
|
|
3702
3725
|
obscuredFields,
|
|
3726
|
+
optionalFields,
|
|
3703
3727
|
formatters,
|
|
3704
3728
|
staticValidate,
|
|
3705
3729
|
asyncValidate
|
|
@@ -3711,10 +3735,11 @@ function init({
|
|
|
3711
3735
|
mode: "blur",
|
|
3712
3736
|
formatters,
|
|
3713
3737
|
defaultData,
|
|
3714
|
-
obscuredFields,
|
|
3715
3738
|
fieldContext: {
|
|
3716
3739
|
state: {
|
|
3717
|
-
data: defaultData
|
|
3740
|
+
data: defaultData,
|
|
3741
|
+
obscuredFields,
|
|
3742
|
+
optionalFields
|
|
3718
3743
|
}
|
|
3719
3744
|
},
|
|
3720
3745
|
staticValidate,
|
|
@@ -3735,7 +3760,8 @@ function init({
|
|
|
3735
3760
|
fieldProblems: (fieldProblems == null ? void 0 : fieldProblems[fieldKey]) ?? false
|
|
3736
3761
|
};
|
|
3737
3762
|
};
|
|
3738
|
-
const
|
|
3763
|
+
const formFields = optionalFields ? [...schema, ...optionalFields] : schema;
|
|
3764
|
+
const formData = formFields.reduce((acc, field) => {
|
|
3739
3765
|
const {
|
|
3740
3766
|
valid,
|
|
3741
3767
|
errors,
|
|
@@ -3767,13 +3793,16 @@ function init({
|
|
|
3767
3793
|
valid: {},
|
|
3768
3794
|
errors: {},
|
|
3769
3795
|
fieldProblems: {},
|
|
3770
|
-
obscuredFields
|
|
3796
|
+
obscuredFields,
|
|
3797
|
+
optionalFields
|
|
3771
3798
|
});
|
|
3772
3799
|
return formData;
|
|
3773
3800
|
}
|
|
3774
3801
|
function reducer({
|
|
3775
3802
|
staticValidate,
|
|
3776
3803
|
asyncValidate,
|
|
3804
|
+
obscuredFields,
|
|
3805
|
+
optionalFields,
|
|
3777
3806
|
formatters
|
|
3778
3807
|
}) {
|
|
3779
3808
|
return (state2, {
|
|
@@ -3784,7 +3813,6 @@ function reducer({
|
|
|
3784
3813
|
schema,
|
|
3785
3814
|
selectedSchema,
|
|
3786
3815
|
formValue,
|
|
3787
|
-
obscuredFields,
|
|
3788
3816
|
fieldProblems,
|
|
3789
3817
|
defaultData
|
|
3790
3818
|
}) => {
|
|
@@ -3841,27 +3869,35 @@ function reducer({
|
|
|
3841
3869
|
if (!schema) return state2;
|
|
3842
3870
|
const defaultState = init({
|
|
3843
3871
|
schema,
|
|
3872
|
+
// requiredFields
|
|
3844
3873
|
defaultData,
|
|
3845
3874
|
fieldProblems,
|
|
3846
3875
|
obscuredFields,
|
|
3876
|
+
optionalFields,
|
|
3847
3877
|
staticValidate,
|
|
3848
3878
|
asyncValidate
|
|
3849
3879
|
});
|
|
3850
|
-
const
|
|
3851
|
-
const
|
|
3880
|
+
const removedFields = ((_b = state2.optionalFields) == null ? void 0 : _b.length) ? [...state2.schema.filter((field) => !schema.includes(field)), ...state2.optionalFields.filter((field) => !(optionalFields == null ? void 0 : optionalFields.includes(field)))] : state2.schema.filter((field) => !schema.includes(field));
|
|
3881
|
+
const newFields = (optionalFields == null ? void 0 : optionalFields.length) ? [...schema.filter((field) => {
|
|
3882
|
+
var _a2;
|
|
3883
|
+
return !((_a2 = state2.schema) == null ? void 0 : _a2.includes(field));
|
|
3884
|
+
}), ...optionalFields.filter((field) => {
|
|
3885
|
+
var _a2;
|
|
3886
|
+
return !((_a2 = state2.optionalFields) == null ? void 0 : _a2.includes(field));
|
|
3887
|
+
})] : schema.filter((field) => {
|
|
3852
3888
|
var _a2;
|
|
3853
3889
|
return !((_a2 = state2.schema) == null ? void 0 : _a2.includes(field));
|
|
3854
3890
|
});
|
|
3855
3891
|
const local = {
|
|
3856
|
-
data: omitKeys(state2.data,
|
|
3857
|
-
errors: omitKeys(state2.errors,
|
|
3858
|
-
valid: omitKeys(state2.valid,
|
|
3859
|
-
fieldProblems: omitKeys(state2.fieldProblems,
|
|
3892
|
+
data: omitKeys(state2.data, newFields),
|
|
3893
|
+
errors: omitKeys(state2.errors, newFields),
|
|
3894
|
+
valid: omitKeys(state2.valid, newFields),
|
|
3895
|
+
fieldProblems: omitKeys(state2.fieldProblems, newFields)
|
|
3860
3896
|
};
|
|
3861
|
-
const updatedData = addKeys(omitKeys(state2.data,
|
|
3862
|
-
const updatedValid = addKeys(omitKeys(state2.valid,
|
|
3863
|
-
const updatedErrors = addKeys(omitKeys(state2.errors,
|
|
3864
|
-
const updatedFieldProblems = addKeys(omitKeys(state2.fieldProblems,
|
|
3897
|
+
const updatedData = addKeys(omitKeys(state2.data, removedFields), newFields, null, defaultState.data, (_c = state2.local) == null ? void 0 : _c.data);
|
|
3898
|
+
const updatedValid = addKeys(omitKeys(state2.valid, removedFields), newFields, false, defaultState.valid, (_d = state2.local) == null ? void 0 : _d.valid);
|
|
3899
|
+
const updatedErrors = addKeys(omitKeys(state2.errors, removedFields), newFields, null, defaultState.errors, (_e = state2.local) == null ? void 0 : _e.errors);
|
|
3900
|
+
const updatedFieldProblems = addKeys(omitKeys(state2.fieldProblems, removedFields), newFields, false, defaultState.fieldProblems, (_f = state2.local) == null ? void 0 : _f.fieldProblems);
|
|
3865
3901
|
return {
|
|
3866
3902
|
...state2,
|
|
3867
3903
|
schema,
|
|
@@ -3869,6 +3905,8 @@ function reducer({
|
|
|
3869
3905
|
valid: updatedValid,
|
|
3870
3906
|
errors: updatedErrors,
|
|
3871
3907
|
fieldProblems: updatedFieldProblems,
|
|
3908
|
+
obscuredFields,
|
|
3909
|
+
optionalFields,
|
|
3872
3910
|
local
|
|
3873
3911
|
};
|
|
3874
3912
|
}
|
|
@@ -3879,7 +3917,6 @@ function reducer({
|
|
|
3879
3917
|
value,
|
|
3880
3918
|
mode,
|
|
3881
3919
|
defaultData,
|
|
3882
|
-
obscuredFields,
|
|
3883
3920
|
formatters,
|
|
3884
3921
|
fieldContext: {
|
|
3885
3922
|
state: state2
|
|
@@ -3936,13 +3973,12 @@ function reducer({
|
|
|
3936
3973
|
}
|
|
3937
3974
|
case "validateForm": {
|
|
3938
3975
|
const formValidation = validationSchema == null ? void 0 : validationSchema.reduce((acc, cur) => {
|
|
3939
|
-
var _a2;
|
|
3940
|
-
const [, validation] = processField({
|
|
3976
|
+
var _a2, _b2;
|
|
3977
|
+
const [formattedValue, validation] = processField({
|
|
3941
3978
|
key: cur,
|
|
3942
3979
|
value: state2.data[cur],
|
|
3943
3980
|
mode: "blur",
|
|
3944
3981
|
defaultData,
|
|
3945
|
-
obscuredFields,
|
|
3946
3982
|
formatters,
|
|
3947
3983
|
fieldContext: {
|
|
3948
3984
|
state: state2
|
|
@@ -3950,6 +3986,8 @@ function reducer({
|
|
|
3950
3986
|
staticValidate,
|
|
3951
3987
|
asyncValidate
|
|
3952
3988
|
});
|
|
3989
|
+
const oldValue = state2.data[cur];
|
|
3990
|
+
const clearFieldProblems = oldValue !== formattedValue;
|
|
3953
3991
|
return {
|
|
3954
3992
|
valid: {
|
|
3955
3993
|
...acc.valid,
|
|
@@ -3958,16 +3996,22 @@ function reducer({
|
|
|
3958
3996
|
errors: {
|
|
3959
3997
|
...acc.errors,
|
|
3960
3998
|
[cur]: validation.getError() ?? null
|
|
3999
|
+
},
|
|
4000
|
+
fieldProblems: {
|
|
4001
|
+
...acc.fieldProblems,
|
|
4002
|
+
[cur]: clearFieldProblems ? false : ((_b2 = state2.fieldProblems) == null ? void 0 : _b2[cur]) ?? false
|
|
3961
4003
|
}
|
|
3962
4004
|
};
|
|
3963
4005
|
}, {
|
|
3964
4006
|
valid: state2.valid,
|
|
3965
|
-
errors: state2.errors
|
|
4007
|
+
errors: state2.errors,
|
|
4008
|
+
fieldProblems: state2.fieldProblems
|
|
3966
4009
|
});
|
|
3967
4010
|
return {
|
|
3968
4011
|
...state2,
|
|
3969
4012
|
valid: formValidation == null ? void 0 : formValidation.valid,
|
|
3970
|
-
errors: formValidation == null ? void 0 : formValidation.errors
|
|
4013
|
+
errors: formValidation == null ? void 0 : formValidation.errors,
|
|
4014
|
+
fieldProblems: formValidation == null ? void 0 : formValidation.fieldProblems
|
|
3971
4015
|
};
|
|
3972
4016
|
}
|
|
3973
4017
|
default:
|
|
@@ -3975,27 +4019,6 @@ function reducer({
|
|
|
3975
4019
|
}
|
|
3976
4020
|
};
|
|
3977
4021
|
}
|
|
3978
|
-
class ValidationResult {
|
|
3979
|
-
constructor(results) {
|
|
3980
|
-
this.validationResults = results;
|
|
3981
|
-
}
|
|
3982
|
-
/** Checks if all validation rules have passed */
|
|
3983
|
-
get isValid() {
|
|
3984
|
-
return this.validationResults.reduce((acc, result) => acc && result.isValid, true);
|
|
3985
|
-
}
|
|
3986
|
-
/** Checks if any validation rule returned an error */
|
|
3987
|
-
hasError() {
|
|
3988
|
-
return Boolean(this.getError());
|
|
3989
|
-
}
|
|
3990
|
-
/** Returns the first validation result that returned an error */
|
|
3991
|
-
getError() {
|
|
3992
|
-
return this.validationResults.find((result) => result.hasError);
|
|
3993
|
-
}
|
|
3994
|
-
/** Returns all validation results that returned an error */
|
|
3995
|
-
getAllErrors() {
|
|
3996
|
-
return this.validationResults.filter((result) => result.hasError);
|
|
3997
|
-
}
|
|
3998
|
-
}
|
|
3999
4022
|
const logger$v = createLogger("useAsyncValidator");
|
|
4000
4023
|
const useAsyncValidator = (asyncRules) => {
|
|
4001
4024
|
const [asyncValidationResults, setAsyncValidationResults] = useState({});
|
|
@@ -4039,10 +4062,13 @@ const useStaticValidator = (rules2) => {
|
|
|
4039
4062
|
value,
|
|
4040
4063
|
mode = "blur"
|
|
4041
4064
|
}, context) => {
|
|
4065
|
+
var _a, _b;
|
|
4042
4066
|
const fieldRules = getRulesForField(key);
|
|
4067
|
+
const isFieldOptional = !!((_a = context == null ? void 0 : context.state.optionalFields) == null ? void 0 : _a.includes(key));
|
|
4068
|
+
const isFieldObscured = !!((_b = context == null ? void 0 : context.state.obscuredFields) == null ? void 0 : _b.includes(key));
|
|
4043
4069
|
const validationRulesResult = fieldRules.map((rule) => {
|
|
4044
|
-
const
|
|
4045
|
-
const
|
|
4070
|
+
const shouldValidate = rule.modes.includes(mode) && !isFieldObscured;
|
|
4071
|
+
const isValid = isFieldOptional && isEmpty(value) ? true : rule.validate(value, context);
|
|
4046
4072
|
return {
|
|
4047
4073
|
isValid,
|
|
4048
4074
|
errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value, context) : rule.errorMessage,
|
|
@@ -4055,9 +4081,10 @@ const useStaticValidator = (rules2) => {
|
|
|
4055
4081
|
triggerStaticValidation
|
|
4056
4082
|
};
|
|
4057
4083
|
};
|
|
4058
|
-
const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema) => {
|
|
4059
|
-
|
|
4060
|
-
|
|
4084
|
+
const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema, optionalFields) => {
|
|
4085
|
+
const fields = optionalFields ? [...schema, ...optionalFields] : schema;
|
|
4086
|
+
if (!fields.length) return staticValidationErrors;
|
|
4087
|
+
return fields.reduce((acc, field) => {
|
|
4061
4088
|
var _a;
|
|
4062
4089
|
return {
|
|
4063
4090
|
...acc,
|
|
@@ -4084,27 +4111,25 @@ function useForm({
|
|
|
4084
4111
|
asyncValidationResults
|
|
4085
4112
|
} = useAsyncValidator(asyncRules);
|
|
4086
4113
|
const getRequiredFields = useMemo(() => typeof schema === "function" ? schema : () => schema, [schema]);
|
|
4087
|
-
const getSchema = useMemo(() =>
|
|
4088
|
-
if (optionalFields) {
|
|
4089
|
-
return defaultData ? [...getRequiredFields(defaultData), ...optionalFields] : [];
|
|
4090
|
-
}
|
|
4091
|
-
return defaultData ? getRequiredFields(defaultData) : [];
|
|
4092
|
-
}, [optionalFields, defaultData, getRequiredFields]);
|
|
4114
|
+
const getSchema = useMemo(() => defaultData ? getRequiredFields(defaultData) : [], [defaultData, getRequiredFields]);
|
|
4093
4115
|
const getReducer = useCallback(() => reducer({
|
|
4094
4116
|
staticValidate: triggerStaticValidation,
|
|
4095
4117
|
asyncValidate: triggerAsyncValidation,
|
|
4118
|
+
obscuredFields,
|
|
4119
|
+
optionalFields,
|
|
4096
4120
|
formatters
|
|
4097
|
-
}), [triggerStaticValidation, triggerAsyncValidation, formatters]);
|
|
4098
|
-
const
|
|
4121
|
+
}), [triggerStaticValidation, triggerAsyncValidation, obscuredFields, optionalFields, formatters]);
|
|
4122
|
+
const initialData = useMemo(() => ({
|
|
4099
4123
|
schema: getSchema,
|
|
4100
4124
|
defaultData,
|
|
4101
4125
|
fieldProblems,
|
|
4102
4126
|
obscuredFields,
|
|
4127
|
+
optionalFields,
|
|
4103
4128
|
formatters,
|
|
4104
4129
|
staticValidate: triggerStaticValidation,
|
|
4105
4130
|
asyncValidate: triggerAsyncValidation
|
|
4106
|
-
}), [getSchema, defaultData, fieldProblems, obscuredFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
|
|
4107
|
-
const [state2, dispatch] = useReducer(getReducer(),
|
|
4131
|
+
}), [getSchema, defaultData, fieldProblems, obscuredFields, optionalFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
|
|
4132
|
+
const [state2, dispatch] = useReducer(getReducer(), initialData, init);
|
|
4108
4133
|
const isValid = useMemo(() => {
|
|
4109
4134
|
var _a;
|
|
4110
4135
|
return (_a = state2.schema) == null ? void 0 : _a.every((key) => state2.valid[key]);
|
|
@@ -4151,18 +4176,16 @@ function useForm({
|
|
|
4151
4176
|
key,
|
|
4152
4177
|
value,
|
|
4153
4178
|
mode,
|
|
4154
|
-
defaultData
|
|
4155
|
-
obscuredFields
|
|
4179
|
+
defaultData
|
|
4156
4180
|
});
|
|
4157
|
-
}, [defaultData,
|
|
4181
|
+
}, [defaultData, getTargetValue]);
|
|
4158
4182
|
const triggerValidation = useCallback((selectedSchema) => {
|
|
4159
4183
|
dispatch({
|
|
4160
4184
|
type: "validateForm",
|
|
4161
4185
|
selectedSchema,
|
|
4162
|
-
defaultData
|
|
4163
|
-
obscuredFields
|
|
4186
|
+
defaultData
|
|
4164
4187
|
});
|
|
4165
|
-
}, [defaultData
|
|
4188
|
+
}, [defaultData]);
|
|
4166
4189
|
useEffect(() => {
|
|
4167
4190
|
const newSchema = getRequiredFields(state2.data);
|
|
4168
4191
|
if (!doArraysMatch(state2.schema, newSchema)) {
|
|
@@ -4179,7 +4202,7 @@ function useForm({
|
|
|
4179
4202
|
setFieldProblems(fieldProblems);
|
|
4180
4203
|
}
|
|
4181
4204
|
}, [JSON.stringify(fieldProblems), setFieldProblems]);
|
|
4182
|
-
const formErrors = useMemo(() => mergeStaticAndAsyncErrorsState(state2.errors, asyncValidationResults, state2.schema), [asyncValidationResults, state2.errors]);
|
|
4205
|
+
const formErrors = useMemo(() => mergeStaticAndAsyncErrorsState(state2.errors, asyncValidationResults, state2.schema, state2.optionalFields), [asyncValidationResults, state2.errors, state2.optionalFields, state2.schema]);
|
|
4183
4206
|
return {
|
|
4184
4207
|
mergeForm,
|
|
4185
4208
|
setData,
|
|
@@ -4308,6 +4331,7 @@ const Field = ({
|
|
|
4308
4331
|
children,
|
|
4309
4332
|
dataPlaceholder,
|
|
4310
4333
|
disabled,
|
|
4334
|
+
optional: optional2,
|
|
4311
4335
|
errorMessage,
|
|
4312
4336
|
filled,
|
|
4313
4337
|
focused,
|
|
@@ -4327,6 +4351,9 @@ const Field = ({
|
|
|
4327
4351
|
wrapperRef
|
|
4328
4352
|
}) => {
|
|
4329
4353
|
const uniqueId = useId();
|
|
4354
|
+
const {
|
|
4355
|
+
i18n
|
|
4356
|
+
} = useI18nContext();
|
|
4330
4357
|
const [isFilled] = useStateFromProp({
|
|
4331
4358
|
passedValue: filled,
|
|
4332
4359
|
skipUpdate: filled === void 0
|
|
@@ -4354,11 +4381,14 @@ const Field = ({
|
|
|
4354
4381
|
name,
|
|
4355
4382
|
onClick: onFocusField,
|
|
4356
4383
|
useLabelElement,
|
|
4357
|
-
children: [
|
|
4384
|
+
children: [jsxs("span", {
|
|
4358
4385
|
className: cx("adyen-kyc-label__text", {
|
|
4359
4386
|
"adyen-kyc-label__text--error": !!errorMessage
|
|
4360
4387
|
}),
|
|
4361
|
-
children: label
|
|
4388
|
+
children: [label, optional2 && jsxs("span", {
|
|
4389
|
+
className: "adyen-kyc-optional-label",
|
|
4390
|
+
children: [" ", i18n.get("optional")]
|
|
4391
|
+
})]
|
|
4362
4392
|
}), helper && helperPosition === "above" && jsx("span", {
|
|
4363
4393
|
className: "adyen-kyc-helper-text adyen-kyc-helper-text__above",
|
|
4364
4394
|
children: helper
|
|
@@ -5721,8 +5751,8 @@ const findPossibleShifts = (mask) => {
|
|
|
5721
5751
|
const inputOnlyMask = mask.filter((t) => t.type === "input");
|
|
5722
5752
|
const optionals = inputOnlyMask.filter((t) => t.optional);
|
|
5723
5753
|
const possibleShifts = [];
|
|
5724
|
-
for (const
|
|
5725
|
-
const index = inputOnlyMask.indexOf(
|
|
5754
|
+
for (const optional2 of optionals) {
|
|
5755
|
+
const index = inputOnlyMask.indexOf(optional2);
|
|
5726
5756
|
for (let i = index + 1; i < inputOnlyMask.length; i += 1) {
|
|
5727
5757
|
const laterToken = inputOnlyMask[i];
|
|
5728
5758
|
if (laterToken.type === "input") {
|
|
@@ -5904,10 +5934,15 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5904
5934
|
}
|
|
5905
5935
|
}
|
|
5906
5936
|
};
|
|
5907
|
-
const deriveInputState = (isValid, isFocused,
|
|
5937
|
+
const deriveInputState = (isValid, isFocused, isDisabled, isOptional, hasNullishValue, hasBlurred, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
|
|
5908
5938
|
if (isDisabled) return {
|
|
5909
5939
|
isError: false
|
|
5910
5940
|
};
|
|
5941
|
+
if (isOptional && hasNullishValue) {
|
|
5942
|
+
return {
|
|
5943
|
+
isError: false
|
|
5944
|
+
};
|
|
5945
|
+
}
|
|
5911
5946
|
if (isValid && (!potentiallyMoreOptionalCharacters || !isFocused)) return {
|
|
5912
5947
|
isError: false,
|
|
5913
5948
|
text: jsxs(Fragment, {
|
|
@@ -5946,6 +5981,7 @@ const MaskedInputText = ({
|
|
|
5946
5981
|
transformOnType,
|
|
5947
5982
|
readonly = false,
|
|
5948
5983
|
disabled = false,
|
|
5984
|
+
optional: optional2 = false,
|
|
5949
5985
|
formatGuidance,
|
|
5950
5986
|
classNameModifiers,
|
|
5951
5987
|
acceptObscuredValue = false
|
|
@@ -5986,7 +6022,7 @@ const MaskedInputText = ({
|
|
|
5986
6022
|
}, [mask]);
|
|
5987
6023
|
const maskResult = useMemo(() => getMaskResult(value), [getMaskResult, value]);
|
|
5988
6024
|
const displayValue = maskResult.outcome === "mismatch" ? maskResult.partialDisplayValue : maskResult.displayValue;
|
|
5989
|
-
const inputState = deriveInputState(validationIsValid && maskResult.outcome !== "mismatch", isFocused,
|
|
6025
|
+
const inputState = deriveInputState(validationIsValid && maskResult.outcome !== "mismatch", isFocused, disabled, optional2, !displayValue, hasBlurred, errorMessage, shouldValidate, maskResult.outcome === "correct" && !!maskResult.potentialForMoreOptionalInput, formatGuidance, i18n);
|
|
5990
6026
|
useEffect(() => {
|
|
5991
6027
|
if (mask && maskResult.outcome === "mismatch") {
|
|
5992
6028
|
const strippedValue = displayValueToPure(value);
|
|
@@ -6040,6 +6076,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
6040
6076
|
helperPosition: "below",
|
|
6041
6077
|
classNameModifiers: classNameModifiers == null ? void 0 : classNameModifiers.field,
|
|
6042
6078
|
disabled,
|
|
6079
|
+
optional: optional2,
|
|
6043
6080
|
children: ({
|
|
6044
6081
|
onBlurHandler: fieldOnBlur,
|
|
6045
6082
|
onFocusHandler: fieldOnFocus,
|
|
@@ -6344,25 +6381,25 @@ const nonInputs = (str, options) => Array.from(str).map((char) => ({
|
|
|
6344
6381
|
displayEagerly: (options == null ? void 0 : options.displayEagerly) ?? true
|
|
6345
6382
|
}));
|
|
6346
6383
|
const spacer = nonInputs(" ")[0];
|
|
6347
|
-
const alphaInputs = (length,
|
|
6384
|
+
const alphaInputs = (length, optional2 = false) => makeArrayOfRepeatedObjects(length, {
|
|
6348
6385
|
type: "input",
|
|
6349
6386
|
allow: /[A-Za-z]/,
|
|
6350
|
-
optional
|
|
6387
|
+
optional: optional2
|
|
6351
6388
|
});
|
|
6352
|
-
const numericInputs = (length,
|
|
6389
|
+
const numericInputs = (length, optional2 = false) => makeArrayOfRepeatedObjects(length, {
|
|
6353
6390
|
type: "input",
|
|
6354
6391
|
allow: /\d/,
|
|
6355
|
-
optional
|
|
6392
|
+
optional: optional2
|
|
6356
6393
|
});
|
|
6357
|
-
const alphanumericInputs = (length,
|
|
6394
|
+
const alphanumericInputs = (length, optional2 = false) => makeArrayOfRepeatedObjects(length, {
|
|
6358
6395
|
type: "input",
|
|
6359
6396
|
allow: /[\dA-Za-z]/,
|
|
6360
|
-
optional
|
|
6397
|
+
optional: optional2
|
|
6361
6398
|
});
|
|
6362
|
-
const customInputs = (length, regex,
|
|
6399
|
+
const customInputs = (length, regex, optional2 = false) => makeArrayOfRepeatedObjects(length, {
|
|
6363
6400
|
type: "input",
|
|
6364
6401
|
allow: regex,
|
|
6365
|
-
optional
|
|
6402
|
+
optional: optional2
|
|
6366
6403
|
});
|
|
6367
6404
|
const makeMask = (...tokens) => ({
|
|
6368
6405
|
tokens,
|
|
@@ -7740,208 +7777,62 @@ class UserEvents {
|
|
|
7740
7777
|
}
|
|
7741
7778
|
}
|
|
7742
7779
|
const userEvents = new UserEvents();
|
|
7743
|
-
const
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
className,
|
|
7747
|
-
expand = false,
|
|
7748
|
-
type,
|
|
7749
|
-
onExpandSection
|
|
7750
|
-
}) {
|
|
7751
|
-
const [items, setItems] = useState([]);
|
|
7752
|
-
const classNames = cx("adyen-kyc-accordion", className, {
|
|
7753
|
-
"adyen-kyc-accordion--container": type === "container",
|
|
7754
|
-
"adyen-kyc-accordion--guide": type === "guide"
|
|
7755
|
-
});
|
|
7756
|
-
const contextValue = useMemo(() => ({
|
|
7757
|
-
expand,
|
|
7758
|
-
items,
|
|
7759
|
-
setItems,
|
|
7760
|
-
onExpandSection
|
|
7761
|
-
}), [expand, items, onExpandSection]);
|
|
7762
|
-
return jsx(AccordionContext.Provider, {
|
|
7763
|
-
value: contextValue,
|
|
7764
|
-
children: jsx("div", {
|
|
7765
|
-
className: classNames,
|
|
7766
|
-
children
|
|
7767
|
-
})
|
|
7768
|
-
});
|
|
7769
|
-
}
|
|
7770
|
-
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
7771
|
-
Placement2[Placement2["Left"] = 0] = "Left";
|
|
7772
|
-
Placement2[Placement2["Right"] = 1] = "Right";
|
|
7773
|
-
return Placement2;
|
|
7774
|
-
})(Placement || {});
|
|
7775
|
-
function CollapsibleContainer({
|
|
7776
|
-
children,
|
|
7777
|
-
collapsed = false,
|
|
7778
|
-
animationDuration = 0
|
|
7779
|
-
}) {
|
|
7780
|
-
const collapsibleContainerEl = useRef(null);
|
|
7781
|
-
const [height, setHeight] = useState(collapsed ? 0 : void 0);
|
|
7782
|
-
useEffect(() => {
|
|
7783
|
-
var _a;
|
|
7784
|
-
setHeight(collapsed ? 0 : (_a = collapsibleContainerEl.current) == null ? void 0 : _a.scrollHeight);
|
|
7785
|
-
setTimeout(() => {
|
|
7786
|
-
setHeight(collapsed ? 0 : "auto");
|
|
7787
|
-
}, animationDuration * 1e3);
|
|
7788
|
-
}, [collapsed]);
|
|
7789
|
-
return jsx("div", {
|
|
7790
|
-
className: "adyen-collapsible-container",
|
|
7791
|
-
"aria-hidden": collapsed,
|
|
7792
|
-
ref: collapsibleContainerEl,
|
|
7793
|
-
style: {
|
|
7794
|
-
height,
|
|
7795
|
-
transitionDuration: `${animationDuration}s`
|
|
7796
|
-
},
|
|
7797
|
-
children
|
|
7798
|
-
});
|
|
7799
|
-
}
|
|
7800
|
-
const useAccordionContext = () => {
|
|
7801
|
-
const accordionContext = useContext(AccordionContext);
|
|
7802
|
-
if (!accordionContext) {
|
|
7803
|
-
throw new Error("Cannot use useAccordionContext without AccordionContext");
|
|
7804
|
-
}
|
|
7805
|
-
return accordionContext;
|
|
7806
|
-
};
|
|
7807
|
-
function AccordionItem({
|
|
7780
|
+
const ChevronDownIcon = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2015%2015'%3e%3cdefs%3e%3cpath%20id='chevron-down_svg__a'%20d='M2%205a1%201%200%200%201%201.74-.67L7.5%208.51l3.76-4.18a1%201%200%200%201%201.48%201.34l-4.5%205a1%201%200%200%201-1.48%200l-4.5-5A1%201%200%200%201%202%205'/%3e%3c/defs%3e%3cuse%20xlink:href='%23chevron-down_svg__a'%20fill-rule='evenodd'/%3e%3c/svg%3e";
|
|
7781
|
+
const Accordion = ({
|
|
7782
|
+
title,
|
|
7808
7783
|
children,
|
|
7809
|
-
className,
|
|
7810
|
-
open = false,
|
|
7811
|
-
title = "",
|
|
7812
|
-
subTitle = "",
|
|
7813
|
-
expandIconPlacement = Placement.Left,
|
|
7814
|
-
iconPlacement = Placement.Left,
|
|
7815
7784
|
icon,
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
setItems,
|
|
7823
|
-
onExpandSection
|
|
7824
|
-
} = useAccordionContext();
|
|
7825
|
-
const [isOpen, setIsOpen] = useState(open);
|
|
7826
|
-
const [id2] = useState(getUniqueId);
|
|
7827
|
-
const toggle = () => {
|
|
7828
|
-
const newValue = !isOpen;
|
|
7829
|
-
const newItems = [...items];
|
|
7830
|
-
if (!expand) {
|
|
7831
|
-
setItems(newItems.map((item) => ({
|
|
7832
|
-
...item,
|
|
7833
|
-
isOpen: item.id === id2 ? newValue : false
|
|
7834
|
-
})));
|
|
7835
|
-
} else {
|
|
7836
|
-
const currentItem = newItems.find((item) => item.id === id2);
|
|
7837
|
-
if (currentItem) {
|
|
7838
|
-
currentItem.isOpen = newValue;
|
|
7839
|
-
}
|
|
7840
|
-
setItems(newItems);
|
|
7841
|
-
}
|
|
7785
|
+
expandOnLeft = false,
|
|
7786
|
+
onToggle,
|
|
7787
|
+
className
|
|
7788
|
+
}) => {
|
|
7789
|
+
const handleToggle = (e) => {
|
|
7790
|
+
onToggle(e.newState === "closed" ? "close" : "open");
|
|
7842
7791
|
};
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
}]);
|
|
7848
|
-
}, []);
|
|
7849
|
-
useEffect(() => {
|
|
7850
|
-
setIsOpen(open);
|
|
7851
|
-
}, [open]);
|
|
7852
|
-
useEffect(() => {
|
|
7853
|
-
const currentItem = items.find((item) => item.id === id2);
|
|
7854
|
-
if (currentItem) {
|
|
7855
|
-
setIsOpen(currentItem.isOpen);
|
|
7856
|
-
}
|
|
7857
|
-
}, [items]);
|
|
7858
|
-
useEffect(() => {
|
|
7859
|
-
if (isOpen) {
|
|
7860
|
-
onExpandSection == null ? void 0 : onExpandSection(typeof title === "string" ? title : "");
|
|
7861
|
-
onOpen();
|
|
7862
|
-
} else {
|
|
7863
|
-
onClose();
|
|
7864
|
-
}
|
|
7865
|
-
}, [isOpen]);
|
|
7866
|
-
return jsxs("div", {
|
|
7867
|
-
className: cx("adyen-kyc-accordion__item", className),
|
|
7868
|
-
children: [jsxs("div", {
|
|
7792
|
+
return jsxs("details", {
|
|
7793
|
+
onToggle: handleToggle,
|
|
7794
|
+
className,
|
|
7795
|
+
children: [jsxs("summary", {
|
|
7869
7796
|
role: "button",
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
children: [jsx("div", {
|
|
7883
|
-
className: "adyen-kyc-accordion__title",
|
|
7884
|
-
children: title
|
|
7885
|
-
}), subTitle && jsx("div", {
|
|
7886
|
-
className: "adyen-kyc-accordion__subtitle",
|
|
7887
|
-
children: subTitle
|
|
7888
|
-
})]
|
|
7889
|
-
}), expandIconPlacement === Placement.Right ? jsx(Icon, {
|
|
7890
|
-
name: isOpen ? "chevron-up" : "chevron-down",
|
|
7891
|
-
className: "adyen-kyc-accordion__toggle"
|
|
7892
|
-
}) : null, icon && iconPlacement === Placement.Right ? jsx(Icon, {
|
|
7893
|
-
name: icon,
|
|
7894
|
-
className: "adyen-kyc-accordion__toggle"
|
|
7895
|
-
}) : null]
|
|
7896
|
-
}), jsx(CollapsibleContainer, {
|
|
7897
|
-
collapsed: !isOpen,
|
|
7898
|
-
animationDuration: 0.1,
|
|
7899
|
-
children: jsx("div", {
|
|
7900
|
-
className: "adyen-kyc-accordion__content",
|
|
7901
|
-
children
|
|
7902
|
-
})
|
|
7797
|
+
children: [expandOnLeft && jsx("img", {
|
|
7798
|
+
className: "arrow",
|
|
7799
|
+
src: ChevronDownIcon,
|
|
7800
|
+
alt: ""
|
|
7801
|
+
}), icon, title, !expandOnLeft && jsx("img", {
|
|
7802
|
+
className: "arrow arrow-right",
|
|
7803
|
+
src: ChevronDownIcon,
|
|
7804
|
+
alt: ""
|
|
7805
|
+
})]
|
|
7806
|
+
}), jsx("section", {
|
|
7807
|
+
className: "content",
|
|
7808
|
+
children
|
|
7903
7809
|
})]
|
|
7904
7810
|
});
|
|
7905
|
-
}
|
|
7811
|
+
};
|
|
7906
7812
|
function ContextGuidance({
|
|
7907
7813
|
page,
|
|
7908
7814
|
title,
|
|
7909
7815
|
content,
|
|
7910
7816
|
titleId,
|
|
7911
|
-
contentId
|
|
7912
|
-
onOpen = noop,
|
|
7913
|
-
onClose = noop
|
|
7817
|
+
contentId
|
|
7914
7818
|
}) {
|
|
7915
|
-
const
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
guidancePage: page,
|
|
7919
|
-
guidanceTitleId: titleId,
|
|
7920
|
-
guidanceContentId: contentId
|
|
7921
|
-
}
|
|
7922
|
-
});
|
|
7923
|
-
onOpen();
|
|
7924
|
-
};
|
|
7925
|
-
const onGuidanceClose = () => {
|
|
7926
|
-
userEvents.addEvent("Close contextual guidance information", {
|
|
7819
|
+
const onGuidanceToggle = (status) => {
|
|
7820
|
+
const eventAction = status === "open" ? "Open" : "Close";
|
|
7821
|
+
userEvents.addEvent(`${eventAction} contextual guidance information`, {
|
|
7927
7822
|
segmentation: {
|
|
7928
7823
|
guidancePage: page,
|
|
7929
7824
|
guidanceTitleId: titleId,
|
|
7930
7825
|
guidanceContentId: contentId
|
|
7931
7826
|
}
|
|
7932
7827
|
});
|
|
7933
|
-
onClose();
|
|
7934
7828
|
};
|
|
7935
7829
|
return jsx(Accordion, {
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
onClose: onGuidanceClose,
|
|
7943
|
-
children: content
|
|
7944
|
-
})
|
|
7830
|
+
title,
|
|
7831
|
+
icon: jsx(Icon, {
|
|
7832
|
+
name: "light-bulb"
|
|
7833
|
+
}),
|
|
7834
|
+
onToggle: onGuidanceToggle,
|
|
7835
|
+
children: content
|
|
7945
7836
|
});
|
|
7946
7837
|
}
|
|
7947
7838
|
const checkDateInputSupport = () => {
|
|
@@ -9050,6 +8941,8 @@ var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
|
|
|
9050
8941
|
ExperimentNames2["ShowSingPassButtonForCompanies"] = "ShowSingPassButtonForCompanies";
|
|
9051
8942
|
ExperimentNames2["ShowExtraTaxExemptionReasons"] = "ShowExtraTaxExemptionReasons";
|
|
9052
8943
|
ExperimentNames2["EnableCountryOfGoverningLawForUKCompanies"] = "EnableCountryOfGoverningLawForUKCompanies";
|
|
8944
|
+
ExperimentNames2["HidePayoutAccountTask"] = "HidePayoutAccountTask";
|
|
8945
|
+
ExperimentNames2["HidePciTask"] = "HidePciTask";
|
|
9053
8946
|
return ExperimentNames2;
|
|
9054
8947
|
})(ExperimentNames || {});
|
|
9055
8948
|
var VatAbsenceReason = /* @__PURE__ */ ((VatAbsenceReason2) => {
|
|
@@ -12310,10 +12203,7 @@ function Address(props) {
|
|
|
12310
12203
|
}) => {
|
|
12311
12204
|
const isHouseNumberFirst = COUNTRIES_WITH_HOUSE_NUMBER_FIRST.includes(data.country);
|
|
12312
12205
|
const needsComma = COUNTRIES_WITH_COMMA_SEPARATED.includes(data.country);
|
|
12313
|
-
|
|
12314
|
-
if (needsComma) {
|
|
12315
|
-
formattedAddress = formattedAddress.replace(" ", ", ");
|
|
12316
|
-
}
|
|
12206
|
+
const formattedAddress = isHouseNumberFirst ? `${houseNumberOrName}${needsComma ? ", " : " "}${street2}` : `${street2}${needsComma ? ", " : " "}${houseNumberOrName}`;
|
|
12317
12207
|
handleChangeFor("address", "input")(formattedAddress);
|
|
12318
12208
|
};
|
|
12319
12209
|
const setFieldsData = (address2, field) => {
|
|
@@ -14021,8 +13911,8 @@ const mapLegalEntityToSoleProp = (legalEntity) => {
|
|
|
14021
13911
|
}
|
|
14022
13912
|
return solePropCompData;
|
|
14023
13913
|
};
|
|
14024
|
-
const mapSolePropToLegalEntity = (data
|
|
14025
|
-
var _a;
|
|
13914
|
+
const mapSolePropToLegalEntity = (data) => {
|
|
13915
|
+
var _a, _b;
|
|
14026
13916
|
const requestObj = {
|
|
14027
13917
|
...formatObject(data, solePropApiKeyMapping)
|
|
14028
13918
|
};
|
|
@@ -14041,7 +13931,7 @@ const mapSolePropToLegalEntity = (data, isCountryOfGoverningLawEnabled = false)
|
|
|
14041
13931
|
if (data.solePropRegistrationDetails.exemptedFromRegistrationNumber) {
|
|
14042
13932
|
requestObj.soleProprietorship.registrationNumber = "";
|
|
14043
13933
|
}
|
|
14044
|
-
if (!
|
|
13934
|
+
if (!((_a = requestObj.soleProprietorship) == null ? void 0 : _a.countryOfGoverningLaw) && ((_b = data.solePropNameAndCountry) == null ? void 0 : _b.country)) {
|
|
14045
13935
|
requestObj.soleProprietorship.countryOfGoverningLaw = data.solePropNameAndCountry.country;
|
|
14046
13936
|
}
|
|
14047
13937
|
requestObj.type = LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
@@ -24282,9 +24172,12 @@ var BusinessDetailsEvents = /* @__PURE__ */ ((BusinessDetailsEvents2) => {
|
|
|
24282
24172
|
})(BusinessDetailsEvents || {});
|
|
24283
24173
|
const isMaintenanceModeError = (error) => error && "messageCode" in error && error.messageCode === "maintenanceMode";
|
|
24284
24174
|
const API_VALIDATION_ERROR_CODE = "30_102";
|
|
24285
|
-
const
|
|
24286
|
-
const
|
|
24287
|
-
const
|
|
24175
|
+
const ID_DOCUMENT_UPLOAD_ERROR_CODE = "30_105";
|
|
24176
|
+
const BANK_STATEMENT_UPLOAD_ERROR_CODE = "30_106";
|
|
24177
|
+
const validateErrorCode = (error, errorCode) => error && "errorCode" in error && error.errorCode === errorCode;
|
|
24178
|
+
const isValidationError = (error) => validateErrorCode(error, API_VALIDATION_ERROR_CODE);
|
|
24179
|
+
const isIdDocumentUploadError = (error) => validateErrorCode(error, ID_DOCUMENT_UPLOAD_ERROR_CODE);
|
|
24180
|
+
const isBankStatementUploadError = (error) => validateErrorCode(error, BANK_STATEMENT_UPLOAD_ERROR_CODE);
|
|
24288
24181
|
const processValidationErrors = (validationError, dropinTask) => {
|
|
24289
24182
|
if ((validationError == null ? void 0 : validationError.invalidFields) && (validationError == null ? void 0 : validationError.invalidFields.length) > 0) {
|
|
24290
24183
|
return validationError == null ? void 0 : validationError.invalidFields.reduce((acc, invalidField) => {
|
|
@@ -25939,6 +25832,7 @@ function CompanyBasics({
|
|
|
25939
25832
|
shouldValidate,
|
|
25940
25833
|
formVerificationErrors,
|
|
25941
25834
|
fieldValidationErrors,
|
|
25835
|
+
allFields,
|
|
25942
25836
|
requiredFields,
|
|
25943
25837
|
obscuredFields,
|
|
25944
25838
|
optionalFields,
|
|
@@ -25972,6 +25866,7 @@ function CompanyBasics({
|
|
|
25972
25866
|
const defaultTaxIdNumberType = existingTaxId ? inferTaxIdNumberType(existingTaxId, country2) : (_c = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _c[0].id;
|
|
25973
25867
|
const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
|
|
25974
25868
|
const initialFormUtilsProps = useMemo$1(() => ({
|
|
25869
|
+
allFields,
|
|
25975
25870
|
labels: labels2,
|
|
25976
25871
|
placeholders,
|
|
25977
25872
|
helperText,
|
|
@@ -25981,10 +25876,10 @@ function CompanyBasics({
|
|
|
25981
25876
|
optionalFields,
|
|
25982
25877
|
obscuredFields,
|
|
25983
25878
|
shouldValidate
|
|
25984
|
-
}), [helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
25879
|
+
}), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
25985
25880
|
const mergedFieldProps = useMemo$1(() => {
|
|
25986
25881
|
var _a2;
|
|
25987
|
-
return (_a2 = initialFormUtilsProps.
|
|
25882
|
+
return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
|
|
25988
25883
|
switch (field) {
|
|
25989
25884
|
case "legalCompanyName":
|
|
25990
25885
|
return {
|
|
@@ -26171,14 +26066,14 @@ function CompanyOtherDetails({
|
|
|
26171
26066
|
shouldValidate,
|
|
26172
26067
|
formVerificationErrors,
|
|
26173
26068
|
fieldValidationErrors,
|
|
26069
|
+
allFields,
|
|
26174
26070
|
requiredFields,
|
|
26175
26071
|
obscuredFields,
|
|
26176
26072
|
optionalFields,
|
|
26177
26073
|
readOnlyFields,
|
|
26178
26074
|
country: country2,
|
|
26179
26075
|
legalCompanyName: legalCompanyName2,
|
|
26180
|
-
companyType: companyType2
|
|
26181
|
-
kompanyVerifiedData
|
|
26076
|
+
companyType: companyType2
|
|
26182
26077
|
}) {
|
|
26183
26078
|
var _a, _b, _c, _d;
|
|
26184
26079
|
const {
|
|
@@ -26197,6 +26092,7 @@ function CompanyOtherDetails({
|
|
|
26197
26092
|
const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
|
|
26198
26093
|
const directChildFields = companyOtherDetailsFields.filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
|
|
26199
26094
|
const initialFormUtilsProps = useMemo$1(() => ({
|
|
26095
|
+
allFields,
|
|
26200
26096
|
labels: labels2,
|
|
26201
26097
|
placeholders,
|
|
26202
26098
|
helperText,
|
|
@@ -26206,10 +26102,10 @@ function CompanyOtherDetails({
|
|
|
26206
26102
|
optionalFields,
|
|
26207
26103
|
obscuredFields,
|
|
26208
26104
|
shouldValidate
|
|
26209
|
-
}), [helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
26105
|
+
}), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
|
|
26210
26106
|
const mergedFieldProps = useMemo$1(() => {
|
|
26211
26107
|
var _a2;
|
|
26212
|
-
return (_a2 = initialFormUtilsProps.
|
|
26108
|
+
return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
|
|
26213
26109
|
switch (field) {
|
|
26214
26110
|
case "tradingName":
|
|
26215
26111
|
return {
|
|
@@ -26266,8 +26162,6 @@ function CompanyOtherDetails({
|
|
|
26266
26162
|
shouldValidate
|
|
26267
26163
|
});
|
|
26268
26164
|
const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
|
|
26269
|
-
useEffect$1(() => {
|
|
26270
|
-
}, [kompanyVerifiedData]);
|
|
26271
26165
|
useEffect$1(() => {
|
|
26272
26166
|
updateStateSlice({
|
|
26273
26167
|
schema: formSchema,
|
|
@@ -29641,6 +29535,8 @@ function TaskListComponent({
|
|
|
29641
29535
|
}
|
|
29642
29536
|
}, [isCompany, isExperimentEnabled]);
|
|
29643
29537
|
const hasSoleProprietorship = accountHolder2 === "mySoleProprietorName" || hasSolePropInLegalEntity(legalEntityResponse);
|
|
29538
|
+
const hidePayoutAccountTaskExperiment = isExperimentEnabled(ExperimentNames.HidePayoutAccountTask);
|
|
29539
|
+
const hidePciTaskExperiment = isExperimentEnabled(ExperimentNames.HidePciTask);
|
|
29644
29540
|
const transferInstruments = (legalEntityResponse == null ? void 0 : legalEntityResponse.transferInstruments) || [];
|
|
29645
29541
|
const canAddPayoutAccount = ((_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.legalName) || ((_b = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _b.name);
|
|
29646
29542
|
const hasPayinTaskNotPayout = tasks.includes(TaskTypes.PAYIN) && !tasks.includes(TaskTypes.PAYOUT);
|
|
@@ -29649,7 +29545,7 @@ function TaskListComponent({
|
|
|
29649
29545
|
const isSigningRequired = (pciStatus == null ? void 0 : pciStatus.signingRequired) === "true" || (pciStatus == null ? void 0 : pciStatus.signingRequired) === true;
|
|
29650
29546
|
const canDownloadPci = !isSigningRequired && (pciStatus == null ? void 0 : pciStatus.hasDocuments);
|
|
29651
29547
|
const isPciTaskDisabled = !canSignPci || !isSigningRequired && !(pciStatus == null ? void 0 : pciStatus.hasDocuments) || canDownloadPci;
|
|
29652
|
-
const showPciTask = canDownloadPci || isSigningRequired;
|
|
29548
|
+
const showPciTask = (canDownloadPci || isSigningRequired) && !hidePciTaskExperiment;
|
|
29653
29549
|
const showServiceAgreementTask = tasks.includes(TaskTypes.SERVICE_AGREEMENT) && ((serviceAgreementTypes == null ? void 0 : serviceAgreementTypes.length) > 0 || (serviceAgreementAcceptanceInfos == null ? void 0 : serviceAgreementAcceptanceInfos.length) > 0);
|
|
29654
29550
|
const hasServiceAgreementSigners = legalEntityResponse.type === LegalEntityType.ORGANIZATION && getOwnSignatories(legalEntityResponse).length || legalEntityResponse.type === LegalEntityType.INDIVIDUAL && !!(legalEntityResponse == null ? void 0 : legalEntityResponse.individual);
|
|
29655
29551
|
const areServiceAgreementTasksDisabled = !hasServiceAgreementSigners;
|
|
@@ -29774,7 +29670,7 @@ function TaskListComponent({
|
|
|
29774
29670
|
title: i18n.get("trustMembers"),
|
|
29775
29671
|
status: hasRequiredTrustMemberCount2 ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnTrustMembersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
|
|
29776
29672
|
})]
|
|
29777
|
-
}), (tasks.includes(TaskTypes.PAYOUT) || tasks.includes(TaskTypes.PAYIN)) && jsx(TaskListGroup, {
|
|
29673
|
+
}), (tasks.includes(TaskTypes.PAYOUT) || tasks.includes(TaskTypes.PAYIN)) && !hidePayoutAccountTaskExperiment && jsx(TaskListGroup, {
|
|
29778
29674
|
title: isEnableNewEntryFlowEnabled ? i18n.get("letUsKnowTheBankAccountToSendReceiveFunds") : i18n.get(hasPayinTaskNotPayout ? "payinAccountsDescription" : payoutTaskDescriptionKey),
|
|
29779
29675
|
children: transferInstruments.length > 0 ? jsxs(Fragment, {
|
|
29780
29676
|
children: [transferInstruments.map((transferInstrument) => jsx(PayoutAccountTaskListItem, {
|
|
@@ -31017,9 +30913,14 @@ function PayoutDetailsDropinComponent({
|
|
|
31017
30913
|
...problems,
|
|
31018
30914
|
validationErrors
|
|
31019
30915
|
});
|
|
31020
|
-
} else if (
|
|
30916
|
+
} else if (isIdDocumentUploadError(e)) {
|
|
30917
|
+
showToast({
|
|
30918
|
+
label: i18n.get("idDocumentAlreadyUploaded"),
|
|
30919
|
+
type: ToastType.ERROR
|
|
30920
|
+
});
|
|
30921
|
+
} else if (isBankStatementUploadError(e)) {
|
|
31021
30922
|
showToast({
|
|
31022
|
-
label: i18n.get("
|
|
30923
|
+
label: i18n.get("bankStatementAlreadyUploaded"),
|
|
31023
30924
|
type: ToastType.ERROR
|
|
31024
30925
|
});
|
|
31025
30926
|
} else if (isMaintenanceModeError(e)) {
|
|
@@ -32602,7 +32503,7 @@ function SolePropDropinComponent({
|
|
|
32602
32503
|
const dataSubmitted = data;
|
|
32603
32504
|
setLoadingStatus("loading");
|
|
32604
32505
|
try {
|
|
32605
|
-
const legalEntity = await handleSubmitLegalEntity(mapSolePropToLegalEntity(dataSubmitted
|
|
32506
|
+
const legalEntity = await handleSubmitLegalEntity(mapSolePropToLegalEntity(dataSubmitted));
|
|
32606
32507
|
await submitDocuments2({
|
|
32607
32508
|
forms: forms2,
|
|
32608
32509
|
legalEntity,
|
|
@@ -35046,47 +34947,50 @@ function ManageTransferInstrumentOverviewItem({
|
|
|
35046
34947
|
size: "large",
|
|
35047
34948
|
showText: false
|
|
35048
34949
|
}) : null;
|
|
35049
|
-
const
|
|
35050
|
-
className: "adyen-kyc-manage-ti-overview-item__heading",
|
|
35051
|
-
children: [status, jsx(Heading, {
|
|
35052
|
-
level: 1,
|
|
35053
|
-
children: transferInstrumentReference.transferInstrument.accountIdentifier
|
|
35054
|
-
})]
|
|
35055
|
-
});
|
|
35056
|
-
const actions = jsx("div", {
|
|
34950
|
+
const actions = jsxs("div", {
|
|
35057
34951
|
className: "adyen-kyc-manage-ti-overview-item__action",
|
|
35058
|
-
children: needMoreDetails && jsx(Button, {
|
|
34952
|
+
children: [needMoreDetails && jsx(Button, {
|
|
35059
34953
|
label: i18n.get("completeAddingAccount"),
|
|
35060
34954
|
onClick: (e) => {
|
|
35061
34955
|
e.stopPropagation();
|
|
35062
34956
|
onEdit(transferInstrumentReference.transferInstrument.id);
|
|
35063
34957
|
},
|
|
35064
34958
|
secondary: true
|
|
35065
|
-
})
|
|
35066
|
-
});
|
|
35067
|
-
const subTitle = jsxs(Fragment, {
|
|
35068
|
-
children: [description2 && jsx("span", {
|
|
35069
|
-
children: i18n.get(description2)
|
|
35070
|
-
}), actions]
|
|
35071
|
-
});
|
|
35072
|
-
return jsxs(AccordionItem, {
|
|
35073
|
-
className: "adyen-kyc-manage-ti-overview-item",
|
|
35074
|
-
expandIconPlacement: Placement.Right,
|
|
35075
|
-
title,
|
|
35076
|
-
subTitle,
|
|
35077
|
-
onOpen: () => onOpen(transferInstrumentReference.transferInstrument.id),
|
|
35078
|
-
children: [!transferInstrument ? jsx(LoaderWrapper, {
|
|
35079
|
-
className: "adyen-kyc-manage-ti-overview-item__loader",
|
|
35080
|
-
status: "loading"
|
|
35081
|
-
}) : jsx(ManageTransferInstrumentOverviewItemSummary, {
|
|
35082
|
-
transferInstrument,
|
|
35083
|
-
accountHolderName,
|
|
35084
|
-
onEdit: () => onEdit(transferInstrument.id)
|
|
35085
34959
|
}), jsx(Remove, {
|
|
35086
34960
|
label: isRemoving ? "removing" : "removeThisBankAccount",
|
|
35087
34961
|
onRemove: async () => onRemove(transferInstrumentReference.transferInstrument.id),
|
|
35088
34962
|
onRemoveStatusChange: setIsRemoving
|
|
35089
34963
|
})]
|
|
34964
|
+
});
|
|
34965
|
+
const title = jsxs("div", {
|
|
34966
|
+
className: "adyen-kyc-manage-ti-overview-item__header",
|
|
34967
|
+
children: [jsxs("div", {
|
|
34968
|
+
className: "adyen-kyc-manage-ti-overview-item__title",
|
|
34969
|
+
children: [status, jsx(Heading, {
|
|
34970
|
+
level: 2,
|
|
34971
|
+
children: transferInstrumentReference.transferInstrument.accountIdentifier
|
|
34972
|
+
})]
|
|
34973
|
+
}), jsx("p", {
|
|
34974
|
+
className: "adyen-kyc-manage-ti-overview-item__subtitle",
|
|
34975
|
+
children: description2 && i18n.get(description2)
|
|
34976
|
+
})]
|
|
34977
|
+
});
|
|
34978
|
+
return jsx(Accordion, {
|
|
34979
|
+
className: "adyen-kyc-manage-ti-overview-item",
|
|
34980
|
+
title,
|
|
34981
|
+
onToggle: (state2) => {
|
|
34982
|
+
if (state2 === "open") onOpen(transferInstrumentReference.transferInstrument.id);
|
|
34983
|
+
},
|
|
34984
|
+
children: jsxs(Fragment, {
|
|
34985
|
+
children: [!transferInstrument ? jsx(LoaderWrapper, {
|
|
34986
|
+
className: "adyen-kyc-manage-ti-overview-item__loader",
|
|
34987
|
+
status: "loading"
|
|
34988
|
+
}) : jsx(ManageTransferInstrumentOverviewItemSummary, {
|
|
34989
|
+
transferInstrument,
|
|
34990
|
+
accountHolderName,
|
|
34991
|
+
onEdit: () => onEdit(transferInstrument.id)
|
|
34992
|
+
}), actions]
|
|
34993
|
+
})
|
|
35090
34994
|
}, transferInstrumentReference.transferInstrument.id);
|
|
35091
34995
|
}
|
|
35092
34996
|
const logger$8 = createLogger("ManageTransferInstrumentOverview");
|
|
@@ -35134,7 +35038,7 @@ function ManageTransferInstrumentOverview({
|
|
|
35134
35038
|
onOpen: onShowBankDetails
|
|
35135
35039
|
}, transferInstrumentRef.transferInstrument.id));
|
|
35136
35040
|
return jsxs(Fragment, {
|
|
35137
|
-
children: [jsx(
|
|
35041
|
+
children: [jsx("section", {
|
|
35138
35042
|
className: "adyen-kyc-manage-ti-overview",
|
|
35139
35043
|
children: transferInstrumentListEle
|
|
35140
35044
|
}), jsx("div", {
|
|
@@ -35936,7 +35840,7 @@ const ConfigurationApiProvider = ({
|
|
|
35936
35840
|
isEmbeddedDropin,
|
|
35937
35841
|
loadingContext
|
|
35938
35842
|
} = authContext;
|
|
35939
|
-
const sdkVersion = "3.
|
|
35843
|
+
const sdkVersion = "3.18.1";
|
|
35940
35844
|
useAnalytics({
|
|
35941
35845
|
onUserEvent,
|
|
35942
35846
|
legalEntityId: rootLegalEntityId,
|
|
@@ -36477,12 +36381,15 @@ class UIElement extends BaseElement {
|
|
|
36477
36381
|
refreshExpiry: this.props.refreshExpiry,
|
|
36478
36382
|
eventEmitter: this.eventEmitter,
|
|
36479
36383
|
children: jsx("div", {
|
|
36480
|
-
className: "adyen-kyc-
|
|
36384
|
+
className: "adyen-kyc-u-width-full",
|
|
36481
36385
|
children: jsx(AutoResizer, {
|
|
36482
|
-
children: jsx(
|
|
36483
|
-
|
|
36484
|
-
|
|
36485
|
-
|
|
36386
|
+
children: jsx("div", {
|
|
36387
|
+
className: "adyen-kyc-dropin-container adyen-kyc-u-position-relative",
|
|
36388
|
+
children: jsx(ToastContextProvider, {
|
|
36389
|
+
children: jsx(StateProvider, {
|
|
36390
|
+
children: jsx(Component, {
|
|
36391
|
+
...this.props.componentProps
|
|
36392
|
+
})
|
|
36486
36393
|
})
|
|
36487
36394
|
})
|
|
36488
36395
|
})
|