@adyen/kyc-components 3.6.1 → 3.7.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.
@@ -2,7 +2,7 @@ import { useContext, useState, useCallback, useEffect, useMemo, useReducer, useR
2
2
  import { createContext, createElement, render } from "preact";
3
3
  import { sanitize } from "isomorphic-dompurify";
4
4
  import cx from "classnames";
5
- import { lazy, Suspense, useId, forwardRef, memo, useMemo as useMemo$1, useEffect as useEffect$1, useState as useState$1, useCallback as useCallback$1 } from "preact/compat";
5
+ import { lazy, Suspense, useId, forwardRef, memo, useMemo as useMemo$1, useEffect as useEffect$1, useState as useState$1 } from "preact/compat";
6
6
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
7
7
  import { debounce, noop as noop$1, isEmpty as isEmpty$1, range } from "lodash";
8
8
  import OpenBankingSDK from "@adyen/openbankingsdk";
@@ -183,6 +183,7 @@ const chamberOfCommerceRegistrationNumber = "Chamber of Commerce registration nu
183
183
  const taxId = "Tax ID";
184
184
  const exemptedFromTax = "Exempted from tax";
185
185
  const doNotHaveTaxIdNumber = "I do not have a Tax Identification Number";
186
+ const doNotHaveEIN = "I do not have an EIN";
186
187
  const doNotHaveFirmenbuchnummer = "I do not have a Firmenbuchnummer";
187
188
  const doNotHaveOrganisationsnummer = "I do not have an Organisationsnummer";
188
189
  const doNotHaveYTunnus = "I do not have a Y-TUNNUS";
@@ -202,6 +203,7 @@ const validationPleaseEnterAValidVatNumber = "Please enter a valid Tax id number
202
203
  const validationPleaseEnterAValidIdNumberWithFormat = "Please enter a valid %{idType} number. Expected format: %{format}";
203
204
  const validationPleaseEnterAValidVatNumberWithFormat = "Please enter a valid VAT number. Expected format: %{format}";
204
205
  const validationPleaseEnterAValidTaxIdNumberWithFormat = "Please enter a valid Tax id number. Expected format: %{format}";
206
+ const validationPleaseEnterAValidEINWithFormat = "Please enter a valid EIN. Expected format: %{format}";
205
207
  const validationPleaseEnterAValidTaxIdNumber = "Please enter a valid Tax id number.";
206
208
  const validationPleaseEnterAValidIRDNumber = "Please enter a valid IRD number. Expected format: 8 - 9 digits";
207
209
  const aValidAbnShouldBe11Digits = "A valid ABN should be 11 digits.";
@@ -619,7 +621,7 @@ const noGlare = "No glare";
619
621
  const selectDocumentType = "Select document type";
620
622
  const registrationDocumentSubTitle = "Upload your company’s business registration document. We need to see this document so we can verify your company.";
621
623
  const documentIssuedByGovernmentAuthority = "The document has to be issued by a government authority. It’s usually given when a business is created at the local commercial register";
622
- const uploadTaxationDocument = "Upload a a tax return or taxation registration document. We need to see this document so we can verify that your tax ID number belongs to your company.";
624
+ const uploadTaxationDocument = "Upload a tax return or taxation registration document. We need to see this document so we can verify that your tax ID number belongs to your company.";
623
625
  const containsNameOfCompany = "Contains the name of your company or organization";
624
626
  const documentShowsTaxIdOfCompany = "The document shows the tax ID number of the company";
625
627
  const issuedByTheTaxAuthority = "Issued by the tax authority or government of the country where the company is registered";
@@ -869,14 +871,14 @@ const marketIdentifierCodeMIC = "Market Identifier Code (MIC)";
869
871
  const isin = "ISIN";
870
872
  const companyLookupResultsHeader = "Let's find your company";
871
873
  const companyLookupResultsHeader__searching = "Searching for companies...";
872
- const companyLookupResultsHeader__verifying = "Verifying tax information...";
874
+ const companyLookupResultsHeader__verifying = "Verifying company selection...";
873
875
  const companyLookupResultsHeader__noResults = "We couldn't find your company";
874
876
  const companyLookupResultsHeader__results = "Select your company";
875
877
  const companyLookupResultsHeader__searchFailure = "Sorry, something went wrong";
876
878
  const companyLookupResultsHeaderDescription__noResults = "No problem, let's enter your company details in the next steps.";
877
- const companyLookupResultsHeaderDescription__results = "This helps you to get verified quicker. If you can't find your company, you can always continue by pressing Next.";
879
+ const companyLookupResultsHeaderDescription__results = "We'll find your official company details to help you get verified faster. If your company isn't in this list, you can always continue by pressing Next.";
878
880
  const companyLookupResultsHeaderDescription__searchFailure = "If that doesn't work, press Next to continue.";
879
- const companyLookupResultsListAlert__title__verified = "Your tax information has been verified";
881
+ const companyLookupResultsListAlert__title__verified = "Your company details will be pre-filled in the relevant sections.";
880
882
  const companyLookupResultsListAlert__title__warning = "This company's TIN doesn't match yours";
881
883
  const companyLookupResultsListAlert__title__error = "Sorry, something went wrong. Try again or continue by pressing Next";
882
884
  const companyLookupResultsListAlert__description__warning = "Check the TIN you've entered, or select a different company.";
@@ -887,9 +889,9 @@ const companyStructureFormName = "Company structure";
887
889
  const companyStructureFormDescription = "What type of company do you have?";
888
890
  const companyOtherDetailsFormName = "Other details";
889
891
  const companyRegistrationDocumentFormName = "Registration document";
890
- const companyRegistrationDocumentFormDescription = "Please upload you companies registration document so we can verify your information.";
892
+ const companyRegistrationDocumentFormDescription = "Please upload your companies registration document so we can verify your information.";
891
893
  const companyTaxDocumentFormName = "Tax document";
892
- const companyTaxDocumentFormDescription = "Please upload you companies tax documents so we can verify your information.";
894
+ const companyTaxDocumentFormDescription = "Please upload your companies tax documents so we can verify your information.";
893
895
  const errorMessage_1_10 = "Information couldn’t be verified";
894
896
  const errorMessage_1_11 = "Document didn’t meet requirements";
895
897
  const errorMessage_1_12 = "Legal entity declined";
@@ -1112,6 +1114,7 @@ const errorMessage_2_8064 = "UBO through ownership was missing.";
1112
1114
  const errorMessage_2_8067 = "Signatory was missing.";
1113
1115
  const errorMessage_2_8141 = "Registration document was missing.";
1114
1116
  const errorMessage_2_8162 = "proofOfOrganizationTaxInfo was missing.";
1117
+ const errorMessage_2_8183 = "'webAddress' was missing.";
1115
1118
  const errorMessage_2_8189 = "UBO through control was missing.";
1116
1119
  const errorMessage_2_8193 = "Director was missing.";
1117
1120
  const errorMessage_3_10 = "Review of data is required";
@@ -1157,6 +1160,7 @@ const remediationMessage_1_705 = "Upload an official bank statement";
1157
1160
  const remediationMessage_2_123 = "You haven't added an owner";
1158
1161
  const remediationMessage_2_124 = "You haven't added a signatory";
1159
1162
  const remediationMessage_2_151 = "You haven't added a controlling person";
1163
+ const remediationMessage_2_178 = "Add 'webAddress' to business line.";
1160
1164
  const remediationMessage_2_185 = "You haven't added your directors";
1161
1165
  const remediationMessage_3_100 = "Check the above information, then click here to confirm.";
1162
1166
  const sameNameAsLegalName = "Same as legal name of the company";
@@ -1424,6 +1428,7 @@ const defaultTrans = {
1424
1428
  taxId,
1425
1429
  exemptedFromTax,
1426
1430
  doNotHaveTaxIdNumber,
1431
+ doNotHaveEIN,
1427
1432
  doNotHaveFirmenbuchnummer,
1428
1433
  doNotHaveOrganisationsnummer,
1429
1434
  doNotHaveYTunnus,
@@ -1443,6 +1448,7 @@ const defaultTrans = {
1443
1448
  validationPleaseEnterAValidIdNumberWithFormat,
1444
1449
  validationPleaseEnterAValidVatNumberWithFormat,
1445
1450
  validationPleaseEnterAValidTaxIdNumberWithFormat,
1451
+ validationPleaseEnterAValidEINWithFormat,
1446
1452
  validationPleaseEnterAValidTaxIdNumber,
1447
1453
  validationPleaseEnterAValidIRDNumber,
1448
1454
  aValidAbnShouldBe11Digits,
@@ -2361,6 +2367,7 @@ const defaultTrans = {
2361
2367
  errorMessage_2_8067,
2362
2368
  errorMessage_2_8141,
2363
2369
  errorMessage_2_8162,
2370
+ errorMessage_2_8183,
2364
2371
  errorMessage_2_8189,
2365
2372
  errorMessage_2_8193,
2366
2373
  errorMessage_3_10,
@@ -2406,6 +2413,7 @@ const defaultTrans = {
2406
2413
  remediationMessage_2_123,
2407
2414
  remediationMessage_2_124,
2408
2415
  remediationMessage_2_151,
2416
+ remediationMessage_2_178,
2409
2417
  remediationMessage_2_185,
2410
2418
  remediationMessage_3_100,
2411
2419
  sameNameAsLegalName,
@@ -2729,6 +2737,7 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2729
2737
  SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
2730
2738
  SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
2731
2739
  SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
2740
+ SettingNames2["LimitToOneTransferInstrument"] = "limitToOneTransferInstrument";
2732
2741
  SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
2733
2742
  SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
2734
2743
  SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
@@ -6680,18 +6689,6 @@ const taxIdNumberOptions = {
6680
6689
  }, {
6681
6690
  id: "uen",
6682
6691
  name: "uen"
6683
- }],
6684
- [CountryCodes.UnitedStates]: [{
6685
- id: "ein",
6686
- name: "employerIdentificationNumber"
6687
- }, {
6688
- id: "ssn",
6689
- name: "socialSecurityNumber",
6690
- applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6691
- }, {
6692
- id: "ssnLastFour",
6693
- name: "last4DigitsOfSocialSecurityNumber",
6694
- applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6695
6692
  }]
6696
6693
  };
6697
6694
  const getTaxIdNumberOptions = (country2, companyType2) => {
@@ -8088,7 +8085,7 @@ function BusinessRegistrationNumber(props) {
8088
8085
  ...formUtils.getMask("registrationNumber")
8089
8086
  }), formUtils.isRequiredField("exemptedFromRegistrationNumber") && !showExemptedOption && jsx(Checkbox, {
8090
8087
  name: "exemptedFromRegistrationNumber",
8091
- label: formUtils.getLabel("exemptedFromRegistrationNumber"),
8088
+ label: formUtils.getLabel("iDontHaveARegistrationNumber"),
8092
8089
  value: "exemptedFromRegistrationNumber",
8093
8090
  readonly: formUtils.isReadOnly("exemptedFromRegistrationNumber"),
8094
8091
  classNameModifiers: ["exempted-from-registration"],
@@ -8581,41 +8578,17 @@ const defaultFieldConfig$7 = {
8581
8578
  }
8582
8579
  }
8583
8580
  },
8584
- [CountryCodes.UnitedStates]: ({
8585
- taxIdNumberType
8586
- }) => {
8587
- switch (taxIdNumberType) {
8588
- case "ssn":
8589
- return {
8590
- label: "socialSecurityNumber",
8591
- validators: validatePatternOnBlur(/^\d{9}$/),
8592
- mask: {
8593
- mask: makeMask(...numericInputs(9))
8594
- }
8595
- };
8596
- case "ssnLastFour":
8597
- return {
8598
- label: "last4DigitsOfSocialSecurityNumber",
8599
- validators: validatePatternOnBlur(/^\d{4}$/),
8600
- mask: {
8601
- mask: makeMask(...nonInputs("*** — ** — "), ...numericInputs(4))
8602
- }
8603
- };
8604
- case "ein":
8605
- default:
8606
- return {
8607
- label: "employerIdentificationNumber",
8608
- validators: validatePatternOnBlur(/^\d{9}$/),
8609
- mask: {
8610
- mask: makeMask(...numericInputs(2), ...nonInputs(" - "), ...numericInputs(7))
8611
- },
8612
- guidanceText: {
8613
- key: "validationPleaseEnterAValidTaxIdNumberWithFormat",
8614
- values: {
8615
- format: "XX-XXXXXXX"
8616
- }
8617
- }
8618
- };
8581
+ [CountryCodes.UnitedStates]: {
8582
+ label: "employerIdentificationNumber",
8583
+ validators: validatePatternOnBlur(/^\d{9}$/),
8584
+ mask: {
8585
+ mask: makeMask(...numericInputs(2), ...nonInputs(" - "), ...numericInputs(7))
8586
+ },
8587
+ guidanceText: {
8588
+ key: "validationPleaseEnterAValidEINWithFormat",
8589
+ values: {
8590
+ format: "XX-XXXXXXX"
8591
+ }
8619
8592
  }
8620
8593
  },
8621
8594
  /**
@@ -10290,10 +10263,7 @@ const countryConfig$3 = {
10290
10263
  label: "doingBusinessAs"
10291
10264
  },
10292
10265
  exemptedFromTax: {
10293
- label: "doNotHaveTaxIdNumber"
10294
- },
10295
- taxId: {
10296
- label: "employerIdentificationNumber"
10266
+ label: "doNotHaveEIN"
10297
10267
  }
10298
10268
  }
10299
10269
  };
@@ -13071,6 +13041,9 @@ const rules$2 = ({
13071
13041
  if (country2 === "DE" && (companyType2 === CompanyTypesValue.GOVERNMENTAL_ORGANIZATION || companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE)) {
13072
13042
  return "REQUIRED";
13073
13043
  }
13044
+ if (country2 === "DK" && companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE) {
13045
+ return "REQUIRED";
13046
+ }
13074
13047
  },
13075
13048
  countryRequiresRegistrationNumberForSoleProps: () => {
13076
13049
  if (!COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION.includes(country2)) {
@@ -22045,7 +22018,7 @@ var EntityType = /* @__PURE__ */ ((EntityType2) => {
22045
22018
  EntityType2["LEGAL_ENTITY"] = "LegalEntity";
22046
22019
  return EntityType2;
22047
22020
  })(EntityType || {});
22048
- const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8189"];
22021
+ const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8183", "2_8189"];
22049
22022
  const UNRELATED_INVALID_INPUT_ERROR_CODES = ["1_14", "2_901", "2_902"];
22050
22023
  const getComponentMappingFromLEFieldPath = (context, entityType2, isExperimentEnabled) => {
22051
22024
  if (!(context == null ? void 0 : context.key)) {
@@ -24848,11 +24821,15 @@ function TaxInformationField({
24848
24821
  readonly,
24849
24822
  handleChangeFor,
24850
24823
  country: country2,
24851
- canExempt
24824
+ canExempt,
24825
+ companyType: companyType2,
24826
+ taxIdNumberType,
24827
+ setTaxIdNumberType
24852
24828
  }) {
24829
+ var _a;
24853
24830
  const currentCountryTaxInformation = useMemo(() => {
24854
- var _a;
24855
- return (_a = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === country2);
24831
+ var _a2;
24832
+ return (_a2 = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a2.find((taxInfo) => taxInfo.country === country2);
24856
24833
  }, [data, country2]);
24857
24834
  const handleTaxInformationInput = (value) => {
24858
24835
  if (!data.taxInformation) {
@@ -24907,8 +24884,33 @@ function TaxInformationField({
24907
24884
  });
24908
24885
  return handleChangeFor("taxInformation", "blur")(updatedTaxInformation);
24909
24886
  };
24910
- return jsxs(Fragment, {
24911
- children: [jsx(MaskedInputText, {
24887
+ const showTaxIdExemptedOption = canExempt && (((_a = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _a.length) ?? 0) > 1;
24888
+ const handleTaxIdNumberTypeChange = (taxIdType) => {
24889
+ if (taxIdType === "exempted") {
24890
+ if (!canExempt) {
24891
+ throw Error(`${country2} does not allow tax exemptions`);
24892
+ }
24893
+ handleChangeFor("exemptedFromTax")(true);
24894
+ setTaxIdNumberType(void 0);
24895
+ return;
24896
+ }
24897
+ if (canExempt && data.exemptedFromTax === true) {
24898
+ handleChangeFor("exemptedFromTax")(false);
24899
+ }
24900
+ setTaxIdNumberType(taxIdType);
24901
+ };
24902
+ return jsxs("div", {
24903
+ className: "adyen-kyc-field__tax-information",
24904
+ children: [jsx(TaxIdNumberTypeSelector, {
24905
+ country: country2,
24906
+ companyType: companyType2,
24907
+ setSelected: handleTaxIdNumberTypeChange,
24908
+ selected: data.exemptedFromTax ? "exempted" : taxIdNumberType,
24909
+ exemptedOption: showTaxIdExemptedOption ? labels2.exemptedFromTax : false
24910
+ }), jsx(MaskedInputText, {
24911
+ "aria-required": true,
24912
+ "aria-label": labels2.taxInformation,
24913
+ "aria-invalid": !valid.taxInformation,
24912
24914
  name: "taxInformationNumber",
24913
24915
  label: labels2.taxInformation ?? "",
24914
24916
  formatGuidance: (guidanceText == null ? void 0 : guidanceText.taxInformation) ?? "",
@@ -24916,15 +24918,12 @@ function TaxInformationField({
24916
24918
  errorMessage: errors.taxInformation,
24917
24919
  placeholder: placeholders == null ? void 0 : placeholders.taxInformation,
24918
24920
  isValid: Boolean(valid.taxInformation),
24919
- "aria-required": true,
24920
- "aria-label": labels2.taxInformation,
24921
- "aria-invalid": !valid.taxInformation,
24922
24921
  onInput: handleTaxInformationInput,
24923
24922
  onBlur: handleTaxInformationBlur,
24924
24923
  disabled: data.exemptedFromTax,
24925
24924
  readonly,
24926
24925
  ...mask
24927
- }), canExempt && jsx(Checkbox, {
24926
+ }), canExempt && !showTaxIdExemptedOption && jsx(Checkbox, {
24928
24927
  "aria-required": false,
24929
24928
  "aria-label": labels2.exemptedFromTax,
24930
24929
  "aria-invalid": false,
@@ -24991,13 +24990,14 @@ function CompanyBasics({
24991
24990
  handleRefreshCompanyDataset,
24992
24991
  handleVerifyTin,
24993
24992
  country: country2,
24993
+ companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24994
24994
  isTopLevelEntity,
24995
24995
  baseTrackingPayload,
24996
24996
  kompanyVerifiedData,
24997
24997
  setKompanyAddress,
24998
24998
  setKompanyVerifiedData
24999
24999
  }) {
25000
- var _a, _b;
25000
+ var _a, _b, _c, _d, _e;
25001
25001
  const {
25002
25002
  i18n
25003
25003
  } = useI18nContext();
@@ -25009,6 +25009,9 @@ function CompanyBasics({
25009
25009
  } = useGlobalDataSlice(COMPANY_BASICS_FORM_ID);
25010
25010
  const [loading2, setLoading] = useState$1(false);
25011
25011
  const allowedCountries = useAllowedCountries();
25012
+ const existingTaxId = (_b = (_a = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _b.number;
25013
+ const defaultTaxIdNumberType = existingTaxId ? inferTaxIdNumberType(existingTaxId, country2) : (_c = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _c[0].id;
25014
+ const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
25012
25015
  const initialFormUtilsProps = useMemo$1(() => ({
25013
25016
  labels: labels2,
25014
25017
  placeholders,
@@ -25050,13 +25053,13 @@ function CompanyBasics({
25050
25053
  };
25051
25054
  case "taxInformation":
25052
25055
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
25053
- taxIdNumberType: countryToTaxInfoTypeMap[country2]
25056
+ taxIdNumberType
25054
25057
  }, defaultFieldMetadata), acc);
25055
25058
  default:
25056
25059
  return acc;
25057
25060
  }
25058
25061
  }, initialFormUtilsProps);
25059
- }, [country2, initialFormUtilsProps]);
25062
+ }, [country2, initialFormUtilsProps, taxIdNumberType]);
25060
25063
  const schema = (requiredFields == null ? void 0 : requiredFields.length) ? requiredFields : ["legalCompanyName", "country"];
25061
25064
  const {
25062
25065
  schema: formSchema,
@@ -25078,7 +25081,7 @@ function CompanyBasics({
25078
25081
  const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
25079
25082
  const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
25080
25083
  const hasCompanySearchProvider = formData.country && COUNTRIES_WITH_IN_APP_SEARCH_COMPANY_VERIFICATION.includes(formData.country);
25081
- const currentCountryTaxIdNumber = (_b = (_a = formData.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === formData.country)) == null ? void 0 : _b.number;
25084
+ const currentCountryTaxIdNumber = (_e = (_d = formData.taxInformation) == null ? void 0 : _d.find((taxInfo) => taxInfo.country === formData.country)) == null ? void 0 : _e.number;
25082
25085
  const disabled = (field) => formUtils.isReadOnly(field) || Boolean(kompanyVerifiedData) || loading2;
25083
25086
  useEffect$1(() => {
25084
25087
  updateStateSlice({
@@ -25141,7 +25144,9 @@ function CompanyBasics({
25141
25144
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
25142
25145
  valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
25143
25146
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
25144
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
25147
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25148
+ exemptedFromTax: "iDontHaveATaxId"
25149
+ }),
25145
25150
  mask: formUtils.getMask("taxInformation"),
25146
25151
  helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25147
25152
  guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
@@ -25149,7 +25154,10 @@ function CompanyBasics({
25149
25154
  handleChangeFor,
25150
25155
  canExempt: formUtils.isRequiredField("exemptedFromTax"),
25151
25156
  isUen: formUtils.isRequiredField("isUen"),
25152
- country: formData.country
25157
+ country: formData.country,
25158
+ companyType: companyType2 ?? CompanyTypesValue.PRIVATE_COMPANY,
25159
+ taxIdNumberType,
25160
+ setTaxIdNumberType
25153
25161
  })
25154
25162
  }), hasCompanySearchProvider && jsx(CompanyLookupComponent, {
25155
25163
  defaultData: data,
@@ -25172,7 +25180,7 @@ function CompanyBasics({
25172
25180
  })]
25173
25181
  });
25174
25182
  }
25175
- const CompanyBasicsComponent = memo(CompanyBasics, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.placeholders, nextProps.placeholders) && objectsDeepEqual(prevProps.helperText, nextProps.helperText) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.heading === nextProps.heading && prevProps.description === nextProps.description && prevProps.readOnly === nextProps.readOnly && prevProps.requiredFields === nextProps.requiredFields && prevProps.obscuredFields === nextProps.obscuredFields && prevProps.optionalFields === nextProps.optionalFields && prevProps.readOnlyFields === nextProps.readOnlyFields && prevProps.shouldValidate === nextProps.shouldValidate && objectsDeepEqual(prevProps.kompanyVerifiedData, nextProps.kompanyVerifiedData));
25183
+ const CompanyBasicsComponent = memo(CompanyBasics, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.placeholders, nextProps.placeholders) && objectsDeepEqual(prevProps.helperText, nextProps.helperText) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.heading === nextProps.heading && prevProps.description === nextProps.description && prevProps.readOnly === nextProps.readOnly && prevProps.requiredFields === nextProps.requiredFields && prevProps.obscuredFields === nextProps.obscuredFields && prevProps.optionalFields === nextProps.optionalFields && prevProps.readOnlyFields === nextProps.readOnlyFields && prevProps.shouldValidate === nextProps.shouldValidate && prevProps.companyType === nextProps.companyType && objectsDeepEqual(prevProps.kompanyVerifiedData, nextProps.kompanyVerifiedData));
25176
25184
  const BUSINESS_REGISTRATION_NUMBER_FIELD = ["registrationNumber", "exemptedFromRegistrationNumber"];
25177
25185
  function BusinessRegistrationNumberField({
25178
25186
  data,
@@ -25183,11 +25191,38 @@ function BusinessRegistrationNumberField({
25183
25191
  guidanceText,
25184
25192
  placeholders,
25185
25193
  readonly,
25194
+ handleChangeFor,
25195
+ country: country2,
25186
25196
  canExempt,
25187
- handleChangeFor
25197
+ companyType: companyType2,
25198
+ registrationNumberOptions,
25199
+ registrationNumberType,
25200
+ setRegistrationNumberType
25188
25201
  }) {
25189
- return jsxs(Fragment, {
25190
- children: [jsx(MaskedInputText, {
25202
+ const showExemptedOption = canExempt && !!registrationNumberOptions && registrationNumberOptions.length > 1;
25203
+ const handleCompanyRegistrationNumberTypeChange = (regNumberType) => {
25204
+ if (regNumberType === "exempted") {
25205
+ if (!canExempt) {
25206
+ throw Error(`${country2} does not allow tax exemptions`);
25207
+ }
25208
+ handleChangeFor("exemptedFromRegistrationNumber")(true);
25209
+ setRegistrationNumberType(void 0);
25210
+ return;
25211
+ }
25212
+ if (canExempt && data.exemptedFromRegistrationNumber === true) {
25213
+ handleChangeFor("exemptedFromRegistrationNumber")(false);
25214
+ }
25215
+ setRegistrationNumberType(regNumberType);
25216
+ };
25217
+ return jsxs("div", {
25218
+ className: "adyen-kyc-field__business-registration",
25219
+ children: [jsx(CompanyRegistrationNumberTypeSelector, {
25220
+ companyType: companyType2,
25221
+ country: country2,
25222
+ setSelected: handleCompanyRegistrationNumberTypeChange,
25223
+ selected: data.exemptedFromRegistrationNumber ? "exempted" : registrationNumberType,
25224
+ exemptedOption: showExemptedOption ? labels2.exemptedFromRegistrationNumber : false
25225
+ }), jsx(MaskedInputText, {
25191
25226
  "aria-required": true,
25192
25227
  "aria-label": labels2.registrationNumber,
25193
25228
  "aria-invalid": !valid.registrationNumber,
@@ -25332,13 +25367,38 @@ function VatNumberField({
25332
25367
  placeholders,
25333
25368
  readonly,
25334
25369
  handleChangeFor,
25335
- canExempt
25370
+ canExempt,
25371
+ country: country2,
25372
+ vatNumberType,
25373
+ setVatNumberType
25336
25374
  }) {
25375
+ var _a;
25337
25376
  const {
25338
25377
  i18n
25339
25378
  } = useI18nContext();
25340
- return jsxs(Fragment, {
25341
- children: [jsx(MaskedInputText, {
25379
+ const showVatExemptedOption = canExempt && ((_a = taxIdNumberOptions[country2]) == null ? void 0 : _a.length) > 1;
25380
+ const handleVatNumberTypeChange = (vatType) => {
25381
+ if (vatType === "exempted") {
25382
+ if (!canExempt) {
25383
+ throw Error(`${country2} does not allow VAT exemptions`);
25384
+ }
25385
+ handleChangeFor("exemptedFromVat")(true);
25386
+ setVatNumberType(void 0);
25387
+ return;
25388
+ }
25389
+ if (canExempt && data.exemptedFromVat === true) {
25390
+ handleChangeFor("exemptedFromVat")(false);
25391
+ }
25392
+ setVatNumberType(vatType);
25393
+ };
25394
+ return jsxs("div", {
25395
+ className: "adyen-kyc-field__vat-number",
25396
+ children: [jsx(TaxIdNumberTypeSelector, {
25397
+ country: country2,
25398
+ setSelected: handleVatNumberTypeChange,
25399
+ selected: data.exemptedFromVat ? "exempted" : vatNumberType,
25400
+ exemptedOption: showVatExemptedOption ? labels2.exemptedFromVat : false
25401
+ }), jsx(MaskedInputText, {
25342
25402
  "aria-required": true,
25343
25403
  "aria-label": labels2.vatNumber,
25344
25404
  "aria-invalid": !valid.vatNumber,
@@ -25358,7 +25418,7 @@ function VatNumberField({
25358
25418
  disabled: data.exemptedFromVat,
25359
25419
  readonly,
25360
25420
  ...mask
25361
- }), canExempt && jsx(Checkbox, {
25421
+ }), canExempt && !showVatExemptedOption && jsx(Checkbox, {
25362
25422
  "aria-required": false,
25363
25423
  "aria-label": labels2 == null ? void 0 : labels2.exemptedFromVat,
25364
25424
  "aria-invalid": false,
@@ -25415,14 +25475,17 @@ function CompanyOtherDetails({
25415
25475
  i18n
25416
25476
  } = useI18nContext();
25417
25477
  const {
25418
- sliceData,
25419
25478
  updateStateSlice
25420
25479
  } = useGlobalDataSlice(COMPANY_OTHER_DETAILS_FORM_ID);
25421
- const [registrationNumberType, setRegistrationNumberType] = useState$1((data == null ? void 0 : data.registrationNumber) ? inferCompanyRegistrationNumberType(data == null ? void 0 : data.registrationNumber, country2, companyType2) : (_a = companyRegistrationNumberOptions[country2]) == null ? void 0 : _a[0].id);
25422
- const existingTaxIdentificationNumber = (data == null ? void 0 : data.vatNumber) ?? ((_c = (_b = data == null ? void 0 : data.taxInformation) == null ? void 0 : _b.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _c.number);
25423
- const [taxIdentificationNumberType, setTaxIdentificationNumberType] = useState$1(existingTaxIdentificationNumber ? inferTaxIdNumberType(existingTaxIdentificationNumber, country2) : (_d = taxIdNumberOptions[country2]) == null ? void 0 : _d[0].id);
25480
+ const registrationNumberOptions = useMemo$1(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
25481
+ const defaultRegistrationNumberType = (data == null ? void 0 : data.registrationNumber) ? inferCompanyRegistrationNumberType(data == null ? void 0 : data.registrationNumber, country2, companyType2) : registrationNumberOptions == null ? void 0 : registrationNumberOptions[0].id;
25482
+ const [registrationNumberType, setRegistrationNumberType] = useState$1(defaultRegistrationNumberType);
25483
+ const defaultVatNumberType = (data == null ? void 0 : data.vatNumber) ? inferTaxIdNumberType(data == null ? void 0 : data.vatNumber, country2) : (_a = taxIdNumberOptions[country2]) == null ? void 0 : _a[0].id;
25484
+ const [vatNumberType, setVatNumberType] = useState$1(defaultVatNumberType);
25485
+ const existingTaxId = (_c = (_b = data == null ? void 0 : data.taxInformation) == null ? void 0 : _b.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _c.number;
25486
+ const defaultTaxIdNumberType = existingTaxId ? inferTaxIdNumberType(existingTaxId, country2) : (_d = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _d[0].id;
25487
+ const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
25424
25488
  const directChildFields = companyOtherDetailsFields.filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
25425
- const schema = useMemo$1(() => !(sliceData == null ? void 0 : sliceData.exemptedFromVat) ? (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatAbsenceReason")) ?? directChildFields : (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatNumber")) ?? directChildFields, [requiredFields, directChildFields, sliceData]);
25426
25489
  const initialFormUtilsProps = useMemo$1(() => ({
25427
25490
  labels: labels2,
25428
25491
  placeholders,
@@ -25465,27 +25528,26 @@ function CompanyOtherDetails({
25465
25528
  }, defaultFieldMetadata$8), acc);
25466
25529
  case "taxInformation":
25467
25530
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
25468
- taxIdNumberType: taxIdentificationNumberType
25531
+ taxIdNumberType
25469
25532
  }, defaultFieldMetadata), acc);
25470
25533
  case "vatNumber":
25471
25534
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$6[country2], {
25472
- vatNumberType: taxIdentificationNumberType
25535
+ vatNumberType
25473
25536
  }, defaultFieldMetadata$6), acc);
25474
25537
  default:
25475
25538
  return acc;
25476
25539
  }
25477
25540
  }, initialFormUtilsProps);
25478
- }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdentificationNumberType]);
25541
+ }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdNumberType, vatNumberType]);
25479
25542
  const {
25480
25543
  schema: formSchema,
25481
25544
  data: formData,
25482
25545
  errors: formErrors,
25483
25546
  valid: formValid,
25484
25547
  fieldProblems: formFieldProblems,
25485
- handleChangeFor,
25486
- triggerValidation
25548
+ handleChangeFor
25487
25549
  } = useForm({
25488
- schema,
25550
+ schema: (currentData) => !currentData.exemptedFromVat ? (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatAbsenceReason")) ?? directChildFields : (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatNumber")) ?? directChildFields,
25489
25551
  defaultData: data,
25490
25552
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
25491
25553
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
@@ -25494,14 +25556,6 @@ function CompanyOtherDetails({
25494
25556
  shouldValidate
25495
25557
  });
25496
25558
  const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
25497
- const handleBusinessRegistrationNumberTypeChange = useCallback$1((type) => {
25498
- setRegistrationNumberType(type);
25499
- triggerValidation(["registrationNumber"]);
25500
- }, [triggerValidation]);
25501
- const handleTaxIdentificationNumberTypeChange = useCallback$1((type) => {
25502
- setTaxIdentificationNumberType(type);
25503
- triggerValidation(["vatNumber", "taxInformation"]);
25504
- }, [triggerValidation]);
25505
25559
  useEffect$1(() => {
25506
25560
  }, [kompanyVerifiedData]);
25507
25561
  useEffect$1(() => {
@@ -25541,44 +25595,46 @@ function CompanyOtherDetails({
25541
25595
  handleChangeFor,
25542
25596
  legalCompanyName: legalCompanyName2
25543
25597
  })
25544
- }), formUtils.isRequiredField("registrationNumber") && jsx(CompanyRegistrationNumberTypeSelector, {
25545
- companyType: companyType2,
25546
- country: country2,
25547
- setSelected: handleBusinessRegistrationNumberTypeChange,
25548
- selected: registrationNumberType
25549
25598
  }), formUtils.isRequiredField("registrationNumber") && jsx("div", {
25550
25599
  className: "adyen-kyc-field-wrapper",
25551
25600
  children: jsx(BusinessRegistrationNumberField, {
25552
25601
  data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
25553
25602
  valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
25554
25603
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
25555
- labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD),
25604
+ labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
25605
+ exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
25606
+ }),
25556
25607
  mask: formUtils.getMask("registrationNumber"),
25557
25608
  guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25558
25609
  placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
25559
25610
  helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25560
25611
  readonly: formUtils.isReadOnly("registrationNumber"),
25561
25612
  handleChangeFor,
25562
- canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber")
25613
+ country: country2,
25614
+ canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
25615
+ companyType: companyType2,
25616
+ registrationNumberOptions,
25617
+ registrationNumberType,
25618
+ setRegistrationNumberType
25563
25619
  })
25564
- }), formUtils.isRequiredField("vatNumber") && jsx(TaxIdNumberTypeSelector, {
25565
- country: country2,
25566
- setSelected: handleTaxIdentificationNumberTypeChange,
25567
- selected: taxIdentificationNumberType
25568
25620
  }), formUtils.isRequiredField("vatNumber") && jsx("div", {
25569
25621
  className: "adyen-kyc-field-wrapper",
25570
25622
  children: jsx(VatNumberField, {
25571
25623
  data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
25572
25624
  valid: formUtils.getFieldValid(formValid, VAT_NUMBER_FIELD),
25573
25625
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, VAT_NUMBER_FIELD),
25574
- labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD),
25626
+ labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD, {
25627
+ exemptedFromVat: "iDontHaveAVatNumber"
25628
+ }),
25575
25629
  mask: formUtils.getMask("vatNumber"),
25576
25630
  guidanceText: formUtils.getFieldGuidanceText(VAT_NUMBER_FIELD),
25577
25631
  placeholders: formUtils.getFieldPlaceholders(VAT_NUMBER_FIELD),
25578
25632
  readonly: formUtils.isReadOnly("vatNumber"),
25579
25633
  handleChangeFor,
25580
25634
  country: country2,
25581
- canExempt: formUtils.isRequiredField("exemptedFromVat")
25635
+ canExempt: formUtils.isRequiredField("exemptedFromVat"),
25636
+ vatNumberType,
25637
+ setVatNumberType
25582
25638
  })
25583
25639
  }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25584
25640
  className: "adyen-kyc-field-wrapper",
@@ -25586,7 +25642,9 @@ function CompanyOtherDetails({
25586
25642
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
25587
25643
  valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
25588
25644
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
25589
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
25645
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25646
+ exemptedFromTax: "iDontHaveATaxId"
25647
+ }),
25590
25648
  mask: formUtils.getMask("taxInformation"),
25591
25649
  helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25592
25650
  guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
@@ -25594,7 +25652,10 @@ function CompanyOtherDetails({
25594
25652
  handleChangeFor,
25595
25653
  country: country2,
25596
25654
  canExempt: formUtils.isRequiredField("exemptedFromTax"),
25597
- isUen: formUtils.isRequiredField("isUen")
25655
+ isUen: formUtils.isRequiredField("isUen"),
25656
+ companyType: companyType2,
25657
+ taxIdNumberType,
25658
+ setTaxIdNumberType
25598
25659
  })
25599
25660
  }), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
25600
25661
  className: "adyen-kyc-field-wrapper",
@@ -25685,11 +25746,16 @@ function CompanyStructure({
25685
25746
  requiredFields
25686
25747
  }, i18n);
25687
25748
  const disabled = Boolean((_a = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a.entityType) || formUtils.isReadOnly("entityType");
25749
+ const prevVerifiedDataRef = useRef(kompanyVerifiedData);
25688
25750
  useEffect(() => {
25689
- var _a2, _b;
25751
+ var _a2, _b, _c, _d, _e;
25690
25752
  if ((_a2 = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a2.entityType) {
25691
25753
  handleChangeFor("entityType")((_b = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _b.entityType);
25692
25754
  }
25755
+ if (((_d = (_c = prevVerifiedDataRef.current) == null ? void 0 : _c.companyStructure) == null ? void 0 : _d.entityType) && !((_e = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _e.entityType)) {
25756
+ handleChangeFor("entityType")(void 0);
25757
+ }
25758
+ prevVerifiedDataRef.current = kompanyVerifiedData;
25693
25759
  }, [kompanyVerifiedData]);
25694
25760
  useEffect(() => {
25695
25761
  updateStateSlice({
@@ -26202,7 +26268,7 @@ function useCompanySearchTaskSubmit({
26202
26268
  };
26203
26269
  }
26204
26270
  function CompanySearchComponent(props) {
26205
- var _a, _b;
26271
+ var _a, _b, _c;
26206
26272
  const {
26207
26273
  i18n
26208
26274
  } = useI18nContext();
@@ -26233,6 +26299,7 @@ function CompanySearchComponent(props) {
26233
26299
  id: forms.companyBasics.formId,
26234
26300
  heading: i18n.get(forms.companyBasics.formName),
26235
26301
  country: country2,
26302
+ companyType: (_a = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _a.entityType,
26236
26303
  isTopLevelEntity,
26237
26304
  baseTrackingPayload,
26238
26305
  handleCompanyIndexSearch,
@@ -26275,8 +26342,8 @@ function CompanySearchComponent(props) {
26275
26342
  id: forms.companyOtherDetails.formId,
26276
26343
  heading: i18n.get(forms.companyOtherDetails.formName),
26277
26344
  country: country2,
26278
- legalCompanyName: (_a = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _a.legalCompanyName,
26279
- companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26345
+ legalCompanyName: (_b = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _b.legalCompanyName,
26346
+ companyType: (_c = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _c.entityType,
26280
26347
  kompanyVerifiedData
26281
26348
  })
26282
26349
  }), jsx("div", {
@@ -26634,12 +26701,6 @@ function useAssociatedLegalArrangement({
26634
26701
  associatedLegalArrangement
26635
26702
  };
26636
26703
  }
26637
- const useShouldShowBusinessTypeSelection = (accountHolder2) => {
26638
- const {
26639
- isExperimentEnabled
26640
- } = useExperimentsContext();
26641
- return isExperimentEnabled("EnableNewEntryFlow") && !accountHolder2;
26642
- };
26643
26704
  const logger$c = createLogger("useExemptSettlor");
26644
26705
  const useExemptSettlor = ({
26645
26706
  trust: trust2,
@@ -26658,6 +26719,11 @@ const useExemptSettlor = ({
26658
26719
  }, [trust2, updateExemptSettlor]);
26659
26720
  return exemptSettlor;
26660
26721
  };
26722
+ const leIdStorageKey = "LE_ID";
26723
+ const useLeId = () => {
26724
+ const [leIdFromLocalStorage, setLeIdIntoLocalStorage] = useLocalStorage(leIdStorageKey, null);
26725
+ return [leIdFromLocalStorage, setLeIdIntoLocalStorage];
26726
+ };
26661
26727
  function useSalesChannelsSettings() {
26662
26728
  const {
26663
26729
  isSettingEnabled
@@ -27125,8 +27191,6 @@ const BusinessTypeSelection = ({
27125
27191
  const defaultBusinessType = getBusinessType(businessTypeOptions, accountHolder2, legalEntityResponse == null ? void 0 : legalEntityResponse.type, (_b = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _b.type);
27126
27192
  const getDefaultLegalArrangementSelection = () => legalArrangementOptions.find((item) => item.id === getDefaultLegalArrangementOrSuborganizationType(legalEntityResponse, accountHolder2));
27127
27193
  const defaultLegalArrangementType = getDefaultLegalArrangementSelection();
27128
- console.log("defaultBusinessType", defaultBusinessType);
27129
- console.log("defaultLegalArrangementType", defaultLegalArrangementType);
27130
27194
  const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
27131
27195
  const {
27132
27196
  handleChangeFor,
@@ -28163,6 +28227,22 @@ const introductionScreensByLegalEntityType = {
28163
28227
  [LegalEntityType.SOLE_PROPRIETORSHIP]: [IntroductionScreens.PROLOGUE, IntroductionScreens.INDIVIDUAL, IntroductionScreens.SOLE_PROPRIETOR_COMPANY, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE],
28164
28228
  [LegalEntityType.TRUST]: [IntroductionScreens.PROLOGUE, IntroductionScreens.COMPANY, IntroductionScreens.INDIVIDUAL, IntroductionScreens.DECISION_MAKER, IntroductionScreens.TRUST, IntroductionScreens.TRUST_MEMBER_OVERVIEW, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE]
28165
28229
  };
28230
+ var IntroductionScreenEvent = /* @__PURE__ */ ((IntroductionScreenEvent2) => {
28231
+ IntroductionScreenEvent2["EMPTY"] = "Introduction_Empty";
28232
+ IntroductionScreenEvent2["START_FLOW"] = "Introduction_StartFlow";
28233
+ IntroductionScreenEvent2["START_SCREEN"] = "Introduction_StartScreen";
28234
+ IntroductionScreenEvent2["STOP_SCREEN"] = "Introduction_StopScreen";
28235
+ IntroductionScreenEvent2["STOP_FLOW"] = "Introduction_StopFlow";
28236
+ IntroductionScreenEvent2["NEXT"] = "Introduction_Next";
28237
+ IntroductionScreenEvent2["BACK"] = "Introduction_Back";
28238
+ IntroductionScreenEvent2["SKIP"] = "Introduction_Skip";
28239
+ return IntroductionScreenEvent2;
28240
+ })(IntroductionScreenEvent || {});
28241
+ var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
28242
+ IntroductionScreenTiming2["VIEW_FLOW"] = "Introduction_ViewFlow";
28243
+ IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
28244
+ return IntroductionScreenTiming2;
28245
+ })(IntroductionScreenTiming || {});
28166
28246
  const useIntroductionScreens = ({
28167
28247
  legalEntity,
28168
28248
  tasks
@@ -28284,10 +28364,30 @@ const Introduction = ({
28284
28364
  tasks
28285
28365
  });
28286
28366
  const [activeIndex, setActiveIndex] = useState(0);
28367
+ const eventSegmentationDefaults = getBaseTrackingPayload({
28368
+ trackingConfig: {
28369
+ topLevelLegalEntity: legalEntity
28370
+ },
28371
+ legalEntity,
28372
+ task: TaskTypes.INTRODUCTION
28373
+ });
28374
+ const eventDetails = {
28375
+ segmentation: {
28376
+ ...eventSegmentationDefaults,
28377
+ page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : null
28378
+ }
28379
+ };
28287
28380
  useEffect(() => {
28288
- if (!(introductionScreens == null ? void 0 : introductionScreens.length))
28381
+ if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
28382
+ userEvents.addEvent(IntroductionScreenEvent.EMPTY, {
28383
+ segmentation: eventSegmentationDefaults
28384
+ });
28289
28385
  onExitIntroduction();
28290
- }, [onExitIntroduction, introductionScreens]);
28386
+ } else {
28387
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_FLOW);
28388
+ userEvents.addEvent(IntroductionScreenEvent.START_FLOW, eventDetails);
28389
+ }
28390
+ }, [introductionScreens]);
28291
28391
  return (introductionScreens == null ? void 0 : introductionScreens.length) ? jsxs("div", {
28292
28392
  className: "adyen-kyc-introduction",
28293
28393
  children: [jsx(StepProgressIndicator, {
@@ -28297,7 +28397,10 @@ const Introduction = ({
28297
28397
  className: "adyen-kyc-introduction__skip",
28298
28398
  children: jsx(Button, {
28299
28399
  label: i18n.get("goToOverviewFromIntroduction"),
28300
- onClick: () => onExitIntroduction(),
28400
+ onClick: () => {
28401
+ userEvents.addEvent(IntroductionScreenEvent.SKIP, eventDetails);
28402
+ onExitIntroduction();
28403
+ },
28301
28404
  showAsLink: true,
28302
28405
  type: "button"
28303
28406
  })
@@ -28311,16 +28414,36 @@ const Introduction = ({
28311
28414
  children: [jsx(Button, {
28312
28415
  disabled: activeIndex === 0,
28313
28416
  label: "Back",
28314
- onClick: () => setActiveIndex((currentValue) => currentValue - 1),
28417
+ onClick: () => {
28418
+ userEvents.addEvent(IntroductionScreenEvent.BACK, eventDetails);
28419
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28420
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28421
+ setActiveIndex((currentValue) => currentValue - 1);
28422
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
28423
+ userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
28424
+ },
28315
28425
  secondary: true,
28316
28426
  type: "button"
28317
28427
  }), activeIndex + 1 === introductionScreens.length ? jsx(Button, {
28318
28428
  label: "Start",
28319
- onClick: () => onExitIntroduction(),
28429
+ onClick: () => {
28430
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28431
+ userEvents.addEvent(IntroductionScreenEvent.STOP_FLOW, eventDetails);
28432
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28433
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_FLOW, eventDetails);
28434
+ onExitIntroduction();
28435
+ },
28320
28436
  type: "button"
28321
28437
  }) : jsx(Button, {
28322
28438
  label: "Next",
28323
- onClick: () => setActiveIndex((currentValue) => currentValue + 1),
28439
+ onClick: () => {
28440
+ userEvents.addEvent(IntroductionScreenEvent.NEXT, eventDetails);
28441
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28442
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28443
+ setActiveIndex((currentValue) => currentValue + 1);
28444
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
28445
+ userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
28446
+ },
28324
28447
  type: "button"
28325
28448
  })]
28326
28449
  })]
@@ -28682,6 +28805,7 @@ function TaskListComponent({
28682
28805
  const {
28683
28806
  isExperimentEnabled
28684
28807
  } = useExperimentsContext();
28808
+ const limitToOneTransferInstrument = useSetting("limitToOneTransferInstrument");
28685
28809
  const isEnableNewEntryFlowEnabled = useEnableNewEntryFlow();
28686
28810
  const canSeeIntroduction = useCanSeeIntroduction({
28687
28811
  legalEntity: legalEntityResponse
@@ -28829,7 +28953,7 @@ function TaskListComponent({
28829
28953
  capabilityProblems,
28830
28954
  onNavigateToTask: () => handleOnNavigateToTaskPayout(transferInstrument.id),
28831
28955
  onTransferInstrumentDelete: () => onTransferInstrumentDelete(transferInstrument.id)
28832
- }, transferInstrument.id)), jsxs(Card, {
28956
+ }, transferInstrument.id)), !limitToOneTransferInstrument || transferInstruments.length < 1 ? jsxs(Card, {
28833
28957
  stateful: true,
28834
28958
  onClick: () => handleOnNavigateToTaskPayout(),
28835
28959
  className: "adyen-task adl-add-payout",
@@ -28840,7 +28964,7 @@ function TaskListComponent({
28840
28964
  }), jsx("span", {
28841
28965
  children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
28842
28966
  })]
28843
- })]
28967
+ }) : null]
28844
28968
  }) : jsx(TaskListItem, {
28845
28969
  onNavigateToTask: () => handleOnNavigateToTaskPayout(),
28846
28970
  icon: "payout",
@@ -32024,7 +32148,8 @@ function DropinComposerComponent({
32024
32148
  showToast
32025
32149
  } = useToastContext();
32026
32150
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
32027
- const showBusinessTypeSelection = useShouldShowBusinessTypeSelection(accountHolder2);
32151
+ const isNewEntryFlowEnabled = isExperimentEnabled("EnableNewEntryFlow");
32152
+ const [leId, setLeId] = useLeId();
32028
32153
  const showIntroduction = useShouldShowIntroduction({
32029
32154
  legalEntity: legalEntityResponse
32030
32155
  });
@@ -32035,12 +32160,13 @@ function DropinComposerComponent({
32035
32160
  });
32036
32161
  const [tasks, setTasks] = useState([]);
32037
32162
  const initialTask = useMemo(() => {
32038
- if (showBusinessTypeSelection)
32163
+ if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
32039
32164
  return TaskTypes.BUSINESS_TYPE_SELECTION;
32165
+ }
32040
32166
  if (showIntroduction)
32041
32167
  return TaskTypes.INTRODUCTION;
32042
32168
  return TaskTypes.TASKS_OVERVIEW;
32043
- }, [showBusinessTypeSelection, showIntroduction]);
32169
+ }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
32044
32170
  const [taskHistory, setTaskHistory] = useState([initialTask]);
32045
32171
  const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
32046
32172
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
@@ -32564,6 +32690,12 @@ function DropinComposerComponent({
32564
32690
  clearInterval(timeoutId);
32565
32691
  };
32566
32692
  }, [refreshLegalEntity, rootLegalEntity, taskHistory]);
32693
+ useEffect(() => {
32694
+ if (!isNewEntryFlowEnabled || leId !== legalEntityResponse.id) {
32695
+ setLeId(null);
32696
+ setAccountHolder(null);
32697
+ }
32698
+ }, [isNewEntryFlowEnabled, setLeId]);
32567
32699
  if (isLoadingConfiguration) {
32568
32700
  return jsx(Shimmer, {});
32569
32701
  }
@@ -32577,6 +32709,7 @@ function DropinComposerComponent({
32577
32709
  legalEntityResponse: rootLegalEntity,
32578
32710
  accountHolder: accountHolder2,
32579
32711
  onAccountHolderSelect: async (newAccountHolder) => {
32712
+ setLeId(legalEntityResponse.id);
32580
32713
  setAccountHolder(newAccountHolder);
32581
32714
  await refreshLegalEntity();
32582
32715
  onNavigateTo(showIntroduction ? TaskTypes.INTRODUCTION : TaskTypes.TASKS_OVERVIEW);
@@ -34571,7 +34704,8 @@ const settingsDefaults = {
34571
34704
  hideOnboardingIntroductionOrganization: true,
34572
34705
  hideOnboardingIntroductionTrust: true,
34573
34706
  hideOnboardingIntroductionSoleProprietor: true,
34574
- viewOnboardingGuidance: false
34707
+ viewOnboardingGuidance: false,
34708
+ limitToOneTransferInstrument: false
34575
34709
  };
34576
34710
  function SettingsProvider({
34577
34711
  children,