@adyen/kyc-components 2.32.2 → 2.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/es/adyen-kyc-components.es.js +314 -129
  2. package/dist/style.css +9 -0
  3. package/dist/types/components/BankVerification/BankVerification.d.ts +1 -1
  4. package/dist/types/components/BankVerification/types.d.ts +5 -5
  5. package/dist/types/components/BusinessTypeSelection/utils.d.ts +2 -1
  6. package/dist/types/components/CompanyBasics/component/CompanyBasicsComponent.d.ts +1 -1
  7. package/dist/types/components/CompanyBasics/types.d.ts +5 -3
  8. package/dist/types/components/CompanyLookup/types.d.ts +4 -4
  9. package/dist/types/components/Individual/types.d.ts +2 -2
  10. package/dist/types/components/Introduction/constants.d.ts +14 -0
  11. package/dist/types/components/PayoutDetails/types.d.ts +2 -2
  12. package/dist/types/components/TaskList/types.d.ts +2 -2
  13. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  14. package/dist/types/components/internal/BusinessRegistrationNumberField/BusinessRegistrationNumberField.d.ts +1 -1
  15. package/dist/types/components/internal/BusinessRegistrationNumberField/types.d.ts +9 -0
  16. package/dist/types/components/internal/EntityAssociation/types.d.ts +2 -2
  17. package/dist/types/components/internal/Remove/types.d.ts +3 -3
  18. package/dist/types/components/internal/TaxInformationField/TaxInformationField.d.ts +1 -1
  19. package/dist/types/components/internal/TaxInformationField/types.d.ts +7 -0
  20. package/dist/types/components/internal/VatNumberField/VatNumberField.d.ts +1 -1
  21. package/dist/types/components/internal/VatNumberField/types.d.ts +4 -0
  22. package/dist/types/core/Context/ExperimentContext/types.d.ts +2 -1
  23. package/dist/types/core/Context/ReactQueryContext/ReactQueryClient.d.ts +2 -0
  24. package/dist/types/core/Context/ReactQueryContext/ReactQueryProvider.d.ts +4 -0
  25. package/dist/types/core/Context/SettingsContext/types.d.ts +2 -0
  26. package/dist/types/core/Context/SettingsContext/useSetting.d.ts +1 -1
  27. package/dist/types/core/hooks/introduction/useHasSeenIntroduction.d.ts +1 -1
  28. package/dist/types/core/hooks/useCompanySearch/types.d.ts +2 -2
  29. package/dist/types/core/hooks/useCompanySearchTaskSubmit.d.ts +4 -3
  30. package/dist/types/core/hooks/useForm/types.d.ts +8 -8
  31. package/dist/types/core/hooks/useFormComposer.d.ts +2 -2
  32. package/dist/types/core/hooks/useLeId.d.ts +1 -0
  33. package/dist/types/core/hooks/useLocalStorage.d.ts +2 -2
  34. package/dist/types/language/config.d.ts +2 -1235
  35. package/dist/types/language/types.d.ts +1 -1
  36. package/dist/types/utils/entity-status-util.d.ts +1 -1
  37. package/dist/types/utils/useStateFromProp.d.ts +2 -2
  38. package/package.json +9 -5
  39. package/dist/types/core/hooks/useBusinessTypeSelection.d.ts +0 -2
@@ -2,12 +2,13 @@ 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";
9
9
  import "@adyen/adyen-document-viewer/dist/adyen-document-viewer.min.css";
10
10
  import AdyenDocumentViewer from "@adyen/adyen-document-viewer";
11
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
11
12
  const ConfigurationApiContext = createContext(void 0);
12
13
  const useConfigurationApi = () => {
13
14
  const configurationApi = useContext(ConfigurationApiContext);
@@ -16,6 +17,15 @@ const useConfigurationApi = () => {
16
17
  }
17
18
  return configurationApi;
18
19
  };
20
+ const smartling = {
21
+ placeholder_format: "YAML",
22
+ translate_paths: [
23
+ {
24
+ path: "*",
25
+ key: "{*}"
26
+ }
27
+ ]
28
+ };
19
29
  const close = "Close";
20
30
  const individual = "Individual";
21
31
  const payoutAccount = "Payout account";
@@ -617,7 +627,7 @@ const noGlare = "No glare";
617
627
  const selectDocumentType = "Select document type";
618
628
  const registrationDocumentSubTitle = "Upload your company’s business registration document. We need to see this document so we can verify your company.";
619
629
  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";
620
- 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.";
630
+ 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.";
621
631
  const containsNameOfCompany = "Contains the name of your company or organization";
622
632
  const documentShowsTaxIdOfCompany = "The document shows the tax ID number of the company";
623
633
  const issuedByTheTaxAuthority = "Issued by the tax authority or government of the country where the company is registered";
@@ -865,14 +875,14 @@ const marketIdentifierCodeMIC = "Market Identifier Code (MIC)";
865
875
  const isin = "ISIN";
866
876
  const companyLookupResultsHeader = "Let's find your company";
867
877
  const companyLookupResultsHeader__searching = "Searching for companies...";
868
- const companyLookupResultsHeader__verifying = "Verifying tax information...";
878
+ const companyLookupResultsHeader__verifying = "Verifying company selection...";
869
879
  const companyLookupResultsHeader__noResults = "We couldn't find your company";
870
880
  const companyLookupResultsHeader__results = "Select your company";
871
881
  const companyLookupResultsHeader__searchFailure = "Sorry, something went wrong";
872
882
  const companyLookupResultsHeaderDescription__noResults = "No problem, let's enter your company details in the next steps.";
873
- const companyLookupResultsHeaderDescription__results = "This helps you to get verified quicker. If you can't find your company, you can always continue by pressing Next.";
883
+ 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.";
874
884
  const companyLookupResultsHeaderDescription__searchFailure = "If that doesn't work, press Next to continue.";
875
- const companyLookupResultsListAlert__title__verified = "Your tax information has been verified";
885
+ const companyLookupResultsListAlert__title__verified = "Your company details will be pre-filled in the relevant sections.";
876
886
  const companyLookupResultsListAlert__title__warning = "This company's TIN doesn't match yours";
877
887
  const companyLookupResultsListAlert__title__error = "Sorry, something went wrong. Try again or continue by pressing Next";
