@adyen/kyc-components 3.51.0 → 3.51.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.
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { b as createContext, d as createSignal, o as onMount, e as createEffect, c as createMemo, a as createComponent, P as Portal, S as Show, t as template, i as insert, f as createRenderEffect, h as className, j as clearDelegatedEvents, k as delegateEvents, u as useContext, l as onCleanup, s as sortFns, m as mutationSortFns, n as on, p as setAttribute, q as getSidedProp, r as use, v as createUniqueId, w as batch, x as getQueryStatusLabel, y as getMutationStatusColor, z as getQueryStatusColor, A as getQueryStatusColorByLabel, B as displayValue, F as For, C as convertRemToPixels, D as untrack, $ as $TRACK, E as useTransition, G as spread, H as mergeProps, I as createRoot, J as serialize, K as Index, L as updateNestedDataByPath, M as addEventListener, N as stringify, O as Match, Q as Switch, R as deleteNestedDataByPath, T as splitProps, U as Dynamic, V as createComputed } from "./index-CsxVaeY_.js";
4
+ import { b as createContext, d as createSignal, o as onMount, e as createEffect, c as createMemo, a as createComponent, P as Portal, S as Show, t as template, i as insert, f as createRenderEffect, h as className, j as clearDelegatedEvents, k as delegateEvents, u as useContext, l as onCleanup, s as sortFns, m as mutationSortFns, n as on, p as setAttribute, q as getSidedProp, r as use, v as createUniqueId, w as batch, x as getQueryStatusLabel, y as getMutationStatusColor, z as getQueryStatusColor, A as getQueryStatusColorByLabel, B as displayValue, F as For, C as convertRemToPixels, D as untrack, $ as $TRACK, E as useTransition, G as spread, H as mergeProps, I as createRoot, J as serialize, K as Index, L as updateNestedDataByPath, M as addEventListener, N as stringify, O as Match, Q as Switch, R as deleteNestedDataByPath, T as splitProps, U as Dynamic, V as createComputed } from "./index-C6O_j_lU.js";
5
5
  var isNonNullable = (i2) => i2 != null;
6
6
  var filterNonNullable = (arr) => arr.filter(isNonNullable);
