@adyen/kyc-components 3.24.3 → 3.24.5

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.
@@ -5,9 +5,9 @@ import cx from "classnames";
5
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";
6
6
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
7
7
  import debounce from "lodash-es/debounce";
8
+ import isEmpty$1 from "lodash-es/isEmpty";
8
9
  import isISIN from "validator/es/lib/isISIN.js";
9
10
  import OpenBankingSDK from "@adyen/openbankingsdk";
10
- import isEmpty$1 from "lodash-es/isEmpty";
11
11
  import noop$1 from "lodash-es/noop";
12
12
  import range from "lodash-es/range";
13
13
  import { jsxs as jsxs$1, jsx as jsx$1 } from "preact/compat/jsx-runtime";
@@ -9214,7 +9214,7 @@ function CompanyRegistrationDetailsComponent(props) {
9214
9214
  } = useGlobalDataSlice(COMPANY_REGISTRATION_DETAILS);
9215
9215
  const country = (companyNameAndCountry == null ? void 0 : companyNameAndCountry.country) ?? mergedProps.country;
9216
9216
  const hideOptionalRegistrationNumberField = FLOWS_THAT_HIDE_REGISTRATION_NUMBER.some((f) => f.country === country && mergedProps.companyType && f.companyType.includes(mergedProps.companyType));
9217
- const requiredFields = mergedProps.requiredFields || companyRegistrationDetailsFields;
9217
+ const requiredFields = isEmpty$1(mergedProps.requiredFields) ? companyRegistrationDetailsFields : mergedProps.requiredFields;
9218
9218
  const legalCompanyName = companyNameAndCountry == null ? void 0 : companyNameAndCountry.legalCompanyName;
9219
9219
  const defaultVatNumberType = ((_a = mergedProps.data) == null ? void 0 : _a.vatNumber) ? inferTaxIdNumberType((_b = mergedProps.data) == null ? void 0 : _b.vatNumber, country) : (_c = taxIdNumberOptions[country]) == null ? void 0 : _c[0].id;
9220
9220
  const [vatNumberType, setVatNumberType] = useState(defaultVatNumberType);
@@ -9605,7 +9605,7 @@ const businessDetailsBase = {
9605
9605
  rule: "countryRequiresRegistrationNumberForCompanies"
9606
9606
  }
9607
9607
  };
