@adyen/kyc-components 3.40.2 → 3.40.4

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.
@@ -13600,6 +13600,13 @@ function Address({
13600
13600
  },
13601
13601
  i18n
13602
13602
  );
13603
+ useEffect(() => {
13604
+ if (hideCountry && (data == null ? void 0 : data.country) && data.country !== formData.country) {
13605
+ schema.forEach((field) => {
13606
+ return field === "country" ? handleChangeFor("country", "input")(data.country) : handleChangeFor(field, "input")(" ");
13607
+ });
13608
+ }
13609
+ }, [data == null ? void 0 : data.country, hideCountry]);
13603
13610
  useEffect(() => {
13604
13611
  onChange == null ? void 0 : onChange({
13605
13612
  schema: formSchema,
@@ -15417,7 +15424,7 @@ const mapLegalEntityToIndividual = (legalEntity, isChangingType) => {
15417
15424
  return individualData;
15418
15425
  };
15419
15426
  const mapIndividualToLegalEntity = (data) => {
15420
- var _a, _b;
15427
+ var _a, _b, _c;
15421
15428
  const requestObj = {
15422
15429
  ...formatObject(data, individualApiKeyMapping)
15423
15430
  };
@@ -15426,8 +15433,11 @@ const mapIndividualToLegalEntity = (data) => {
15426
15433
  data.personalDetails,
15427
15434
  requestObj.individual.identificationData
15428
15435
  );
15429
- const phone2 = ((_a = data.personalDetails) == null ? void 0 : _a.phone) ?? {
15430
- number: (_b = data.personalDetails) == null ? void 0 : _b.phoneNumber,
15436
+ const phone2 = ((_a = data.personalDetails) == null ? void 0 : _a.phone) ? {
15437
+ number: (_b = data.personalDetails) == null ? void 0 : _b.phone.number,
15438
+ type: "mobile"
15439
+ } : {
15440
+ number: (_c = data.personalDetails) == null ? void 0 : _c.phoneNumber,
15431
15441
  type: "mobile"
15432
15442
  };
15433
15443
  if (phone2.number) {
@@ -22393,7 +22403,7 @@ function Individual(props) {
22393
22403
  "address"
22394
22404
  );
22395
22405
  const renderActiveForm = (activeForm) => {
22396
- var _a2, _b2;
22406
+ var _a2, _b2, _c2;
22397
22407
  return /* @__PURE__ */ jsxs(Fragment, { children: [
22398
22408
  /* @__PURE__ */ jsx(StateContextWatcher, { owner: "Individual", onChange: handleStateChange }),
22399
22409
  /* @__PURE__ */ jsx(StateContextSetter, { owner: "Individual", stateRef }),
@@ -22445,7 +22455,7 @@ function Individual(props) {
22445
22455
  id: addressFormID,
22446
22456
  data: {
22447
22457
  ...addressFormProps == null ? void 0 : addressFormProps.data,
22448
- country: country ?? ((_a2 = addressFormProps == null ? void 0 : addressFormProps.data) == null ? void 0 : _a2.country)
22458
+ country: ((_a2 = data.personalDetails) == null ? void 0 : _a2.residencyCountry) ?? ((_b2 = addressFormProps == null ? void 0 : addressFormProps.data) == null ? void 0 : _b2.country) ?? country
22449
22459
  },
22450
22460
  requiredFields: addressSchema,
22451
22461
  optionalFields: ["otherAddressInformation"],
@@ -22470,7 +22480,7 @@ function Individual(props) {
22470
22480
  ...idVerificationMethodFormProps,
22471
22481
  name: fullName,
22472
22482
  id: idVerificationMethodFormID,
22473
- countryOfResidence: (_b2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _b2.residencyCountry
22483
+ countryOfResidence: (_c2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _c2.residencyCountry
22474
22484
  }
22475
22485
  )
22476
22486
  }
@@ -28579,22 +28589,28 @@ function getBaseTrackingPayload({
28579
28589
  }
28580
28590
  return baseTrackingPayload;
28581
28591
  }
28582
- const adjustFormData = (oldFormData, newFormData) => (/* @__PURE__ */ new Set([...keysOf(oldFormData), ...keysOf(newFormData)])).keys().reduce((acc, key) => {
28583
- const oldValue = oldFormData[key];
28584
- const newValue = newFormData[key];
28585
- if (!isUndefinedOrNull(newValue)) return { ...acc, [key]: newValue };
28586
- if (Array.isArray(oldValue)) return { ...acc, [key]: [] };
28587
- if (typeof oldValue === "number") return { ...acc, [key]: null };
28588
- if (typeof oldValue === "string") return { ...acc, [key]: "" };
28589
- return { ...acc, [key]: "" };
28590
- }, {});
28591
- const setRemovedFieldsOnSchemaToDeletedValue = (newData, existingData) => (/* @__PURE__ */ new Set([...keysOf(existingData), ...keysOf(newData)])).keys().reduce((adjusted, formId) => {
28592
- const oldFormData = existingData[formId];
28593
- const newFormData = newData[formId];
28594
- if (isUndefinedOrNull(oldFormData)) return { ...adjusted, [formId]: newFormData };
28595
- if (isUndefinedOrNull(newFormData)) return adjusted;
28596
- return { ...adjusted, [formId]: adjustFormData(oldFormData, newFormData) };
28597
- }, {});
28592
+ const adjustFormData = (oldFormData, newFormData) => {
28593
+ const schema = Array.from((/* @__PURE__ */ new Set([...keysOf(oldFormData), ...keysOf(newFormData)])).keys());
28594
+ return schema.reduce((acc, key) => {
28595
+ const oldValue = oldFormData[key];
28596
+ const newValue = newFormData[key];
28597
+ if (!isUndefinedOrNull(newValue)) return { ...acc, [key]: newValue };
28598
+ if (Array.isArray(oldValue)) return { ...acc, [key]: [] };
28599
+ if (typeof oldValue === "number") return { ...acc, [key]: null };
28600
+ if (typeof oldValue === "string") return { ...acc, [key]: "" };
28601
+ return { ...acc, [key]: "" };
28602
+ }, {});
28603
+ };
28604
+ const setRemovedFieldsOnSchemaToDeletedValue = (newData, existingData) => {
28605
+ const formIds = Array.from((/* @__PURE__ */ new Set([...keysOf(existingData), ...keysOf(newData)])).keys());
28606
+ return formIds.reduce((adjusted, formId) => {
28607
+ const oldFormData = existingData[formId];
28608
+ const newFormData = newData[formId];
28609
+ if (isUndefinedOrNull(oldFormData)) return { ...adjusted, [formId]: newFormData };
28610
+ if (isUndefinedOrNull(newFormData)) return adjusted;
28611
+ return { ...adjusted, [formId]: adjustFormData(oldFormData, newFormData) };
28612
+ }, {});
28613
+ };
28598
28614
  const getRequiredForms = (forms, requiredFields, optionalFields) => {
28599
28615
  const requiredForms = Object.values(forms).filter(({ formId }) => {
28600
28616
  if (requiredFields || optionalFields) {
@@ -34220,13 +34236,16 @@ const BusinessTypeSelection = ({
34220
34236
  ] }) });
34221
34237
  };
34222
34238
  const mapCustomerSupportSchemaToCustomerSupportType = (customerSupport) => {
34223
- var _a, _b, _c;
34224
- const phone2 = ((_a = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _a.phone) ?? {
34225
- number: ((_b = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _b.phoneNumber) || "",
34239
+ var _a, _b, _c, _d, _e;
34240
+ const phone2 = ((_a = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _a.phone) ? {
34241
+ number: ((_c = (_b = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _b.phone) == null ? void 0 : _c.number) || "",
34242
+ type: "mobile"
34243
+ } : {
34244
+ number: ((_d = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _d.phoneNumber) || "",
34226
34245
  type: "mobile"
34227
34246
  };
34228
34247
  return {
34229
- email: ((_c = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _c.email) || "",
34248
+ email: ((_e = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _e.email) || "",
34230
34249
  phone: phone2
34231
34250
  };
34232
34251
  };
@@ -45585,7 +45604,7 @@ const ConfigurationApiProvider = ({
45585
45604
  }) => {
45586
45605
  const authContext = useAuthContext();
45587
45606
  const { isEmbeddedDropin, loadingContext } = authContext;
45588
- const sdkVersion = "3.40.2";
45607
+ const sdkVersion = "3.40.4";
45589
45608
  useAnalytics({
45590
45609
  onUserEvent,
45591
45610
  legalEntityId: rootLegalEntityId,
@@ -46264,7 +46283,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46264
46283
  (settingName) => [settingName, getSetting(settingName)]
46265
46284
  );
46266
46285
  const debugModalMetaData = [
46267
- { key: "SDK version", value: "3.40.2", variant: "green" },
46286
+ { key: "SDK version", value: "3.40.4", variant: "green" },
46268
46287
  { key: "rootLegalEntityId", value: rootLegalEntityId, variant: "blue" },
46269
46288
  { key: "Locale", value: i18n.locale, variant: "blue" },
46270
46289
  { key: "Language", value: i18n.languageCode, variant: "blue" },
@@ -46296,7 +46315,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46296
46315
  };
46297
46316
  const copyToClipboard = async () => {
46298
46317
  const toCopy = {
46299
- sdkVersion: "3.40.2",
46318
+ sdkVersion: "3.40.4",
46300
46319
  experiments: Object.fromEntries(allExperimentsWithValues),
46301
46320
  settings: Object.fromEntries(allSettingsWithValues)
46302
46321
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.40.2",
3
+ "version": "3.40.4",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",