@incodetech/core 2.3.2 → 2.4.0-rc.0

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 (267) hide show
  1. package/THIRD_PARTY_NOTICES.txt +1243 -3
  2. package/dist/Actor-DpTj5PFb.d.ts +1 -0
  3. package/dist/{BaseWasmProvider-Dyi6dKp1.d.ts → BaseWasmProvider-BL9wIRnN.d.ts} +2 -2
  4. package/dist/{FaceDetectionProvider-DtmtCKa9.esm.js → FaceDetectionProvider-BjTer9h3.esm.js} +126 -10
  5. package/dist/HttpRequestError-Bh0pNGSC.esm.js +35 -0
  6. package/dist/{IIdCaptureCapability-RNiFhvXR.d.ts → IIdCaptureCapability-DBsv9-7M.d.ts} +2 -2
  7. package/dist/{IWasmUtilCapability-CNWRl7jr.d.ts → IWasmUtilCapability-CPX0RGdQ.d.ts} +28 -5
  8. package/dist/{Manager-CQQ99QOI.d.ts → Manager-C9T5amUN.d.ts} +7 -1
  9. package/dist/{MotionSensorProvider-DyhbM4Si.esm.js → MotionSensorProvider-DYxh8TjR.esm.js} +1 -1
  10. package/dist/{ekycStateMachine-UeJRO8_p.esm.js → PhoneValidationProvider-SZiOS0jB.esm.js} +232 -827
  11. package/dist/{StreamCanvasCapture-_8gdW5Lk.d.ts → StreamCanvasCapture-DVmzJux5.d.ts} +2 -2
  12. package/dist/{safeStorage-BdU9_m2E.esm.js → WasmUtilProvider-CIdnE7Fx.esm.js} +95 -46
  13. package/dist/{addressSearch-DyHGgeX8.esm.js → addressSearch-BiYZjvp3.esm.js} +143 -4
  14. package/dist/{advanceableErrors-CpF2cBy6.esm.js → advanceableErrors-q_pfU3Cn.esm.js} +5 -4
  15. package/dist/ae-signature.d.ts +2 -2
  16. package/dist/ae-signature.esm.js +1 -1
  17. package/dist/antifraud.d.ts +1 -1
  18. package/dist/antifraud.esm.js +2 -2
  19. package/dist/{antifraudManager-BY36bS12.d.ts → antifraudManager-DbGCvlJs.d.ts} +2 -2
  20. package/dist/{antifraudManager-DNkw66oW.esm.js → antifraudManager-HL08jeDX.esm.js} +3 -3
  21. package/dist/{antifraudStateMachine-DBeq47D2.esm.js → antifraudStateMachine-DoJVzblM.esm.js} +3 -3
  22. package/dist/{apiError-CmGEmaGU.esm.js → apiError-DcSWedC6.esm.js} +2 -1
  23. package/dist/authentication.d.ts +3 -3
  24. package/dist/authentication.esm.js +2 -2
  25. package/dist/{authenticationManager-CboRCl_N.d.ts → authenticationManager-CANv5-W5.d.ts} +2 -8
  26. package/dist/{authenticationManager-BFjSjtQ_.esm.js → authenticationManager-SaiAxqvS.esm.js} +6 -6
  27. package/dist/{authenticationStateMachine-Dfo34ZiI.esm.js → authenticationStateMachine-CHSxmV7z.esm.js} +5 -6
  28. package/dist/avatar.d.ts +1 -1
  29. package/dist/{backCameraStream-B0-YgP_y.esm.js → backCameraStream-CMvXj4X4.esm.js} +1 -1
  30. package/dist/camera.esm.js +1 -1
  31. package/dist/certificate-issuance.d.ts +1 -1
  32. package/dist/certificate-issuance.esm.js +2 -2
  33. package/dist/{certificateIssuanceManager-C3-CI0_s.esm.js → certificateIssuanceManager-CMg4SgL4.esm.js} +3 -3
  34. package/dist/{certificateIssuanceManager-DCgEidHz.d.ts → certificateIssuanceManager-Dr8A4Lgr.d.ts} +2 -3
  35. package/dist/{certificateIssuanceStateMachine-CxqS_nD-.esm.js → certificateIssuanceStateMachine-Cs64QmYH.esm.js} +4 -4
  36. package/dist/consent.d.ts +1 -1
  37. package/dist/consent.esm.js +2 -2
  38. package/dist/{consentManager-B6E1XJDw.esm.js → consentManager-CjrxY737.esm.js} +3 -3
  39. package/dist/{consentManager-2h_w6wFc.d.ts → consentManager-DgzWQpAR.d.ts} +6 -7
  40. package/dist/{consentStateMachine-DTSfdGiW.esm.js → consentStateMachine-BCj5Jb3g.esm.js} +3 -3
  41. package/dist/{createCameraCycleOwnership-DnwTl1ad.esm.js → createCameraCycleOwnership-kdlhkmmY.esm.js} +71 -65
  42. package/dist/{createFaceAvatar-BlcTYgJv.d.ts → createFaceAvatar-DXgmQmQy.d.ts} +1 -1
  43. package/dist/cross-document-data-match.d.ts +1 -1
  44. package/dist/cross-document-data-match.esm.js +1 -1
  45. package/dist/{crossDocumentDataMatchManager-9XhFVZ5S.esm.js → crossDocumentDataMatchManager-BHnGRsto.esm.js} +4 -4
  46. package/dist/{crossDocumentDataMatchManager-Dq8Z3SOg.d.ts → crossDocumentDataMatchManager-yCWCOzcU.d.ts} +2 -2
  47. package/dist/curp-validation.d.ts +1 -1
  48. package/dist/curp-validation.esm.js +2 -2
  49. package/dist/{curpValidationManager-DNuZn9fn.d.ts → curpValidationManager-B-1EZbP_.d.ts} +3 -3
  50. package/dist/{curpValidationManager-DbIMYFcJ.esm.js → curpValidationManager-DBNIn8BF.esm.js} +15 -22
  51. package/dist/{curpValidationStateMachine-g5kMfuLj.esm.js → curpValidationStateMachine-DAxImy8p.esm.js} +4 -4
  52. package/dist/custom-fields.d.ts +1 -1
  53. package/dist/custom-fields.esm.js +1 -1
  54. package/dist/custom-watchlist.d.ts +1 -1
  55. package/dist/custom-watchlist.esm.js +2 -2
  56. package/dist/{customFieldsManager-CzWZTkW-.esm.js → customFieldsManager-BV6UyLFV.esm.js} +4 -4
  57. package/dist/{customFieldsManager-8-W2KY4n.d.ts → customFieldsManager-CF-cO8ap.d.ts} +2 -2
  58. package/dist/{customWatchlistManager-DWTED5Ur.esm.js → customWatchlistManager-DML0UPzf.esm.js} +3 -3
  59. package/dist/{customWatchlistManager-PBWHr_oM.d.ts → customWatchlistManager-DolUswyR.d.ts} +2 -2
  60. package/dist/{customWatchlistStateMachine-DOQou6TW.esm.js → customWatchlistStateMachine-D9gI5uu7.esm.js} +3 -3
  61. package/dist/deepsightLoader-DvfAYnzg.esm.js +55 -0
  62. package/dist/{deepsightLoader-v-dLejS-.esm.js → deepsightService-DLGO9yv1.esm.js} +51 -56
  63. package/dist/device.esm.js +1 -1
  64. package/dist/document-capture.d.ts +2 -2
  65. package/dist/document-capture.esm.js +2 -2
  66. package/dist/{documentCaptureManager-BRPxqYD2.esm.js → documentCaptureManager-C9XUnYU6.esm.js} +17 -18
  67. package/dist/{documentCaptureManager-lEtCM320.d.ts → documentCaptureManager-DkyDtm3Y.d.ts} +11 -34
  68. package/dist/{documentCaptureStateMachine-D312sSIu.esm.js → documentCaptureStateMachine-BHDsCfhL.esm.js} +55 -58
  69. package/dist/dynamic-forms.d.ts +2 -2
  70. package/dist/dynamic-forms.esm.js +2 -2
  71. package/dist/{dynamicFormsManager-C-9Jhnd3.esm.js → dynamicFormsManager-5uIXobxi.esm.js} +3 -3
  72. package/dist/{dynamicFormsManager-D5R_uxLQ.d.ts → dynamicFormsManager-C0dHs1ty.d.ts} +3 -3
  73. package/dist/{dynamicFormsStateMachine-DGI_F2PP.esm.js → dynamicFormsStateMachine-DQmok084.esm.js} +4 -4
  74. package/dist/ekyb.d.ts +5 -5
  75. package/dist/ekyb.esm.js +3 -3
  76. package/dist/{ekybManager-BwRuGAwt.d.ts → ekybManager-BaZ_7CEu.d.ts} +4 -4
  77. package/dist/{ekybManager-DeoMcZEz.esm.js → ekybManager-CazShiQz.esm.js} +23 -27
  78. package/dist/{ekybStateMachine-D1IJ1Z72.esm.js → ekybStateMachine-hstiCNmW.esm.js} +338 -13
  79. package/dist/ekyc.d.ts +2 -2
  80. package/dist/ekyc.esm.js +3 -3
  81. package/dist/{ekycManager-BX2d46FY.esm.js → ekycManager-BdJRUsz0.esm.js} +29 -36
  82. package/dist/{ekycManager-DLzDuBzI.d.ts → ekycManager-DW-ynodd.d.ts} +3 -3
  83. package/dist/ekycStateMachine-x6Klot8g.esm.js +1444 -0
  84. package/dist/{ekycUtils-D6wfSpPN.esm.js → ekycUtils-zY8CdKJL.esm.js} +53 -3
  85. package/dist/electronic-signature.d.ts +1 -1
  86. package/dist/electronic-signature.esm.js +1 -1
  87. package/dist/{electronicSignatureManager-yYUc30na.esm.js → electronicSignatureManager-Bc8spG8p.esm.js} +10 -10
  88. package/dist/{electronicSignatureManager-Ds-KEVTq.d.ts → electronicSignatureManager-DTSLOvKR.d.ts} +2 -3
  89. package/dist/email.d.ts +1 -1
  90. package/dist/email.esm.js +2 -2
  91. package/dist/{emailManager-bR1N5rV_.esm.js → emailManager-CtlKRRaR.esm.js} +20 -26
  92. package/dist/{emailManager-CADXW_9X.d.ts → emailManager-Dy6omJVp.d.ts} +2 -2
  93. package/dist/{emailStateMachine-Bc_6oIYw.esm.js → emailStateMachine-5Neq3rE5.esm.js} +4 -4
  94. package/dist/{endpoints-B-3Q-LUw.esm.js → endpoints-DHzlkQNe.esm.js} +2 -0
  95. package/dist/{events-ijlbX_Wx.esm.js → events-CAgFE-k3.esm.js} +19 -7
  96. package/dist/events.d.ts +3 -2
  97. package/dist/events.esm.js +1 -1
  98. package/dist/extensibility.d.ts +38 -38
  99. package/dist/extensibility.esm.js +36 -36
  100. package/dist/{externalFetch-BKBThAUC.esm.js → externalFetch-DrR9xshk.esm.js} +3 -2
  101. package/dist/face-match.d.ts +1 -1
  102. package/dist/face-match.esm.js +2 -2
  103. package/dist/{faceCaptureManagerFactory-m-7ae67q.d.ts → faceCaptureManagerFactory-jKQ2QtY-.d.ts} +11 -51
  104. package/dist/{faceCaptureManagerFactory-B6i9QcAk.esm.js → faceCaptureManagerFactory-uFm1AcaY.esm.js} +19 -54
  105. package/dist/{faceCaptureSetup-DU1mjRr6.esm.js → faceCaptureSetup-Cu2wabzo.esm.js} +99 -395
  106. package/dist/{faceMatchManager-Bmv0HzuY.esm.js → faceMatchManager-9Nj9aPci.esm.js} +3 -3
  107. package/dist/{faceMatchManager-BnvrZM2F.d.ts → faceMatchManager-DIgG-UFS.d.ts} +1 -2
  108. package/dist/{faceMatchStateMachine-mRIHQ3dA.esm.js → faceMatchStateMachine-B9ZUnlyU.esm.js} +6 -4
  109. package/dist/{feature-management-C8CuN0os.esm.js → feature-management-BTbYruNe.esm.js} +3 -3
  110. package/dist/feature-management.esm.js +1 -1
  111. package/dist/field-comparison.d.ts +2 -2
  112. package/dist/field-comparison.esm.js +1 -1
  113. package/dist/{fieldComparisonManager-CBvEGxFx.d.ts → fieldComparisonManager-CUX4gza2.d.ts} +6 -3
  114. package/dist/{fieldComparisonManager-CC-klG0h.esm.js → fieldComparisonManager-Dk38hXZP.esm.js} +35 -17
  115. package/dist/fiscal-qr.d.ts +1 -1
  116. package/dist/fiscal-qr.esm.js +1 -1
  117. package/dist/{fiscalQrManager-B1STmT6z.d.ts → fiscalQrManager-D0Iy7EKR.d.ts} +2 -2
  118. package/dist/fiscalQrManager-DmBkQfs0.esm.js +6798 -0
  119. package/dist/flow-events.d.ts +1 -1
  120. package/dist/flow.d.ts +14 -13
  121. package/dist/flow.esm.js +14 -14
  122. package/dist/{flowCompletionService-DccgtDnm.esm.js → flowCompletionService-xnn_SlJU.esm.js} +2 -2
  123. package/dist/{flowServices-CdsWsppG.esm.js → flowServices-DA64AEZC.esm.js} +11 -7
  124. package/dist/geolocation.d.ts +1 -1
  125. package/dist/geolocation.esm.js +2 -2
  126. package/dist/{geolocationManager-CGHBxtMb.esm.js → geolocationManager-CqNLY45e.esm.js} +6 -7
  127. package/dist/{geolocationManager-Cz744E5S.d.ts → geolocationManager-Dn24g1fl.d.ts} +2 -3
  128. package/dist/{geolocationStateMachine-CdEb1Gn0.esm.js → geolocationStateMachine-D-cQi7ar.esm.js} +4 -4
  129. package/dist/{getDeviceClass-5NYZg9s6.esm.js → getDeviceClass-bsWdEDxP.esm.js} +1 -1
  130. package/dist/{getParsedUserAgent-B2iFDql1.esm.js → getParsedUserAgent-DhQPeKqw.esm.js} +1 -1
  131. package/dist/government-validation.d.ts +1 -1
  132. package/dist/government-validation.esm.js +2 -2
  133. package/dist/{governmentValidationManager-D02vT4yY.d.ts → governmentValidationManager-B82zOut8.d.ts} +3 -3
  134. package/dist/{governmentValidationManager-CacFOtKO.esm.js → governmentValidationManager-CP0SiOOe.esm.js} +3 -3
  135. package/dist/{governmentValidationStateMachine-CoaZOSTP.esm.js → governmentValidationStateMachine-C3YQ8yCZ.esm.js} +3 -3
  136. package/dist/home.d.ts +3 -26
  137. package/dist/home.esm.js +2 -2
  138. package/dist/id-ocr.d.ts +1 -1
  139. package/dist/id-ocr.esm.js +2 -2
  140. package/dist/id-selfie-flow.d.ts +6 -9
  141. package/dist/id-selfie-flow.esm.js +23 -28
  142. package/dist/id-verification.d.ts +1 -1
  143. package/dist/id-verification.esm.js +2 -2
  144. package/dist/id.d.ts +4 -4
  145. package/dist/id.esm.js +4 -205
  146. package/dist/{idCaptureDefaults-Dl64Trv5.esm.js → idCaptureDefaults-CBg73RnV.esm.js} +8 -5
  147. package/dist/{idCaptureManager-BHwL2Z0V.d.ts → idCaptureManager-BY97SRCV.d.ts} +242 -98
  148. package/dist/{idCaptureManager-BNmVJQkd.esm.js → idCaptureManager-D4V8vXtY.esm.js} +276 -210
  149. package/dist/{idCaptureServices-dtDG2HXS.esm.js → idCaptureServices-DJ33k3-p.esm.js} +21 -39
  150. package/dist/{idCaptureStateMachine-BbiZD3uf.esm.js → idCaptureStateMachine-PJt0yzom.esm.js} +989 -872
  151. package/dist/{idOcrManager-CFlDwUvN.d.ts → idOcrManager-BTdHlJ9D.d.ts} +2 -3
  152. package/dist/{idOcrManager-ByWuQ4ej.esm.js → idOcrManager-DxoCesYP.esm.js} +3 -3
  153. package/dist/{idOcrStateMachine-Bt_abXQQ.esm.js → idOcrStateMachine-kPn7DB2I.esm.js} +3 -3
  154. package/dist/{idVerificationManager-BB4Pj_N6.d.ts → idVerificationManager-BJapZfpy.d.ts} +2 -3
  155. package/dist/{idVerificationManager-DT42c77H.esm.js → idVerificationManager-CDhRUU5n.esm.js} +3 -3
  156. package/dist/{idVerificationStateMachine-DbDVIh9t.esm.js → idVerificationStateMachine-0HTVVxse.esm.js} +3 -3
  157. package/dist/identity-reuse.d.ts +2 -2
  158. package/dist/identity-reuse.esm.js +2 -2
  159. package/dist/{identityReuseManager-yG3acUrQ.esm.js → identityReuseManager-BleUi6TK.esm.js} +26 -13
  160. package/dist/{identityReuseManager-BXEBBI3N.d.ts → identityReuseManager-ooAbp6Kc.d.ts} +164 -46
  161. package/dist/{identityReuseStateMachine-BhAkuIra.esm.js → identityReuseStateMachine-BrBUpfn5.esm.js} +89 -23
  162. package/dist/{index-CeaC32qI.d.ts → index-DfEuu-Ew.d.ts} +2 -2
  163. package/dist/index-DpTj5PFb.d.ts +1 -0
  164. package/dist/index.d.ts +1 -1
  165. package/dist/index.esm.js +1 -1
  166. package/dist/{invokeOnCaptureCallback-BjzPjJ_p.esm.js → invokeOnCaptureCallback-BW7V3vub.esm.js} +1 -1
  167. package/dist/lamejs-B6TzhU5q.esm.js +10 -0
  168. package/dist/mandatory-consent.d.ts +2 -2
  169. package/dist/mandatory-consent.esm.js +2 -2
  170. package/dist/{mandatoryConsentManager-7dI0D08q.esm.js → mandatoryConsentManager-CX_Dyht7.esm.js} +3 -3
  171. package/dist/{mandatoryConsentManager-DFVm_i2B.d.ts → mandatoryConsentManager-TkX57U6f.d.ts} +3 -4
  172. package/dist/{mandatoryConsentStateMachine-DC5Mo6M1.esm.js → mandatoryConsentStateMachine-CoaSB7P7.esm.js} +3 -3
  173. package/dist/{multipartRecordingService-mwKFTlhR.esm.js → multipartRecordingService-DbeQpXdU.esm.js} +2 -2
  174. package/dist/{permissionGuards-D6TfVop2.esm.js → permissionGuards-Bf4LbHjC.esm.js} +1 -1
  175. package/dist/{permissionServices-EY3_Vx6c.esm.js → permissionServices-d2UW0r_L.esm.js} +34 -3
  176. package/dist/phone-number.d.ts +24 -0
  177. package/dist/phone-number.esm.js +1922 -0
  178. package/dist/phone.d.ts +1 -1
  179. package/dist/phone.esm.js +2 -2
  180. package/dist/{phoneManager-IjhSv5XS.esm.js → phoneManager-BGBcpqsk.esm.js} +31 -22
  181. package/dist/{phoneManager-BBU8Lq0O.d.ts → phoneManager-BO-LTih5.d.ts} +16 -3
  182. package/dist/{phoneStateMachine-CXdXufKg.esm.js → phoneStateMachine-CEm2y7yG.esm.js} +39 -20
  183. package/dist/phoneValidation-DnBcNUNh.esm.js +48 -0
  184. package/dist/qe-signature.d.ts +2 -2
  185. package/dist/qe-signature.esm.js +1 -1
  186. package/dist/redirect-to-mobile.d.ts +1 -1
  187. package/dist/redirect-to-mobile.esm.js +2 -2
  188. package/dist/{redirectToMobileManager-FLEWJtv8.esm.js → redirectToMobileManager-B1yQHFLu.esm.js} +4 -4
  189. package/dist/{redirectToMobileManager-BD2PvT5B.d.ts → redirectToMobileManager-CVsvpVbQ.d.ts} +2 -2
  190. package/dist/{redirectToMobileStateMachine-CSWWgUTO.esm.js → redirectToMobileStateMachine--Sr9NEVT.esm.js} +5 -5
  191. package/dist/{rolldown-runtime-FDOR9p9I.esm.js → rolldown-runtime-B-1-B7_t.esm.js} +10 -1
  192. package/dist/{runChildModule-B2Y_hlix.esm.js → runChildModule-vdxQMCmO.esm.js} +13 -12
  193. package/dist/safeStorage-UxDrnjwa.esm.js +35 -0
  194. package/dist/{sdkVersion-N1UiyFiY.esm.js → sdkVersion-F5YZbjip.esm.js} +1 -1
  195. package/dist/selfie.d.ts +4 -4
  196. package/dist/selfie.esm.js +12 -12
  197. package/dist/selfieErrorUtils-D-tsgEuX.esm.js +21 -0
  198. package/dist/{selfieManager-BSZG891S.d.ts → selfieManager-1J0IEyFq.d.ts} +2 -8
  199. package/dist/{selfieManager-AS6wfUvZ.esm.js → selfieManager-26pENXxw.esm.js} +6 -6
  200. package/dist/selfieStateMachine-BhfKsl3I.esm.js +41 -0
  201. package/dist/{session-BESZc05k.esm.js → session-Bu7djCsj.esm.js} +5 -5
  202. package/dist/session.d.ts +15 -3
  203. package/dist/session.esm.js +30 -5
  204. package/dist/sessionInitializer-jxbfCnE-.esm.js +974 -0
  205. package/dist/{setup-BuPbxpwF.esm.js → setup-C38QkrSP.esm.js} +232 -112
  206. package/dist/{setup-Cyko6cAn.d.ts → setup-lgkQ8dJW.d.ts} +20 -11
  207. package/dist/signature.d.ts +1 -1
  208. package/dist/signature.esm.js +2 -2
  209. package/dist/{signatureManager-DGBSWz2_.d.ts → signatureManager-BpVt_Jv7.d.ts} +2 -2
  210. package/dist/{signatureManager-B72np4ZO.esm.js → signatureManager-qqXyH93e.esm.js} +7 -11
  211. package/dist/{signatureStateMachine-ce_XMA3l.esm.js → signatureStateMachine-BkRSrkKp.esm.js} +3 -3
  212. package/dist/splitTrackedName-3zJRd2RD.esm.js +19 -0
  213. package/dist/{src-35ekGRzK.esm.js → src-DJAJjRYQ.esm.js} +1 -1
  214. package/dist/{stats-CZcy2J53.esm.js → stats-DmG_tkGk.esm.js} +1 -1
  215. package/dist/stats.esm.js +1 -1
  216. package/dist/{sessionInitializer-CnhAkMUN.esm.js → thumbmark.esm-CRc0cYvz.esm.js} +33 -776
  217. package/dist/{trueSightService-M5VpCo96.esm.js → trueSightService-BWgRVGIT.esm.js} +893 -900
  218. package/dist/trust-graph.d.ts +1 -2
  219. package/dist/trust-graph.esm.js +2 -2
  220. package/dist/{types-C0oWGUzg.d.ts → types-0L-eFDmr.d.ts} +1 -1
  221. package/dist/{types-C1g9itHE.d.ts → types-BGXxRwQM.d.ts} +6 -7
  222. package/dist/{types-BfgmV7s7.d.ts → types-BQA7lRDV.d.ts} +1 -1
  223. package/dist/{types-CxGdmzxa.d.ts → types-BvFmYX5c.d.ts} +1 -1
  224. package/dist/{types-Cx-1zo-i.d.ts → types-BvLo3U4u.d.ts} +1 -1
  225. package/dist/types-C71Zo6vl.d.ts +6 -0
  226. package/dist/{types-DEGVXwsk2.d.ts → types-CyPUIpzf.d.ts} +110 -62
  227. package/dist/{types-Bx-BWveD.d.ts → types-DTYr9pCB.d.ts} +1 -1
  228. package/dist/{types-BjSly8cp.d.ts → types-DUnFZ08M.d.ts} +1 -1
  229. package/dist/{types-ESdtnHtg.d.ts → types-zpO4fU6a.d.ts} +3 -4
  230. package/dist/{urlUtils-D6phjq1-.esm.js → urlUtils-6jsE6rKp.esm.js} +9 -1
  231. package/dist/video-selfie.d.ts +6 -9
  232. package/dist/video-selfie.esm.js +1386 -1344
  233. package/dist/{videoSelfieCameraWarmer-q9ZjvXu9.esm.js → videoSelfieCameraWarmer-C366RKqu.esm.js} +11 -11
  234. package/dist/{videoSelfieFlowModuleMachine-BUe2uACW.esm.js → videoSelfieFlowModuleMachine-BCFVHBQ1.esm.js} +1 -1
  235. package/dist/{videoSelfieStepDetector-ChYgFM15.d.ts → videoSelfieStepDetector-C5QHOvWb.d.ts} +4 -4
  236. package/dist/videoTrimByCopy-BFfAiNpv.esm.js +15901 -0
  237. package/dist/{warmup-Cis2p6O0.d.ts → warmup-BUPPRAA1.d.ts} +7 -0
  238. package/dist/{warmup-ChDwHSel.esm.js → warmup-DMtbyb2l.esm.js} +27 -9
  239. package/dist/wasm.d.ts +2 -2
  240. package/dist/wasm.esm.js +4 -4
  241. package/dist/{wasmDsFlagSync-DYrLUEII.esm.js → wasmDsFlagSync-BXCGqP48.esm.js} +1 -1
  242. package/dist/{wasmWebClient-B7baE-Wf.esm.js → wasmWebClient-kbYZ2sxw.esm.js} +259 -20
  243. package/dist/watchlist-for-business.d.ts +1 -1
  244. package/dist/watchlist-for-business.esm.js +2 -2
  245. package/dist/watchlist.d.ts +1 -1
  246. package/dist/watchlist.esm.js +2 -2
  247. package/dist/{watchlistForBusinessManager-CsnJnG-C.d.ts → watchlistForBusinessManager-B3GDPZrr.d.ts} +2 -2
  248. package/dist/{watchlistForBusinessManager-CIMkpEhu.esm.js → watchlistForBusinessManager-BvF4jK3S.esm.js} +7 -5
  249. package/dist/{watchlistForBusinessStateMachine-CJ-MvUre.esm.js → watchlistForBusinessStateMachine-121XK-Et.esm.js} +3 -3
  250. package/dist/{watchlistManager-CixcLNDT.esm.js → watchlistManager-CNWEOYSq.esm.js} +3 -3
  251. package/dist/{watchlistManager-DLXef90v.d.ts → watchlistManager-DJQOd8Pw.d.ts} +2 -2
  252. package/dist/{watchlistStateMachine-CBqk2w-h.esm.js → watchlistStateMachine-Dgfm42w2.esm.js} +3 -3
  253. package/dist/workflow.d.ts +34 -5
  254. package/dist/workflow.esm.js +64 -46
  255. package/dist/{xstate-actors.esm-BXeQ-Ucz.esm.js → xstate-actors.esm-8Gzepa_A.esm.js} +1 -1
  256. package/dist/{xstate.esm-BuFLFuzz.esm.js → xstate.esm-DSajW7CJ.esm.js} +24 -10
  257. package/package.json +13 -5
  258. package/dist/Actor-iTq7YY48.d.ts +0 -1
  259. package/dist/StateMachine-EDpYWy0i.d.ts +0 -6
  260. package/dist/fiscalQrManager-DbCVMIBx.esm.js +0 -34143
  261. package/dist/index-B8weJxmL.d.ts +0 -1
  262. package/dist/selfieErrorUtils-UiQ46EBa.esm.js +0 -116
  263. package/dist/selfieStateMachine-DY7vJVNY.esm.js +0 -71
  264. package/dist/types-BN5RPPIZ.esm.js +0 -34
  265. package/dist/types-Bt9RuRqt.d.ts +0 -6
  266. package/dist/virtualCameraCheck-Cjab7FTI.esm.js +0 -48
  267. /package/dist/{types-BSBzhHRH.d.ts → types-BSBzhHRH2.d.ts} +0 -0