9608
- const taxInformationBase = {
9608
+ const taxInformationBase$1 = {
9609
9609
  vatNumber: {
9610
9610
  rule: "countryUsesVat"
9611
9611
  },
@@ -9667,7 +9667,7 @@ const fieldsPerScenario$3 = {
9667
9667
  },
9668
9668
  L: {
9669
9669
  ...companyBase,
9670
- ...taxInformationBase
9670
+ ...taxInformationBase$1
9671
9671
  },
9672
9672
  L_PROOFOFADDRESS: {
9673
9673
  proofOfAddressDocument: {
@@ -9702,7 +9702,7 @@ const companySearchFieldsPerScenario = {
9702
9702
  },
9703
9703
  L: {
9704
9704
  ...companySearchBase,
9705
- ...taxInformationBase
9705
+ ...taxInformationBase$1
9706
9706
  },
9707
9707
  L_PROOFOFADDRESS: {
9708
9708
  proofOfAddressDocument: {
@@ -9737,7 +9737,7 @@ const businessDetailsFieldsPerScenario = {
9737
9737
  },
9738
9738
  L: {
9739
9739
  ...businessDetailsBase,
9740
- ...taxInformationBase
9740
+ ...taxInformationBase$1
9741
9741
  },
9742
9742
  L_PROOFOFADDRESS: {
9743
9743
  proofOfAddressDocument: {
@@ -23130,7 +23130,7 @@ const solePropBase = {
23130
23130
  rule: "countryOfGoverningLawRequired"
23131
23131
  }
23132
23132
  };
23133
- const taxIdBase = {
23133
+ const taxInformationBase = {
23134
23134
  vatNumber: {
23135
23135
  rule: "countryUsesVat"
23136
23136
  },
@@ -23141,7 +23141,7 @@ const taxIdBase = {
23141
23141
  rule: "countryUsesVat"
23142
23142
  },
23143
23143
  // it still needs support from the BE: https://youtrack.is.adyen.com/issue/UO-2290
23144
- taxId: {
23144
+ taxInformation: {
23145
23145
  rule: "countryUsesTaxId"
23146
23146
  },
23147
23147
  exemptedFromTax: {
@@ -23165,7 +23165,7 @@ const fieldsPerScenario = {
23165
23165
  },
23166
23166
  L: {
23167
23167
  ...solePropBase,
23168
- ...taxIdBase
23168
+ ...taxInformationBase
23169
23169
  },
23170
23170
  L_ConstDoc: {
23171
23171
  constitutionalDocument: {
@@ -34419,7 +34419,7 @@ function SolePropDropinComponent({
34419
34419
  handleUpdateLegalEntity,
34420
34420
  handleCreateLegalEntity
34421
34421
  }) {
34422
- var _a, _b;
34422
+ var _a, _b, _c, _d;
34423
34423
  const {
34424
34424
  i18n
34425
34425
  } = useI18nContext();
@@ -34440,9 +34440,21 @@ function SolePropDropinComponent({
34440
34440
  } = useSettingsContext();
34441
34441
  const [loadingStatus, setLoadingStatus] = useState("success");
34442
34442
  const formRef = useRef(null);
34443
+ const {
34444
+ state: {
34445
+ currentState
34446
+ }
34447
+ } = useStateContext();
34448
+ const formValidity = currentState.validityByForm;
34449
+ useEffect(() => {
34450
+ setData({
34451
+ ...currentState.data
34452
+ });
34453
+ onChange == null ? void 0 : onChange(currentState);
34454
+ }, [currentState]);
34443
34455
  const dataFromResponse = getDataWithDefaultAddress(legalEntityResponse, parentLegalEntity);
34444
34456
  const [data, setData] = useState(dataFromResponse);
34445
- const country = ((_a = dataFromResponse == null ? void 0 : dataFromResponse.solePropRegistrationAddress) == null ? void 0 : _a.registrationAddress.country) || externalCountry;
34457
+ const country = ((_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.country) || ((_c = dataFromResponse == null ? void 0 : dataFromResponse.solePropRegistrationAddress) == null ? void 0 : _c.registrationAddress.country) || externalCountry;
34446
34458
  const baseTrackingPayload = getBaseTrackingPayload({
34447
34459
  trackingConfig,
34448
34460
  parentLegalEntity,
@@ -34471,18 +34483,6 @@ function SolePropDropinComponent({
34471
34483
  isSettingEnabled
34472
34484
  }), [country, data, taskType, requiredFields, isSettingEnabled]);
34473
34485
  const derivedProps = useMemo(() => getPropsFromConfigurations(fieldConfigurations, solePropForms, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], legalEntityResponse ? getFieldsWithExistingData(legalEntityResponse) : [], fieldsFromCustomRules), [fieldConfigurations, fieldsFromCustomRules, problems == null ? void 0 : problems.remediationActions]);
34474
- const {
34475
- state: {
34476
- currentState
34477
- }
34478
- } = useStateContext();
34479
- const formValidity = currentState.validityByForm;
34480
- useEffect(() => {
34481
- setData({
34482
- ...currentState.data
34483
- });
34484
- onChange == null ? void 0 : onChange(currentState);
34485
- }, [currentState]);
34486
34486
  const forms2 = useMemo(() => {
34487
34487
  const requiredForms = getRequiredForms(solePropForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
34488
34488
  return addValidityToForms(requiredForms, formValidity, problems);
@@ -34590,7 +34590,7 @@ function SolePropDropinComponent({
34590
34590
  };
34591
34591
  const isCountryOfGoverningLawEnabled = isExperimentEnabled("EnableCountryOfGoverningLawForUKCompanies");
34592
34592
  const formatDataForSummary2 = (data2, forms22) => {
34593
- var _a2, _b2, _c, _d, _e, _f;
34593
+ var _a2, _b2, _c2, _d2, _e, _f;
34594
34594
  let summaryData = cloneObject(data2);
34595
34595
  if (isCountryOfGoverningLawEnabled) {
34596
34596
  summaryData.solePropNameAndCountry = getUpdatedCountryOfGoverningLaw(summaryData.solePropNameAndCountry);
@@ -34599,9 +34599,9 @@ function SolePropDropinComponent({
34599
34599
  summaryData.solePropNameAndCountry = {
34600
34600
  legalNameOfSoleProprietor: (_b2 = data2.solePropNameAndCountry) == null ? void 0 : _b2.legalCompanyName,
34601
34601
  countryRegionOfEstablishment: solePropCountry,
34602
- countryOfGoverningLaw: ((_c = summaryData.solePropNameAndCountry) == null ? void 0 : _c.countryOfGoverningLaw) && datasetUtils.getCountryName(summaryData.solePropNameAndCountry.countryOfGoverningLaw)
34602
+ countryOfGoverningLaw: ((_c2 = summaryData.solePropNameAndCountry) == null ? void 0 : _c2.countryOfGoverningLaw) && datasetUtils.getCountryName(summaryData.solePropNameAndCountry.countryOfGoverningLaw)
34603
34603
  };
34604
- if ((_d = summaryData.companyRegistrationDetails) == null ? void 0 : _d.taxInformation) {
34604
+ if ((_d2 = summaryData.companyRegistrationDetails) == null ? void 0 : _d2.taxInformation) {
34605
34605
  const taxInformation = summaryData.companyRegistrationDetails.taxInformation.find((taxId) => {
34606
34606
  var _a3;
34607
34607
  return taxId.country === ((_a3 = data2.solePropNameAndCountry) == null ? void 0 : _a3.country);
@@ -34668,7 +34668,7 @@ function SolePropDropinComponent({
34668
34668
  activeForm,
34669
34669
  capabilities,
34670
34670
  data: dataFromResponse,
34671
- country: ((_b = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _b.country) || country,
34671
+ country: ((_d = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _d.country) || country,
34672
34672
  problems,
34673
34673
  handleAddressSearch,
34674
34674
  handleFindAddress,
@@ -39736,7 +39736,7 @@ const ConfigurationApiProvider = ({
39736
39736
  isEmbeddedDropin,
39737
39737
  loadingContext
39738
39738
  } = authContext;
39739
- const sdkVersion = "3.24.3";
39739
+ const sdkVersion = "3.24.5";
39740
39740
  useAnalytics({
39741
39741
  onUserEvent,
39742
39742
  legalEntityId: rootLegalEntityId,
@@ -40368,7 +40368,7 @@ const DebugModal = ({
40368
40368
  };
40369
40369
  const copyToClipboard = async () => {
40370
40370
  const toCopy = {
40371
- sdkVersion: "3.24.3",
40371
+ sdkVersion: "3.24.5",
40372
40372
  experiments: Object.fromEntries(allExperimentsWithValues),
40373
40373
  settings: Object.fromEntries(allSettingsWithValues)
40374
40374
  };
@@ -40398,7 +40398,7 @@ const DebugModal = ({
40398
40398
  children: [jsxs("div", {
40399
40399
  className: "adyen-kyc-debug-modal__meta",
40400
40400
  children: [jsxs("span", {
40401
- children: ["SDK version: ", "3.24.3"]
40401
+ children: ["SDK version: ", "3.24.5"]
40402
40402
  }), jsxs("span", {
40403
40403
  children: ["rootLegalEntityId: ", rootLegalEntityId]
40404
40404
  })]
@@ -3,7 +3,7 @@ import type { ScenarioFields, ScenarioFieldSettings } from './scenario-fields';
3
3
  export declare const solePropBase: {
4
4
  [key: string]: ScenarioFieldSettings;
5
5
  };
6
- export declare const taxIdBase: {
6
+ export declare const taxInformationBase: {
7
7
  [key: string]: ScenarioFieldSettings;
8
8
  };
9
9
  export declare const fieldsPerScenario: ScenarioFields<typeof solePropBase>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.24.3",
3
+ "version": "3.24.5",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",