@adyen/kyc-components 3.40.0 → 3.40.2

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.
@@ -19573,10 +19573,13 @@ function ContactDetails(props) {
19573
19573
  ...mergedProps,
19574
19574
  schema,
19575
19575
  defaultData: mergedProps.data,
19576
- rules: mergedProps.validators || contactDetailsValidationRules,
19576
+ rules: {
19577
+ ...mergedProps.validators,
19578
+ email: contactDetailsValidationRules.email
19579
+ },
19577
19580
  /*
19578
19581
  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)
19582
+ The MemoizedPhoneInput component has its own useForm instance and asyncRules using a different field key (phoneNumber)
19580
19583
  */
19581
19584
  asyncRules,
19582
19585
  fieldProblems: mergedProps == null ? void 0 : mergedProps.fieldValidationErrors
@@ -28588,7 +28591,8 @@ const adjustFormData = (oldFormData, newFormData) => (/* @__PURE__ */ new Set([.
28588
28591
  const setRemovedFieldsOnSchemaToDeletedValue = (newData, existingData) => (/* @__PURE__ */ new Set([...keysOf(existingData), ...keysOf(newData)])).keys().reduce((adjusted, formId) => {
28589
28592
  const oldFormData = existingData[formId];
28590
28593
  const newFormData = newData[formId];
28591
- if (isUndefinedOrNull(oldFormData) || isUndefinedOrNull(newFormData)) return adjusted;
28594
+ if (isUndefinedOrNull(oldFormData)) return { ...adjusted, [formId]: newFormData };
28595
+ if (isUndefinedOrNull(newFormData)) return adjusted;
28592
28596
  return { ...adjusted, [formId]: adjustFormData(oldFormData, newFormData) };
28593
28597
  }, {});
28594
28598
  const getRequiredForms = (forms, requiredFields, optionalFields) => {
@@ -34232,6 +34236,7 @@ function CustomerSupport(props) {
34232
34236
  const { i18n } = useI18nContext();
34233
34237
  const { showToast } = useToastContext();
34234
34238
  const { isExperimentEnabled } = useExperimentsContext();
34239
+ const [shouldValidate, setShouldValidate] = useState(false);
34235
34240
  const {
34236
34241
  state: { currentState }
34237
34242
  } = useStateContext();
@@ -34245,20 +34250,22 @@ function CustomerSupport(props) {
34245
34250
  email: (_f = (_e = legalEntityResponse[legalEntityType]) == null ? void 0 : _e.support) == null ? void 0 : _f.email
34246
34251
  };
34247
34252
  const submitForm = async () => {
34248
- if (currentState.isValid) {
34249
- const customerSupport = currentState.data;
34250
- const support = mapCustomerSupportSchemaToCustomerSupportType(customerSupport);
34251
- const payload = {
34252
- [legalEntityType]: { support }
34253
- };
34254
- try {
34255
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(payload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
34256
- onSubmit();
34257
- } catch {
34258
- const label = i18n.get("failedToUpdateDetails");
34259
- logger$q.error(label, payload);
34260
- showToast({ label, type: "error" });
34261
- }
34253
+ if (!currentState.isValid) {
34254
+ setShouldValidate(true);
34255
+ return;
34256
+ }
34257
+ const customerSupport = currentState.data;
34258
+ const support = mapCustomerSupportSchemaToCustomerSupportType(customerSupport);
34259
+ const payload = {
34260
+ [legalEntityType]: { support }
34261
+ };
34262
+ try {
34263
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(payload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
34264
+ onSubmit();
34265
+ } catch {
34266
+ const label = i18n.get("failedToUpdateDetails");
34267
+ logger$q.error(label, payload);
34268
+ showToast({ label, type: "error" });
34262
34269
  }
34263
34270
  };
34264
34271
  return /* @__PURE__ */ jsxs("form", { className: "adyen-kyc-individual__customer-support", "aria-describedby": "ariaErrorField", children: [
@@ -34276,7 +34283,7 @@ function CustomerSupport(props) {
34276
34283
  data: contactDetailsData,
34277
34284
  country,
34278
34285
  requiredFields: isExperimentEnabled("EnableNewPhoneField") ? ["email", "phone"] : ["email", "phoneNumber"],
34279
- shouldValidate: true
34286
+ shouldValidate
34280
34287
  }
34281
34288
  ),
34282
34289
  /* @__PURE__ */ jsx(
@@ -45578,7 +45585,7 @@ const ConfigurationApiProvider = ({
45578
45585
  }) => {
45579
45586
  const authContext = useAuthContext();
45580
45587
  const { isEmbeddedDropin, loadingContext } = authContext;
45581
- const sdkVersion = "3.40.0";
45588
+ const sdkVersion = "3.40.2";
45582
45589
  useAnalytics({
45583
45590
  onUserEvent,
45584
45591
  legalEntityId: rootLegalEntityId,
@@ -46257,7 +46264,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46257
46264
  (settingName) => [settingName, getSetting(settingName)]
46258
46265
  );
46259
46266
  const debugModalMetaData = [
46260
- { key: "SDK version", value: "3.40.0", variant: "green" },
46267
+ { key: "SDK version", value: "3.40.2", variant: "green" },
46261
46268
  { key: "rootLegalEntityId", value: rootLegalEntityId, variant: "blue" },
46262
46269
  { key: "Locale", value: i18n.locale, variant: "blue" },
46263
46270
  { key: "Language", value: i18n.languageCode, variant: "blue" },
@@ -46289,7 +46296,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46289
46296
  };
46290
46297
  const copyToClipboard = async () => {
46291
46298
  const toCopy = {
46292
- sdkVersion: "3.40.0",
46299
+ sdkVersion: "3.40.2",
46293
46300
  experiments: Object.fromEntries(allExperimentsWithValues),
46294
46301
  settings: Object.fromEntries(allSettingsWithValues)
46295
46302
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.40.0",
3
+ "version": "3.40.2",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",