7
7
  function chain(callbacks) {
@@ -1,5 +1,5 @@
1
- import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./B4MFY5CR-HldG4P4R.js";
2
- import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./index-CsxVaeY_.js";
1
+ import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./B4MFY5CR-zicDXg2A.js";
2
+ import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./index-C6O_j_lU.js";
3
3
  var DevtoolsComponent = (props) => {
4
4
  const [localStore, setLocalStore] = createLocalStorage({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
1
- import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./B4MFY5CR-HldG4P4R.js";
2
- import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./index-CsxVaeY_.js";
1
+ import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./B4MFY5CR-zicDXg2A.js";
2
+ import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./index-C6O_j_lU.js";
3
3
  var DevtoolsPanelComponent = (props) => {
4
4
  const [localStore, setLocalStore] = createLocalStorage({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,4 +1,4 @@
1
- import { W } from "./index-CsxVaeY_.js";
1
+ import { W } from "./index-C6O_j_lU.js";
2
2
  export {
3
3
  W as default
4
4
  };
@@ -15580,12 +15580,16 @@ function Address({
15580
15580
  } = form;
15581
15581
  const { isValid } = form;
15582
15582
  if (handleFieldChange && requiredFields && propFieldValidationErrors) {
15583
+ const allFields2 = [...requiredFields, ...optionalFields];
15584
+ const fieldsInOrder = getAddressSchemaForCountry(dataProp == null ? void 0 : dataProp.country).filter(
15585
+ (field) => allFields2.includes(field)
15586
+ );
15583
15587
  handleChangeFor = handleFieldChange;
15584
15588
  formData = dataProp ?? {};
15585
15589
  formErrors = errorProp;
15586
15590
  formValid = validProp;
15587
15591
  formFieldProblems = propFieldValidationErrors;
15588
- formSchema = requiredFields;
15592
+ formSchema = fieldsInOrder;
15589
15593
  }
15590
15594
  useEffect(() => {
15591
15595
  if (verifiedAddress) {
@@ -19307,7 +19311,10 @@ function PersonalDetails(props) {
19307
19311
  readonly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask || formUtils.isReadOnly("residencyCountry"),
19308
19312
  allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
19309
19313
  classNameModifiers: ["country"],
19310
- handleChangeFor: () => handleFieldChange("residencyCountry", "input")
19314
+ handleChangeFor: () => (e) => {
19315
+ handleFieldChange("residencyCountry", "input")(e);
19316
+ handleChangeFor("country", "address")(e);
19317
+ }
19311
19318
  }
19312
19319
  ),
19313
19320
  isAgeVerificationEnabled && formUtils.isRequiredField("relationship") && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
@@ -29104,6 +29111,7 @@ const useFormComposer = ({
29104
29111
  onSubmit,
29105
29112
  triggerValidation
29106
29113
  }) => {
29114
+ var _a2;
29107
29115
  const [shouldValidate, setShouldValidate] = useState(false);
29108
29116
  const [activeForm, setActiveForm] = useState(forms[0]);
29109
29117
  const isFormSummaryStep = (form) => form.formId === summaryStep.formId;
@@ -29112,6 +29120,7 @@ const useFormComposer = ({
29112
29120
  const totalSteps = forms.length;
29113
29121
  const isFinalStep = currentStep === totalSteps - 1;
29114
29122
  const isFirstStep = currentStep === 0;
29123
+ const firstStepId = (_a2 = forms[0]) == null ? void 0 : _a2.formId;
29115
29124
  useEffect(() => {
29116
29125
  setActiveForm(
29117
29126
  (activeForm2) => forms.find(({ formId }) => formId === activeForm2.formId) ?? activeForm2
@@ -29123,7 +29132,7 @@ const useFormComposer = ({
29123
29132
  useEffect(() => {
29124
29133
  const openingStep = getOpeningStep(forms, problems == null ? void 0 : problems.remediationActions);
29125
29134
  setActiveForm(openingStep);
29126
- }, []);
29135
+ }, [firstStepId, problems == null ? void 0 : problems.remediationActions]);
29127
29136
  const gotoFormByFormIndex = (nextFormIndex) => {
29128
29137
  setActiveForm(forms[nextFormIndex]);
29129
29138
  };
@@ -29407,6 +29416,9 @@ const identityBase = {
29407
29416
  otherAddressInformation: {
29408
29417
  rule: "otherAddressInfoIfRequiredForCountry"
29409
29418
  },
29419
+ country: {
29420
+ rule: "REQUIRED"
29421
+ },
29410
29422
  postalCode: {
29411
29423
  rule: "postalCodeIfRequiredForCountry"
29412
29424
  },
@@ -39796,6 +39808,18 @@ const nameValidationRulesV4 = {
39796
39808
  }
39797
39809
  ]
39798
39810
  };
39811
+ const specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS.replace("-", ""));
39812
+ const nameFormatters = {
39813
+ firstName: {
39814
+ // formatter: trimValWithOneSpace // just trim
39815
+ // Example - removing disallowed chars as they are input: then they don't end up in state
39816
+ formatter: (val) => val ? trimValWithOneSpace(val).replace(specialCharsRegEx, "") : void 0
39817
+ // trim & replace
39818
+ },
39819
+ lastName: {
39820
+ formatter: (val) => val ? trimValWithOneSpace(val).replace(specialCharsRegEx, "") : void 0
39821
+ }
39822
+ };
39799
39823
  const nomineeDecisionMakerRoleValidationRules = {
39800
39824
  nomineeShareholder: {
39801
39825
  modes: ["blur"],
@@ -39947,7 +39971,7 @@ function IndividualDropin({
39947
39971
  trustedFieldsProvider,
39948
39972
  trustedRoles
39949
39973
  }) {
39950
- var _a2, _b2, _c2, _d2;
39974
+ var _a2, _b2, _c2, _d2, _e2;
39951
39975
  const { accountHolder, setAccountHolder, idVerificationProviderId } = useCoreContext();
39952
39976
  const { isEmbeddedDropin } = useAuthContext();
39953
39977
  const { i18n } = useI18nContext();
@@ -39962,6 +39986,9 @@ function IndividualDropin({
39962
39986
  return {
39963
39987
  personalDetails: {
39964
39988
  residencyCountry: parentCountry
39989
+ },
39990
+ address: {
39991
+ country: parentCountry
39965
39992
  }
39966
39993
  };
39967
39994
  }, [legalEntityResponse, isTargetLegalEntityType]);
@@ -39976,7 +40003,7 @@ function IndividualDropin({
39976
40003
  const [loadingStatus, setLoadingStatus] = useState("success");
39977
40004
  const [documents, setDocuments] = useState();
39978
40005
  const [existingAttachments, setExistingAttachments] = useState();
39979
- const [country] = useState(
40006
+ const [country, setCountry] = useState(
39980
40007
  ((_a2 = dataFromResponse == null ? void 0 : dataFromResponse.personalDetails) == null ? void 0 : _a2.residencyCountry) ?? parentCountry
39981
40008
  );
39982
40009
  const [hideFooter, setHideFooter] = useState(false);
@@ -40000,7 +40027,7 @@ function IndividualDropin({
40000
40027
  }, []);
40001
40028
  const individualFieldValidations = useCallback(
40002
40029
  (data2) => {
40003
- var _a3, _b3, _c3, _d3, _e2, _f2, _g2, _h2, _i2;
40030
+ var _a3, _b3, _c3, _d3, _e3, _f2, _g2, _h2, _i2;
40004
40031
  return {
40005
40032
  personalDetails: personalDetailsValidators({
40006
40033
  country: ((_a3 = data2 == null ? void 0 : data2.personalDetails) == null ? void 0 : _a3.residencyCountry) ?? country,
@@ -40009,7 +40036,7 @@ function IndividualDropin({
40009
40036
  taskType,
40010
40037
  idNumberType: (_b3 = data2 == null ? void 0 : data2.personalDetails) == null ? void 0 : _b3.typeOfIdentity,
40011
40038
  phonePrefix: (_d3 = (_c3 = data2 == null ? void 0 : data2.personalDetails) == null ? void 0 : _c3.phone) == null ? void 0 : _d3.phoneCountryCode,
40012
- idNumberExempt: (_e2 = data2 == null ? void 0 : data2.personalDetails) == null ? void 0 : _e2.idNumberExempt,
40039
+ idNumberExempt: (_e3 = data2 == null ? void 0 : data2.personalDetails) == null ? void 0 : _e3.idNumberExempt,
40013
40040
  idNumber: (_f2 = data2 == null ? void 0 : data2.personalDetails) == null ? void 0 : _f2.idNumber,
40014
40041
  existingIdNumber: (_g2 = dataFromResponse.personalDetails) == null ? void 0 : _g2.idNumber,
40015
40042
  formVerificationErrors: (_h2 = propProblems == null ? void 0 : propProblems.verificationErrors) == null ? void 0 : _h2.personalDetails
@@ -40043,14 +40070,28 @@ function IndividualDropin({
40043
40070
  }),
40044
40071
  [legalEntityResponse, documents, isTargetLegalEntityType, dataFromResponse]
40045
40072
  );
40073
+ const formatters = useMemo(
40074
+ () => ({
40075
+ personalDetails: {
40076
+ ...nameFormatters
40077
+ },
40078
+ address: addressFormatters
40079
+ }),
40080
+ []
40081
+ );
40046
40082
  const form = useMultiForm({
40047
40083
  requiredFields: derivedProps == null ? void 0 : derivedProps.requiredFields,
40048
40084
  defaultData,
40049
40085
  rules: individualFieldValidations,
40050
40086
  asyncRules: individualFieldAsyncValidations,
40051
- optionalFields: derivedProps == null ? void 0 : derivedProps.optionalFields
40087
+ optionalFields: derivedProps == null ? void 0 : derivedProps.optionalFields,
40088
+ formatters
40052
40089
  });
40053
40090
  const { data = dataFromResponse } = form;
40091
+ useEffect(() => {
40092
+ var _a3;
40093
+ setCountry(((_a3 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _a3.residencyCountry) ?? parentCountry);
40094
+ }, [(_b2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _b2.residencyCountry, parentCountry]);
40054
40095
  const getConfigurationData = useCallback(
40055
40096
  () => getConfiguration2({
40056
40097
  legalEntityType: LegalEntityType.INDIVIDUAL,
@@ -40115,14 +40156,14 @@ function IndividualDropin({
40115
40156
  roleTypes = getAllowedDecisionMakerRoles(parentLegalEntity, taskType);
40116
40157
  }
40117
40158
  if (parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) {
40118
- const associations = (_b2 = parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) == null ? void 0 : _b2.filter(
40159
+ const associations = (_c2 = parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) == null ? void 0 : _c2.filter(
40119
40160
  (ea) => ea.legalEntityId === (legalEntityResponse == null ? void 0 : legalEntityResponse.id)
40120
40161
  );
40121
40162
  if (associations && associations.length > 0) {
40122
40163
  if (isRoleTypeTask && parentLegalEntity) {
40123
- const jobTitle = (_c2 = associations.find(
40164
+ const jobTitle = (_d2 = associations.find(
40124
40165
  (association) => Boolean(association.jobTitle)
40125
- )) == null ? void 0 : _c2.jobTitle;
40166
+ )) == null ? void 0 : _d2.jobTitle;
40126
40167
  dataFromResponse = {
40127
40168
  ...dataFromResponse,
40128
40169
  personalDetails: {
@@ -40263,7 +40304,7 @@ function IndividualDropin({
40263
40304
  parentLE,
40264
40305
  dataSubmitted
40265
40306
  }) => {
40266
- var _a3, _b3, _c3, _d3, _e2, _f2;
40307
+ var _a3, _b3, _c3, _d3, _e3, _f2;
40267
40308
  const newRoles = taskType === TaskTypes.DECISION_MAKER || taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER ? (_a3 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _a3.role : taskType === TaskTypes.TRUST_MEMBER_INDIVIDUAL ? trustMember == null ? void 0 : trustMember.roles : null;
40268
40309
  const existingEntityAssociations = getOwnEntityAssociations(parentLE);
40269
40310
  if (newRoles && (hasRolesChanged(legalEntity2, existingEntityAssociations, newRoles) || ((_b3 = dataFromResponse.personalDetails) == null ? void 0 : _b3.jobTitle) !== ((_c3 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _c3.jobTitle) || hasNomineesChanged(dataFromResponse.personalDetails, dataSubmitted.nominee))) {
@@ -40289,7 +40330,7 @@ function IndividualDropin({
40289
40330
  }
40290
40331
  await handleUpdateLegalEntity(updatedParentLegalEntity, parentLE.id);
40291
40332
  }
40292
- if (taskType === TaskTypes.LEGAL_REPRESENTATIVE_DETAILS && (existingEntityAssociations.every((ea) => ea.legalEntityId !== legalEntity2.id) || ((_d3 = dataFromResponse == null ? void 0 : dataFromResponse.personalDetails) == null ? void 0 : _d3.relationship) !== ((_e2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _e2.relationship))) {
40333
+ if (taskType === TaskTypes.LEGAL_REPRESENTATIVE_DETAILS && (existingEntityAssociations.every((ea) => ea.legalEntityId !== legalEntity2.id) || ((_d3 = dataFromResponse == null ? void 0 : dataFromResponse.personalDetails) == null ? void 0 : _d3.relationship) !== ((_e3 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _e3.relationship))) {
40293
40334
  const newEntityAssociation = {
40294
40335
  type: "legalRepresentative",
40295
40336
  legalEntityId: legalEntity2.id,
@@ -40426,7 +40467,7 @@ function IndividualDropin({
40426
40467
  };
40427
40468
  };
40428
40469
  const formatDataForSummary2 = () => {
40429
- var _a3, _b3, _c3, _d3, _e2, _f2, _g2;
40470
+ var _a3, _b3, _c3, _d3, _e3, _f2, _g2;
40430
40471
  let summaryData = cloneObject(data);
40431
40472
  if ((_a3 = summaryData.personalDetails) == null ? void 0 : _a3.residencyCountry) {
40432
40473
  summaryData.personalDetails.residencyCountry = datasetUtils.getCountryName(
@@ -40456,7 +40497,7 @@ function IndividualDropin({
40456
40497
  i18n.locale
40457
40498
  );
40458
40499
  }
40459
- if ((_e2 = summaryData.personalDetails) == null ? void 0 : _e2.phone) {
40500
+ if ((_e3 = summaryData.personalDetails) == null ? void 0 : _e3.phone) {
40460
40501
  delete summaryData.personalDetails.phone;
40461
40502
  summaryData.personalDetails.phoneNumber = (_g2 = (_f2 = data.personalDetails) == null ? void 0 : _f2.phone) == null ? void 0 : _g2.number;
40462
40503
  }
@@ -40464,7 +40505,7 @@ function IndividualDropin({
40464
40505
  };
40465
40506
  const summaryOmittedKeys = [
40466
40507
  ...taskType === TaskTypes.DECISION_MAKER ? ["role"] : [],
40467
- ...((_d2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _d2.idNumberExempt) ? ["idNumber"] : []
40508
+ ...((_e2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _e2.idNumberExempt) ? ["idNumber"] : []
40468
40509
  ];
40469
40510
  const {
40470
40511
  handleNextClick,
@@ -52142,7 +52183,7 @@ const ConfigurationApiProvider = ({
52142
52183
  }) => {
52143
52184
  const authContext = useAuthContext();
52144
52185
  const { isEmbeddedDropin, loadingContext } = authContext;
52145
- const sdkVersion = "3.51.0";
52186
+ const sdkVersion = "3.51.2";
52146
52187
  const rootLegalEntityId = useGlobalStore((store) => store.rootLegalEntity.id);
52147
52188
  useAnalytics({
52148
52189
  onUserEvent,
@@ -52882,7 +52923,7 @@ const DebugModal = ({ onExit }) => {
52882
52923
  const [tab, setTab] = useState("metadata");
52883
52924
  const rootLegalEntity = useGlobalStore((store) => store.rootLegalEntity);
52884
52925
  const metadata = {
52885
- sdkVersion: "3.51.0",
52926
+ sdkVersion: "3.51.2",
52886
52927
  locale: i18n.locale,
52887
52928
  rootLegalEntityId: rootLegalEntity.id
52888
52929
  };
@@ -55879,7 +55920,7 @@ var TanstackQueryDevtools = (_k = class {
55879
55920
  if (__privateGet(this, _Component)) {
55880
55921
  Devtools = __privateGet(this, _Component);
55881
55922
  } else {
55882
- Devtools = lazy(() => import("./HO4MOOFI-B0LIhOPC.js"));
55923
+ Devtools = lazy(() => import("./HO4MOOFI-cwSYvEW_.js"));
55883
55924
  __privateSet(this, _Component, Devtools);
55884
55925
  }
55885
55926
  setupStyleSheet(__privateGet(this, _styleNonce), __privateGet(this, _shadowDOMTarget));
@@ -56001,7 +56042,7 @@ var TanstackQueryDevtoolsPanel = (_l = class {
56001
56042
  if (__privateGet(this, _Component2)) {
56002
56043
  Devtools = __privateGet(this, _Component2);
56003
56044
  } else {
56004
- Devtools = lazy(() => import("./HUY7CZI3-B3UlKGgb.js"));
56045
+ Devtools = lazy(() => import("./HUY7CZI3-Mle7w1qv.js"));
56005
56046
  __privateSet(this, _Component2, Devtools);
56006
56047
  }
56007
56048
  setupStyleSheet(__privateGet(this, _styleNonce2), __privateGet(this, _shadowDOMTarget2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.51.0",
3
+ "version": "3.51.2",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",