@incodetech/core 2.4.1 → 2.5.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/dist/Actor-DqjOqDfU.d.ts +1 -0
  2. package/dist/{BaseWasmProvider-Bq3OHo7P.d.ts → BaseWasmProvider-bBNquvYn.d.ts} +2 -2
  3. package/dist/BrowserNetworkStatusProvider-BrDXBEDd.esm.js +21 -0
  4. package/dist/{multipartRecordingService-CLwrF5wD.esm.js → CameraCompositor-ppyMYVoY.esm.js} +7 -744
  5. package/dist/DateFormattingProvider-DPq9zco-.esm.js +25 -0
  6. package/dist/{FaceDetectionProvider-J_-1Cwck.esm.js → FaceDetectionProvider-D0DbKUKC.esm.js} +28 -64
  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-C-5M8pP1.d.ts} +2 -2
  10. package/dist/{IWasmUtilCapability-GF2n7sfm.d.ts → IWasmUtilCapability-BRn0wz8v.d.ts} +33 -6
  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/MultipartRecordingProvider-CduV32Qa.esm.js +151 -0
  14. package/dist/{PhoneValidationProvider-SZiOS0jB.esm.js → PhoneValidationProvider-Co4zk2en.esm.js} +7 -0
  15. package/dist/{StreamCanvasCapture-7JRf-2ck.d.ts → StreamCanvasCapture-BOwciHDC.d.ts} +20 -4
  16. package/dist/{StreamCanvasCapture-C9jtgBdT.esm.js → StreamCanvasCapture-CXd87trH.esm.js} +18 -3
  17. package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +42 -0
  18. package/dist/{WasmUtilProvider-DtJuBdt-.esm.js → WasmUtilProvider-0xTxgP0R.esm.js} +114 -25
  19. package/dist/WorkerEncoderRecordingProvider-CsDED9UU.esm.js +80 -0
  20. package/dist/addressSearch-Rxm1K67A.esm.js +73 -0
  21. package/dist/{advanceableErrors-q_pfU3Cn.esm.js → advanceableErrors-CxZyPRyh.esm.js} +4 -2
  22. package/dist/ae-signature.d.ts +2 -2
  23. package/dist/ae-signature.esm.js +1 -1
  24. package/dist/antifraud.d.ts +1 -1
  25. package/dist/antifraud.esm.js +2 -2
  26. package/dist/{antifraudManager-DbGCvlJs.d.ts → antifraudManager-BxfCsyA7.d.ts} +3 -3
  27. package/dist/{antifraudManager-CaweCYnY.esm.js → antifraudManager-DKNOi9-z.esm.js} +5 -3
  28. package/dist/{antifraudStateMachine-DRl0UVyA.esm.js → antifraudStateMachine-BJ6PmCsw.esm.js} +3 -3
  29. package/dist/{api-Cz90EHyu.esm.js → api-CZpuJuZl.esm.js} +11 -6
  30. package/dist/{apiError-9Yi8xMeB.esm.js → apiError-DJHHF70K.esm.js} +1 -1
  31. package/dist/attemptCarry-BecGGZK8.esm.js +45 -0
  32. package/dist/authentication.d.ts +3 -3
  33. package/dist/authentication.esm.js +2 -2
  34. package/dist/{authenticationManager-BIZC55Bi.d.ts → authenticationManager-B0WPJjvz.d.ts} +2 -2
  35. package/dist/{authenticationManager-pKQS4fHT.esm.js → authenticationManager-CkjV81NT.esm.js} +7 -6
  36. package/dist/{authenticationStateMachine-D_DygKtQ.esm.js → authenticationStateMachine-BoPwxHAI.esm.js} +50 -18
  37. package/dist/avatar.d.ts +1 -1
  38. package/dist/backCameraLabel-yda5ugE4.esm.js +67 -0
  39. package/dist/{backCameraStream-CMvXj4X4.esm.js → backCameraStream-DS1oDiUq.esm.js} +12 -107
  40. package/dist/{callback-645_omgz.d.ts → callback-BmjJ1G-5.d.ts} +1 -1
  41. package/dist/{camera-sIa9ceW2.esm.js → camera-E_Kcre4O.esm.js} +15 -23
  42. package/dist/camera.d.ts +2 -2
  43. package/dist/camera.esm.js +1 -1
  44. package/dist/certificate-issuance.d.ts +1 -1
  45. package/dist/certificate-issuance.esm.js +2 -2
  46. package/dist/{certificateIssuanceManager-Dr8A4Lgr.d.ts → certificateIssuanceManager-BcYhxO63.d.ts} +4 -3
  47. package/dist/{certificateIssuanceManager-BfeMv2PU.esm.js → certificateIssuanceManager-DaUklfNj.esm.js} +5 -3
  48. package/dist/{certificateIssuanceStateMachine-Frgjbjw8.esm.js → certificateIssuanceStateMachine-_EQcjGE3.esm.js} +4 -4
  49. package/dist/cnpj-Bl_olpdX.esm.js +79 -0
  50. package/dist/connectivity-BCuEoQ-n.esm.js +114 -0
  51. package/dist/consent.d.ts +1 -1
  52. package/dist/consent.esm.js +2 -2
  53. package/dist/{consentManager-Ca8FHlC4.d.ts → consentManager-B2F_VeAo.d.ts} +13 -5
  54. package/dist/{consentManager-CvEu8h_W.esm.js → consentManager-BPocwpm2.esm.js} +7 -4
  55. package/dist/{consentStateMachine-DJTgN_-1.esm.js → consentStateMachine-DgiIcT9q.esm.js} +22 -9
  56. package/dist/cpf-DDXMTLYr.esm.js +37 -0
  57. package/dist/{createFaceAvatar-lYX0VTYs.d.ts → createFaceAvatar-BimBTONm.d.ts} +1 -1
  58. package/dist/cross-document-data-match.d.ts +1 -1
  59. package/dist/cross-document-data-match.esm.js +1 -1
  60. package/dist/{crossDocumentDataMatchManager-Cu141CE8.esm.js → crossDocumentDataMatchManager-BfA29Aji.esm.js} +6 -4
  61. package/dist/{crossDocumentDataMatchManager-yCWCOzcU.d.ts → crossDocumentDataMatchManager-crZcIUSY.d.ts} +3 -3
  62. package/dist/curp-DZGvefg3.esm.js +14 -0
  63. package/dist/curp-validation.d.ts +1 -1
  64. package/dist/curp-validation.esm.js +2 -2
  65. package/dist/{curpValidationManager-B-z9q5V3.esm.js → curpValidationManager-CbvBDoE1.esm.js} +6 -3
  66. package/dist/{curpValidationManager-C9sqoh9n.d.ts → curpValidationManager-Ci2iVuog.d.ts} +4 -4
  67. package/dist/{curpValidationStateMachine-vDEFLMPw.esm.js → curpValidationStateMachine-BQ8XK2Y3.esm.js} +30 -22
  68. package/dist/custom-fields.d.ts +1 -1
  69. package/dist/custom-fields.esm.js +1 -1
  70. package/dist/custom-watchlist.d.ts +1 -1
  71. package/dist/custom-watchlist.esm.js +2 -2
  72. package/dist/{customFieldsManager-D1ex2cFM.esm.js → customFieldsManager-BRqSCR9R.esm.js} +6 -4
  73. package/dist/{customFieldsManager-CF-cO8ap.d.ts → customFieldsManager-CdWTbsew.d.ts} +3 -3
  74. package/dist/{customWatchlistManager-CTI-SGk0.esm.js → customWatchlistManager-Bd1ooIDB.esm.js} +5 -3
  75. package/dist/{customWatchlistManager-DolUswyR.d.ts → customWatchlistManager-lJrveDS4.d.ts} +3 -3
  76. package/dist/{customWatchlistStateMachine-hmRd0f2I.esm.js → customWatchlistStateMachine-r8nGhyo1.esm.js} +3 -3
  77. package/dist/{deepsightService-C3DVBOZd.esm.js → deepsightLoader-ngnhyO6B.esm.js} +39 -69
  78. package/dist/definitionSource-Nw0YCbpe.esm.js +221 -0
  79. package/dist/{createCameraCycleOwnership-Dj_LHUvN.esm.js → desktopCameraElection-BKFjsQpO.esm.js} +178 -41
  80. package/dist/device.esm.js +2 -2
  81. package/dist/document-capture.d.ts +3 -3
  82. package/dist/document-capture.esm.js +2 -2
  83. package/dist/{documentCaptureManager-DUJwpKC5.esm.js → documentCaptureManager-BKaJVQxg.esm.js} +30 -20
  84. package/dist/{documentCaptureManager-DkyDtm3Y.d.ts → documentCaptureManager-BZBmcOKI.d.ts} +41 -7
  85. package/dist/{documentCaptureStateMachine-B8i7GnLh.esm.js → documentCaptureStateMachine-BYLb5Azk.esm.js} +107 -58
  86. package/dist/dynamic-forms.d.ts +2 -2
  87. package/dist/dynamic-forms.esm.js +2 -2
  88. package/dist/{dynamicFormsManager-C0dHs1ty.d.ts → dynamicFormsManager-C45pTncO.d.ts} +4 -4
  89. package/dist/{dynamicFormsManager-DK_oc5Oy.esm.js → dynamicFormsManager-CC3t8bqX.esm.js} +5 -3
  90. package/dist/{dynamicFormsStateMachine-CGlIAWZ6.esm.js → dynamicFormsStateMachine-Vsn6kszV.esm.js} +4 -4
  91. package/dist/ekyb.d.ts +5 -5
  92. package/dist/ekyb.esm.js +3 -3
  93. package/dist/{ekybManager-BaZ_7CEu.d.ts → ekybManager-BflWuTe4.d.ts} +5 -5
  94. package/dist/{ekybManager-BLgkiWXw.esm.js → ekybManager-DgNO6c0e.esm.js} +5 -3
  95. package/dist/{ekybStateMachine-BfgOUZMK.esm.js → ekybStateMachine-DHybwePr.esm.js} +40 -56
  96. package/dist/ekybUtils-Cw8Ta9Qi.esm.js +140 -0
  97. package/dist/ekyc-prefill.d.ts +17 -0
  98. package/dist/ekyc-prefill.esm.js +3 -0
  99. package/dist/ekyc.d.ts +4 -3
  100. package/dist/ekyc.esm.js +3 -3
  101. package/dist/{ekycManager-DW-ynodd.d.ts → ekycManager-BKVQazAb.d.ts} +49 -7
  102. package/dist/{ekycManager-BO-Lui3t.esm.js → ekycManager-nRT0rxei.esm.js} +39 -16
  103. package/dist/ekycPrefillManager-DOTl3Y2w.d.ts +566 -0
  104. package/dist/ekycPrefillManager-Drq_nYJ3.esm.js +103 -0
  105. package/dist/ekycPrefillStateMachine-CycO-K3B.esm.js +687 -0
  106. package/dist/ekycRules-DXP2hqVw.esm.js +479 -0
  107. package/dist/ekycStateMachine-nwJRel2s.esm.js +7897 -0
  108. package/dist/ekycUtils-FcqA6oU4.esm.js +1491 -0
  109. package/dist/electronic-signature.d.ts +1 -1
  110. package/dist/electronic-signature.esm.js +1 -1
  111. package/dist/{electronicSignatureManager-DTSLOvKR.d.ts → electronicSignatureManager-5tYz-a4o.d.ts} +4 -3
  112. package/dist/{electronicSignatureManager-CjKvJ6E-.esm.js → electronicSignatureManager-hn-_ADP5.esm.js} +8 -6
  113. package/dist/email.d.ts +1 -1
  114. package/dist/email.esm.js +2 -2
  115. package/dist/{emailManager-ButFktRm.esm.js → emailManager-Co4jarT1.esm.js} +5 -3
  116. package/dist/{emailManager-Dy6omJVp.d.ts → emailManager-pM7ZPuMa.d.ts} +3 -3
  117. package/dist/{emailStateMachine-BXtlC0NV.esm.js → emailStateMachine-CTEaYncs.esm.js} +34 -22
  118. package/dist/events-CP3yOzAl.esm.js +299 -0
  119. package/dist/events.d.ts +3 -1
  120. package/dist/events.esm.js +2 -1
  121. package/dist/extensibility.d.ts +43 -41
  122. package/dist/extensibility.esm.js +39 -37
  123. package/dist/{externalFetch-DrR9xshk.esm.js → externalFetch-CQY41QT1.esm.js} +4 -1
  124. package/dist/face-match.d.ts +1 -1
  125. package/dist/face-match.esm.js +2 -2
  126. package/dist/{faceCaptureManagerFactory-BDGhg24q.esm.js → faceCaptureManagerFactory-B2POCGth.esm.js} +17 -6
  127. package/dist/{faceCaptureManagerFactory-1hzeS_rB.d.ts → faceCaptureManagerFactory-BZjGT392.d.ts} +84 -72
  128. package/dist/{faceCaptureSetup-CvGYG4GZ.esm.js → faceCaptureSetup-DCBK1osx.esm.js} +117 -482
  129. package/dist/{faceMatchManager-DIgG-UFS.d.ts → faceMatchManager-C5b5WtcY.d.ts} +23 -7
  130. package/dist/{faceMatchManager-DWFUQjMQ.esm.js → faceMatchManager-CGmNGbov.esm.js} +5 -3
  131. package/dist/{faceMatchStateMachine-CUCvlydD.esm.js → faceMatchStateMachine-BuHt7kec.esm.js} +68 -29
  132. package/dist/{feature-management-D4ne_hXW.esm.js → feature-management-BFfuXr1M.esm.js} +35 -21
  133. package/dist/feature-management.esm.js +1 -1
  134. package/dist/field-comparison.d.ts +1 -1
  135. package/dist/field-comparison.esm.js +1 -1
  136. package/dist/{fieldComparisonManager-v3knTYV_.esm.js → fieldComparisonManager-VgCU4X96.esm.js} +6 -4
  137. package/dist/{fieldComparisonManager-CUX4gza2.d.ts → fieldComparisonManager-mFOHRhVd.d.ts} +3 -3
  138. package/dist/fiscal-qr.d.ts +1 -1
  139. package/dist/fiscal-qr.esm.js +1 -1
  140. package/dist/{fiscalQrManager-Dt9fHG7h.esm.js → fiscalQrManager-D4G-4xKE.esm.js} +9 -7
  141. package/dist/{fiscalQrManager-D0Iy7EKR.d.ts → fiscalQrManager-DFnFVpP9.d.ts} +3 -3
  142. package/dist/flow-events.d.ts +1 -1
  143. package/dist/flow.d.ts +75 -24
  144. package/dist/flow.esm.js +288 -70
  145. package/dist/{flowCompletionService-Cemwaa5b.esm.js → flowCompletionService-Crry_GxY.esm.js} +24 -3
  146. package/dist/{flowServices-X6Rwf_7E.esm.js → flowServices-Cj8SQjQT.esm.js} +447 -183
  147. package/dist/geolocation.d.ts +1 -1
  148. package/dist/geolocation.esm.js +2 -2
  149. package/dist/{geolocationManager-Dn24g1fl.d.ts → geolocationManager-CENrvxpK.d.ts} +19 -20
  150. package/dist/{geolocationManager-B0dc5rW9.esm.js → geolocationManager-qpTiVlc6.esm.js} +9 -9
  151. package/dist/{geolocationStateMachine-B3rcoODF.esm.js → geolocationStateMachine-Dk10UW9G.esm.js} +14 -10
  152. package/dist/{getDeviceClass-bsWdEDxP.esm.js → getDeviceClass-DoIWuKI8.esm.js} +1 -1
  153. package/dist/government-validation.d.ts +1 -1
  154. package/dist/government-validation.esm.js +2 -2
  155. package/dist/{governmentValidationManager-BtXWHICu.esm.js → governmentValidationManager-6JQQkzha.esm.js} +5 -3
  156. package/dist/{governmentValidationManager-B82zOut8.d.ts → governmentValidationManager-De_vU7bm.d.ts} +4 -4
  157. package/dist/{governmentValidationStateMachine-COL-Vs48.esm.js → governmentValidationStateMachine-wBunpfQ9.esm.js} +3 -3
  158. package/dist/home.d.ts +4 -3
  159. package/dist/home.esm.js +4 -2
  160. package/dist/http.esm.js +1 -1
  161. package/dist/id-ocr.d.ts +2 -2
  162. package/dist/id-ocr.esm.js +3 -19
  163. package/dist/id-selfie-flow.d.ts +6 -5
  164. package/dist/id-selfie-flow.esm.js +14 -12
  165. package/dist/id-verification.d.ts +1 -1
  166. package/dist/id-verification.esm.js +2 -2
  167. package/dist/id.d.ts +4 -17
  168. package/dist/id.esm.js +4 -4
  169. package/dist/{idCaptureDefaults-BGsG2OAs.esm.js → idCaptureDefaults-Drh207VJ.esm.js} +3 -3
  170. package/dist/{idCaptureManager-0M02hSuC.d.ts → idCaptureManager-C4Xk02cS.d.ts} +76 -12
  171. package/dist/{idCaptureManager-IouAnrFm.esm.js → idCaptureManager-RrDMn2tS.esm.js} +68 -19
  172. package/dist/{idCaptureServices-VTKIPSpT.esm.js → idCaptureServices-BqDlOnzD.esm.js} +29 -198
  173. package/dist/{idCaptureStateMachine-_Pn2Xkpb.esm.js → idCaptureStateMachine-DFa1GOap.esm.js} +962 -554
  174. package/dist/idOcrCpfUtils-D5Gwskxu.esm.js +18 -0
  175. package/dist/{idOcrManager-DT3kPIB3.d.ts → idOcrManager-C0C7lFGd.d.ts} +7 -6
  176. package/dist/{idOcrManager-D3-HNMXP.esm.js → idOcrManager-im7VfJQi.esm.js} +5 -3
  177. package/dist/{idOcrStateMachine-DyENX6Ki.esm.js → idOcrStateMachine-B832arAl.esm.js} +11 -10
  178. package/dist/{idVerificationManager-BJapZfpy.d.ts → idVerificationManager-B6R8xNZq.d.ts} +4 -3
  179. package/dist/{idVerificationManager-iWz7Avkr.esm.js → idVerificationManager-PMGM4hXY.esm.js} +5 -3
  180. package/dist/{idVerificationStateMachine-CL1kUdBe.esm.js → idVerificationStateMachine-DeeugC00.esm.js} +3 -3
  181. package/dist/identity-reuse.d.ts +2 -2
  182. package/dist/identity-reuse.esm.js +2 -2
  183. package/dist/identity-search.d.ts +97 -0
  184. package/dist/identity-search.esm.js +97 -0
  185. package/dist/{identityReuseManager-ooAbp6Kc.d.ts → identityReuseManager-CZ-qJ_Aa.d.ts} +82 -15
  186. package/dist/{identityReuseManager-CD1ucp1d.esm.js → identityReuseManager-CjFZ7WRa.esm.js} +9 -4
  187. package/dist/{identityReuseStateMachine-DfV81wQC.esm.js → identityReuseStateMachine-CLFjPp13.esm.js} +22 -25
  188. package/dist/index-DHuAkTe0.d.ts +1 -0
  189. package/dist/{index-CKQ9QBZP.d.ts → index-DxYNO94y.d.ts} +2 -2
  190. package/dist/index.d.ts +1 -1
  191. package/dist/index.esm.js +1 -1
  192. package/dist/{invokeOnCaptureCallback-DYrkOXO6.esm.js → invokeOnCaptureCallback-lXP41N7b.esm.js} +1 -1
  193. package/dist/kyb-checks.d.ts +3 -0
  194. package/dist/kyb-checks.esm.js +3 -0
  195. package/dist/kybChecksManager-B7Di9auB.d.ts +95 -0
  196. package/dist/kybChecksManager-CcEXyOlg.esm.js +90 -0
  197. package/dist/kybChecksStateMachine-DEKqDA2G.esm.js +720 -0
  198. package/dist/mandatory-consent.d.ts +2 -2
  199. package/dist/mandatory-consent.esm.js +2 -2
  200. package/dist/{mandatoryConsentManager-qYojnZYg.d.ts → mandatoryConsentManager-Bh1asNJh.d.ts} +28 -11
  201. package/dist/{mandatoryConsentManager-Cwqx1nK7.esm.js → mandatoryConsentManager-Dh3pBhOe.esm.js} +7 -4
  202. package/dist/{mandatoryConsentStateMachine-pXWqAHo_.esm.js → mandatoryConsentStateMachine-BjuI72HZ.esm.js} +32 -13
  203. package/dist/mediaRecorderOptions-g1TwTlhd.esm.js +87 -0
  204. package/dist/multipartRecordingService-WgK8ieRI.esm.js +407 -0
  205. package/dist/{permissionGuards-gcy3U0SL.esm.js → permissionGuards-pcrrqrPR.esm.js} +1 -1
  206. package/dist/{permissionServices-Ca-tSNhT.esm.js → permissionServices-DFJlH7K3.esm.js} +11 -9
  207. package/dist/phone-number.d.ts +7 -1
  208. package/dist/phone-number.esm.js +15 -2
  209. package/dist/phone.d.ts +1 -1
  210. package/dist/phone.esm.js +2 -2
  211. package/dist/phoneFormat-C3q0Ukh4.esm.js +27 -0
  212. package/dist/{phoneManager-BO-LTih5.d.ts → phoneManager-VO1HEoUZ.d.ts} +8 -3
  213. package/dist/{phoneManager-KKUq-Vgo.esm.js → phoneManager-rA7updqF.esm.js} +6 -4
  214. package/dist/phoneServices-CFXcwCFr.esm.js +77 -0
  215. package/dist/{phoneStateMachine-D2QWS2cu.esm.js → phoneStateMachine-DKdY2Scx.esm.js} +56 -84
  216. package/dist/{phoneValidation-DnBcNUNh.esm.js → phoneValidation-OggtfjRt.esm.js} +1 -2
  217. package/dist/{platform-DkcRc9JV.esm.js → platform-aPh7gTWh.esm.js} +15 -1
  218. package/dist/processFaceMatch-B_DkDTE5.esm.js +21 -0
  219. package/dist/qe-signature.d.ts +2 -2
  220. package/dist/qe-signature.esm.js +1 -1
  221. package/dist/recordingService-DxiwS8TV.esm.js +397 -0
  222. package/dist/redirect-to-mobile.d.ts +2 -2
  223. package/dist/redirect-to-mobile.esm.js +2 -2
  224. package/dist/{redirectToMobileManager-uHW3dyuQ.esm.js → redirectToMobileManager-DjsEtWLq.esm.js} +9 -6
  225. package/dist/{redirectToMobileManager-CVsvpVbQ.d.ts → redirectToMobileManager-pT6FiPE7.d.ts} +6 -4
  226. package/dist/{redirectToMobileStateMachine-b-H-ipGM.esm.js → redirectToMobileStateMachine-CMjjUXSu.esm.js} +67 -28
  227. package/dist/resolveForm-DaaQSVWp.esm.js +146 -0
  228. package/dist/{runChildModule-DSpP41Hl.esm.js → runChildModule-CJzb91Cf.esm.js} +9 -7
  229. package/dist/{sdkVersion-DKHwWEyH.esm.js → sdkVersion-k-QlBWlU.esm.js} +1 -1
  230. package/dist/selfie.d.ts +4 -4
  231. package/dist/selfie.esm.js +13 -12
  232. package/dist/{selfieErrorUtils-DoN1KFSQ.esm.js → selfieErrorUtils-F449y_PI.esm.js} +1 -1
  233. package/dist/{selfieManager-DtQegA6T.esm.js → selfieManager-Ba2YqjfY.esm.js} +7 -6
  234. package/dist/{selfieManager-BJdNu_nd.d.ts → selfieManager-aPdwxSFt.d.ts} +2 -2
  235. package/dist/{selfieStateMachine-CnCwJZuC.esm.js → selfieStateMachine-CTjb-Qr4.esm.js} +5 -5
  236. package/dist/{session-CNUfjlRc.esm.js → session-DPL5QWRx.esm.js} +77 -9
  237. package/dist/session.d.ts +96 -10
  238. package/dist/session.esm.js +7 -6
  239. package/dist/{sessionInitializer-JM_glXR2.esm.js → sessionInitializer-43LQITNU.esm.js} +359 -115
  240. package/dist/{setup-YPKTUCY5.d.ts → setup-DpOr8H_l.d.ts} +2 -2
  241. package/dist/{setup-C5tfWt6W.esm.js → setup-lcBOfaNE.esm.js} +36 -27
  242. package/dist/signature.d.ts +1 -1
  243. package/dist/signature.esm.js +2 -2
  244. package/dist/{signatureManager-f_dPAGXn.esm.js → signatureManager-BgAja97K.esm.js} +5 -3
  245. package/dist/{signatureManager-BpVt_Jv7.d.ts → signatureManager-daT_8fj_.d.ts} +3 -3
  246. package/dist/{signatureStateMachine-C-nUq_oq.esm.js → signatureStateMachine-CVPmvU2p.esm.js} +3 -3
  247. package/dist/{spawn-D9jgw9pW.d.ts → spawn-COZKetCS.d.ts} +1 -1
  248. package/dist/{stats-BEvexnKC.esm.js → stats-DoByUnTa.esm.js} +1 -1
  249. package/dist/stats.esm.js +1 -1
  250. package/dist/textRules-D4NRinKY.d.ts +41 -0
  251. package/dist/{trueSightService-fLmL_cyg.esm.js → trueSightService-Bs6xqUXD.esm.js} +22 -10
  252. package/dist/trust-graph.d.ts +4 -3
  253. package/dist/trust-graph.esm.js +5 -3
  254. package/dist/{types-yPH8lAH-.d.ts → types-9wlf1-GE.d.ts} +3 -3
  255. package/dist/types-B-PIc0en.d.ts +115 -0
  256. package/dist/types-B9C8W01q.d.ts +34 -0
  257. package/dist/{types-0L-eFDmr.d.ts → types-BgRHw-dR.d.ts} +1 -1
  258. package/dist/{types-CJ7Yl9K-.d.ts → types-Bpo97EOh.d.ts} +4 -2
  259. package/dist/{types-BQA7lRDV.d.ts → types-C3rfDzgE.d.ts} +4 -2
  260. package/dist/types-CE1jkHw3.d.ts +6 -0
  261. package/dist/types-CTaL0XJz.d.ts +80 -0
  262. package/dist/{types-DUnFZ08M.d.ts → types-CyNndVAT.d.ts} +16 -8
  263. package/dist/types-DEa3taWc.d.ts +217 -0
  264. package/dist/{types-CK8Jbjkp.d.ts → types-DFP7eSle.d.ts} +1 -1
  265. package/dist/{types-Ckir_BEs.d.ts → types-DJPU3W2M.d.ts} +3 -2
  266. package/dist/{types-DPIDuhut.d.ts → types-DNVzoRvi.d.ts} +2 -1
  267. package/dist/{events-Du2A4-Qr.esm.js → types-DYYMdAGv.esm.js} +4 -299
  268. package/dist/{types-B6HsSzpk.d.ts → types-Ddc4Tr_f.d.ts} +42 -6
  269. package/dist/{types-BAxn7MpY.d.ts → types-YA7ieDOx.d.ts} +125 -50
  270. package/dist/{urlUtils-6jsE6rKp.esm.js → urlUtils-eYiyWjh0.esm.js} +4 -1
  271. package/dist/usStates-CwOQ2kAx.esm.js +209 -0
  272. package/dist/video-selfie.d.ts +16 -14
  273. package/dist/video-selfie.esm.js +100 -24
  274. package/dist/{videoSelfieCameraWarmer-BBNKiau1.esm.js → videoSelfieCameraWarmer-a7GBfmEZ.esm.js} +27 -28
  275. package/dist/{videoSelfieFlowModuleMachine-BCFVHBQ1.esm.js → videoSelfieFlowModuleMachine-IWdxw1TW.esm.js} +1 -1
  276. package/dist/{videoSelfieStepDetector-CGsTltqB.d.ts → videoSelfieStepDetector-DRrh4P0A.d.ts} +10 -5
  277. package/dist/virtualCameraCheck-eFOm2C9q.esm.js +27 -0
  278. package/dist/{warmup-BO57syF6.d.ts → warmup-BNhIuURi.d.ts} +18 -2
  279. package/dist/{warmup-BElYWRh7.esm.js → warmup-BZOMg303.esm.js} +243 -30
  280. package/dist/wasm.d.ts +9 -3
  281. package/dist/wasm.esm.js +3 -3
  282. package/dist/{wasmDsFlagSync-CYj5LL9z.esm.js → wasmDsFlagSync-DPK7qGgo.esm.js} +1 -1
  283. package/dist/wasmMetadataVersionSync-U8EFUr1T.esm.js +27 -0
  284. package/dist/{wasmWebClient-BjZw_7OB.esm.js → wasmWebClient-CyLCM31e.esm.js} +45 -26
  285. package/dist/watchlist-for-business.d.ts +2 -1
  286. package/dist/watchlist-for-business.esm.js +2 -2
  287. package/dist/watchlist.d.ts +1 -1
  288. package/dist/watchlist.esm.js +2 -2
  289. package/dist/{watchlistForBusinessManager-CZZOFkGl.esm.js → watchlistForBusinessManager-BH6M4kqA.esm.js} +40 -8
  290. package/dist/{watchlistForBusinessManager-B3GDPZrr.d.ts → watchlistForBusinessManager-l7ZERQcV.d.ts} +57 -21
  291. package/dist/watchlistForBusinessStateMachine-BMWm5mcP.esm.js +166 -0
  292. package/dist/{watchlistManager-DXtX94SN.esm.js → watchlistManager-BDaVjzLW.esm.js} +5 -3
  293. package/dist/{watchlistManager-DJQOd8Pw.d.ts → watchlistManager-DQq4GxBO.d.ts} +3 -3
  294. package/dist/{watchlistStateMachine-McALifag.esm.js → watchlistStateMachine-Cx-6QAvu.esm.js} +3 -3
  295. package/dist/workflow.d.ts +234 -45
  296. package/dist/workflow.esm.js +194 -80
  297. package/dist/{xstate-actors.esm-8Gzepa_A.esm.js → xstate-actors.esm-BCcwgosu.esm.js} +1 -1
  298. package/dist/xstate.cjs-D6Ur0X1F.d.ts +7 -0
  299. package/dist/{xstate.esm-DSajW7CJ.esm.js → xstate.esm-CIqUf_i6.esm.js} +1 -125
  300. package/package.json +24 -7
  301. package/dist/Actor-DpTj5PFb.d.ts +0 -1
  302. package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +0 -9
  303. package/dist/addressSearch-DPjIKJrX.esm.js +0 -563
  304. package/dist/cpf-uAZTPUBy.esm.js +0 -61
  305. package/dist/deepsightLoader-sH7920zw.esm.js +0 -55
  306. package/dist/ekycStateMachine-CDnI_NRq.esm.js +0 -1443
  307. package/dist/ekycUtils-zY8CdKJL.esm.js +0 -300
  308. package/dist/index-DpTj5PFb.d.ts +0 -1
  309. package/dist/types-BvLo3U4u.d.ts +0 -134
  310. package/dist/types-zOgZqMni.d.ts +0 -6
  311. package/dist/watchlistForBusinessStateMachine-B66E7jud.esm.js +0 -78
  312. /package/dist/{types-BSBzhHRH2.d.ts → types-BSBzhHRH.d.ts} +0 -0
