@adyen/kyc-components 2.43.1 → 2.44.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.
Files changed (56) hide show
  1. package/dist/es/adyen-kyc-components.es.js +204 -293
  2. package/dist/style.css +56 -194
  3. package/dist/types/components/BusinessTypeSelection/utils.d.ts +2 -2
  4. package/dist/types/components/CompanyBasics/component/CompanyBasicsComponent.d.ts +1 -1
  5. package/dist/types/components/CompanyOtherDetails/component/CompanyOtherDetailsComponent.d.ts +1 -1
  6. package/dist/types/components/EventEmitter.d.ts +3 -3
  7. package/dist/types/components/internal/Accordion/Accordion.d.ts +11 -3
  8. package/dist/types/components/internal/ContextGuidance/ContextGuidance.d.ts +1 -1
  9. package/dist/types/components/internal/DocumentGuidance/DocumentGuidance.d.ts +1 -1
  10. package/dist/types/components/internal/FormFields/Field/Field.d.ts +1 -1
  11. package/dist/types/components/internal/FormFields/Field/types.d.ts +1 -0
  12. package/dist/types/components/internal/FormFields/InputRadio/InputRadio.d.ts +1 -1
  13. package/dist/types/components/internal/FormFields/MaskedInputText/MaskedInputText.d.ts +2 -1
  14. package/dist/types/components/internal/IdFieldTypeSelector/countryIdNumberTypes.d.ts +1 -1
  15. package/dist/types/components/internal/IdFieldTypeSelector/inferCompanyRegistrationNumberType.d.ts +1 -1
  16. package/dist/types/core/Context/ExperimentContext/types.d.ts +3 -1
  17. package/dist/types/core/Context/SettingsContext/useSetting.d.ts +2 -2
  18. package/dist/types/core/SDKValidation/index.d.ts +2 -2
  19. package/dist/types/core/Services/session.d.ts +1 -1
  20. package/dist/types/core/core.d.ts +4 -4
  21. package/dist/types/core/hooks/useAsyncValidator.d.ts +1 -1
  22. package/dist/types/core/hooks/useBankConfigurationHandlers.d.ts +1 -1
  23. package/dist/types/core/hooks/useForm/reducer.d.ts +5 -3
  24. package/dist/types/core/hooks/useForm/types.d.ts +3 -0
  25. package/dist/types/core/hooks/useIdVerificationToken.d.ts +2 -2
  26. package/dist/types/core/hooks/useLocalStorage.d.ts +1 -5
  27. package/dist/types/core/hooks/useStaticValidator/useStaticValidator.d.ts +2 -2
  28. package/dist/types/core/models/errors/validation-error.d.ts +2 -1
  29. package/dist/types/core/models/field-configurations.d.ts +1 -1
  30. package/dist/types/utils/api/documentUtils.d.ts +1 -1
  31. package/dist/types/utils/api/processCapabilitites.d.ts +1 -1
  32. package/dist/types/utils/company-util.d.ts +1 -1
  33. package/dist/types/utils/entriesOf.d.ts +2 -2
  34. package/dist/types/utils/mapping/componentApiMapping.d.ts +1 -1
  35. package/dist/types/utils/mapping/mapping.d.ts +1 -1
  36. package/dist/types/utils/omitObscuredFieldsIfUnchanged.d.ts +1 -1
  37. package/dist/types/utils/regex/patternValidators.d.ts +1 -1
  38. package/dist/types/utils/trustMembers/handlers/addOrUpdateAssociatedTrustMember.d.ts +2 -2
  39. package/dist/types/utils/trustMembers/handlers/addOrUpdateUndefinedBeneficiary.d.ts +1 -1
  40. package/dist/types/utils/trustMembers/handlers/createExemptSettlor.d.ts +2 -2
  41. package/dist/types/utils/trustMembers/handlers/deleteAssociatedTrustMember.d.ts +1 -1
  42. package/dist/types/utils/trustMembers/handlers/deleteUndefinedBeneficiary.d.ts +1 -1
  43. package/dist/types/utils/trustMembers/handlers/updateExemptSettlorName.d.ts +2 -2
  44. package/dist/types/utils/validatorUtils.d.ts +3 -3
  45. package/dist/types/utils/verification/verificationUtils.d.ts +1 -1
  46. package/package.json +5 -4
  47. package/dist/types/components/internal/Accordion/AccordionContext.d.ts +0 -2
  48. package/dist/types/components/internal/Accordion/index.d.ts +0 -1
  49. package/dist/types/components/internal/Accordion/types.d.ts +0 -22
  50. package/dist/types/components/internal/AccordionItem/AccordionItem.d.ts +0 -3
  51. package/dist/types/components/internal/AccordionItem/index.d.ts +0 -1
  52. package/dist/types/components/internal/AccordionItem/types.d.ts +0 -14
  53. package/dist/types/components/internal/AccordionItem/useAccordionContext.d.ts +0 -1
  54. package/dist/types/components/internal/CollapsibleContainer/CollapsibleContainer.d.ts +0 -3
  55. package/dist/types/components/internal/CollapsibleContainer/index.d.ts +0 -1
  56. 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";
@@ -423,7 +424,8 @@ const invalidDateOfBirth = "Please enter a valid date of birth";
423
424
  const invalidDateOfIncorporation = "Please enter a valid date of incorporation";
424
425
  const successfullyUpdatedDetails = "Successfully updated details";
425
426
  const failedToUpdateDetails = "Failed to update details";
426
- const documentUploadfailed = "Document upload failed. Please ensure the document is not a duplicate and its size is 4MBs or less.";
427
+ const idDocumentAlreadyUploaded = "Identity document has already been uploaded or is too large; try another";
428
+ const bankStatementAlreadyUploaded = "Bank statement has already been uploaded, is too large, or the the account has already been added; try another";
427
429
  const successfullyVerifiedIdNumber = "Successfully verified %{idNumber}";
428
430
  const failedFetchingDecisionMaker = "Failed to get decision maker details";
429
431
  const fileUpload = "File upload";
@@ -1364,6 +1366,7 @@ const defaultTrans = {
1364
1366
  invalidFormat,
1365
1367
  formatIsCorrect,
1366
1368
  fieldIsRequired,
1369
+ optional,
1367
1370
  tooManyFiles,
1368
1371
  duplicatedFiles,
1369
1372
  unsupportedFiletype,
@@ -1712,7 +1715,8 @@ const defaultTrans = {
1712
1715
  invalidDateOfIncorporation,
1713
1716
  successfullyUpdatedDetails,
1714
1717
  failedToUpdateDetails,
1715
- documentUploadfailed,
1718
+ idDocumentAlreadyUploaded,
1719
+ bankStatementAlreadyUploaded,
1716
1720
  successfullyVerifiedIdNumber,
1717
1721
  failedFetchingDecisionMaker,
1718
1722
  fileUpload,
@@ -3617,12 +3621,32 @@ const useAllowedCountries = () => {
3617
3621
  }, [acceptedCountries]);
3618
3622
  return allowedCountries;
3619
3623
  };
