@incodetech/core 0.0.0-dev-20260923-1a4dbec8 → 0.0.0-dev-20260924-9e40faf4

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.
Files changed (76) hide show
  1. package/dist/{BrowserDiagnosticsCryptoProvider-B5poAx1_.esm.js → BrowserDiagnosticsCryptoProvider-D0e-1PEZ.esm.js} +1 -1
  2. package/dist/{FaceDetectionProvider-Ydsahps4.esm.js → FaceDetectionProvider-DbssECIq.esm.js} +4 -4
  3. package/dist/{ekycStateMachine-BjNeL6ce.esm.js → PhoneValidationProvider-Dok_Det7.esm.js} +160 -779
  4. package/dist/ae-signature.esm.js +1 -1
  5. package/dist/{apiError-B5izenZ8.esm.js → apiError-BBsde_zZ.esm.js} +1 -1
  6. package/dist/authentication.esm.js +2 -2
  7. package/dist/{authenticationManager-xf4GoLxc.esm.js → authenticationManager-CfHmU40H.esm.js} +3 -3
  8. package/dist/{authenticationStateMachine-BkvMIijO.esm.js → authenticationStateMachine-DIijLkkt.esm.js} +2 -2
  9. package/dist/curp-validation.esm.js +2 -2
  10. package/dist/{curpValidationManager-BzS_Dlcq.esm.js → curpValidationManager-BHocstXa.esm.js} +13 -20
  11. package/dist/{curpValidationStateMachine-Bg_Lsk2V.esm.js → curpValidationStateMachine-CDcMdfvW.esm.js} +1 -1
  12. package/dist/{deepsightLoader-L0JGAPDe.esm.js → deepsightLoader-Cxt11Cx1.esm.js} +3 -3
  13. package/dist/document-capture.d.ts +1 -1
  14. package/dist/document-capture.esm.js +1 -1
  15. package/dist/{documentCaptureManager-CbAGkHWh.d.ts → documentCaptureManager-C8eO0hbv.d.ts} +1 -1
  16. package/dist/{documentCaptureManager-7aQhPQnb.esm.js → documentCaptureManager-CLtex74O.esm.js} +7 -14
  17. package/dist/dynamic-forms.esm.js +2 -2
  18. package/dist/{dynamicFormsManager-l_3MYzBs.esm.js → dynamicFormsManager-CXKgiYov.esm.js} +1 -1
  19. package/dist/{dynamicFormsStateMachine-DOF7ba6-.esm.js → dynamicFormsStateMachine-CJ8bA1oW.esm.js} +1 -1
  20. package/dist/ekyb.esm.js +3 -3
  21. package/dist/{ekybManager-lxNzE1kk.esm.js → ekybManager-BSIlNfRf.esm.js} +21 -25
  22. package/dist/{ekybStateMachine-DNBBT-S9.esm.js → ekybStateMachine-z0t8szV3.esm.js} +1 -1
  23. package/dist/ekyc.esm.js +2 -2
  24. package/dist/{ekycManager-DoGZkFZQ.esm.js → ekycManager-DEbkqrHx.esm.js} +27 -34
  25. package/dist/ekycStateMachine-UjaYNdNf.esm.js +688 -0
  26. package/dist/electronic-signature.esm.js +1 -1
  27. package/dist/{electronicSignatureManager-COJYfU0x.esm.js → electronicSignatureManager-B-IMLsp-.esm.js} +5 -5
  28. package/dist/email.esm.js +1 -1
  29. package/dist/{emailManager-CTNtCZJI.esm.js → emailManager-CeSfUjcz.esm.js} +17 -23
  30. package/dist/extensibility.d.ts +3 -3
  31. package/dist/extensibility.esm.js +17 -17
  32. package/dist/{faceCaptureManagerFactory-CIj0Cuh2.esm.js → faceCaptureManagerFactory-SDNPwwLR.esm.js} +2 -2
  33. package/dist/{faceCaptureSetup-LKIkhOFU.esm.js → faceCaptureSetup-bzpheUcb.esm.js} +3 -3
  34. package/dist/{feature-management-BdEYtp-i.esm.js → feature-management-B_C9uoMn.esm.js} +1 -1
  35. package/dist/feature-management.esm.js +1 -1
  36. package/dist/flow.esm.js +3 -3
  37. package/dist/{flowCompletionService-__FouXqN.esm.js → flowCompletionService-Cu5uEJuu.esm.js} +1 -1
  38. package/dist/{flowServices-Bzs_X1o4.esm.js → flowServices-BQtiexrG.esm.js} +4 -4
  39. package/dist/geolocation.esm.js +2 -2
  40. package/dist/{geolocationManager-B9ljrS0X.esm.js → geolocationManager-DSDFdGbn.esm.js} +4 -5
  41. package/dist/{geolocationStateMachine-DjxU3gOp.esm.js → geolocationStateMachine-BJR0ZbYj.esm.js} +1 -1
  42. package/dist/id-selfie-flow.esm.js +7 -7
  43. package/dist/id.esm.js +3 -3
  44. package/dist/{idCaptureDefaults-BJglMiCL.esm.js → idCaptureDefaults-BRdqVIve.esm.js} +1 -1
  45. package/dist/{idCaptureManager-C2DaehZ0.esm.js → idCaptureManager-xHV3aAVd.esm.js} +3 -3
  46. package/dist/{idCaptureServices-B3rNM_gb.esm.js → idCaptureServices-P9BCoM4V.esm.js} +3 -3
  47. package/dist/{idCaptureStateMachine-CnAu9UcE.esm.js → idCaptureStateMachine-BM3TBJhd.esm.js} +9 -9
  48. package/dist/identity-reuse.d.ts +1 -1
  49. package/dist/{identityReuseManager-BBE2R_S7.d.ts → identityReuseManager-x2QG6QAm.d.ts} +4 -4
  50. package/dist/index.esm.js +1 -1
  51. package/dist/personhood.esm.js +4 -4
  52. package/dist/phone.d.ts +1 -1
  53. package/dist/phone.esm.js +1 -1
  54. package/dist/{phoneManager-DNzWb7_d.d.ts → phoneManager-D4FVaENS.d.ts} +9 -1
  55. package/dist/{phoneManager-tPB-SJvp.esm.js → phoneManager-Do-HaC6Z.esm.js} +19 -17
  56. package/dist/qe-signature.esm.js +1 -1
  57. package/dist/{runChildModule-CNOpKnr8.esm.js → runChildModule-BpOMtasT.esm.js} +1 -1
  58. package/dist/{sdkVersion-DD5MTu4p.esm.js → sdkVersion-DQRoTd6P.esm.js} +1 -1
  59. package/dist/selfie.esm.js +5 -5
  60. package/dist/{selfieManager-BLCxM_Ci.esm.js → selfieManager-CNW7zH1i.esm.js} +3 -3
  61. package/dist/{selfieStateMachine-BYUhydKm.esm.js → selfieStateMachine-R9J8mADt.esm.js} +2 -2
  62. package/dist/{session-cbcxp2lM.esm.js → session-BEhlnolX.esm.js} +3 -3
  63. package/dist/session.esm.js +4 -4
  64. package/dist/{sessionInitializer-BQnUIKSb.esm.js → sessionInitializer-DV11I5N9.esm.js} +3 -3
  65. package/dist/{setup-CzOLxZwN.esm.js → setup--2aSSY35.esm.js} +4 -4
  66. package/dist/signature.esm.js +1 -1
  67. package/dist/{signatureManager-BEhnPTe8.esm.js → signatureManager-CS217sC0.esm.js} +4 -8
  68. package/dist/{trueSightService-BWs2WTYv.esm.js → trueSightService-BFrcoNz3.esm.js} +2 -2
  69. package/dist/video-selfie.esm.js +4 -4
  70. package/dist/{videoSelfieCameraWarmer-BnPBPjIw.esm.js → videoSelfieCameraWarmer-Cx0iEoav.esm.js} +3 -3
  71. package/dist/wasm.esm.js +2 -2
  72. package/dist/watchlist-for-business.esm.js +1 -1
  73. package/dist/{watchlistForBusinessManager-CwMC60YS.esm.js → watchlistForBusinessManager-BUWO4S6n.esm.js} +4 -2
  74. package/dist/workflow.d.ts +4 -4
  75. package/dist/workflow.esm.js +16 -16
  76. package/package.json +3 -3