@@ -0,0 +1,720 @@
1
+ import { t as api, u as endpoints } from "./api-CZpuJuZl.esm.js";
2
+ import { i as toIncodeApiError, t as IncodeApiError } from "./apiError-DJHHF70K.esm.js";
3
+ import { n as loadPhoneValidation } from "./phoneValidation-OggtfjRt.esm.js";
4
+ import { i as assign, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
5
+ import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
6
+ import { t as usStateOptions } from "./usStates-CwOQ2kAx.esm.js";
7
+ import { n as checkSupport, r as DYNAMIC_REQUIRED_KEY, t as resolveForm } from "./resolveForm-DaaQSVWp.esm.js";
8
+ import { n as hasAllowedCharacters, t as formatPhoneE164 } from "./phoneFormat-C3q0Ukh4.esm.js";
9
+ function isSupportedSchema(form) {
10
+ return String(form.schemaVersion).split(".")[0] === "1";
11
+ }
12
+ /** Every field of the form, in display order. */
13
+ function formFields(form) {
14
+ if (!form) return [];
15
+ return form.steps.flatMap((step) => step.sections.flatMap((section) => section.fields));
16
+ }
17
+ function findField(form, name) {
18
+ return formFields(form).find((field) => field.name === name);
19
+ }
20
+ /** Blank text, or a list with no non-blank entry. */
21
+ function isBlank(value) {
22
+ if (Array.isArray(value)) return value.every((v) => v.trim() === "");
23
+ return value === void 0 || value.trim() === "";
24
+ }
25
+ //#endregion
26
+ //#region src/modules/kyb-checks/kybChecksDefinition.ts
27
+ const KYB_CHECKS_MODULE = "kybChecks";
28
+ /** Served field name → vocabulary group. Every group is on: the backend already chose the fields. */
29
+ const GROUPS = {
30
+ country: "country",
31
+ taxId: "taxId",
32
+ businessName: "businessName",
33
+ alternativeNames: "alternativeNames",
34
+ street: "address",
35
+ city: "address",
36
+ state: "address",
37
+ postalCode: "address",
38
+ website: "website",
39
+ phoneNumber: "phone",
40
+ email: "email",
41
+ personNames: "personNames"
42
+ };
43
+ /** The group of a served field name this build has no group for. */
44
+ const OTHER_GROUP = "other";
45
+ /** Served field type → vocabulary kind. Any other type renders as text. */
46
+ const KINDS = {
47
+ text: "text",
48
+ select: "choice",
49
+ phone: "phone",
50
+ list: "list"
51
+ };
52
+ const KEYBOARDS = /* @__PURE__ */ new Set(["url", "email"]);
53
+ const TRANSFORMS = /* @__PURE__ */ new Set(["trim", "e164"]);
54
+ const KYB_CHECKS_SUPPORTED_IDS = {
55
+ schemaVersions: [1],
56
+ vocabulary: "1.3",
57
+ kinds: new Set(Object.values(KINDS)),
58
+ groups: /* @__PURE__ */ new Set([...Object.values(GROUPS), OTHER_GROUP]),
59
+ rules: /* @__PURE__ */ new Set(["allowedCharacters"]),
60
+ transforms: TRANSFORMS,
61
+ groupRules: /* @__PURE__ */ new Set(["oneOfRequired"]),
62
+ optionLists: /* @__PURE__ */ new Set(["US_STATES"]),
63
+ conditions: /* @__PURE__ */ new Set(),
64
+ prefillSources: /* @__PURE__ */ new Set(),
65
+ flags: /* @__PURE__ */ new Set(["payload.omitWhenEmpty"])
66
+ };
67
+ /** A served regex of the one shape `allowedCharacters` can express: `^[…]{1,n}$` or `^[…]+$`. */
68
+ const CHARACTER_CLASS_REGEX = /^\^\[([^\]]+)\](?:\{[01],(\d+)\}|\+)\$$/;
69
+ /**
70
+ * Reads a served pattern as `allowedCharacters` (ASCII letters) plus a maximum
71
+ * length. Returns `undefined` for any other regex, which the adapter leaves
72
+ * out.
73
+ */
74
+ function toCharacterPattern(regex, flags = "") {
75
+ const match = regex ? CHARACTER_CLASS_REGEX.exec(regex) : null;
76
+ if (!match || flags !== "" && flags !== "i") return void 0;
77
+ const [, body, max] = match;
78
+ let upper = false;
79
+ let lower = false;
80
+ let digit = false;
81
+ let space = false;
82
+ let extra = "";
83
+ for (let i = 0; i < body.length; i++) {
84
+ const range = body.slice(i, i + 3);
85
+ if (range === "A-Z" || range === "a-z" || range === "0-9") {
86
+ if (range === "A-Z") upper = true;
87
+ if (range === "a-z") lower = true;
88
+ if (range === "0-9") digit = true;
89
+ i += 2;
90
+ } else if (body[i] === "\\" && i + 1 < body.length) {
91
+ const escaped = body[++i];
92
+ if (escaped === "d") digit = true;
93
+ else if (/[A-Za-z]/.test(escaped)) return void 0;
94
+ else extra += escaped;
95
+ } else if (body[i] === "-" && i > 0 && i < body.length - 1) return;
96
+ else if (body[i] === " ") space = true;
97
+ else extra += body[i];
98
+ }
99
+ const letter = upper && lower || flags === "i" && (upper || lower);
100
+ if ((upper || lower) && !letter) return void 0;
101
+ const classes = [];
102
+ if (letter) classes.push("letter");
103
+ if (digit) classes.push("digit");
104
+ if (space) classes.push("space");
105
+ return {
106
+ classes,
107
+ extra,
108
+ max: max ? Number(max) : void 0
109
+ };
110
+ }
111
+ const toFormText = ({ key, text }) => ({
112
+ key,
113
+ text
114
+ });
115
+ function toField(field, section, country) {
116
+ const options = field.options?.map((option) => ({
117
+ value: option.value,
118
+ label: toFormText(option.label)
119
+ }));
120
+ let kind = KINDS[field.type] ?? "text";
121
+ if (kind === "choice" && !options?.length) kind = "text";
122
+ const rules = [];
123
+ let maxLength;
124
+ for (const rule of field.rules) {
125
+ if (rule.kind !== "pattern" || kind === "phone") continue;
126
+ const pattern = toCharacterPattern(rule.regex, rule.flags);
127
+ if (!pattern) continue;
128
+ rules.push({
129
+ id: "allowedCharacters",
130
+ params: {
131
+ classes: pattern.classes,
132
+ extra: pattern.extra,
133
+ ascii: true
134
+ },
135
+ message: toFormText(rule.message)
136
+ });
137
+ if (pattern.max !== void 0) maxLength = Math.min(maxLength ?? pattern.max, pattern.max);
138
+ }
139
+ const keyboard = field.input?.keyboard;
140
+ const input = {
141
+ ...maxLength !== void 0 && { maxLength },
142
+ ...keyboard && KEYBOARDS.has(keyboard) && { keyboard }
143
+ };
144
+ const usStates = kind === "choice" && field.name === "state" && country === "US";
145
+ return {
146
+ name: field.name,
147
+ kind,
148
+ group: GROUPS[field.name] ?? OTHER_GROUP,
149
+ section,
150
+ required: field.required,
151
+ label: toFormText(field.label),
152
+ ...Object.keys(input).length > 0 && { input },
153
+ ...kind === "choice" && (usStates ? { optionsRef: "US_STATES" } : { options }),
154
+ ...kind === "phone" && { phone: {
155
+ lockCountry: !field.phone?.allowCountryChange,
156
+ defaultCountry: "definition"
157
+ } },
158
+ ...rules.length > 0 && { rules },
159
+ payload: {
160
+ key: field.payload.key,
161
+ transforms: field.payload.transforms.filter((id) => TRANSFORMS.has(id)).map((id) => ({ id })),
162
+ omitWhenEmpty: field.payload.omitWhenEmpty
163
+ }
164
+ };
165
+ }
166
+ function toGroupRules(form, names) {
167
+ return [...form.rules, ...formFields(form).flatMap((field) => field.rules)].flatMap((rule) => {
168
+ const fields = (rule.fields ?? []).filter((name) => names.has(name));
169
+ if (rule.kind !== "requireAnyOf" || fields.length === 0) return [];
170
+ return [{
171
+ id: "oneOfRequired",
172
+ fields,
173
+ message: toFormText(rule.message)
174
+ }];
175
+ });
176
+ }
177
+ /**
178
+ * The served form as a form definition, plus what the definition has no slot
179
+ * for. Steps are flattened: the backend always sends one.
180
+ */
181
+ function toKybChecksDefinition(form) {
182
+ const country = form.context.country;
183
+ const sections = [];
184
+ const fields = [];
185
+ const layoutFields = {};
186
+ for (const step of form.steps) for (const section of step.sections) {
187
+ sections.push(section.title ? {
188
+ id: section.id,
189
+ title: toFormText(section.title)
190
+ } : { id: section.id });
191
+ for (const field of section.fields) {
192
+ fields.push(toField(field, section.id, country));
193
+ layoutFields[field.name] = {
194
+ value: field.value,
195
+ readonly: field.display !== "editable",
196
+ ...field.refetchOnChange && { refetchOnChange: field.refetchOnChange }
197
+ };
198
+ }
199
+ }
200
+ const groupRules = toGroupRules(form, new Set(fields.map((field) => field.name)));
201
+ return {
202
+ definition: {
203
+ schemaVersion: 1,
204
+ vocabulary: KYB_CHECKS_SUPPORTED_IDS.vocabulary,
205
+ id: `${KYB_CHECKS_MODULE}/${country ?? "country"}`,
206
+ module: KYB_CHECKS_MODULE,
207
+ ...country && { country },
208
+ sections,
209
+ fields,
210
+ ...groupRules.length > 0 && { groupRules },
211
+ submit: { static: form.submit?.static ?? {} }
212
+ },
213
+ layout: {
214
+ title: form.steps[0]?.title,
215
+ fields: layoutFields
216
+ }
217
+ };
218
+ }
219
+ //#endregion
220
+ //#region src/modules/kyb-checks/kybChecksFields.ts
221
+ const PHONE_FORMAT_ERROR = {
222
+ key: "kyb.errors.phoneNumberFormat",
223
+ text: "Enter a valid phone number"
224
+ };
225
+ const INVALID_CHARACTERS = {
226
+ key: "verification.errors.invalidCharacters",
227
+ text: "Use only the allowed characters"
228
+ };
229
+ const ALL_GROUPS_ON = Object.fromEntries([...KYB_CHECKS_SUPPORTED_IDS.groups].map((group) => [group, true]));
230
+ const TYPES = {
231
+ choice: "dropdown",
232
+ phone: "phone",
233
+ list: "list"
234
+ };
235
+ const toText = (text, fallback) => text ? {
236
+ key: text.key,
237
+ text: text.text ?? fallback.text
238
+ } : fallback;
239
+ const fromFormText = (text) => ({
240
+ key: text.key,
241
+ text: text.text ?? ""
242
+ });
243
+ function projectRules(rules, required, maxLength) {
244
+ const validation = required ? [{ type: "required" }] : [];
245
+ let lengthMessage;
246
+ for (const rule of rules ?? []) {
247
+ if (rule.id !== "allowedCharacters") continue;
248
+ const params = rule.params ?? {};
249
+ const message = toText(rule.message, INVALID_CHARACTERS);
250
+ validation.push({
251
+ type: "allowedCharacters",
252
+ classes: params.classes ?? [],
253
+ extra: typeof params.extra === "string" ? params.extra : "",
254
+ ascii: params.ascii === true,
255
+ message
256
+ });
257
+ lengthMessage ??= message;
258
+ }
259
+ if (maxLength !== void 0 && lengthMessage) validation.push({
260
+ type: "maxLength",
261
+ max: maxLength,
262
+ message: lengthMessage
263
+ });
264
+ return validation;
265
+ }
266
+ function projectField(resolved, layout, country) {
267
+ const { field, required, phoneLocked } = resolved;
268
+ const type = TYPES[field.kind] ?? "text";
269
+ const served = layout.fields[field.name];
270
+ const keyboard = field.input?.keyboard;
271
+ const maxLength = field.input?.maxLength;
272
+ const options = field.optionsRef === "US_STATES" ? usStateOptions.map((option) => ({ ...option })) : field.options?.map((option) => ({
273
+ value: option.value,
274
+ label: option.label.key,
275
+ labelText: option.label.text
276
+ }));
277
+ return {
278
+ name: field.name,
279
+ type,
280
+ label: field.label.key,
281
+ labelText: field.label.text ?? "",
282
+ required,
283
+ ...field.section && { section: field.section },
284
+ ...maxLength !== void 0 && { maxLength },
285
+ ...type === "dropdown" && { options },
286
+ ...(keyboard === "url" || keyboard === "email") && { inputType: keyboard },
287
+ ...type === "phone" && {
288
+ phoneCountry: country,
289
+ disableCountrySelector: phoneLocked
290
+ },
291
+ ...served?.readonly && { readonly: true },
292
+ ...served?.refetchOnChange && { refetchOnChange: served.refetchOnChange },
293
+ initialValue: served?.value ?? (type === "list" ? [] : ""),
294
+ validation: projectRules(field.rules, required, maxLength)
295
+ };
296
+ }
297
+ const preparedForms = /* @__PURE__ */ new WeakMap();
298
+ /**
299
+ * The served form on the forms kernel: translated to a definition, checked,
300
+ * resolved with every group on and projected. `undefined` when this build
301
+ * can't render it: a newer schema major, or an adapter output that fails
302
+ * `checkSupport`, which would be a bug in the adapter.
303
+ */
304
+ function prepareKybChecksForm(form) {
305
+ if (preparedForms.has(form)) return preparedForms.get(form) ?? void 0;
306
+ let prepared = null;
307
+ if (isSupportedSchema(form)) {
308
+ const { definition, layout } = toKybChecksDefinition(form);
309
+ const support = checkSupport(definition, KYB_CHECKS_SUPPORTED_IDS);
310
+ if (support.supported) {
311
+ const resolved = resolveForm(definition, { groups: ALL_GROUPS_ON });
312
+ const sections = (definition.sections ?? []).map((section) => ({
313
+ id: section.id,
314
+ ...section.title && { title: fromFormText(section.title) },
315
+ fields: resolved.fields.filter((field) => field.field.section === section.id).map((field) => projectField(field, layout, definition.country))
316
+ }));
317
+ const formRules = resolved.groupRules.map(({ rule, fields }) => ({
318
+ type: "oneOfRequired",
319
+ fields: [...fields],
320
+ message: fromFormText(rule.message ?? { key: rule.id })
321
+ }));
322
+ prepared = {
323
+ submit: toSubmitPlan(definition),
324
+ title: layout.title,
325
+ sections,
326
+ formRules
327
+ };
328
+ } else console.warn("[kyb-checks] Unsupported form definition", support.problems);
329
+ }
330
+ preparedForms.set(form, prepared);
331
+ return prepared ?? void 0;
332
+ }
333
+ function sectionFields(prepared) {
334
+ return prepared.sections.flatMap((section) => section.fields);
335
+ }
336
+ function canKeep(field, before, value) {
337
+ if (field.readonly) return false;
338
+ if (before && before.type !== field.type) return false;
339
+ if (Array.isArray(value) !== Array.isArray(field.initialValue)) return false;
340
+ if (field.type !== "dropdown" || value === "") return true;
341
+ return (field.options ?? []).some((option) => option.value === value);
342
+ }
343
+ /**
344
+ * Values for a newly fetched form. What the user entered carries over to the
345
+ * field of the same name only when that field is editable, has the same type
346
+ * and shape as before and, for a dropdown, still offers the value. A phone
347
+ * the input flagged as invalid stays flagged with it. Every other field
348
+ * starts from its served value.
349
+ */
350
+ function carryOverValues(prepared, before, previous, invalidFormats) {
351
+ const beforeFields = new Map((before ? sectionFields(before) : []).map((field) => [field.name, field]));
352
+ const values = {};
353
+ const stillInvalid = {};
354
+ for (const field of sectionFields(prepared)) {
355
+ const kept = previous[field.name];
356
+ if (kept !== void 0 && canKeep(field, beforeFields.get(field.name), kept)) {
357
+ values[field.name] = kept;
358
+ if (field.type === "phone" && invalidFormats[field.name]) stillInvalid[field.name] = true;
359
+ } else values[field.name] = field.initialValue;
360
+ }
361
+ return {
362
+ values,
363
+ invalidFormats: stillInvalid
364
+ };
365
+ }
366
+ function requiredMessage(field) {
367
+ return {
368
+ key: DYNAMIC_REQUIRED_KEY,
369
+ text: `${field.labelText} is required`,
370
+ params: { fieldName: {
371
+ key: field.label,
372
+ text: field.labelText
373
+ } }
374
+ };
375
+ }
376
+ function failsRule(rule, value) {
377
+ if (rule.type === "required") return isBlank(value);
378
+ const entries = (Array.isArray(value) ? value : [value]).map((entry) => entry.trim()).filter((entry) => entry !== "");
379
+ if (rule.type === "maxLength") return entries.some((entry) => entry.length > rule.max);
380
+ return entries.some((entry) => !hasAllowedCharacters(entry, rule.classes, rule.extra, rule.ascii));
381
+ }
382
+ /** The first failing rule's message for a field, in rule order. */
383
+ function validateField(field, values, invalidFormats = {}) {
384
+ const value = values[field.name] ?? field.initialValue;
385
+ for (const rule of field.validation) if (failsRule(rule, value)) return rule.type === "required" ? requiredMessage(field) : rule.message;
386
+ if (invalidFormats[field.name] && !isBlank(value)) return PHONE_FORMAT_ERROR;
387
+ }
388
+ /**
389
+ * Errors for the whole form. A form-level rule is shown on the first field it
390
+ * names, unless that field already has an error.
391
+ */
392
+ function validateForm(prepared, values, invalidFormats = {}) {
393
+ const errors = {};
394
+ for (const field of sectionFields(prepared)) {
395
+ const error = validateField(field, values, invalidFormats);
396
+ if (error) errors[field.name] = error;
397
+ }
398
+ for (const rule of prepared.formRules) {
399
+ const [target] = rule.fields;
400
+ const allBlank = rule.fields.every((name) => isBlank(values[name]));
401
+ if (target && !errors[target] && allBlank) errors[target] = rule.message;
402
+ }
403
+ return errors;
404
+ }
405
+ function applyTransforms(value, transforms, country) {
406
+ let current = value;
407
+ for (const transform of transforms) if (transform === "trim") current = Array.isArray(current) ? current.map((entry) => entry.trim()) : current.trim();
408
+ else if (transform === "e164" && typeof current === "string") current = current ? formatPhoneE164(current, country ?? "") : current;
409
+ return current;
410
+ }
411
+ /**
412
+ * The request body the definition describes, in the module's own terms.
413
+ * `submit.static` wins over a field with the same key: the backend sends the
414
+ * country both ways, with the same value. The catalog compiler rejects two
415
+ * fields writing one key, but a served form is never compiled, so a later
416
+ * field whose key an earlier field already writes is left out, with a warning.
417
+ */
418
+ function toSubmitPlan(definition) {
419
+ const staticKeys = new Set(Object.keys(definition.submit.static ?? {}));
420
+ const claimed = /* @__PURE__ */ new Set();
421
+ const fields = [];
422
+ for (const field of definition.fields) {
423
+ if (field.payload?.omit) continue;
424
+ const key = field.payload?.key ?? field.name;
425
+ if (staticKeys.has(key)) continue;
426
+ if (claimed.has(key)) {
427
+ console.warn(`[kyb-checks] Not sending field "${field.name}": request key "${key}" is already written`);
428
+ continue;
429
+ }
430
+ claimed.add(key);
431
+ fields.push({
432
+ name: field.name,
433
+ key,
434
+ transforms: (field.payload?.transforms ?? []).map((t) => t.id),
435
+ omitWhenEmpty: field.payload?.omitWhenEmpty === true,
436
+ isList: field.kind === "list"
437
+ });
438
+ }
439
+ return {
440
+ static: { ...definition.submit.static },
441
+ country: definition.country,
442
+ fields
443
+ };
444
+ }
445
+ /**
446
+ * The `POST /omni/kyb` body: `submit.static`, then each field's value under
447
+ * its request key after its transforms. List fields drop blank entries, and
448
+ * a field marked `omitWhenEmpty` is left out when it's empty.
449
+ */
450
+ function buildSubmitBody(submit, values) {
451
+ const body = { ...submit.static };
452
+ for (const field of submit.fields) {
453
+ let value = applyTransforms(values[field.name] ?? (field.isList ? [] : ""), field.transforms, submit.country);
454
+ if (Array.isArray(value)) value = value.filter((entry) => entry.trim() !== "");
455
+ if (field.omitWhenEmpty && isBlank(value)) continue;
456
+ body[field.key] = value;
457
+ }
458
+ return body;
459
+ }
460
+ //#endregion
461
+ //#region src/modules/kyb-checks/kybChecksServices.ts
462
+ /**
463
+ * Fetches the KYB form for the session. Without `country` it holds only the
464
+ * country picker; with it, the fields that country needs and a `submit` block.
465
+ */
466
+ async function fetchKybForm(country, signal) {
467
+ try {
468
+ const res = await api.get(endpoints.kybForm, {
469
+ query: { country },
470
+ signal
471
+ });
472
+ if (!res.ok) throw res;
473
+ return res.data;
474
+ } catch (error) {
475
+ throw toIncodeApiError(endpoints.kybForm, error);
476
+ }
477
+ }
478
+ /**
479
+ * Runs the KYB checks. Always posts to `endpoints.kybSubmit`: the form's
480
+ * `submit.endpoint` and `submit.method` are not followed.
481
+ */
482
+ async function submitKyb(body, signal) {
483
+ try {
484
+ const res = await api.post(endpoints.kybSubmit, body, { signal });
485
+ if (!res.ok) throw res;
486
+ return res.data;
487
+ } catch (error) {
488
+ throw toIncodeApiError(endpoints.kybSubmit, error);
489
+ }
490
+ }
491
+ //#endregion
492
+ //#region src/modules/kyb-checks/kybChecksStateMachine.ts
493
+ /** The only `refetchOnChange` query parameter `GET /omni/kyb/form` takes. */
494
+ const COUNTRY_PARAM = "country";
495
+ function isForbidden(error) {
496
+ return error instanceof IncodeApiError && error.httpStatus === 403;
497
+ }
498
+ /**
499
+ * A submit is retried only when the server answered with a 4xx: it rejected
500
+ * the request, so no check ran. After a timeout, a network failure or a 5xx
501
+ * the checks may already have run, and `POST /omni/kyb` has no duplicate
502
+ * guard, so a retry could run (and charge) them twice.
503
+ */
504
+ function canRetrySubmit(error) {
505
+ return error instanceof IncodeApiError && error.httpStatus >= 400 && error.httpStatus < 500;
506
+ }
507
+ function errorMessageOf(error) {
508
+ return error instanceof Error ? error.message : String(error);
509
+ }
510
+ const kybChecksMachine = setup({
511
+ types: {
512
+ context: {},
513
+ events: {},
514
+ input: {},
515
+ output: {}
516
+ },
517
+ actors: {
518
+ fetchForm: fromPromise(async ({ input, signal }) => fetchKybForm(input.country, signal)),
519
+ submit: fromPromise(async ({ input, signal }) => {
520
+ await loadPhoneValidation();
521
+ return submitKyb(buildSubmitBody(input.submit, input.values), signal);
522
+ })
523
+ },
524
+ actions: {
525
+ startPhoneValidationLoad: () => {
526
+ loadPhoneValidation();
527
+ },
528
+ applyForm: assign(({ context, event }) => {
529
+ const form = event.output;
530
+ const prepared = prepareKybChecksForm(form);
531
+ return {
532
+ form,
533
+ prepared,
534
+ ...carryOverValues(prepared, context.prepared, context.values, context.invalidFormats),
535
+ errors: {},
536
+ country: form.context.country ?? context.country
537
+ };
538
+ }),
539
+ setFieldValue: assign(({ context, event }) => {
540
+ const { name, value, isValid } = event;
541
+ const invalidFormats = { ...context.invalidFormats };
542
+ if (isValid === false) invalidFormats[name] = true;
543
+ else delete invalidFormats[name];
544
+ const errors = { ...context.errors };
545
+ delete errors[name];
546
+ return {
547
+ values: {
548
+ ...context.values,
549
+ [name]: value
550
+ },
551
+ errors,
552
+ invalidFormats
553
+ };
554
+ }),
555
+ setCountryFromEvent: assign(({ event }) => ({ country: String(event.value) })),
556
+ validateAll: assign(({ context }) => ({ errors: context.prepared ? validateForm(context.prepared, context.values, context.invalidFormats) : {} })),
557
+ setLoadError: assign(({ event }) => ({
558
+ errorKind: "load",
559
+ canRetry: true,
560
+ errorMessage: errorMessageOf(event.error)
561
+ })),
562
+ setSubmitError: assign(({ event }) => {
563
+ const { error } = event;
564
+ return {
565
+ errorKind: "submit",
566
+ canRetry: canRetrySubmit(error),
567
+ errorMessage: errorMessageOf(error)
568
+ };
569
+ }),
570
+ clearError: assign({
571
+ errorKind: void 0,
572
+ errorMessage: void 0,
573
+ canRetry: false
574
+ }),
575
+ setResult: assign(({ event }) => ({ result: { referenceId: event.output?.referenceId } }))
576
+ },
577
+ guards: {
578
+ isSupportedForm: ({ event }) => !!prepareKybChecksForm(event.output),
579
+ isForbidden: ({ event }) => isForbidden(event.error),
580
+ changesCountry: ({ context, event }) => {
581
+ const { name, value } = event;
582
+ return findField(context.form, name)?.refetchOnChange === COUNTRY_PARAM && typeof value === "string" && value !== "" && value !== context.country;
583
+ },
584
+ hasNoErrors: ({ context }) => Object.keys(context.errors).length === 0 && !!context.form?.submit,
585
+ failedLoadingFirstForm: ({ context }) => context.errorKind === "load" && context.form === void 0,
586
+ failedLoading: ({ context }) => context.errorKind === "load",
587
+ canRetry: ({ context }) => context.canRetry
588
+ }
589
+ }).createMachine({
590
+ id: "kybChecks",
591
+ initial: "idle",
592
+ context: ({ input }) => ({
593
+ config: input?.config ?? {},
594
+ form: void 0,
595
+ prepared: void 0,
596
+ values: {},
597
+ errors: {},
598
+ invalidFormats: {},
599
+ country: void 0,
600
+ errorKind: void 0,
601
+ errorMessage: void 0,
602
+ canRetry: false,
603
+ result: void 0
604
+ }),
605
+ output: ({ context }) => context.result ?? {},
606
+ states: {
607
+ idle: { on: { LOAD: "loading" } },
608
+ loading: {
609
+ entry: "startPhoneValidationLoad",
610
+ invoke: {
611
+ id: "fetchForm",
612
+ src: "fetchForm",
613
+ input: ({ context }) => ({ country: context.country }),
614
+ onDone: [{
615
+ guard: "isSupportedForm",
616
+ target: "form",
617
+ actions: "applyForm"
618
+ }, { target: "misconfigured" }],
619
+ onError: [{
620
+ guard: "isForbidden",
621
+ target: "misconfigured"
622
+ }, {
623
+ target: "error",
624
+ actions: "setLoadError"
625
+ }]
626
+ }
627
+ },
628
+ form: {
629
+ initial: "inputting",
630
+ states: {
631
+ inputting: { on: {
632
+ SET_FIELD: [{
633
+ guard: "changesCountry",
634
+ target: "refetching",
635
+ actions: ["setFieldValue", "setCountryFromEvent"]
636
+ }, { actions: "setFieldValue" }],
637
+ SUBMIT: "validating"
638
+ } },
639
+ refetching: {
640
+ invoke: {
641
+ id: "refetchForm",
642
+ src: "fetchForm",
643
+ input: ({ context }) => ({ country: context.country }),
644
+ onDone: [{
645
+ guard: "isSupportedForm",
646
+ target: "inputting",
647
+ actions: "applyForm"
648
+ }, { target: "#kybChecks.misconfigured" }],
649
+ onError: [{
650
+ guard: "isForbidden",
651
+ target: "#kybChecks.misconfigured"
652
+ }, {
653
+ target: "#kybChecks.error",
654
+ actions: "setLoadError"
655
+ }]
656
+ },
657
+ on: { SET_FIELD: [{
658
+ guard: "changesCountry",
659
+ target: "refetching",
660
+ reenter: true,
661
+ actions: ["setFieldValue", "setCountryFromEvent"]
662
+ }, { actions: "setFieldValue" }] }
663
+ },
664
+ validating: {
665
+ entry: "validateAll",
666
+ always: [{
667
+ guard: "hasNoErrors",
668
+ target: "#kybChecks.submitting"
669
+ }, { target: "inputting" }]
670
+ }
671
+ },
672
+ on: { CLOSE: "closed" }
673
+ },
674
+ submitting: { invoke: {
675
+ id: "submit",
676
+ src: "submit",
677
+ input: ({ context }) => ({
678
+ submit: context.prepared?.submit,
679
+ values: context.values
680
+ }),
681
+ onDone: {
682
+ target: "finished",
683
+ actions: "setResult"
684
+ },
685
+ onError: [{
686
+ guard: "isForbidden",
687
+ target: "misconfigured"
688
+ }, {
689
+ target: "error",
690
+ actions: "setSubmitError"
691
+ }]
692
+ } },
693
+ error: { on: {
694
+ RETRY: [
695
+ {
696
+ guard: "failedLoadingFirstForm",
697
+ target: "loading",
698
+ actions: "clearError"
699
+ },
700
+ {
701
+ guard: "failedLoading",
702
+ target: "form.refetching",
703
+ actions: "clearError"
704
+ },
705
+ {
706
+ guard: "canRetry",
707
+ target: "submitting",
708
+ actions: "clearError"
709
+ }
710
+ ],
711
+ CLOSE: "closed"
712
+ } },
713
+ /** KYB is not in the session's flow, the session is closed, or the form schema is newer than this SDK. */
714
+ misconfigured: { on: { CLOSE: "closed" } },
715
+ finished: { type: "final" },
716
+ closed: { type: "final" }
717
+ }
718
+ });
719
+ //#endregion
720
+ export { kybChecksMachine as t };