@incodetech/core 2.0.1 → 2.1.0-rc.1

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 (218) hide show
  1. package/dist/{BrowserStorageProvider-CuOW1Er2.esm.js → BrowserStorageProvider-BpJM-gIl.esm.js} +8 -1
  2. package/dist/{IpifyProvider-D7jx52AL.esm.js → IpifyProvider-D4LWD15E.esm.js} +28 -0
  3. package/dist/{MotionSensorProvider-4v7xkqAp.esm.js → MotionSensorProvider-Bx7Mpzt0.esm.js} +63 -13
  4. package/dist/{OpenViduRecordingProvider-CMu6XVdc.esm.js → OpenViduRecordingProvider-O4GjBseO.esm.js} +1 -1
  5. package/dist/StateMachine-BC_nGvrc.d.ts +2 -0
  6. package/dist/StreamCanvasCapture-ImiDQdVA.esm.js +118 -0
  7. package/dist/StreamCanvasCapture-yyl20qd9.d.ts +152 -0
  8. package/dist/{BaseWasmProvider-C_DLEI40.esm.js → WasmUtilProvider-BKWm8rSA.esm.js} +202 -11
  9. package/dist/{addressSearch-BpTbTWCa.esm.js → addressSearch-DvmWXKZg.esm.js} +63 -57
  10. package/dist/{ae-signature-DDDZmWXj.esm.js → ae-signature-BFZta3TZ.esm.js} +1 -1
  11. package/dist/ae-signature.d.ts +3 -3
  12. package/dist/ae-signature.esm.js +6 -5
  13. package/dist/antifraud.d.ts +5 -46
  14. package/dist/antifraud.esm.js +6 -43
  15. package/dist/antifraudManager-CkV4u-LE.esm.js +55 -0
  16. package/dist/antifraudManager-CznnhyvD.d.ts +63 -0
  17. package/dist/{antifraudStateMachine-O0TMf6yc.esm.js → antifraudStateMachine-Ccrb-Jxc.esm.js} +2 -2
  18. package/dist/apiError-B-j-gyDx.esm.js +51 -0
  19. package/dist/authentication.d.ts +13 -11
  20. package/dist/authentication.esm.js +26 -22
  21. package/dist/{authenticationManager-5M-fKzXx.esm.js → authenticationManager-BlR6mSaG.esm.js} +6 -6
  22. package/dist/{authenticationManager-C83GNIhl.d.ts → authenticationManager-CaiQbp-q.d.ts} +4 -4
  23. package/dist/{authenticationStateMachine-BMZqatiF.esm.js → authenticationStateMachine-DkcGUMw5.esm.js} +21 -9
  24. package/dist/{backCameraStream-DMdMeGk2.esm.js → backCameraStream-D7Wo4Nbx.esm.js} +95 -7
  25. package/dist/{session-CrkWAs-q.esm.js → browserSimulation-B1dWiXp7.esm.js} +61 -476
  26. package/dist/camera.d.ts +4 -3
  27. package/dist/camera.esm.js +4 -3
  28. package/dist/canvas-SKcRBxsk.esm.js +230 -0
  29. package/dist/consent.d.ts +4 -398
  30. package/dist/consent.esm.js +6 -77
  31. package/dist/consentManager-BYo9Nu1r.esm.js +90 -0
  32. package/dist/consentManager-Cg5Sk2tv.d.ts +419 -0
  33. package/dist/{consentStateMachine-CCT-B60O.esm.js → consentStateMachine-BG3yL8aC.esm.js} +9 -6
  34. package/dist/cpf-ocr.d.ts +4 -199
  35. package/dist/cpf-ocr.esm.js +8 -177
  36. package/dist/cpfOcrManager-Dg1s_TY5.d.ts +216 -0
  37. package/dist/cpfOcrManager-sSKegxox.esm.js +190 -0
  38. package/dist/cross-document-data-match.d.ts +1 -1
  39. package/dist/cross-document-data-match.esm.js +4 -4
  40. package/dist/curp-validation.d.ts +8 -158
  41. package/dist/curp-validation.esm.js +6 -108
  42. package/dist/curpValidationManager-CFem6zP9.esm.js +122 -0
  43. package/dist/curpValidationManager-RttixpIc.d.ts +184 -0
  44. package/dist/{curpValidationStateMachine-CitWLr2c.esm.js → curpValidationStateMachine-B7V_qp66.esm.js} +20 -13
  45. package/dist/custom-fields.d.ts +2 -2
  46. package/dist/custom-fields.esm.js +4 -4
  47. package/dist/custom-watchlist.d.ts +1 -1
  48. package/dist/custom-watchlist.esm.js +4 -41
  49. package/dist/customWatchlistStateMachine-HmFybXLX.esm.js +50 -0
  50. package/dist/{deepsightLoader-Cm4JIT_z.esm.js → deepsightLoader-8tnddNx-.esm.js} +19 -10
  51. package/dist/deepsightService-CrHmvx8X.esm.js +276 -0
  52. package/dist/{deepsightService-CEVxzehb.d.ts → deepsightService-Dh5P-hLf.d.ts} +13 -160
  53. package/dist/device.esm.js +4 -3
  54. package/dist/document-capture.d.ts +989 -80
  55. package/dist/document-capture.esm.js +34 -8
  56. package/dist/document-upload.d.ts +44 -44
  57. package/dist/document-upload.esm.js +7 -7
  58. package/dist/{documentCaptureStateMachine-BqzTDy9k.esm.js → documentCaptureStateMachine-CUTUzUw_.esm.js} +90 -6
  59. package/dist/dynamic-forms.d.ts +20 -5
  60. package/dist/dynamic-forms.esm.js +150 -61
  61. package/dist/ekyb.d.ts +32 -13
  62. package/dist/ekyb.esm.js +25 -15
  63. package/dist/{ekybStateMachine-CyMx_kg-.esm.js → ekybStateMachine-klc-AImJ.esm.js} +319 -207
  64. package/dist/ekyc.d.ts +10 -78
  65. package/dist/ekyc.esm.js +17 -12
  66. package/dist/{ekycStateMachine-oeO0Iekd.esm.js → ekycStateMachine-CXbpaJJn.esm.js} +201 -113
  67. package/dist/electronic-signature.d.ts +3 -3
  68. package/dist/electronic-signature.esm.js +5 -4
  69. package/dist/{electronicSignatureManager-D9OHzTpG.esm.js → electronicSignatureManager-BaECdJ1u.esm.js} +91 -23
  70. package/dist/email.d.ts +4 -3
  71. package/dist/email.esm.js +6 -5
  72. package/dist/{emailManager-wAV0LE-H.esm.js → emailManager--D5G3ChB.esm.js} +30 -7
  73. package/dist/{emailManager-DIfnS5g1.d.ts → emailManager-lAzDoQOs.d.ts} +66 -8
  74. package/dist/{emailStateMachine-DOf4j58N.esm.js → emailStateMachine-CxTOMAjC.esm.js} +46 -11
  75. package/dist/{endpoints-CnN3SyDa.esm.js → endpoints-BeTK0Mlt.esm.js} +6 -3
  76. package/dist/{events-D6-e4vok.esm.js → events-Dvvriq9l.esm.js} +3 -1
  77. package/dist/events.d.ts +2 -0
  78. package/dist/events.esm.js +1 -1
  79. package/dist/extensibility.d.ts +41 -16
  80. package/dist/extensibility.esm.js +55 -33
  81. package/dist/face-match.d.ts +21 -2
  82. package/dist/face-match.esm.js +5 -5
  83. package/dist/{faceCaptureManagerFactory-yqtpxjnN.d.ts → faceCaptureManagerFactory-CjdBUS6s.d.ts} +48 -17
  84. package/dist/{faceCaptureManagerFactory-Dh2PdGlF.esm.js → faceCaptureManagerFactory-ej2j1LMr.esm.js} +21 -5
  85. package/dist/{faceCaptureSetup-B3faSpYA.esm.js → faceCaptureSetup-B9t6bYze.esm.js} +68 -183
  86. package/dist/{faceMatchStateMachine-DNFrxTFS.esm.js → faceMatchStateMachine-DeXXzSuz.esm.js} +62 -6
  87. package/dist/field-comparison.d.ts +4 -0
  88. package/dist/field-comparison.esm.js +7 -0
  89. package/dist/fieldComparisonManager-Bu5TaSr3.d.ts +76 -0
  90. package/dist/fieldComparisonManager-COGI2ARD.esm.js +162 -0
  91. package/dist/fiscal-qr.d.ts +59 -0
  92. package/dist/fiscal-qr.esm.js +323 -0
  93. package/dist/flow-events.d.ts +6 -5
  94. package/dist/flow.d.ts +23 -15
  95. package/dist/flow.esm.js +56 -17
  96. package/dist/flowCompletionService-BdR2cGgB.d.ts +19 -0
  97. package/dist/flowCompletionService-DdGojV9K.esm.js +20 -0
  98. package/dist/{flowServices-PiNsxLfK.esm.js → flowServices-ChgTNggJ.esm.js} +10 -5
  99. package/dist/geolocation.d.ts +4 -4
  100. package/dist/geolocation.esm.js +6 -6
  101. package/dist/{geolocationStateMachine-asasuHY2.esm.js → geolocationStateMachine-Dvh7X0wF.esm.js} +5 -5
  102. package/dist/getBrowser-C8DP7oTB.esm.js +8 -0
  103. package/dist/{getBrowser-BSXUTWXw.esm.js → getDeviceClass-C0olyNFS.esm.js} +1 -8
  104. package/dist/{getDeviceClass-BSntT9_j.esm.js → getDeviceClass-C8Do2qYu.esm.js} +1 -1
  105. package/dist/government-validation.d.ts +28 -8
  106. package/dist/government-validation.esm.js +19 -8
  107. package/dist/{governmentValidationStateMachine-BDDYrJTo.esm.js → governmentValidationStateMachine-DcJ-BfsC.esm.js} +35 -77
  108. package/dist/home.d.ts +15 -14
  109. package/dist/home.esm.js +2 -2
  110. package/dist/http-Cai3IoLS.esm.js +0 -0
  111. package/dist/http.esm.js +1 -0
  112. package/dist/id-ocr.d.ts +54 -54
  113. package/dist/id-ocr.esm.js +5 -5
  114. package/dist/id-verification.d.ts +27 -27
  115. package/dist/id-verification.esm.js +4 -4
  116. package/dist/id.d.ts +12 -10
  117. package/dist/id.esm.js +70 -27
  118. package/dist/{idCaptureManager-Fyd0eam-.d.ts → idCaptureManager-ChCNmgBj.d.ts} +40 -20
  119. package/dist/{idCaptureManager-D0ktk7Hh.esm.js → idCaptureManager-D3pwWutw.esm.js} +22 -7
  120. package/dist/{idCaptureStateMachine-dwlBUjbC.esm.js → idCaptureStateMachine-B3AiDIsT.esm.js} +172 -123
  121. package/dist/{idOcrStateMachine-YbjjC_Gg.esm.js → idOcrStateMachine-CDQ5d_VM.esm.js} +4 -4
  122. package/dist/{idVerificationStateMachine-xbw9HP1Z.esm.js → idVerificationStateMachine-kRxwImzO.esm.js} +2 -2
  123. package/dist/identity-reuse.d.ts +4 -530
  124. package/dist/identity-reuse.esm.js +8 -274
  125. package/dist/identityReuseManager-C6n_97dw.esm.js +95 -0
  126. package/dist/identityReuseManager-Cww-NDtd.d.ts +428 -0
  127. package/dist/identityReuseStateMachine-BfE5YiEr.esm.js +148 -0
  128. package/dist/{index-BcRG8rtJ.d.ts → index-B5hPA0Bg.d.ts} +2 -2
  129. package/dist/{index-ChHWNH48.d.ts → index-B9NysVDB.d.ts} +469 -195
  130. package/dist/index.d.ts +2 -2
  131. package/dist/index.esm.js +10 -8
  132. package/dist/{invokeOnCaptureCallback-rc6kBHo5.esm.js → invokeOnCaptureCallback-ygByVdnn.esm.js} +1 -1
  133. package/dist/{lib-BB0B_qQX.esm.js → lib-BY67lgbq.esm.js} +1 -1
  134. package/dist/mandatory-consent.d.ts +8 -412
  135. package/dist/mandatory-consent.esm.js +6 -76
  136. package/dist/mandatoryConsentManager-Dq6WiOZh.d.ts +429 -0
  137. package/dist/mandatoryConsentManager-H6D18cZB.esm.js +89 -0
  138. package/dist/{mandatoryConsentStateMachine-Cnco1jvn.esm.js → mandatoryConsentStateMachine-DtQNW1ji.esm.js} +6 -6
  139. package/dist/openviduLazy-B8L--0oe.esm.js +3 -0
  140. package/dist/{openviduLazy-Cok70ZSg.esm.js → openviduLazy-Dh14JNJc.esm.js} +2 -2
  141. package/dist/otp-CGMdUzBC.esm.js +33 -0
  142. package/dist/otp-DF5A0sFx.d.ts +8 -0
  143. package/dist/permissionGuards-D0wGddy7.esm.js +23 -0
  144. package/dist/permissionServices-Doec4X5L.esm.js +130 -0
  145. package/dist/phone.d.ts +4 -3
  146. package/dist/phone.esm.js +6 -5
  147. package/dist/{phoneManager-DAJbGhlY.esm.js → phoneManager-BmF-0Ez4.esm.js} +30 -7
  148. package/dist/{phoneManager-B6M30hKE.d.ts → phoneManager-fPmIBYQK.d.ts} +65 -7
  149. package/dist/{phoneStateMachine-CuPARRaT.esm.js → phoneStateMachine-BiV0yoEx.esm.js} +46 -11
  150. package/dist/{qe-signature-DFo_Cc-I.esm.js → qe-signature-CUYPcHVo.esm.js} +1 -1
  151. package/dist/qe-signature.d.ts +3 -3
  152. package/dist/qe-signature.esm.js +6 -5
  153. package/dist/{recordingService-Ig2UgbLv.esm.js → recordingService-yRw7hfzU.esm.js} +197 -179
  154. package/dist/redirect-to-mobile.d.ts +6 -104
  155. package/dist/redirect-to-mobile.esm.js +6 -99
  156. package/dist/redirectToMobileManager-BNe3IzC_.d.ts +178 -0
  157. package/dist/redirectToMobileManager-Dy3t7o0C.esm.js +159 -0
  158. package/dist/{redirectToMobileStateMachine-BOEqe46A.esm.js → redirectToMobileStateMachine-DyAdRxfP.esm.js} +28 -19
  159. package/dist/{runChildModule-CqqwqAkW.esm.js → runChildModule-CuoHZ1cx.esm.js} +35 -3
  160. package/dist/selfie.d.ts +13 -11
  161. package/dist/selfie.esm.js +53 -24
  162. package/dist/{selfieManager-Duisl7qN.esm.js → selfieManager-BNuTIGAz.esm.js} +6 -6
  163. package/dist/{selfieManager-D0lSgd-J.d.ts → selfieManager-C2y_t6DG.d.ts} +4 -4
  164. package/dist/{selfieStateMachine-D76whWEf.esm.js → selfieStateMachine-Bv99bZJE.esm.js} +5 -3
  165. package/dist/session-DoVb-OcB.esm.js +152 -0
  166. package/dist/session.d.ts +37 -5
  167. package/dist/session.esm.js +12 -7
  168. package/dist/sessionInitializer-DRB-hgbV.esm.js +366 -0
  169. package/dist/{setup-C5AITV8m.d.ts → setup-BwCluiw3.d.ts} +86 -6
  170. package/dist/{setup-DPPAxmXf.esm.js → setup-CUO4mErT.esm.js} +175 -25
  171. package/dist/signature.d.ts +2 -2
  172. package/dist/signature.esm.js +4 -4
  173. package/dist/{signatureStateMachine-B5-QVUve.esm.js → signatureStateMachine-C5qqYLRz.esm.js} +3 -3
  174. package/dist/stats-BMNUG1AU.esm.js +41 -0
  175. package/dist/stats.d.ts +13 -2
  176. package/dist/stats.esm.js +3 -2
  177. package/dist/trust-graph.d.ts +33 -4
  178. package/dist/trust-graph.esm.js +21 -15
  179. package/dist/{types-CFV9G_7j.d.ts → types-Bj9hdFjU.d.ts} +1 -1
  180. package/dist/{types-BP1m8VRw.d.ts → types-DOUhndhT.d.ts} +14 -2
  181. package/dist/types-DsnEVMhr.esm.js +34 -0
  182. package/dist/types-DvGZI7BF.d.ts +131 -0
  183. package/dist/{types-B06Ypu2F.d.ts → types-NuT8ftBV.d.ts} +1 -1
  184. package/dist/types-ya0LN_MX.d.ts +5 -0
  185. package/dist/{warmup-CEcppFiS.d.ts → warmup-Dg8Lh-50.d.ts} +8 -0
  186. package/dist/wasm.d.ts +6 -4
  187. package/dist/wasm.esm.js +11 -9
  188. package/dist/watchlist-for-business.d.ts +1 -1
  189. package/dist/watchlist-for-business.esm.js +5 -73
  190. package/dist/watchlist.d.ts +1 -1
  191. package/dist/watchlist.esm.js +4 -41
  192. package/dist/watchlistForBusinessStateMachine-DMl8j2Ov.esm.js +74 -0
  193. package/dist/watchlistStateMachine-DmQlqI6L.esm.js +50 -0
  194. package/dist/workflow.d.ts +146 -100
  195. package/dist/workflow.esm.js +116 -66
  196. package/package.json +19 -1
  197. package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
  198. package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
  199. package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
  200. package/dist/deepsightService-O74l4Y__.esm.js +0 -489
  201. package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
  202. package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
  203. package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
  204. package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
  205. package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
  206. package/dist/stats-CIfiPzb1.esm.js +0 -16
  207. package/dist/types-CAD4va6a.d.ts +0 -5
  208. package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
  209. /package/dist/{Actor-CI32dTbG.d.ts → Actor-Y0_Fj-KL.d.ts} +0 -0
  210. /package/dist/{ITimerCapability-C67ZRskg.esm.js → ITimerCapability-CB0I1Uf2.esm.js} +0 -0
  211. /package/dist/{Manager-C8PrhBOx.d.ts → Manager-BHn8wH8K.d.ts} +0 -0
  212. /package/dist/{camera-PA2Ljri3.esm.js → camera-DJWm3V4g.esm.js} +0 -0
  213. /package/dist/{camera-DBSxa6ML.d.ts → camera-SRBpPq2X.d.ts} +0 -0
  214. /package/dist/{chunk-CRF6K_H_.esm.js → chunk-CMUKZ2uL.esm.js} +0 -0
  215. /package/dist/{cpf-PPz2Njto.esm.js → cpf-BRzggV8G.esm.js} +0 -0
  216. /package/dist/{dateUtils-UoN5xswP.esm.js → dateUtils-AksLQmgV.esm.js} +0 -0
  217. /package/dist/{platform-CfrjKhmi.esm.js → platform-SKvEfCBh.esm.js} +0 -0
  218. /package/dist/{xstate.esm-B70JrNqo.esm.js → xstate.esm-C9wncMQa.esm.js} +0 -0