878
888
  const companyLookupResultsListAlert__description__warning = "Check the TIN you've entered, or select a different company.";
@@ -883,9 +893,9 @@ const companyStructureFormName = "Company structure";
883
893
  const companyStructureFormDescription = "What type of company do you have?";
884
894
  const companyOtherDetailsFormName = "Other details";
885
895
  const companyRegistrationDocumentFormName = "Registration document";
886
- const companyRegistrationDocumentFormDescription = "Please upload you companies registration document so we can verify your information.";
896
+ const companyRegistrationDocumentFormDescription = "Please upload your companies registration document so we can verify your information.";
887
897
  const companyTaxDocumentFormName = "Tax document";
888
- const companyTaxDocumentFormDescription = "Please upload you companies tax documents so we can verify your information.";
898
+ const companyTaxDocumentFormDescription = "Please upload your companies tax documents so we can verify your information.";
889
899
  const errorMessage_1_10 = "Information couldn’t be verified";
890
900
  const errorMessage_1_11 = "Document didn’t meet requirements";
891
901
  const errorMessage_1_12 = "Legal entity declined";
@@ -1108,6 +1118,7 @@ const errorMessage_2_8064 = "UBO through ownership was missing.";
1108
1118
  const errorMessage_2_8067 = "Signatory was missing.";
1109
1119
  const errorMessage_2_8141 = "Registration document was missing.";
1110
1120
  const errorMessage_2_8162 = "proofOfOrganizationTaxInfo was missing.";
1121
+ const errorMessage_2_8183 = "'webAddress' was missing.";
1111
1122
  const errorMessage_2_8189 = "UBO through control was missing.";
1112
1123
  const errorMessage_2_8193 = "Director was missing.";
1113
1124
  const errorMessage_3_10 = "Review of data is required";
@@ -1153,6 +1164,7 @@ const remediationMessage_1_705 = "Upload an official bank statement";
1153
1164
  const remediationMessage_2_123 = "You haven't added an owner";
1154
1165
  const remediationMessage_2_124 = "You haven't added a signatory";
1155
1166
  const remediationMessage_2_151 = "You haven't added a controlling person";
1167
+ const remediationMessage_2_178 = "Add 'webAddress' to business line.";
1156
1168
  const remediationMessage_2_185 = "You haven't added your directors";
1157
1169
  const remediationMessage_3_100 = "Check the above information, then click here to confirm.";
1158
1170
  const sameNameAsLegalName = "Same as legal name of the company";
@@ -1240,6 +1252,7 @@ const onboardingRedirectFinishedCtaButton = "View data";
1240
1252
  const onboardingRedirectLinkError = "Onboarding link not available at the moment, please try again later.";
1241
1253
  const onboardingRedirectOpenError = "Pop-up blocker prevented redirecting, please allow pop-ups for this site.";
