@incodetech/core 2.4.1 → 2.5.0-agentic.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 (340) hide show
  1. package/dist/Actor-DqjOqDfU.d.ts +1 -0
  2. package/dist/{BaseWasmProvider-Bq3OHo7P.d.ts → BaseWasmProvider-CPdofn7R.d.ts} +3 -5
  3. package/dist/BrowserNetworkStatusProvider-BrDXBEDd.esm.js +21 -0
  4. package/dist/{multipartRecordingService-CLwrF5wD.esm.js → CameraCompositor-C7N1N61V.esm.js} +61 -744
  5. package/dist/DateFormattingProvider-DPq9zco-.esm.js +25 -0
  6. package/dist/{FaceDetectionProvider-J_-1Cwck.esm.js → FaceDetectionProvider-Cy2EAL0i.esm.js} +38 -66
  7. package/dist/IBrowserEnvironmentCapability-D7JG7ML3.esm.js +16 -0
  8. package/dist/IGeolocationCapability-r49Qo7rR.d.ts +10 -0
  9. package/dist/{IIdCaptureCapability-CGcEt2Cw.d.ts → IIdCaptureCapability-BRAZQtkM.d.ts} +4 -3
  10. package/dist/{IWasmUtilCapability-GF2n7sfm.d.ts → IWasmUtilCapability-CLWIYHB4.d.ts} +35 -7
  11. package/dist/Manager-BvXAwDv9.esm.js +125 -0
  12. package/dist/{Manager-C9T5amUN.d.ts → Manager-DufwKlav.d.ts} +1 -7
  13. package/dist/{MotionSensorProvider-DYxh8TjR.esm.js → MotionSensorProvider-BAGydZPH.esm.js} +20 -0
  14. package/dist/MultipartRecordingProvider-BtMQZEbg.esm.js +151 -0
  15. package/dist/{PhoneValidationProvider-SZiOS0jB.esm.js → PhoneValidationProvider-Co4zk2en.esm.js} +7 -0
  16. package/dist/{StreamCanvasCapture-7JRf-2ck.d.ts → StreamCanvasCapture-BqaHTJF0.d.ts} +36 -5
  17. package/dist/{StreamCanvasCapture-C9jtgBdT.esm.js → StreamCanvasCapture-CXd87trH.esm.js} +18 -3
  18. package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +42 -0
  19. package/dist/{WasmUtilProvider-DtJuBdt-.esm.js → WasmUtilProvider-C4x5gc1c.esm.js} +135 -25
  20. package/dist/WorkerEncoderRecordingProvider-BO7urYwT.esm.js +80 -0
  21. package/dist/addressSearch-DBJeg_g3.esm.js +301 -0
  22. package/dist/{advanceableErrors-q_pfU3Cn.esm.js → advanceableErrors-CxZyPRyh.esm.js} +4 -2
  23. package/dist/ae-signature.d.ts +2 -2
  24. package/dist/ae-signature.esm.js +1 -1
  25. package/dist/allowedCharacters-Bnir--CN.esm.js +17 -0
  26. package/dist/antifraud.d.ts +1 -1
  27. package/dist/antifraud.esm.js +2 -2
  28. package/dist/{antifraudManager-DbGCvlJs.d.ts → antifraudManager-BxfCsyA7.d.ts} +3 -3
  29. package/dist/{antifraudManager-CaweCYnY.esm.js → antifraudManager-DRMBLSh7.esm.js} +5 -3
  30. package/dist/{antifraudStateMachine-DRl0UVyA.esm.js → antifraudStateMachine-Bi0m60oV.esm.js} +4 -6
  31. package/dist/{api-Cz90EHyu.esm.js → api-B58edv6M.esm.js} +13 -7
  32. package/dist/{apiError-9Yi8xMeB.esm.js → apiError-B9-B3cMq.esm.js} +1 -1
  33. package/dist/attemptCarry-CxiYlUAO.esm.js +45 -0
  34. package/dist/authentication.d.ts +3 -3
  35. package/dist/authentication.esm.js +2 -2
  36. package/dist/{authenticationManager-BIZC55Bi.d.ts → authenticationManager-CkD0JR7Q.d.ts} +2 -2
  37. package/dist/{authenticationManager-pKQS4fHT.esm.js → authenticationManager-DNWtc0eq.esm.js} +7 -6
  38. package/dist/{authenticationStateMachine-D_DygKtQ.esm.js → authenticationStateMachine-CJ9i4Al-.esm.js} +50 -18
  39. package/dist/avatar.d.ts +1 -1
  40. package/dist/backCameraLabel-yda5ugE4.esm.js +67 -0
  41. package/dist/{backCameraStream-CMvXj4X4.esm.js → backCameraStream-6qVHvj76.esm.js} +12 -107
  42. package/dist/{browser-DlFgHpoC-DnyrCR8r.esm.js → browser-pQZA35G2-B4Dwja1e.esm.js} +161 -150
  43. package/dist/calendarDate-D2zWfUlA.esm.js +35 -0
  44. package/dist/{callback-645_omgz.d.ts → callback-BmjJ1G-5.d.ts} +1 -1
  45. package/dist/camera-9yYDUOsO.d.ts +5 -0
  46. package/dist/{camera-sIa9ceW2.esm.js → camera-CJKApt0x.esm.js} +19 -20
  47. package/dist/camera.d.ts +9 -5
  48. package/dist/camera.esm.js +1 -1
  49. package/dist/certificate-issuance.d.ts +1 -1
  50. package/dist/certificate-issuance.esm.js +2 -2
  51. package/dist/{certificateIssuanceManager-Dr8A4Lgr.d.ts → certificateIssuanceManager-BcYhxO63.d.ts} +4 -3
  52. package/dist/{certificateIssuanceManager-BfeMv2PU.esm.js → certificateIssuanceManager-Ctj6AJC7.esm.js} +5 -3
  53. package/dist/{certificateIssuanceStateMachine-Frgjbjw8.esm.js → certificateIssuanceStateMachine-DDqN9kvL.esm.js} +4 -4
  54. package/dist/cnpj-CVq3vL39.esm.js +71 -0
  55. package/dist/cnpj-D5cxwIe-.esm.js +9 -0
  56. package/dist/connectivity-BCuEoQ-n.esm.js +114 -0
  57. package/dist/consent.d.ts +1 -1
  58. package/dist/consent.esm.js +2 -2
  59. package/dist/{consentManager-Ca8FHlC4.d.ts → consentManager-B0YKqYtZ.d.ts} +20 -12
  60. package/dist/{consentManager-CvEu8h_W.esm.js → consentManager-CyoeiABc.esm.js} +7 -4
  61. package/dist/{consentStateMachine-DJTgN_-1.esm.js → consentStateMachine-BTUrAslr.esm.js} +25 -15
  62. package/dist/cpf-DDXMTLYr.esm.js +37 -0
  63. package/dist/{createFaceAvatar-lYX0VTYs.d.ts → createFaceAvatar-Ct9QrQ66.d.ts} +1 -1
  64. package/dist/cross-document-data-match.d.ts +1 -1
  65. package/dist/cross-document-data-match.esm.js +1 -1
  66. package/dist/{crossDocumentDataMatchManager-Cu141CE8.esm.js → crossDocumentDataMatchManager-cmQmp7Bi.esm.js} +6 -5
  67. package/dist/{crossDocumentDataMatchManager-yCWCOzcU.d.ts → crossDocumentDataMatchManager-crZcIUSY.d.ts} +3 -3
  68. package/dist/curp-DZGvefg3.esm.js +14 -0
  69. package/dist/curp-validation.d.ts +1 -1
  70. package/dist/curp-validation.esm.js +2 -2
  71. package/dist/{curpValidationManager-B-z9q5V3.esm.js → curpValidationManager-EW44fVpH.esm.js} +6 -3
  72. package/dist/{curpValidationManager-C9sqoh9n.d.ts → curpValidationManager-HOidAKvT.d.ts} +4 -4
  73. package/dist/{curpValidationStateMachine-vDEFLMPw.esm.js → curpValidationStateMachine-BFkt90Zs.esm.js} +41 -34
  74. package/dist/custom-fields.d.ts +1 -1
  75. package/dist/custom-fields.esm.js +1 -1
  76. package/dist/custom-watchlist.d.ts +1 -1
  77. package/dist/custom-watchlist.esm.js +2 -2
  78. package/dist/{customFieldsManager-CF-cO8ap.d.ts → customFieldsManager-CdWTbsew.d.ts} +3 -3
  79. package/dist/{customFieldsManager-D1ex2cFM.esm.js → customFieldsManager-DPMBJrcH.esm.js} +15 -17
  80. package/dist/{customWatchlistManager-CTI-SGk0.esm.js → customWatchlistManager-DiYpPjZx.esm.js} +5 -3
  81. package/dist/{customWatchlistManager-DolUswyR.d.ts → customWatchlistManager-lJrveDS4.d.ts} +3 -3
  82. package/dist/{customWatchlistStateMachine-hmRd0f2I.esm.js → customWatchlistStateMachine-D7VxQggF.esm.js} +4 -6
  83. package/dist/deepsightCaptureConfig-BxD3mSac.esm.js +70 -0
  84. package/dist/{deepsightService-C3DVBOZd.esm.js → deepsightLoader-KYZP8_x-.esm.js} +41 -74
  85. package/dist/definitionSource-B9WTvQb9.esm.js +30 -0
  86. package/dist/{createCameraCycleOwnership-Dj_LHUvN.esm.js → desktopCameraElection-BGQRIA2u.esm.js} +278 -44
  87. package/dist/device.d.ts +3 -3
  88. package/dist/device.esm.js +16 -16
  89. package/dist/document-capture.d.ts +3 -3
  90. package/dist/document-capture.esm.js +2 -2
  91. package/dist/document-signature.d.ts +123 -0
  92. package/dist/document-signature.esm.js +149 -0
  93. package/dist/{documentCaptureManager-DUJwpKC5.esm.js → documentCaptureManager-SRG6YEMh.esm.js} +30 -20
  94. package/dist/{documentCaptureManager-DkyDtm3Y.d.ts → documentCaptureManager-sJWgqtUy.d.ts} +42 -8
  95. package/dist/{documentCaptureStateMachine-B8i7GnLh.esm.js → documentCaptureStateMachine-Bh0uyfGq.esm.js} +110 -63
  96. package/dist/documentSignatureStateMachine-CLljjltG.esm.js +219 -0
  97. package/dist/dynamic-forms.d.ts +2 -2
  98. package/dist/dynamic-forms.esm.js +2 -2
  99. package/dist/{dynamicFormsManager-C0dHs1ty.d.ts → dynamicFormsManager-C45pTncO.d.ts} +4 -4
  100. package/dist/{dynamicFormsManager-DK_oc5Oy.esm.js → dynamicFormsManager-CnU2hRvl.esm.js} +5 -3
  101. package/dist/{dynamicFormsStateMachine-CGlIAWZ6.esm.js → dynamicFormsStateMachine-huYmjamB.esm.js} +12 -13
  102. package/dist/ekyb.d.ts +5 -5
  103. package/dist/ekyb.esm.js +3 -3
  104. package/dist/{ekybManager-BLgkiWXw.esm.js → ekybManager-CaEErq39.esm.js} +5 -3
  105. package/dist/{ekybManager-BaZ_7CEu.d.ts → ekybManager-Cjk8pQX0.d.ts} +5 -5
  106. package/dist/ekybStateMachine-BIU8KIMv.esm.js +2173 -0
  107. package/dist/ekybUtils-Dl0MU-ib.esm.js +172 -0
  108. package/dist/ekyc-prefill.d.ts +17 -0
  109. package/dist/ekyc-prefill.esm.js +3 -0
  110. package/dist/ekyc.d.ts +4 -3
  111. package/dist/ekyc.esm.js +3 -3
  112. package/dist/{ekycManager-BO-Lui3t.esm.js → ekycManager-D2K8AaMV.esm.js} +39 -16
  113. package/dist/{ekycManager-DW-ynodd.d.ts → ekycManager-DusmB-4j.d.ts} +49 -7
  114. package/dist/ekycPrefillManager-BwmPXfhY.d.ts +566 -0
  115. package/dist/ekycPrefillManager-CENQjdNq.esm.js +102 -0
  116. package/dist/ekycPrefillStateMachine-jT3hIt2X.esm.js +1289 -0
  117. package/dist/ekycStateMachine-6EKndBd7.esm.js +9024 -0
  118. package/dist/ekycUtils-C6HZB46m.esm.js +1532 -0
  119. package/dist/electronic-signature.d.ts +1 -1
  120. package/dist/electronic-signature.esm.js +1 -1
  121. package/dist/{electronicSignatureManager-DTSLOvKR.d.ts → electronicSignatureManager-5tYz-a4o.d.ts} +4 -3
  122. package/dist/{electronicSignatureManager-CjKvJ6E-.esm.js → electronicSignatureManager-wM8WTgzP.esm.js} +12 -18
  123. package/dist/email.d.ts +1 -1
  124. package/dist/email.esm.js +2 -2
  125. package/dist/{emailManager-ButFktRm.esm.js → emailManager-BBdRYLtH.esm.js} +5 -3
  126. package/dist/{emailManager-Dy6omJVp.d.ts → emailManager-pM7ZPuMa.d.ts} +3 -3
  127. package/dist/{emailStateMachine-BXtlC0NV.esm.js → emailStateMachine-DO7lWYvn.esm.js} +35 -25
  128. package/dist/events-PUWyizJn.esm.js +299 -0
  129. package/dist/events.d.ts +4 -4
  130. package/dist/events.esm.js +2 -1
  131. package/dist/extensibility.d.ts +57 -41
  132. package/dist/extensibility.esm.js +39 -37
  133. package/dist/{externalFetch-DrR9xshk.esm.js → externalFetch-cUjJYyXj.esm.js} +4 -1
  134. package/dist/face-match.d.ts +1 -1
  135. package/dist/face-match.esm.js +2 -2
  136. package/dist/{faceCaptureManagerFactory-1hzeS_rB.d.ts → faceCaptureManagerFactory-D1EJw36F.d.ts} +101 -77
  137. package/dist/{faceCaptureManagerFactory-BDGhg24q.esm.js → faceCaptureManagerFactory-DbEARG3h.esm.js} +29 -12
  138. package/dist/{faceCaptureSetup-CvGYG4GZ.esm.js → faceCaptureSetup-VaAjMpWX.esm.js} +189 -513
  139. package/dist/{faceMatchManager-DIgG-UFS.d.ts → faceMatchManager-C5b5WtcY.d.ts} +23 -7
  140. package/dist/{faceMatchManager-DWFUQjMQ.esm.js → faceMatchManager-nBvS9z0o.esm.js} +5 -3
  141. package/dist/{faceMatchStateMachine-CUCvlydD.esm.js → faceMatchStateMachine-48O8j_Lx.esm.js} +70 -42
  142. package/dist/{feature-management-D4ne_hXW.esm.js → feature-management-D7oLtULO.esm.js} +37 -22
  143. package/dist/feature-management.esm.js +1 -1
  144. package/dist/field-comparison.d.ts +1 -1
  145. package/dist/field-comparison.esm.js +1 -1
  146. package/dist/{fieldComparisonManager-v3knTYV_.esm.js → fieldComparisonManager-B1ipvtnp.esm.js} +7 -7
  147. package/dist/{fieldComparisonManager-CUX4gza2.d.ts → fieldComparisonManager-mFOHRhVd.d.ts} +3 -3
  148. package/dist/fiscal-qr.d.ts +1 -1
  149. package/dist/fiscal-qr.esm.js +1 -1
  150. package/dist/{fiscalQrManager-D0Iy7EKR.d.ts → fiscalQrManager-DFnFVpP9.d.ts} +3 -3
  151. package/dist/{fiscalQrManager-Dt9fHG7h.esm.js → fiscalQrManager-yecjuXV4.esm.js} +9 -8
  152. package/dist/flow-events.d.ts +1 -1
  153. package/dist/flow.d.ts +73 -24
  154. package/dist/flow.esm.js +261 -66
  155. package/dist/{flowCompletionService-Cemwaa5b.esm.js → flowCompletionService-CIjaIpMH.esm.js} +2 -2
  156. package/dist/flowServices-Dqt75TXx.esm.js +951 -0
  157. package/dist/formErrors-lSfh7Y8J.esm.js +512 -0
  158. package/dist/geolocation.d.ts +1 -1
  159. package/dist/geolocation.esm.js +2 -2
  160. package/dist/{geolocationManager-Dn24g1fl.d.ts → geolocationManager-CENrvxpK.d.ts} +19 -20
  161. package/dist/{geolocationManager-B0dc5rW9.esm.js → geolocationManager-DHfgXhEs.esm.js} +9 -9
  162. package/dist/{geolocationStateMachine-B3rcoODF.esm.js → geolocationStateMachine-CrEspaN-.esm.js} +16 -14
  163. package/dist/{getDeviceClass-bsWdEDxP.esm.js → getDeviceClass-Dcy9erbl.esm.js} +1 -1
  164. package/dist/government-validation.d.ts +1 -1
  165. package/dist/government-validation.esm.js +2 -2
  166. package/dist/{governmentValidationManager-BtXWHICu.esm.js → governmentValidationManager-0-L21hu6.esm.js} +5 -3
  167. package/dist/{governmentValidationManager-B82zOut8.d.ts → governmentValidationManager-De_vU7bm.d.ts} +4 -4
  168. package/dist/{governmentValidationStateMachine-COL-Vs48.esm.js → governmentValidationStateMachine-BFIcq3UB.esm.js} +4 -6
  169. package/dist/home.d.ts +4 -3
  170. package/dist/home.esm.js +4 -2
  171. package/dist/http.esm.js +1 -1
  172. package/dist/id-ocr.d.ts +2 -2
  173. package/dist/id-ocr.esm.js +3 -3
  174. package/dist/id-selfie-flow.d.ts +7 -6
  175. package/dist/id-selfie-flow.esm.js +14 -12
  176. package/dist/id-verification.d.ts +1 -1
  177. package/dist/id-verification.esm.js +2 -2
  178. package/dist/id.d.ts +6 -19
  179. package/dist/id.esm.js +4 -4
  180. package/dist/{idCaptureDefaults-BGsG2OAs.esm.js → idCaptureDefaults-CNopPetU.esm.js} +17 -7
  181. package/dist/{idCaptureManager-IouAnrFm.esm.js → idCaptureManager-BPDCAV04.esm.js} +95 -34
  182. package/dist/{idCaptureManager-0M02hSuC.d.ts → idCaptureManager-CNFBeYgV.d.ts} +105 -16
  183. package/dist/{idCaptureServices-VTKIPSpT.esm.js → idCaptureServices-CWZFmS7l.esm.js} +36 -213
  184. package/dist/{idCaptureStateMachine-_Pn2Xkpb.esm.js → idCaptureStateMachine-Cyt2BvPB.esm.js} +3081 -2510
  185. package/dist/{idOcrManager-DT3kPIB3.d.ts → idOcrManager-DflRx-_u.d.ts} +6 -5
  186. package/dist/{idOcrManager-D3-HNMXP.esm.js → idOcrManager-bjBLjrEE.esm.js} +5 -3
  187. package/dist/{idOcrStateMachine-DyENX6Ki.esm.js → idOcrStateMachine-D5ifJ1B8.esm.js} +20 -16
  188. package/dist/{idVerificationManager-BJapZfpy.d.ts → idVerificationManager-B6R8xNZq.d.ts} +4 -3
  189. package/dist/{idVerificationManager-iWz7Avkr.esm.js → idVerificationManager-C8Ja-vKq.esm.js} +5 -3
  190. package/dist/{idVerificationStateMachine-CL1kUdBe.esm.js → idVerificationStateMachine-BMnfZZli.esm.js} +4 -6
  191. package/dist/identity-reuse.d.ts +2 -2
  192. package/dist/identity-reuse.esm.js +2 -2
  193. package/dist/identity-search.d.ts +97 -0
  194. package/dist/identity-search.esm.js +96 -0
  195. package/dist/{identityReuseManager-CD1ucp1d.esm.js → identityReuseManager-B5BWAleT.esm.js} +9 -4
  196. package/dist/{identityReuseManager-ooAbp6Kc.d.ts → identityReuseManager-CZ-qJ_Aa.d.ts} +82 -15
  197. package/dist/{identityReuseStateMachine-DfV81wQC.esm.js → identityReuseStateMachine-Cuggm1UP.esm.js} +24 -31
  198. package/dist/{index-BKOWUhxG.d.ts → index-BMr3MZEI.d.ts} +93 -22
  199. package/dist/{index-CKQ9QBZP.d.ts → index-BoGlwLGK.d.ts} +2 -2
  200. package/dist/index-DHuAkTe0.d.ts +1 -0
  201. package/dist/index.d.ts +1 -1
  202. package/dist/index.esm.js +1 -1
  203. package/dist/{invokeOnCaptureCallback-DYrkOXO6.esm.js → invokeOnCaptureCallback-D2FOfi4O.esm.js} +1 -1
  204. package/dist/kyb-checks.d.ts +3 -0
  205. package/dist/kyb-checks.esm.js +3 -0
  206. package/dist/kybChecksManager-BF2vf0Q2.esm.js +90 -0
  207. package/dist/kybChecksManager-CKDy1mel.d.ts +95 -0
  208. package/dist/kybChecksStateMachine-oBQfgdka.esm.js +713 -0
  209. package/dist/mandatory-consent.d.ts +2 -2
  210. package/dist/mandatory-consent.esm.js +2 -2
  211. package/dist/{mandatoryConsentManager-qYojnZYg.d.ts → mandatoryConsentManager-BcxCesP5.d.ts} +30 -13
  212. package/dist/{mandatoryConsentManager-Cwqx1nK7.esm.js → mandatoryConsentManager-FfgHdPYw.esm.js} +7 -4
  213. package/dist/{mandatoryConsentStateMachine-pXWqAHo_.esm.js → mandatoryConsentStateMachine-CXuYC3qR.esm.js} +35 -19
  214. package/dist/mediaRecorderOptions-Di_V9TnZ.esm.js +87 -0
  215. package/dist/multipartRecordingService-CFmOUGQt.esm.js +407 -0
  216. package/dist/numericRange-2e1vw1W0.esm.js +256 -0
  217. package/dist/{permissionGuards-gcy3U0SL.esm.js → permissionGuards-CZTCRHT-.esm.js} +1 -1
  218. package/dist/{permissionServices-Ca-tSNhT.esm.js → permissionServices-Vd86JiW9.esm.js} +47 -19
  219. package/dist/phone-number.d.ts +7 -1
  220. package/dist/phone-number.esm.js +15 -2
  221. package/dist/phone.d.ts +1 -1
  222. package/dist/phone.esm.js +2 -2
  223. package/dist/{phoneManager-BO-LTih5.d.ts → phoneManager-bA-xw2TP.d.ts} +8 -11
  224. package/dist/{phoneManager-KKUq-Vgo.esm.js → phoneManager-oIMdbeLG.esm.js} +8 -7
  225. package/dist/phoneServices-Dk4j3NhI.esm.js +63 -0
  226. package/dist/{phoneStateMachine-D2QWS2cu.esm.js → phoneStateMachine-Cu3y7ewi.esm.js} +57 -90
  227. package/dist/{phoneValidation-DnBcNUNh.esm.js → phoneValidation-OggtfjRt.esm.js} +1 -2
  228. package/dist/{platform-DkcRc9JV.esm.js → platform-GIg4uPWe.esm.js} +15 -4
  229. package/dist/processFaceMatch-CHeI0DEt.esm.js +21 -0
  230. package/dist/qe-signature.d.ts +2 -2
  231. package/dist/qe-signature.esm.js +1 -1
  232. package/dist/recordingService-DK3kjUby.esm.js +404 -0
  233. package/dist/redirect-to-mobile.d.ts +2 -2
  234. package/dist/redirect-to-mobile.esm.js +2 -2
  235. package/dist/{redirectToMobileManager-CVsvpVbQ.d.ts → redirectToMobileManager-Db99n9Yu.d.ts} +7 -4
  236. package/dist/{redirectToMobileManager-uHW3dyuQ.esm.js → redirectToMobileManager-yYJGE47m.esm.js} +10 -6
  237. package/dist/{redirectToMobileStateMachine-b-H-ipGM.esm.js → redirectToMobileStateMachine-g_NbyHrL.esm.js} +82 -46
  238. package/dist/resolveForm-DaaQSVWp.esm.js +146 -0
  239. package/dist/{runChildModule-DSpP41Hl.esm.js → runChildModule-x1rrxjYY.esm.js} +9 -7
  240. package/dist/{sdkVersion-DKHwWEyH.esm.js → sdkVersion-kRh5h82H.esm.js} +1 -1
  241. package/dist/selfie.d.ts +6 -6
  242. package/dist/selfie.esm.js +15 -13
  243. package/dist/{selfieErrorUtils-DoN1KFSQ.esm.js → selfieErrorUtils-B9GfiS9f.esm.js} +1 -1
  244. package/dist/{selfieManager-DtQegA6T.esm.js → selfieManager-CivYjnF5.esm.js} +7 -6
  245. package/dist/{selfieManager-BJdNu_nd.d.ts → selfieManager-CqDlUy6B.d.ts} +2 -2
  246. package/dist/{selfieStateMachine-CnCwJZuC.esm.js → selfieStateMachine-dLwrXWll.esm.js} +5 -5
  247. package/dist/{session-CNUfjlRc.esm.js → session-DeJ-rd9u.esm.js} +78 -9
  248. package/dist/session.d.ts +85 -9
  249. package/dist/session.esm.js +7 -6
  250. package/dist/{sessionInitializer-JM_glXR2.esm.js → sessionInitializer-uZgyxsrL.esm.js} +442 -208
  251. package/dist/{setup-YPKTUCY5.d.ts → setup-Cr2KCwau.d.ts} +7 -6
  252. package/dist/{setup-C5tfWt6W.esm.js → setup-D0QZHkS8.esm.js} +42 -29
  253. package/dist/signature.d.ts +1 -1
  254. package/dist/signature.esm.js +2 -2
  255. package/dist/{signatureManager-f_dPAGXn.esm.js → signatureManager-DRUflksL.esm.js} +5 -3
  256. package/dist/{signatureManager-BpVt_Jv7.d.ts → signatureManager-daT_8fj_.d.ts} +3 -3
  257. package/dist/{signatureStateMachine-C-nUq_oq.esm.js → signatureStateMachine-BQZenxel.esm.js} +5 -7
  258. package/dist/{spawn-D9jgw9pW.d.ts → spawn-COZKetCS.d.ts} +1 -1
  259. package/dist/{stats-BEvexnKC.esm.js → stats-DHu3li6G.esm.js} +1 -1
  260. package/dist/stats.esm.js +1 -1
  261. package/dist/step-up.d.ts +379 -0
  262. package/dist/step-up.esm.js +640 -0
  263. package/dist/{tri-xzRLIIMN.esm.js → tri-D_gHPWrq.esm.js} +137 -8
  264. package/dist/tri.d.ts +2 -2
  265. package/dist/tri.esm-CftnGf9w.esm.js +3115 -0
  266. package/dist/tri.esm.js +2 -2
  267. package/dist/trueSight-CbrZUzLx.esm.js +1 -0
  268. package/dist/{trueSightService-fLmL_cyg.esm.js → trueSightService-BMp8g65B.esm.js} +25 -16
  269. package/dist/trust-graph.d.ts +87 -27
  270. package/dist/trust-graph.esm.js +6 -25
  271. package/dist/trustGraphStateMachine-0Ehwried.esm.js +58 -0
  272. package/dist/types-B9C8W01q.d.ts +34 -0
  273. package/dist/types-BNkzXOXE.d.ts +45 -0
  274. package/dist/{types-B6HsSzpk.d.ts → types-BZsmNYom.d.ts} +77 -9
  275. package/dist/types-BinnzVrL.d.ts +6 -0
  276. package/dist/{types-CJ7Yl9K-.d.ts → types-Bpo97EOh.d.ts} +4 -2
  277. package/dist/{types-0L-eFDmr.d.ts → types-BwMpWCVG.d.ts} +6 -2
  278. package/dist/{types-BQA7lRDV.d.ts → types-C3rfDzgE.d.ts} +4 -2
  279. package/dist/types-CXTDuzUJ.d.ts +16 -0
  280. package/dist/{types-BEwVKkLJ.d.ts → types-CeEcakO7.d.ts} +7 -1
  281. package/dist/{types-DUnFZ08M.d.ts → types-Cy6Lx3L6.d.ts} +18 -10
  282. package/dist/{types-BAxn7MpY.d.ts → types-D-FEM1rT.d.ts} +156 -58
  283. package/dist/types-D6Q1D1kx.d.ts +33 -0
  284. package/dist/{events-Du2A4-Qr.esm.js → types-DLsivQsu.esm.js} +6 -303
  285. package/dist/{types-DPIDuhut.d.ts → types-DNVzoRvi.d.ts} +2 -1
  286. package/dist/types-DWqO7owj.d.ts +58 -0
  287. package/dist/{types-yPH8lAH-.d.ts → types-HHgsFhZn.d.ts} +16 -3
  288. package/dist/{types-Ckir_BEs.d.ts → types-LbccjQYX.d.ts} +3 -2
  289. package/dist/{types-CK8Jbjkp.d.ts → types-PnJXvTkV.d.ts} +1 -1
  290. package/dist/types-g3NuVCT9.d.ts +118 -0
  291. package/dist/types-tOSLpcSa.d.ts +231 -0
  292. package/dist/urlUtils-B2wagB5v.esm.js +39 -0
  293. package/dist/usStates-CwOQ2kAx.esm.js +209 -0
  294. package/dist/video-selfie.d.ts +27 -17
  295. package/dist/video-selfie.esm.js +105 -26
  296. package/dist/{videoSelfieCameraWarmer-BBNKiau1.esm.js → videoSelfieCameraWarmer-BpP0_lDr.esm.js} +47 -29
  297. package/dist/{videoSelfieFlowModuleMachine-BCFVHBQ1.esm.js → videoSelfieFlowModuleMachine-IWdxw1TW.esm.js} +1 -1
  298. package/dist/{videoSelfieStepDetector-CGsTltqB.d.ts → videoSelfieStepDetector-CxOc3kSI.d.ts} +24 -9
  299. package/dist/virtualCameraCheck-eFOm2C9q.esm.js +27 -0
  300. package/dist/{warmup-BElYWRh7.esm.js → warmup-ClZxXOkg.esm.js} +378 -57
  301. package/dist/{warmup-BO57syF6.d.ts → warmup-SWu5L7cW.d.ts} +19 -2
  302. package/dist/wasm.d.ts +9 -3
  303. package/dist/wasm.esm.js +3 -3
  304. package/dist/wasmDeepsightConfigSync-DukEcrU8.esm.js +77 -0
  305. package/dist/{wasmDsFlagSync-CYj5LL9z.esm.js → wasmDsFlagSync-Bw-P5OG1.esm.js} +1 -1
  306. package/dist/{wasmWebClient-BjZw_7OB.esm.js → wasmWebClient-BLtlzQhv.esm.js} +77 -29
  307. package/dist/watchlist-for-business.d.ts +2 -1
  308. package/dist/watchlist-for-business.esm.js +2 -2
  309. package/dist/watchlist.d.ts +1 -1
  310. package/dist/watchlist.esm.js +2 -2
  311. package/dist/{watchlistForBusinessManager-CZZOFkGl.esm.js → watchlistForBusinessManager-d8kdf35n.esm.js} +40 -8
  312. package/dist/{watchlistForBusinessManager-B3GDPZrr.d.ts → watchlistForBusinessManager-l7ZERQcV.d.ts} +57 -21
  313. package/dist/watchlistForBusinessStateMachine-Y9wFmuMH.esm.js +170 -0
  314. package/dist/{watchlistManager-DXtX94SN.esm.js → watchlistManager-D1BVrd3H.esm.js} +5 -3
  315. package/dist/{watchlistManager-DJQOd8Pw.d.ts → watchlistManager-DQq4GxBO.d.ts} +3 -3
  316. package/dist/{watchlistStateMachine-McALifag.esm.js → watchlistStateMachine-Da4p0sTE.esm.js} +4 -6
  317. package/dist/workflow.d.ts +10 -6
  318. package/dist/workflow.esm.js +95 -60
  319. package/dist/{xstate-actors.esm-8Gzepa_A.esm.js → xstate-actors.esm-BCcwgosu.esm.js} +1 -1
  320. package/dist/xstate.cjs-D6Ur0X1F.d.ts +7 -0
  321. package/dist/{xstate.esm-DSajW7CJ.esm.js → xstate.esm-CIqUf_i6.esm.js} +1 -125
  322. package/package.json +34 -7
  323. package/dist/Actor-DpTj5PFb.d.ts +0 -1
  324. package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +0 -9
  325. package/dist/addressSearch-DPjIKJrX.esm.js +0 -563
  326. package/dist/camera-9wWD-pwg.d.ts +0 -4
  327. package/dist/cpf-uAZTPUBy.esm.js +0 -61
  328. package/dist/deepsightLoader-sH7920zw.esm.js +0 -55
  329. package/dist/ekybStateMachine-BfgOUZMK.esm.js +0 -933
  330. package/dist/ekycStateMachine-CDnI_NRq.esm.js +0 -1443
  331. package/dist/ekycUtils-zY8CdKJL.esm.js +0 -300
  332. package/dist/flowServices-X6Rwf_7E.esm.js +0 -688
  333. package/dist/index-DpTj5PFb.d.ts +0 -1
  334. package/dist/thumbmark.esm-CRc0cYvz.esm.js +0 -1242
  335. package/dist/tri.esm-BIjHhBJ2.esm.js +0 -2620
  336. package/dist/types-BvLo3U4u.d.ts +0 -134
  337. package/dist/types-zOgZqMni.d.ts +0 -6
  338. package/dist/urlUtils-6jsE6rKp.esm.js +0 -23
  339. package/dist/watchlistForBusinessStateMachine-B66E7jud.esm.js +0 -78
  340. /package/dist/{types-BSBzhHRH2.d.ts → types-BSBzhHRH.d.ts} +0 -0
