@adyen/kyc-components 2.32.1 → 2.33.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.";
@@ -615,7 +617,7 @@ const noGlare = "No glare";
615
617
  const selectDocumentType = "Select document type";
616
618
  const registrationDocumentSubTitle = "Upload your company’s business registration document. We need to see this document so we can verify your company.";
617
619
  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";
618
- 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.";
620
+ 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.";
619
621
  const containsNameOfCompany = "Contains the name of your company or organization";
620
622
  const documentShowsTaxIdOfCompany = "The document shows the tax ID number of the company";
621
623
  const issuedByTheTaxAuthority = "Issued by the tax authority or government of the country where the company is registered";
@@ -863,14 +865,14 @@ const marketIdentifierCodeMIC = "Market Identifier Code (MIC)";
863
865
  const isin = "ISIN";
864
866
  const companyLookupResultsHeader = "Let's find your company";
865
867
  const companyLookupResultsHeader__searching = "Searching for companies...";
866
- const companyLookupResultsHeader__verifying = "Verifying tax information...";
868
+ const companyLookupResultsHeader__verifying = "Verifying company selection...";
867
869
  const companyLookupResultsHeader__noResults = "We couldn't find your company";
868
870
  const companyLookupResultsHeader__results = "Select your company";
869
871
  const companyLookupResultsHeader__searchFailure = "Sorry, something went wrong";
870
872
  const companyLookupResultsHeaderDescription__noResults = "No problem, let's enter your company details in the next steps.";
871
- const companyLookupResultsHeaderDescription__results = "This helps you to get verified quicker. If you can't find your company, you can always continue by pressing Next.";
873
+ 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.";
872
874
  const companyLookupResultsHeaderDescription__searchFailure = "If that doesn't work, press Next to continue.";
873
- const companyLookupResultsListAlert__title__verified = "Your tax information has been verified";
875
+ const companyLookupResultsListAlert__title__verified = "Your company details will be pre-filled in the relevant sections.";
874
876
  const companyLookupResultsListAlert__title__warning = "This company's TIN doesn't match yours";
875
877
  const companyLookupResultsListAlert__title__error = "Sorry, something went wrong. Try again or continue by pressing Next";
876
878
  const companyLookupResultsListAlert__description__warning = "Check the TIN you've entered, or select a different company.";
@@ -881,9 +883,9 @@ const companyStructureFormName = "Company structure";
881
883
  const companyStructureFormDescription = "What type of company do you have?";
882
884
  const companyOtherDetailsFormName = "Other details";
883
885
  const companyRegistrationDocumentFormName = "Registration document";
884
- const companyRegistrationDocumentFormDescription = "Please upload you companies registration document so we can verify your information.";
886
+ const companyRegistrationDocumentFormDescription = "Please upload your companies registration document so we can verify your information.";
885
887
  const companyTaxDocumentFormName = "Tax document";
886
- const companyTaxDocumentFormDescription = "Please upload you companies tax documents so we can verify your information.";
888
+ const companyTaxDocumentFormDescription = "Please upload your companies tax documents so we can verify your information.";
887
889
  const errorMessage_1_10 = "Information couldn’t be verified";
888
890
  const errorMessage_1_11 = "Document didn’t meet requirements";
889
891
  const errorMessage_1_12 = "Legal entity declined";
@@ -1106,6 +1108,7 @@ const errorMessage_2_8064 = "UBO through ownership was missing.";
1106
1108
  const errorMessage_2_8067 = "Signatory was missing.";
1107
1109
  const errorMessage_2_8141 = "Registration document was missing.";
1108
1110
  const errorMessage_2_8162 = "proofOfOrganizationTaxInfo was missing.";
1111
+ const errorMessage_2_8183 = "'webAddress' was missing.";
1109
1112
  const errorMessage_2_8189 = "UBO through control was missing.";
1110
1113
  const errorMessage_2_8193 = "Director was missing.";
1111
1114
  const errorMessage_3_10 = "Review of data is required";
@@ -1151,6 +1154,7 @@ const remediationMessage_1_705 = "Upload an official bank statement";
1151
1154
  const remediationMessage_2_123 = "You haven't added an owner";
1152
1155
  const remediationMessage_2_124 = "You haven't added a signatory";
1153
1156
  const remediationMessage_2_151 = "You haven't added a controlling person";
1157
+ const remediationMessage_2_178 = "Add 'webAddress' to business line.";
1154
1158
  const remediationMessage_2_185 = "You haven't added your directors";
1155
1159
  const remediationMessage_3_100 = "Check the above information, then click here to confirm.";
1156
1160
  const sameNameAsLegalName = "Same as legal name of the company";