3624
+ class ValidationResult {
3625
+ constructor(results) {
3626
+ this.validationResults = results;
3627
+ }
3628
+ /** Checks if all validation rules have passed */
3629
+ get isValid() {
3630
+ return this.validationResults.reduce((acc, result) => acc && result.isValid, true);
3631
+ }
3632
+ /** Checks if any validation rule returned an error */
3633
+ hasError() {
3634
+ return Boolean(this.getError());
3635
+ }
3636
+ /** Returns the first validation result that returned an error */
3637
+ getError() {
3638
+ return this.validationResults.find((result) => result.hasError);
3639
+ }
3640
+ /** Returns all validation results that returned an error */
3641
+ getAllErrors() {
3642
+ return this.validationResults.filter((result) => result.hasError);
3643
+ }
3644
+ }
3620
3645
  const processField = ({
3621
3646
  key,
3622
3647
  value = null,
3623
3648
  mode,
3624
3649
  defaultData,
3625
- obscuredFields,
3626
3650
  fieldContext,
3627
3651
  formatters,
3628
3652
  staticValidate,
@@ -3631,7 +3655,7 @@ const processField = ({
3631
3655
  var _a, _b;
3632
3656
  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];
3633
3657
  const formattedValue = formatterFn && typeof formatterFn === "function" ? formatterFn(value, fieldContext) : value;
3634
- const shouldValidateField = !((obscuredFields == null ? void 0 : obscuredFields.includes(key)) && (defaultData == null ? void 0 : defaultData[key]) === value && !!(defaultData == null ? void 0 : defaultData[key]));
3658
+ const shouldValidateField = !((defaultData == null ? void 0 : defaultData[key]) === value && !!(defaultData == null ? void 0 : defaultData[key]));
3635
3659
  if (shouldValidateField && value) {
3636
3660
  asyncValidate(key, fieldContext.state, mode);
3637
3661
  }
@@ -3639,11 +3663,10 @@ const processField = ({
3639
3663
  key,
3640
3664
  value: formattedValue,
3641
3665
  mode
3642
- }, fieldContext) : {
3666
+ }, fieldContext) : new ValidationResult([{
3643
3667
  isValid: true,
3644
- hasError: () => null,
3645
- getError: () => null
3646
- };
3668
+ hasError: false
3669
+ }]);
3647
3670
  return [formattedValue, validationResult];
3648
3671
  };