1242
1254
  const defaultTrans = {
1255
+ smartling,
1243
1256
  close,
1244
1257
  individual,
1245
1258
  payoutAccount,
@@ -2340,6 +2353,7 @@ const defaultTrans = {
2340
2353
  errorMessage_2_8067,
2341
2354
  errorMessage_2_8141,
2342
2355
  errorMessage_2_8162,
2356
+ errorMessage_2_8183,
2343
2357
  errorMessage_2_8189,
2344
2358
  errorMessage_2_8193,
2345
2359
  errorMessage_3_10,
@@ -2385,6 +2399,7 @@ const defaultTrans = {
2385
2399
  remediationMessage_2_123,
2386
2400
  remediationMessage_2_124,
2387
2401
  remediationMessage_2_151,
2402
+ remediationMessage_2_178,
2388
2403
  remediationMessage_2_185,
2389
2404
  remediationMessage_3_100,
2390
2405
  sameNameAsLegalName,
@@ -2473,7 +2488,10 @@ const defaultTrans = {
2473
2488
  onboardingRedirectOpenError
2474
2489
  };
2475
2490
  const FALLBACK_LOCALE = "en-US";
2476
- const defaultTranslation = defaultTrans;
2491
+ const defaultTranslation = Object.entries(defaultTrans).reduce((acc, [translationKey, translationValue]) => translationKey !== "smartling" ? {
2492
+ ...acc,
2493
+ [translationKey]: translationValue
2494
+ } : acc, {});
2477
2495
  const determineAllowedAttributes = (allowedTags) => {
2478
2496
  const allowedAttributes = [];
2479
2497
  if (allowedTags.includes("a")) {
@@ -2695,6 +2713,7 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2695
2713
  SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
2696
2714
  SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
2697
2715
  SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
2716
+ SettingNames2["LimitToOneTransferInstrument"] = "limitToOneTransferInstrument";
2698
2717
  SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
2699
2718
  SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
2700
2719
  SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
@@ -8031,7 +8050,7 @@ function BusinessRegistrationNumber(props) {
8031
8050
  ...formUtils.getMask("registrationNumber")
8032
8051
  }), formUtils.isRequiredField("exemptedFromRegistrationNumber") && !showExemptedOption && jsx(Checkbox, {
8033
8052
  name: "exemptedFromRegistrationNumber",
8034
- label: formUtils.getLabel("exemptedFromRegistrationNumber"),
8053
+ label: formUtils.getLabel("iDontHaveARegistrationNumber"),
8035
8054
  value: "exemptedFromRegistrationNumber",
8036
8055
  readonly: formUtils.isReadOnly("exemptedFromRegistrationNumber"),
8037
8056
  classNameModifiers: ["exempted-from-registration"],
@@ -12980,6 +12999,9 @@ const rules$2 = ({
12980
12999
  if (country2 === "DE" && (companyType2 === CompanyTypesValue.GOVERNMENTAL_ORGANIZATION || companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE)) {
12981
13000
  return "REQUIRED";
12982
13001
  }
13002
+ if (country2 === "DK" && companyType2 === CompanyTypesValue.NON_PROFIT_OR_CHARITABLE) {
13003
+ return "REQUIRED";
13004
+ }
12983
13005
  },
12984
13006
  countryRequiresRegistrationNumberForSoleProps: () => {
12985
13007
  if (!COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION.includes(country2)) {
@@ -21806,7 +21828,7 @@ const entityProblemInitialState = {
21806
21828
  // default status - if the entity is not listed in the problems array
21807
21829
  validationErrors: {}
21808
21830
  };
21809
- const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8189"];
21831
+ const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8183", "2_8189"];
21810
21832
  const UNRELATED_INVALID_INPUT_ERROR_CODES = ["1_14", "2_901", "2_902"];
21811
21833
  function getCapabilityProblems(response, country2, isExperimentEnabled) {
21812
21834
  const capabilities = (response == null ? void 0 : response.capabilities) || {};
@@ -23202,12 +23224,20 @@ const legalArrangementItems = [{
23202
23224
  name: "associationIncorporated",
23203
23225
  description: "groupOfPeopleActingTogetherForNonCommercialPurpose"
23204
23226
  }];
23205
- const getLegalArrangementOptions = (country2) => legalArrangementItems.filter((legalArrangementItem) => legalArrangementItem.id !== "aTrust" || country2 && TRUST_COUNTRIES.includes(country2));
23206
- const getSelectionOptions = (legalEntityResponse) => {
23227
+ const getLegalArrangementOptions = (country2, experiments) => legalArrangementItems.filter((legalArrangementItem) => {
23228
+ if (legalArrangementItem.id !== "aTrust" && legalArrangementItem.id !== "partnershipUnincorporated") {
23229
+ return true;
23230
+ }
23231
+ if (legalArrangementItem.id === "partnershipUnincorporated" && (experiments == null ? void 0 : experiments.ShowUnsupportedEntityType)) {
23232
+ return true;
23233
+ }
23234
+ return country2 && TRUST_COUNTRIES.includes(country2);
23235
+ });
23236
+ const getSelectionOptions = (legalEntityResponse, experiments) => {
23207
23237
  var _a, _b, _c, _d;
23208
23238
  const country2 = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? (_b = (_a = legalEntityResponse.individual) == null ? void 0 : _a.residentialAddress) == null ? void 0 : _b.country : (_d = (_c = legalEntityResponse.organization) == null ? void 0 : _c.registeredAddress) == null ? void 0 : _d.country;
23209
23239
  const businessTypeOptions = getBusinessTypeOptions(country2);
23210
- const legalArrangementOptions = getLegalArrangementOptions(country2);
23240
+ const legalArrangementOptions = getLegalArrangementOptions(country2, experiments);
23211
23241
  return {
23212
23242
  businessTypeOptions,
23213
23243
  legalArrangementOptions
@@ -23927,30 +23957,19 @@ function useCompanySearch({
23927
23957
  deepSearch
23928
23958
  }) => {
23929
23959
  try {
23930
- if (!indexSearch || !deepSearch)
23960
+ if (!deepSearch)
23931
23961
  return;
23932
23962
  setStatus("loading");
23933
23963
  setCompaniesList([]);
23934
23964
  const {
23935
- results: indexSearchResults
23936
- } = await indexSearch({
23965
+ results: deepSearchResults
23966
+ } = await deepSearch({
23937
23967
  text: companyName2,
23938
23968
  country: companyCountry2,
23939
23969
  state: companyState,
23940
23970
  limit: resultsLimit
23941
23971
  });
23942
- if (!(indexSearchResults == null ? void 0 : indexSearchResults.length)) {
23943
- const {
23944
- results: deepSearchResults
23945
- } = await deepSearch({
23946
- text: companyName2,
23947
- country: companyCountry2,
23948
- state: companyState,
23949
- limit: resultsLimit
23950
- });
23951
- return setCompaniesList(deepSearchResults);
23952
- }
23953
- return setCompaniesList(indexSearchResults);
23972
+ return setCompaniesList(deepSearchResults);
23954
23973
  } catch (e) {
23955
23974
  setStatus("error");
23956
23975
  setError(e);
@@ -23963,37 +23982,26 @@ function useCompanySearch({
23963
23982
  return setStatus("idle");
23964
23983
  }
23965
23984
  try {
23966
- if (!handleCompanyIndexSearch || !handleCompanyDeepSearch)
23985
+ if (!handleCompanyDeepSearch)
23967
23986
  return;
23968
23987
  setStatus("loading");
23969
23988
  setSelectedCompanyId(void 0);
23970
23989
  const {
23971
- results: indexSearchResults
23972
- } = await handleCompanyIndexSearch({
23990
+ results: deepSearchResults
23991
+ } = await handleCompanyDeepSearch({
23973
23992
  text: legalCompanyName2,
23974
23993
  country: country2,
23975
23994
  state: stateOrProvince2,
23976
23995
  limit
23977
23996
  });
23978
- if (!(indexSearchResults == null ? void 0 : indexSearchResults.length)) {
23979
- const {
23980
- results: deepSearchResults
23981
- } = await handleCompanyDeepSearch({
23982
- text: legalCompanyName2,
23983
- country: country2,
23984
- state: stateOrProvince2,
23985
- limit
23986
- });
23987
- return setCompaniesList(deepSearchResults);
23988
- }
23989
- return setCompaniesList(indexSearchResults);
23997
+ return setCompaniesList(deepSearchResults);
23990
23998
  } catch (e) {
23991
23999
  setStatus("error");
23992
24000
  setError(e);
23993
24001
  } finally {
23994
24002
  setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
23995
24003
  }
23996
- }, [handleCompanyIndexSearch, handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
24004
+ }, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
23997
24005
  const verify2 = useCallback(async (companyTIN, company2) => {
23998
24006
  try {
23999
24007
  if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset)
@@ -24544,11 +24552,15 @@ function TaxInformationField({
24544
24552
  readonly,
24545
24553
  handleChangeFor,
24546
24554
  country: country2,
24547
- canExempt
24555
+ canExempt,
24556
+ companyType: companyType2,
24557
+ taxIdNumberType,
24558
+ setTaxIdNumberType
24548
24559
  }) {
24560
+ var _a;
24549
24561
  const currentCountryTaxInformation = useMemo(() => {
24550
- var _a;
24551
- 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);
24552
24564
  }, [data, country2]);
24553
24565
  const handleTaxInformationInput = (value) => {
24554
24566
  if (!data.taxInformation) {
@@ -24603,8 +24615,33 @@ function TaxInformationField({
24603
24615
  });
24604
24616
  return handleChangeFor("taxInformation", "blur")(updatedTaxInformation);
24605
24617
  };
24606
- return jsxs(Fragment, {
24607
- 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,
24608
24645
  name: "taxInformationNumber",
24609
24646
  label: labels2.taxInformation ?? "",
24610
24647
  formatGuidance: (guidanceText == null ? void 0 : guidanceText.taxInformation) ?? "",
@@ -24612,15 +24649,12 @@ function TaxInformationField({
24612
24649
  errorMessage: errors.taxInformation,
24613
24650
  placeholder: placeholders == null ? void 0 : placeholders.taxInformation,
24614
24651
  isValid: Boolean(valid.taxInformation),
24615
- "aria-required": true,
24616
- "aria-label": labels2.taxInformation,
24617
- "aria-invalid": !valid.taxInformation,
24618
24652
  onInput: handleTaxInformationInput,
24619
24653
  onBlur: handleTaxInformationBlur,
24620
24654
  disabled: data.exemptedFromTax,
24621
24655
  readonly,
24622
24656
  ...mask
24623
- }), canExempt && jsx(Checkbox, {
24657
+ }), canExempt && !showTaxIdExemptedOption && jsx(Checkbox, {
24624
24658
  "aria-required": false,
24625
24659
  "aria-label": labels2.exemptedFromTax,
24626
24660
  "aria-invalid": false,
@@ -24687,13 +24721,14 @@ function CompanyBasics({
24687
24721
  handleRefreshCompanyDataset,
24688
24722
  handleVerifyTin,
24689
24723
  country: country2,
24724
+ companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24690
24725
  isTopLevelEntity,
24691
24726
  baseTrackingPayload,
24692
24727
  kompanyVerifiedData,
24693
24728
  setKompanyAddress,
24694
24729
  setKompanyVerifiedData
24695
24730
  }) {
24696
- var _a, _b;
24731
+ var _a, _b, _c, _d, _e;
24697
24732
  const {
24698
24733
  i18n
24699
24734
  } = useI18nContext();
@@ -24705,6 +24740,9 @@ function CompanyBasics({
24705
24740
  } = useGlobalDataSlice(COMPANY_BASICS_FORM_ID);
24706
24741
  const [loading2, setLoading] = useState$1(false);
24707
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);
24708
24746
  const initialFormUtilsProps = useMemo$1(() => ({
24709
24747
  labels: labels2,
24710
24748
  placeholders,
@@ -24746,13 +24784,13 @@ function CompanyBasics({
24746
24784
  };
24747
24785
  case "taxInformation":
24748
24786
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
24749
- taxIdNumberType: countryToTaxInfoTypeMap[country2]
24787
+ taxIdNumberType
24750
24788
  }, defaultFieldMetadata), acc);
24751
24789
  default:
24752
24790
  return acc;
24753
24791
  }
24754
24792
  }, initialFormUtilsProps);
24755
- }, [country2, initialFormUtilsProps]);
24793
+ }, [country2, initialFormUtilsProps, taxIdNumberType]);
24756
24794
  const schema = (requiredFields == null ? void 0 : requiredFields.length) ? requiredFields : ["legalCompanyName", "country"];
24757
24795
  const {
24758
24796
  schema: formSchema,
@@ -24774,7 +24812,7 @@ function CompanyBasics({
24774
24812
  const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
24775
24813
  const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
24776
24814
  const hasCompanySearchProvider = formData.country && COUNTRIES_WITH_IN_APP_SEARCH_COMPANY_VERIFICATION.includes(formData.country);
24777
- 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;
24778
24816
  const disabled = (field) => formUtils.isReadOnly(field) || Boolean(kompanyVerifiedData) || loading2;
24779
24817
  useEffect$1(() => {
24780
24818
  updateStateSlice({
@@ -24837,7 +24875,9 @@ function CompanyBasics({
24837
24875
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
24838
24876
  valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
24839
24877
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
24840
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
24878
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
24879
+ exemptedFromTax: "iDontHaveATaxId"
24880
+ }),
24841
24881
  mask: formUtils.getMask("taxInformation"),
24842
24882
  helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
24843
24883
  guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
@@ -24845,7 +24885,10 @@ function CompanyBasics({
24845
24885
  handleChangeFor,
24846
24886
  canExempt: formUtils.isRequiredField("exemptedFromTax"),
24847
24887
  isUen: formUtils.isRequiredField("isUen"),
24848
- country: formData.country
24888
+ country: formData.country,
24889
+ companyType: companyType2 ?? CompanyTypesValue.PRIVATE_COMPANY,
24890
+ taxIdNumberType,
24891
+ setTaxIdNumberType
24849
24892
  })
24850
24893
  }), hasCompanySearchProvider && jsx(CompanyLookupComponent, {
24851
24894
  defaultData: data,
@@ -24868,7 +24911,7 @@ function CompanyBasics({
24868
24911
  })]
24869
24912
  });
24870
24913
  }
24871
- 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));
24872
24915
  const BUSINESS_REGISTRATION_NUMBER_FIELD = ["registrationNumber", "exemptedFromRegistrationNumber"];
24873
24916
  function BusinessRegistrationNumberField({
24874
24917
  data,
@@ -24879,11 +24922,38 @@ function BusinessRegistrationNumberField({
24879
24922
  guidanceText,
24880
24923
  placeholders,
24881
24924
  readonly,
24925
+ handleChangeFor,
24926
+ country: country2,
24882
24927
  canExempt,
24883
- handleChangeFor
24928
+ companyType: companyType2,
24929
+ registrationNumberOptions,
24930
+ registrationNumberType,
24931
+ setRegistrationNumberType
24884
24932
  }) {
24885
- return jsxs(Fragment, {
24886
- 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, {
24887
24957
  "aria-required": true,
24888
24958
  "aria-label": labels2.registrationNumber,
24889
24959
  "aria-invalid": !valid.registrationNumber,
@@ -25028,13 +25098,38 @@ function VatNumberField({
25028
25098
  placeholders,
25029
25099
  readonly,
25030
25100
  handleChangeFor,
25031
- canExempt
25101
+ canExempt,
25102
+ country: country2,
25103
+ vatNumberType,
25104
+ setVatNumberType
25032
25105
  }) {
25106
+ var _a;
25033
25107
  const {
25034
25108
  i18n
25035
25109
  } = useI18nContext();
25036
- return jsxs(Fragment, {
25037
- 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, {
25038
25133
  "aria-required": true,
25039
25134
  "aria-label": labels2.vatNumber,
25040
25135
  "aria-invalid": !valid.vatNumber,
@@ -25054,7 +25149,7 @@ function VatNumberField({
25054
25149
  disabled: data.exemptedFromVat,
25055
25150
  readonly,
25056
25151
  ...mask
25057
- }), canExempt && jsx(Checkbox, {
25152
+ }), canExempt && !showVatExemptedOption && jsx(Checkbox, {
25058
25153
  "aria-required": false,
25059
25154
  "aria-label": labels2 == null ? void 0 : labels2.exemptedFromVat,
25060
25155
  "aria-invalid": false,
@@ -25111,14 +25206,17 @@ function CompanyOtherDetails({
25111
25206
  i18n
25112
25207
  } = useI18nContext();
25113
25208
  const {
25114
- sliceData,
25115
25209
  updateStateSlice
25116
25210
  } = useGlobalDataSlice(COMPANY_OTHER_DETAILS_FORM_ID);
25117
- 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);
25118
- 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);
25119
- 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);
25120
25219
  const directChildFields = companyOtherDetailsFields.filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
25121
- 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]);
25122
25220
  const initialFormUtilsProps = useMemo$1(() => ({
25123
25221
  labels: labels2,
25124
25222
  placeholders,
@@ -25161,27 +25259,26 @@ function CompanyOtherDetails({
25161
25259
  }, defaultFieldMetadata$8), acc);
25162
25260
  case "taxInformation":
25163
25261
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig[country2], {
25164
- taxIdNumberType: taxIdentificationNumberType
25262
+ taxIdNumberType
25165
25263
  }, defaultFieldMetadata), acc);
25166
25264
  case "vatNumber":
25167
25265
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$6[country2], {
25168
- vatNumberType: taxIdentificationNumberType
25266
+ vatNumberType
25169
25267
  }, defaultFieldMetadata$6), acc);
25170
25268
  default:
25171
25269
  return acc;
25172
25270
  }
25173
25271
  }, initialFormUtilsProps);
25174
- }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdentificationNumberType]);
25272
+ }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdNumberType, vatNumberType]);
25175
25273
  const {
25176
25274
  schema: formSchema,
25177
25275
  data: formData,
25178
25276
  errors: formErrors,
25179
25277
  valid: formValid,
25180
25278
  fieldProblems: formFieldProblems,
25181
- handleChangeFor,
25182
- triggerValidation
25279
+ handleChangeFor
25183
25280
  } = useForm({
25184
- 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,
25185
25282
  defaultData: data,
25186
25283
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
25187
25284
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
@@ -25190,14 +25287,6 @@ function CompanyOtherDetails({
25190
25287
  shouldValidate
25191
25288
  });
25192
25289
  const formUtils = formUtilities(mergedFieldProps ?? initialFormUtilsProps, i18n);
25193
- const handleBusinessRegistrationNumberTypeChange = useCallback$1((type) => {
25194
- setRegistrationNumberType(type);
25195
- triggerValidation(["registrationNumber"]);
25196
- }, [triggerValidation]);
25197
- const handleTaxIdentificationNumberTypeChange = useCallback$1((type) => {
25198
- setTaxIdentificationNumberType(type);
25199
- triggerValidation(["vatNumber", "taxInformation"]);
25200
- }, [triggerValidation]);
25201
25290
  useEffect$1(() => {
25202
25291
  }, [kompanyVerifiedData]);
25203
25292
  useEffect$1(() => {
@@ -25237,44 +25326,46 @@ function CompanyOtherDetails({
25237
25326
  handleChangeFor,
25238
25327
  legalCompanyName: legalCompanyName2
25239
25328
  })
25240
- }), formUtils.isRequiredField("registrationNumber") && jsx(CompanyRegistrationNumberTypeSelector, {
25241
- companyType: companyType2,
25242
- country: country2,
25243
- setSelected: handleBusinessRegistrationNumberTypeChange,
25244
- selected: registrationNumberType
25245
25329
  }), formUtils.isRequiredField("registrationNumber") && jsx("div", {
25246
25330
  className: "adyen-kyc-field-wrapper",
25247
25331
  children: jsx(BusinessRegistrationNumberField, {
25248
25332
  data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
25249
25333
  valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
25250
25334
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
25251
- labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD),
25335
+ labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
25336
+ exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
25337
+ }),
25252
25338
  mask: formUtils.getMask("registrationNumber"),
25253
25339
  guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25254
25340
  placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
25255
25341
  helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25256
25342
  readonly: formUtils.isReadOnly("registrationNumber"),
25257
25343
  handleChangeFor,
25258
- canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber")
25344
+ country: country2,
25345
+ canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
25346
+ companyType: companyType2,
25347
+ registrationNumberOptions,
25348
+ registrationNumberType,
25349
+ setRegistrationNumberType
25259
25350
  })
25260
- }), formUtils.isRequiredField("vatNumber") && jsx(TaxIdNumberTypeSelector, {
25261
- country: country2,
25262
- setSelected: handleTaxIdentificationNumberTypeChange,
25263
- selected: taxIdentificationNumberType
25264
25351
  }), formUtils.isRequiredField("vatNumber") && jsx("div", {
25265
25352
  className: "adyen-kyc-field-wrapper",
25266
25353
  children: jsx(VatNumberField, {
25267
25354
  data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
25268
25355
  valid: formUtils.getFieldValid(formValid, VAT_NUMBER_FIELD),
25269
25356
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, VAT_NUMBER_FIELD),
25270
- labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD),
25357
+ labels: formUtils.getFieldLabels(VAT_NUMBER_FIELD, {
25358
+ exemptedFromVat: "iDontHaveAVatNumber"
25359
+ }),
25271
25360
  mask: formUtils.getMask("vatNumber"),
25272
25361
  guidanceText: formUtils.getFieldGuidanceText(VAT_NUMBER_FIELD),
25273
25362
  placeholders: formUtils.getFieldPlaceholders(VAT_NUMBER_FIELD),
25274
25363
  readonly: formUtils.isReadOnly("vatNumber"),
25275
25364
  handleChangeFor,
25276
25365
  country: country2,
25277
- canExempt: formUtils.isRequiredField("exemptedFromVat")
25366
+ canExempt: formUtils.isRequiredField("exemptedFromVat"),
25367
+ vatNumberType,
25368
+ setVatNumberType
25278
25369
  })
25279
25370
  }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25280
25371
  className: "adyen-kyc-field-wrapper",
@@ -25282,7 +25373,9 @@ function CompanyOtherDetails({
25282
25373
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
25283
25374
  valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
25284
25375
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
25285
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD),
25376
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25377
+ exemptedFromTax: "iDontHaveATaxId"
25378
+ }),
25286
25379
  mask: formUtils.getMask("taxInformation"),
25287
25380
  helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25288
25381
  guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
@@ -25290,7 +25383,10 @@ function CompanyOtherDetails({
25290
25383
  handleChangeFor,
25291
25384
  country: country2,
25292
25385
  canExempt: formUtils.isRequiredField("exemptedFromTax"),
25293
- isUen: formUtils.isRequiredField("isUen")
25386
+ isUen: formUtils.isRequiredField("isUen"),
25387
+ companyType: companyType2,
25388
+ taxIdNumberType,
25389
+ setTaxIdNumberType
25294
25390
  })
25295
25391
  }), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
25296
25392
  className: "adyen-kyc-field-wrapper",
@@ -25381,11 +25477,16 @@ function CompanyStructure({
25381
25477
  requiredFields
25382
25478
  }, i18n);
25383
25479
  const disabled = Boolean((_a = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a.entityType) || formUtils.isReadOnly("entityType");
25480
+ const prevVerifiedDataRef = useRef(kompanyVerifiedData);
25384
25481
  useEffect(() => {
25385
- var _a2, _b;
25482
+ var _a2, _b, _c, _d, _e;
25386
25483
  if ((_a2 = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _a2.entityType) {
25387
25484
  handleChangeFor("entityType")((_b = kompanyVerifiedData == null ? void 0 : kompanyVerifiedData.companyStructure) == null ? void 0 : _b.entityType);
25388
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;
25389
25490
  }, [kompanyVerifiedData]);
25390
25491
  useEffect(() => {
25391
25492
  updateStateSlice({
@@ -25898,7 +25999,7 @@ function useCompanySearchTaskSubmit({
25898
25999
  };
25899
26000
  }
25900
26001
  function CompanySearchComponent(props) {
25901
- var _a, _b;
26002
+ var _a, _b, _c;
25902
26003
  const {
25903
26004
  i18n
25904
26005
  } = useI18nContext();
@@ -25929,6 +26030,7 @@ function CompanySearchComponent(props) {
25929
26030
  id: forms.companyBasics.formId,
25930
26031
  heading: i18n.get(forms.companyBasics.formName),
25931
26032
  country: country2,
26033
+ companyType: (_a = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _a.entityType,
25932
26034
  isTopLevelEntity,
25933
26035
  baseTrackingPayload,
25934
26036
  handleCompanyIndexSearch,
@@ -25971,8 +26073,8 @@ function CompanySearchComponent(props) {
25971
26073
  id: forms.companyOtherDetails.formId,
25972
26074
  heading: i18n.get(forms.companyOtherDetails.formName),
25973
26075
  country: country2,
25974
- legalCompanyName: (_a = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _a.legalCompanyName,
25975
- 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,
25976
26078
  kompanyVerifiedData
25977
26079
  })
25978
26080
  }), jsx("div", {
@@ -26330,12 +26432,6 @@ function useAssociatedLegalArrangement({
26330
26432
  associatedLegalArrangement
26331
26433
  };
26332
26434
  }
26333
- const useShouldShowBusinessTypeSelection = (accountHolder2) => {
26334
- const {
26335
- isExperimentEnabled
26336
- } = useExperimentsContext();
26337
- return isExperimentEnabled("EnableNewEntryFlow") && !accountHolder2;
26338
- };
26339
26435
  const logger$a = createLogger("useExemptSettlor");
26340
26436
  const useExemptSettlor = ({
26341
26437
  trust: trust2,
@@ -26354,6 +26450,11 @@ const useExemptSettlor = ({
26354
26450
  }, [trust2, updateExemptSettlor]);
26355
26451
  return exemptSettlor;
26356
26452
  };
26453
+ const leIdStorageKey = "LE_ID";
26454
+ const useLeId = () => {
26455
+ const [leIdFromLocalStorage, setLeIdIntoLocalStorage] = useLocalStorage(leIdStorageKey, null);
26456
+ return [leIdFromLocalStorage, setLeIdIntoLocalStorage];
26457
+ };
26357
26458
  function useSalesChannelsSettings() {
26358
26459
  const {
26359
26460
  isSettingEnabled
@@ -26800,6 +26901,9 @@ const BusinessTypeSelection = ({
26800
26901
  const {
26801
26902
  showToast
26802
26903
  } = useToastContext();
26904
+ const {
26905
+ isExperimentEnabled
26906
+ } = useExperimentsContext();
26803
26907
  const [loadingStatus, setLoadingStatus] = useState();
26804
26908
  const [currentStep, setCurrentStep] = useState(
26805
26909
  0
@@ -26815,14 +26919,14 @@ const BusinessTypeSelection = ({
26815
26919
  const {
26816
26920
  businessTypeOptions,
26817
26921
  legalArrangementOptions
26818
- } = getSelectionOptions(legalEntityResponse);
26922
+ } = getSelectionOptions(legalEntityResponse, {
26923
+ ShowUnsupportedEntityType: isExperimentEnabled("ShowUnsupportedEntityType")
26924
+ });
26819
26925
  const currentLegalEntityType = legalEntityResponse == null ? void 0 : legalEntityResponse.type;
26820
26926
  const currentCompanyTypesValue = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.type;
26821
26927
  const defaultBusinessType = getBusinessType(businessTypeOptions, accountHolder2, legalEntityResponse == null ? void 0 : legalEntityResponse.type, (_b = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _b.type);
26822
26928
  const getDefaultLegalArrangementSelection = () => legalArrangementOptions.find((item) => item.id === getDefaultLegalArrangementOrSuborganizationType(legalEntityResponse, accountHolder2));
26823
26929
  const defaultLegalArrangementType = getDefaultLegalArrangementSelection();
26824
- console.log("defaultBusinessType", defaultBusinessType);
26825
- console.log("defaultLegalArrangementType", defaultLegalArrangementType);
26826
26930
  const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
26827
26931
  const {
26828
26932
  handleChangeFor,
@@ -27839,6 +27943,22 @@ const introductionScreensByLegalEntityType = {
27839
27943
  [LegalEntityType.SOLE_PROPRIETORSHIP]: [IntroductionScreens.PROLOGUE, IntroductionScreens.INDIVIDUAL, IntroductionScreens.SOLE_PROPRIETOR_COMPANY, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE],
27840
27944
  [LegalEntityType.TRUST]: [IntroductionScreens.PROLOGUE, IntroductionScreens.COMPANY, IntroductionScreens.INDIVIDUAL, IntroductionScreens.DECISION_MAKER, IntroductionScreens.TRUST, IntroductionScreens.TRUST_MEMBER_OVERVIEW, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE]
27841
27945
  };
27946
+ var IntroductionScreenEvent = /* @__PURE__ */ ((IntroductionScreenEvent2) => {
27947
+ IntroductionScreenEvent2["EMPTY"] = "Introduction_Empty";
27948
+ IntroductionScreenEvent2["START_FLOW"] = "Introduction_StartFlow";
27949
+ IntroductionScreenEvent2["START_SCREEN"] = "Introduction_StartScreen";
27950
+ IntroductionScreenEvent2["STOP_SCREEN"] = "Introduction_StopScreen";
27951
+ IntroductionScreenEvent2["STOP_FLOW"] = "Introduction_StopFlow";
27952
+ IntroductionScreenEvent2["NEXT"] = "Introduction_Next";
27953
+ IntroductionScreenEvent2["BACK"] = "Introduction_Back";
27954
+ IntroductionScreenEvent2["SKIP"] = "Introduction_Skip";
27955
+ return IntroductionScreenEvent2;
27956
+ })(IntroductionScreenEvent || {});
27957
+ var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
27958
+ IntroductionScreenTiming2["VIEW_FLOW"] = "Introduction_ViewFlow";
27959
+ IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
27960
+ return IntroductionScreenTiming2;
27961
+ })(IntroductionScreenTiming || {});
27842
27962
  const useIntroductionScreens = ({
27843
27963
  legalEntity,
27844
27964
  tasks
@@ -27960,10 +28080,30 @@ const Introduction = ({
27960
28080
  tasks
27961
28081
  });
27962
28082
  const [activeIndex, setActiveIndex] = useState(0);
28083
+ const eventSegmentationDefaults = getBaseTrackingPayload({
28084
+ trackingConfig: {
28085
+ topLevelLegalEntity: legalEntity
28086
+ },
28087
+ legalEntity,
28088
+ task: TaskTypes.INTRODUCTION
28089
+ });
28090
+ const eventDetails = {
28091
+ segmentation: {
28092
+ ...eventSegmentationDefaults,
28093
+ page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : null
28094
+ }
28095
+ };
27963
28096
  useEffect(() => {
27964
- if (!(introductionScreens == null ? void 0 : introductionScreens.length))
28097
+ if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
28098
+ userEvents.addEvent(IntroductionScreenEvent.EMPTY, {
28099
+ segmentation: eventSegmentationDefaults
28100
+ });
27965
28101
  onExitIntroduction();
27966
- }, [onExitIntroduction, introductionScreens]);
28102
+ } else {
28103
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_FLOW);
28104
+ userEvents.addEvent(IntroductionScreenEvent.START_FLOW, eventDetails);
28105
+ }
28106
+ }, [introductionScreens]);
27967
28107
  return (introductionScreens == null ? void 0 : introductionScreens.length) ? jsxs("div", {
27968
28108
  className: "adyen-kyc-introduction",
27969
28109
  children: [jsx(StepProgressIndicator, {
@@ -27973,7 +28113,10 @@ const Introduction = ({
27973
28113
  className: "adyen-kyc-introduction__skip",
27974
28114
  children: jsx(Button, {
27975
28115
  label: i18n.get("goToOverviewFromIntroduction"),
27976
- onClick: () => onExitIntroduction(),
28116
+ onClick: () => {
28117
+ userEvents.addEvent(IntroductionScreenEvent.SKIP, eventDetails);
28118
+ onExitIntroduction();
28119
+ },
27977
28120
  showAsLink: true,
27978
28121
  type: "button"
27979
28122
  })
@@ -27987,16 +28130,36 @@ const Introduction = ({
27987
28130
  children: [jsx(Button, {
27988
28131
  disabled: activeIndex === 0,
27989
28132
  label: "Back",
27990
- onClick: () => setActiveIndex((currentValue) => currentValue - 1),
28133
+ onClick: () => {
28134
+ userEvents.addEvent(IntroductionScreenEvent.BACK, eventDetails);
28135
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28136
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28137
+ setActiveIndex((currentValue) => currentValue - 1);
28138
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
28139
+ userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
28140
+ },
27991
28141
  secondary: true,
27992
28142
  type: "button"
27993
28143
  }), activeIndex + 1 === introductionScreens.length ? jsx(Button, {
27994
28144
  label: "Start",
27995
- onClick: () => onExitIntroduction(),
28145
+ onClick: () => {
28146
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28147
+ userEvents.addEvent(IntroductionScreenEvent.STOP_FLOW, eventDetails);
28148
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28149
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_FLOW, eventDetails);
28150
+ onExitIntroduction();
28151
+ },
27996
28152
  type: "button"
27997
28153
  }) : jsx(Button, {
27998
28154
  label: "Next",
27999
- onClick: () => setActiveIndex((currentValue) => currentValue + 1),
28155
+ onClick: () => {
28156
+ userEvents.addEvent(IntroductionScreenEvent.NEXT, eventDetails);
28157
+ userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
28158
+ userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
28159
+ setActiveIndex((currentValue) => currentValue + 1);
28160
+ userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
28161
+ userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
28162
+ },
28000
28163
  type: "button"
28001
28164
  })]
28002
28165
  })]
@@ -28358,6 +28521,7 @@ function TaskListComponent({
28358
28521
  const {
28359
28522
  isExperimentEnabled
28360
28523
  } = useExperimentsContext();
28524
+ const limitToOneTransferInstrument = useSetting("limitToOneTransferInstrument");
28361
28525
  const isEnableNewEntryFlowEnabled = useEnableNewEntryFlow();
28362
28526
  const canSeeIntroduction = useCanSeeIntroduction({
28363
28527
  legalEntity: legalEntityResponse
@@ -28505,7 +28669,7 @@ function TaskListComponent({
28505
28669
  capabilityProblems,
28506
28670
  onNavigateToTask: () => handleOnNavigateToTaskPayout(transferInstrument.id),
28507
28671
  onTransferInstrumentDelete: () => onTransferInstrumentDelete(transferInstrument.id)
28508
- }, transferInstrument.id)), jsxs(Card, {
28672
+ }, transferInstrument.id)), !limitToOneTransferInstrument || transferInstruments.length < 1 ? jsxs(Card, {
28509
28673
  stateful: true,
28510
28674
  onClick: () => handleOnNavigateToTaskPayout(),
28511
28675
  className: "adyen-task adl-add-payout",
@@ -28516,7 +28680,7 @@ function TaskListComponent({
28516
28680
  }), jsx("span", {
28517
28681
  children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
28518
28682
  })]
28519
- })]
28683
+ }) : null]
28520
28684
  }) : jsx(TaskListItem, {
28521
28685
  onNavigateToTask: () => handleOnNavigateToTaskPayout(),
28522
28686
  icon: "payout",
@@ -31706,7 +31870,8 @@ function DropinComposerComponent({
31706
31870
  showToast
31707
31871
  } = useToastContext();
31708
31872
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
31709
- const showBusinessTypeSelection = useShouldShowBusinessTypeSelection(accountHolder2);
31873
+ const isNewEntryFlowEnabled = isExperimentEnabled("EnableNewEntryFlow");
31874
+ const [leId, setLeId] = useLeId();
31710
31875
  const showIntroduction = useShouldShowIntroduction({
31711
31876
  legalEntity: legalEntityResponse
31712
31877
  });
@@ -31717,12 +31882,13 @@ function DropinComposerComponent({
31717
31882
  });
31718
31883
  const [tasks, setTasks] = useState([]);
31719
31884
  const initialTask = useMemo(() => {
31720
- if (showBusinessTypeSelection)
31885
+ if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
31721
31886
  return TaskTypes.BUSINESS_TYPE_SELECTION;
31887
+ }
31722
31888
  if (showIntroduction)
31723
31889
  return TaskTypes.INTRODUCTION;
31724
31890
  return TaskTypes.TASKS_OVERVIEW;
31725
- }, [showBusinessTypeSelection, showIntroduction]);
31891
+ }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
31726
31892
  const [taskHistory, setTaskHistory] = useState([initialTask]);
31727
31893
  const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
31728
31894
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
@@ -32246,6 +32412,12 @@ function DropinComposerComponent({
32246
32412
  clearInterval(timeoutId);
32247
32413
  };
32248
32414
  }, [refreshLegalEntity, rootLegalEntity, taskHistory]);
32415
+ useEffect(() => {
32416
+ if (!isNewEntryFlowEnabled || leId !== legalEntityResponse.id) {
32417
+ setLeId(null);
32418
+ setAccountHolder(null);
32419
+ }
32420
+ }, [isNewEntryFlowEnabled, setLeId]);
32249
32421
  if (isLoadingConfiguration) {
32250
32422
  return jsx(Shimmer, {});
32251
32423
  }
@@ -32259,6 +32431,7 @@ function DropinComposerComponent({
32259
32431
  legalEntityResponse: rootLegalEntity,
32260
32432
  accountHolder: accountHolder2,
32261
32433
  onAccountHolderSelect: async (newAccountHolder) => {
32434
+ setLeId(legalEntityResponse.id);
32262
32435
  setAccountHolder(newAccountHolder);
32263
32436
  await refreshLegalEntity();
32264
32437
  onNavigateTo(showIntroduction ? TaskTypes.INTRODUCTION : TaskTypes.TASKS_OVERVIEW);
@@ -33871,6 +34044,15 @@ const I18nProvider = ({
33871
34044
  children
33872
34045
  });
33873
34046
  };
34047
+ const ReactQueryClient = new QueryClient();
34048
+ function ReactQueryProvider({
34049
+ children
34050
+ }) {
34051
+ return jsx(QueryClientProvider, {
34052
+ client: ReactQueryClient,
34053
+ children
34054
+ });
34055
+ }
33874
34056
  const settingsDefaults = {
33875
34057
  acceptedCountries: void 0,
33876
34058
  allowBankAccountFormatSelection: false,
@@ -33885,7 +34067,8 @@ const settingsDefaults = {
33885
34067
  hideOnboardingIntroductionOrganization: true,
33886
34068
  hideOnboardingIntroductionTrust: true,
33887
34069
  hideOnboardingIntroductionSoleProprietor: true,
33888
- viewOnboardingGuidance: false
34070
+ viewOnboardingGuidance: false,
34071
+ limitToOneTransferInstrument: false
33889
34072
  };
33890
34073
  function SettingsProvider({
33891
34074
  children,
@@ -34222,9 +34405,11 @@ class UIElement extends BaseElement {
34222
34405
  children: jsx(AutoResizer, {
34223
34406
  children: jsx(ToastContextProvider, {
34224
34407
  children: jsx(StateProvider, {
34225
- children: jsx(Component, {
34226
- ...this.props.componentProps,
34227
- eventEmitter: this.eventEmitter
34408
+ children: jsx(ReactQueryProvider, {
34409
+ children: jsx(Component, {
34410
+ ...this.props.componentProps,
34411
+ eventEmitter: this.eventEmitter
34412
+ })
34228
34413
  })
34229
34414
  })
34230
34415
  })