@@ -1405,6 +1409,7 @@ const defaultTrans = {
1405
1409
  taxId,
1406
1410
  exemptedFromTax,
1407
1411
  doNotHaveTaxIdNumber,
1412
+ doNotHaveEIN,
1408
1413
  doNotHaveFirmenbuchnummer,
1409
1414
  doNotHaveOrganisationsnummer,
1410
1415
  doNotHaveYTunnus,
@@ -1424,6 +1429,7 @@ const defaultTrans = {
1424
1429
  validationPleaseEnterAValidIdNumberWithFormat,
1425
1430
  validationPleaseEnterAValidVatNumberWithFormat,
1426
1431
  validationPleaseEnterAValidTaxIdNumberWithFormat,
1432
+ validationPleaseEnterAValidEINWithFormat,
1427
1433
  validationPleaseEnterAValidTaxIdNumber,
1428
1434
  validationPleaseEnterAValidIRDNumber,
1429
1435
  aValidAbnShouldBe11Digits,
@@ -2336,6 +2342,7 @@ const defaultTrans = {
2336
2342
  errorMessage_2_8067,
2337
2343
  errorMessage_2_8141,
2338
2344
  errorMessage_2_8162,
2345
+ errorMessage_2_8183,
2339
2346
  errorMessage_2_8189,
2340
2347
  errorMessage_2_8193,
2341
2348
  errorMessage_3_10,
@@ -2381,6 +2388,7 @@ const defaultTrans = {
2381
2388
  remediationMessage_2_123,
2382
2389
  remediationMessage_2_124,
2383
2390
  remediationMessage_2_151,
2391
+ remediationMessage_2_178,
2384
2392
  remediationMessage_2_185,
2385
2393
  remediationMessage_3_100,
2386
2394
  sameNameAsLegalName,
@@ -2691,6 +2699,7 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2691
2699
  SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
2692
2700
  SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
2693
2701
  SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
2702
+ SettingNames2["LimitToOneTransferInstrument"] = "limitToOneTransferInstrument";
2694
2703
  SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
2695
2704
  SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
2696
2705
  SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
@@ -6631,18 +6640,6 @@ const taxIdNumberOptions = {
6631
6640
  }, {
6632
6641
  id: "uen",
6633
6642
  name: "uen"
6634
- }],
6635
- [CountryCodes.UnitedStates]: [{
6636
- id: "ein",
6637
- name: "employerIdentificationNumber"
6638
- }, {
6639
- id: "ssn",
6640
- name: "socialSecurityNumber",
6641
- applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6642
- }, {
6643
- id: "ssnLastFour",
6644
- name: "last4DigitsOfSocialSecurityNumber",
6645
- applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6646
6643
  }]
6647
6644
  };
6648
6645
  const getTaxIdNumberOptions = (country2, companyType2) => {
@@ -8039,7 +8036,7 @@ function BusinessRegistrationNumber(props) {
8039
8036
  ...formUtils.getMask("registrationNumber")
8040
8037
  }), formUtils.isRequiredField("exemptedFromRegistrationNumber") && !showExemptedOption && jsx(Checkbox, {
8041
8038
  name: "exemptedFromRegistrationNumber",
8042
- label: formUtils.getLabel("exemptedFromRegistrationNumber"),
8039
+ label: formUtils.getLabel("iDontHaveARegistrationNumber"),
8043
8040
  value: "exemptedFromRegistrationNumber",
8044
8041
  readonly: formUtils.isReadOnly("exemptedFromRegistrationNumber"),
8045
8042
  classNameModifiers: ["exempted-from-registration"],
@@ -8525,41 +8522,17 @@ const defaultFieldConfig$7 = {
8525
8522
  }
8526
8523
  }
8527
8524
  },
8528
- [CountryCodes.UnitedStates]: ({
8529
- taxIdNumberType
8530
- }) => {
8531
- switch (taxIdNumberType) {
8532
- case "ssn":
8533
- return {
8534
- label: "socialSecurityNumber",
8535
- validators: validatePatternOnBlur(/^\d{9}$/),
8536
- mask: {
8537
- mask: makeMask(...numericInputs(9))
8538
- }
8539
- };
8540
- case "ssnLastFour":
8541
- return {
8542
- label: "last4DigitsOfSocialSecurityNumber",
8543
- validators: validatePatternOnBlur(/^\d{4}$/),
8544
- mask: {
8545
- mask: makeMask(...nonInputs("*** — ** — "), ...numericInputs(4))
8546
- }
8547
- };
8548
- case "ein":
8549
- default:
8550
- return {
8551
- label: "employerIdentificationNumber",
8552
- validators: validatePatternOnBlur(/^\d{9}$/),
8553
- mask: {
8554
- mask: makeMask(...numericInputs(2), ...nonInputs(" - "), ...numericInputs(7))
8555
- },
8556
- guidanceText: {
8557
- key: "validationPleaseEnterAValidTaxIdNumberWithFormat",
8558
- values: {
8559
- format: "XX-XXXXXXX"
8560
- }
8561
- }
8562
- };
8525
+ [CountryCodes.UnitedStates]: {
8526
+ label: "employerIdentificationNumber",
8527
+ validators: validatePatternOnBlur(/^\d{9}$/),
8528
+ mask: {
8529
+ mask: makeMask(...numericInputs(2), ...nonInputs(" - "), ...numericInputs(7))
8530
+ },
8531
+ guidanceText: {
8532
+ key: "validationPleaseEnterAValidEINWithFormat",
8533
+ values: {
8534
+ format: "XX-XXXXXXX"
8535
+ }
8563
8536
  }
8564
8537
  },
8565
8538
  /**
@@ -10234,10 +10207,7 @@ const countryConfig$3 = {
10234
10207
  label: "doingBusinessAs"
10235
10208
  },
10236
10209
  exemptedFromTax: {
10237
- label: "doNotHaveTaxIdNumber"
10238
- },
10239
- taxId: {
10240
- label: "employerIdentificationNumber"
10210
+ label: "doNotHaveEIN"
10241
10211
  }
10242
10212
  }
10243
10213
  };
@@ -13015,6 +12985,9 @@ const rules$2 = ({
13015
12985
  if (country2 === "DE" && (companyType2 === CompanyTypesValue.GOVERNMENTAL_ORGANIZATION || companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE)) {
13016
12986
  return "REQUIRED";
13017
12987
  }
12988
+ if (country2 === "DK" && companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE) {
12989
+ return "REQUIRED";
12990
+ }
13018
12991
  },
13019
12992
  countryRequiresRegistrationNumberForSoleProps: () => {
13020
12993
  if (!COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION.includes(country2)) {
@@ -21841,7 +21814,7 @@ const entityProblemInitialState = {
21841
21814
  // default status - if the entity is not listed in the problems array
21842
21815
  validationErrors: {}
21843
21816
  };
21844
- const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8189"];
21817
+ const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8183", "2_8189"];
21845
21818
  const UNRELATED_INVALID_INPUT_ERROR_CODES = ["1_14", "2_901", "2_902"];
21846
21819
  function getCapabilityProblems(response, country2, isExperimentEnabled) {
21847
21820
  const capabilities = (response == null ? void 0 : response.capabilities) || {};
@@ -24579,11 +24552,15 @@ function TaxInformationField({
24579
24552
  readonly,
24580
24553
  handleChangeFor,
24581
24554
  country: country2,
24582
- canExempt
24555
+ canExempt,
24556
+ companyType: companyType2,
24557
+ taxIdNumberType,
24558
+ setTaxIdNumberType
24583
24559
  }) {
24560
+ var _a;
24584
24561
  const currentCountryTaxInformation = useMemo(() => {
24585
- var _a;
24586
- return (_a = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === country2);
24562
+ var _a2;
24563
+ return (_a2 = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a2.find((taxInfo) => taxInfo.country === country2);
24587
24564
  }, [data, country2]);
24588
24565
  const handleTaxInformationInput = (value) => {
24589
24566
  if (!data.taxInformation) {
@@ -24638,8 +24615,33 @@ function TaxInformationField({
24638
24615
  });
24639
24616
  return handleChangeFor("taxInformation", "blur")(updatedTaxInformation);
24640
24617
  };
24641
- return jsxs(Fragment, {
24642
- children: [jsx(MaskedInputText, {
24618
+ const showTaxIdExemptedOption = canExempt && (((_a = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _a.length) ?? 0) > 1;
24619
+ const handleTaxIdNumberTypeChange = (taxIdType) => {
24620
+ if (taxIdType === "exempted") {
24621
+ if (!canExempt) {
24622
+ throw Error(`${country2} does not allow tax exemptions`);
24623
+ }
24624
+ handleChangeFor("exemptedFromTax")(true);
24625
+ setTaxIdNumberType(void 0);
24626
+ return;
24627
+ }
24628
+ if (canExempt && data.exemptedFromTax === true) {
24629
+ handleChangeFor("exemptedFromTax")(false);
24630
+ }
24631
+ setTaxIdNumberType(taxIdType);
24632
+ };
24633
+ return jsxs("div", {
24634
+ className: "adyen-kyc-field__tax-information",
24635
+ children: [jsx(TaxIdNumberTypeSelector, {
24636
+ country: country2,
24637
+ companyType: companyType2,
24638
+ setSelected: handleTaxIdNumberTypeChange,
24639
+ selected: data.exemptedFromTax ? "exempted" : taxIdNumberType,
24640
+ exemptedOption: showTaxIdExemptedOption ? labels2.exemptedFromTax : false
24641
+ }), jsx(MaskedInputText, {
24642
+ "aria-required": true,
24643
+ "aria-label": labels2.taxInformation,
24644
+ "aria-invalid": !valid.taxInformation,
24643
24645
  name: "taxInformationNumber",
24644
24646
  label: labels2.taxInformation ?? "",
24645
24647
  formatGuidance: (guidanceText == null ? void 0 : guidanceText.taxInformation) ?? "",
@@ -24647,15 +24649,12 @@ function TaxInformationField({
24647
24649
  errorMessage: errors.taxInformation,
24648
24650
  placeholder: placeholders == null ? void 0 : placeholders.taxInformation,
24649
24651
  isValid: Boolean(valid.taxInformation),
24650
- "aria-required": true,
24651
- "aria-label": labels2.taxInformation,
24652
- "aria-invalid": !valid.taxInformation,
24653
24652
  onInput: handleTaxInformationInput,
24654
24653
  onBlur: handleTaxInformationBlur,
24655
24654
  disabled: data.exemptedFromTax,
24656
24655
  readonly,
24657
24656
  ...mask
24658
- }), canExempt && jsx(Checkbox, {
24657
+ }), canExempt && !showTaxIdExemptedOption && jsx(Checkbox, {
24659
24658
  "aria-required": false,
24660
24659
  "aria-label": labels2.exemptedFromTax,
24661
24660
  "aria-invalid": false,
@@ -24722,13 +24721,14 @@ function CompanyBasics({
24722
24721
  handleRefreshCompanyDataset,
24723
24722
  handleVerifyTin,
24724
24723
  country: country2,
24724
+ companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24725
24725
  isTopLevelEntity,
24726
24726
  baseTrackingPayload,
24727
24727
  kompanyVerifiedData,
24728
24728
  setKompanyAddress,
24729
24729
  setKompanyVerifiedData
24730
24730
  }) {
24731
- var _a, _b;
24731
+ var _a, _b, _c, _d, _e;
24732
24732
  const {
24733
24733
  i18n
24734
24734
  } = useI18nContext();
@@ -24740,6 +24740,9 @@ function CompanyBasics({
24740
24740
  } = useGlobalDataSlice(COMPANY_BASICS_FORM_ID);
24741
24741
  const [loading2, setLoading] = useState$1(false);
24742
24742
  const allowedCountries = useAllowedCountries();
24743
+ const existingTaxId = (_b = (_a = data == null ? void 0 : data.taxInformation) == null ? void 0 : _a.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _b.number;
24744
+ const defaultTaxIdNumberType = existingTaxId ? inferTaxIdNumberType(existingTaxId, country2) : (_c = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _c[0].id;
24745
+ const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
24743
24746
  const initialFormUtilsProps = useMemo$1(() => ({
24744
24747
  labels: labels2,
24745
24748
  placeholders,
@@ -24781,13 +24784,13 @@ function CompanyBasics({
24781
24784
  };
24782
24785
  case "taxInformation":
24783
24786
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
24784
- taxIdNumberType: countryToTaxInfoTypeMap[country2]
24787
+ taxIdNumberType
24785
24788
  }, defaultFieldMetadata), acc);
24786
24789
  default:
24787
24790
  return acc;
24788
24791
  }
24789
24792
  }, initialFormUtilsProps);
24790
- }, [country2, initialFormUtilsProps]);
24793
+ }, [country2, initialFormUtilsProps, taxIdNumberType]);
24791
24794
  const schema = (requiredFields == null ? void 0 : requiredFields.length) ? requiredFields : ["legalCompanyName", "country"];
24792
24795
  const {
24793
24796
  schema: formSchema,
@@ -24809,7 +24812,7 @@ function CompanyBasics({
24809
24812
  const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
24810
24813
  const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
24811
24814
  const hasCompanySearchProvider = formData.country && COUNTRIES_WITH_IN_APP_SEARCH_COMPANY_VERIFICATION.includes(formData.country);
24812
- const currentCountryTaxIdNumber = (_b = (_a = formData.taxInformation) == null ? void 0 : _a.find((taxInfo) => taxInfo.country === formData.country)) == null ? void 0 : _b.number;
24815
+ const currentCountryTaxIdNumber = (_e = (_d = formData.taxInformation) == null ? void 0 : _d.find((taxInfo) => taxInfo.country === formData.country)) == null ? void 0 : _e.number;
24813
24816
  const disabled = (field) => formUtils.isReadOnly(field) || Boolean(kompanyVerifiedData) || loading2;
24814
24817
  useEffect$1(() => {
24815
24818
  updateStateSlice({
@@ -24872,7 +24875,9 @@ function CompanyBasics({
24872
24875
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
24873
24876
  valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
24874
24877
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
24875
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
24878
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
24879
+ exemptedFromTax: "iDontHaveATaxId"
24880
+ }),
24876
24881
  mask: formUtils.getMask("taxInformation"),
24877
24882
  helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
24878
24883
  guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
@@ -24880,7 +24885,10 @@ function CompanyBasics({
24880
24885
  handleChangeFor,
24881
24886
  canExempt: formUtils.isRequiredField("exemptedFromTax"),
24882
24887
  isUen: formUtils.isRequiredField("isUen"),
24883
- country: formData.country
24888
+ country: formData.country,
24889
+ companyType: companyType2 ?? CompanyTypesValue.PRIVATE_COMPANY,
24890
+ taxIdNumberType,
24891
+ setTaxIdNumberType
24884
24892
  })
24885
24893
  }), hasCompanySearchProvider && jsx(CompanyLookupComponent, {
24886
24894
  defaultData: data,
@@ -24903,7 +24911,7 @@ function CompanyBasics({
24903
24911
  })]
24904
24912
  });
24905
24913
  }
24906
- 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));
24914
+ 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));
24907
24915
  const BUSINESS_REGISTRATION_NUMBER_FIELD = ["registrationNumber", "exemptedFromRegistrationNumber"];
24908
24916
  function BusinessRegistrationNumberField({
24909
24917
  data,
@@ -24914,11 +24922,38 @@ function BusinessRegistrationNumberField({
24914
24922
  guidanceText,
24915
24923
  placeholders,
24916
24924
  readonly,
24925
+ handleChangeFor,
24926
+ country: country2,
24917
24927
  canExempt,
24918
- handleChangeFor
24928
+ companyType: companyType2,
24929
+ registrationNumberOptions,
24930
+ registrationNumberType,
24931
+ setRegistrationNumberType
24919
24932
  }) {
24920
- return jsxs(Fragment, {
24921
- children: [jsx(MaskedInputText, {
24933
+ const showExemptedOption = canExempt && !!registrationNumberOptions && registrationNumberOptions.length > 1;
24934
+ const handleCompanyRegistrationNumberTypeChange = (regNumberType) => {
24935
+ if (regNumberType === "exempted") {
24936
+ if (!canExempt) {
24937
+ throw Error(`${country2} does not allow tax exemptions`);
24938
+ }
24939
+ handleChangeFor("exemptedFromRegistrationNumber")(true);
24940
+ setRegistrationNumberType(void 0);
24941
+ return;
24942
+ }
24943
+ if (canExempt && data.exemptedFromRegistrationNumber === true) {
24944
+ handleChangeFor("exemptedFromRegistrationNumber")(false);
24945
+ }
24946
+ setRegistrationNumberType(regNumberType);
24947
+ };
24948
+ return jsxs("div", {
24949
+ className: "adyen-kyc-field__business-registration",
24950
+ children: [jsx(CompanyRegistrationNumberTypeSelector, {
24951
+ companyType: companyType2,
24952
+ country: country2,
24953
+ setSelected: handleCompanyRegistrationNumberTypeChange,
24954
+ selected: data.exemptedFromRegistrationNumber ? "exempted" : registrationNumberType,
24955
+ exemptedOption: showExemptedOption ? labels2.exemptedFromRegistrationNumber : false
24956
+ }), jsx(MaskedInputText, {
24922
24957
  "aria-required": true,
24923
24958
  "aria-label": labels2.registrationNumber,
24924
24959
  "aria-invalid": !valid.registrationNumber,
@@ -25063,13 +25098,38 @@ function VatNumberField({
25063
25098
  placeholders,
25064
25099
  readonly,
25065
25100
  handleChangeFor,
25066
- canExempt
25101
+ canExempt,
25102
+ country: country2,
25103
+ vatNumberType,
25104
+ setVatNumberType
25067
25105
  }) {
25106
+ var _a;
25068
25107
  const {
25069
25108
  i18n
25070
25109
  } = useI18nContext();
25071
- return jsxs(Fragment, {
25072
- children: [jsx(MaskedInputText, {
25110
+ const showVatExemptedOption = canExempt && ((_a = taxIdNumberOptions[country2]) == null ? void 0 : _a.length) > 1;
25111
+ const handleVatNumberTypeChange = (vatType) => {
25112
+ if (vatType === "exempted") {
25113
+ if (!canExempt) {
25114
+ throw Error(`${country2} does not allow VAT exemptions`);
25115
+ }
25116
+ handleChangeFor("exemptedFromVat")(true);
25117
+ setVatNumberType(void 0);
25118
+ return;
25119
+ }
25120
+ if (canExempt && data.exemptedFromVat === true) {
25121
+ handleChangeFor("exemptedFromVat")(false);
25122
+ }
25123
+ setVatNumberType(vatType);
25124
+ };
25125
+ return jsxs("div", {
25126
+ className: "adyen-kyc-field__vat-number",
25127
+ children: [jsx(TaxIdNumberTypeSelector, {
25128
+ country: country2,
25129
+ setSelected: handleVatNumberTypeChange,
25130
+ selected: data.exemptedFromVat ? "exempted" : vatNumberType,
25131
+ exemptedOption: showVatExemptedOption ? labels2.exemptedFromVat : false
25132
+ }), jsx(MaskedInputText, {
25073
25133
  "aria-required": true,
25074
25134
  "aria-label": labels2.vatNumber,
25075
25135
  "aria-invalid": !valid.vatNumber,
@@ -25089,7 +25149,7 @@ function VatNumberField({
25089
25149
  disabled: data.exemptedFromVat,
25090
25150
  readonly,
25091
25151
  ...mask
25092
- }), canExempt && jsx(Checkbox, {
25152
+ }), canExempt && !showVatExemptedOption && jsx(Checkbox, {
25093
25153
  "aria-required": false,
25094
25154
  "aria-label": labels2 == null ? void 0 : labels2.exemptedFromVat,
25095
25155
  "aria-invalid": false,
@@ -25146,14 +25206,17 @@ function CompanyOtherDetails({
25146
25206
  i18n
25147
25207
  } = useI18nContext();
25148
25208
  const {
25149
- sliceData,
25150
25209
  updateStateSlice
25151
25210
  } = useGlobalDataSlice(COMPANY_OTHER_DETAILS_FORM_ID);
25152
- 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);
25153
- 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);
25154
- const [taxIdentificationNumberType, setTaxIdentificationNumberType] = useState$1(existingTaxIdentificationNumber ? inferTaxIdNumberType(existingTaxIdentificationNumber, country2) : (_d = taxIdNumberOptions[country2]) == null ? void 0 : _d[0].id);
25211
+ const registrationNumberOptions = useMemo$1(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
25212
+ const defaultRegistrationNumberType = (data == null ? void 0 : data.registrationNumber) ? inferCompanyRegistrationNumberType(data == null ? void 0 : data.registrationNumber, country2, companyType2) : registrationNumberOptions == null ? void 0 : registrationNumberOptions[0].id;
25213
+ const [registrationNumberType, setRegistrationNumberType] = useState$1(defaultRegistrationNumberType);
25214
+ 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;
25215
+ const [vatNumberType, setVatNumberType] = useState$1(defaultVatNumberType);
25216
+ const existingTaxId = (_c = (_b = data == null ? void 0 : data.taxInformation) == null ? void 0 : _b.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _c.number;
25217
+ const defaultTaxIdNumberType = existingTaxId ? inferTaxIdNumberType(existingTaxId, country2) : (_d = getTaxIdNumberOptions(country2, companyType2)) == null ? void 0 : _d[0].id;
25218
+ const [taxIdNumberType, setTaxIdNumberType] = useState$1(defaultTaxIdNumberType);
25155
25219
  const directChildFields = companyOtherDetailsFields.filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
25156
- 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]);
25157
25220
  const initialFormUtilsProps = useMemo$1(() => ({
25158
25221
  labels: labels2,
25159
25222
  placeholders,
@@ -25196,27 +25259,26 @@ function CompanyOtherDetails({
25196
25259
  }, defaultFieldMetadata$8), acc);
25197
25260
  case "taxInformation":
25198
25261
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
25199
- taxIdNumberType: taxIdentificationNumberType
25262
+ taxIdNumberType
25200
25263
  }, defaultFieldMetadata), acc);
25201
25264
  case "vatNumber":
25202
25265
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$6[country2], {
25203
- vatNumberType: taxIdentificationNumberType
25266
+ vatNumberType
25204
25267
  }, defaultFieldMetadata$6), acc);
25205
25268
  default:
25206
25269
  return acc;
25207
25270
  }
25208
25271
  }, initialFormUtilsProps);
25209
- }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdentificationNumberType]);
25272
+ }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdNumberType, vatNumberType]);
25210
25273
  const {
25211
25274
  schema: formSchema,
25212
25275
  data: formData,
25213
25276
  errors: formErrors,
25214
25277
  valid: formValid,
25215
25278
  fieldProblems: formFieldProblems,
25216
- handleChangeFor,
25217
- triggerValidation
25279
+ handleChangeFor
25218
25280
  } = useForm({
25219
- schema,
25281
+ schema: (currentData) => !currentData.exemptedFromVat ? (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatAbsenceReason")) ?? directChildFields : (requiredFields == null ? void 0 : requiredFields.filter((field) => field !== "vatNumber")) ?? directChildFields,
25220
25282
  defaultData: data,
25221
25283
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
25222
25284
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
@@ -25225,14 +25287,6 @@ function CompanyOtherDetails({
25225
25287
  shouldValidate
25226
25288
  });
25227
25289
  const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
25228
- const handleBusinessRegistrationNumberTypeChange = useCallback$1((type) => {
25229
- setRegistrationNumberType(type);
25230
- triggerValidation(["registrationNumber"]);
25231
- }, [triggerValidation]);
25232
- const handleTaxIdentificationNumberTypeChange = useCallback$1((type) => {
25233
- setTaxIdentificationNumberType(type);
25234
- triggerValidation(["vatNumber", "taxInformation"]);
25235
- }, [triggerValidation]);
25236
25290
  useEffect$1(() => {
25237
25291
  }, [kompanyVerifiedData]);
25238
25292
  useEffect$1(() => {
@@ -25272,44 +25326,46 @@ function CompanyOtherDetails({
25272
25326
  handleChangeFor,
25273
25327
  legalCompanyName: legalCompanyName2
25274
25328
  })
25275
- }), formUtils.isRequiredField("registrationNumber") && jsx(CompanyRegistrationNumberTypeSelector, {
25276
- companyType: companyType2,
25277
- country: country2,
25278
- setSelected: handleBusinessRegistrationNumberTypeChange,
25279
- selected: registrationNumberType
25280
25329
  }), formUtils.isRequiredField("registrationNumber") && jsx("div", {
25281
25330
  className: "adyen-kyc-field-wrapper",
25282
25331
  children: jsx(BusinessRegistrationNumberField, {
25283
25332
  data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
25284
25333
  valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
25285
25334
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
25286
- labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD),
25335
+ labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
25336
+ exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
25337
+ }),
25287
25338
  mask: formUtils.getMask("registrationNumber"),
25288
25339
  guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25289
25340
  placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
25290
25341
  helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25291
25342
  readonly: formUtils.isReadOnly("registrationNumber"),
25292
25343
  handleChangeFor,
25293
- canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber")
25344
+ country: country2,
25345
+ canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
25346
+ companyType: companyType2,
25347
+ registrationNumberOptions,
25348
+ registrationNumberType,
25349
+ setRegistrationNumberType
25294
25350
  })
25295
- }), formUtils.isRequiredField("vatNumber") && jsx(TaxIdNumberTypeSelector, {
25296
- country: country2,
25297
- setSelected: handleTaxIdentificationNumberTypeChange,
25298
- selected: taxIdentificationNumberType
25299
25351
  }), formUtils.isRequiredField("vatNumber") && jsx("div", {
25300
25352
  className: "adyen-kyc-field-wrapper",
25301
25353
  children: jsx(VatNumberField, {
25302
25354
  data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
25303
25355
  valid: formUtils.getFieldValid(formValid, VAT_NUMBER_FIELD),
25304
25356
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, VAT_NUMBER_FIELD),
25305
- labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD),
25357
+ labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD, {
25358
+ exemptedFromVat: "iDontHaveAVatNumber"
25359
+ }),
25306
25360
  mask: formUtils.getMask("vatNumber"),
25307
25361
  guidanceText: formUtils.getFieldGuidanceText(VAT_NUMBER_FIELD),
25308
25362
  placeholders: formUtils.getFieldPlaceholders(VAT_NUMBER_FIELD),
25309
25363
  readonly: formUtils.isReadOnly("vatNumber"),
25310
25364
  handleChangeFor,
25311
25365
  country: country2,
25312
- canExempt: formUtils.isRequiredField("exemptedFromVat")
25366
+ canExempt: formUtils.isRequiredField("exemptedFromVat"),
25367
+ vatNumberType,
25368
+ setVatNumberType
25313
25369
  })
25314
25370
  }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25315
25371
  className: "adyen-kyc-field-wrapper",
@@ -25317,7 +25373,9 @@ function CompanyOtherDetails({
25317
25373
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
25318
25374
  valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
25319
25375
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
25320
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
25376
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25377
+ exemptedFromTax: "iDontHaveATaxId"
25378
+ }),
25321
25379
  mask: formUtils.getMask("taxInformation"),
25322
25380
  helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25323
25381
  guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
@@ -25325,7 +25383,10 @@ function CompanyOtherDetails({
25325
25383
  handleChangeFor,
25326
25384
  country: country2,
25327
25385
  canExempt: formUtils.isRequiredField("exemptedFromTax"),
25328
- isUen: formUtils.isRequiredField("isUen")
25386
+ isUen: formUtils.isRequiredField("isUen"),
25387
+ companyType: companyType2,
25388
+ taxIdNumberType,
25389
+ setTaxIdNumberType
25329
25390
  })
25330
25391
  }), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
25331
25392
  className: "adyen-kyc-field-wrapper",
@@ -25416,11 +25477,16 @@ function CompanyStructure({
25416
25477
  requiredFields
25417
25478
  }, i18n);
25418
25479
  const disabled = Boolean((_a = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a.entityType) || formUtils.isReadOnly("entityType");
25480
+ const prevVerifiedDataRef = useRef(kompanyVerifiedData);
25419
25481
  useEffect(() => {
25420
- var _a2, _b;
25482
+ var _a2, _b, _c, _d, _e;
25421
25483
  if ((_a2 = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a2.entityType) {
25422
25484
  handleChangeFor("entityType")((_b = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _b.entityType);
25423
25485
  }
25486
+ 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)) {
25487
+ handleChangeFor("entityType")(void 0);
25488
+ }
25489
+ prevVerifiedDataRef.current = kompanyVerifiedData;
25424
25490
  }, [kompanyVerifiedData]);
25425
25491
  useEffect(() => {
25426
25492
  updateStateSlice({
@@ -25933,7 +25999,7 @@ function useCompanySearchTaskSubmit({
25933
25999
  };
25934
26000
  }
25935
26001
  function CompanySearchComponent(props) {
25936
- var _a, _b;
26002
+ var _a, _b, _c;
25937
26003
  const {
25938
26004
  i18n
25939
26005
  } = useI18nContext();
@@ -25964,6 +26030,7 @@ function CompanySearchComponent(props) {
25964
26030
  id: forms.companyBasics.formId,
25965
26031
  heading: i18n.get(forms.companyBasics.formName),
25966
26032
  country: country2,
26033
+ companyType: (_a = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _a.entityType,
25967
26034
  isTopLevelEntity,
25968
26035
  baseTrackingPayload,
25969
26036
  handleCompanyIndexSearch,
@@ -26006,8 +26073,8 @@ function CompanySearchComponent(props) {
26006
26073
  id: forms.companyOtherDetails.formId,
26007
26074
  heading: i18n.get(forms.companyOtherDetails.formName),
26008
26075
  country: country2,
26009
- legalCompanyName: (_a = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _a.legalCompanyName,
26010
- companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26076
+ legalCompanyName: (_b = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _b.legalCompanyName,
26077
+ companyType: (_c = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _c.entityType,
26011
26078
  kompanyVerifiedData
26012
26079
  })
26013
26080
  }), jsx("div", {
@@ -26365,12 +26432,6 @@ function useAssociatedLegalArrangement({
26365
26432
  associatedLegalArrangement
26366
26433
  };
26367
26434
  }
26368
- const useShouldShowBusinessTypeSelection = (accountHolder2) => {
26369
- const {
26370
- isExperimentEnabled
26371
- } = useExperimentsContext();
26372
- return isExperimentEnabled("EnableNewEntryFlow") && !accountHolder2;
26373
- };
26374
26435
  const logger$a = createLogger("useExemptSettlor");
26375
26436
  const useExemptSettlor = ({
26376
26437
  trust: trust2,
@@ -26389,6 +26450,11 @@ const useExemptSettlor = ({
26389
26450
  }, [trust2, updateExemptSettlor]);
26390
26451
  return exemptSettlor;
26391
26452
  };
26453
+ const leIdStorageKey = "LE_ID";
26454
+ const useLeId = () => {
26455
+ const [leIdFromLocalStorage, setLeIdIntoLocalStorage] = useLocalStorage(leIdStorageKey, null);
26456
+ return [leIdFromLocalStorage, setLeIdIntoLocalStorage];
26457
+ };
26392
26458
  function useSalesChannelsSettings() {
26393
26459
  const {
26394
26460
  isSettingEnabled
@@ -26856,8 +26922,6 @@ const BusinessTypeSelection = ({
26856
26922
  const defaultBusinessType = getBusinessType(businessTypeOptions, accountHolder2, legalEntityResponse == null ? void 0 : legalEntityResponse.type, (_b = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _b.type);
26857
26923
  const getDefaultLegalArrangementSelection = () => legalArrangementOptions.find((item) => item.id === getDefaultLegalArrangementOrSuborganizationType(legalEntityResponse, accountHolder2));
26858
26924
  const defaultLegalArrangementType = getDefaultLegalArrangementSelection();
26859
- console.log("defaultBusinessType", defaultBusinessType);
26860
- console.log("defaultLegalArrangementType", defaultLegalArrangementType);
26861
26925
  const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
26862
26926
  const {
26863
26927
  handleChangeFor,
@@ -27874,6 +27938,22 @@ const introductionScreensByLegalEntityType = {
27874
27938
  [LegalEntityType.SOLE_PROPRIETORSHIP]: [IntroductionScreens.PROLOGUE, IntroductionScreens.INDIVIDUAL, IntroductionScreens.SOLE_PROPRIETOR_COMPANY, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE],
27875
27939
  [LegalEntityType.TRUST]: [IntroductionScreens.PROLOGUE, IntroductionScreens.COMPANY, IntroductionScreens.INDIVIDUAL, IntroductionScreens.DECISION_MAKER, IntroductionScreens.TRUST, IntroductionScreens.TRUST_MEMBER_OVERVIEW, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE]
27876
27940
  };
27941
+ var IntroductionScreenEvent = /* @__PURE__ */ ((IntroductionScreenEvent2) => {
27942
+ IntroductionScreenEvent2["EMPTY"] = "Introduction_Empty";
27943
+ IntroductionScreenEvent2["START_FLOW"] = "Introduction_StartFlow";
27944
+ IntroductionScreenEvent2["START_SCREEN"] = "Introduction_StartScreen";
27945
+ IntroductionScreenEvent2["STOP_SCREEN"] = "Introduction_StopScreen";
27946
+ IntroductionScreenEvent2["STOP_FLOW"] = "Introduction_StopFlow";
27947
+ IntroductionScreenEvent2["NEXT"] = "Introduction_Next";
27948
+ IntroductionScreenEvent2["BACK"] = "Introduction_Back";
27949
+ IntroductionScreenEvent2["SKIP"] = "Introduction_Skip";
27950
+ return IntroductionScreenEvent2;
27951
+ })(IntroductionScreenEvent || {});
27952
+ var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
27953
+ IntroductionScreenTiming2["VIEW_FLOW"] = "Introduction_ViewFlow";
27954
+ IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
27955
+ return IntroductionScreenTiming2;
27956
+ })(IntroductionScreenTiming || {});
27877
27957
  const useIntroductionScreens = ({
27878
27958
  legalEntity,
27879
27959
  tasks
@@ -27995,10 +28075,30 @@ const Introduction = ({
27995
28075
  tasks
27996
28076
  });
27997
28077
  const [activeIndex, setActiveIndex] = useState(0);
28078
+ const eventSegmentationDefaults = getBaseTrackingPayload({
28079
+ trackingConfig: {
28080
+ topLevelLegalEntity: legalEntity
28081
+ },
28082
+ legalEntity,
28083
+ task: TaskTypes.INTRODUCTION
28084
+ });
28085
+ const eventDetails = {
28086
+ segmentation: {
28087
+ ...eventSegmentationDefaults,
28088
+ page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : null
28089
+ }
28090
+ };
27998
28091
  useEffect(() => {
27999
- if (!(introductionScreens == null ? void 0 : introductionScreens.length))
28092
+ if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
28093
+ userEvents.addEvent(IntroductionScreenEvent.EMPTY, {
28094
+ segmentation: eventSegmentationDefaults
28095
+ });
28000
28096
  onExitIntroduction();
28001
- }, [onExitIntroduction, introductionScreens]);
28097
+ } else {
28098
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_FLOW);
28099
+ userEvents.addEvent(IntroductionScreenEvent.START_FLOW, eventDetails);
28100
+ }
28101
+ }, [introductionScreens]);
28002
28102
  return (introductionScreens == null ? void 0 : introductionScreens.length) ? jsxs("div", {
28003
28103
  className: "adyen-kyc-introduction",
28004
28104
  children: [jsx(StepProgressIndicator, {
@@ -28008,7 +28108,10 @@ const Introduction = ({
28008
28108
  className: "adyen-kyc-introduction__skip",
28009
28109
  children: jsx(Button, {
28010
28110
  label: i18n.get("goToOverviewFromIntroduction"),
28011
- onClick: () => onExitIntroduction(),
28111
+ onClick: () => {
28112
+ userEvents.addEvent(IntroductionScreenEvent.SKIP, eventDetails);
28113
+ onExitIntroduction();
28114
+ },
28012
28115
  showAsLink: true,
28013
28116
  type: "button"
28014
28117
  })
@@ -28022,16 +28125,36 @@ const Introduction = ({
28022
28125
  children: [jsx(Button, {
28023
28126
  disabled: activeIndex === 0,
28024
28127
  label: "Back",
28025
- onClick: () => setActiveIndex((currentValue) => currentValue - 1),
28128
+ onClick: () => {
28129
+ userEvents.addEvent(IntroductionScreenEvent.BACK, eventDetails);
28130
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28131
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28132
+ setActiveIndex((currentValue) => currentValue - 1);
28133
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
28134
+ userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
28135
+ },
28026
28136
  secondary: true,
28027
28137
  type: "button"
28028
28138
  }), activeIndex + 1 === introductionScreens.length ? jsx(Button, {
28029
28139
  label: "Start",
28030
- onClick: () => onExitIntroduction(),
28140
+ onClick: () => {
28141
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28142
+ userEvents.addEvent(IntroductionScreenEvent.STOP_FLOW, eventDetails);
28143
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28144
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_FLOW, eventDetails);
28145
+ onExitIntroduction();
28146
+ },
28031
28147
  type: "button"
28032
28148
  }) : jsx(Button, {
28033
28149
  label: "Next",
28034
- onClick: () => setActiveIndex((currentValue) => currentValue + 1),
28150
+ onClick: () => {
28151
+ userEvents.addEvent(IntroductionScreenEvent.NEXT, eventDetails);
28152
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28153
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28154
+ setActiveIndex((currentValue) => currentValue + 1);
28155
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
28156
+ userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
28157
+ },
28035
28158
  type: "button"
28036
28159
  })]
28037
28160
  })]
@@ -28393,6 +28516,7 @@ function TaskListComponent({
28393
28516
  const {
28394
28517
  isExperimentEnabled
28395
28518
  } = useExperimentsContext();
28519
+ const limitToOneTransferInstrument = useSetting("limitToOneTransferInstrument");
28396
28520
  const isEnableNewEntryFlowEnabled = useEnableNewEntryFlow();
28397
28521
  const canSeeIntroduction = useCanSeeIntroduction({
28398
28522
  legalEntity: legalEntityResponse
@@ -28540,7 +28664,7 @@ function TaskListComponent({
28540
28664
  capabilityProblems,
28541
28665
  onNavigateToTask: () => handleOnNavigateToTaskPayout(transferInstrument.id),
28542
28666
  onTransferInstrumentDelete: () => onTransferInstrumentDelete(transferInstrument.id)
28543
- }, transferInstrument.id)), jsxs(Card, {
28667
+ }, transferInstrument.id)), !limitToOneTransferInstrument || transferInstruments.length < 1 ? jsxs(Card, {
28544
28668
  stateful: true,
28545
28669
  onClick: () => handleOnNavigateToTaskPayout(),
28546
28670
  className: "adyen-task adl-add-payout",
@@ -28551,7 +28675,7 @@ function TaskListComponent({
28551
28675
  }), jsx("span", {
28552
28676
  children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
28553
28677
  })]
28554
- })]
28678
+ }) : null]
28555
28679
  }) : jsx(TaskListItem, {
28556
28680
  onNavigateToTask: () => handleOnNavigateToTaskPayout(),
28557
28681
  icon: "payout",
@@ -31741,7 +31865,8 @@ function DropinComposerComponent({
31741
31865
  showToast
31742
31866
  } = useToastContext();
31743
31867
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
31744
- const showBusinessTypeSelection = useShouldShowBusinessTypeSelection(accountHolder2);
31868
+ const isNewEntryFlowEnabled = isExperimentEnabled("EnableNewEntryFlow");
31869
+ const [leId, setLeId] = useLeId();
31745
31870
  const showIntroduction = useShouldShowIntroduction({
31746
31871
  legalEntity: legalEntityResponse
31747
31872
  });
@@ -31752,12 +31877,13 @@ function DropinComposerComponent({
31752
31877
  });
31753
31878
  const [tasks, setTasks] = useState([]);
31754
31879
  const initialTask = useMemo(() => {
31755
- if (showBusinessTypeSelection)
31880
+ if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
31756
31881
  return TaskTypes.BUSINESS_TYPE_SELECTION;
31882
+ }
31757
31883
  if (showIntroduction)
31758
31884
  return TaskTypes.INTRODUCTION;
31759
31885
  return TaskTypes.TASKS_OVERVIEW;
31760
- }, [showBusinessTypeSelection, showIntroduction]);
31886
+ }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
31761
31887
  const [taskHistory, setTaskHistory] = useState([initialTask]);
31762
31888
  const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
31763
31889
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
@@ -32281,6 +32407,12 @@ function DropinComposerComponent({
32281
32407
  clearInterval(timeoutId);
32282
32408
  };
32283
32409
  }, [refreshLegalEntity, rootLegalEntity, taskHistory]);