package/dist/ekyc.d.ts CHANGED
@@ -1,74 +1,7 @@
1
- import { t as Manager } from "./Manager-C8PrhBOx.js";
2
- import "./Actor-CI32dTbG.js";
3
- import { n as AddressSuggestion, r as FieldDef, t as DisplayErrorsResult } from "./displayErrors-DqJ_IbsG.js";
1
+ import { t as Manager } from "./Manager-BHn8wH8K.js";
2
+ import "./Actor-Y0_Fj-KL.js";
3
+ import { a as EkycValidationError, c as AddressSuggestion, i as EkycModuleConfig, n as EkycFieldDef, o as EkycValidationErrors, r as EkycFormValues, t as EkycConfig } from "./types-DvGZI7BF.js";
4
4
 
5
- //#region src/modules/ekyc/types.d.ts
6
- type EkycFieldSource = 'user_input' | 'document_scan' | 'poa_document' | 'phone_module_input' | 'email_module_input' | false;
7
- type EkycVerificationFields = {
8
- name?: EkycFieldSource;
9
- address?: EkycFieldSource;
10
- phone?: EkycFieldSource;
11
- email?: EkycFieldSource;
12
- SSN?: EkycFieldSource;
13
- taxId?: EkycFieldSource;
14
- nationality?: EkycFieldSource;
15
- 'date of birth'?: EkycFieldSource;
16
- dlNumber?: EkycFieldSource;
17
- dlState?: EkycFieldSource;
18
- dlExpireAt?: EkycFieldSource;
19
- last4SSN?: EkycFieldSource;
20
- idNum?: EkycFieldSource;
21
- idNum1?: EkycFieldSource;
22
- gender?: EkycFieldSource;
23
- panNumber?: EkycFieldSource;
24
- };
25
- type EkycModuleConfig = {
26
- source: string;
27
- enablePhoneRisk?: boolean;
28
- checkName?: boolean;
29
- nameSource?: string;
30
- checkEmail?: boolean;
31
- emailSource?: string;
32
- checkAddress?: boolean;
33
- addressSource?: string;
34
- checkPhone?: boolean;
35
- phoneSource?: string;
36
- checkSsn?: boolean;
37
- ssnSource?: string;
38
- checkDob?: boolean;
39
- dobSource?: string;
40
- checkNationality?: boolean;
41
- nationalitySource?: string;
42
- checkDlNumber?: boolean;
43
- dlNumberSource?: string;
44
- checkDlState?: boolean;
45
- dlStateSource?: string;
46
- checkDlExpireAt?: boolean;
47
- dlExpireAtSource?: string;
48
- checkLast4SSN?: boolean;
49
- last4SSNSource?: string;
50
- checkIdNum?: boolean;
51
- idNumSource?: string;
52
- checkIdNum1?: boolean;
53
- idNum1Source?: string;
54
- checkGender?: boolean;
55
- genderSource?: string;
56
- checkPanNumber?: boolean;
57
- panNumberSource?: string;
58
- };
59
- type EkycFormValues = Record<string, string | undefined>;
60
- /** Manager creation config */
61
- type EkycConfig = {
62
- flowId?: string;
63
- verificationFields?: EkycVerificationFields;
64
- source?: string;
65
- fieldsCountry?: string;
66
- enablePhoneRisk?: boolean;
67
- };
68
- type EkycFieldDef = FieldDef & {
69
- source: EkycFieldSource;
70
- };
71
- //#endregion
72
5
  //#region src/modules/ekyc/ekycStateMachine.d.ts