@@ -1,10 +1,3 @@
1
- import { t as api } from "./api-Bx3gKW_y.esm.js";
2
- import { t as endpoints } from "./endpoints-B-3Q-LUw.esm.js";
3
- import { a as ADDRESS_STATE_SOURCES, c as EMAIL_SOURCES, d as NAME_SOURCES, f as POSTAL_CODE_SOURCES, h as TAX_ID_SOURCES, i as toEkycConfig, l as HOUSE_NO_SOURCES, m as STREET_SOURCES, n as getEKYCFields, o as CITY_SOURCES, p as STATE_CODE_HINTS, r as isFieldOptional, s as COUNTRY_SELECTOR_DISABLED_SOURCES, t as getEKYCCountry, u as MIDDLE_NAME_SOURCES } from "./ekycUtils-Dew1rBG0.esm.js";
4
- import { i as assign, t as setup } from "./xstate.esm-Bg3FuvIs.esm.js";
5
- import { n as fromPromise } from "./xstate-actors.esm-Ccyzgxj1.esm.js";
6
- import { a as getPostalCodeMaxLength, c as STREET_LEVEL_REQUIRED_ERROR, d as usStateOptions, i as getPostalCodeErrorKey, l as fillFromSuggestion, n as FIXED_DIGIT_POSTAL_CODE_LENGTH, o as validatePostalCode, r as formatPostalCode, s as DYNAMIC_REQUIRED_KEY, t as debounceSearchActor, u as getStreetLevelErrorForSuggestion } from "./addressSearch-Dnwc7dMx.esm.js";
7
- import { t as validateCPF } from "./cpf-BIADjddF.esm.js";
8
1
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/metadata.min.json.js
9
2
  var metadata_min_json_default = {
10
3
  "version": 4,
@@ -7484,13 +7477,13 @@ function isObject(object) {
7484
7477
  }
7485
7478
  //#endregion
7486
7479
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/metadata.js
7487
- function _typeof$6(o) {
7480
+ function _typeof$7(o) {
7488
7481
  "@babel/helpers - typeof";
7489
- return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
7482
+ return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
7490
7483
  return typeof o;
7491
7484
  } : function(o) {
7492
7485
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
7493
- }, _typeof$6(o);
7486
+ }, _typeof$7(o);
7494
7487
  }
7495
7488
  function _classCallCheck$2(a, n) {
7496
7489
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
@@ -7498,22 +7491,22 @@ function _classCallCheck$2(a, n) {
7498
7491
  function _defineProperties$2(e, r) {
7499
7492
  for (var t = 0; t < r.length; t++) {
7500
7493
  var o = r[t];
7501
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$6(o.key), o);
7494
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$7(o.key), o);
7502
7495
  }
7503
7496
  }