@@ -0,0 +1,713 @@
1
+ import { t as getLocalIsoDate } from "./IBrowserEnvironmentCapability-D7JG7ML3.esm.js";
2
+ import { t as api, u as endpoints } from "./api-B58edv6M.esm.js";
3
+ import { i as toIncodeApiError, t as IncodeApiError } from "./apiError-B9-B3cMq.esm.js";
4
+ import { n as loadPhoneValidation, t as getPhoneValidation } from "./phoneValidation-OggtfjRt.esm.js";
5
+ import { i as assign, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
6
+ import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
7
+ import { t as usStateOptions } from "./usStates-CwOQ2kAx.esm.js";
8
+ import { n as checkSupport, t as resolveForm } from "./resolveForm-DaaQSVWp.esm.js";
9
+ import { a as e164, c as setFieldValue, d as createFormRegistry, f as supportedIds, i as oneOfRequired, l as validateAllValues, n as requiredError, o as allowedCharacters, p as buildPayload, r as trim, s as phoneDeps, t as STRUCTURE_MESSAGES } from "./formErrors-lSfh7Y8J.esm.js";
10
+ function isSupportedSchema(form) {
11
+ return String(form.schemaVersion).split(".")[0] === "1";
12
+ }
13
+ /** Every field of the form, in display order. */
14
+ function formFields(form) {
15
+ if (!form) return [];
16
+ return form.steps.flatMap((step) => step.sections.flatMap((section) => section.fields));
17
+ }
18
+ function findField(form, name) {
19
+ return formFields(form).find((field) => field.name === name);
20
+ }
21
+ //#endregion
22
+ //#region src/modules/kyb-checks/kybChecksDefinition.ts
23
+ const KYB_CHECKS_MODULE = "kybChecks";
24
+ /** Served field name → vocabulary group. Every group is on: the backend already chose the fields. */
25
+ const GROUPS = {
26
+ country: "country",
27
+ taxId: "taxId",
28
+ businessName: "businessName",
29
+ alternativeNames: "alternativeNames",
30
+ street: "address",
31
+ city: "address",
32
+ state: "address",
33
+ postalCode: "address",
34
+ website: "website",
35
+ phoneNumber: "phone",
36
+ email: "email",
37
+ personNames: "personNames"
38
+ };
39
+ /** The group of a served field name this build has no group for. */
40
+ const OTHER_GROUP = "other";
41
+ /** Served field type → vocabulary kind. Any other type renders as text. */
42
+ const KINDS = {
43
+ text: "text",
44
+ select: "choice",
45
+ phone: "phone",
46
+ list: "list"
47
+ };
48
+ const KEYBOARDS = /* @__PURE__ */ new Set(["url", "email"]);
49
+ /**
50
+ * The only ids the adapter produces, with their kernel implementations: KYB
51
+ * Checks validates and builds its request with these, and nothing else, so
52
+ * the kernel's other rules, the vocabulary and the postal tables stay out of
53
+ * its bundle. A served construct with no id here is left out by the adapter.
54
+ * There are no default messages: every served rule carries its own, and a
55
+ * rule without one falls back to its id, as before.
56
+ */
57
+ const KYB_CHECKS_REGISTRY = createFormRegistry({
58
+ schemaVersions: [1],
59
+ vocabulary: "1.3",
60
+ kinds: Object.values(KINDS),
61
+ groups: [...Object.values(GROUPS), OTHER_GROUP],
62
+ rules: [allowedCharacters],
63
+ transforms: [trim, e164],
64
+ groupRules: [oneOfRequired],
65
+ optionLists: { US_STATES: usStateOptions.map((option) => option.value) },
66
+ flags: ["payload.omitWhenEmpty"],
67
+ required: requiredError,
68
+ structure: STRUCTURE_MESSAGES
69
+ });
70
+ /** Request transforms the adapter keeps from a served field. */
71
+ const TRANSFORMS = new Set(KYB_CHECKS_REGISTRY.transforms.keys());
72
+ const KYB_CHECKS_SUPPORTED_IDS = supportedIds(KYB_CHECKS_REGISTRY);
73
+ /** A served regex of the one shape `allowedCharacters` can express: `^[…]{1,n}$` or `^[…]+$`. */
74
+ const CHARACTER_CLASS_REGEX = /^\^\[([^\]]+)\](?:\{[01],(\d+)\}|\+)\$$/;
75
+ /**
76
+ * Reads a served pattern as `allowedCharacters` (ASCII letters) plus a maximum
77
+ * length. Returns `undefined` for any other regex, which the adapter leaves
78
+ * out.
79
+ */
80
+ function toCharacterPattern(regex, flags = "") {
81
+ const match = regex ? CHARACTER_CLASS_REGEX.exec(regex) : null;
82
+ if (!match || flags !== "" && flags !== "i") return void 0;
83
+ const [, body, max] = match;
84
+ let upper = false;
85
+ let lower = false;
86
+ let digit = false;
87
+ let space = false;
88
+ let extra = "";
89
+ for (let i = 0; i < body.length; i++) {
90
+ const range = body.slice(i, i + 3);
91
+ if (range === "A-Z" || range === "a-z" || range === "0-9") {
92
+ if (range === "A-Z") upper = true;
93
+ if (range === "a-z") lower = true;
94
+ if (range === "0-9") digit = true;
95
+ i += 2;
96
+ } else if (body[i] === "\\" && i + 1 < body.length) {
97
+ const escaped = body[++i];
98
+ if (escaped === "d") digit = true;
99
+ else if (/[A-Za-z]/.test(escaped)) return void 0;
100
+ else extra += escaped;
101
+ } else if (body[i] === "-" && i > 0 && i < body.length - 1) return;
102
+ else if (body[i] === " ") space = true;
103
+ else extra += body[i];
104
+ }
105
+ const letter = upper && lower || flags === "i" && (upper || lower);
106
+ if ((upper || lower) && !letter) return void 0;
107
+ const classes = [];
108
+ if (letter) classes.push("letter");
109
+ if (digit) classes.push("digit");
110
+ if (space) classes.push("space");
111
+ return {
112
+ classes,
113
+ extra,
114
+ max: max ? Number(max) : void 0
115
+ };
116
+ }
117
+ const toFormText = ({ key, text }) => ({
118
+ key,
119
+ text
120
+ });
121
+ function toField(field, section, country) {
122
+ const options = field.options?.map((option) => ({
123
+ value: option.value,
124
+ label: toFormText(option.label)
125
+ }));
126
+ let kind = KINDS[field.type] ?? "text";
127
+ if (kind === "choice" && !options?.length) kind = "text";
128
+ const rules = [];
129
+ let maxLength;
130
+ for (const rule of field.rules) {
131
+ if (rule.kind !== "pattern" || kind === "phone") continue;
132
+ const pattern = toCharacterPattern(rule.regex, rule.flags);
133
+ if (!pattern) continue;
134
+ rules.push({
135
+ id: "allowedCharacters",
136
+ params: {
137
+ classes: pattern.classes,
138
+ extra: pattern.extra,
139
+ ascii: true
140
+ },
141
+ message: toFormText(rule.message)
142
+ });
143
+ if (pattern.max !== void 0) maxLength = Math.min(maxLength ?? pattern.max, pattern.max);
144
+ }
145
+ const keyboard = field.input?.keyboard;
146
+ const input = {
147
+ ...maxLength !== void 0 && { maxLength },
148
+ ...keyboard && KEYBOARDS.has(keyboard) && { keyboard }
149
+ };
150
+ const usStates = kind === "choice" && field.name === "state" && country === "US";
151
+ return {
152
+ name: field.name,
153
+ kind,
154
+ group: GROUPS[field.name] ?? OTHER_GROUP,
155
+ section,
156
+ required: field.required,
157
+ label: toFormText(field.label),
158
+ ...Object.keys(input).length > 0 && { input },
159
+ ...kind === "choice" && (usStates ? { optionsRef: "US_STATES" } : { options }),
160
+ ...kind === "phone" && { phone: {
161
+ lockCountry: !field.phone?.allowCountryChange,
162
+ defaultCountry: "definition"
163
+ } },
164
+ ...rules.length > 0 && { rules },
165
+ payload: {
166
+ key: field.payload.key,
167
+ transforms: field.payload.transforms.filter((id) => TRANSFORMS.has(id)).map((id) => ({ id })),
168
+ omitWhenEmpty: field.payload.omitWhenEmpty
169
+ }
170
+ };
171
+ }
172
+ function toGroupRules(form, names) {
173
+ return [...form.rules, ...formFields(form).flatMap((field) => field.rules)].flatMap((rule) => {
174
+ const fields = (rule.fields ?? []).filter((name) => names.has(name));
175
+ if (rule.kind !== "requireAnyOf" || fields.length === 0) return [];
176
+ return [{
177
+ id: "oneOfRequired",
178
+ fields,
179
+ message: toFormText(rule.message)
180
+ }];
181
+ });
182
+ }
183
+ /**
184
+ * `submit.static` without the keys a served field writes. The backend sends
185
+ * the country both ways, with the same value; the field's value is the one
186
+ * the user chose (CK1 decision K11), and the kernel reports two writers of
187
+ * one key as a definition error.
188
+ */
189
+ function staticKeys(form, fields) {
190
+ const written = new Set(fields.filter((field) => !field.payload?.omit).map((field) => field.payload?.key ?? field.name));
191
+ return Object.fromEntries(Object.entries(form.submit?.static ?? {}).filter(([key]) => !written.has(key)));
192
+ }
193
+ /**
194
+ * The served form as a form definition, plus what the definition has no slot
195
+ * for. Steps are flattened: the backend always sends one.
196
+ */
197
+ function toKybChecksDefinition(form) {
198
+ const country = form.context.country;
199
+ const sections = [];
200
+ const fields = [];
201
+ const layoutFields = {};
202
+ for (const step of form.steps) for (const section of step.sections) {
203
+ sections.push(section.title ? {
204
+ id: section.id,
205
+ title: toFormText(section.title)
206
+ } : { id: section.id });
207
+ for (const field of section.fields) {
208
+ fields.push(toField(field, section.id, country));
209
+ layoutFields[field.name] = {
210
+ value: field.value,
211
+ readonly: field.display !== "editable",
212
+ ...field.refetchOnChange && { refetchOnChange: field.refetchOnChange }
213
+ };
214
+ }
215
+ }
216
+ const groupRules = toGroupRules(form, new Set(fields.map((field) => field.name)));
217
+ return {
218
+ definition: {
219
+ schemaVersion: 1,
220
+ vocabulary: KYB_CHECKS_SUPPORTED_IDS.vocabulary,
221
+ id: `${KYB_CHECKS_MODULE}/${country ?? "country"}`,
222
+ module: KYB_CHECKS_MODULE,
223
+ ...country && { country },
224
+ sections,
225
+ fields,
226
+ ...groupRules.length > 0 && { groupRules },
227
+ submit: { static: staticKeys(form, fields) }
228
+ },
229
+ layout: {
230
+ title: form.steps[0]?.title,
231
+ fields: layoutFields
232
+ }
233
+ };
234
+ }
235
+ //#endregion
236
+ //#region src/modules/kyb-checks/kybChecksFields.ts
237
+ /**
238
+ * KYB Checks on the forms kernel: checks and resolves the definition the
239
+ * adapter builds and projects it to `KybFieldDef`s. Values are validated with
240
+ * the kernel's `validateForm` and the request body is the kernel's
241
+ * `buildPayload`, both with `KYB_CHECKS_REGISTRY`; this file only maps their
242
+ * errors to the module's `KybText`s.
243
+ */
244
+ /** A phone the input itself reports as malformed. */
245
+ const PHONE_FORMAT_ERROR = {
246
+ key: "kyb.errors.phoneNumberFormat",
247
+ text: "Enter a valid phone number"
248
+ };
249
+ const ALL_GROUPS_ON = Object.fromEntries([...KYB_CHECKS_SUPPORTED_IDS.groups].map((group) => [group, true]));
250
+ const TYPES = {
251
+ choice: "dropdown",
252
+ phone: "phone",
253
+ list: "list"
254
+ };
255
+ const fromFormText = (text) => ({
256
+ key: text.key,
257
+ text: text.text ?? ""
258
+ });
259
+ function projectField(resolved, layout, country) {
260
+ const { field, required, phoneLocked } = resolved;
261
+ const type = TYPES[field.kind] ?? "text";
262
+ const served = layout.fields[field.name];
263
+ const keyboard = field.input?.keyboard;
264
+ const maxLength = field.input?.maxLength;
265
+ const options = field.optionsRef === "US_STATES" ? usStateOptions.map((option) => ({ ...option })) : field.options?.map((option) => ({
266
+ value: option.value,
267
+ label: option.label.key,
268
+ labelText: option.label.text
269
+ }));
270
+ return {
271
+ name: field.name,
272
+ type,
273
+ label: field.label.key,
274
+ labelText: field.label.text ?? "",
275
+ required,
276
+ ...field.section && { section: field.section },
277
+ ...maxLength !== void 0 && { maxLength },
278
+ ...type === "dropdown" && { options },
279
+ ...(keyboard === "url" || keyboard === "email") && { inputType: keyboard },
280
+ ...type === "phone" && {
281
+ phoneCountry: country,
282
+ disableCountrySelector: phoneLocked
283
+ },
284
+ ...served?.readonly && { readonly: true },
285
+ ...served?.refetchOnChange && { refetchOnChange: served.refetchOnChange },
286
+ initialValue: served?.value ?? (type === "list" ? [] : "")
287
+ };
288
+ }
289
+ /**
290
+ * The English text of every message the definition carries (rule and group
291
+ * rule messages), by key, for a key i18nexus doesn't have.
292
+ */
293
+ function messageTexts(definition) {
294
+ const texts = /* @__PURE__ */ new Map([[PHONE_FORMAT_ERROR.key, PHONE_FORMAT_ERROR.text]]);
295
+ const add = (text) => {
296
+ if (text?.text && !texts.has(text.key)) texts.set(text.key, text.text);
297
+ };
298
+ for (const field of definition.fields) for (const rule of field.rules ?? []) add(rule.message);
299
+ for (const rule of definition.groupRules ?? []) add(rule.message);
300
+ return texts;
301
+ }
302
+ /**
303
+ * Each field's first served rule text, by field name. A served pattern also
304
+ * caps the field's length, so a value that is too long falls back to it, as
305
+ * the module's own check did.
306
+ */
307
+ function lengthTexts(definition) {
308
+ return new Map(definition.fields.flatMap((field) => {
309
+ const text = field.rules?.find((rule) => rule.message?.text)?.message?.text;
310
+ return field.input?.maxLength !== void 0 && text ? [[field.name, text]] : [];
311
+ }));
312
+ }
313
+ const preparedForms = /* @__PURE__ */ new WeakMap();
314
+ function prepared(form) {
315
+ if (preparedForms.has(form)) return preparedForms.get(form) ?? void 0;
316
+ let result = null;
317
+ if (isSupportedSchema(form)) {
318
+ const { definition, layout } = toKybChecksDefinition(form);
319
+ const support = checkSupport(definition, KYB_CHECKS_SUPPORTED_IDS);
320
+ if (support.supported) {
321
+ const resolved = resolveForm(definition, { groups: ALL_GROUPS_ON });
322
+ const sections = (definition.sections ?? []).map((section) => ({
323
+ id: section.id,
324
+ ...section.title && { title: fromFormText(section.title) },
325
+ fields: resolved.fields.filter((field) => field.field.section === section.id).map((field) => projectField(field, layout, definition.country))
326
+ }));
327
+ result = {
328
+ view: {
329
+ title: layout.title,
330
+ sections
331
+ },
332
+ definition,
333
+ check: {
334
+ form: resolved,
335
+ registry: KYB_CHECKS_REGISTRY,
336
+ env: () => ({
337
+ country: definition.country ?? "",
338
+ today: getLocalIsoDate(),
339
+ deps: phoneDeps()
340
+ }),
341
+ invalidFormatError: { key: PHONE_FORMAT_ERROR.key }
342
+ },
343
+ fieldsByName: new Map(sections.flatMap((section) => section.fields.map((field) => [field.name, field]))),
344
+ texts: messageTexts(definition),
345
+ lengthTexts: lengthTexts(definition)
346
+ };
347
+ } else console.warn("[kyb-checks] Unsupported form definition", support.problems);
348
+ }
349
+ preparedForms.set(form, result);
350
+ return result ?? void 0;
351
+ }
352
+ /**
353
+ * The served form on the forms kernel: translated to a definition, checked,
354
+ * resolved with every group on and projected. `undefined` when this build
355
+ * can't render it: a newer schema major, or an adapter output that fails
356
+ * `checkSupport`, which would be a bug in the adapter.
357
+ */
358
+ function prepareKybChecksForm(form) {
359
+ return prepared(form)?.view;
360
+ }
361
+ /** What the kernel checks the form's values against. */
362
+ function kybChecksFormCheck(form) {
363
+ return prepared(form)?.check;
364
+ }
365
+ /**
366
+ * Whether the form shows a phone locked to its country. Its country check
367
+ * needs the phone rules, so a submit waits for them first.
368
+ */
369
+ function hasLockedPhone(form) {
370
+ return !!prepared(form)?.check.form.fields.some((field) => field.phoneLocked);
371
+ }
372
+ function sectionFields(prepared) {
373
+ return prepared.sections.flatMap((section) => section.fields);
374
+ }
375
+ function canKeep(field, before, value) {
376
+ if (field.readonly) return false;
377
+ if (before && before.type !== field.type) return false;
378
+ if (Array.isArray(value) !== Array.isArray(field.initialValue)) return false;
379
+ if (field.type !== "dropdown" || value === "") return true;
380
+ return (field.options ?? []).some((option) => option.value === value);
381
+ }
382
+ /**
383
+ * Values for a newly fetched form. What the user entered carries over to the
384
+ * field of the same name only when that field is editable, has the same type
385
+ * and shape as before and, for a dropdown, still offers the value. A phone
386
+ * the input flagged as invalid stays flagged with it. Every other field
387
+ * starts from its served value.
388
+ */
389
+ function carryOverValues(prepared, before, previous, invalidFormats) {
390
+ const beforeFields = new Map((before ? sectionFields(before) : []).map((field) => [field.name, field]));
391
+ const values = {};
392
+ const stillInvalid = {};
393
+ for (const field of sectionFields(prepared)) {
394
+ const kept = previous[field.name];
395
+ if (kept !== void 0 && canKeep(field, beforeFields.get(field.name), kept)) {
396
+ values[field.name] = kept;
397
+ if (field.type === "phone" && invalidFormats[field.name]) stillInvalid[field.name] = true;
398
+ } else values[field.name] = field.initialValue;
399
+ }
400
+ return {
401
+ values,
402
+ invalidFormats: stillInvalid
403
+ };
404
+ }
405
+ /**
406
+ * A kernel error as a `KybText`: params as text, and the served English text
407
+ * as fallback. A value that is too long gets the field's served pattern text
408
+ * (its `lengthText`), which also capped the length.
409
+ */
410
+ function toKybText(error, field, texts, lengthText) {
411
+ const params = error.params ? Object.fromEntries(Object.entries(error.params).map(([name, value]) => [name, Array.isArray(value) ? value.join(", ") : String(value)])) : void 0;
412
+ const tooLong = typeof error.params?.maxLength === "number";
413
+ const text = error.key === "verification.errors.fieldRequiredDynamic" && field ? `${field.labelText} is required` : texts.get(error.key) ?? (tooLong ? lengthText : void 0) ?? "";
414
+ return {
415
+ key: error.key,
416
+ text,
417
+ ...params && { params }
418
+ };
419
+ }
420
+ const kybErrors = /* @__PURE__ */ new WeakMap();
421
+ const NO_TEXTS = /* @__PURE__ */ new Map();
422
+ /**
423
+ * The module's errors for the UI and headless hosts. The required message's
424
+ * `fieldName` is the field's label key; show the field's `labelText` when it
425
+ * has no translation. Mapped once per errors object, so it keeps its identity
426
+ * between snapshots.
427
+ */
428
+ function toKybErrors(form, errors) {
429
+ const known = kybErrors.get(errors);
430
+ if (known) return known;
431
+ const entry = form ? prepared(form) : void 0;
432
+ const mapped = Object.fromEntries(Object.entries(errors).map(([name, error]) => [name, toKybText(error, entry?.fieldsByName.get(name), entry?.texts ?? NO_TEXTS, entry?.lengthTexts.get(name))]));
433
+ kybErrors.set(errors, mapped);
434
+ return mapped;
435
+ }
436
+ /**
437
+ * The `POST /omni/kyb` body: the kernel's request body for the definition.
438
+ * Empty values are left out, list entries that are blank are dropped, and
439
+ * `submit.static` keys follow the fields. A served form the compiler never
440
+ * saw can still repeat a request key; the first writer wins, with a warning.
441
+ */
442
+ function buildKybChecksBody(form, values) {
443
+ const check = prepared(form)?.check;
444
+ if (!check) return {};
445
+ const { body, problems } = buildPayload(check.form, values, check.registry, check.env());
446
+ if (problems.length > 0) console.warn("[kyb-checks] Request body problems", problems);
447
+ return { ...body };
448
+ }
449
+ //#endregion
450
+ //#region src/modules/kyb-checks/kybChecksServices.ts
451
+ /**
452
+ * Fetches the KYB form for the session. Without `country` it holds only the
453
+ * country picker; with it, the fields that country needs and a `submit` block.
454
+ */
455
+ async function fetchKybForm(country, signal) {
456
+ try {
457
+ return (await api.get(endpoints.kybForm, {
458
+ query: { country },
459
+ signal
460
+ })).data;
461
+ } catch (error) {
462
+ throw toIncodeApiError(endpoints.kybForm, error);
463
+ }
464
+ }
465
+ /**
466
+ * Runs the KYB checks. Always posts to `endpoints.kybSubmit`: the form's
467
+ * `submit.endpoint` and `submit.method` are not followed.
468
+ */
469
+ async function submitKyb(body, signal) {
470
+ try {
471
+ return (await api.post(endpoints.kybSubmit, body, { signal })).data;
472
+ } catch (error) {
473
+ throw toIncodeApiError(endpoints.kybSubmit, error);
474
+ }
475
+ }
476
+ //#endregion
477
+ //#region src/modules/kyb-checks/kybChecksStateMachine.ts
478
+ /** The only `refetchOnChange` query parameter `GET /omni/kyb/form` takes. */
479
+ const COUNTRY_PARAM = "country";
480
+ function isForbidden(error) {
481
+ return error instanceof IncodeApiError && error.httpStatus === 403;
482
+ }
483
+ /**
484
+ * A submit is retried only when the server answered with a 4xx: it rejected
485
+ * the request, so no check ran. After a timeout, a network failure or a 5xx
486
+ * the checks may already have run, and `POST /omni/kyb` has no duplicate
487
+ * guard, so a retry could run (and charge) them twice.
488
+ */
489
+ function canRetrySubmit(error) {
490
+ return error instanceof IncodeApiError && error.httpStatus >= 400 && error.httpStatus < 500;
491
+ }
492
+ function errorMessageOf(error) {
493
+ return error instanceof Error ? error.message : String(error);
494
+ }
495
+ const kybChecksMachine = setup({
496
+ types: {
497
+ context: {},
498
+ events: {},
499
+ input: {},
500
+ output: {}
501
+ },
502
+ actors: {
503
+ fetchForm: fromPromise(async ({ input, signal }) => fetchKybForm(input.country, signal)),
504
+ loadPhoneRules: fromPromise(async () => {
505
+ await loadPhoneValidation();
506
+ }),
507
+ submit: fromPromise(async ({ input, signal }) => {
508
+ await loadPhoneValidation();
509
+ return submitKyb(buildKybChecksBody(input.form, input.values), signal);
510
+ })
511
+ },
512
+ actions: {
513
+ startPhoneValidationLoad: () => {
514
+ loadPhoneValidation();
515
+ },
516
+ applyForm: assign(({ context, event }) => {
517
+ const form = event.output;
518
+ const prepared = prepareKybChecksForm(form);
519
+ return {
520
+ form,
521
+ prepared,
522
+ ...carryOverValues(prepared, context.prepared, context.values, context.invalidFormats),
523
+ errors: {},
524
+ country: form.context.country ?? context.country
525
+ };
526
+ }),
527
+ setFieldValue: assign(({ context, event }) => {
528
+ const check = context.form && kybChecksFormCheck(context.form);
529
+ const set = event;
530
+ return check ? setFieldValue(context, set, check) : { values: {
531
+ ...context.values,
532
+ [set.name]: set.value
533
+ } };
534
+ }),
535
+ setCountryFromEvent: assign(({ event }) => ({ country: String(event.value) })),
536
+ validateAll: assign(({ context }) => {
537
+ const check = context.form && kybChecksFormCheck(context.form);
538
+ return { errors: check ? validateAllValues(context, check) : {} };
539
+ }),
540
+ setLoadError: assign(({ event }) => ({
541
+ errorKind: "load",
542
+ canRetry: true,
543
+ errorMessage: errorMessageOf(event.error)
544
+ })),
545
+ setSubmitError: assign(({ event }) => {
546
+ const { error } = event;
547
+ return {
548
+ errorKind: "submit",
549
+ canRetry: canRetrySubmit(error),
550
+ errorMessage: errorMessageOf(error)
551
+ };
552
+ }),
553
+ clearError: assign({
554
+ errorKind: void 0,
555
+ errorMessage: void 0,
556
+ canRetry: false
557
+ }),
558
+ setResult: assign(({ event }) => ({ result: { referenceId: event.output?.referenceId } }))
559
+ },
560
+ guards: {
561
+ isSupportedForm: ({ event }) => !!prepareKybChecksForm(event.output),
562
+ isForbidden: ({ event }) => isForbidden(event.error),
563
+ changesCountry: ({ context, event }) => {
564
+ const { name, value } = event;
565
+ return findField(context.form, name)?.refetchOnChange === COUNTRY_PARAM && typeof value === "string" && value !== "" && value !== context.country;
566
+ },
567
+ waitsForPhoneRules: ({ context }) => !!context.form && hasLockedPhone(context.form) && !getPhoneValidation(),
568
+ hasNoErrors: ({ context }) => Object.keys(context.errors).length === 0 && !!context.form?.submit,
569
+ failedLoadingFirstForm: ({ context }) => context.errorKind === "load" && context.form === void 0,
570
+ failedLoading: ({ context }) => context.errorKind === "load",
571
+ canRetry: ({ context }) => context.canRetry
572
+ }
573
+ }).createMachine({
574
+ id: "kybChecks",
575
+ initial: "idle",
576
+ context: ({ input }) => ({
577
+ config: input?.config ?? {},
578
+ form: void 0,
579
+ prepared: void 0,
580
+ values: {},
581
+ errors: {},
582
+ invalidFormats: {},
583
+ country: void 0,
584
+ errorKind: void 0,
585
+ errorMessage: void 0,
586
+ canRetry: false,
587
+ result: void 0
588
+ }),
589
+ output: ({ context }) => context.result ?? {},
590
+ states: {
591
+ idle: { on: { LOAD: "loading" } },
592
+ loading: {
593
+ entry: "startPhoneValidationLoad",
594
+ invoke: {
595
+ id: "fetchForm",
596
+ src: "fetchForm",
597
+ input: ({ context }) => ({ country: context.country }),
598
+ onDone: [{
599
+ guard: "isSupportedForm",
600
+ target: "form",
601
+ actions: "applyForm"
602
+ }, { target: "misconfigured" }],
603
+ onError: [{
604
+ guard: "isForbidden",
605
+ target: "misconfigured"
606
+ }, {
607
+ target: "error",
608
+ actions: "setLoadError"
609
+ }]
610
+ }
611
+ },
612
+ form: {
613
+ initial: "inputting",
614
+ states: {
615
+ inputting: { on: {
616
+ SET_FIELD: [{
617
+ guard: "changesCountry",
618
+ target: "refetching",
619
+ actions: ["setFieldValue", "setCountryFromEvent"]
620
+ }, { actions: "setFieldValue" }],
621
+ SUBMIT: [{
622
+ guard: "waitsForPhoneRules",
623
+ target: "loadingPhoneRules"
624
+ }, { target: "validating" }]
625
+ } },
626
+ loadingPhoneRules: { invoke: {
627
+ id: "loadPhoneRules",
628
+ src: "loadPhoneRules",
629
+ onDone: { target: "validating" },
630
+ onError: { target: "validating" }
631
+ } },
632
+ refetching: {
633
+ invoke: {
634
+ id: "refetchForm",
635
+ src: "fetchForm",
636
+ input: ({ context }) => ({ country: context.country }),
637
+ onDone: [{
638
+ guard: "isSupportedForm",
639
+ target: "inputting",
640
+ actions: "applyForm"
641
+ }, { target: "#kybChecks.misconfigured" }],
642
+ onError: [{
643
+ guard: "isForbidden",
644
+ target: "#kybChecks.misconfigured"
645
+ }, {
646
+ target: "#kybChecks.error",
647
+ actions: "setLoadError"
648
+ }]
649
+ },
650
+ on: { SET_FIELD: [{
651
+ guard: "changesCountry",
652
+ target: "refetching",
653
+ reenter: true,
654
+ actions: ["setFieldValue", "setCountryFromEvent"]
655
+ }, { actions: "setFieldValue" }] }
656
+ },
657
+ validating: {
658
+ entry: "validateAll",
659
+ always: [{
660
+ guard: "hasNoErrors",
661
+ target: "#kybChecks.submitting"
662
+ }, { target: "inputting" }]
663
+ }
664
+ },
665
+ on: { CLOSE: "closed" }
666
+ },
667
+ submitting: { invoke: {
668
+ id: "submit",
669
+ src: "submit",
670
+ input: ({ context }) => ({
671
+ form: context.form,
672
+ values: context.values
673
+ }),
674
+ onDone: {
675
+ target: "finished",
676
+ actions: "setResult"
677
+ },
678
+ onError: [{
679
+ guard: "isForbidden",
680
+ target: "misconfigured"
681
+ }, {
682
+ target: "error",
683
+ actions: "setSubmitError"
684
+ }]
685
+ } },
686
+ error: { on: {
687
+ RETRY: [
688
+ {
689
+ guard: "failedLoadingFirstForm",
690
+ target: "loading",
691
+ actions: "clearError"
692
+ },
693
+ {
694
+ guard: "failedLoading",
695
+ target: "form.refetching",
696
+ actions: "clearError"
697
+ },
698
+ {
699
+ guard: "canRetry",
700
+ target: "submitting",
701
+ actions: "clearError"
702
+ }
703
+ ],
704
+ CLOSE: "closed"
705
+ } },
706
+ /** KYB is not in the session's flow, the session is closed, or the form schema is newer than this SDK. */
707
+ misconfigured: { on: { CLOSE: "closed" } },
708
+ finished: { type: "final" },
709
+ closed: { type: "final" }
710
+ }
711
+ });
712
+ //#endregion
713
+ export { toKybErrors as n, kybChecksMachine as t };