@@ -0,0 +1,1444 @@
1
+ import { t as api } from "./api-Bx3gKW_y.esm.js";
2
+ import { t as endpoints } from "./endpoints-DHzlkQNe.esm.js";
3
+ import { _ as STATE_CODE_HINTS, a as toEkycConfig, c as CITY_SOURCES, d as EMAIL_SOURCES, f as HOUSE_NO_SOURCES, g as POSTAL_CODE_SOURCES, h as ONE_OF_REQUIRED_GROUPS, i as resolveEkycSource, l as COUNTRY_CODE_OMITTED_SOURCES, m as NAME_SOURCES, n as getEKYCFields, o as ADDRESS_STATE_SOURCES, p as MIDDLE_NAME_SOURCES, r as isFieldOptional, s as APARTMENT_SOURCES, t as getEKYCCountry, u as COUNTRY_SELECTOR_DISABLED_SOURCES, v as STREET_SOURCES, y as TAX_ID_SOURCES } from "./ekycUtils-zY8CdKJL.esm.js";
4
+ import { i as assign, t as setup } from "./xstate.esm-DSajW7CJ.esm.js";
5
+ import { n as fromPromise } from "./xstate-actors.esm-8Gzepa_A.esm.js";
6
+ import { a as FIXED_DIGIT_POSTAL_CODE_LENGTH, c as getPostalCodeMaxLength, d as STREET_LEVEL_REQUIRED_ERROR, f as fillFromSuggestion, i as checkSupport, l as validatePostalCode, m as usStateOptions, n as resolveForm, o as formatPostalCode, p as getStreetLevelErrorForSuggestion, r as createBundledDefinitionSource, s as getPostalCodeErrorKey, t as debounceSearchActor, u as DYNAMIC_REQUIRED_KEY } from "./addressSearch-BiYZjvp3.esm.js";
7
+ import { n as DateFormattingProvider, t as validateCPF } from "./cpf-uAZTPUBy.esm.js";
8
+ import { n as loadPhoneValidation, t as getPhoneValidation } from "./phoneValidation-DnBcNUNh.esm.js";
9
+ //#region src/modules/ekyc/ekycValidators.ts
10
+ async function loadPhoneValidator() {
11
+ if (!await loadPhoneValidation()) throw new Error("Failed to load the phone validation rules");
12
+ }
13
+ /** Progressively formats an SSN as XXX-XX-XXXX */
14
+ function formatSSN(value) {
15
+ const ssn = value?.replace(/\D/g, "") ?? "";
16
+ if (ssn.length < 4) return ssn;
17
+ if (ssn.length < 6) return `${ssn.slice(0, 3)}-${ssn.slice(3)}`;
18
+ return `${ssn.slice(0, 3)}-${ssn.slice(3, 5)}-${ssn.slice(5, 9)}`;
19
+ }
20
+ /**
21
+ * Strips invalid characters from a name.
22
+ * Fixes SDKv1 regex syntax issue — allows letters, accented chars, spaces, commas, apostrophes.
23
+ */
24
+ function cleanName(name) {
25
+ return (name ?? "").replace(/[^a-zA-ZñÑáéíóúÁÉÍÓÚ\s,'´]/g, "").slice(0, 100);
26
+ }
27
+ const PO_BOX_REGEX = /POBox|P\.O\.Box|pobox|postofficebox|postbox|po\.box|p\.o\.box/i;
28
+ /** Returns true if the address looks like a P.O. Box */
29
+ function isPoBox(address) {
30
+ return PO_BOX_REGEX.test(address.replace(/\s/g, ""));
31
+ }
32
+ function validatePhone(phone, country) {
33
+ return getPhoneValidation()?.isValid(phone, country) ?? false;
34
+ }
35
+ function formatPhoneE164(phone, country) {
36
+ return getPhoneValidation()?.formatE164(phone, country) ?? phone;
37
+ }
38
+ const ONE_OF_REQUIRED_ERROR_KEY = "verification.errors.dobOrSsnRequired";
39
+ const normalizeFieldValue = (value) => typeof value === "string" ? value : String(value ?? "");
40
+ const SSN_FORMAT_REGEX = /^\d{3}-\d{2}-\d{4}$/;
41
+ const EMAIL_FORMAT_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
42
+ const buildPostalCodeParams = (country) => {
43
+ const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
44
+ if (fixedLen !== void 0) return { length: fixedLen };
45
+ let maxLen = getPostalCodeMaxLength(country);
46
+ if (country === "US" || country === "BR") maxLen = maxLen - 1;
47
+ return { maxLength: maxLen };
48
+ };
49
+ const createValidators = () => ({
50
+ required: (value, _rule, field) => {
51
+ if (value.trim().length > 0) return void 0;
52
+ const fieldName = field.displayLabel ?? field.label;
53
+ return fieldName ? {
54
+ key: DYNAMIC_REQUIRED_KEY,
55
+ params: { fieldName }
56
+ } : { key: DYNAMIC_REQUIRED_KEY };
57
+ },
58
+ streetLevelRequired: (value) => {
59
+ if (value.trim().length > 0) return void 0;
60
+ return STREET_LEVEL_REQUIRED_ERROR;
61
+ },
62
+ cpf: (value) => {
63
+ if (value.trim().length === 0) return void 0;
64
+ return validateCPF(value) ? void 0 : { key: "verification.errors.invalidTaxId" };
65
+ },
66
+ ssnFormat: (value) => {
67
+ if (value.trim().length === 0) return void 0;
68
+ return SSN_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.ssnFormat" };
69
+ },
70
+ noPoBox: (value) => {
71
+ if (value.trim().length === 0) return void 0;
72
+ return isPoBox(value) ? { key: "verification.errors.poBox" } : void 0;
73
+ },
74
+ postalCodeFormat: (value, rule) => {
75
+ if (rule.type !== "postalCodeFormat") return void 0;
76
+ if (value.trim().length === 0) return void 0;
77
+ if (validatePostalCode(value, rule.country)) return void 0;
78
+ return {
79
+ key: getPostalCodeErrorKey(rule.country),
80
+ params: buildPostalCodeParams(rule.country)
81
+ };
82
+ },
83
+ phoneFormat: (value, rule) => {
84
+ if (rule.type !== "phoneFormat") return void 0;
85
+ const trimmed = value.trim();
86
+ if (rule.optional && trimmed.length === 0) return void 0;
87
+ return validatePhone(trimmed, rule.country) ? void 0 : { key: "verification.errors.phoneInvalid" };
88
+ },
89
+ emailFormat: (value) => {
90
+ if (value.trim().length === 0) return void 0;
91
+ return EMAIL_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.emailInvalid" };
92
+ },
93
+ exactLength: (value, rule) => {
94
+ if (rule.type !== "exactLength") return void 0;
95
+ if (value.trim().length === 0) return void 0;
96
+ return value.length === rule.length ? void 0 : { key: "verification.errors.exactly10Characters" };
97
+ },
98
+ oneOfRequired: (_value, rule, _field, values) => {
99
+ if (rule.type !== "oneOfRequired") return void 0;
100
+ return rule.fields.some((name) => normalizeFieldValue(values[name]).trim().length > 0) ? void 0 : { key: ONE_OF_REQUIRED_ERROR_KEY };
101
+ }
102
+ });
103
+ const evaluateRules = (value, rules, field, values, validators) => {
104
+ if (!rules) return void 0;
105
+ for (const rule of rules) {
106
+ const error = validators[rule.type](value, rule, field, values);
107
+ if (error) return error;
108
+ }
109
+ };
110
+ function validateEkycForm(values, fields) {
111
+ const validators = createValidators();
112
+ return fields.reduce((errors, field) => {
113
+ const value = normalizeFieldValue(values[field.name]);
114
+ const error = evaluateRules(value, field.validation, field, values, validators);
115
+ if (error) errors[field.name] = error;
116
+ return errors;
117
+ }, {});
118
+ }
119
+ function validateEkycField(values, fieldName, fields) {
120
+ const field = fields.find((f) => f.name === fieldName);
121
+ if (!field) return void 0;
122
+ const validators = createValidators();
123
+ const value = normalizeFieldValue(values[field.name]);
124
+ return evaluateRules(value, field.validation, field, values, validators);
125
+ }
126
+ //#endregion
127
+ //#region ../form-definitions/generated/ekyc.ts
128
+ const EKYC_DEFINITIONS = {
129
+ "ekyc/BR/BR_GOVT_1": {
130
+ schemaVersion: 1,
131
+ vocabulary: "1.0",
132
+ id: "ekyc/BR/BR_GOVT_1",
133
+ module: "ekyc",
134
+ country: "BR",
135
+ source: "BR_GOVT_1",
136
+ sections: [{ id: "address" }, { id: "driverLicense" }],
137
+ fields: [
138
+ {
139
+ name: "firstName",
140
+ kind: "text",
141
+ group: "name",
142
+ required: true,
143
+ label: { key: "verification.labels.firstName" },
144
+ placeholder: { key: "verification.placeholder.firstName" },
145
+ input: {
146
+ maxLength: 100,
147
+ autofill: "givenName"
148
+ }
149
+ },
150
+ {
151
+ name: "surName",
152
+ kind: "text",
153
+ group: "name",
154
+ required: true,
155
+ label: { key: "verification.labels.surName" },
156
+ placeholder: { key: "verification.placeholder.surname" },
157
+ input: {
158
+ maxLength: 100,
159
+ autofill: "familyName"
160
+ }
161
+ },
162
+ {
163
+ name: "dateOfBirth",
164
+ kind: "date",
165
+ group: "dateOfBirth",
166
+ required: true,
167
+ label: { key: "verification.labels.dateOfBirth" },
168
+ input: { autofill: "birthday" }
169
+ },
170
+ {
171
+ name: "email",
172
+ kind: "text",
173
+ group: "email",
174
+ required: true,
175
+ label: { key: "verification.labels.email" },
176
+ placeholder: { key: "verification.placeholder.email" },
177
+ input: {
178
+ keyboard: "email",
179
+ autofill: "email"
180
+ },
181
+ rules: [{ id: "emailFormat" }]
182
+ },
183
+ {
184
+ name: "phone",
185
+ kind: "phone",
186
+ group: "phone",
187
+ required: true,
188
+ label: { key: "verification.labels.phone" },
189
+ input: { autofill: "phone" },
190
+ phone: { lockCountry: "whenPhoneRisk" },
191
+ rules: [{ id: "phoneFormat" }],
192
+ payload: { transforms: [{ id: "e164" }] }
193
+ },
194
+ {
195
+ name: "taxId",
196
+ kind: "text",
197
+ group: "ssn",
198
+ required: true,
199
+ label: { key: "verification.labels.taxId" },
200
+ displayLabel: {
201
+ key: "verification.labels.cpf",
202
+ text: "CPF"
203
+ },
204
+ rules: [{ id: "cpf" }]
205
+ },
206
+ {
207
+ name: "nationality",
208
+ kind: "choice",
209
+ group: "nationality",
210
+ required: true,
211
+ widget: "select",
212
+ label: { key: "verification.labels.nationality" },
213
+ options: [
214
+ {
215
+ value: "brazilian",
216
+ label: { key: "verification.labels.brazilian" }
217
+ },
218
+ {
219
+ value: "naturalizedBrazilian",
220
+ label: { key: "verification.labels.naturalizedBrazilian" }
221
+ },
222
+ {
223
+ value: "foreigner",
224
+ label: { key: "verification.labels.foreigner" }
225
+ },
226
+ {
227
+ value: "brazilianBornAbroad",
228
+ label: { key: "verification.labels.brazilianBornAbroad" }
229
+ }
230
+ ],
231
+ payload: { transforms: [{ id: "uppercase" }] }
232
+ },
233
+ {
234
+ name: "last4SSN",
235
+ kind: "text",
236
+ group: "last4SSN",
237
+ required: true,
238
+ label: { key: "verification.labels.last4SSN" },
239
+ input: {
240
+ maxLength: 4,
241
+ keyboard: "numeric"
242
+ }
243
+ },
244
+ {
245
+ name: "idNum",
246
+ kind: "text",
247
+ group: "idNumber",
248
+ required: true,
249
+ label: { key: "verification.labels.idNum" },
250
+ input: { maxLength: 13 }
251
+ },
252
+ {
253
+ name: "idNum1",
254
+ kind: "text",
255
+ group: "idNumber1",
256
+ required: true,
257
+ label: { key: "verification.labels.idNum1" }
258
+ },
259
+ {
260
+ name: "gender",
261
+ kind: "choice",
262
+ group: "gender",
263
+ required: true,
264
+ widget: "radio",
265
+ label: { key: "verification.labels.gender" },
266
+ options: [{
267
+ value: "F",
268
+ label: { key: "common.female" }
269
+ }, {
270
+ value: "M",
271
+ label: { key: "common.male" }
272
+ }]
273
+ },
274
+ {
275
+ name: "panNumber",
276
+ kind: "text",
277
+ group: "panNumber",
278
+ required: true,
279
+ label: { key: "verification.labels.panNumber" },
280
+ input: { maxLength: 10 },
281
+ rules: [{
282
+ id: "exactLength",
283
+ params: { length: 10 }
284
+ }]
285
+ },
286
+ {
287
+ name: "houseNo",
288
+ kind: "text",
289
+ group: "address",
290
+ section: "address",
291
+ required: true,
292
+ label: { key: "verification.labels.houseNo" }
293
+ },
294
+ {
295
+ name: "street",
296
+ kind: "text",
297
+ group: "address",
298
+ section: "address",
299
+ required: true,
300
+ widget: "addressSearch",
301
+ label: { key: "verification.labels.street" },
302
+ input: { autofill: "addressLine1" },
303
+ rules: [{ id: "noPoBox" }]
304
+ },
305
+ {
306
+ name: "city",
307
+ kind: "text",
308
+ group: "address",
309
+ section: "address",
310
+ required: true,
311
+ label: { key: "verification.labels.city" },
312
+ input: { autofill: "addressLevel2" }
313
+ },
314
+ {
315
+ name: "state",
316
+ kind: "text",
317
+ group: "address",
318
+ section: "address",
319
+ required: true,
320
+ label: { key: "verification.labels.state" },
321
+ placeholder: {
322
+ key: "verification.placeholder.stateCode",
323
+ params: { states: "RJ, SP" }
324
+ },
325
+ input: { autofill: "addressLevel1" },
326
+ payload: { transforms: [{ id: "uppercase" }] }
327
+ },
328
+ {
329
+ name: "postalCode",
330
+ kind: "text",
331
+ group: "address",
332
+ section: "address",
333
+ required: true,
334
+ label: { key: "verification.labels.postalCode" },
335
+ input: {
336
+ maxLength: 9,
337
+ autofill: "postalCode"
338
+ },
339
+ rules: [{ id: "postalCodeFormat" }],
340
+ payload: { transforms: [{
341
+ id: "stripSeparators",
342
+ params: { chars: "- " }
343
+ }] }
344
+ },
345
+ {
346
+ name: "dlNumber",
347
+ kind: "text",
348
+ group: "dlNumber",
349
+ section: "driverLicense",
350
+ required: true,
351
+ label: { key: "verification.labels.dlNumber" }
352
+ },
353
+ {
354
+ name: "dlState",
355
+ kind: "choice",
356
+ group: "dlState",
357
+ section: "driverLicense",
358
+ required: true,
359
+ widget: "select",
360
+ label: { key: "verification.labels.dlState" },
361
+ placeholder: { key: "verification.placeholder.state" },
362
+ optionsRef: "US_STATES"
363
+ },
364
+ {
365
+ name: "dlExpireAt",
366
+ kind: "date",
367
+ group: "dlExpireAt",
368
+ section: "driverLicense",
369
+ required: true,
370
+ label: { key: "verification.labels.dlExpireAt" }
371
+ }
372
+ ],
373
+ submit: {
374
+ static: { plugins: ["kyc"] },
375
+ context: {
376
+ source: "source",
377
+ countryCode: "country"
378
+ }
379
+ }
380
+ },
381
+ "ekyc/US/US_CREDIT_TELCO": {
382
+ schemaVersion: 1,
383
+ vocabulary: "1.0",
384
+ id: "ekyc/US/US_CREDIT_TELCO",
385
+ module: "ekyc",
386
+ country: "US",
387
+ source: "US_CREDIT_TELCO",
388
+ sections: [{ id: "address" }, { id: "driverLicense" }],
389
+ groups: [{
390
+ group: "name",
391
+ whenDisabled: "forceShow"
392
+ }],
393
+ fields: [
394
+ {
395
+ name: "firstName",
396
+ kind: "text",
397
+ group: "name",
398
+ required: true,
399
+ label: { key: "verification.labels.firstName" },
400
+ placeholder: { key: "verification.placeholder.firstName" },
401
+ input: {
402
+ maxLength: 100,
403
+ autofill: "givenName"
404
+ }
405
+ },
406
+ {
407
+ name: "surName",
408
+ kind: "text",
409
+ group: "name",
410
+ required: true,
411
+ label: { key: "verification.labels.lastName" },
412
+ placeholder: { key: "verification.placeholder.lastName" },
413
+ input: {
414
+ maxLength: 100,
415
+ autofill: "familyName"
416
+ }
417
+ },
418
+ {
419
+ name: "dateOfBirth",
420
+ kind: "date",
421
+ group: "dateOfBirth",
422
+ label: { key: "verification.labels.dateOfBirth" },
423
+ input: { autofill: "birthday" }
424
+ },
425
+ {
426
+ name: "email",
427
+ kind: "text",
428
+ group: "email",
429
+ required: true,
430
+ label: { key: "verification.labels.email" },
431
+ placeholder: { key: "verification.placeholder.email" },
432
+ input: {
433
+ keyboard: "email",
434
+ autofill: "email"
435
+ },
436
+ rules: [{ id: "emailFormat" }]
437
+ },
438
+ {
439
+ name: "phone",
440
+ kind: "phone",
441
+ group: "phone",
442
+ label: { key: "verification.labels.phone" },
443
+ input: { autofill: "phone" },
444
+ phone: { lockCountry: true },
445
+ rules: [{ id: "phoneFormat" }],
446
+ payload: { transforms: [{ id: "e164" }] }
447
+ },
448
+ {
449
+ name: "ssn",
450
+ kind: "text",
451
+ group: "ssn",
452
+ widget: "masked",
453
+ label: { key: "verification.labels.ssn" },
454
+ input: {
455
+ maxLength: 11,
456
+ keyboard: "numeric"
457
+ },
458
+ rules: [{ id: "ssnFormat" }],
459
+ payload: { transforms: [{
460
+ id: "stripSeparators",
461
+ params: { chars: "-" }
462
+ }] }
463
+ },
464
+ {
465
+ name: "nationality",
466
+ kind: "text",
467
+ group: "nationality",
468
+ required: true,
469
+ label: { key: "verification.labels.nationality" },
470
+ payload: { transforms: [{ id: "uppercase" }] }
471
+ },
472
+ {
473
+ name: "last4SSN",
474
+ kind: "text",
475
+ group: "last4SSN",
476
+ required: true,
477
+ label: { key: "verification.labels.last4SSN" },
478
+ input: {
479
+ maxLength: 4,
480
+ keyboard: "numeric"
481
+ }
482
+ },
483
+ {
484
+ name: "idNum",
485
+ kind: "text",
486
+ group: "idNumber",
487
+ required: true,
488
+ label: { key: "verification.labels.idNum" },
489
+ input: { maxLength: 13 }
490
+ },
491
+ {
492
+ name: "idNum1",
493
+ kind: "text",
494
+ group: "idNumber1",
495
+ required: true,
496
+ label: { key: "verification.labels.idNum1" }
497
+ },
498
+ {
499
+ name: "gender",
500
+ kind: "choice",
501
+ group: "gender",
502
+ required: true,
503
+ widget: "radio",
504
+ label: { key: "verification.labels.gender" },
505
+ options: [{
506
+ value: "F",
507
+ label: { key: "common.female" }
508
+ }, {
509
+ value: "M",
510
+ label: { key: "common.male" }
511
+ }]
512
+ },
513
+ {
514
+ name: "panNumber",
515
+ kind: "text",
516
+ group: "panNumber",
517
+ required: true,
518
+ label: { key: "verification.labels.panNumber" },
519
+ input: { maxLength: 10 },
520
+ rules: [{
521
+ id: "exactLength",
522
+ params: { length: 10 }
523
+ }]
524
+ },
525
+ {
526
+ name: "street",
527
+ kind: "text",
528
+ group: "address",
529
+ section: "address",
530
+ widget: "addressSearch",
531
+ label: { key: "verification.labels.street" },
532
+ input: { autofill: "addressLine1" },
533
+ rules: [{ id: "noPoBox" }]
534
+ },
535
+ {
536
+ name: "apartment",
537
+ kind: "text",
538
+ group: "address",
539
+ section: "address",
540
+ label: { key: "verification.labels.apartment" },
541
+ placeholder: { key: "verification.placeholder.apartment" },
542
+ input: { autofill: "addressLine2" }
543
+ },
544
+ {
545
+ name: "city",
546
+ kind: "text",
547
+ group: "address",
548
+ section: "address",
549
+ label: { key: "verification.labels.city" },
550
+ input: { autofill: "addressLevel2" }
551
+ },
552
+ {
553
+ name: "state",
554
+ kind: "choice",
555
+ group: "address",
556
+ section: "address",
557
+ widget: "select",
558
+ label: { key: "verification.labels.chooseState" },
559
+ placeholder: { key: "verification.placeholder.state" },
560
+ input: { autofill: "addressLevel1" },
561
+ optionsRef: "US_STATES",
562
+ payload: { transforms: [{ id: "uppercase" }] }
563
+ },
564
+ {
565
+ name: "postalCode",
566
+ kind: "text",
567
+ group: "address",
568
+ section: "address",
569
+ label: { key: "verification.labels.zipCode" },
570
+ input: {
571
+ maxLength: 10,
572
+ autofill: "postalCode"
573
+ },
574
+ rules: [{ id: "postalCodeFormat" }],
575
+ payload: { transforms: [{
576
+ id: "stripSeparators",
577
+ params: { chars: "- " }
578
+ }] }
579
+ },
580
+ {
581
+ name: "dlNumber",
582
+ kind: "text",
583
+ group: "dlNumber",
584
+ section: "driverLicense",
585
+ required: true,
586
+ label: { key: "verification.labels.dlNumber" }
587
+ },
588
+ {
589
+ name: "dlState",
590
+ kind: "choice",
591
+ group: "dlState",
592
+ section: "driverLicense",
593
+ required: true,
594
+ widget: "select",
595
+ label: { key: "verification.labels.dlState" },
596
+ placeholder: { key: "verification.placeholder.state" },
597
+ optionsRef: "US_STATES"
598
+ },
599
+ {
600
+ name: "dlExpireAt",
601
+ kind: "date",
602
+ group: "dlExpireAt",
603
+ section: "driverLicense",
604
+ required: true,
605
+ label: { key: "verification.labels.dlExpireAt" }
606
+ }
607
+ ],
608
+ groupRules: [{
609
+ id: "oneOfRequired",
610
+ fields: ["dateOfBirth", "ssn"],
611
+ message: { key: "verification.errors.dobOrSsnRequired" }
612
+ }],
613
+ submit: {
614
+ static: { plugins: ["kyc"] },
615
+ context: {
616
+ source: "source",
617
+ countryCode: "country"
618
+ }
619
+ }
620
+ }
621
+ };
622
+ //#endregion
623
+ //#region src/modules/ekyc/ekycForm.ts
624
+ /**
625
+ * eKYC adapter for form definitions.
626
+ *
627
+ * Selects the bundled definition for a source and country, resolves it against
628
+ * the verification fields from module configuration, and projects the result
629
+ * to today's public `EkycFieldDef[]` shape, including the `validation` arrays
630
+ * today's validators run. A pair without a definition this projection can
631
+ * express keeps the current builder.
632
+ */
633
+ /** eKYC group id → the key `getEKYCFields` sets in `EkycVerificationFields`. */
634
+ const EKYC_GROUP_KEYS = {
635
+ name: "name",
636
+ dateOfBirth: "date of birth",
637
+ email: "email",
638
+ phone: "phone",
639
+ address: "address",
640
+ ssn: "SSN",
641
+ last4SSN: "last4SSN",
642
+ idNumber: "idNum",
643
+ idNumber1: "idNum1",
644
+ nationality: "nationality",
645
+ gender: "gender",
646
+ panNumber: "panNumber",
647
+ dlNumber: "dlNumber",
648
+ dlState: "dlState",
649
+ dlExpireAt: "dlExpireAt"
650
+ };
651
+ const OPTION_LISTS = { US_STATES: usStateOptions };
652
+ /** Vocabulary rules expressed as today's `EkycValidationRule` objects. */
653
+ const RULES = {
654
+ cpf: () => ({ type: "cpf" }),
655
+ ssnFormat: () => ({ type: "ssnFormat" }),
656
+ noPoBox: () => ({ type: "noPoBox" }),
657
+ emailFormat: () => ({ type: "emailFormat" }),
658
+ postalCodeFormat: ({ country }) => ({
659
+ type: "postalCodeFormat",
660
+ country
661
+ }),
662
+ phoneFormat: ({ country, required }) => ({
663
+ type: "phoneFormat",
664
+ country,
665
+ optional: !required
666
+ }),
667
+ exactLength: ({ params }) => ({
668
+ type: "exactLength",
669
+ length: params.length
670
+ })
671
+ };
672
+ /**
673
+ * Params a projected rule reads. The compiler checks params against the
674
+ * vocabulary too; this keeps a definition that skipped it, such as a served
675
+ * one later, from projecting a broken rule.
676
+ */
677
+ const RULE_PARAMS = { exactLength: ({ length }) => typeof length === "number" && Number.isInteger(length) && length > 0 };
678
+ /**
679
+ * What the projection can express today. Request-body transforms are listed
680
+ * because `buildSubmitPayload` already applies them, on the fields
681
+ * `legacyPayloadTransforms` names; `requiredWhen` waits for decision B20, so
682
+ * no condition is supported yet.
683
+ */
684
+ const EKYC_SUPPORTED_IDS = {
685
+ schemaVersions: [1],
686
+ vocabulary: "1.0",
687
+ kinds: /* @__PURE__ */ new Set([
688
+ "text",
689
+ "date",
690
+ "choice",
691
+ "phone"
692
+ ]),
693
+ groups: new Set(Object.keys(EKYC_GROUP_KEYS)),
694
+ rules: new Set(Object.keys(RULES)),
695
+ transforms: /* @__PURE__ */ new Set([
696
+ "stripSeparators",
697
+ "e164",
698
+ "uppercase"
699
+ ]),
700
+ groupRules: /* @__PURE__ */ new Set(["oneOfRequired"]),
701
+ optionLists: new Set(Object.keys(OPTION_LISTS)),
702
+ conditions: /* @__PURE__ */ new Set()
703
+ };
704
+ /** Today's field shape only flags `middleName` as optional. */
705
+ const LEGACY_OPTIONAL_FLAG = /* @__PURE__ */ new Set(["middleName"]);
706
+ /** The sections the eKYC UI has headers for. */
707
+ const UI_SECTIONS = /* @__PURE__ */ new Set(["address", "driverLicense"]);
708
+ /** The fields today's DOB-or-SSN group rule and its message are for. */
709
+ const ONE_OF_REQUIRED_FIELDS = ["dateOfBirth", "ssn"];
710
+ /** A Text today's field shape can carry: a key only, or `text` where shown. */
711
+ const plainKey = (text) => !text?.params;
712
+ /**
713
+ * The request-body transforms `buildSubmitPayload` applies to a field. It
714
+ * reads values by field name and transforms them in fixed branches, not from
715
+ * the definition, so until the kernel builds request bodies (P2) a definition
716
+ * must declare exactly these. Otherwise a transform it declares on another
717
+ * field would pass `checkSupport` and then not be applied. Mirrors those
718
+ * branches by hand: change both together.
719
+ */
720
+ function legacyPayloadTransforms(name, country) {
721
+ switch (name) {
722
+ case "phone": return [{ id: "e164" }];
723
+ case "nationality":
724
+ case "state": return [{ id: "uppercase" }];
725
+ case "postalCode": return [{
726
+ id: "stripSeparators",
727
+ params: { chars: "- " }
728
+ }];
729
+ case "ssn": return country === "US" || country === "CA" ? [{
730
+ id: "stripSeparators",
731
+ params: { chars: "-" }
732
+ }] : [];
733
+ default: return [];
734
+ }
735
+ }
736
+ function sameTransforms(declared, expected) {
737
+ return declared.length === expected.length && declared.every((transform, i) => {
738
+ const params = transform.params ?? {};
739
+ const want = expected[i].params ?? {};
740
+ return transform.id === expected[i].id && Object.keys(params).length === Object.keys(want).length && Object.entries(want).every(([key, value]) => params[key] === value);
741
+ });
742
+ }
743
+ /**
744
+ * Whether today's code handles a field the way its definition says. Today's
745
+ * validators show their own message, so a rule can't carry one. The field
746
+ * shape has no hint or suggestions, and only placeholders take params. Input
747
+ * formatting (`processFieldValue`) and the request body (`buildSubmitPayload`)
748
+ * stay keyed by field name until P2.
749
+ */
750
+ function isProjectableField(field, country) {
751
+ return !field.hint && !field.suggestionsRef && plainKey(field.label) && plainKey(field.displayLabel) && (field.options ?? []).every((option) => plainKey(option.label)) && (!field.section || UI_SECTIONS.has(field.section)) && (field.rules ?? []).every((rule) => !rule.message && (RULE_PARAMS[rule.id]?.(rule.params ?? {}) ?? true)) && !field.input?.format?.length && (field.payload?.key ?? field.name) === field.name && !field.payload?.omit && sameTransforms(field.payload?.transforms ?? [], legacyPayloadTransforms(field.name, country));
752
+ }
753
+ /**
754
+ * Caches the check per definition object. Bundled definitions are singletons
755
+ * created once at module load, so each is checked once. A served source (P4)
756
+ * that builds new objects per call would still be correct, but would miss
757
+ * this cache; key it by definition id and version then.
758
+ */
759
+ const projectable = /* @__PURE__ */ new WeakMap();
760
+ /** Whether every part of a definition maps onto today's `EkycFieldDef`. */
761
+ function isProjectableEkycDefinition(definition) {
762
+ let result = projectable.get(definition);
763
+ if (result === void 0) {
764
+ result = definition.module === "ekyc" && checkSupport(definition, EKYC_SUPPORTED_IDS).supported && definition.fields.every((field) => isProjectableField(field, definition.country ?? "")) && (definition.sections ?? []).every((section) => !section.title && UI_SECTIONS.has(section.id)) && (definition.groupRules ?? []).every((rule) => rule.fields.length === ONE_OF_REQUIRED_FIELDS.length && ONE_OF_REQUIRED_FIELDS.every((name) => rule.fields.includes(name)) && (!rule.message || rule.message.key === "verification.errors.dobOrSsnRequired" && !rule.message.params));
765
+ projectable.set(definition, result);
766
+ }
767
+ return result;
768
+ }
769
+ const bundled = createBundledDefinitionSource(EKYC_DEFINITIONS);
770
+ /** The bundled definition for exactly this source and country, if it is projectable. */
771
+ function selectEkycDefinition(source, country) {
772
+ const definition = bundled.select({
773
+ module: "ekyc",
774
+ source,
775
+ country
776
+ });
777
+ return definition && isProjectableEkycDefinition(definition) ? definition : void 0;
778
+ }
779
+ function toEkycResolveContext(verificationFields, enablePhoneRisk) {
780
+ return {
781
+ groups: Object.fromEntries(Object.entries(EKYC_GROUP_KEYS).map(([group, key]) => [group, Boolean(verificationFields[key])])),
782
+ phoneRisk: enablePhoneRisk
783
+ };
784
+ }
785
+ function fieldType(field) {
786
+ if (field.kind === "choice") return field.widget === "radio" ? "radio" : "dropdown";
787
+ return field.kind === "date" || field.kind === "phone" ? field.kind : "text";
788
+ }
789
+ function fieldOptions(field) {
790
+ if (field.optionsRef) return OPTION_LISTS[field.optionsRef];
791
+ return field.options?.map((option) => ({
792
+ value: option.value,
793
+ label: option.label.key
794
+ }));
795
+ }
796
+ function projectField(resolved, verificationFields, country) {
797
+ const { field, required } = resolved;
798
+ const groupKey = EKYC_GROUP_KEYS[field.group];
799
+ const source = groupKey && verificationFields[groupKey] || "user_input";
800
+ const def = {
801
+ name: field.name,
802
+ type: fieldType(field),
803
+ label: field.label.key,
804
+ source,
805
+ required
806
+ };
807
+ if (field.placeholder) {
808
+ def.placeholder = field.placeholder.key;
809
+ if (field.placeholder.params) def.placeholderParams = { ...field.placeholder.params };
810
+ }
811
+ if (field.displayLabel) def.displayLabel = field.displayLabel.text ?? field.displayLabel.key;
812
+ if (field.input?.maxLength !== void 0) def.maxLength = field.input.maxLength;
813
+ const options = fieldOptions(field);
814
+ if (options) def.options = options;
815
+ if (field.section) def.section = field.section;
816
+ if (field.kind === "phone") def.disableCountrySelector = resolved.phoneLocked;
817
+ if (LEGACY_OPTIONAL_FLAG.has(field.name)) def.optional = true;
818
+ const validation = required ? [{ type: "required" }] : [];
819
+ for (const rule of field.rules ?? []) {
820
+ const project = RULES[rule.id];
821
+ if (project) validation.push(project({
822
+ country,
823
+ required,
824
+ params: rule.params ?? {}
825
+ }));
826
+ }
827
+ if (validation.length > 0) def.validation = validation;
828
+ return def;
829
+ }
830
+ /**
831
+ * Projects a resolved definition to today's `EkycFieldDef[]`, identical to
832
+ * what `legacyBuildFieldDefs` returns for the same source and country.
833
+ */
834
+ function projectEkycFields(form, verificationFields, country) {
835
+ const defs = form.fields.map((resolved) => projectField(resolved, verificationFields, country));
836
+ for (const { fields } of form.groupRules) for (const def of defs) if (fields.includes(def.name)) def.validation = [{
837
+ type: "oneOfRequired",
838
+ fields: [...fields]
839
+ }, ...def.validation ?? []];
840
+ return defs;
841
+ }
842
+ //#endregion
843
+ //#region src/modules/ekyc/ekycActions.ts
844
+ const dateFormattingInstance = new DateFormattingProvider();
845
+ function buildValidationRules(field, country, configSource) {
846
+ const rules = [];
847
+ if (field.required) rules.push({ type: "required" });
848
+ if (field.name === "taxId" && country === "BR") rules.push({ type: "cpf" });
849
+ if (field.name === "ssn" && (country === "US" || country === "CA")) rules.push({ type: "ssnFormat" });
850
+ if (field.name === "street") rules.push({ type: "noPoBox" });
851
+ if (field.name === "postalCode") rules.push({
852
+ type: "postalCodeFormat",
853
+ country
854
+ });
855
+ if (field.name === "phone") rules.push({
856
+ type: "phoneFormat",
857
+ country,
858
+ optional: isFieldOptional("phone", configSource)
859
+ });
860
+ if (field.name === "email") rules.push({ type: "emailFormat" });
861
+ if (field.name === "panNumber") rules.push({
862
+ type: "exactLength",
863
+ length: 10
864
+ });
865
+ return rules;
866
+ }
867
+ function applyOneOfRequiredGroups(defs, configSource) {
868
+ for (const group of ONE_OF_REQUIRED_GROUPS[configSource] ?? []) {
869
+ const members = defs.filter((def) => group.includes(def.name));
870
+ const fields = members.map((def) => def.name);
871
+ for (const def of members) def.validation = [{
872
+ type: "oneOfRequired",
873
+ fields
874
+ }, ...def.validation ?? []];
875
+ }
876
+ }
877
+ /**
878
+ * Builds the form's field defs. A source with a form definition for exactly
879
+ * this country reads it (`packages/form-definitions/catalog/ekyc`); any other
880
+ * pair keeps the current builder.
881
+ */
882
+ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false) {
883
+ const definition = selectEkycDefinition(configSource, country);
884
+ if (definition) return projectEkycFields(resolveForm(definition, toEkycResolveContext(fields, enablePhoneRisk)), fields, country);
885
+ return legacyBuildFieldDefs(fields, configSource, country, enablePhoneRisk);
886
+ }
887
+ /** The per-source builder for sources without a form definition yet. */
888
+ function legacyBuildFieldDefs(fields, configSource, country, enablePhoneRisk = false) {
889
+ const defs = [];
890
+ const add = (name, type, label, source, opts) => {
891
+ if (source === false) return;
892
+ const def = {
893
+ name,
894
+ type,
895
+ label,
896
+ source,
897
+ required: !isFieldOptional(name, configSource),
898
+ ...opts
899
+ };
900
+ const validation = buildValidationRules(def, country, configSource);
901
+ if (validation.length > 0) def.validation = validation;
902
+ defs.push(def);
903
+ };
904
+ const nameSource = fields.name || (NAME_SOURCES.includes(configSource) ? "user_input" : false);
905
+ if (nameSource) {
906
+ add("firstName", "text", "verification.labels.firstName", nameSource, {
907
+ maxLength: 100,
908
+ placeholder: "verification.placeholder.firstName"
909
+ });
910
+ if (MIDDLE_NAME_SOURCES.includes(configSource)) add("middleName", "text", "verification.labels.middleName", nameSource, {
911
+ maxLength: 100,
912
+ placeholder: "verification.placeholder.middleName",
913
+ optional: true
914
+ });
915
+ add("surName", "text", country === "US" ? "verification.labels.lastName" : "verification.labels.surName", nameSource, {
916
+ maxLength: 100,
917
+ placeholder: country === "US" ? "verification.placeholder.lastName" : "verification.placeholder.surname"
918
+ });
919
+ if (country === "MX") add("maternalSurname", "text", "verification.labels.maternalSurname", nameSource, {
920
+ maxLength: 100,
921
+ placeholder: "verification.placeholder.maternalSurname"
922
+ });
923
+ }
924
+ if (fields["date of birth"]) add("dateOfBirth", "date", "verification.labels.dateOfBirth", fields["date of birth"]);
925
+ const emailSource = fields.email || (EMAIL_SOURCES.includes(configSource) ? "user_input" : false);
926
+ if (emailSource) add("email", "text", "verification.labels.email", emailSource, { placeholder: "verification.placeholder.email" });
927
+ if (fields.phone) {
928
+ const phoneCountrySelectorDisabled = enablePhoneRisk && configSource !== "PHONE_RISK_1" || COUNTRY_SELECTOR_DISABLED_SOURCES.includes(configSource);
929
+ add("phone", "phone", "verification.labels.phone", fields.phone, { disableCountrySelector: phoneCountrySelectorDisabled });
930
+ }
931
+ if (fields.SSN) if (country === "BR" || TAX_ID_SOURCES.includes(configSource)) add("taxId", "text", "verification.labels.taxId", fields.SSN, { ...country === "BR" && { displayLabel: "CPF" } });
932
+ else if (country === "CN") add("ssn", "text", "verification.labels.prcId", fields.SSN);
933
+ else add("ssn", "text", "verification.labels.ssn", fields.SSN, { maxLength: 11 });
934
+ if (fields.nationality) if (country === "BR") add("nationality", "dropdown", "verification.labels.nationality", fields.nationality, { options: [
935
+ {
936
+ value: "brazilian",
937
+ label: "verification.labels.brazilian"
938
+ },
939
+ {
940
+ value: "naturalizedBrazilian",
941
+ label: "verification.labels.naturalizedBrazilian"
942
+ },
943
+ {
944
+ value: "foreigner",
945
+ label: "verification.labels.foreigner"
946
+ },
947
+ {
948
+ value: "brazilianBornAbroad",
949
+ label: "verification.labels.brazilianBornAbroad"
950
+ }
951
+ ] });
952
+ else add("nationality", "text", "verification.labels.nationality", fields.nationality);
953
+ if (fields.last4SSN) add("last4SSN", "text", "verification.labels.last4SSN", fields.last4SSN, { maxLength: 4 });
954
+ if (fields.idNum) add("idNum", "text", "verification.labels.idNum", fields.idNum, { maxLength: 13 });
955
+ if (fields.idNum1) add("idNum1", "text", "verification.labels.idNum1", fields.idNum1);
956
+ if (fields.gender) add("gender", "radio", "verification.labels.gender", fields.gender, { options: [{
957
+ value: "F",
958
+ label: "common.female"
959
+ }, {
960
+ value: "M",
961
+ label: "common.male"
962
+ }] });
963
+ if (fields.panNumber) add("panNumber", "text", "verification.labels.panNumber", fields.panNumber, { maxLength: 10 });
964
+ const addAddressFields = () => {
965
+ const addrSource = fields.address;
966
+ if (!addrSource) return;
967
+ if (HOUSE_NO_SOURCES.includes(configSource)) add("houseNo", "text", "verification.labels.houseNo", addrSource, { section: "address" });
968
+ if (STREET_SOURCES.includes(configSource)) add("street", "text", "verification.labels.street", addrSource, { section: "address" });
969
+ if (APARTMENT_SOURCES.includes(configSource)) add("apartment", "text", "verification.labels.apartment", addrSource, {
970
+ section: "address",
971
+ placeholder: "verification.placeholder.apartment"
972
+ });
973
+ if (CITY_SOURCES.includes(configSource)) add("city", "text", "verification.labels.city", addrSource, { section: "address" });
974
+ if (ADDRESS_STATE_SOURCES.includes(configSource)) add("state", country === "US" ? "dropdown" : "text", country === "US" ? "verification.labels.chooseState" : "verification.labels.state", addrSource, {
975
+ section: "address",
976
+ ...country === "US" ? {
977
+ options: usStateOptions,
978
+ placeholder: "verification.placeholder.state"
979
+ } : {
980
+ placeholder: "verification.placeholder.stateCode",
981
+ placeholderParams: { states: STATE_CODE_HINTS[country] ?? "" }
982
+ }
983
+ });
984
+ if (POSTAL_CODE_SOURCES.includes(configSource)) add("postalCode", "text", country === "US" ? "verification.labels.zipCode" : "verification.labels.postalCode", addrSource, {
985
+ section: "address",
986
+ maxLength: getPostalCodeMaxLength(country)
987
+ });
988
+ };
989
+ const addDriversLicenseFields = () => {
990
+ if (fields.dlNumber) add("dlNumber", "text", "verification.labels.dlNumber", fields.dlNumber, { section: "driverLicense" });
991
+ if (fields.dlState) add("dlState", "dropdown", "verification.labels.dlState", fields.dlState, {
992
+ section: "driverLicense",
993
+ options: usStateOptions,
994
+ placeholder: "verification.placeholder.state"
995
+ });
996
+ if (fields.dlExpireAt) add("dlExpireAt", "date", "verification.labels.dlExpireAt", fields.dlExpireAt, { section: "driverLicense" });
997
+ };
998
+ if (configSource === "US_TELCO_1") {
999
+ addDriversLicenseFields();
1000
+ addAddressFields();
1001
+ } else {
1002
+ addAddressFields();
1003
+ addDriversLicenseFields();
1004
+ }
1005
+ applyOneOfRequiredGroups(defs, configSource);
1006
+ return defs;
1007
+ }
1008
+ function applyPrefill(fields, ocrData, otpStatus, _country) {
1009
+ const values = {};
1010
+ const prefilled = {};
1011
+ const readonlyFields = [];
1012
+ let hideEmail = false;
1013
+ if (fields.name === "document_scan" && ocrData?.name) {
1014
+ if (ocrData.name.firstName) {
1015
+ values.firstName = ocrData.name.firstName;
1016
+ prefilled.firstName = true;
1017
+ }
1018
+ if (ocrData.name.paternalLastName) {
1019
+ values.surName = ocrData.name.paternalLastName;
1020
+ prefilled.surName = true;
1021
+ }
1022
+ if (ocrData.name.middleName) {
1023
+ values.middleName = ocrData.name.middleName;
1024
+ prefilled.middleName = true;
1025
+ }
1026
+ if (ocrData.name.maternalLastName) {
1027
+ values.maternalSurname = ocrData.name.maternalLastName;
1028
+ prefilled.maternalSurname = true;
1029
+ }
1030
+ }
1031
+ const ocrBirthDate = dateFormattingInstance.utcToIsoDateString(ocrData?.birthDate);
1032
+ if (fields["date of birth"] === "document_scan" && ocrBirthDate) {
1033
+ values.dateOfBirth = ocrBirthDate;
1034
+ prefilled.dateOfBirth = true;
1035
+ }
1036
+ const addressSource = fields.address;
1037
+ if (addressSource === "document_scan" || addressSource === "poa_document") {
1038
+ const addrData = addressSource === "poa_document" ? ocrData?.addressFieldsFromStatement ?? void 0 : ocrData?.addressFields ?? ocrData?.checkedAddressBean ?? void 0;
1039
+ if (addrData) {
1040
+ if (addrData.street) {
1041
+ values.street = addrData.street;
1042
+ prefilled.street = true;
1043
+ }
1044
+ if (addrData.city) {
1045
+ values.city = addrData.city;
1046
+ prefilled.city = true;
1047
+ }
1048
+ if (addrData.state) {
1049
+ values.state = addrData.state;
1050
+ prefilled.state = true;
1051
+ }
1052
+ if (addrData.postalCode) {
1053
+ values.postalCode = addrData.postalCode;
1054
+ prefilled.postalCode = true;
1055
+ }
1056
+ if (addrData.houseNumber) {
1057
+ values.houseNo = addrData.houseNumber;
1058
+ prefilled.houseNo = true;
1059
+ }
1060
+ }
1061
+ }
1062
+ if (fields.phone === "phone_module_input" && otpStatus?.phone) {
1063
+ values.phone = otpStatus.phone;
1064
+ prefilled.phone = true;
1065
+ readonlyFields.push("phone");
1066
+ }
1067
+ if (fields.email === "email_module_input" && otpStatus?.email) {
1068
+ values.email = otpStatus.email;
1069
+ prefilled.email = true;
1070
+ hideEmail = true;
1071
+ }
1072
+ return {
1073
+ values,
1074
+ prefilled,
1075
+ hideEmail,
1076
+ readonlyFields
1077
+ };
1078
+ }
1079
+ /**
1080
+ * Builds the request body. Keep the per-field transforms below in sync with
1081
+ * `legacyPayloadTransforms` in `ekycForm.ts`: definitions are projectable only
1082
+ * when they declare exactly these, until P2 builds request bodies from them.
1083
+ */
1084
+ function buildSubmitPayload(ctx) {
1085
+ const payload = {};
1086
+ for (const field of ctx.fields) {
1087
+ const val = ctx.values[field.name];
1088
+ if (val !== void 0 && val !== "") payload[field.name] = val;
1089
+ }
1090
+ if (payload.nationality) payload.nationality = payload.nationality.toUpperCase();
1091
+ if (ctx.fieldsCountry && !COUNTRY_CODE_OMITTED_SOURCES.includes(ctx.configSource)) payload.countryCode = ctx.fieldsCountry;
1092
+ if (ctx.hideEmail && ctx.values.email) payload.email = ctx.values.email;
1093
+ if (payload.ssn && (ctx.fieldsCountry === "US" || ctx.fieldsCountry === "CA")) payload.ssn = payload.ssn.replace(/-/g, "");
1094
+ if (payload.postalCode) payload.postalCode = payload.postalCode.replace(/[-\s]/g, "");
1095
+ if (payload.phone) payload.phone = formatPhoneE164(payload.phone, ctx.fieldsCountry);
1096
+ if (payload.state) payload.state = payload.state.toUpperCase();
1097
+ if (ctx.configSource === "UK_CREDIT_BUREAU_1" && payload.countryCode) payload.country = payload.countryCode;
1098
+ if (ctx.configSource === "US_DRIVERS_LICENSE_1" && payload.dlState) payload.state = payload.dlState;
1099
+ return {
1100
+ ...payload,
1101
+ plugins: ["kyc"],
1102
+ source: ctx.configSource
1103
+ };
1104
+ }
1105
+ function processFieldValue(name, value, fieldsCountry) {
1106
+ if ((name === "firstName" || name === "surName" || name === "middleName" || name === "maternalSurname") && value) return cleanName(value);
1107
+ if (name === "ssn" && (fieldsCountry === "US" || fieldsCountry === "CA")) return formatSSN(value);
1108
+ if (name === "postalCode") return formatPostalCode(value, fieldsCountry);
1109
+ if (name === "panNumber") return value.replace(/[^a-zA-Z0-9]/g, "").toUpperCase();
1110
+ return value;
1111
+ }
1112
+ //#endregion
1113
+ //#region src/modules/ekyc/ekycServices.ts
1114
+ /** Fetches module configuration for EXTERNAL_VERIFICATION */
1115
+ async function fetchModuleConfig(flowId, signal) {
1116
+ const url = `${endpoints.moduleConfig}?id=${encodeURIComponent(flowId)}&moduleKey=EXTERNAL_VERIFICATION`;
1117
+ const res = await api.get(url, { signal });
1118
+ if (!res.ok) throw new Error(`GET ${url} failed: ${res.status} ${res.statusText}`);
1119
+ return res.data;
1120
+ }
1121
+ /** Fetches OCR data for pre-fill */
1122
+ async function fetchOcrData(signal) {
1123
+ const res = await api.get(endpoints.ocrData, { signal });
1124
+ if (!res.ok) throw new Error(`GET ${endpoints.ocrData} failed: ${res.status} ${res.statusText}`);
1125
+ return res.data;
1126
+ }
1127
+ /** Fetches phone/email from prior OTP modules */
1128
+ async function fetchOtpStatus(signal) {
1129
+ const res = await api.get(endpoints.otpStatus, { signal });
1130
+ if (!res.ok) throw new Error(`GET ${endpoints.otpStatus} failed: ${res.status} ${res.statusText}`);
1131
+ return res.data;
1132
+ }
1133
+ var EkycSubmitError = class extends Error {
1134
+ constructor(status, apiError) {
1135
+ super(`POST ${endpoints.ekycSubmit} failed: ${status} – ${apiError}`);
1136
+ this.name = "EkycSubmitError";
1137
+ this.status = status;
1138
+ this.apiError = apiError;
1139
+ }
1140
+ };
1141
+ /** Submits eKYC verification */
1142
+ async function submitEkyc(data, signal) {
1143
+ try {
1144
+ return (await api.post(endpoints.ekycSubmit, data, { signal })).data;
1145
+ } catch (err) {
1146
+ const httpErr = err;
1147
+ if (typeof httpErr.status === "number") {
1148
+ const body = httpErr.data;
1149
+ const apiError = body?.error ?? body?.message ?? String(err);
1150
+ throw new EkycSubmitError(httpErr.status, apiError);
1151
+ }
1152
+ throw err;
1153
+ }
1154
+ }
1155
+ //#endregion
1156
+ //#region src/modules/ekyc/ekycGuards.ts
1157
+ const hasNoValidationErrorsGuard = ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0;
1158
+ const hasFlowIdGuard = ({ context }) => !!context.config.flowId;
1159
+ const hasVerificationFieldsGuard = ({ context }) => !!context.config.verificationFields;
1160
+ const COUNTRY_NOT_SUPPORTED_MSG = "Request unsuccessful. Country not supported for EKYC.";
1161
+ const isCountryNotSupportedGuard = ({ event }) => {
1162
+ const err = event.error;
1163
+ return err instanceof EkycSubmitError && err.status === 400 && err.apiError === COUNTRY_NOT_SUPPORTED_MSG;
1164
+ };
1165
+ //#endregion
1166
+ //#region src/modules/ekyc/ekycActors.ts
1167
+ const fetchModuleConfigActor = fromPromise(async ({ input, signal }) => {
1168
+ const phoneRules = loadPhoneValidator();
1169
+ phoneRules.catch(() => void 0);
1170
+ const config = await fetchModuleConfig(input.flowId, signal);
1171
+ if (getEKYCFields(config).phone !== false) await phoneRules;
1172
+ return config;
1173
+ });
1174
+ const fetchPrefillDataActor = fromPromise(async ({ signal }) => {
1175
+ const [ocrData, otpStatus] = await Promise.all([fetchOcrData(signal).catch(() => void 0), fetchOtpStatus(signal).catch(() => void 0)]);
1176
+ return {
1177
+ ocrData,
1178
+ otpStatus
1179
+ };
1180
+ });
1181
+ const submitEkycActor = fromPromise(async ({ input, signal }) => submitEkyc(input, signal));
1182
+ //#endregion
1183
+ //#region src/modules/ekyc/ekycStateMachine.ts
1184
+ const ADDRESS_AUTOCOMPLETE_KEYS = [
1185
+ "street",
1186
+ "city",
1187
+ "state",
1188
+ "postalCode",
1189
+ "houseNo"
1190
+ ];
1191
+ const omitKeys = (errors, keys) => {
1192
+ if (!errors) return void 0;
1193
+ const next = { ...errors };
1194
+ for (const key of keys) delete next[key];
1195
+ return Object.keys(next).length > 0 ? next : void 0;
1196
+ };
1197
+ const ekycMachine = setup({
1198
+ types: {
1199
+ context: {},
1200
+ events: {},
1201
+ input: {}
1202
+ },
1203
+ actors: {
1204
+ fetchModuleConfig: fetchModuleConfigActor,
1205
+ fetchPrefillData: fetchPrefillDataActor,
1206
+ submitEkyc: submitEkycActor,
1207
+ debounceSearch: debounceSearchActor
1208
+ },
1209
+ actions: {
1210
+ setModuleConfig: assign(({ context, event }) => {
1211
+ const config = event.output;
1212
+ const source = resolveEkycSource(config.source ?? context.config.source ?? "", config.riskAddons);
1213
+ const country = context.config.fieldsCountry ?? getEKYCCountry(source);
1214
+ const vFields = getEKYCFields(config);
1215
+ return {
1216
+ moduleConfig: config,
1217
+ verificationFields: vFields,
1218
+ configSource: source,
1219
+ fieldsCountry: country,
1220
+ fields: buildFieldDefs(vFields, source, country, config.enablePhoneRisk)
1221
+ };
1222
+ }),
1223
+ applyPrefillData: assign(({ context, event }) => {
1224
+ const { ocrData, otpStatus } = event.output;
1225
+ const { values, prefilled, hideEmail, readonlyFields } = applyPrefill(context.verificationFields, ocrData, otpStatus, context.fieldsCountry);
1226
+ return {
1227
+ values,
1228
+ prefilled,
1229
+ hideEmail,
1230
+ fields: context.fields.map((f) => ({
1231
+ ...f,
1232
+ readonly: readonlyFields.includes(f.name) ? true : f.readonly
1233
+ }))
1234
+ };
1235
+ }),
1236
+ updateField: assign(({ context, event }) => {
1237
+ if (event.type !== "DATA_CHANGED") return {};
1238
+ const processedValue = processFieldValue(event.name, event.value, context.fieldsCountry);
1239
+ return {
1240
+ values: {
1241
+ ...context.values,
1242
+ [event.name]: processedValue
1243
+ },
1244
+ submitError: ""
1245
+ };
1246
+ }),
1247
+ clearFieldValidationError: assign(({ context, event }) => {
1248
+ if (event.type !== "DATA_CHANGED") return {};
1249
+ const errs = context.validationErrors;
1250
+ if (!errs) return {};
1251
+ const next = { ...errs };
1252
+ delete next[event.name];
1253
+ const oneOfRule = context.fields.find((f) => f.name === event.name)?.validation?.find((rule) => rule.type === "oneOfRequired");
1254
+ if (oneOfRule?.type === "oneOfRequired") {
1255
+ for (const sibling of oneOfRule.fields) if (next[sibling]?.key === "verification.errors.dobOrSsnRequired") delete next[sibling];
1256
+ }
1257
+ if (Object.keys(next).length === Object.keys(errs).length) return {};
1258
+ return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
1259
+ }),
1260
+ validateFormField: assign(({ context, event }) => {
1261
+ if (event.type !== "VALIDATE_FIELD") return {};
1262
+ const message = validateEkycField(context.values, event.name, context.fields);
1263
+ const next = { ...context.validationErrors ?? {} };
1264
+ if (message) next[event.name] = message;
1265
+ else delete next[event.name];
1266
+ return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
1267
+ }),
1268
+ computeValidationResult: assign(({ context }) => {
1269
+ const errors = validateEkycForm(context.values, context.fields);
1270
+ return { validationErrors: Object.keys(errors).length > 0 ? errors : void 0 };
1271
+ }),
1272
+ fillAddressFields: assign(({ context, event }) => {
1273
+ const { suggestion } = event;
1274
+ const activeFields = new Set(context.fields.map((f) => f.name));
1275
+ const { values: newValues } = fillFromSuggestion(context.values, {}, suggestion, activeFields);
1276
+ const clearedErrors = omitKeys(context.validationErrors, ADDRESS_AUTOCOMPLETE_KEYS);
1277
+ const streetError = getStreetLevelErrorForSuggestion(suggestion, activeFields);
1278
+ const validationErrors = {
1279
+ ...clearedErrors ?? {},
1280
+ ...streetError !== void 0 ? { street: streetError } : {}
1281
+ };
1282
+ return {
1283
+ values: newValues,
1284
+ addressSuggestions: [],
1285
+ _searchQuery: "",
1286
+ validationErrors: Object.keys(validationErrors).length > 0 ? validationErrors : void 0,
1287
+ submitError: ""
1288
+ };
1289
+ }),
1290
+ setAddressSuggestions: assign(({ event }) => ({ addressSuggestions: event.suggestions })),
1291
+ setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
1292
+ clearErrorMessage: assign({ errorMessage: () => "" }),
1293
+ setSubmitError: assign(() => ({ submitError: "verification.errors.countryNotSupported" })),
1294
+ clearSubmitError: assign({ submitError: () => "" })
1295
+ },
1296
+ guards: {
1297
+ hasNoValidationErrors: hasNoValidationErrorsGuard,
1298
+ hasFlowId: hasFlowIdGuard,
1299
+ hasVerificationFields: hasVerificationFieldsGuard,
1300
+ isCountryNotSupported: isCountryNotSupportedGuard
1301
+ }
1302
+ }).createMachine({
1303
+ id: "ekyc",
1304
+ initial: "idle",
1305
+ context: ({ input }) => {
1306
+ const config = toEkycConfig(input.config);
1307
+ return {
1308
+ config,
1309
+ moduleConfig: void 0,
1310
+ verificationFields: {},
1311
+ configSource: config.source ?? "",
1312
+ fieldsCountry: config.fieldsCountry ?? "",
1313
+ fields: [],
1314
+ values: {},
1315
+ addressSuggestions: [],
1316
+ prefilled: {},
1317
+ hideEmail: false,
1318
+ errorMessage: "",
1319
+ submitError: "",
1320
+ _searchQuery: ""
1321
+ };
1322
+ },
1323
+ states: {
1324
+ idle: { on: { LOAD: [
1325
+ {
1326
+ target: "loading",
1327
+ guard: "hasFlowId"
1328
+ },
1329
+ {
1330
+ target: "prefilling",
1331
+ guard: "hasVerificationFields",
1332
+ actions: assign(({ context }) => {
1333
+ const vFields = context.config.verificationFields;
1334
+ const source = context.config.source ?? "";
1335
+ const country = context.config.fieldsCountry ?? getEKYCCountry(source);
1336
+ return {
1337
+ verificationFields: vFields,
1338
+ configSource: source,
1339
+ fieldsCountry: country,
1340
+ fields: buildFieldDefs(vFields, source, country, context.config.enablePhoneRisk)
1341
+ };
1342
+ })
1343
+ },
1344
+ { target: "misconfigured" }
1345
+ ] } },
1346
+ loading: { invoke: {
1347
+ id: "fetchModuleConfig",
1348
+ src: "fetchModuleConfig",
1349
+ input: ({ context }) => ({ flowId: context.config.flowId }),
1350
+ onDone: {
1351
+ target: "prefilling",
1352
+ actions: "setModuleConfig"
1353
+ },
1354
+ onError: {
1355
+ target: "error",
1356
+ actions: "setErrorMessage"
1357
+ }
1358
+ } },
1359
+ prefilling: { invoke: {
1360
+ id: "fetchPrefillData",
1361
+ src: "fetchPrefillData",
1362
+ onDone: {
1363
+ target: "form",
1364
+ actions: "applyPrefillData"
1365
+ },
1366
+ onError: { target: "form" }
1367
+ } },
1368
+ form: {
1369
+ initial: "inputting",
1370
+ states: {
1371
+ inputting: { on: {
1372
+ DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
1373
+ VALIDATE_FIELD: { actions: "validateFormField" },
1374
+ SUBMIT: { target: "validatingSubmit" }
1375
+ } },
1376
+ searching: {
1377
+ invoke: {
1378
+ id: "debounceSearch",
1379
+ src: "debounceSearch",
1380
+ input: ({ context }) => ({ query: context._searchQuery })
1381
+ },
1382
+ on: {
1383
+ DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
1384
+ VALIDATE_FIELD: { actions: "validateFormField" },
1385
+ RESULTS: {
1386
+ target: "inputting",
1387
+ actions: "setAddressSuggestions"
1388
+ }
1389
+ }
1390
+ },
1391
+ validatingSubmit: {
1392
+ entry: "computeValidationResult",
1393
+ always: [{
1394
+ guard: "hasNoValidationErrors",
1395
+ target: "#ekyc.submitting"
1396
+ }, { target: "inputting" }]
1397
+ }
1398
+ },
1399
+ on: {
1400
+ SEARCH_ADDRESS: {
1401
+ target: ".searching",
1402
+ actions: assign(({ event }) => ({
1403
+ _searchQuery: event.query,
1404
+ addressSuggestions: []
1405
+ }))
1406
+ },
1407
+ SELECT_ADDRESS: {
1408
+ target: ".inputting",
1409
+ actions: "fillAddressFields"
1410
+ },
1411
+ SKIP: { target: "#ekyc.finished" },
1412
+ CLOSE: { target: "#ekyc.closed" }
1413
+ }
1414
+ },
1415
+ submitting: { invoke: {
1416
+ id: "submitEkyc",
1417
+ src: "submitEkyc",
1418
+ input: ({ context }) => buildSubmitPayload(context),
1419
+ onDone: { target: "success" },
1420
+ onError: [{
1421
+ target: "form",
1422
+ guard: "isCountryNotSupported",
1423
+ actions: "setSubmitError"
1424
+ }, {
1425
+ target: "error",
1426
+ actions: "setErrorMessage"
1427
+ }]
1428
+ } },
1429
+ success: { after: { 3e3: "finished" } },
1430
+ error: { on: {
1431
+ RETRY: {
1432
+ target: "form",
1433
+ actions: "clearErrorMessage"
1434
+ },
1435
+ SKIP: { target: "finished" },
1436
+ CLOSE: { target: "closed" }
1437
+ } },
1438
+ misconfigured: { on: { CLOSE: { target: "closed" } } },
1439
+ finished: { type: "final" },
1440
+ closed: { type: "final" }
1441
+ }
1442
+ });
1443
+ //#endregion
1444
+ export { ekycMachine as t };