73
6
  declare const ekycMachine: any;
74
7
  //#endregion
@@ -85,14 +18,14 @@ type EkycFormState = {
85
18
  status: 'form';
86
19
  fields: EkycFieldDef[];
87
20
  values: EkycFormValues;
88
- errors: Record<string, string>;
21
+ validationErrors?: EkycValidationErrors;
22
+ /** True iff `validationErrors` is empty. Optimistic semantic: starts true on initial render. */
89
23
  isValid: boolean;
90
24
  addressSuggestions: AddressSuggestion[];
91
25
  prefilled: Record<string, boolean>;
92
26
  hideEmail: boolean;
93
27
  fieldsCountry: string;
94
28
  submitError: string;
95
- submitAttempted: boolean;
96
29
  };
97
30
  type EkycSubmittingState = {
98
31
  status: 'submitting';
@@ -123,13 +56,15 @@ type EkycState = EkycLoadingState | EkycFormState | EkycSubmittingState | EkycSu
123
56
  declare function createEkycManager(options: CreateEkycActorOptions): Manager<EkycState> & {
124
57
  /** Initializes the eKYC flow — fetches config and pre-fill data */
125
58
  load(): void;
126
- /** Sets a form field value and triggers revalidation */
59
+ /** Sets a form field value. Clears any existing validation error for this field. */
127
60
  setField(name: string, value: string): void;
61
+ /** Validates a single field (e.g., on blur). Populates or clears `validationErrors[name]`. */
62
+ validateField(name: string): void;
128
63
  /** Initiates a debounced address autocomplete search */
129
64
  searchAddress(query: string): void;
130
65
  /** Selects an address suggestion and populates address fields */
131
66
  selectAddress(suggestion: AddressSuggestion): void;
132
- /** Submits the form (requires isValid to be true) */
67
+ /** Submits the form. Runs full-form validation; advances only when no errors. */
133
68
  submit(): void;
134
69
  /** Retries from failure state, returning to the form */
135
70
  retry(): void;
@@ -140,9 +75,6 @@ declare function createEkycManager(options: CreateEkycActorOptions): Manager<Eky
140
75
  };
141
76
  type EkycManager = ReturnType<typeof createEkycManager>;
142
77
  //#endregion
143
- //#region src/modules/ekyc/ekycActions.d.ts
144
- declare function computeDisplayErrors(errors: Record<string, string>, touched: Record<string, boolean>, submitAttempted: boolean, country: string, fields?: EkycFieldDef[]): DisplayErrorsResult;
145
- //#endregion
146
78
  //#region src/modules/ekyc/ekycUtils.d.ts
147
79
  /**
148
80
  * Normalizes any supported eKYC config input into a manager-ready `EkycConfig`.
@@ -161,4 +93,4 @@ declare function computeDisplayErrors(errors: Record<string, string>, touched: R
161
93
  */
162
94
  declare function toEkycConfig(config: Partial<EkycModuleConfig> & Partial<EkycConfig>): EkycConfig;
163
95
  //#endregion
164
- export { type AddressSuggestion, type EkycConfig, type EkycManager, type EkycModuleConfig, type EkycState, computeDisplayErrors as computeEkycDisplayErrors, createEkycManager, ekycMachine, toEkycConfig };
96
+ export { type AddressSuggestion, type EkycConfig, type EkycManager, type EkycModuleConfig, type EkycState, type EkycValidationError, type EkycValidationErrors, createEkycManager, ekycMachine, toEkycConfig };
package/dist/ekyc.esm.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./BrowserTimerProvider-DhNc_x02.esm.js";
2
2
  import "./api-CESGtpbH.esm.js";
3
- import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
4
- import "./endpoints-CnN3SyDa.esm.js";
5
- import { c as createManager, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
6
- import "./cpf-PPz2Njto.esm.js";
7
- import "./addressSearch-BpTbTWCa.esm.js";
8
- import { n as computeDisplayErrors, r as toEkycConfig, t as ekycMachine } from "./ekycStateMachine-oeO0Iekd.esm.js";
3
+ import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dvvriq9l.esm.js";
4
+ import "./endpoints-BeTK0Mlt.esm.js";
5
+ import { c as createManager, s as createActor } from "./xstate.esm-C9wncMQa.esm.js";
6
+ import "./cpf-BRzggV8G.esm.js";
7
+ import "./addressSearch-DvmWXKZg.esm.js";
8
+ import { n as toEkycConfig, t as ekycMachine } from "./ekycStateMachine-CXbpaJJn.esm.js";
9
9
 
10
10
  //#region src/modules/ekyc/ekycActor.ts
11
11
  /**
@@ -26,14 +26,13 @@ function mapState(snapshot) {
26
26
  status: "form",
27
27
  fields: context.fields,
28
28
  values: context.values,
29
- errors: context.errors,
30
- isValid: context.isValid,
29
+ validationErrors: context.validationErrors,
30
+ isValid: Object.keys(context.validationErrors ?? {}).length === 0,
31
31
  addressSuggestions: context.addressSuggestions,
32
32
  prefilled: context.prefilled,
33
33
  hideEmail: context.hideEmail,
34
34
  fieldsCountry: context.fieldsCountry,
35
- submitError: context.submitError,
36
- submitAttempted: context.submitAttempted
35
+ submitError: context.submitError
37
36
  };
38
37
  if (typedSnapshot.matches("submitting")) return { status: "submitting" };
39
38
  if (typedSnapshot.matches("success")) return { status: "success" };
@@ -53,11 +52,17 @@ function createApi({ actor, trackElementClicked }) {
53
52
  },
54
53
  setField(name, value) {
55
54
  actor.send({
56
- type: "SET_FIELD",
55
+ type: "DATA_CHANGED",
57
56
  name,
58
57
  value
59
58
  });
60
59
  },
60
+ validateField(name) {
61
+ actor.send({
62
+ type: "VALIDATE_FIELD",
63
+ name
64
+ });
65
+ },
61
66
  searchAddress(query) {
62
67
  actor.send({
63
68
  type: "SEARCH_ADDRESS",
@@ -101,4 +106,4 @@ function createEkycManager(options) {
101
106
  }
102
107
 
103
108
  //#endregion
104
- export { computeDisplayErrors as computeEkycDisplayErrors, createEkycManager, ekycMachine, toEkycConfig };
109
+ export { createEkycManager, ekycMachine, toEkycConfig };
@@ -1,8 +1,8 @@
1
1
  import { t as api } from "./api-CESGtpbH.esm.js";
2
- import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
3
- import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
4
- import { t as validateCPF } from "./cpf-PPz2Njto.esm.js";
5
- import { a as POSTAL_CODE_FORMAT_ERROR_KEYS, c as getPostalCodeMaxLength, i as FIXED_DIGIT_POSTAL_CODE_LENGTH, l as validatePostalCode, n as fillFromSuggestion, o as formatPostalCode, r as DYNAMIC_REQUIRED_KEY, s as getPostalCodeErrorKey, t as debounceSearchActor, u as usStateOptions } from "./addressSearch-BpTbTWCa.esm.js";
2
+ import { t as endpoints } from "./endpoints-BeTK0Mlt.esm.js";
3
+ import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-C9wncMQa.esm.js";
4
+ import { t as validateCPF } from "./cpf-BRzggV8G.esm.js";
5
+ 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-DvmWXKZg.esm.js";
6
6
 
7
7
  //#region src/modules/ekyc/ekycConsts.ts
8
8
  const COUNTRY_SELECTOR_DISABLED_SOURCES = ["UK_VOTER_REGISTER"];
@@ -29,7 +29,6 @@ const DRIVERS_LICENSE_FIELDS = [
29
29
  "dlState",
30
30
  "dlExpireAt"
31
31
  ];
32
- const REQUIRED_ERROR_KEYS = new Set(["verification.errors.required"]);
33
32
  const DOB_OPTIONAL_SOURCES = ["US_TELCO_1", "UK_VOTER_REGISTER"];
34
33
  const ADDRESS_OPTIONAL_SOURCES = ["US_TELCO_1", "UK_VOTER_REGISTER"];
35
34
  const LAST4SSN_OPTIONAL_SOURCES = ["US_TELCO_1"];
@@ -120,6 +119,8 @@ const MIDDLE_NAME_SOURCES = [
120
119
  "CL_1",
121
120
  "INDIA_PAN"
122
121
  ];
122
+ const PHONE_RISK_ADDONS = ["phoneCheck", "advancedPhoneCheck"];
123
+ const EMAIL_RISK_ADDONS = ["emailCheck"];
123
124
 
124
125
  //#endregion
125
126
  //#region src/modules/ekyc/ekycUtils.ts
@@ -132,15 +133,22 @@ function mapToEKYCvalue(field) {
132
133
  default: return "user_input";
133
134
  }
134
135
  }
136
+ function hasRiskAddon(riskAddons, allowedAddons) {
137
+ return allowedAddons.some((addon) => riskAddons?.includes(addon));
138
+ }
135
139
  /** Maps raw backend module config to a field-source mapping */
136
140
  function getEKYCFields(config) {
141
+ const hasPhoneRiskAddon = hasRiskAddon(config.riskAddons, PHONE_RISK_ADDONS);
142
+ const hasEmailRiskAddon = hasRiskAddon(config.riskAddons, EMAIL_RISK_ADDONS);
143
+ const shouldRenderEmail = config.checkEmail || hasEmailRiskAddon;
144
+ const shouldRenderPhone = config.checkPhone || hasPhoneRiskAddon;
137
145
  return {
138
146
  name: config.checkName ? mapToEKYCvalue(config.nameSource ?? "") : false,
139
147
  SSN: config.checkSsn ? mapToEKYCvalue(config.ssnSource ?? "") : false,
140
148
  address: config.checkAddress ? mapToEKYCvalue(config.addressSource ?? "") : false,
141
149
  "date of birth": config.checkDob ? mapToEKYCvalue(config.dobSource ?? "") : false,
142
- email: config.checkEmail ? mapToEKYCvalue(config.emailSource ?? "") : false,
143
- phone: config.checkPhone ? mapToEKYCvalue(config.phoneSource ?? "") : false,
150
+ email: shouldRenderEmail ? mapToEKYCvalue(config.emailSource ?? "") : false,
151
+ phone: shouldRenderPhone ? mapToEKYCvalue(config.phoneSource ?? "") : false,
144
152
  nationality: config.checkNationality ? mapToEKYCvalue(config.nationalitySource ?? "") : false,
145
153
  dlNumber: config.checkDlNumber ? mapToEKYCvalue(config.dlNumberSource ?? "") : false,
146
154
  dlState: config.checkDlState ? mapToEKYCvalue(config.dlStateSource ?? "") : false,
@@ -178,7 +186,7 @@ function getEKYCCountry(source) {
178
186
  * distinguish a raw backend config from an unconfigured / empty input.
179
187
  */
180
188
  function hasRawSignal(c) {
181
- return Boolean(c.source || c.checkName || c.checkEmail || c.checkAddress || c.checkPhone || c.checkSsn || c.checkDob || c.checkNationality || c.checkDlNumber || c.checkDlState || c.checkDlExpireAt || c.checkLast4SSN || c.checkIdNum || c.checkIdNum1 || c.checkGender || c.checkPanNumber);
189
+ return Boolean(c.source || c.checkName || c.checkEmail || c.checkAddress || c.checkPhone || c.checkSsn || c.checkDob || c.checkNationality || c.checkDlNumber || c.checkDlState || c.checkDlExpireAt || c.checkLast4SSN || c.checkIdNum || c.checkIdNum1 || c.checkGender || c.checkPanNumber || c.riskAddons?.length);
182
190
  }
183
191
  /**
184
192
  * Normalizes any supported eKYC config input into a manager-ready `EkycConfig`.
@@ -10047,21 +10055,127 @@ function validatePhone(phone, country) {
10047
10055
  function formatPhoneE164(phone, country) {
10048
10056
  return phoneValidator.formatE164(phone, country) ?? phone;
10049
10057
  }
10058
+ const SSN_FORMAT_REGEX = /^\d{3}-\d{2}-\d{4}$/;
10059
+ const EMAIL_FORMAT_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
10060
+ const buildPostalCodeParams = (country) => {
10061
+ const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
10062
+ if (fixedLen !== void 0) return { length: fixedLen };
10063
+ let maxLen = getPostalCodeMaxLength(country);
10064
+ if (country === "US" || country === "BR") maxLen = maxLen - 1;
10065
+ return { maxLength: maxLen };
10066
+ };
10067
+ const createValidators = () => ({
10068
+ required: (value, _rule, field) => {
10069
+ if (value.trim().length > 0) return void 0;
10070
+ const fieldName = field.displayLabel ?? field.label;
10071
+ return fieldName ? {
10072
+ key: DYNAMIC_REQUIRED_KEY,
10073
+ params: { fieldName }
10074
+ } : { key: DYNAMIC_REQUIRED_KEY };
10075
+ },
10076
+ streetLevelRequired: (value) => {
10077
+ if (value.trim().length > 0) return void 0;
10078
+ return STREET_LEVEL_REQUIRED_ERROR;
10079
+ },
10080
+ cpf: (value) => {
10081
+ if (value.trim().length === 0) return void 0;
10082
+ return validateCPF(value) ? void 0 : { key: "verification.errors.invalidTaxId" };
10083
+ },
10084
+ ssnFormat: (value) => {
10085
+ if (value.trim().length === 0) return void 0;
10086
+ return SSN_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.ssnFormat" };
10087
+ },
10088
+ noPoBox: (value) => {
10089
+ if (value.trim().length === 0) return void 0;
10090
+ return isPoBox(value) ? { key: "verification.errors.poBox" } : void 0;
10091
+ },
10092
+ postalCodeFormat: (value, rule) => {
10093
+ if (rule.type !== "postalCodeFormat") return void 0;
10094
+ if (value.trim().length === 0) return void 0;
10095
+ if (validatePostalCode(value, rule.country)) return void 0;
10096
+ return {
10097
+ key: getPostalCodeErrorKey(rule.country),
10098
+ params: buildPostalCodeParams(rule.country)
10099
+ };
10100
+ },
10101
+ phoneFormat: (value, rule) => {
10102
+ if (rule.type !== "phoneFormat") return void 0;
10103
+ const trimmed = value.trim();
10104
+ if (rule.optional && trimmed.length === 0) return void 0;
10105
+ return validatePhone(trimmed, rule.country) ? void 0 : { key: "verification.errors.phoneInvalid" };
10106
+ },
10107
+ emailFormat: (value) => {
10108
+ if (value.trim().length === 0) return void 0;
10109
+ return EMAIL_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.emailInvalid" };
10110
+ },
10111
+ exactLength: (value, rule) => {
10112
+ if (rule.type !== "exactLength") return void 0;
10113
+ if (value.trim().length === 0) return void 0;
10114
+ return value.length === rule.length ? void 0 : { key: "verification.errors.exactly10Characters" };
10115
+ }
10116
+ });
10117
+ const normalizeFieldValue = (value) => typeof value === "string" ? value : String(value ?? "");
10118
+ const evaluateRules = (value, rules, field, validators) => {
10119
+ if (!rules) return void 0;
10120
+ for (const rule of rules) {
10121
+ const error = validators[rule.type](value, rule, field);
10122
+ if (error) return error;
10123
+ }
10124
+ };
10125
+ function validateEkycForm(values, fields) {
10126
+ const validators = createValidators();
10127
+ return fields.reduce((errors, field) => {
10128
+ const error = evaluateRules(normalizeFieldValue(values[field.name]), field.validation, field, validators);
10129
+ if (error) errors[field.name] = error;
10130
+ return errors;
10131
+ }, {});
10132
+ }
10133
+ function validateEkycField(values, fieldName, fields) {
10134
+ const field = fields.find((f) => f.name === fieldName);
10135
+ if (!field) return void 0;
10136
+ const validators = createValidators();
10137
+ return evaluateRules(normalizeFieldValue(values[field.name]), field.validation, field, validators);
10138
+ }
10050
10139
 
10051
10140
  //#endregion
10052
10141
  //#region src/modules/ekyc/ekycActions.ts
10142
+ function buildValidationRules(field, country, configSource) {
10143
+ const rules = [];
10144
+ if (field.required) rules.push({ type: "required" });
10145
+ if (field.name === "taxId" && country === "BR") rules.push({ type: "cpf" });
10146
+ if (field.name === "ssn" && (country === "US" || country === "CA")) rules.push({ type: "ssnFormat" });
10147
+ if (field.name === "street") rules.push({ type: "noPoBox" });
10148
+ if (field.name === "postalCode") rules.push({
10149
+ type: "postalCodeFormat",
10150
+ country
10151
+ });
10152
+ if (field.name === "phone") rules.push({
10153
+ type: "phoneFormat",
10154
+ country,
10155
+ optional: isFieldOptional("phone", configSource)
10156
+ });
10157
+ if (field.name === "email") rules.push({ type: "emailFormat" });
10158
+ if (field.name === "panNumber") rules.push({
10159
+ type: "exactLength",
10160
+ length: 10
10161
+ });
10162
+ return rules;
10163
+ }
10053
10164
  function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false) {
10054
10165
  const defs = [];
10055
10166
  const add = (name, type, label, source, opts) => {
10056
10167
  if (source === false) return;
10057
- defs.push({
10168
+ const def = {
10058
10169
  name,
10059
10170
  type,
10060
10171
  label,
10061
10172
  source,
10062
10173
  required: !isFieldOptional(name, configSource),
10063
10174
  ...opts
10064
- });
10175
+ };
10176
+ const validation = buildValidationRules(def, country, configSource);
10177
+ if (validation.length > 0) def.validation = validation;
10178
+ defs.push(def);
10065
10179
  };
10066
10180
  const nameSource = fields.name || (NAME_SOURCES.includes(configSource) ? "user_input" : false);
10067
10181
  if (nameSource) {
@@ -10163,68 +10277,6 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
10163
10277
  }
10164
10278
  return defs;
10165
10279
  }
10166
- function validateField(name, value, required, country, configSource) {
10167
- const val = (value ?? "").trim();
10168
- if (required && !val) return "verification.errors.required";
10169
- if (!val) return void 0;
10170
- if (name === "taxId" && country === "BR") return validateCPF(val) ? void 0 : "verification.errors.invalidTaxId";
10171
- if (name === "ssn" && (country === "US" || country === "CA")) return /^\d{3}-\d{2}-\d{4}$/.test(val) ? void 0 : "verification.errors.ssnFormat";
10172
- if (name === "street" && isPoBox(val)) return "verification.errors.poBox";
10173
- if (name === "postalCode") return validatePostalCode(val, country) ? void 0 : getPostalCodeErrorKey(country);
10174
- if (name === "phone") {
10175
- if (!isFieldOptional("phone", configSource) || val) return validatePhone(val, country) ? void 0 : "verification.errors.phoneInvalid";
10176
- }
10177
- if (name === "email" && val) return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val) ? void 0 : "verification.errors.emailInvalid";
10178
- if (name === "panNumber" && val) return val.length === 10 ? void 0 : "verification.errors.exactly10Characters";
10179
- }
10180
- function computeValidation(fields, values, country, configSource) {
10181
- const errors = {};
10182
- for (const field of fields) {
10183
- const err = validateField(field.name, values[field.name], field.required, country, configSource);
10184
- if (err) errors[field.name] = err;
10185
- }
10186
- return {
10187
- errors,
10188
- isValid: Object.keys(errors).length === 0
10189
- };
10190
- }
10191
- function computeDisplayErrors(errors, touched, submitAttempted, country, fields) {
10192
- const display = {};
10193
- const errorParams = {};
10194
- const fieldLabelMap = new Map(fields?.map((f) => [f.name, f.displayLabel ?? f.label]));
10195
- for (const [field, err] of Object.entries(errors)) {
10196
- const isRequiredErr = REQUIRED_ERROR_KEYS.has(err);
10197
- if (isRequiredErr && (submitAttempted || touched[field])) {
10198
- const label = fieldLabelMap.get(field);
10199
- if (label) {
10200
- display[field] = DYNAMIC_REQUIRED_KEY;
10201
- errorParams[field] = {
10202
- ...errorParams[field] ?? {},
10203
- fieldName: label
10204
- };
10205
- } else display[field] = DYNAMIC_REQUIRED_KEY;
10206
- } else if (!isRequiredErr && touched[field]) display[field] = err;
10207
- if (display[field] && field === "postalCode" && POSTAL_CODE_FORMAT_ERROR_KEYS.has(err)) {
10208
- const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
10209
- if (fixedLen !== void 0) errorParams[field] = {
10210
- ...errorParams[field] ?? {},
10211
- length: fixedLen
10212
- };
10213
- else {
10214
- let maxLen = getPostalCodeMaxLength(country);
10215
- if (country === "US" || country === "BR") maxLen = maxLen - 1;
10216
- errorParams[field] = {
10217
- ...errorParams[field] ?? {},
10218
- maxLength: maxLen
10219
- };
10220
- }
10221
- }
10222
- }
10223
- return {
10224
- displayErrors: display,
10225
- errorParams
10226
- };
10227
- }
10228
10280
  function applyPrefill(fields, ocrData, otpStatus, _country) {
10229
10281
  const values = {};
10230
10282
  const prefilled = {};
@@ -10380,7 +10432,7 @@ async function submitEkyc(data, signal) {
10380
10432
 
10381
10433
  //#endregion
10382
10434
  //#region src/modules/ekyc/ekycGuards.ts
10383
- const isValidGuard = ({ context }) => context.isValid;
10435
+ const hasNoValidationErrorsGuard = ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0;
10384
10436
  const hasFlowIdGuard = ({ context }) => !!context.config.flowId;
10385
10437
  const hasVerificationFieldsGuard = ({ context }) => !!context.config.verificationFields;
10386
10438
  const COUNTRY_NOT_SUPPORTED_MSG = "Request unsuccessful. Country not supported for EKYC.";
@@ -10403,6 +10455,19 @@ const submitEkycActor = fromPromise(async ({ input, signal }) => submitEkyc(inpu
10403
10455
 
10404
10456
  //#endregion
10405
10457
  //#region src/modules/ekyc/ekycStateMachine.ts
10458
+ const ADDRESS_AUTOCOMPLETE_KEYS = [
10459
+ "street",
10460
+ "city",
10461
+ "state",
10462
+ "postalCode",
10463
+ "houseNo"
10464
+ ];
10465
+ const omitKeys = (errors, keys) => {
10466
+ if (!errors) return void 0;
10467
+ const next = { ...errors };
10468
+ for (const key of keys) delete next[key];
10469
+ return Object.keys(next).length > 0 ? next : void 0;
10470
+ };
10406
10471
  const ekycMachine = setup({
10407
10472
  types: {
10408
10473
  context: {},
@@ -10432,45 +10497,62 @@ const ekycMachine = setup({
10432
10497
  applyPrefillData: assign(({ context, event }) => {
10433
10498
  const { ocrData, otpStatus } = event.output;
10434
10499
  const { values, prefilled, hideEmail, readonlyFields } = applyPrefill(context.verificationFields, ocrData, otpStatus, context.fieldsCountry);
10435
- const updatedFields = context.fields.map((f) => ({
10436
- ...f,
10437
- readonly: readonlyFields.includes(f.name) ? true : f.readonly
10438
- }));
10439
- const { errors, isValid } = computeValidation(updatedFields, values, context.fieldsCountry, context.configSource);
10440
10500
  return {
10441
10501
  values,
10442
10502
  prefilled,
10443
10503
  hideEmail,
10444
- fields: updatedFields,
10445
- errors,
10446
- isValid
10504
+ fields: context.fields.map((f) => ({
10505
+ ...f,
10506
+ readonly: readonlyFields.includes(f.name) ? true : f.readonly
10507
+ }))
10447
10508
  };
10448
10509
  }),
10449
10510
  updateField: assign(({ context, event }) => {
10450
- const { name, value } = event;
10451
- const processedValue = processFieldValue(name, value, context.fieldsCountry);
10452
- const newValues = {
10453
- ...context.values,
10454
- [name]: processedValue
10455
- };
10456
- const { errors, isValid } = computeValidation(context.fields, newValues, context.fieldsCountry, context.configSource);
10511
+ if (event.type !== "DATA_CHANGED") return {};
10512
+ const processedValue = processFieldValue(event.name, event.value, context.fieldsCountry);
10457
10513
  return {
10458
- values: newValues,
10459
- errors,
10460
- isValid,
10514
+ values: {
10515
+ ...context.values,
10516
+ [event.name]: processedValue
10517
+ },
10461
10518
  submitError: ""
10462
10519
  };
10463
10520
  }),
10521
+ clearFieldValidationError: assign(({ context, event }) => {
10522
+ if (event.type !== "DATA_CHANGED") return {};
10523
+ const errs = context.validationErrors;
10524
+ if (!errs?.[event.name]) return {};
10525
+ const next = { ...errs };
10526
+ delete next[event.name];
10527
+ return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
10528
+ }),
10529
+ validateFormField: assign(({ context, event }) => {
10530
+ if (event.type !== "VALIDATE_FIELD") return {};
10531
+ const message = validateEkycField(context.values, event.name, context.fields);
10532
+ const next = { ...context.validationErrors ?? {} };
10533
+ if (message) next[event.name] = message;
10534
+ else delete next[event.name];
10535
+ return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
10536
+ }),
10537
+ computeValidationResult: assign(({ context }) => {
10538
+ const errors = validateEkycForm(context.values, context.fields);
10539
+ return { validationErrors: Object.keys(errors).length > 0 ? errors : void 0 };
10540
+ }),
10464
10541
  fillAddressFields: assign(({ context, event }) => {
10465
10542
  const { suggestion } = event;
10466
10543
  const activeFields = new Set(context.fields.map((f) => f.name));
10467
10544
  const { values: newValues } = fillFromSuggestion(context.values, {}, suggestion, activeFields);
10468
- const { errors, isValid } = computeValidation(context.fields, newValues, context.fieldsCountry, context.configSource);
10545
+ const clearedErrors = omitKeys(context.validationErrors, ADDRESS_AUTOCOMPLETE_KEYS);
10546
+ const streetError = getStreetLevelErrorForSuggestion(suggestion, activeFields);
10547
+ const validationErrors = {
10548
+ ...clearedErrors ?? {},
10549
+ ...streetError !== void 0 ? { street: streetError } : {}
10550
+ };
10469
10551
  return {
10470
10552
  values: newValues,
10471
10553
  addressSuggestions: [],
10472
- errors,
10473
- isValid,
10554
+ _searchQuery: "",
10555
+ validationErrors: Object.keys(validationErrors).length > 0 ? validationErrors : void 0,
10474
10556
  submitError: ""
10475
10557
  };
10476
10558
  }),
@@ -10478,11 +10560,10 @@ const ekycMachine = setup({
10478
10560
  setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
10479
10561
  clearErrorMessage: assign({ errorMessage: () => "" }),
10480
10562
  setSubmitError: assign(() => ({ submitError: "verification.errors.countryNotSupported" })),
10481
- clearSubmitError: assign({ submitError: () => "" }),
10482
- markSubmitAttempted: assign({ submitAttempted: () => true })
10563
+ clearSubmitError: assign({ submitError: () => "" })
10483
10564
  },
10484
10565
  guards: {
10485
- isValid: isValidGuard,
10566
+ hasNoValidationErrors: hasNoValidationErrorsGuard,
10486
10567
  hasFlowId: hasFlowIdGuard,
10487
10568
  hasVerificationFields: hasVerificationFieldsGuard,
10488
10569
  isCountryNotSupported: isCountryNotSupportedGuard
@@ -10500,14 +10581,11 @@ const ekycMachine = setup({
10500
10581
  fieldsCountry: config.fieldsCountry ?? "",
10501
10582
  fields: [],
10502
10583
  values: {},
10503
- errors: {},
10504
- isValid: false,
10505
10584
  addressSuggestions: [],
10506
10585
  prefilled: {},
10507
10586
  hideEmail: false,
10508
10587
  errorMessage: "",
10509
10588
  submitError: "",
10510
- submitAttempted: false,
10511
10589
  _searchQuery: ""
10512
10590
  };
10513
10591
  },
@@ -10557,23 +10635,37 @@ const ekycMachine = setup({
10557
10635
  onError: { target: "form" }
10558
10636
  } },
10559
10637
  form: {
10560
- initial: "idle",
10638
+ initial: "inputting",
10561
10639
  states: {
10562
- idle: {},
10640
+ inputting: { on: {
10641
+ DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
10642
+ VALIDATE_FIELD: { actions: "validateFormField" },
10643
+ SUBMIT: { target: "validatingSubmit" }
10644
+ } },
10563
10645
  searching: {
10564
10646
  invoke: {
10565
10647
  id: "debounceSearch",
10566
10648
  src: "debounceSearch",
10567
10649
  input: ({ context }) => ({ query: context._searchQuery })
10568
10650
  },
10569
- on: { RESULTS: {
10570
- target: "idle",
10571
- actions: "setAddressSuggestions"
10572
- } }
10651
+ on: {
10652
+ DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
10653
+ VALIDATE_FIELD: { actions: "validateFormField" },
10654
+ RESULTS: {
10655
+ target: "inputting",
10656
+ actions: "setAddressSuggestions"
10657
+ }
10658
+ }
10659
+ },
10660
+ validatingSubmit: {
10661
+ entry: "computeValidationResult",
10662
+ always: [{
10663
+ guard: "hasNoValidationErrors",
10664
+ target: "#ekyc.submitting"
10665
+ }, { target: "inputting" }]
10573
10666
  }
10574
10667
  },
10575
10668
  on: {
10576
- SET_FIELD: { actions: "updateField" },
10577
10669
  SEARCH_ADDRESS: {
10578
10670
  target: ".searching",
10579
10671
  actions: assign(({ event }) => ({
@@ -10582,13 +10674,9 @@ const ekycMachine = setup({
10582
10674
  }))
10583
10675
  },
10584
10676
  SELECT_ADDRESS: {
10585
- target: ".idle",
10677
+ target: ".inputting",
10586
10678
  actions: "fillAddressFields"
10587
10679
  },
10588
- SUBMIT: [{
10589
- target: "submitting",
10590
- guard: "isValid"
10591
- }, { actions: "markSubmitAttempted" }],
10592
10680
  SKIP: { target: "#ekyc.finished" },
10593
10681
  CLOSE: { target: "#ekyc.closed" }
10594
10682
  }
@@ -10623,4 +10711,4 @@ const ekycMachine = setup({
10623
10711
  });
10624
10712
 
10625
10713
  //#endregion
10626
- export { computeDisplayErrors as n, toEkycConfig as r, ekycMachine as t };
10714
+ export { toEkycConfig as n, ekycMachine as t };
@@ -1,4 +1,4 @@
1
- import "./Manager-C8PrhBOx.js";
2
- import "./Actor-CI32dTbG.js";
3
- import { a as AE_CONSENT_KEYS, c as ConsentKey, d as ElectronicSignatureVariant, f as QE_CONSENT_KEYS, g as getDefaultConsentChecks, h as getConsentKeys, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, o as AeConsentKey, p as QeConsentKey, r as createElectronicSignatureManager, s as ConsentChecks, t as ElectronicSignatureManager, u as ElectronicSignatureDocument } from "./index-ChHWNH48.js";
1
+ import "./Manager-BHn8wH8K.js";
2
+ import "./Actor-Y0_Fj-KL.js";
3
+ import { a as AE_CONSENT_KEYS, c as ConsentKey, d as ElectronicSignatureVariant, f as QE_CONSENT_KEYS, g as getDefaultConsentChecks, h as getConsentKeys, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, o as AeConsentKey, p as QeConsentKey, r as createElectronicSignatureManager, s as ConsentChecks, t as ElectronicSignatureManager, u as ElectronicSignatureDocument } from "./index-B9NysVDB.js";
4
4
  export { AE_CONSENT_KEYS, AeConsentKey, ConsentChecks, ConsentKey, ElectronicSignatureConfig, ElectronicSignatureDocument, ElectronicSignatureManager, ElectronicSignatureState, ElectronicSignatureVariant, QE_CONSENT_KEYS, QeConsentKey, areAllConsented, createElectronicSignatureManager, electronicSignatureMachine, getConsentKeys, getDefaultConsentChecks };