7504
7497
  function _createClass$2(e, r, t) {
7505
7498
  return r && _defineProperties$2(e.prototype, r), t && _defineProperties$2(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
7506
7499
  }
7507
- function _toPropertyKey$6(t) {
7508
- var i = _toPrimitive$6(t, "string");
7509
- return "symbol" == _typeof$6(i) ? i : i + "";
7500
+ function _toPropertyKey$7(t) {
7501
+ var i = _toPrimitive$7(t, "string");
7502
+ return "symbol" == _typeof$7(i) ? i : i + "";
7510
7503
  }
7511
- function _toPrimitive$6(t, r) {
7512
- if ("object" != _typeof$6(t) || !t) return t;
7504
+ function _toPrimitive$7(t, r) {
7505
+ if ("object" != _typeof$7(t) || !t) return t;
7513
7506
  var e = t[Symbol.toPrimitive];
7514
7507
  if (void 0 !== e) {
7515
7508
  var i = e.call(t, r || "default");
7516
- if ("object" != _typeof$6(i)) return i;
7509
+ if ("object" != _typeof$7(i)) return i;
7517
7510
  throw new TypeError("@@toPrimitive must return a primitive value.");
7518
7511
  }
7519
7512
  return ("string" === r ? String : Number)(t);
@@ -7975,7 +7968,7 @@ function validateMetadata(metadata) {
7975
7968
  }
7976
7969
  /* istanbul ignore next */
7977
7970
  var typeOf = function typeOf(_) {
7978
- return _typeof$6(_);
7971
+ return _typeof$7(_);
7979
7972
  };
7980
7973
  /**
7981
7974
  * Returns "country calling code" for a country.
@@ -8093,7 +8086,7 @@ function checkNumberLengthForType(nationalNumber, country, type, metadata) {
8093
8086
  * @param {object} metadata
8094
8087
  * @return {string}
8095
8088
  */
8096
- function isPossiblePhoneNumber(input, options, metadata) {
8089
+ function isPossiblePhoneNumber$2(input, options, metadata) {
8097
8090
  /* istanbul ignore if */
8098
8091
  if (options === void 0) options = {};
8099
8092
  metadata = new Metadata(metadata);
@@ -8731,15 +8724,15 @@ function pickFirstMatchingElement(elements, testFunction) {
8731
8724
  }
8732
8725
  //#endregion
8733
8726
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/PhoneNumber.js
8734
- function _typeof$5(o) {
8727
+ function _typeof$6(o) {
8735
8728
  "@babel/helpers - typeof";
8736
- return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
8729
+ return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
8737
8730
  return typeof o;
8738
8731
  } : function(o) {
8739
8732
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8740
- }, _typeof$5(o);
8733
+ }, _typeof$6(o);
8741
8734
  }
8742
- function ownKeys$4(e, r) {
8735
+ function ownKeys$5(e, r) {
8743
8736
  var t = Object.keys(e);
8744
8737
  if (Object.getOwnPropertySymbols) {
8745
8738
  var o = Object.getOwnPropertySymbols(e);
@@ -8749,19 +8742,19 @@ function ownKeys$4(e, r) {
8749
8742
  }
8750
8743
  return t;
8751
8744
  }
8752
- function _objectSpread$4(e) {
8745
+ function _objectSpread$5(e) {
8753
8746
  for (var r = 1; r < arguments.length; r++) {
8754
8747
  var t = null != arguments[r] ? arguments[r] : {};
8755
- r % 2 ? ownKeys$4(Object(t), !0).forEach(function(r) {
8756
- _defineProperty$4(e, r, t[r]);
8757
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function(r) {
8748
+ r % 2 ? ownKeys$5(Object(t), !0).forEach(function(r) {
8749
+ _defineProperty$5(e, r, t[r]);
8750
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function(r) {
8758
8751
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
8759
8752
  });
8760
8753
  }
8761
8754
  return e;
8762
8755
  }
8763
- function _defineProperty$4(e, r, t) {
8764
- return (r = _toPropertyKey$5(r)) in e ? Object.defineProperty(e, r, {
8756
+ function _defineProperty$5(e, r, t) {
8757
+ return (r = _toPropertyKey$6(r)) in e ? Object.defineProperty(e, r, {
8765
8758
  value: t,
8766
8759
  enumerable: !0,
8767
8760
  configurable: !0,
@@ -8774,22 +8767,22 @@ function _classCallCheck$1(a, n) {
8774
8767
  function _defineProperties$1(e, r) {
8775
8768
  for (var t = 0; t < r.length; t++) {
8776
8769
  var o = r[t];
8777
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$5(o.key), o);
8770
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$6(o.key), o);
8778
8771
  }
8779
8772
  }
8780
8773
  function _createClass$1(e, r, t) {
8781
8774
  return r && _defineProperties$1(e.prototype, r), t && _defineProperties$1(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
8782
8775
  }
8783
- function _toPropertyKey$5(t) {
8784
- var i = _toPrimitive$5(t, "string");
8785
- return "symbol" == _typeof$5(i) ? i : i + "";
8776
+ function _toPropertyKey$6(t) {
8777
+ var i = _toPrimitive$6(t, "string");
8778
+ return "symbol" == _typeof$6(i) ? i : i + "";
8786
8779
  }
8787
- function _toPrimitive$5(t, r) {
8788
- if ("object" != _typeof$5(t) || !t) return t;
8780
+ function _toPrimitive$6(t, r) {
8781
+ if ("object" != _typeof$6(t) || !t) return t;
8789
8782
  var e = t[Symbol.toPrimitive];
8790
8783
  if (void 0 !== e) {
8791
8784
  var i = e.call(t, r || "default");
8792
- if ("object" != _typeof$5(i)) return i;
8785
+ if ("object" != _typeof$6(i)) return i;
8793
8786
  throw new TypeError("@@toPrimitive must return a primitive value.");
8794
8787
  }
8795
8788
  return ("string" === r ? String : Number)(t);
@@ -8845,7 +8838,7 @@ var PhoneNumber = /*#__PURE__*/ function() {
8845
8838
  {
8846
8839
  key: "isPossible",
8847
8840
  value: function isPossible() {
8848
- return isPossiblePhoneNumber(this, { v2: true }, this.getMetadata());
8841
+ return isPossiblePhoneNumber$2(this, { v2: true }, this.getMetadata());
8849
8842
  }
8850
8843
  },
8851
8844
  {
@@ -8875,7 +8868,7 @@ var PhoneNumber = /*#__PURE__*/ function() {
8875
8868
  {
8876
8869
  key: "format",
8877
8870
  value: function format(_format, options) {
8878
- return formatNumber(this, _format, options ? _objectSpread$4(_objectSpread$4({}, options), {}, { v2: true }) : { v2: true }, this.getMetadata());
8871
+ return formatNumber(this, _format, options ? _objectSpread$5(_objectSpread$5({}, options), {}, { v2: true }) : { v2: true }, this.getMetadata());
8879
8872
  }
8880
8873
  },
8881
8874
  {
@@ -8924,33 +8917,33 @@ function getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJs
8924
8917
  var E164_NUMBER_REGEXP = /^\+\d+$/;
8925
8918
  //#endregion
8926
8919
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/ParseError.js
8927
- function _typeof$4(o) {
8920
+ function _typeof$5(o) {
8928
8921
  "@babel/helpers - typeof";
8929
- return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
8922
+ return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
8930
8923
  return typeof o;
8931
8924
  } : function(o) {
8932
8925
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8933
- }, _typeof$4(o);
8926
+ }, _typeof$5(o);
8934
8927
  }
8935
8928
  function _defineProperties(e, r) {
8936
8929
  for (var t = 0; t < r.length; t++) {
8937
8930
  var o = r[t];
8938
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$4(o.key), o);
8931
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$5(o.key), o);
8939
8932
  }
8940
8933
  }
8941
8934
  function _createClass(e, r, t) {
8942
8935
  return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
8943
8936
  }
8944
- function _toPropertyKey$4(t) {
8945
- var i = _toPrimitive$4(t, "string");
8946
- return "symbol" == _typeof$4(i) ? i : i + "";
8937
+ function _toPropertyKey$5(t) {
8938
+ var i = _toPrimitive$5(t, "string");
8939
+ return "symbol" == _typeof$5(i) ? i : i + "";
8947
8940
  }
8948
- function _toPrimitive$4(t, r) {
8949
- if ("object" != _typeof$4(t) || !t) return t;
8941
+ function _toPrimitive$5(t, r) {
8942
+ if ("object" != _typeof$5(t) || !t) return t;
8950
8943
  var e = t[Symbol.toPrimitive];
8951
8944
  if (void 0 !== e) {
8952
8945
  var i = e.call(t, r || "default");
8953
- if ("object" != _typeof$4(i)) return i;
8946
+ if ("object" != _typeof$5(i)) return i;
8954
8947
  throw new TypeError("@@toPrimitive must return a primitive value.");
8955
8948
  }
8956
8949
  return ("string" === r ? String : Number)(t);
@@ -8962,7 +8955,7 @@ function _callSuper(t, o, e) {
8962
8955
  return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
8963
8956
  }
8964
8957
  function _possibleConstructorReturn(t, e) {
8965
- if (e && ("object" == _typeof$4(e) || "function" == typeof e)) return e;
8958
+ if (e && ("object" == _typeof$5(e) || "function" == typeof e)) return e;
8966
8959
  if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
8967
8960
  return _assertThisInitialized(t);
8968
8961
  }
@@ -9417,15 +9410,15 @@ function parsePhoneNumber$3(formattedPhoneNumber, defaultCountry, defaultCalling
9417
9410
  }
9418
9411
  //#endregion
9419
9412
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js
9420
- function _typeof$3(o) {
9413
+ function _typeof$4(o) {
9421
9414
  "@babel/helpers - typeof";
9422
- return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
9415
+ return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
9423
9416
  return typeof o;
9424
9417
  } : function(o) {
9425
9418
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
9426
- }, _typeof$3(o);
9419
+ }, _typeof$4(o);
9427
9420
  }
9428
- function ownKeys$3(e, r) {
9421
+ function ownKeys$4(e, r) {
9429
9422
  var t = Object.keys(e);
9430
9423
  if (Object.getOwnPropertySymbols) {
9431
9424
  var o = Object.getOwnPropertySymbols(e);
@@ -9435,53 +9428,53 @@ function ownKeys$3(e, r) {
9435
9428
  }
9436
9429
  return t;
9437
9430
  }
9438
- function _objectSpread$3(e) {
9431
+ function _objectSpread$4(e) {
9439
9432
  for (var r = 1; r < arguments.length; r++) {
9440
9433
  var t = null != arguments[r] ? arguments[r] : {};
9441
- r % 2 ? ownKeys$3(Object(t), !0).forEach(function(r) {
9442
- _defineProperty$3(e, r, t[r]);
9443
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r) {
9434
+ r % 2 ? ownKeys$4(Object(t), !0).forEach(function(r) {
9435
+ _defineProperty$4(e, r, t[r]);
9436
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function(r) {
9444
9437
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
9445
9438
  });
9446
9439
  }
9447
9440
  return e;
9448
9441
  }
9449
- function _defineProperty$3(e, r, t) {
9450
- return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, {
9442
+ function _defineProperty$4(e, r, t) {
9443
+ return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, {
9451
9444
  value: t,
9452
9445
  enumerable: !0,
9453
9446
  configurable: !0,
9454
9447
  writable: !0
9455
9448
  }) : e[r] = t, e;
9456
9449
  }
9457
- function _toPropertyKey$3(t) {
9458
- var i = _toPrimitive$3(t, "string");
9459
- return "symbol" == _typeof$3(i) ? i : i + "";
9450
+ function _toPropertyKey$4(t) {
9451
+ var i = _toPrimitive$4(t, "string");
9452
+ return "symbol" == _typeof$4(i) ? i : i + "";
9460
9453
  }
9461
- function _toPrimitive$3(t, r) {
9462
- if ("object" != _typeof$3(t) || !t) return t;
9454
+ function _toPrimitive$4(t, r) {
9455
+ if ("object" != _typeof$4(t) || !t) return t;
9463
9456
  var e = t[Symbol.toPrimitive];
9464
9457
  if (void 0 !== e) {
9465
9458
  var i = e.call(t, r || "default");
9466
- if ("object" != _typeof$3(i)) return i;
9459
+ if ("object" != _typeof$4(i)) return i;
9467
9460
  throw new TypeError("@@toPrimitive must return a primitive value.");
9468
9461
  }
9469
9462
  return ("string" === r ? String : Number)(t);
9470
9463
  }
9471
9464
  function parsePhoneNumberWithError(text, options, metadata) {
9472
- return parse(text, _objectSpread$3(_objectSpread$3({}, options), {}, { v2: true }), metadata);
9465
+ return parse(text, _objectSpread$4(_objectSpread$4({}, options), {}, { v2: true }), metadata);
9473
9466
  }
9474
9467
  //#endregion
9475
9468
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/normalizeArguments.js
9476
- function _typeof$2(o) {
9469
+ function _typeof$3(o) {
9477
9470
  "@babel/helpers - typeof";
9478
- return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
9471
+ return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
9479
9472
  return typeof o;
9480
9473
  } : function(o) {
9481
9474
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
9482
- }, _typeof$2(o);
9475
+ }, _typeof$3(o);
9483
9476
  }
9484
- function ownKeys$2(e, r) {
9477
+ function ownKeys$3(e, r) {
9485
9478
  var t = Object.keys(e);
9486
9479
  if (Object.getOwnPropertySymbols) {
9487
9480
  var o = Object.getOwnPropertySymbols(e);
@@ -9491,35 +9484,35 @@ function ownKeys$2(e, r) {
9491
9484
  }
9492
9485
  return t;
9493
9486
  }
9494
- function _objectSpread$2(e) {
9487
+ function _objectSpread$3(e) {
9495
9488
  for (var r = 1; r < arguments.length; r++) {
9496
9489
  var t = null != arguments[r] ? arguments[r] : {};
9497
- r % 2 ? ownKeys$2(Object(t), !0).forEach(function(r) {
9498
- _defineProperty$2(e, r, t[r]);
9499
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r) {
9490
+ r % 2 ? ownKeys$3(Object(t), !0).forEach(function(r) {
9491
+ _defineProperty$3(e, r, t[r]);
9492
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r) {
9500
9493
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
9501
9494
  });
9502
9495
  }
9503
9496
  return e;
9504
9497
  }
9505
- function _defineProperty$2(e, r, t) {
9506
- return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, {
9498
+ function _defineProperty$3(e, r, t) {
9499
+ return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, {
9507
9500
  value: t,
9508
9501
  enumerable: !0,
9509
9502
  configurable: !0,
9510
9503
  writable: !0
9511
9504
  }) : e[r] = t, e;
9512
9505
  }
9513
- function _toPropertyKey$2(t) {
9514
- var i = _toPrimitive$2(t, "string");
9515
- return "symbol" == _typeof$2(i) ? i : i + "";
9506
+ function _toPropertyKey$3(t) {
9507
+ var i = _toPrimitive$3(t, "string");
9508
+ return "symbol" == _typeof$3(i) ? i : i + "";
9516
9509
  }
9517
- function _toPrimitive$2(t, r) {
9518
- if ("object" != _typeof$2(t) || !t) return t;
9510
+ function _toPrimitive$3(t, r) {
9511
+ if ("object" != _typeof$3(t) || !t) return t;
9519
9512
  var e = t[Symbol.toPrimitive];
9520
9513
  if (void 0 !== e) {
9521
9514
  var i = e.call(t, r || "default");
9522
- if ("object" != _typeof$2(i)) return i;
9515
+ if ("object" != _typeof$3(i)) return i;
9523
9516
  throw new TypeError("@@toPrimitive must return a primitive value.");
9524
9517
  }
9525
9518
  return ("string" === r ? String : Number)(t);
@@ -9581,7 +9574,7 @@ function normalizeArguments(args) {
9581
9574
  options = void 0;
9582
9575
  metadata = arg_3;
9583
9576
  }
9584
- if (arg_2) options = _objectSpread$2({ defaultCountry: arg_2 }, options);
9577
+ if (arg_2) options = _objectSpread$3({ defaultCountry: arg_2 }, options);
9585
9578
  } else if (isObject(arg_2)) if (arg_3) {
9586
9579
  options = arg_2;
9587
9580
  metadata = arg_3;
@@ -9595,6 +9588,74 @@ function normalizeArguments(args) {
9595
9588
  }
9596
9589
  //#endregion
9597
9590
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js
9591
+ function _typeof$2(o) {
9592
+ "@babel/helpers - typeof";
9593
+ return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
9594
+ return typeof o;
9595
+ } : function(o) {
9596
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
9597
+ }, _typeof$2(o);
9598
+ }
9599
+ function ownKeys$2(e, r) {
9600
+ var t = Object.keys(e);
9601
+ if (Object.getOwnPropertySymbols) {
9602
+ var o = Object.getOwnPropertySymbols(e);
9603
+ r && (o = o.filter(function(r) {
9604
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
9605
+ })), t.push.apply(t, o);
9606
+ }
9607
+ return t;
9608
+ }
9609
+ function _objectSpread$2(e) {
9610
+ for (var r = 1; r < arguments.length; r++) {
9611
+ var t = null != arguments[r] ? arguments[r] : {};
9612
+ r % 2 ? ownKeys$2(Object(t), !0).forEach(function(r) {
9613
+ _defineProperty$2(e, r, t[r]);
9614
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r) {
9615
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
9616
+ });
9617
+ }
9618
+ return e;
9619
+ }
9620
+ function _defineProperty$2(e, r, t) {
9621
+ return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, {
9622
+ value: t,
9623
+ enumerable: !0,
9624
+ configurable: !0,
9625
+ writable: !0
9626
+ }) : e[r] = t, e;
9627
+ }
9628
+ function _toPropertyKey$2(t) {
9629
+ var i = _toPrimitive$2(t, "string");
9630
+ return "symbol" == _typeof$2(i) ? i : i + "";
9631
+ }
9632
+ function _toPrimitive$2(t, r) {
9633
+ if ("object" != _typeof$2(t) || !t) return t;
9634
+ var e = t[Symbol.toPrimitive];
9635
+ if (void 0 !== e) {
9636
+ var i = e.call(t, r || "default");
9637
+ if ("object" != _typeof$2(i)) return i;
9638
+ throw new TypeError("@@toPrimitive must return a primitive value.");
9639
+ }
9640
+ return ("string" === r ? String : Number)(t);
9641
+ }
9642
+ function parsePhoneNumber$2(text, options, metadata) {
9643
+ if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) options = _objectSpread$2(_objectSpread$2({}, options), {}, { defaultCountry: void 0 });
9644
+ try {
9645
+ return parsePhoneNumberWithError(text, options, metadata);
9646
+ } catch (error) {
9647
+ /* istanbul ignore else */
9648
+ if (error instanceof ParseError) {} else throw error;
9649
+ }
9650
+ }
9651
+ //#endregion
9652
+ //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parsePhoneNumber.js
9653
+ function parsePhoneNumber$1() {
9654
+ var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
9655
+ return parsePhoneNumber$2(text, options, metadata);
9656
+ }
9657
+ //#endregion
9658
+ //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/isValidPhoneNumber.js
9598
9659
  function _typeof$1(o) {
9599
9660
  "@babel/helpers - typeof";
9600
9661
  return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -9646,23 +9707,14 @@ function _toPrimitive$1(t, r) {
9646
9707
  }
9647
9708
  return ("string" === r ? String : Number)(t);
9648
9709
  }
9649
- function parsePhoneNumber$2(text, options, metadata) {
9650
- if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) options = _objectSpread$1(_objectSpread$1({}, options), {}, { defaultCountry: void 0 });
9651
- try {
9652
- return parsePhoneNumberWithError(text, options, metadata);
9653
- } catch (error) {
9654
- /* istanbul ignore else */
9655
- if (error instanceof ParseError) {} else throw error;
9656
- }
9657
- }
9658
- //#endregion
9659
- //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parsePhoneNumber.js
9660
- function parsePhoneNumber$1() {
9710
+ function isValidPhoneNumber$1() {
9661
9711
  var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
9662
- return parsePhoneNumber$2(text, options, metadata);
9712
+ options = _objectSpread$1(_objectSpread$1({}, options), {}, { extract: false });
9713
+ var phoneNumber = parsePhoneNumber$2(text, options, metadata);
9714
+ return phoneNumber && phoneNumber.isValid() || false;
9663
9715
  }
9664
9716
  //#endregion
9665
- //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/isValidPhoneNumber.js
9717
+ //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/isPossiblePhoneNumber.js
9666
9718
  function _typeof(o) {
9667
9719
  "@babel/helpers - typeof";
9668
9720
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -9714,11 +9766,11 @@ function _toPrimitive(t, r) {
9714
9766
  }
9715
9767
  return ("string" === r ? String : Number)(t);
9716
9768
  }
9717
- function isValidPhoneNumber$1() {
9769
+ function isPossiblePhoneNumber$1() {
9718
9770
  var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
9719
9771
  options = _objectSpread(_objectSpread({}, options), {}, { extract: false });
9720
9772
  var phoneNumber = parsePhoneNumber$2(text, options, metadata);
9721
- return phoneNumber && phoneNumber.isValid() || false;
9773
+ return phoneNumber && phoneNumber.isPossible() || false;
9722
9774
  }
9723
9775
  //#endregion
9724
9776
  //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js
@@ -9731,8 +9783,16 @@ function isValidPhoneNumber() {
9731
9783
  return withMetadataArgument(isValidPhoneNumber$1, arguments);
9732
9784
  }
9733
9785
  //#endregion
9786
+ //#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/isPossiblePhoneNumber.js
9787
+ function isPossiblePhoneNumber() {
9788
+ return withMetadataArgument(isPossiblePhoneNumber$1, arguments);
9789
+ }
9790
+ //#endregion
9734
9791
  //#region ../infra/src/providers/browser/PhoneValidationProvider.ts
9735
9792
  var PhoneValidationProvider = class {
9793
+ isPossible(phone) {
9794
+ return isPossiblePhoneNumber(phone);
9795
+ }
9736
9796
  isValid(phone, country) {
9737
9797
  if (!phone) return false;
9738
9798
  try {
@@ -9750,683 +9810,4 @@ var PhoneValidationProvider = class {
9750
9810
  }
9751
9811
  };
9752
9812
  //#endregion
9753
- //#region src/modules/ekyc/ekycValidators.ts
9754
- const phoneValidator = new PhoneValidationProvider();
9755
- /** Progressively formats an SSN as XXX-XX-XXXX */
9756
- function formatSSN(value) {
9757
- const ssn = value?.replace(/\D/g, "") ?? "";
9758
- if (ssn.length < 4) return ssn;
9759
- if (ssn.length < 6) return `${ssn.slice(0, 3)}-${ssn.slice(3)}`;
9760
- return `${ssn.slice(0, 3)}-${ssn.slice(3, 5)}-${ssn.slice(5, 9)}`;
9761
- }
9762
- /**
9763
- * Strips invalid characters from a name.
9764
- * Fixes SDKv1 regex syntax issue — allows letters, accented chars, spaces, commas, apostrophes.
9765
- */
9766
- function cleanName(name) {
9767
- return (name ?? "").replace(/[^a-zA-ZñÑáéíóúÁÉÍÓÚ\s,'´]/g, "").slice(0, 100);
9768
- }
9769
- const PO_BOX_REGEX = /POBox|P\.O\.Box|pobox|postofficebox|postbox|po\.box|p\.o\.box/i;
9770
- /** Returns true if the address looks like a P.O. Box */
9771
- function isPoBox(address) {
9772
- return PO_BOX_REGEX.test(address.replace(/\s/g, ""));
9773
- }
9774
- function validatePhone(phone, country) {
9775
- return phoneValidator.isValid(phone, country);
9776
- }
9777
- function formatPhoneE164(phone, country) {
9778
- return phoneValidator.formatE164(phone, country) ?? phone;
9779
- }
9780
- const SSN_FORMAT_REGEX = /^\d{3}-\d{2}-\d{4}$/;
9781
- const EMAIL_FORMAT_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
9782
- const buildPostalCodeParams = (country) => {
9783
- const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
9784
- if (fixedLen !== void 0) return { length: fixedLen };
9785
- let maxLen = getPostalCodeMaxLength(country);
9786
- if (country === "US" || country === "BR") maxLen = maxLen - 1;
9787
- return { maxLength: maxLen };
9788
- };
9789
- const createValidators = () => ({
9790
- required: (value, _rule, field) => {
9791
- if (value.trim().length > 0) return void 0;
9792
- const fieldName = field.displayLabel ?? field.label;
9793
- return fieldName ? {
9794
- key: DYNAMIC_REQUIRED_KEY,
9795
- params: { fieldName }
9796
- } : { key: DYNAMIC_REQUIRED_KEY };
9797
- },
9798
- streetLevelRequired: (value) => {
9799
- if (value.trim().length > 0) return void 0;
9800
- return STREET_LEVEL_REQUIRED_ERROR;
9801
- },
9802
- cpf: (value) => {
9803
- if (value.trim().length === 0) return void 0;
9804
- return validateCPF(value) ? void 0 : { key: "verification.errors.invalidTaxId" };
9805
- },
9806
- ssnFormat: (value) => {
9807
- if (value.trim().length === 0) return void 0;
9808
- return SSN_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.ssnFormat" };
9809
- },
9810
- noPoBox: (value) => {
9811
- if (value.trim().length === 0) return void 0;
9812
- return isPoBox(value) ? { key: "verification.errors.poBox" } : void 0;
9813
- },
9814
- postalCodeFormat: (value, rule) => {
9815
- if (rule.type !== "postalCodeFormat") return void 0;
9816
- if (value.trim().length === 0) return void 0;
9817
- if (validatePostalCode(value, rule.country)) return void 0;
9818
- return {
9819
- key: getPostalCodeErrorKey(rule.country),
9820
- params: buildPostalCodeParams(rule.country)
9821
- };
9822
- },
9823
- phoneFormat: (value, rule) => {
9824
- if (rule.type !== "phoneFormat") return void 0;
9825
- const trimmed = value.trim();
9826
- if (rule.optional && trimmed.length === 0) return void 0;
9827
- return validatePhone(trimmed, rule.country) ? void 0 : { key: "verification.errors.phoneInvalid" };
9828
- },
9829
- emailFormat: (value) => {
9830
- if (value.trim().length === 0) return void 0;
9831
- return EMAIL_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.emailInvalid" };
9832
- },
9833
- exactLength: (value, rule) => {
9834
- if (rule.type !== "exactLength") return void 0;
9835
- if (value.trim().length === 0) return void 0;
9836
- return value.length === rule.length ? void 0 : { key: "verification.errors.exactly10Characters" };
9837
- }
9838
- });
9839
- const normalizeFieldValue = (value) => typeof value === "string" ? value : String(value ?? "");
9840
- const evaluateRules = (value, rules, field, validators) => {
9841
- if (!rules) return void 0;
9842
- for (const rule of rules) {
9843
- const error = validators[rule.type](value, rule, field);
9844
- if (error) return error;
9845
- }
9846
- };
9847
- function validateEkycForm(values, fields) {
9848
- const validators = createValidators();
9849
- return fields.reduce((errors, field) => {
9850
- const value = normalizeFieldValue(values[field.name]);
9851
- const error = evaluateRules(value, field.validation, field, validators);
9852
- if (error) errors[field.name] = error;
9853
- return errors;
9854
- }, {});
9855
- }
9856
- function validateEkycField(values, fieldName, fields) {
9857
- const field = fields.find((f) => f.name === fieldName);
9858
- if (!field) return void 0;
9859
- const validators = createValidators();
9860
- const value = normalizeFieldValue(values[field.name]);
9861
- return evaluateRules(value, field.validation, field, validators);
9862
- }
9863
- //#endregion
9864
- //#region src/modules/ekyc/ekycActions.ts
9865
- function buildValidationRules(field, country, configSource) {
9866
- const rules = [];
9867
- if (field.required) rules.push({ type: "required" });
9868
- if (field.name === "taxId" && country === "BR") rules.push({ type: "cpf" });
9869
- if (field.name === "ssn" && (country === "US" || country === "CA")) rules.push({ type: "ssnFormat" });
9870
- if (field.name === "street") rules.push({ type: "noPoBox" });
9871
- if (field.name === "postalCode") rules.push({
9872
- type: "postalCodeFormat",
9873
- country
9874
- });
9875
- if (field.name === "phone") rules.push({
9876
- type: "phoneFormat",
9877
- country,
9878
- optional: isFieldOptional("phone", configSource)
9879
- });
9880
- if (field.name === "email") rules.push({ type: "emailFormat" });
9881
- if (field.name === "panNumber") rules.push({
9882
- type: "exactLength",
9883
- length: 10
9884
- });
9885
- return rules;
9886
- }
9887
- function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false) {
9888
- const defs = [];
9889
- const add = (name, type, label, source, opts) => {
9890
- if (source === false) return;
9891
- const def = {
9892
- name,
9893
- type,
9894
- label,
9895
- source,
9896
- required: !isFieldOptional(name, configSource),
9897
- ...opts
9898
- };
9899
- const validation = buildValidationRules(def, country, configSource);
9900
- if (validation.length > 0) def.validation = validation;
9901
- defs.push(def);
9902
- };
9903
- const nameSource = fields.name || (NAME_SOURCES.includes(configSource) ? "user_input" : false);
9904
- if (nameSource) {
9905
- add("firstName", "text", "verification.labels.firstName", nameSource, {
9906
- maxLength: 100,
9907
- placeholder: "verification.placeholder.firstName"
9908
- });
9909
- if (MIDDLE_NAME_SOURCES.includes(configSource)) add("middleName", "text", "verification.labels.middleName", nameSource, {
9910
- maxLength: 100,
9911
- placeholder: "verification.placeholder.middleName",
9912
- optional: true
9913
- });
9914
- add("surName", "text", country === "US" ? "verification.labels.lastName" : "verification.labels.surName", nameSource, {
9915
- maxLength: 100,
9916
- placeholder: country === "US" ? "verification.placeholder.lastName" : "verification.placeholder.surname"
9917
- });
9918
- if (country === "MX") add("maternalSurname", "text", "verification.labels.maternalSurname", nameSource, {
9919
- maxLength: 100,
9920
- placeholder: "verification.placeholder.maternalSurname"
9921
- });
9922
- }
9923
- if (fields["date of birth"]) add("dateOfBirth", "date", "verification.labels.dateOfBirth", fields["date of birth"]);
9924
- const emailSource = fields.email || (EMAIL_SOURCES.includes(configSource) ? "user_input" : false);
9925
- if (emailSource) add("email", "text", "verification.labels.email", emailSource, { placeholder: "verification.placeholder.email" });
9926
- if (fields.phone) {
9927
- const phoneCountrySelectorDisabled = enablePhoneRisk && configSource !== "PHONE_RISK_1" || COUNTRY_SELECTOR_DISABLED_SOURCES.includes(configSource);
9928
- add("phone", "phone", "verification.labels.phone", fields.phone, { disableCountrySelector: phoneCountrySelectorDisabled });
9929
- }
9930
- if (fields.SSN) if (country === "BR" || TAX_ID_SOURCES.includes(configSource)) add("taxId", "text", "verification.labels.taxId", fields.SSN, { ...country === "BR" && { displayLabel: "CPF" } });
9931
- else if (country === "CN") add("ssn", "text", "verification.labels.prcId", fields.SSN);
9932
- else add("ssn", "text", "verification.labels.ssn", fields.SSN, { maxLength: 11 });
9933
- if (fields.nationality) if (country === "BR") add("nationality", "dropdown", "verification.labels.nationality", fields.nationality, { options: [
9934
- {
9935
- value: "brazilian",
9936
- label: "verification.labels.brazilian"
9937
- },
9938
- {
9939
- value: "naturalizedBrazilian",
9940
- label: "verification.labels.naturalizedBrazilian"
9941
- },
9942
- {
9943
- value: "foreigner",
9944
- label: "verification.labels.foreigner"
9945
- },
9946
- {
9947
- value: "brazilianBornAbroad",
9948
- label: "verification.labels.brazilianBornAbroad"
9949
- }
9950
- ] });
9951
- else add("nationality", "text", "verification.labels.nationality", fields.nationality);
9952
- if (fields.last4SSN) add("last4SSN", "text", "verification.labels.last4SSN", fields.last4SSN, { maxLength: 4 });
9953
- if (fields.idNum) add("idNum", "text", "verification.labels.idNum", fields.idNum, { maxLength: 13 });
9954
- if (fields.idNum1) add("idNum1", "text", "verification.labels.idNum1", fields.idNum1);
9955
- if (fields.gender) add("gender", "radio", "verification.labels.gender", fields.gender, { options: [{
9956
- value: "F",
9957
- label: "common.female"
9958
- }, {
9959
- value: "M",
9960
- label: "common.male"
9961
- }] });
9962
- if (fields.panNumber) add("panNumber", "text", "verification.labels.panNumber", fields.panNumber, { maxLength: 10 });
9963
- const addAddressFields = () => {
9964
- const needsAddress = HOUSE_NO_SOURCES.includes(configSource) || STREET_SOURCES.includes(configSource) || ADDRESS_STATE_SOURCES.includes(configSource);
9965
- const addrSource = fields.address || (needsAddress ? "user_input" : false);
9966
- if (!addrSource) return;
9967
- if (HOUSE_NO_SOURCES.includes(configSource)) add("houseNo", "text", "verification.labels.houseNo", addrSource, { section: "address" });
9968
- if (STREET_SOURCES.includes(configSource)) add("street", "text", "verification.labels.street", addrSource, { section: "address" });
9969
- if (CITY_SOURCES.includes(configSource)) add("city", "text", "verification.labels.city", addrSource, { section: "address" });
9970
- if (ADDRESS_STATE_SOURCES.includes(configSource)) add("state", country === "US" ? "dropdown" : "text", country === "US" ? "verification.labels.chooseState" : "verification.labels.state", addrSource, {
9971
- section: "address",
9972
- ...country === "US" ? {
9973
- options: usStateOptions,
9974
- placeholder: "verification.placeholder.state"
9975
- } : {
9976
- placeholder: "verification.placeholder.stateCode",
9977
- placeholderParams: { states: STATE_CODE_HINTS[country] ?? "" }
9978
- }
9979
- });
9980
- if (POSTAL_CODE_SOURCES.includes(configSource)) add("postalCode", "text", country === "US" ? "verification.labels.zipCode" : "verification.labels.postalCode", addrSource, {
9981
- section: "address",
9982
- maxLength: getPostalCodeMaxLength(country)
9983
- });
9984
- };
9985
- const addDriversLicenseFields = () => {
9986
- if (fields.dlNumber) add("dlNumber", "text", "verification.labels.dlNumber", fields.dlNumber, { section: "driverLicense" });
9987
- if (fields.dlState) add("dlState", "dropdown", "verification.labels.dlState", fields.dlState, {
9988
- section: "driverLicense",
9989
- options: usStateOptions,
9990
- placeholder: "verification.placeholder.state"
9991
- });
9992
- if (fields.dlExpireAt) add("dlExpireAt", "date", "verification.labels.dlExpireAt", fields.dlExpireAt, { section: "driverLicense" });
9993
- };
9994
- if (configSource === "US_TELCO_1") {
9995
- addDriversLicenseFields();
9996
- addAddressFields();
9997
- } else {
9998
- addAddressFields();
9999
- addDriversLicenseFields();
10000
- }
10001
- return defs;
10002
- }
10003
- function applyPrefill(fields, ocrData, otpStatus, _country) {
10004
- const values = {};
10005
- const prefilled = {};
10006
- const readonlyFields = [];
10007
- let hideEmail = false;
10008
- if (fields.name === "document_scan" && ocrData?.name) {
10009
- if (ocrData.name.firstName) {
10010
- values.firstName = ocrData.name.firstName;
10011
- prefilled.firstName = true;
10012
- readonlyFields.push("firstName");
10013
- }
10014
- if (ocrData.name.paternalLastName) {
10015
- values.surName = ocrData.name.paternalLastName;
10016
- prefilled.surName = true;
10017
- readonlyFields.push("surName");
10018
- }
10019
- if (ocrData.name.middleName) {
10020
- values.middleName = ocrData.name.middleName;
10021
- prefilled.middleName = true;
10022
- readonlyFields.push("middleName");
10023
- }
10024
- if (ocrData.name.maternalLastName) {
10025
- values.maternalSurname = ocrData.name.maternalLastName;
10026
- prefilled.maternalSurname = true;
10027
- readonlyFields.push("maternalSurname");
10028
- }
10029
- }
10030
- if (fields["date of birth"] === "document_scan" && ocrData?.birthDate) {
10031
- values.dateOfBirth = ocrData.birthDate;
10032
- prefilled.dateOfBirth = true;
10033
- readonlyFields.push("dateOfBirth");
10034
- }
10035
- const addressSource = fields.address;
10036
- if (addressSource === "document_scan" || addressSource === "poa_document") {
10037
- const addrData = addressSource === "poa_document" ? ocrData?.addressFieldsFromStatement ?? void 0 : ocrData?.addressFields ?? ocrData?.checkedAddressBean ?? void 0;
10038
- if (addrData) {
10039
- if (addrData.street) {
10040
- values.street = addrData.street;
10041
- prefilled.street = true;
10042
- readonlyFields.push("street");
10043
- }
10044
- if (addrData.city) {
10045
- values.city = addrData.city;
10046
- prefilled.city = true;
10047
- readonlyFields.push("city");
10048
- }
10049
- if (addrData.state) {
10050
- values.state = addrData.state;
10051
- prefilled.state = true;
10052
- readonlyFields.push("state");
10053
- }
10054
- if (addrData.postalCode) {
10055
- values.postalCode = addrData.postalCode;
10056
- prefilled.postalCode = true;
10057
- readonlyFields.push("postalCode");
10058
- }
10059
- if (addrData.houseNumber) {
10060
- values.houseNo = addrData.houseNumber;
10061
- prefilled.houseNo = true;
10062
- readonlyFields.push("houseNo");
10063
- }
10064
- }
10065
- }
10066
- if (fields.phone === "phone_module_input" && otpStatus?.phone) {
10067
- values.phone = otpStatus.phone;
10068
- prefilled.phone = true;
10069
- readonlyFields.push("phone");
10070
- }
10071
- if (fields.email === "email_module_input" && otpStatus?.email) {
10072
- values.email = otpStatus.email;
10073
- prefilled.email = true;
10074
- hideEmail = true;
10075
- }
10076
- return {
10077
- values,
10078
- prefilled,
10079
- hideEmail,
10080
- readonlyFields
10081
- };
10082
- }
10083
- function buildSubmitPayload(ctx) {
10084
- const payload = {};
10085
- for (const field of ctx.fields) {
10086
- const val = ctx.values[field.name];
10087
- if (val !== void 0 && val !== "") payload[field.name] = val;
10088
- }
10089
- if (payload.nationality) payload.nationality = payload.nationality.toUpperCase();
10090
- if (ctx.fieldsCountry) payload.countryCode = ctx.fieldsCountry;
10091
- if (ctx.hideEmail && ctx.values.email) payload.email = ctx.values.email;
10092
- if (payload.ssn && (ctx.fieldsCountry === "US" || ctx.fieldsCountry === "CA")) payload.ssn = payload.ssn.replace(/-/g, "");
10093
- if (payload.postalCode) payload.postalCode = payload.postalCode.replace(/[-\s]/g, "");
10094
- if (payload.phone) payload.phone = formatPhoneE164(payload.phone, ctx.fieldsCountry);
10095
- if (payload.state) payload.state = payload.state.toUpperCase();
10096
- if (ctx.configSource === "UK_CREDIT_BUREAU_1" && payload.countryCode) payload.country = payload.countryCode;
10097
- if (ctx.configSource === "US_DRIVERS_LICENSE_1" && payload.dlState) payload.state = payload.dlState;
10098
- return {
10099
- ...payload,
10100
- plugins: ["kyc"],
10101
- source: ctx.configSource
10102
- };
10103
- }
10104
- function processFieldValue(name, value, fieldsCountry) {
10105
- if ((name === "firstName" || name === "surName" || name === "middleName" || name === "maternalSurname") && value) return cleanName(value);
10106
- if (name === "ssn" && (fieldsCountry === "US" || fieldsCountry === "CA")) return formatSSN(value);
10107
- if (name === "postalCode") return formatPostalCode(value, fieldsCountry);
10108
- if (name === "panNumber") return value.replace(/[^a-zA-Z0-9]/g, "").toUpperCase();
10109
- return value;
10110
- }
10111
- //#endregion
10112
- //#region src/modules/ekyc/ekycServices.ts
10113
- /** Fetches module configuration for EXTERNAL_VERIFICATION */
10114
- async function fetchModuleConfig(flowId, signal) {
10115
- const url = `${endpoints.moduleConfig}?id=${encodeURIComponent(flowId)}&moduleKey=EXTERNAL_VERIFICATION`;
10116
- const res = await api.get(url, { signal });
10117
- if (!res.ok) throw new Error(`GET ${url} failed: ${res.status} ${res.statusText}`);
10118
- return res.data;
10119
- }
10120
- /** Fetches OCR data for pre-fill */
10121
- async function fetchOcrData(signal) {
10122
- const res = await api.get(endpoints.ocrData, { signal });
10123
- if (!res.ok) throw new Error(`GET ${endpoints.ocrData} failed: ${res.status} ${res.statusText}`);
10124
- return res.data;
10125
- }
10126
- /** Fetches phone/email from prior OTP modules */
10127
- async function fetchOtpStatus(signal) {
10128
- const res = await api.get(endpoints.otpStatus, { signal });
10129
- if (!res.ok) throw new Error(`GET ${endpoints.otpStatus} failed: ${res.status} ${res.statusText}`);
10130
- return res.data;
10131
- }
10132
- var EkycSubmitError = class extends Error {
10133
- constructor(status, apiError) {
10134
- super(`POST ${endpoints.ekycSubmit} failed: ${status} – ${apiError}`);
10135
- this.name = "EkycSubmitError";
10136
- this.status = status;
10137
- this.apiError = apiError;
10138
- }
10139
- };
10140
- /** Submits eKYC verification */
10141
- async function submitEkyc(data, signal) {
10142
- try {
10143
- return (await api.post(endpoints.ekycSubmit, data, { signal })).data;
10144
- } catch (err) {
10145
- const httpErr = err;
10146
- if (typeof httpErr.status === "number") {
10147
- const body = httpErr.data;
10148
- const apiError = body?.error ?? body?.message ?? String(err);
10149
- throw new EkycSubmitError(httpErr.status, apiError);
10150
- }
10151
- throw err;
10152
- }
10153
- }
10154
- //#endregion
10155
- //#region src/modules/ekyc/ekycGuards.ts
10156
- const hasNoValidationErrorsGuard = ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0;
10157
- const hasFlowIdGuard = ({ context }) => !!context.config.flowId;
10158
- const hasVerificationFieldsGuard = ({ context }) => !!context.config.verificationFields;
10159
- const COUNTRY_NOT_SUPPORTED_MSG = "Request unsuccessful. Country not supported for EKYC.";
10160
- const isCountryNotSupportedGuard = ({ event }) => {
10161
- const err = event.error;
10162
- return err instanceof EkycSubmitError && err.status === 400 && err.apiError === COUNTRY_NOT_SUPPORTED_MSG;
10163
- };
10164
- //#endregion
10165
- //#region src/modules/ekyc/ekycActors.ts
10166
- const fetchModuleConfigActor = fromPromise(async ({ input, signal }) => fetchModuleConfig(input.flowId, signal));
10167
- const fetchPrefillDataActor = fromPromise(async ({ signal }) => {
10168
- const [ocrData, otpStatus] = await Promise.all([fetchOcrData(signal).catch(() => void 0), fetchOtpStatus(signal).catch(() => void 0)]);
10169
- return {
10170
- ocrData,
10171
- otpStatus
10172
- };
10173
- });
10174
- const submitEkycActor = fromPromise(async ({ input, signal }) => submitEkyc(input, signal));
10175
- //#endregion
10176
- //#region src/modules/ekyc/ekycStateMachine.ts
10177
- const ADDRESS_AUTOCOMPLETE_KEYS = [
10178
- "street",
10179
- "city",
10180
- "state",
10181
- "postalCode",
10182
- "houseNo"
10183
- ];
10184
- const omitKeys = (errors, keys) => {
10185
- if (!errors) return void 0;
10186
- const next = { ...errors };
10187
- for (const key of keys) delete next[key];
10188
- return Object.keys(next).length > 0 ? next : void 0;
10189
- };
10190
- const ekycMachine = setup({
10191
- types: {
10192
- context: {},
10193
- events: {},
10194
- input: {}
10195
- },
10196
- actors: {
10197
- fetchModuleConfig: fetchModuleConfigActor,
10198
- fetchPrefillData: fetchPrefillDataActor,
10199
- submitEkyc: submitEkycActor,
10200
- debounceSearch: debounceSearchActor
10201
- },
10202
- actions: {
10203
- setModuleConfig: assign(({ context, event }) => {
10204
- const config = event.output;
10205
- const source = config.source ?? context.config.source ?? "";
10206
- const country = context.config.fieldsCountry ?? getEKYCCountry(source);
10207
- const vFields = getEKYCFields(config);
10208
- return {
10209
- moduleConfig: config,
10210
- verificationFields: vFields,
10211
- configSource: source,
10212
- fieldsCountry: country,
10213
- fields: buildFieldDefs(vFields, source, country, config.enablePhoneRisk)
10214
- };
10215
- }),
10216
- applyPrefillData: assign(({ context, event }) => {
10217
- const { ocrData, otpStatus } = event.output;
10218
- const { values, prefilled, hideEmail, readonlyFields } = applyPrefill(context.verificationFields, ocrData, otpStatus, context.fieldsCountry);
10219
- return {
10220
- values,
10221
- prefilled,
10222
- hideEmail,
10223
- fields: context.fields.map((f) => ({
10224
- ...f,
10225
- readonly: readonlyFields.includes(f.name) ? true : f.readonly
10226
- }))
10227
- };
10228
- }),
10229
- updateField: assign(({ context, event }) => {
10230
- if (event.type !== "DATA_CHANGED") return {};
10231
- const processedValue = processFieldValue(event.name, event.value, context.fieldsCountry);
10232
- return {
10233
- values: {
10234
- ...context.values,
10235
- [event.name]: processedValue
10236
- },
10237
- submitError: ""
10238
- };
10239
- }),
10240
- clearFieldValidationError: assign(({ context, event }) => {
10241
- if (event.type !== "DATA_CHANGED") return {};
10242
- const errs = context.validationErrors;
10243
- if (!errs?.[event.name]) return {};
10244
- const next = { ...errs };
10245
- delete next[event.name];
10246
- return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
10247
- }),
10248
- validateFormField: assign(({ context, event }) => {
10249
- if (event.type !== "VALIDATE_FIELD") return {};
10250
- const message = validateEkycField(context.values, event.name, context.fields);
10251
- const next = { ...context.validationErrors ?? {} };
10252
- if (message) next[event.name] = message;
10253
- else delete next[event.name];
10254
- return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
10255
- }),
10256
- computeValidationResult: assign(({ context }) => {
10257
- const errors = validateEkycForm(context.values, context.fields);
10258
- return { validationErrors: Object.keys(errors).length > 0 ? errors : void 0 };
10259
- }),
10260
- fillAddressFields: assign(({ context, event }) => {
10261
- const { suggestion } = event;
10262
- const activeFields = new Set(context.fields.map((f) => f.name));
10263
- const { values: newValues } = fillFromSuggestion(context.values, {}, suggestion, activeFields);
10264
- const clearedErrors = omitKeys(context.validationErrors, ADDRESS_AUTOCOMPLETE_KEYS);
10265
- const streetError = getStreetLevelErrorForSuggestion(suggestion, activeFields);
10266
- const validationErrors = {
10267
- ...clearedErrors ?? {},
10268
- ...streetError !== void 0 ? { street: streetError } : {}
10269
- };
10270
- return {
10271
- values: newValues,
10272
- addressSuggestions: [],
10273
- _searchQuery: "",
10274
- validationErrors: Object.keys(validationErrors).length > 0 ? validationErrors : void 0,
10275
- submitError: ""
10276
- };
10277
- }),
10278
- setAddressSuggestions: assign(({ event }) => ({ addressSuggestions: event.suggestions })),
10279
- setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
10280
- clearErrorMessage: assign({ errorMessage: () => "" }),
10281
- setSubmitError: assign(() => ({ submitError: "verification.errors.countryNotSupported" })),
10282
- clearSubmitError: assign({ submitError: () => "" })
10283
- },
10284
- guards: {
10285
- hasNoValidationErrors: hasNoValidationErrorsGuard,
10286
- hasFlowId: hasFlowIdGuard,
10287
- hasVerificationFields: hasVerificationFieldsGuard,
10288
- isCountryNotSupported: isCountryNotSupportedGuard
10289
- }
10290
- }).createMachine({
10291
- id: "ekyc",
10292
- initial: "idle",
10293
- context: ({ input }) => {
10294
- const config = toEkycConfig(input.config);
10295
- return {
10296
- config,
10297
- moduleConfig: void 0,
10298
- verificationFields: {},
10299
- configSource: config.source ?? "",
10300
- fieldsCountry: config.fieldsCountry ?? "",
10301
- fields: [],
10302
- values: {},
10303
- addressSuggestions: [],
10304
- prefilled: {},
10305
- hideEmail: false,
10306
- errorMessage: "",
10307
- submitError: "",
10308
- _searchQuery: ""
10309
- };
10310
- },
10311
- states: {
10312
- idle: { on: { LOAD: [
10313
- {
10314
- target: "loading",
10315
- guard: "hasFlowId"
10316
- },
10317
- {
10318
- target: "prefilling",
10319
- guard: "hasVerificationFields",
10320
- actions: assign(({ context }) => {
10321
- const vFields = context.config.verificationFields;
10322
- const source = context.config.source ?? "";
10323
- const country = context.config.fieldsCountry ?? getEKYCCountry(source);
10324
- return {
10325
- verificationFields: vFields,
10326
- configSource: source,
10327
- fieldsCountry: country,
10328
- fields: buildFieldDefs(vFields, source, country, context.config.enablePhoneRisk)
10329
- };
10330
- })
10331
- },
10332
- { target: "misconfigured" }
10333
- ] } },
10334
- loading: { invoke: {
10335
- id: "fetchModuleConfig",
10336
- src: "fetchModuleConfig",
10337
- input: ({ context }) => ({ flowId: context.config.flowId }),
10338
- onDone: {
10339
- target: "prefilling",
10340
- actions: "setModuleConfig"
10341
- },
10342
- onError: {
10343
- target: "error",
10344
- actions: "setErrorMessage"
10345
- }
10346
- } },
10347
- prefilling: { invoke: {
10348
- id: "fetchPrefillData",
10349
- src: "fetchPrefillData",
10350
- onDone: {
10351
- target: "form",
10352
- actions: "applyPrefillData"
10353
- },
10354
- onError: { target: "form" }
10355
- } },
10356
- form: {
10357
- initial: "inputting",
10358
- states: {
10359
- inputting: { on: {
10360
- DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
10361
- VALIDATE_FIELD: { actions: "validateFormField" },
10362
- SUBMIT: { target: "validatingSubmit" }
10363
- } },
10364
- searching: {
10365
- invoke: {
10366
- id: "debounceSearch",
10367
- src: "debounceSearch",
10368
- input: ({ context }) => ({ query: context._searchQuery })
10369
- },
10370
- on: {
10371
- DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
10372
- VALIDATE_FIELD: { actions: "validateFormField" },
10373
- RESULTS: {
10374
- target: "inputting",
10375
- actions: "setAddressSuggestions"
10376
- }
10377
- }
10378
- },
10379
- validatingSubmit: {
10380
- entry: "computeValidationResult",
10381
- always: [{
10382
- guard: "hasNoValidationErrors",
10383
- target: "#ekyc.submitting"
10384
- }, { target: "inputting" }]
10385
- }
10386
- },
10387
- on: {
10388
- SEARCH_ADDRESS: {
10389
- target: ".searching",
10390
- actions: assign(({ event }) => ({
10391
- _searchQuery: event.query,
10392
- addressSuggestions: []
10393
- }))
10394
- },
10395
- SELECT_ADDRESS: {
10396
- target: ".inputting",
10397
- actions: "fillAddressFields"
10398
- },
10399
- SKIP: { target: "#ekyc.finished" },
10400
- CLOSE: { target: "#ekyc.closed" }
10401
- }
10402
- },
10403
- submitting: { invoke: {
10404
- id: "submitEkyc",
10405
- src: "submitEkyc",
10406
- input: ({ context }) => buildSubmitPayload(context),
10407
- onDone: { target: "success" },
10408
- onError: [{
10409
- target: "form",
10410
- guard: "isCountryNotSupported",
10411
- actions: "setSubmitError"
10412
- }, {
10413
- target: "error",
10414
- actions: "setErrorMessage"
10415
- }]
10416
- } },
10417
- success: { after: { 3e3: "finished" } },
10418
- error: { on: {
10419
- RETRY: {
10420
- target: "form",
10421
- actions: "clearErrorMessage"
10422
- },
10423
- SKIP: { target: "finished" },
10424
- CLOSE: { target: "closed" }
10425
- } },
10426
- misconfigured: { on: { CLOSE: { target: "closed" } } },
10427
- finished: { type: "final" },
10428
- closed: { type: "final" }
10429
- }
10430
- });
10431
- //#endregion
10432
- export { ekycMachine as t };
9813
+ export { PhoneValidationProvider as t };