@adyen/kyc-components 3.40.1 → 3.40.3

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) {
@@ -19573,10 +19583,13 @@ function ContactDetails(props) {
19573
19583
  ...mergedProps,
19574
19584
  schema,
19575
19585
  defaultData: mergedProps.data,
19576
- rules: mergedProps.validators || contactDetailsValidationRules,
19586
+ rules: {
19587
+ ...mergedProps.validators,
19588
+ email: contactDetailsValidationRules.email
19589
+ },
19577
19590
  /*
19578
19591
  These async rules are specific to the new PhoneField (phone) and aren't applied when the feature is disabled.
19579
- The MemoizedPhoneInput component has it's own useForm instance and asyncRules using a different field key (phoneNumber)
19592
+ The MemoizedPhoneInput component has its own useForm instance and asyncRules using a different field key (phoneNumber)
19580
19593
  */
19581
19594
  asyncRules,
19582
19595
  fieldProblems: mergedProps == null ? void 0 : mergedProps.fieldValidationErrors
@@ -22390,7 +22403,7 @@ function Individual(props) {
22390
22403
  "address"
22391
22404
  );
22392
22405
  const renderActiveForm = (activeForm) => {
22393
- var _a2, _b2;
22406
+ var _a2, _b2, _c2;
22394
22407
  return /* @__PURE__ */ jsxs(Fragment, { children: [
22395
22408
  /* @__PURE__ */ jsx(StateContextWatcher, { owner: "Individual", onChange: handleStateChange }),
22396
22409
  /* @__PURE__ */ jsx(StateContextSetter, { owner: "Individual", stateRef }),
@@ -22442,7 +22455,7 @@ function Individual(props) {
22442
22455
  id: addressFormID,
22443
22456
  data: {
22444
22457
  ...addressFormProps == null ? void 0 : addressFormProps.data,
22445
- 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
22446
22459
  },
22447
22460
  requiredFields: addressSchema,
22448
22461
  optionalFields: ["otherAddressInformation"],
@@ -22467,7 +22480,7 @@ function Individual(props) {
22467
22480
  ...idVerificationMethodFormProps,
22468
22481
  name: fullName,
22469
22482
  id: idVerificationMethodFormID,
22470
- 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
22471
22484
  }
22472
22485
  )
22473
22486
  }
@@ -34217,13 +34230,16 @@ const BusinessTypeSelection = ({
34217
34230
  ] }) });
34218
34231
  };
34219
34232
  const mapCustomerSupportSchemaToCustomerSupportType = (customerSupport) => {
34220
- var _a, _b, _c;
34221
- const phone2 = ((_a = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _a.phone) ?? {
34222
- number: ((_b = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _b.phoneNumber) || "",
34233
+ var _a, _b, _c, _d, _e;
34234
+ const phone2 = ((_a = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _a.phone) ? {
34235
+ number: ((_c = (_b = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _b.phone) == null ? void 0 : _c.number) || "",
34236
+ type: "mobile"
34237
+ } : {
34238
+ number: ((_d = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _d.phoneNumber) || "",
34223
34239
  type: "mobile"
34224
34240
  };
34225
34241
  return {
34226
- email: ((_c = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _c.email) || "",
34242
+ email: ((_e = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _e.email) || "",
34227
34243
  phone: phone2
34228
34244
  };
34229
34245
  };
@@ -34233,6 +34249,7 @@ function CustomerSupport(props) {
34233
34249
  const { i18n } = useI18nContext();
34234
34250
  const { showToast } = useToastContext();
34235
34251
  const { isExperimentEnabled } = useExperimentsContext();
34252
+ const [shouldValidate, setShouldValidate] = useState(false);
34236
34253
  const {
34237
34254
  state: { currentState }
34238
34255
  } = useStateContext();
@@ -34246,20 +34263,22 @@ function CustomerSupport(props) {
34246
34263
  email: (_f = (_e = legalEntityResponse[legalEntityType]) == null ? void 0 : _e.support) == null ? void 0 : _f.email
34247
34264
  };
34248
34265
  const submitForm = async () => {
34249
- if (currentState.isValid) {
34250
- const customerSupport = currentState.data;
34251
- const support = mapCustomerSupportSchemaToCustomerSupportType(customerSupport);
34252
- const payload = {
34253
- [legalEntityType]: { support }
34254
- };
34255
- try {
34256
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(payload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
34257
- onSubmit();
34258
- } catch {
34259
- const label = i18n.get("failedToUpdateDetails");
34260
- logger$q.error(label, payload);
34261
- showToast({ label, type: "error" });
34262
- }
34266
+ if (!currentState.isValid) {
34267
+ setShouldValidate(true);
34268
+ return;
34269
+ }
34270
+ const customerSupport = currentState.data;
34271
+ const support = mapCustomerSupportSchemaToCustomerSupportType(customerSupport);
34272
+ const payload = {
34273
+ [legalEntityType]: { support }
34274
+ };
34275
+ try {
34276
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(payload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
34277
+ onSubmit();
34278
+ } catch {
34279
+ const label = i18n.get("failedToUpdateDetails");
34280
+ logger$q.error(label, payload);
34281
+ showToast({ label, type: "error" });
34263
34282
  }
34264
34283
  };
34265
34284
  return /* @__PURE__ */ jsxs("form", { className: "adyen-kyc-individual__customer-support", "aria-describedby": "ariaErrorField", children: [
@@ -34277,7 +34296,7 @@ function CustomerSupport(props) {
34277
34296
  data: contactDetailsData,
34278
34297
  country,
34279
34298
  requiredFields: isExperimentEnabled("EnableNewPhoneField") ? ["email", "phone"] : ["email", "phoneNumber"],
34280
- shouldValidate: true
34299
+ shouldValidate
34281
34300
  }
34282
34301
  ),
34283
34302
  /* @__PURE__ */ jsx(
@@ -45579,7 +45598,7 @@ const ConfigurationApiProvider = ({
45579
45598
  }) => {
45580
45599
  const authContext = useAuthContext();
45581
45600
  const { isEmbeddedDropin, loadingContext } = authContext;
45582
- const sdkVersion = "3.40.1";
45601
+ const sdkVersion = "3.40.3";
45583
45602
  useAnalytics({
45584
45603
  onUserEvent,
45585
45604
  legalEntityId: rootLegalEntityId,
@@ -46258,7 +46277,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46258
46277
  (settingName) => [settingName, getSetting(settingName)]
46259
46278
  );
46260
46279
  const debugModalMetaData = [
46261
- { key: "SDK version", value: "3.40.1", variant: "green" },
46280
+ { key: "SDK version", value: "3.40.3", variant: "green" },
46262
46281
  { key: "rootLegalEntityId", value: rootLegalEntityId, variant: "blue" },
46263
46282
  { key: "Locale", value: i18n.locale, variant: "blue" },
46264
46283
  { key: "Language", value: i18n.languageCode, variant: "blue" },
@@ -46290,7 +46309,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46290
46309
  };
46291
46310
  const copyToClipboard = async () => {
46292
46311
  const toCopy = {
46293
- sdkVersion: "3.40.1",
46312
+ sdkVersion: "3.40.3",
46294
46313
  experiments: Object.fromEntries(allExperimentsWithValues),
46295
46314
  settings: Object.fromEntries(allSettingsWithValues)
46296
46315
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.40.1",
3
+ "version": "3.40.3",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",