32410
+ useEffect(() => {
32411
+ if (!isNewEntryFlowEnabled || leId !== legalEntityResponse.id) {
32412
+ setLeId(null);
32413
+ setAccountHolder(null);
32414
+ }
32415
+ }, [isNewEntryFlowEnabled, setLeId]);
32284
32416
  if (isLoadingConfiguration) {
32285
32417
  return jsx(Shimmer, {});
32286
32418
  }
@@ -32294,6 +32426,7 @@ function DropinComposerComponent({
32294
32426
  legalEntityResponse: rootLegalEntity,
32295
32427
  accountHolder: accountHolder2,
32296
32428
  onAccountHolderSelect: async (newAccountHolder) => {
32429
+ setLeId(legalEntityResponse.id);
32297
32430
  setAccountHolder(newAccountHolder);
32298
32431
  await refreshLegalEntity();
32299
32432
  onNavigateTo(showIntroduction ? TaskTypes.INTRODUCTION : TaskTypes.TASKS_OVERVIEW);
@@ -33920,7 +34053,8 @@ const settingsDefaults = {
33920
34053
  hideOnboardingIntroductionOrganization: true,
33921
34054
  hideOnboardingIntroductionTrust: true,
33922
34055
  hideOnboardingIntroductionSoleProprietor: true,
33923
- viewOnboardingGuidance: false
34056
+ viewOnboardingGuidance: false,
34057
+ limitToOneTransferInstrument: false
33924
34058
  };
33925
34059
  function SettingsProvider({
33926
34060
  children,