3649
3672
  function init({
@@ -3651,6 +3674,7 @@ function init({
3651
3674
  defaultData,
3652
3675
  fieldProblems,
3653
3676
  obscuredFields,
3677
+ optionalFields,
3654
3678
  formatters,
3655
3679
  staticValidate,
3656
3680
  asyncValidate
@@ -3662,10 +3686,11 @@ function init({
3662
3686
  mode: "blur",
3663
3687
  formatters,
3664
3688
  defaultData,
3665
- obscuredFields,
3666
3689
  fieldContext: {
3667
3690
  state: {
3668
- data: defaultData
3691
+ data: defaultData,
3692
+ obscuredFields,
3693
+ optionalFields
3669
3694
  }
3670
3695
  },
3671
3696
  staticValidate,
@@ -3686,7 +3711,8 @@ function init({
3686
3711
  fieldProblems: (fieldProblems == null ? void 0 : fieldProblems[fieldKey]) ?? false
3687
3712
  };
3688
3713
  };
3689
- const formData = schema.reduce((acc, field) => {
3714
+ const formFields = optionalFields ? [...schema, ...optionalFields] : schema;
3715
+ const formData = formFields.reduce((acc, field) => {
3690
3716
  const {
3691
3717
  valid,
3692
3718
  errors,
@@ -3718,13 +3744,16 @@ function init({
3718
3744
  valid: {},
3719
3745
  errors: {},
3720
3746
  fieldProblems: {},
3721
- obscuredFields
3747
+ obscuredFields,
3748
+ optionalFields
3722
3749
  });
3723
3750
  return formData;
3724
3751
  }
3725
3752
  function reducer({
3726
3753
  staticValidate,
3727
3754
  asyncValidate,
3755
+ obscuredFields,
3756
+ optionalFields,
3728
3757
  formatters
3729
3758
  }) {
3730
3759
  return (state2, {
@@ -3735,7 +3764,6 @@ function reducer({
3735
3764
  schema,
3736
3765
  selectedSchema,
3737
3766
  formValue,
3738
- obscuredFields,
3739
3767
  fieldProblems,
3740
3768
  defaultData
3741
3769
  }) => {
@@ -3792,27 +3820,35 @@ function reducer({
3792
3820
  if (!schema) return state2;
3793
3821
  const defaultState = init({
3794
3822
  schema,
3823
+ // requiredFields
3795
3824
  defaultData,
3796
3825
  fieldProblems,
3797
3826
  obscuredFields,
3827
+ optionalFields,
3798
3828
  staticValidate,
3799
3829
  asyncValidate
3800
3830
  });
3801
- const removedSchemaFields = (_b = state2.schema) == null ? void 0 : _b.filter((field) => !schema.includes(field));
3802
- const newSchemaFields = schema.filter((field) => {
3831
+ 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));
3832
+ const newFields = (optionalFields == null ? void 0 : optionalFields.length) ? [...schema.filter((field) => {
3833
+ var _a2;
3834
+ return !((_a2 = state2.schema) == null ? void 0 : _a2.includes(field));
3835
+ }), ...optionalFields.filter((field) => {
3836
+ var _a2;
3837
+ return !((_a2 = state2.optionalFields) == null ? void 0 : _a2.includes(field));
3838
+ })] : schema.filter((field) => {
3803
3839
  var _a2;
3804
3840
  return !((_a2 = state2.schema) == null ? void 0 : _a2.includes(field));
3805
3841
  });
3806
3842
  const local = {
3807
- data: omitKeys(state2.data, newSchemaFields),
3808
- errors: omitKeys(state2.errors, newSchemaFields),
3809
- valid: omitKeys(state2.valid, newSchemaFields),
3810
- fieldProblems: omitKeys(state2.fieldProblems, newSchemaFields)
3843
+ data: omitKeys(state2.data, newFields),
3844
+ errors: omitKeys(state2.errors, newFields),
3845
+ valid: omitKeys(state2.valid, newFields),
3846
+ fieldProblems: omitKeys(state2.fieldProblems, newFields)
3811
3847
  };
3812
- const updatedData = addKeys(omitKeys(state2.data, removedSchemaFields), newSchemaFields, null, defaultState.data, (_c = state2.local) == null ? void 0 : _c.data);
3813
- const updatedValid = addKeys(omitKeys(state2.valid, removedSchemaFields), newSchemaFields, false, defaultState.valid, (_d = state2.local) == null ? void 0 : _d.valid);
3814
- const updatedErrors = addKeys(omitKeys(state2.errors, removedSchemaFields), newSchemaFields, null, defaultState.errors, (_e = state2.local) == null ? void 0 : _e.errors);
3815
- const updatedFieldProblems = addKeys(omitKeys(state2.fieldProblems, removedSchemaFields), newSchemaFields, false, defaultState.fieldProblems, (_f = state2.local) == null ? void 0 : _f.fieldProblems);
3848
+ const updatedData = addKeys(omitKeys(state2.data, removedFields), newFields, null, defaultState.data, (_c = state2.local) == null ? void 0 : _c.data);
3849
+ const updatedValid = addKeys(omitKeys(state2.valid, removedFields), newFields, false, defaultState.valid, (_d = state2.local) == null ? void 0 : _d.valid);
3850
+ const updatedErrors = addKeys(omitKeys(state2.errors, removedFields), newFields, null, defaultState.errors, (_e = state2.local) == null ? void 0 : _e.errors);
3851
+ const updatedFieldProblems = addKeys(omitKeys(state2.fieldProblems, removedFields), newFields, false, defaultState.fieldProblems, (_f = state2.local) == null ? void 0 : _f.fieldProblems);
3816
3852
  return {
3817
3853
  ...state2,
3818
3854
  schema,
@@ -3820,6 +3856,8 @@ function reducer({
3820
3856
  valid: updatedValid,
3821
3857
  errors: updatedErrors,
3822
3858
  fieldProblems: updatedFieldProblems,
3859
+ obscuredFields,
3860
+ optionalFields,
3823
3861
  local
3824
3862
  };
3825
3863
  }
@@ -3830,7 +3868,6 @@ function reducer({
3830
3868
  value,
3831
3869
  mode,
3832
3870
  defaultData,
3833
- obscuredFields,
3834
3871
  formatters,
3835
3872
  fieldContext: {
3836
3873
  state: state2
@@ -3887,13 +3924,12 @@ function reducer({
3887
3924
  }
3888
3925
  case "validateForm": {
3889
3926
  const formValidation = validationSchema == null ? void 0 : validationSchema.reduce((acc, cur) => {
3890
- var _a2;
3891
- const [, validation] = processField({
3927
+ var _a2, _b2;
3928
+ const [formattedValue, validation] = processField({
3892
3929
  key: cur,
3893
3930
  value: state2.data[cur],
3894
3931
  mode: "blur",
3895
3932
  defaultData,
3896
- obscuredFields,
3897
3933
  formatters,
3898
3934
  fieldContext: {
3899
3935
  state: state2
@@ -3901,6 +3937,8 @@ function reducer({
3901
3937
  staticValidate,
3902
3938
  asyncValidate
3903
3939
  });
3940
+ const oldValue = state2.data[cur];
3941
+ const clearFieldProblems = oldValue !== formattedValue;
3904
3942
  return {
3905
3943
  valid: {
3906
3944
  ...acc.valid,
@@ -3909,16 +3947,22 @@ function reducer({
3909
3947
  errors: {
3910
3948
  ...acc.errors,
3911
3949
  [cur]: validation.getError() ?? null
3950
+ },
3951
+ fieldProblems: {
3952
+ ...acc.fieldProblems,
3953
+ [cur]: clearFieldProblems ? false : ((_b2 = state2.fieldProblems) == null ? void 0 : _b2[cur]) ?? false
3912
3954
  }
3913
3955
  };
3914
3956
  }, {
3915
3957
  valid: state2.valid,
3916
- errors: state2.errors
3958
+ errors: state2.errors,
3959
+ fieldProblems: state2.fieldProblems
3917
3960
  });
3918
3961
  return {
3919
3962
  ...state2,
3920
3963
  valid: formValidation == null ? void 0 : formValidation.valid,
3921
- errors: formValidation == null ? void 0 : formValidation.errors
3964
+ errors: formValidation == null ? void 0 : formValidation.errors,
3965
+ fieldProblems: formValidation == null ? void 0 : formValidation.fieldProblems
3922
3966
  };
3923
3967
  }
3924
3968
  default:
@@ -3926,27 +3970,6 @@ function reducer({
3926
3970
  }
3927
3971
  };
3928
3972
  }
3929
- class ValidationResult {
3930
- constructor(results) {
3931
- this.validationResults = results;
3932
- }
3933
- /** Checks if all validation rules have passed */
3934
- get isValid() {
3935
- return this.validationResults.reduce((acc, result) => acc && result.isValid, true);
3936
- }
3937
- /** Checks if any validation rule returned an error */
3938
- hasError() {
3939
- return Boolean(this.getError());
3940
- }
3941
- /** Returns the first validation result that returned an error */
3942
- getError() {
3943
- return this.validationResults.find((result) => result.hasError);
3944
- }
3945
- /** Returns all validation results that returned an error */
3946
- getAllErrors() {
3947
- return this.validationResults.filter((result) => result.hasError);
3948
- }
3949
- }
3950
3973
  const logger$s = createLogger("useAsyncValidator");
3951
3974
  const useAsyncValidator = (asyncRules) => {
3952
3975
  const [asyncValidationResults, setAsyncValidationResults] = useState({});
@@ -3990,10 +4013,13 @@ const useStaticValidator = (rules2) => {
3990
4013
  value,
3991
4014
  mode = "blur"
3992
4015
  }, context) => {
4016
+ var _a, _b;
3993
4017
  const fieldRules = getRulesForField(key);
4018
+ const isFieldOptional = !!((_a = context == null ? void 0 : context.state.optionalFields) == null ? void 0 : _a.includes(key));
4019
+ const isFieldObscured = !!((_b = context == null ? void 0 : context.state.obscuredFields) == null ? void 0 : _b.includes(key));
3994
4020
  const validationRulesResult = fieldRules.map((rule) => {
3995
- const isValid = rule.validate(value, context);
3996
- const shouldValidate = rule.modes.includes(mode);
4021
+ const shouldValidate = rule.modes.includes(mode) && !isFieldObscured;
4022
+ const isValid = isFieldOptional && isEmpty(value) ? true : rule.validate(value, context);
3997
4023
  return {
3998
4024
  isValid,
3999
4025
  errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value, context) : rule.errorMessage,
@@ -4006,9 +4032,10 @@ const useStaticValidator = (rules2) => {
4006
4032
  triggerStaticValidation
4007
4033
  };
4008
4034
  };
4009
- const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema) => {
4010
- if (!schema.length) return staticValidationErrors;
4011
- return schema.reduce((acc, field) => {
4035
+ const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema, optionalFields) => {
4036
+ const fields = optionalFields ? [...schema, ...optionalFields] : schema;
4037
+ if (!fields.length) return staticValidationErrors;
4038
+ return fields.reduce((acc, field) => {
4012
4039
  var _a;
4013
4040
  return {
4014
4041
  ...acc,
@@ -4035,27 +4062,25 @@ function useForm({
4035
4062
  asyncValidationResults
4036
4063
  } = useAsyncValidator(asyncRules);
4037
4064
  const getRequiredFields = useMemo(() => typeof schema === "function" ? schema : () => schema, [schema]);
4038
- const getSchema = useMemo(() => {
4039
- if (optionalFields) {
4040
- return defaultData ? [...getRequiredFields(defaultData), ...optionalFields] : [];
4041
- }
4042
- return defaultData ? getRequiredFields(defaultData) : [];
4043
- }, [optionalFields, defaultData, getRequiredFields]);
4065
+ const getSchema = useMemo(() => defaultData ? getRequiredFields(defaultData) : [], [defaultData, getRequiredFields]);
4044
4066
  const getReducer = useCallback(() => reducer({
4045
4067
  staticValidate: triggerStaticValidation,
4046
4068
  asyncValidate: triggerAsyncValidation,
4069
+ obscuredFields,
4070
+ optionalFields,
4047
4071
  formatters
4048
- }), [triggerStaticValidation, triggerAsyncValidation, formatters]);
4049
- const getInitialData = useCallback(() => ({
4072
+ }), [triggerStaticValidation, triggerAsyncValidation, obscuredFields, optionalFields, formatters]);
4073
+ const initialData = useMemo(() => ({
4050
4074
  schema: getSchema,
4051
4075
  defaultData,
4052
4076
  fieldProblems,
4053
4077
  obscuredFields,
4078
+ optionalFields,
4054
4079
  formatters,
4055
4080
  staticValidate: triggerStaticValidation,
4056
4081
  asyncValidate: triggerAsyncValidation
4057
- }), [getSchema, defaultData, fieldProblems, obscuredFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
4058
- const [state2, dispatch] = useReducer(getReducer(), getInitialData(), init);
4082
+ }), [getSchema, defaultData, fieldProblems, obscuredFields, optionalFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
4083
+ const [state2, dispatch] = useReducer(getReducer(), initialData, init);
4059
4084
  const isValid = useMemo(() => {
4060
4085
  var _a;
4061
4086
  return (_a = state2.schema) == null ? void 0 : _a.every((key) => state2.valid[key]);
@@ -4102,18 +4127,16 @@ function useForm({
4102
4127
  key,
4103
4128
  value,
4104
4129
  mode,
4105
- defaultData,
4106
- obscuredFields
4130
+ defaultData
4107
4131
  });
4108
- }, [defaultData, obscuredFields, getTargetValue]);
4132
+ }, [defaultData, getTargetValue]);
4109
4133
  const triggerValidation = useCallback((selectedSchema) => {
4110
4134
  dispatch({
4111
4135
  type: "validateForm",
4112
4136
  selectedSchema,
4113
- defaultData,
4114
- obscuredFields
4137
+ defaultData
4115
4138
  });
4116
- }, [defaultData, obscuredFields]);
4139
+ }, [defaultData]);
4117
4140
  useEffect(() => {
4118
4141
  const newSchema = getRequiredFields(state2.data);
4119
4142
  if (!doArraysMatch(state2.schema, newSchema)) {
@@ -4130,7 +4153,7 @@ function useForm({
4130
4153
  setFieldProblems(fieldProblems);
4131
4154
  }
4132
4155
  }, [JSON.stringify(fieldProblems), setFieldProblems]);
4133
- const formErrors = useMemo(() => mergeStaticAndAsyncErrorsState(state2.errors, asyncValidationResults, state2.schema), [asyncValidationResults, state2.errors]);
4156
+ const formErrors = useMemo(() => mergeStaticAndAsyncErrorsState(state2.errors, asyncValidationResults, state2.schema, state2.optionalFields), [asyncValidationResults, state2.errors, state2.optionalFields, state2.schema]);
4134
4157
  return {
4135
4158
  mergeForm,
4136
4159
  setData,
@@ -4259,6 +4282,7 @@ const Field = ({
4259
4282
  children,
4260
4283
  dataPlaceholder,
4261
4284
  disabled,
4285
+ optional: optional2,
4262
4286
  errorMessage,
4263
4287
  filled,
4264
4288
  focused,
@@ -4278,6 +4302,9 @@ const Field = ({
4278
4302
  wrapperRef
4279
4303
  }) => {
4280
4304
  const uniqueId = useId();
4305
+ const {
4306
+ i18n
4307
+ } = useI18nContext();
4281
4308
  const [isFilled] = useStateFromProp({
4282
4309
  passedValue: filled,
4283
4310
  skipUpdate: filled === void 0
@@ -4305,11 +4332,14 @@ const Field = ({
4305
4332
  name,
4306
4333
  onClick: onFocusField,
4307
4334
  useLabelElement,
4308
- children: [jsx("span", {
4335
+ children: [jsxs("span", {
4309
4336
  className: cx("adyen-kyc-label__text", {
4310
4337
  "adyen-kyc-label__text--error": !!errorMessage
4311
4338
  }),
4312
- children: label
4339
+ children: [label, optional2 && jsxs("span", {
4340
+ className: "adyen-kyc-optional-label",
4341
+ children: [" ", i18n.get("optional")]
4342
+ })]
4313
4343
  }), helper && helperPosition === "above" && jsx("span", {
4314
4344
  className: "adyen-kyc-helper-text adyen-kyc-helper-text__above",
4315
4345
  children: helper
@@ -5672,8 +5702,8 @@ const findPossibleShifts = (mask) => {
5672
5702
  const inputOnlyMask = mask.filter((t) => t.type === "input");
5673
5703
  const optionals = inputOnlyMask.filter((t) => t.optional);
5674
5704
  const possibleShifts = [];
5675
- for (const optional of optionals) {
5676
- const index = inputOnlyMask.indexOf(optional);
5705
+ for (const optional2 of optionals) {
5706
+ const index = inputOnlyMask.indexOf(optional2);
5677
5707
  for (let i = index + 1; i < inputOnlyMask.length; i += 1) {
5678
5708
  const laterToken = inputOnlyMask[i];
5679
5709
  if (laterToken.type === "input") {
@@ -5855,10 +5885,15 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
5855
5885
  }
5856
5886
  }
5857
5887
  };
5858
- const deriveInputState = (isValid, isFocused, hasBlurred, isDisabled, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
5888
+ const deriveInputState = (isValid, isFocused, isDisabled, isOptional, hasNullishValue, hasBlurred, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
5859
5889
  if (isDisabled) return {
5860
5890
  isError: false
5861
5891
  };
5892
+ if (isOptional && hasNullishValue) {
5893
+ return {
5894
+ isError: false
5895
+ };
5896
+ }
5862
5897
  if (isValid && (!potentiallyMoreOptionalCharacters || !isFocused)) return {
5863
5898
  isError: false,
5864
5899
  text: jsxs(Fragment, {
@@ -5897,6 +5932,7 @@ const MaskedInputText = ({
5897
5932
  transformOnType,
5898
5933
  readonly = false,
5899
5934
  disabled = false,
5935
+ optional: optional2 = false,
5900
5936
  formatGuidance,
5901
5937
  classNameModifiers,
5902
5938
  acceptObscuredValue = false
@@ -5937,7 +5973,7 @@ const MaskedInputText = ({
5937
5973
  }, [mask]);
5938
5974
  const maskResult = useMemo(() => getMaskResult(value), [getMaskResult, value]);
5939
5975
  const displayValue = maskResult.outcome === "mismatch" ? maskResult.partialDisplayValue : maskResult.displayValue;
5940
- const inputState = deriveInputState(validationIsValid && maskResult.outcome !== "mismatch", isFocused, hasBlurred, disabled, errorMessage, shouldValidate, maskResult.outcome === "correct" && !!maskResult.potentialForMoreOptionalInput, formatGuidance, i18n);
5976
+ const inputState = deriveInputState(validationIsValid && maskResult.outcome !== "mismatch", isFocused, disabled, optional2, !displayValue, hasBlurred, errorMessage, shouldValidate, maskResult.outcome === "correct" && !!maskResult.potentialForMoreOptionalInput, formatGuidance, i18n);
5941
5977
  useEffect(() => {
5942
5978
  if (mask && maskResult.outcome === "mismatch") {
5943
5979
  const strippedValue = displayValueToPure(value);
@@ -5991,6 +6027,7 @@ Falling back to partially valid value "${fallback}"`);
5991
6027
  helperPosition: "below",
5992
6028
  classNameModifiers: classNameModifiers == null ? void 0 : classNameModifiers.field,
5993
6029
  disabled,
6030
+ optional: optional2,
5994
6031
  children: ({
5995
6032
  onBlurHandler: fieldOnBlur,
5996
6033
  onFocusHandler: fieldOnFocus,
@@ -6295,25 +6332,25 @@ const nonInputs = (str, options) => Array.from(str).map((char) => ({
6295
6332
  displayEagerly: (options == null ? void 0 : options.displayEagerly) ?? true
6296
6333
  }));
6297
6334
  const spacer = nonInputs(" ")[0];
6298
- const alphaInputs = (length, optional = false) => makeArrayOfRepeatedObjects(length, {
6335
+ const alphaInputs = (length, optional2 = false) => makeArrayOfRepeatedObjects(length, {
6299
6336
  type: "input",
6300
6337
  allow: /[A-Za-z]/,
6301
- optional
6338
+ optional: optional2
6302
6339
  });
6303
- const numericInputs = (length, optional = false) => makeArrayOfRepeatedObjects(length, {
6340
+ const numericInputs = (length, optional2 = false) => makeArrayOfRepeatedObjects(length, {
6304
6341
  type: "input",
6305
6342
  allow: /\d/,
6306
- optional
6343
+ optional: optional2
6307
6344
  });
6308
- const alphanumericInputs = (length, optional = false) => makeArrayOfRepeatedObjects(length, {
6345
+ const alphanumericInputs = (length, optional2 = false) => makeArrayOfRepeatedObjects(length, {
6309
6346
  type: "input",
6310
6347
  allow: /[\dA-Za-z]/,
6311
- optional
6348
+ optional: optional2
6312
6349
  });
6313
- const customInputs = (length, regex, optional = false) => makeArrayOfRepeatedObjects(length, {
6350
+ const customInputs = (length, regex, optional2 = false) => makeArrayOfRepeatedObjects(length, {
6314
6351
  type: "input",
6315
6352
  allow: regex,
6316
- optional
6353
+ optional: optional2
6317
6354
  });
6318
6355
  const makeMask = (...tokens) => ({
6319
6356
  tokens,
@@ -7691,201 +7728,61 @@ class UserEvents {
7691
7728
  }
7692
7729
  }
7693
7730
  const userEvents = new UserEvents();
7694
- const AccordionContext = createContext(null);
7695
- function Accordion({
7696
- children,
7697
- className,
7698
- expand = false,
7699
- type,
7700
- onExpandSection
7701
- }) {
7702
- const [items, setItems] = useState([]);
7703
- const classNames = cx("adyen-kyc-accordion", className, {
7704
- "adyen-kyc-accordion--container": type === "container",
7705
- "adyen-kyc-accordion--guide": type === "guide"
7706
- });
7707
- const contextValue = useMemo(() => ({
7708
- expand,
7709
- items,
7710
- setItems,
7711
- onExpandSection
7712
- }), [expand, items, onExpandSection]);
7713
- return jsx(AccordionContext.Provider, {
7714
- value: contextValue,
7715
- children: jsx("div", {
7716
- className: classNames,
7717
- children
7718
- })
7719
- });
7720
- }
7721
- var Placement = /* @__PURE__ */ ((Placement2) => {
7722
- Placement2[Placement2["Left"] = 0] = "Left";
7723
- Placement2[Placement2["Right"] = 1] = "Right";
7724
- return Placement2;
7725
- })(Placement || {});
7726
- function CollapsibleContainer({
7727
- children,
7728
- collapsed = false,
7729
- animationDuration = 0
7730
- }) {
7731
- const collapsibleContainerEl = useRef(null);
7732
- const [height, setHeight] = useState(collapsed ? 0 : void 0);
7733
- useEffect(() => {
7734
- var _a;
7735
- setHeight(collapsed ? 0 : (_a = collapsibleContainerEl.current) == null ? void 0 : _a.scrollHeight);
7736
- setTimeout(() => {
7737
- setHeight(collapsed ? 0 : "auto");
7738
- }, animationDuration * 1e3);
7739
- }, [collapsed]);
7740
- return jsx("div", {
7741
- className: "adyen-collapsible-container",
7742
- "aria-hidden": collapsed,
7743
- ref: collapsibleContainerEl,
7744
- style: {
7745
- height,
7746
- transitionDuration: `${animationDuration}s`
7747
- },
7748
- children
7749
- });
7750
- }
7751
- const useAccordionContext = () => {
7752
- const accordionContext = useContext(AccordionContext);
7753
- if (!accordionContext) {
7754
- throw new Error("Cannot use useAccordionContext without AccordionContext");
7755
- }
7756
- return accordionContext;
7757
- };
7758
- function AccordionItem({
7731
+ 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";
7732
+ const Accordion = ({
7733
+ title,
7759
7734
  children,
7760
- open = false,
7761
- title = "",
7762
- subTitle = "",
7763
- expandIconPlacement = Placement.Left,
7764
- iconPlacement = Placement.Left,
7765
7735
  icon,
7766
- onOpen = noop,
7767
- onClose = noop
7768
- }) {
7769
- const {
7770
- expand,
7771
- items,
7772
- setItems,
7773
- onExpandSection
7774
- } = useAccordionContext();
7775
- const [isOpen, setIsOpen] = useState(open);
7776
- const [id2] = useState(getUniqueId);
7777
- const toggle = () => {
7778
- const newValue = !isOpen;
7779
- const newItems = [...items];
7780
- if (!expand) {
7781
- setItems(newItems.map((item) => ({
7782
- ...item,
7783
- isOpen: item.id === id2 ? newValue : false
7784
- })));
7785
- } else {
7786
- newItems.find((item) => item.id === id2).isOpen = newValue;
7787
- setItems(newItems);
7788
- }
7736
+ expandOnLeft = false,
7737
+ onToggle,
7738
+ className
7739
+ }) => {
7740
+ const handleToggle = (e) => {
7741
+ onToggle(e.newState === "closed" ? "close" : "open");
7789
7742
  };
7790
- useEffect(() => {
7791
- setItems((items2) => [...items2, {
7792
- id: id2,
7793
- isOpen
7794
- }]);
7795
- }, []);
7796
- useEffect(() => {
7797
- setIsOpen(open);
7798
- }, [open]);
7799
- useEffect(() => {
7800
- var _a;
7801
- setIsOpen((_a = items.find((item) => item.id === id2)) == null ? void 0 : _a.isOpen);
7802
- }, [items]);
7803
- useEffect(() => {
7804
- if (isOpen) {
7805
- onExpandSection == null ? void 0 : onExpandSection(title);
7806
- onOpen();
7807
- } else {
7808
- onClose();
7809
- }
7810
- }, [isOpen]);
7811
- return jsxs("div", {
7812
- className: "adyen-kyc-accordion__item",
7813
- children: [jsxs("div", {
7814
- role: "button",
7815
- className: "adyen-kyc-accordion__header",
7816
- tabIndex: 0,
7817
- onClick: toggle,
7818
- children: [expandIconPlacement === Placement.Left ? jsx(Icon, {
7819
- name: isOpen ? "chevron-up" : "chevron-down",
7820
- className: "adyen-kyc-accordion__toggle"
7821
- }) : null, icon && iconPlacement === Placement.Left ? jsx(Icon, {
7822
- name: icon,
7823
- className: "adyen-kyc-accordion__toggle"
7824
- }) : null, jsxs("div", {
7825
- className: "adyen-kyc-accordion__title-wrapper",
7826
- children: [jsx("div", {
7827
- className: "adyen-kyc-accordion__title",
7828
- children: title
7829
- }), subTitle && jsx("div", {
7830
- className: "adyen-kyc-accordion__subtitle",
7831
- children: subTitle
7832
- })]
7833
- }), expandIconPlacement === Placement.Right ? jsx(Icon, {
7834
- name: isOpen ? "chevron-up" : "chevron-down",
7835
- className: "adyen-kyc-accordion__toggle"
7836
- }) : null, icon && iconPlacement === Placement.Right ? jsx(Icon, {
7837
- name: icon,
7838
- className: "adyen-kyc-accordion__toggle"
7839
- }) : null]
7840
- }), jsx(CollapsibleContainer, {
7841
- collapsed: !isOpen,
7842
- animationDuration: 0.1,
7843
- children: jsx("div", {
7844
- className: "adyen-kyc-accordion__content",
7845
- children
7846
- })
7743
+ return jsxs("details", {
7744
+ onToggle: handleToggle,
7745
+ className,
7746
+ children: [jsxs("summary", {
7747
+ children: [expandOnLeft && jsx("img", {
7748
+ className: "arrow",
7749
+ src: ChevronDownIcon,
7750
+ alt: ""
7751
+ }), icon, title, !expandOnLeft && jsx("img", {
7752
+ className: "arrow arrow-right",
7753
+ src: ChevronDownIcon,
7754
+ alt: ""
7755
+ })]
7756
+ }), jsx("section", {
7757
+ className: "content",
7758
+ children
7847
7759
  })]
7848
7760
  });
7849
- }
7761
+ };
7850
7762
  function ContextGuidance({
7851
7763
  page,
7852
7764
  title,
7853
7765
  content,
7854
7766
  titleId,
7855
- contentId,
7856
- onOpen = noop,
7857
- onClose = noop
7767
+ contentId
7858
7768
  }) {
7859
- const onGuidanceOpen = () => {
7860
- userEvents.addEvent("Open contextual guidance information", {
7861
- segmentation: {
7862
- guidancePage: page,
7863
- guidanceTitleId: titleId,
7864
- guidanceContentId: contentId
7865
- }
7866
- });
7867
- onOpen();
7868
- };
7869
- const onGuidanceClose = () => {
7870
- userEvents.addEvent("Close contextual guidance information", {
7769
+ const onGuidanceToggle = (status) => {
7770
+ const eventAction = status === "open" ? "Open" : "Close";
7771
+ userEvents.addEvent(`${eventAction} contextual guidance information`, {
7871
7772
  segmentation: {
7872
7773
  guidancePage: page,
7873
7774
  guidanceTitleId: titleId,
7874
7775
  guidanceContentId: contentId
7875
7776
  }
7876
7777
  });
7877
- onClose();
7878
7778
  };
7879
7779
  return jsx(Accordion, {
7880
- type: "guide",
7881
- children: jsx(AccordionItem, {
7882
- icon: "light-bulb",
7883
- expandIconPlacement: Placement.Right,
7884
- title,
7885
- onOpen: onGuidanceOpen,
7886
- onClose: onGuidanceClose,
7887
- children: content
7888
- })
7780
+ title,
7781
+ icon: jsx(Icon, {
7782
+ name: "light-bulb"
7783
+ }),
7784
+ onToggle: onGuidanceToggle,
7785
+ children: content
7889
7786
  });
7890
7787
  }
7891
7788
  const checkDateInputSupport = () => {
@@ -8994,6 +8891,8 @@ var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
8994
8891
  ExperimentNames2["ShowSingPassButtonForCompanies"] = "ShowSingPassButtonForCompanies";
8995
8892
  ExperimentNames2["ShowExtraTaxExemptionReasons"] = "ShowExtraTaxExemptionReasons";
8996
8893
  ExperimentNames2["EnableCountryOfGoverningLawForUKCompanies"] = "EnableCountryOfGoverningLawForUKCompanies";
8894
+ ExperimentNames2["HidePayoutAccountTask"] = "HidePayoutAccountTask";
8895
+ ExperimentNames2["HidePciTask"] = "HidePciTask";
8997
8896
  return ExperimentNames2;
8998
8897
  })(ExperimentNames || {});
8999
8898
  var VatAbsenceReason = /* @__PURE__ */ ((VatAbsenceReason2) => {
@@ -10792,7 +10691,7 @@ function DocumentGuidance({
10792
10691
  className: cx("adyen-kyc-document-guidance", className),
10793
10692
  children: jsx("div", {
10794
10693
  className: "adyen-kyc-document-guidance__container",
10795
- children: documentGuidanceItems.map((item) => jsxs("div", {
10694
+ children: documentGuidanceItems.map((item) => jsxs("figure", {
10796
10695
  className: "adyen-kyc-document-guidance__item",
10797
10696
  children: [jsx("svg", {
10798
10697
  width: "100%",
@@ -10801,7 +10700,7 @@ function DocumentGuidance({
10801
10700
  children: jsx("use", {
10802
10701
  href: `#adyen-kyc-${guidancePrefix}-${item.type}`
10803
10702
  })
10804
- }), jsx("span", {
10703
+ }), jsx("figcaption", {
10805
10704
  className: "adyen-kyc-document-guidance__description",
10806
10705
  children: i18n.get(item.translationKey)
10807
10706
  })]
@@ -12254,10 +12153,7 @@ function Address(props) {
12254
12153
  }) => {
12255
12154
  const isHouseNumberFirst = COUNTRIES_WITH_HOUSE_NUMBER_FIRST.includes(data.country);
12256
12155
  const needsComma = COUNTRIES_WITH_COMMA_SEPARATED.includes(data.country);
12257
- let formattedAddress = isHouseNumberFirst ? `${houseNumberOrName} ${street2}` : `${street2} ${houseNumberOrName}`;
12258
- if (needsComma) {
12259
- formattedAddress = formattedAddress.replace(" ", ", ");
12260
- }
12156
+ const formattedAddress = isHouseNumberFirst ? `${houseNumberOrName}${needsComma ? ", " : " "}${street2}` : `${street2}${needsComma ? ", " : " "}${houseNumberOrName}`;
12261
12157
  handleChangeFor("address", "input")(formattedAddress);
12262
12158
  };
12263
12159
  const setFieldsData = (address2, field) => {
@@ -24033,9 +23929,12 @@ var BusinessDetailsEvents = /* @__PURE__ */ ((BusinessDetailsEvents2) => {
24033
23929
  })(BusinessDetailsEvents || {});
24034
23930
  const isMaintenanceModeError = (error) => error && "messageCode" in error && error.messageCode === "maintenanceMode";
24035
23931
  const API_VALIDATION_ERROR_CODE = "30_102";
24036
- const DOCUMENT_UPLOAD_ERROR_CODE = ["30_105", "30_106"];
24037
- const isValidationError = (error) => error && "errorCode" in error && error.errorCode === API_VALIDATION_ERROR_CODE;
24038
- const isDocumentUploadError = (error) => error && "errorCode" in error && typeof error.errorCode === "string" && DOCUMENT_UPLOAD_ERROR_CODE.includes(error.errorCode);
23932
+ const ID_DOCUMENT_UPLOAD_ERROR_CODE = "30_105";
23933
+ const BANK_STATEMENT_UPLOAD_ERROR_CODE = "30_106";
23934
+ const validateErrorCode = (error, errorCode) => error && "errorCode" in error && error.errorCode === errorCode;
23935
+ const isValidationError = (error) => validateErrorCode(error, API_VALIDATION_ERROR_CODE);
23936
+ const isIdDocumentUploadError = (error) => validateErrorCode(error, ID_DOCUMENT_UPLOAD_ERROR_CODE);
23937
+ const isBankStatementUploadError = (error) => validateErrorCode(error, BANK_STATEMENT_UPLOAD_ERROR_CODE);
24039
23938
  const processValidationErrors = (validationError, dropinTask) => {
24040
23939
  if ((validationError == null ? void 0 : validationError.invalidFields) && (validationError == null ? void 0 : validationError.invalidFields.length) > 0) {
24041
23940
  return validationError == null ? void 0 : validationError.invalidFields.reduce((acc, invalidField) => {
@@ -25690,6 +25589,7 @@ function CompanyBasics({
25690
25589
  shouldValidate,
25691
25590
  formVerificationErrors,
25692
25591
  fieldValidationErrors,
25592
+ allFields,
25693
25593
  requiredFields,
25694
25594
  obscuredFields,
25695
25595
  optionalFields,
@@ -25723,6 +25623,7 @@ function CompanyBasics({
25723
25623
  const defaultTaxIdNumberType = existingTaxId ? inferTaxIdNumberType(existingTaxId, country2) : (_c = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _c[0].id;
25724
25624
  const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
25725
25625
  const initialFormUtilsProps = useMemo$1(() => ({
25626
+ allFields,
25726
25627
  labels: labels2,
25727
25628
  placeholders,
25728
25629
  helperText,
@@ -25732,10 +25633,10 @@ function CompanyBasics({
25732
25633
  optionalFields,
25733
25634
  obscuredFields,
25734
25635
  shouldValidate
25735
- }), [helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
25636
+ }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
25736
25637
  const mergedFieldProps = useMemo$1(() => {
25737
25638
  var _a2;
25738
- return (_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.reduce((acc, field) => {
25639
+ return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
25739
25640
  switch (field) {
25740
25641
  case "legalCompanyName":
25741
25642
  return {
@@ -25922,14 +25823,14 @@ function CompanyOtherDetails({
25922
25823
  shouldValidate,
25923
25824
  formVerificationErrors,
25924
25825
  fieldValidationErrors,
25826
+ allFields,
25925
25827
  requiredFields,
25926
25828
  obscuredFields,
25927
25829
  optionalFields,
25928
25830
  readOnlyFields,
25929
25831
  country: country2,
25930
25832
  legalCompanyName: legalCompanyName2,
25931
- companyType: companyType2,
25932
- kompanyVerifiedData
25833
+ companyType: companyType2
25933
25834
  }) {
25934
25835
  var _a, _b, _c, _d;
25935
25836
  const {
@@ -25948,6 +25849,7 @@ function CompanyOtherDetails({
25948
25849
  const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
25949
25850
  const directChildFields = companyOtherDetailsFields.filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
25950
25851
  const initialFormUtilsProps = useMemo$1(() => ({
25852
+ allFields,
25951
25853
  labels: labels2,
25952
25854
  placeholders,
25953
25855
  helperText,
@@ -25957,10 +25859,10 @@ function CompanyOtherDetails({
25957
25859
  optionalFields,
25958
25860
  obscuredFields,
25959
25861
  shouldValidate
25960
- }), [helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
25862
+ }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
25961
25863
  const mergedFieldProps = useMemo$1(() => {
25962
25864
  var _a2;
25963
- return (_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.reduce((acc, field) => {
25865
+ return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
25964
25866
  switch (field) {
25965
25867
  case "tradingName":
25966
25868
  return {
@@ -26017,8 +25919,6 @@ function CompanyOtherDetails({
26017
25919
  shouldValidate
26018
25920
  });
26019
25921
  const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
26020
- useEffect$1(() => {
26021
- }, [kompanyVerifiedData]);
26022
25922
  useEffect$1(() => {
26023
25923
  updateStateSlice({
26024
25924
  schema: formSchema,
@@ -28036,7 +27936,8 @@ function Card({
28036
27936
  level: "sub",
28037
27937
  children: subTitle
28038
27938
  })]
28039
- }), jsx("main", {
27939
+ }), jsx("div", {
27940
+ role: "region",
28040
27941
  className: "adyen-kyc-card__body",
28041
27942
  children
28042
27943
  }), warning && jsx(Alert, {
@@ -29305,7 +29206,7 @@ const TaskListGroup = ({
29305
29206
  level: 4,
29306
29207
  children: title
29307
29208
  })
29308
- }), jsx("main", {
29209
+ }), jsx("div", {
29309
29210
  className: "adyen-kyc-card__body",
29310
29211
  children: jsx(CardGroup, {
29311
29212
  className: "adyen-task-list-group__items",
@@ -29371,6 +29272,8 @@ function TaskListComponent({
29371
29272
  }
29372
29273
  }, [isCompany, isExperimentEnabled]);
29373
29274
  const hasSoleProprietorship = accountHolder2 === "mySoleProprietorName" || hasSolePropInLegalEntity(legalEntityResponse);
29275
+ const hidePayoutAccountTaskExperiment = isExperimentEnabled(ExperimentNames.HidePayoutAccountTask);
29276
+ const hidePciTaskExperiment = isExperimentEnabled(ExperimentNames.HidePciTask);
29374
29277
  const transferInstruments = (legalEntityResponse == null ? void 0 : legalEntityResponse.transferInstruments) || [];
29375
29278
  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);
29376
29279
  const hasPayinTaskNotPayout = tasks.includes(TaskTypes.PAYIN) && !tasks.includes(TaskTypes.PAYOUT);
@@ -29379,7 +29282,7 @@ function TaskListComponent({
29379
29282
  const isSigningRequired = (pciStatus == null ? void 0 : pciStatus.signingRequired) === "true" || (pciStatus == null ? void 0 : pciStatus.signingRequired) === true;
29380
29283
  const canDownloadPci = !isSigningRequired && (pciStatus == null ? void 0 : pciStatus.hasDocuments);
29381
29284
  const isPciTaskDisabled = !canSignPci || !isSigningRequired && !(pciStatus == null ? void 0 : pciStatus.hasDocuments) || canDownloadPci;
29382
- const showPciTask = canDownloadPci || isSigningRequired;
29285
+ const showPciTask = (canDownloadPci || isSigningRequired) && !hidePciTaskExperiment;
29383
29286
  const showServiceAgreementTask = tasks.includes(TaskTypes.SERVICE_AGREEMENT) && ((serviceAgreementTypes == null ? void 0 : serviceAgreementTypes.length) > 0 || (serviceAgreementAcceptanceInfos == null ? void 0 : serviceAgreementAcceptanceInfos.length) > 0);
29384
29287
  const hasServiceAgreementSigners = legalEntityResponse.type === LegalEntityType.ORGANIZATION && getOwnSignatories(legalEntityResponse).length || legalEntityResponse.type === LegalEntityType.INDIVIDUAL && !!(legalEntityResponse == null ? void 0 : legalEntityResponse.individual);
29385
29288
  const areServiceAgreementTasksDisabled = !hasServiceAgreementSigners;
@@ -29504,7 +29407,7 @@ function TaskListComponent({
29504
29407
  title: i18n.get("trustMembers"),
29505
29408
  status: hasRequiredTrustMemberCount2 ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnTrustMembersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
29506
29409
  })]
29507
- }), (tasks.includes(TaskTypes.PAYOUT) || tasks.includes(TaskTypes.PAYIN)) && jsx(TaskListGroup, {
29410
+ }), (tasks.includes(TaskTypes.PAYOUT) || tasks.includes(TaskTypes.PAYIN)) && !hidePayoutAccountTaskExperiment && jsx(TaskListGroup, {
29508
29411
  title: isEnableNewEntryFlowEnabled ? i18n.get("letUsKnowTheBankAccountToSendReceiveFunds") : i18n.get(hasPayinTaskNotPayout ? "payinAccountsDescription" : payoutTaskDescriptionKey),
29509
29412
  children: transferInstruments.length > 0 ? jsxs(Fragment, {
29510
29413
  children: [transferInstruments.map((transferInstrument) => jsx(PayoutAccountTaskListItem, {
@@ -30753,9 +30656,14 @@ function PayoutDetailsDropinComponent({
30753
30656
  ...problems,
30754
30657
  validationErrors
30755
30658
  });
30756
- } else if (isDocumentUploadError(e)) {
30659
+ } else if (isIdDocumentUploadError(e)) {
30660
+ showToast({
30661
+ label: i18n.get("idDocumentAlreadyUploaded"),
30662
+ type: ToastType.ERROR
30663
+ });
30664
+ } else if (isBankStatementUploadError(e)) {
30757
30665
  showToast({
30758
- label: i18n.get("documentUploadfailed"),
30666
+ label: i18n.get("bankStatementAlreadyUploaded"),
30759
30667
  type: ToastType.ERROR
30760
30668
  });
30761
30669
  } else if (isMaintenanceModeError(e)) {
@@ -34179,7 +34087,7 @@ const getIdverificationToken = async (context, request) => {
34179
34087
  loadingContext,
34180
34088
  errorLevel: "warn",
34181
34089
  errorMessage: `Failed to find address`,
34182
- path: `${legalEntityId}/providers/IdVerification/initiate`,
34090
+ path: `${legalEntityId}/providers/idVerification/initiate`,
34183
34091
  authentication: "jwt",
34184
34092
  headers: {
34185
34093
  "Content-Type": "application/json"
@@ -34233,7 +34141,7 @@ const idVerificationStartcheck = async (context, request) => {
34233
34141
  loadingContext,
34234
34142
  errorLevel: "warn",
34235
34143
  errorMessage: `Failed to find address`,
34236
- path: `${legalEntityId}/providers/IdVerification/process`,
34144
+ path: `${legalEntityId}/providers/idVerification/process`,
34237
34145
  authentication: "jwt",
34238
34146
  headers: {
34239
34147
  "Content-Type": "application/json"
@@ -35024,7 +34932,7 @@ const ConfigurationApiProvider = ({
35024
34932
  isEmbeddedDropin,
35025
34933
  loadingContext
35026
34934
  } = authContext;
35027
- const sdkVersion = "2.43.1";
34935
+ const sdkVersion = "2.44.0";
35028
34936
  useAnalytics({
35029
34937
  onUserEvent,
35030
34938
  legalEntityId: rootLegalEntityId,
@@ -35565,12 +35473,15 @@ class UIElement extends BaseElement {
35565
35473
  refreshExpiry: this.props.refreshExpiry,
35566
35474
  eventEmitter: this.eventEmitter,
35567
35475
  children: jsx("div", {
35568
- className: "adyen-kyc-dropin-container adyen-kyc-u-position-relative",
35476
+ className: "adyen-kyc-u-width-full",
35569
35477
  children: jsx(AutoResizer, {
35570
- children: jsx(ToastContextProvider, {
35571
- children: jsx(StateProvider, {
35572
- children: jsx(Component, {
35573
- ...this.props.componentProps
35478
+ children: jsx("div", {
35479
+ className: "adyen-kyc-dropin-container adyen-kyc-u-position-relative",
35480
+ children: jsx(ToastContextProvider, {
35481
+ children: jsx(StateProvider, {
35482
+ children: jsx(Component, {
35483
+ ...this.props.componentProps
35484
+ })
35574
35485
  })
35575
35486
  })
35576
35487
  })