@incodetech/core 2.1.0-rc.1 → 2.1.0-rc.3

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 (263) hide show
  1. package/dist/3dAvatarProvider-ChciZmjE.esm.js +28214 -0
  2. package/dist/{BrowserStorageProvider-BpJM-gIl.esm.js → BrowserStorageProvider-CrrN540a.esm.js} +1 -8
  3. package/dist/BrowserVisibilityObserverProvider-rim9Jrz-.esm.js +25 -0
  4. package/dist/Face2DProvider-BeLlYBbB.esm.js +824 -0
  5. package/dist/FaceDetectionProvider-B78455D4.d.ts +119 -0
  6. package/dist/IVisibilityObserverCapability-BbWjgpiF.d.ts +12 -0
  7. package/dist/IWasmUtilCapability-d2XvzaCk.d.ts +145 -0
  8. package/dist/IpifyProvider-BRW14_uo.esm.js +51 -0
  9. package/dist/{OpenViduRecordingProvider-O4GjBseO.esm.js → OpenViduRecordingProvider-B_0GKkzc.esm.js} +1 -1
  10. package/dist/PrivacyLensProvider-hDzaDzZ6.esm.js +339 -0
  11. package/dist/{StreamCanvasCapture-ImiDQdVA.esm.js → StreamCanvasCapture-Bz17q4FP.esm.js} +1 -1
  12. package/dist/StreamCanvasCapture-DS1TOoiH.d.ts +42 -0
  13. package/dist/{WasmUtilProvider-BKWm8rSA.esm.js → WasmUtilProvider-ADG54T6M.esm.js} +26 -2
  14. package/dist/{addressSearch-DvmWXKZg.esm.js → addressSearch-DJyNTg5S.esm.js} +4 -4
  15. package/dist/{ae-signature-BFZta3TZ.esm.js → ae-signature-DlElqFrZ.esm.js} +1 -1
  16. package/dist/ae-signature.d.ts +4 -3
  17. package/dist/ae-signature.esm.js +10 -7
  18. package/dist/antifraud.d.ts +4 -3
  19. package/dist/antifraud.esm.js +7 -6
  20. package/dist/antifraudManager-BKdQoMFf.esm.js +84 -0
  21. package/dist/{antifraudManager-CznnhyvD.d.ts → antifraudManager-DpIvbrZP.d.ts} +2 -2
  22. package/dist/{antifraudStateMachine-Ccrb-Jxc.esm.js → antifraudStateMachine-C0NGnP9W.esm.js} +3 -3
  23. package/dist/{api-CESGtpbH.esm.js → api-DsbUi7TO.esm.js} +21 -2
  24. package/dist/authentication.d.ts +19 -13
  25. package/dist/authentication.esm.js +33 -27
  26. package/dist/{authenticationManager-CaiQbp-q.d.ts → authenticationManager-CdPbNS2H.d.ts} +13 -3
  27. package/dist/{authenticationManager-BlR6mSaG.esm.js → authenticationManager-Dtl1vcET.esm.js} +17 -8
  28. package/dist/{authenticationStateMachine-DkcGUMw5.esm.js → authenticationStateMachine-D-hOlg8p.esm.js} +20 -23
  29. package/dist/avatar.d.ts +3 -0
  30. package/dist/avatar.esm.js +3 -0
  31. package/dist/{backCameraStream-D7Wo4Nbx.esm.js → backCameraStream-ZyqrFyjO.esm.js} +3 -3
  32. package/dist/browser-DlFgHpoC-qLKs75Qp.esm.js +1425 -0
  33. package/dist/{browserSimulation-B1dWiXp7.esm.js → browserSimulation-TsSoavQv.esm.js} +153 -1216
  34. package/dist/camera-DUkgmYMo.esm.js +79 -0
  35. package/dist/camera.d.ts +7 -1
  36. package/dist/camera.esm.js +4 -4
  37. package/dist/{StreamCanvasCapture-yyl20qd9.d.ts → canvas-CJUmoXSD.d.ts} +1 -41
  38. package/dist/certificate-issuance.d.ts +312 -0
  39. package/dist/certificate-issuance.esm.js +74 -0
  40. package/dist/certificateIssuanceStateMachine-C07m7qtP.esm.js +127 -0
  41. package/dist/clientLifecycle-Ct7h9uxx.esm.js +534 -0
  42. package/dist/consent.d.ts +4 -3
  43. package/dist/consent.esm.js +7 -6
  44. package/dist/{consentManager-BYo9Nu1r.esm.js → consentManager-BtnPZUW4.esm.js} +30 -5
  45. package/dist/{consentManager-Cg5Sk2tv.d.ts → consentManager-DufVo9D9.d.ts} +55 -55
  46. package/dist/{consentStateMachine-BG3yL8aC.esm.js → consentStateMachine-DO2JqoZW.esm.js} +3 -3
  47. package/dist/cpf-ocr.d.ts +4 -3
  48. package/dist/cpf-ocr.esm.js +7 -6
  49. package/dist/{cpfOcrManager-sSKegxox.esm.js → cpfOcrManager-C4rLgKsu.esm.js} +6 -5
  50. package/dist/{cpfOcrManager-Dg1s_TY5.d.ts → cpfOcrManager-DqZZ94Gt.d.ts} +19 -19
  51. package/dist/createFaceAvatar-B8pFpy6o.d.ts +401 -0
  52. package/dist/createFaceAvatar-BOHDKQRq.esm.js +46 -0
  53. package/dist/cross-document-data-match.d.ts +2 -1
  54. package/dist/cross-document-data-match.esm.js +6 -5
  55. package/dist/curp-validation.d.ts +10 -7
  56. package/dist/curp-validation.esm.js +7 -6
  57. package/dist/{curpValidationManager-CFem6zP9.esm.js → curpValidationManager-BafobPXC.esm.js} +52 -5
  58. package/dist/{curpValidationManager-RttixpIc.d.ts → curpValidationManager-Co6LZAHT.d.ts} +4 -3
  59. package/dist/{curpValidationStateMachine-B7V_qp66.esm.js → curpValidationStateMachine-DXTPK6vI.esm.js} +3 -3
  60. package/dist/custom-fields.d.ts +4 -2
  61. package/dist/custom-fields.esm.js +49 -6
  62. package/dist/custom-watchlist.d.ts +2 -1
  63. package/dist/custom-watchlist.esm.js +27 -6
  64. package/dist/{customWatchlistStateMachine-HmFybXLX.esm.js → customWatchlistStateMachine-B4G3Chkx.esm.js} +3 -3
  65. package/dist/{deepsightLoader-8tnddNx-.esm.js → deepsightLoader-DHSVD776.esm.js} +14 -13
  66. package/dist/{deepsightService-CrHmvx8X.esm.js → deepsightService-CDahSjGP.esm.js} +9 -38
  67. package/dist/deepsightService-CMB9XjES.d.ts +69 -0
  68. package/dist/device.d.ts +9 -1
  69. package/dist/device.esm.js +5 -5
  70. package/dist/document-capture.d.ts +178 -177
  71. package/dist/document-capture.esm.js +78 -14
  72. package/dist/document-upload.d.ts +51 -50
  73. package/dist/document-upload.esm.js +10 -9
  74. package/dist/{documentCaptureStateMachine-CUTUzUw_.esm.js → documentCaptureStateMachine-DSOX2epf.esm.js} +7 -7
  75. package/dist/dynamic-forms.d.ts +4 -192
  76. package/dist/dynamic-forms.esm.js +8 -410
  77. package/dist/dynamicFormsManager-BOefZbyF.esm.js +168 -0
  78. package/dist/dynamicFormsManager-CUYLOj9g.d.ts +239 -0
  79. package/dist/dynamicFormsStateMachine-BXHcaocI.esm.js +284 -0
  80. package/dist/ekyb.d.ts +10 -6
  81. package/dist/ekyb.esm.js +62 -17
  82. package/dist/{ekybStateMachine-klc-AImJ.esm.js → ekybStateMachine-CCSeqjCt.esm.js} +5 -5
  83. package/dist/ekyc.d.ts +5 -3
  84. package/dist/ekyc.esm.js +55 -9
  85. package/dist/{ekycStateMachine-CXbpaJJn.esm.js → ekycStateMachine-DkLVTOyA.esm.js} +5 -5
  86. package/dist/electronic-signature.d.ts +4 -3
  87. package/dist/electronic-signature.esm.js +9 -6
  88. package/dist/{electronicSignatureManager-BaECdJ1u.esm.js → electronicSignatureManager-DjzUzqZj.esm.js} +135 -92
  89. package/dist/email.d.ts +5 -4
  90. package/dist/email.esm.js +9 -8
  91. package/dist/{emailManager--D5G3ChB.esm.js → emailManager-B_XzEsXH.esm.js} +47 -6
  92. package/dist/{emailManager-lAzDoQOs.d.ts → emailManager-fHASH6uo.d.ts} +4 -3
  93. package/dist/{emailStateMachine-CxTOMAjC.esm.js → emailStateMachine-fqJ42b19.esm.js} +5 -5
  94. package/dist/{endpoints-BeTK0Mlt.esm.js → endpoints-BzMJFAPV.esm.js} +15 -0
  95. package/dist/{events-Dvvriq9l.esm.js → events-CqGY1yMq.esm.js} +87 -206
  96. package/dist/events.d.ts +23 -16
  97. package/dist/events.esm.js +3 -2
  98. package/dist/extensibility.d.ts +37 -27
  99. package/dist/extensibility.esm.js +74 -57
  100. package/dist/externalFetch-CyhBfD-n.esm.js +22 -0
  101. package/dist/face-match.d.ts +2 -2
  102. package/dist/face-match.esm.js +6 -5
  103. package/dist/{faceCaptureManagerFactory-ej2j1LMr.esm.js → faceCaptureManagerFactory-2brKTzMb.esm.js} +115 -25
  104. package/dist/faceCaptureManagerFactory-CGKbf7zt.d.ts +400 -0
  105. package/dist/{faceCaptureSetup-B9t6bYze.esm.js → faceCaptureSetup-CDUVU1nl.esm.js} +97 -13
  106. package/dist/{faceMatchStateMachine-DeXXzSuz.esm.js → faceMatchStateMachine-DUeUjEPx.esm.js} +3 -3
  107. package/dist/field-comparison.d.ts +4 -3
  108. package/dist/field-comparison.esm.js +6 -5
  109. package/dist/{fieldComparisonManager-COGI2ARD.esm.js → fieldComparisonManager-B9W0a9A5.esm.js} +5 -4
  110. package/dist/{fieldComparisonManager-Bu5TaSr3.d.ts → fieldComparisonManager-DdLqDeB2.d.ts} +2 -2
  111. package/dist/fiscal-qr.d.ts +5 -3
  112. package/dist/fiscal-qr.esm.js +13 -12
  113. package/dist/flow-events.d.ts +8 -6
  114. package/dist/flow.d.ts +34 -16
  115. package/dist/flow.esm.js +53 -30
  116. package/dist/flowCompletionService-BIqSTZcd.d.ts +28 -0
  117. package/dist/flowCompletionService-qEqh_g14.esm.js +42 -0
  118. package/dist/{flowServices-ChgTNggJ.esm.js → flowServices-C4piblgx.esm.js} +24 -9
  119. package/dist/geolocation.d.ts +4 -126
  120. package/dist/geolocation.esm.js +8 -87
  121. package/dist/geolocationManager-BP2Do9O-.esm.js +123 -0
  122. package/dist/geolocationManager-Cs50eRlC.d.ts +156 -0
  123. package/dist/{geolocationStateMachine-Dvh7X0wF.esm.js → geolocationStateMachine-BYfOOOG0.esm.js} +4 -4
  124. package/dist/{getDeviceClass-C8Do2qYu.esm.js → getDeviceClass-DGGzzfqm.esm.js} +1 -1
  125. package/dist/getDeviceData-TrKM8NPh.esm.js +101 -0
  126. package/dist/government-validation.d.ts +4 -3
  127. package/dist/government-validation.esm.js +43 -8
  128. package/dist/{governmentValidationStateMachine-DcJ-BfsC.esm.js → governmentValidationStateMachine-CwoPPO8b.esm.js} +5 -5
  129. package/dist/home.d.ts +18 -15
  130. package/dist/home.esm.js +5 -4
  131. package/dist/http.d.ts +1 -0
  132. package/dist/http.esm.js +2 -2
  133. package/dist/id-ocr.d.ts +4 -625
  134. package/dist/id-ocr.esm.js +8 -84
  135. package/dist/id-verification.d.ts +28 -27
  136. package/dist/id-verification.esm.js +6 -5
  137. package/dist/id.d.ts +24 -13
  138. package/dist/id.esm.js +48 -33
  139. package/dist/idCaptureDefaults-DNJON8Xo.esm.js +188 -0
  140. package/dist/{idCaptureManager-ChCNmgBj.d.ts → idCaptureManager-BVdvfJys.d.ts} +47 -12
  141. package/dist/{idCaptureManager-D3pwWutw.esm.js → idCaptureManager-Bo9DCQSU.esm.js} +100 -15
  142. package/dist/{idCaptureStateMachine-B3AiDIsT.esm.js → idCaptureStateMachine-BeDidMLU.esm.js} +525 -439
  143. package/dist/idOcrManager-BkRDrpZu.esm.js +92 -0
  144. package/dist/idOcrManager-CJzrmM91.d.ts +641 -0
  145. package/dist/{idOcrStateMachine-CDQ5d_VM.esm.js → idOcrStateMachine-DRZc4FBl.esm.js} +5 -5
  146. package/dist/{idVerificationStateMachine-kRxwImzO.esm.js → idVerificationStateMachine-oqiERKpg.esm.js} +3 -3
  147. package/dist/identity-reuse.d.ts +4 -3
  148. package/dist/identity-reuse.esm.js +7 -6
  149. package/dist/{identityReuseManager-C6n_97dw.esm.js → identityReuseManager-Bu62LToE.esm.js} +4 -3
  150. package/dist/{identityReuseManager-Cww-NDtd.d.ts → identityReuseManager-TWKbXuvY.d.ts} +33 -33
  151. package/dist/{identityReuseStateMachine-BfE5YiEr.esm.js → identityReuseStateMachine-BmONeF6B.esm.js} +3 -3
  152. package/dist/{index-B5hPA0Bg.d.ts → index-DtUlD-bz.d.ts} +2 -2
  153. package/dist/{index-B9NysVDB.d.ts → index-Icld-cKW.d.ts} +175 -295
  154. package/dist/index-XTtxaahe.d.ts +93 -0
  155. package/dist/index.d.ts +3 -2
  156. package/dist/index.esm.js +16 -12
  157. package/dist/{invokeOnCaptureCallback-ygByVdnn.esm.js → invokeOnCaptureCallback-v_PV_IJz.esm.js} +1 -1
  158. package/dist/{lib-BY67lgbq.esm.js → lib-B050WTth.esm.js} +1 -1
  159. package/dist/mandatory-consent.d.ts +10 -7
  160. package/dist/mandatory-consent.esm.js +7 -6
  161. package/dist/{mandatoryConsentManager-Dq6WiOZh.d.ts → mandatoryConsentManager-Bmdjo14S.d.ts} +50 -50
  162. package/dist/{mandatoryConsentManager-H6D18cZB.esm.js → mandatoryConsentManager-CQ3jirlZ.esm.js} +4 -3
  163. package/dist/{mandatoryConsentStateMachine-DtQNW1ji.esm.js → mandatoryConsentStateMachine-DkJJLHqC.esm.js} +3 -3
  164. package/dist/mediaRecorderOptions-C3NAkVgK.esm.js +42 -0
  165. package/dist/mediapipeShared-CRAKVElv.esm.js +67 -0
  166. package/dist/{recordingService-yRw7hfzU.esm.js → onDeviceFaceResults-DVBggeq8.esm.js} +71 -389
  167. package/dist/{openviduLazy-Dh14JNJc.esm.js → openviduLazy-BTOIauGP.esm.js} +2 -2
  168. package/dist/openviduLazy-Dov8oKfL.esm.js +3 -0
  169. package/dist/{permissionGuards-D0wGddy7.esm.js → permissionGuards-BR2oN573.esm.js} +1 -1
  170. package/dist/{permissionServices-Doec4X5L.esm.js → permissionServices-BJhGL13R.esm.js} +7 -4
  171. package/dist/personhood.d.ts +534 -0
  172. package/dist/personhood.esm.js +1494 -0
  173. package/dist/phone.d.ts +5 -4
  174. package/dist/phone.esm.js +9 -8
  175. package/dist/{phoneManager-fPmIBYQK.d.ts → phoneManager-BOTcjXgs.d.ts} +4 -3
  176. package/dist/{phoneManager-BmF-0Ez4.esm.js → phoneManager-BWlxqbyD.esm.js} +48 -6
  177. package/dist/{phoneStateMachine-BiV0yoEx.esm.js → phoneStateMachine-B_V9nODs.esm.js} +5 -5
  178. package/dist/{qe-signature-CUYPcHVo.esm.js → qe-signature-BhFnI9pT.esm.js} +1 -1
  179. package/dist/qe-signature.d.ts +4 -3
  180. package/dist/qe-signature.esm.js +10 -7
  181. package/dist/recordingService-m_1xCthr.esm.js +347 -0
  182. package/dist/redirect-to-mobile.d.ts +4 -3
  183. package/dist/redirect-to-mobile.esm.js +9 -7
  184. package/dist/{redirectToMobileManager-Dy3t7o0C.esm.js → redirectToMobileManager-BaAo9rgi.esm.js} +5 -4
  185. package/dist/{redirectToMobileManager-BNe3IzC_.d.ts → redirectToMobileManager-Br0KZK1G.d.ts} +2 -2
  186. package/dist/{redirectToMobileStateMachine-DyAdRxfP.esm.js → redirectToMobileStateMachine-DoAnf2ql.esm.js} +16 -28
  187. package/dist/{runChildModule-CuoHZ1cx.esm.js → runChildModule-0nQfjVVo.esm.js} +14 -24
  188. package/dist/selfie.d.ts +27 -14
  189. package/dist/selfie.esm.js +43 -30
  190. package/dist/{selfieManager-BNuTIGAz.esm.js → selfieManager-D_ZFERsE.esm.js} +17 -8
  191. package/dist/{selfieManager-C2y_t6DG.d.ts → selfieManager-R0Jw5sjb.d.ts} +13 -3
  192. package/dist/{selfieStateMachine-Bv99bZJE.esm.js → selfieStateMachine-CIgeeiN9.esm.js} +4 -4
  193. package/dist/{session-DoVb-OcB.esm.js → session-9jIfKFCc.esm.js} +3 -3
  194. package/dist/session.d.ts +11 -8
  195. package/dist/session.esm.js +16 -12
  196. package/dist/{sessionInitializer-DRB-hgbV.esm.js → sessionInitializer-C_TYIgyk.esm.js} +16 -109
  197. package/dist/{setup-BwCluiw3.d.ts → setup-CpRnXxn8.d.ts} +61 -2
  198. package/dist/setup-DHc6OaHm.esm.js +562 -0
  199. package/dist/signature.d.ts +4 -2
  200. package/dist/signature.esm.js +49 -6
  201. package/dist/{signatureStateMachine-C5qqYLRz.esm.js → signatureStateMachine-DtoiPzys.esm.js} +21 -39
  202. package/dist/{stats-BMNUG1AU.esm.js → stats-CYcScXcO.esm.js} +2 -2
  203. package/dist/stats.esm.js +3 -3
  204. package/dist/thumbmarkAdapter-fHBUDlAP.esm.js +1194 -0
  205. package/dist/tri-BG1iJsr4.esm.js +399 -0
  206. package/dist/tri.d.ts +2 -0
  207. package/dist/tri.esm-DUC01NgO.esm.js +2593 -0
  208. package/dist/tri.esm.js +4 -0
  209. package/dist/trust-graph.d.ts +4 -3
  210. package/dist/trust-graph.esm.js +4 -3
  211. package/dist/{types-NuT8ftBV.d.ts → types-BklZ_Wne.d.ts} +2 -1
  212. package/dist/{types-DOUhndhT.d.ts → types-BsYXnC5s.d.ts} +39 -3
  213. package/dist/{types-DsnEVMhr.esm.js → types-CMcxlSmH.esm.js} +2 -1
  214. package/dist/types-CxW2e0Ar.d.ts +132 -0
  215. package/dist/{types-Bj9hdFjU.d.ts → types-DgGlgyZT.d.ts} +1 -1
  216. package/dist/types-ElOJAGaM.esm.js +189 -0
  217. package/dist/urlUtils-BZqFU9rR.esm.js +16 -0
  218. package/dist/video-C2WIj6TS.esm.js +36 -0
  219. package/dist/video-selfie.d.ts +351 -0
  220. package/dist/video-selfie.esm.js +1509 -0
  221. package/dist/videoSelfieSteps-7M5vxKn-.esm.js +58 -0
  222. package/dist/{warmup-Dg8Lh-50.d.ts → warmup-BJZPQIiX.d.ts} +5 -1
  223. package/dist/wasm.d.ts +4 -3
  224. package/dist/wasm.esm.js +17 -13
  225. package/dist/watchlist-for-business.d.ts +2 -1
  226. package/dist/watchlist-for-business.esm.js +30 -7
  227. package/dist/watchlist.d.ts +2 -1
  228. package/dist/watchlist.esm.js +28 -6
  229. package/dist/{watchlistForBusinessStateMachine-DMl8j2Ov.esm.js → watchlistForBusinessStateMachine-DvEunDxs.esm.js} +3 -3
  230. package/dist/{watchlistStateMachine-DmQlqI6L.esm.js → watchlistStateMachine-AHXVf-TB.esm.js} +3 -3
  231. package/dist/workflow.d.ts +296 -103
  232. package/dist/workflow.esm.js +137 -74
  233. package/dist/{xstate.esm-C9wncMQa.esm.js → xstate.esm-Bomq1a0z.esm.js} +54 -5
  234. package/package.json +26 -1
  235. package/dist/IpifyProvider-D4LWD15E.esm.js +0 -167
  236. package/dist/antifraudManager-CkV4u-LE.esm.js +0 -55
  237. package/dist/camera-DJWm3V4g.esm.js +0 -22
  238. package/dist/deepsightService-Dh5P-hLf.d.ts +0 -265
  239. package/dist/faceCaptureManagerFactory-CjdBUS6s.d.ts +0 -721
  240. package/dist/flowCompletionService-BdR2cGgB.d.ts +0 -19
  241. package/dist/flowCompletionService-DdGojV9K.esm.js +0 -20
  242. package/dist/getBrowser-C8DP7oTB.esm.js +0 -8
  243. package/dist/openviduLazy-B8L--0oe.esm.js +0 -3
  244. package/dist/setup-CUO4mErT.esm.js +0 -1037
  245. /package/dist/{Actor-Y0_Fj-KL.d.ts → Actor-CGEelYtQ.d.ts} +0 -0
  246. /package/dist/{BrowserTimerProvider-DhNc_x02.esm.js → BrowserTimerProvider-CHloo0eQ.esm.js} +0 -0
  247. /package/dist/{ITimerCapability-CB0I1Uf2.esm.js → ITimerCapability-pltuG1E8.esm.js} +0 -0
  248. /package/dist/{Manager-BHn8wH8K.d.ts → Manager-CJ3G2zqi.d.ts} +0 -0
  249. /package/dist/{MotionSensorProvider-Bx7Mpzt0.esm.js → MotionSensorProvider-DCbId4De.esm.js} +0 -0
  250. /package/dist/{StateMachine-BC_nGvrc.d.ts → StateMachine-C_AY4cs7.d.ts} +0 -0
  251. /package/dist/{apiError-B-j-gyDx.esm.js → apiError-DNS2OCEX.esm.js} +0 -0
  252. /package/dist/{camera-SRBpPq2X.d.ts → camera-CNVUo-bC.d.ts} +0 -0
  253. /package/dist/{canvas-SKcRBxsk.esm.js → canvas-_I95hkPg.esm.js} +0 -0
  254. /package/dist/{chunk-CMUKZ2uL.esm.js → chunk-CIKcdghV.esm.js} +0 -0
  255. /package/dist/{cpf-BRzggV8G.esm.js → cpf-BKaho0j_.esm.js} +0 -0
  256. /package/dist/{dateUtils-AksLQmgV.esm.js → dateUtils-7-tQYRNN.esm.js} +0 -0
  257. /package/dist/{getDeviceClass-C0olyNFS.esm.js → getDeviceClass-DavNdcxh.esm.js} +0 -0
  258. /package/dist/{http-Cai3IoLS.esm.js → http-BkiUT7EB.esm.js} +0 -0
  259. /package/dist/{otp-CGMdUzBC.esm.js → otp-Bfnzf7I3.esm.js} +0 -0
  260. /package/dist/{otp-DF5A0sFx.d.ts → otp-M4iy57XY.d.ts} +0 -0
  261. /package/dist/{platform-SKvEfCBh.esm.js → platform-uIVQUnJP.esm.js} +0 -0
  262. /package/dist/{types-DvGZI7BF.d.ts → types-D_IceWxT.d.ts} +0 -0
  263. /package/dist/{types-ya0LN_MX.d.ts → types-Duy2rDxF.d.ts} +0 -0
@@ -1,20 +1,21 @@
1
- import { d as IdCaptureModelType, i as mlWasmJSApi_default, n as BaseWasmProvider, u as WasmPipelineType } from "./WasmUtilProvider-BKWm8rSA.esm.js";
2
- import { t as BrowserTimerProvider } from "./BrowserTimerProvider-DhNc_x02.esm.js";
3
- import { r as getToken, t as api } from "./api-CESGtpbH.esm.js";
4
- import { S as revokeObjectURL } from "./events-Dvvriq9l.esm.js";
5
- import { t as endpoints } from "./endpoints-BeTK0Mlt.esm.js";
6
- import { t as addDeviceStats } from "./stats-BMNUG1AU.esm.js";
7
- import { t as getDisableIpify } from "./sessionInitializer-DRB-hgbV.esm.js";
8
- import { n as isDesktop } from "./platform-SKvEfCBh.esm.js";
9
- import { a as fromPromise, i as fromCallback, n as sendTo, o as and, r as assign, t as setup } from "./xstate.esm-C9wncMQa.esm.js";
10
- import { n as invokeRequestPermissionActor, t as checkPermission } from "./permissionServices-Doec4X5L.esm.js";
11
- import { _ as startRecording, g as createRecordingSession, i as flagIdManualReview, n as preloadOpenViduProvider, v as stopRecording$1, y as StreamCanvasProcessingSession } from "./recordingService-yRw7hfzU.esm.js";
12
- import { t as IncodeCanvas } from "./canvas-SKcRBxsk.esm.js";
13
- import { n as getBackCameraStream } from "./backCameraStream-D7Wo4Nbx.esm.js";
14
- import { n as getWindowDimensions } from "./getDeviceClass-C0olyNFS.esm.js";
15
- import { t as getDeviceClass } from "./getDeviceClass-C8Do2qYu.esm.js";
16
- import { t as StreamCanvasCapture } from "./StreamCanvasCapture-ImiDQdVA.esm.js";
17
- import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-D0wGddy7.esm.js";
1
+ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-CHloo0eQ.esm.js";
2
+ import { r as getToken, t as api } from "./api-DsbUi7TO.esm.js";
3
+ import { v as revokeObjectURL } from "./events-CqGY1yMq.esm.js";
4
+ import { t as endpoints } from "./endpoints-BzMJFAPV.esm.js";
5
+ import { t as addDeviceStats } from "./stats-CYcScXcO.esm.js";
6
+ import { t as getDisableIpify } from "./sessionInitializer-C_TYIgyk.esm.js";
7
+ import { n as isDesktop } from "./platform-uIVQUnJP.esm.js";
8
+ import { a as fromPromise, c as not, i as fromCallback, n as sendTo, o as and, r as assign, t as setup } from "./xstate.esm-Bomq1a0z.esm.js";
9
+ import { n as invokeRequestPermissionActor, t as checkPermission } from "./permissionServices-BJhGL13R.esm.js";
10
+ import { _ as stopRecording$1, g as startRecording, h as createRecordingSession, y as StreamCanvasProcessingSession } from "./onDeviceFaceResults-DVBggeq8.esm.js";
11
+ import { t as IncodeCanvas } from "./canvas-_I95hkPg.esm.js";
12
+ import { n as getBackCameraStream } from "./backCameraStream-ZyqrFyjO.esm.js";
13
+ import { n as getWindowDimensions } from "./getDeviceClass-DavNdcxh.esm.js";
14
+ import { t as getDeviceClass } from "./getDeviceClass-DGGzzfqm.esm.js";
15
+ import { t as StreamCanvasCapture } from "./StreamCanvasCapture-Bz17q4FP.esm.js";
16
+ import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-BR2oN573.esm.js";
17
+ import { i as flagIdManualReview, n as preloadOpenViduProvider } from "./recordingService-m_1xCthr.esm.js";
18
+ import { i as IdCaptureProvider, n as DEFAULT_ID_CAPTURE_MODEL_VERSION, r as DEFAULT_ID_CAPTURE_THRESHOLDS } from "./idCaptureDefaults-DNJON8Xo.esm.js";
18
19
 
19
20
  //#region src/modules/id/digitalUpload/digitalUploadErrors.ts
20
21
  const TERMINAL_FAIL_REASONS = new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
@@ -320,6 +321,17 @@ function isHoldingState(value) {
320
321
  if (typeof uploadingState === "object" && uploadingState !== null) return Object.prototype.hasOwnProperty.call(uploadingState, "holding");
321
322
  return false;
322
323
  }
324
+ /**
325
+ * Maps a Digital ID Upload child-machine snapshot to the exact Figma
326
+ * "Tracked Events" screen name. Source: Upload Digital ID Figma file
327
+ * (`https://www.figma.com/design/wxFsHRvllern4VnjRqM4JO/Upload-Digital-ID---Latest-Design?node-id=25911-4095`).
328
+ *
329
+ * Family is `uploadDigitalid.*` — emitted cross-family under the parent
330
+ * `idCapture` module token. Returns Figma-verbatim strings which the
331
+ * adapter emits as-is on `event.screen` (e.g.
332
+ * `uploadDigitalid.<section>.<state>`). See
333
+ * `docs/patterns/INSTRUMENTATION.md`.
334
+ */
323
335
  function mapDigitalIdScreenName(value, failReason) {
324
336
  if (value === "tutorial") return "uploadDigitalid.tutorial.default";
325
337
  if (value === "selecting" || value === "reviewing") return "uploadDigitalid.review.default";
@@ -334,172 +346,102 @@ function mapDigitalIdScreenName(value, failReason) {
334
346
  }
335
347
 
336
348
  //#endregion
337
- //#region src/modules/id/idCaptureHelpers.ts
349
+ //#region src/modules/id/manualUpload/manualUploadErrors.ts
338
350
  /**
339
- * Map of config properties received from the backend to adjusted, internal document types.
351
+ * i18n keys for manual-upload user-facing error copy.
352
+ * Keep in sync with `packages/ui/src/i18n/**.json` under the `manualIdUpload.*` namespace.
340
353
  */
341
- const DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP = [
342
- ["enableId", "id"],
343
- ["enablePassport", "passport"],
344
- ["manualUploadIdCapture", "manualIdUpload"],
345
- ["digitalIdsUpload", "digitalIdUpload"],
346
- ["deviceWallet", "digitalId"]
347
- ];
354
+ const MANUAL_UPLOAD_ERROR_KEYS = {
355
+ wrongSide: "manualIdUpload.wrongSide",
356
+ wrongDocument: "manualIdUpload.wrongDocument",
357
+ fileTooBig: "manualIdUpload.fileTooBig",
358
+ generic: "manualIdUpload.generic",
359
+ lowSharpness: "manualIdUpload.lowSharpness",
360
+ glareDetected: "manualIdUpload.glareDetected",
361
+ readabilityIssue: "manualIdUpload.readabilityIssue"
362
+ };
348
363
  /**
349
- * Returns the list of document types enabled by config for the chooser screen, in display order.
350
- * Used to populate chooser state so UI and headless consumers can render the correct options.
364
+ * Map the server's `failReason` (plus client-side passport/ID tab mismatch and
365
+ * per-image quality flags) onto an i18n key. Mirrors v1's `shouldUploadAgain`
366
+ * branch logic in
367
+ * `ms-incodesmile-web/packages/incode-welcome/src/manualIdUpload/manuaIdUpload.tsx`,
368
+ * extended to also reject responses where the backend flagged a per-image
369
+ * quality issue (`correctSharpness`, `correctGlare`, or `readability`).
370
+ * `idQualityAttemptApproved` is intentionally ignored — v1 did not treat it
371
+ * as a manual-upload rejection signal.
351
372
  *
352
- * @param config - ID capture configuration (from flow or init)
353
- * @returns Array of IdDocumentType values that should be shown in the document type chooser
373
+ * Quality flags are checked with `=== false` so missing/undefined values
374
+ * (older backends, partial payloads) keep the legacy "trust the server"
375
+ * behaviour and do not produce false positives.
376
+ *
377
+ * Returns `null` when the response represents a successful upload — the caller
378
+ * should treat `null` as "no error, advance to next slot".
354
379
  */
355
- function getAvailableDocumentTypes(config) {
356
- const adjustedDocumentTypes = [];
357
- for (const [configProperty, adjustedType] of DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP) if (config[configProperty]) adjustedDocumentTypes.push(adjustedType);
358
- return adjustedDocumentTypes;
380
+ function mapFailReasonToErrorKey(response, expectedTab) {
381
+ const failReason = response.failReason;
382
+ if (failReason === "WRONG_DOCUMENT_SIDE") return MANUAL_UPLOAD_ERROR_KEYS.wrongSide;
383
+ if (failReason === "WRONG_ONE_SIDED_DOCUMENT" || failReason === "UNKNOWN_DOCUMENT_TYPE") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
384
+ if (failReason === "ID_TYPE_UNACCEPTABLE") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
385
+ if (expectedTab === "passport" && response.typeOfId && response.typeOfId.toLowerCase() !== "passport") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
386
+ if (expectedTab === "id" && response.typeOfId?.toLowerCase() === "passport") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
387
+ if (response.correctSharpness === false) return MANUAL_UPLOAD_ERROR_KEYS.lowSharpness;
388
+ if (response.correctGlare === false) return MANUAL_UPLOAD_ERROR_KEYS.glareDetected;
389
+ if (response.readability === false) return MANUAL_UPLOAD_ERROR_KEYS.readabilityIssue;
390
+ return null;
359
391
  }
360
392
 
361
393
  //#endregion
362
- //#region ../infra/src/providers/wasm/IdCaptureProvider.ts
363
- var IdCaptureProvider = class extends BaseWasmProvider {
364
- constructor() {
365
- super(WasmPipelineType.IdBlurGlarePipeline);
366
- this.lastProcessResult = null;
367
- this.capturedCanvas = null;
368
- this.originalCapturedCanvas = null;
369
- }
370
- async initialize(config) {
371
- await this.initializeBase(config, "idCapture");
372
- }
373
- setCallbacks(callbacks) {
374
- this.ensureInitialized();
375
- const onCaptureWrapper = () => {
376
- callbacks.onCapture?.();
377
- };
378
- mlWasmJSApi_default.setIdCaptureCallbacks(this.getPipelineType(), callbacks.onFarAway ?? (() => {}), callbacks.onDetectionStarted ?? (() => {}), callbacks.onMaskChange ? (show, mask, top, orientation) => callbacks.onMaskChange?.(show, mask, top, orientation) : () => {}, callbacks.onBlur ?? (() => {}), callbacks.onGlare ?? (() => {}), callbacks.onCapturing ?? (() => {}), callbacks.onCapture ? onCaptureWrapper : () => {}, callbacks.onBestFrame ? (blur, glare, orientation) => callbacks.onBestFrame?.(blur, glare, orientation) : () => {}, callbacks.onIdNotDetected ?? (() => {}), callbacks.onSwitchToManualCapture ?? (() => {}), callbacks.onIdTypeChange ? (idType) => callbacks.onIdTypeChange?.(idType) : () => {}, callbacks.onIdSideChange ? (side) => callbacks.onIdSideChange?.(side) : () => {}, callbacks.onCapturingCounterValueChange ? (value) => callbacks.onCapturingCounterValueChange?.(value) : () => {});
379
- }
380
- setThresholds(thresholds) {
381
- this.ensureInitialized();
382
- mlWasmJSApi_default.setIdCaptureThresholds(this.getPipelineType(), thresholds.blurThreshold, thresholds.blurChangeThreshold, thresholds.glareThreshold, thresholds.clsThreshold, thresholds.sideThreshold, thresholds.iouThreshold, thresholds.idDetectedTimeout, thresholds.autocaptureTimeout, thresholds.framesAggregationInterval);
383
- }
384
- setGeometry(geometry) {
385
- this.ensureInitialized();
386
- mlWasmJSApi_default.setIdCaptureGeometryParams(this.getPipelineType(), geometry.areaDown, geometry.areaUp, geometry.areaIOSPassportUp, geometry.areaIOSPassportDown, geometry.widthIOSUp, geometry.widthIOSDown, geometry.widthDown, geometry.widthUp, geometry.windowOuterWidth, geometry.windowOuterHeight, geometry.windowInnerWidth, geometry.windowInnerHeight);
387
- }
388
- setSettings(settings) {
389
- this.ensureInitialized();
390
- mlWasmJSApi_default.setIdCaptureConfigParams(this.getPipelineType(), settings.isFixedMask, settings.isIPhone14OrHigher, settings.idType, settings.blurCheckEnabled, settings.glareCheckEnabled, settings.faceQualityCheckEnabled, settings.iouCheckEnabled, settings.fpsLimitEnabled);
391
- }
392
- setModelType(modelType) {
393
- this.ensureInitialized();
394
- let wasmModelType;
395
- switch (modelType) {
396
- case "v1":
397
- wasmModelType = IdCaptureModelType.IdCaptureV1x;
398
- break;
399
- case "v2":
400
- wasmModelType = IdCaptureModelType.IdCaptureV2x;
401
- break;
402
- case "v3":
403
- wasmModelType = IdCaptureModelType.IdCaptureV3x;
404
- break;
405
- default: throw new Error(`Unknown model type: ${modelType}`);
406
- }
407
- mlWasmJSApi_default.setIdCaptureModelType(this.getPipelineType(), wasmModelType);
408
- }
409
- /**
410
- * Processes a frame through the WASM pipeline and stores the result.
411
- */
412
- async processFrame(image) {
413
- const result = await this.processFrameWasm(image);
414
- const pipelineType = this.getPipelineType();
415
- if (result && pipelineType === WasmPipelineType.IdBlurGlarePipeline) this.lastProcessResult = result;
416
- else this.lastProcessResult = null;
417
- }
418
- /**
419
- * Gets the last process result from the most recent frame processing.
420
- * @returns The last process result with quad coordinates, or null if not available
421
- */
422
- getLastProcessResult() {
423
- return this.lastProcessResult;
424
- }
425
- transformPerspective(canvas, frameRect) {
426
- this.ensureInitialized();
427
- const originalWidth = canvas.width();
428
- const originalHeight = canvas.height();
429
- try {
430
- const imageData = canvas.getImageData();
431
- if (!imageData) return canvas;
432
- const transformedCanvas = mlWasmJSApi_default.IdPerspectiveTransform(imageData, frameRect);
433
- if (transformedCanvas) {
434
- const wrappedCanvas = new IncodeCanvas(transformedCanvas);
435
- const wrappedWidth = wrappedCanvas.width();
436
- const wrappedHeight = wrappedCanvas.height();
437
- if (wrappedWidth === originalWidth && wrappedHeight === originalHeight) {
438
- const croppedCanvas = this.cropCanvasToRect(wrappedCanvas, {
439
- x: Math.round(frameRect.x),
440
- y: Math.round(frameRect.y),
441
- w: Math.round(frameRect.w),
442
- h: Math.round(frameRect.h)
443
- });
444
- if (croppedCanvas) return croppedCanvas;
445
- }
446
- return wrappedCanvas;
447
- }
448
- return canvas;
449
- } catch (_error) {
450
- return canvas;
394
+ //#region ../infra/src/media/imageFile.ts
395
+ const DEFAULT_IMAGE_MIME_TYPE = "image/jpeg";
396
+ const DEFAULT_IMAGE_QUALITY = .92;
397
+ const canNormalizeImageFile = (file) => file.type.startsWith("image/") && typeof document !== "undefined" && typeof Image !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
398
+ const readFileAsDataUrl = (file) => new Promise((resolve, reject) => {
399
+ const reader = new FileReader();
400
+ reader.onload = () => {
401
+ const result = reader.result;
402
+ if (typeof result === "string") {
403
+ resolve(result);
404
+ return;
451
405
  }
406
+ reject(/* @__PURE__ */ new Error("FileReader produced non-string result"));
407
+ };
408
+ reader.onerror = () => {
409
+ reject(reader.error ?? /* @__PURE__ */ new Error("FileReader failed"));
410
+ };
411
+ reader.readAsDataURL(file);
412
+ });
413
+ const loadImage = (url) => new Promise((resolve, reject) => {
414
+ const image = new Image();
415
+ image.onload = () => resolve(image);
416
+ image.onerror = () => reject(/* @__PURE__ */ new Error("Image decoding failed"));
417
+ image.src = url;
418
+ });
419
+ const fileToCanvasDataUrl = async (file, options) => {
420
+ const objectUrl = URL.createObjectURL(file);
421
+ try {
422
+ const image = await loadImage(objectUrl);
423
+ const width = image.naturalWidth || image.width;
424
+ const height = image.naturalHeight || image.height;
425
+ if (width <= 0 || height <= 0) return readFileAsDataUrl(file);
426
+ const canvas = document.createElement("canvas");
427
+ canvas.width = width;
428
+ canvas.height = height;
429
+ const context = canvas.getContext("2d");
430
+ if (!context) return readFileAsDataUrl(file);
431
+ context.fillStyle = "#fff";
432
+ context.fillRect(0, 0, width, height);
433
+ context.drawImage(image, 0, 0, width, height);
434
+ return canvas.toDataURL(options.mimeType ?? DEFAULT_IMAGE_MIME_TYPE, options.quality ?? DEFAULT_IMAGE_QUALITY);
435
+ } finally {
436
+ URL.revokeObjectURL(objectUrl);
452
437
  }
453
- /**
454
- * Crops a canvas to the specified rectangle region.
455
- * @param canvas - The canvas to crop
456
- * @param rect - The rectangle to crop to (x, y, w, h)
457
- * @returns A new IncodeCanvas with the cropped region, or null if cropping fails
458
- */
459
- cropCanvasToRect(canvas, rect) {
460
- const canvasWidth = canvas.width();
461
- const canvasHeight = canvas.height();
462
- if (!canvasWidth || !canvasHeight) return null;
463
- const x = Math.max(0, Math.min(rect.x, canvasWidth));
464
- const y = Math.max(0, Math.min(rect.y, canvasHeight));
465
- const w = Math.max(1, Math.min(rect.w, canvasWidth - x));
466
- const h = Math.max(1, Math.min(rect.h, canvasHeight - y));
467
- const croppedCanvasElement = document.createElement("canvas");
468
- croppedCanvasElement.width = w;
469
- croppedCanvasElement.height = h;
470
- const ctx = croppedCanvasElement.getContext("2d");
471
- if (!ctx) return null;
472
- ctx.drawImage(canvas.canvas, x, y, w, h, 0, 0, w, h);
473
- return new IncodeCanvas(croppedCanvasElement);
474
- }
475
- /**
476
- * Gets the captured canvas (transformed for preview).
477
- * @returns The captured canvas, or null if not available
478
- */
479
- getCapturedCanvas() {
480
- return this.capturedCanvas;
481
- }
482
- /**
483
- * Gets the original captured canvas (full frame for upload).
484
- * @returns The original captured canvas, or null if not available
485
- */
486
- getOriginalCapturedCanvas() {
487
- return this.originalCapturedCanvas;
488
- }
489
- /**
490
- * Sets the captured canvases (original and transformed).
491
- * @param original - The original full-frame canvas (for upload)
492
- * @param transformed - The transformed canvas (for preview)
493
- */
494
- setCapturedCanvases(original, transformed) {
495
- this.originalCapturedCanvas = original;
496
- this.capturedCanvas = transformed;
497
- }
498
- reset() {
499
- super.reset();
500
- this.lastProcessResult = null;
501
- this.capturedCanvas = null;
502
- this.originalCapturedCanvas = null;
438
+ };
439
+ const imageFileToDataUrl = async (file, options = {}) => {
440
+ if (!canNormalizeImageFile(file)) return readFileAsDataUrl(file);
441
+ try {
442
+ return await fileToCanvasDataUrl(file, options);
443
+ } catch {
444
+ return readFileAsDataUrl(file);
503
445
  }
504
446
  };
505
447
 
@@ -738,7 +680,7 @@ function preloadIdRecordingProvider(config) {
738
680
  preloadOpenViduProvider();
739
681
  }
740
682
  async function createOpenViduRecordingProvider() {
741
- const { OpenViduRecordingProvider } = await import("./OpenViduRecordingProvider-O4GjBseO.esm.js");
683
+ const { OpenViduRecordingProvider } = await import("./OpenViduRecordingProvider-B_0GKkzc.esm.js");
742
684
  return new OpenViduRecordingProvider();
743
685
  }
744
686
  async function startRecordingSession(params) {
@@ -811,96 +753,49 @@ async function uploadManualIdFile(params) {
811
753
  return res.data;
812
754
  }
813
755
 
814
- //#endregion
815
- //#region src/modules/id/manualUpload/manualUploadErrors.ts
816
- /**
817
- * i18n keys for manual-upload user-facing error copy.
818
- * Keep in sync with `packages/ui/src/i18n/**.json` under the `manualIdUpload.*` namespace.
819
- */
820
- const MANUAL_UPLOAD_ERROR_KEYS = {
821
- wrongSide: "manualIdUpload.wrongSide",
822
- wrongDocument: "manualIdUpload.wrongDocument",
823
- fileTooBig: "manualIdUpload.fileTooBig",
824
- generic: "manualIdUpload.generic",
825
- lowSharpness: "manualIdUpload.lowSharpness",
826
- glareDetected: "manualIdUpload.glareDetected",
827
- readabilityIssue: "manualIdUpload.readabilityIssue"
828
- };
829
- /**
830
- * Map the server's `failReason` (plus client-side passport/ID tab mismatch and
831
- * per-image quality flags) onto an i18n key. Mirrors v1's `shouldUploadAgain`
832
- * branch logic in
833
- * `ms-incodesmile-web/packages/incode-welcome/src/manualIdUpload/manuaIdUpload.tsx`,
834
- * extended to also reject responses where the backend flagged a per-image
835
- * quality issue (`correctSharpness`, `correctGlare`, or `readability`).
836
- * `idQualityAttemptApproved` is intentionally ignored — v1 did not treat it
837
- * as a manual-upload rejection signal.
838
- *
839
- * Quality flags are checked with `=== false` so missing/undefined values
840
- * (older backends, partial payloads) keep the legacy "trust the server"
841
- * behaviour and do not produce false positives.
842
- *
843
- * Returns `null` when the response represents a successful upload — the caller
844
- * should treat `null` as "no error, advance to next slot".
845
- */
846
- function mapFailReasonToErrorKey(response, expectedTab) {
847
- const failReason = response.failReason;
848
- if (failReason === "WRONG_DOCUMENT_SIDE") return MANUAL_UPLOAD_ERROR_KEYS.wrongSide;
849
- if (failReason === "WRONG_ONE_SIDED_DOCUMENT" || failReason === "UNKNOWN_DOCUMENT_TYPE") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
850
- if (failReason === "ID_TYPE_UNACCEPTABLE") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
851
- if (expectedTab === "passport" && response.typeOfId && response.typeOfId.toLowerCase() !== "passport") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
852
- if (expectedTab === "id" && response.typeOfId?.toLowerCase() === "passport") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
853
- if (response.correctSharpness === false) return MANUAL_UPLOAD_ERROR_KEYS.lowSharpness;
854
- if (response.correctGlare === false) return MANUAL_UPLOAD_ERROR_KEYS.glareDetected;
855
- if (response.readability === false) return MANUAL_UPLOAD_ERROR_KEYS.readabilityIssue;
856
- return null;
857
- }
858
-
859
756
  //#endregion
860
757
  //#region src/modules/id/manualUpload/manualUploadServices.ts
861
- /**
862
- * Read a File's bytes and return the raw base64 payload (the portion after
863
- * `data:<mime>;base64,`). The backend's `/omni/add/*-id/v2` endpoints reject
864
- * full data-URLs with `IllegalArgumentException: Illegal base64 character 3a`,
865
- * so the prefix must be stripped before posting. Mirrors the live-camera
866
- * path in `packages/infra/src/media/canvas.ts:getBase64Image()`.
867
- */
868
- function fileToBase64Payload(file) {
869
- return new Promise((resolve, reject) => {
870
- const reader = new FileReader();
871
- reader.onload = () => {
872
- const result = reader.result;
873
- if (typeof result !== "string") {
874
- reject(/* @__PURE__ */ new Error("FileReader produced non-string result"));
875
- return;
876
- }
877
- const commaIndex = result.indexOf(",");
878
- resolve(commaIndex === -1 ? result : result.slice(commaIndex + 1));
879
- };
880
- reader.onerror = () => {
881
- reject(reader.error ?? /* @__PURE__ */ new Error("FileReader failed"));
882
- };
883
- reader.readAsDataURL(file);
884
- });
885
- }
758
+ const stripDataUrlPrefix = (dataUrl) => {
759
+ const commaIndex = dataUrl.indexOf(",");
760
+ return commaIndex === -1 ? dataUrl : dataUrl.slice(commaIndex + 1);
761
+ };
762
+ const getBase64PayloadByteLength = (payload) => {
763
+ const normalized = payload.replace(/\s/g, "");
764
+ let padding = 0;
765
+ if (normalized.endsWith("==")) padding = 2;
766
+ else if (normalized.endsWith("=")) padding = 1;
767
+ return Math.max(0, Math.floor(normalized.length * 3 / 4) - padding);
768
+ };
769
+ const isBase64PayloadWithinSize = (payload, maxBytes) => getBase64PayloadByteLength(payload) <= maxBytes;
770
+ const fileToBase64Payload = async (file) => {
771
+ return stripDataUrlPrefix(await imageFileToDataUrl(file));
772
+ };
886
773
 
887
774
  //#endregion
888
775
  //#region src/modules/id/manualUpload/manualUploadStateMachine.ts
889
776
  const uploadManualFileActor = fromPromise(async ({ input, signal }) => {
890
777
  const base64Image = await fileToBase64Payload(input.file);
891
- return uploadManualIdFile({
892
- side: input.side,
893
- base64Image,
894
- retry: input.retry,
895
- onlyFront: input.onlyFront,
896
- isSecondId: input.isSecondId,
897
- extractIdFace: input.extractIdFace,
898
- signal
899
- });
778
+ if (!isBase64PayloadWithinSize(base64Image, MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES)) return { type: "fileTooLarge" };
779
+ return {
780
+ type: "uploaded",
781
+ response: await uploadManualIdFile({
782
+ side: input.side,
783
+ base64Image,
784
+ retry: input.retry,
785
+ onlyFront: input.onlyFront,
786
+ isSecondId: input.isSecondId,
787
+ extractIdFace: input.extractIdFace,
788
+ signal
789
+ })
790
+ };
900
791
  });
901
- const getUploadResponseFromEvent = (event) => {
792
+ const getUploadOutputFromEvent = (event) => {
902
793
  if ("output" in event) return event.output;
903
794
  };
795
+ const getUploadResponseFromEvent = (event) => {
796
+ const output = getUploadOutputFromEvent(event);
797
+ return output?.type === "uploaded" ? output.response : void 0;
798
+ };
904
799
  const _manualUploadMachine = setup({
905
800
  types: {
906
801
  context: {},
@@ -958,14 +853,15 @@ const _manualUploadMachine = setup({
958
853
  errorSide: null
959
854
  })),
960
855
  recordSkipBackFromResponse: assign(({ event }) => {
961
- if (!("output" in event)) return {};
962
- if (!event.output.skipBackIdCapture) return {};
856
+ const response = getUploadResponseFromEvent(event);
857
+ if (!response) return {};
858
+ if (!response.skipBackIdCapture) return {};
963
859
  return { skipBackFromServer: true };
964
860
  }),
965
861
  decrementManualUploadRetries: assign(({ context }) => ({ retriesLeft: Math.max(0, context.retriesLeft - 1) })),
966
862
  setManualUploadErrorFromResponse: assign(({ context, event }) => {
967
- if (!("output" in event)) return {};
968
- const response = event.output;
863
+ const response = getUploadResponseFromEvent(event);
864
+ if (!response) return {};
969
865
  return { errorMessage: mapFailReasonToErrorKey(response, context.activeTab) ?? "manualIdUpload.generic" };
970
866
  }),
971
867
  setManualUploadGenericError: assign(() => ({ errorMessage: "manualIdUpload.generic" })),
@@ -1004,7 +900,8 @@ const _manualUploadMachine = setup({
1004
900
  const response = getUploadResponseFromEvent(event);
1005
901
  if (!response) return false;
1006
902
  return mapFailReasonToErrorKey(response, context.activeTab) !== null;
1007
- }
903
+ },
904
+ manualUploadPayloadTooLarge: ({ event }) => getUploadOutputFromEvent(event)?.type === "fileTooLarge"
1008
905
  }
1009
906
  }).createMachine({
1010
907
  id: "manualUpload",
@@ -1078,22 +975,30 @@ const _manualUploadMachine = setup({
1078
975
  isSecondId: context.isSecondId,
1079
976
  extractIdFace: context.extractIdFace
1080
977
  }),
1081
- onDone: [{
1082
- guard: "manualUploadResponseHasError",
1083
- target: "checkRetries",
1084
- actions: [
1085
- "decrementManualUploadRetries",
1086
- "setManualUploadErrorFromResponse",
1087
- "markErrorSideFront"
1088
- ]
1089
- }, {
1090
- target: "selecting",
1091
- actions: [
1092
- "markFrontUploaded",
1093
- "recordSkipBackFromResponse",
1094
- "clearManualUploadError"
1095
- ]
1096
- }],
978
+ onDone: [
979
+ {
980
+ guard: "manualUploadPayloadTooLarge",
981
+ target: "selecting",
982
+ actions: ["setManualUploadFileTooLargeError", "markErrorSideFront"]
983
+ },
984
+ {
985
+ guard: "manualUploadResponseHasError",
986
+ target: "checkRetries",
987
+ actions: [
988
+ "decrementManualUploadRetries",
989
+ "setManualUploadErrorFromResponse",
990
+ "markErrorSideFront"
991
+ ]
992
+ },
993
+ {
994
+ target: "selecting",
995
+ actions: [
996
+ "markFrontUploaded",
997
+ "recordSkipBackFromResponse",
998
+ "clearManualUploadError"
999
+ ]
1000
+ }
1001
+ ],
1097
1002
  onError: {
1098
1003
  target: "checkRetries",
1099
1004
  actions: [
@@ -1113,18 +1018,26 @@ const _manualUploadMachine = setup({
1113
1018
  onlyFront: false,
1114
1019
  isSecondId: context.isSecondId
1115
1020
  }),
1116
- onDone: [{
1117
- guard: "manualUploadResponseHasError",
1118
- target: "checkRetries",
1119
- actions: [
1120
- "decrementManualUploadRetries",
1121
- "setManualUploadErrorFromResponse",
1122
- "markErrorSideBack"
1123
- ]
1124
- }, {
1125
- target: "selecting",
1126
- actions: ["markBackUploaded", "clearManualUploadError"]
1127
- }],
1021
+ onDone: [
1022
+ {
1023
+ guard: "manualUploadPayloadTooLarge",
1024
+ target: "selecting",
1025
+ actions: ["setManualUploadFileTooLargeError", "markErrorSideBack"]
1026
+ },
1027
+ {
1028
+ guard: "manualUploadResponseHasError",
1029
+ target: "checkRetries",
1030
+ actions: [
1031
+ "decrementManualUploadRetries",
1032
+ "setManualUploadErrorFromResponse",
1033
+ "markErrorSideBack"
1034
+ ]
1035
+ },
1036
+ {
1037
+ target: "selecting",
1038
+ actions: ["markBackUploaded", "clearManualUploadError"]
1039
+ }
1040
+ ],
1128
1041
  onError: {
1129
1042
  target: "checkRetries",
1130
1043
  actions: [
@@ -1145,18 +1058,26 @@ const _manualUploadMachine = setup({
1145
1058
  isSecondId: context.isSecondId,
1146
1059
  extractIdFace: context.extractIdFace
1147
1060
  }),
1148
- onDone: [{
1149
- guard: "manualUploadResponseHasError",
1150
- target: "checkRetries",
1151
- actions: [
1152
- "decrementManualUploadRetries",
1153
- "setManualUploadErrorFromResponse",
1154
- "markErrorSidePassport"
1155
- ]
1156
- }, {
1157
- target: "selecting",
1158
- actions: ["markPassportUploaded", "clearManualUploadError"]
1159
- }],
1061
+ onDone: [
1062
+ {
1063
+ guard: "manualUploadPayloadTooLarge",
1064
+ target: "selecting",
1065
+ actions: ["setManualUploadFileTooLargeError", "markErrorSidePassport"]
1066
+ },
1067
+ {
1068
+ guard: "manualUploadResponseHasError",
1069
+ target: "checkRetries",
1070
+ actions: [
1071
+ "decrementManualUploadRetries",
1072
+ "setManualUploadErrorFromResponse",
1073
+ "markErrorSidePassport"
1074
+ ]
1075
+ },
1076
+ {
1077
+ target: "selecting",
1078
+ actions: ["markPassportUploaded", "clearManualUploadError"]
1079
+ }
1080
+ ],
1160
1081
  onError: {
1161
1082
  target: "checkRetries",
1162
1083
  actions: [
@@ -1184,26 +1105,258 @@ const _manualUploadMachine = setup({
1184
1105
  const manualUploadMachine = _manualUploadMachine;
1185
1106
 
1186
1107
  //#endregion
1187
- //#region ../infra/src/wasm/idCaptureDefaults.ts
1108
+ //#region src/modules/id/manualUpload/instrumentation.ts
1188
1109
  /**
1189
- * Default WASM thresholds for ID capture quality checks.
1190
- * Based on legacy pipelinesConfig.ts values.
1110
+ * Maps an ID Manual Upload child-machine snapshot to the exact Figma
1111
+ * "Tracked Events" screen name. Source: ID Manual Upload Figma file
1112
+ * (`https://www.figma.com/design/WCx6d4zXG5nu946mu0KZNO/ID-Manual-Upload---Latest-Design?node-id=2462-18986`).
1113
+ *
1114
+ * Family is `IDmanual.*` — emitted cross-family under the parent
1115
+ * `idCapture` module token (same precedent as `uploadDigitalid.*` from
1116
+ * the digital-upload sub-flow). Manual upload has no standalone manager
1117
+ * or module token of its own.
1118
+ *
1119
+ * The mapper returns Figma-verbatim strings (e.g.
1120
+ * `'IDmanual.upload.uploadedFrontandBack'`) which the adapter emits as-is
1121
+ * on `event.screen`. See `docs/patterns/INSTRUMENTATION.md`.
1122
+ *
1123
+ * In-scope Figma screens (driven from child SM state + context):
1124
+ *
1125
+ * - `IDmanual.upload.default` — selecting, ID tab, no front file yet
1126
+ * - `IDmanual.upload.uploadedFront` — selecting, ID tab, front uploaded,
1127
+ * back still needed
1128
+ * - `IDmanual.upload.uploadedFrontandBack` — selecting, ID tab, both
1129
+ * sides uploaded (or `onlyFront`/`skipBackFromServer` short-circuit)
1130
+ * - `IDmanual.upload.passport` — selecting, passport tab, no file
1131
+ * - `IDmanual.upload.uploadedPassport` — selecting, passport tab,
1132
+ * passport uploaded
1133
+ * - `IDmanual.error.document` — selecting, with a populated
1134
+ * `errorMessage`
1135
+ *
1136
+ * Figma screens intentionally NOT mapped here (parent-level surfaces or
1137
+ * shared with other families):
1138
+ *
1139
+ * - `IDmanual.documentchooser.default` / `IDmanual.howtoverify` —
1140
+ * the chooser and the "how to verify" tutorial are PARENT-LEVEL
1141
+ * `idCapture` surfaces (one shared React component, fired BEFORE the
1142
+ * user picks manual-vs-digital). The Upload Digital ID canvas
1143
+ * describes the same physical pixels under its own family name.
1144
+ * Decision (Option A, recorded in `.cursor/commands/sync-events.md`):
1145
+ * keep emitting the neutral parent names `idCapture.documentchooser`
1146
+ * and `idCapture.tutorial.{front,back,passport}` and treat the
1147
+ * per-canvas Figma names as design-side aliases. Per-flow attribution
1148
+ * would require a `selectedDocumentType`-aware override at the parent
1149
+ * dispatcher — explicitly NOT shipped here.
1150
+ * - `digitalID.success.default` — appears on the canvas for reference,
1151
+ * but the actual success surface is emitted by `mapDigitalIdScreenName`
1152
+ * as `uploadDigitalid.success.default`. Manual upload has no dedicated
1153
+ * success screen; `finished` returns control to the parent SM.
1154
+ *
1155
+ * Returns `undefined` for transient (`uploadingFront`/`uploadingBack`/
1156
+ * `uploadingPassport`/`checkRetries`) and terminal (`retriesExhausted`/
1157
+ * `exhausted`/`finished`) states — the parent dispatcher falls back to
1158
+ * its existing default (`idCapture.manualIdUpload`) for those beats.
1191
1159
  */
1192
- const DEFAULT_ID_CAPTURE_THRESHOLDS = {
1193
- blurThreshold: .2,
1194
- blurChangeThreshold: .2,
1195
- glareThreshold: .3,
1196
- clsThreshold: .98,
1197
- sideThreshold: .8,
1198
- iouThreshold: .8,
1199
- idDetectedTimeout: 1e4,
1200
- autocaptureTimeout: 5e3,
1201
- framesAggregationInterval: 3e3
1160
+ function mapIdManualUploadScreenName(value, context) {
1161
+ if (value !== "selecting" || context === void 0) return;
1162
+ if (context.errorMessage !== null) return "IDmanual.error.document";
1163
+ if (context.activeTab === "passport") return context.passportUploaded ? "IDmanual.upload.uploadedPassport" : "IDmanual.upload.passport";
1164
+ if (!context.frontUploaded) return "IDmanual.upload.default";
1165
+ if (context.backUploaded || context.skipBackFromServer || context.onlyFront) return "IDmanual.upload.uploadedFrontandBack";
1166
+ return "IDmanual.upload.uploadedFront";
1167
+ }
1168
+
1169
+ //#endregion
1170
+ //#region src/modules/id/idCaptureGuards.ts
1171
+ const hasShowTutorialGuard = ({ context }) => context.config.showTutorial;
1172
+ const hasAgeAssuranceGuard = ({ context }) => context.config.ageAssurance === true;
1173
+ const hasShowDocumentChooserGuard = ({ context }) => !context.config.onlyBack && (context.config.showDocumentChooserScreen ?? false);
1174
+ const isPermissionGrantedGuard = ({ event }) => {
1175
+ if ("output" in event) return event.output === "granted";
1176
+ return false;
1177
+ };
1178
+ const isReadyForCaptureGuard = ({ context, event }) => {
1179
+ return isReadyForCaptureFromPermission(resolveStoredPermissionResult("output" in event ? event.output : void 0, context.permissionResult), context.config.ds);
1180
+ };
1181
+ const needsMotionPrimeOnlyGuard = ({ context, event }) => {
1182
+ return needsMotionPrimeOnlyFromPermission(resolveStoredPermissionResult("output" in event ? event.output : void 0, context.permissionResult), context.config.ds);
1202
1183
  };
1184
+ const isPermissionDeniedErrorGuard = ({ event }) => {
1185
+ if ("error" in event) {
1186
+ const error = event.error;
1187
+ return error?.name === "NotAllowedError" || error?.name === "PermissionDeniedError";
1188
+ }
1189
+ return false;
1190
+ };
1191
+ const hasStreamGuard = ({ context }) => context.stream !== void 0;
1192
+ const hasAttemptsRemainingGuard = ({ context }) => context.attemptsRemaining > 0;
1193
+ const hasCapturedImageGuard = ({ context }) => {
1194
+ return context.provider?.getCapturedCanvas() !== null;
1195
+ };
1196
+ const hasUploadValidationErrorGuard = ({ context }) => {
1197
+ if (!context.uploadResponse) return false;
1198
+ return validateUploadResponse(context.uploadResponse, {
1199
+ skipGlareFront: context.uploadResponse.skipGlareFront,
1200
+ skipGlareBack: context.uploadResponse.skipGlareBack
1201
+ }) !== void 0;
1202
+ };
1203
+ const isFrontModeGuard = ({ context }) => context.currentMode === "front" || context.currentMode === "passport";
1204
+ /**
1205
+ * `config.onlyFront` from the orchestrated flow JSON is intentionally not
1206
+ * read here: the flow value cannot account for per-document overrides, so the
1207
+ * backend resolves the real policy per document at upload time
1208
+ * (via `skipBackIdCapture` on the upload response). Standalone
1209
+ * `idCaptureManager` consumers that pass `onlyFront: true` directly will
1210
+ * therefore also be ignored — re-wire this guard if that capability is needed
1211
+ * again.
1212
+ */
1213
+ const isOnlyFrontGuard = (_args) => false;
1214
+ const shouldContinueToBackGuard = ({ context }) => {
1215
+ if (context.currentMode !== "front" && context.currentMode !== "passport") return false;
1216
+ if (context.config.onlyBack) return false;
1217
+ if (context.config.usSmartCapture) return false;
1218
+ if (context.uploadResponse?.skipBackIdCapture) return false;
1219
+ return true;
1220
+ };
1221
+ const shouldContinueToFrontGuard = ({ context }) => context.config.usSmartCapture === true && context.currentMode === "back" && context.uploadResponse?.forceFrontIdCapture === true;
1222
+ const hasMandatoryConsentGuard = ({ context }) => context.uploadResponse?.showMandatoryConsent === true;
1223
+ const isDeepsightEnabledGuard = ({ context }) => context.dependencies !== void 0;
1224
+ const isDeepsightReadyGuard = ({ context }) => context.deepsightService !== void 0;
1225
+ const needsDeepsightInitGuard = ({ context }) => context.dependencies !== void 0 && context.deepsightService === void 0 && !context.deepsightInitAttempted;
1226
+ const hasOnlyManualUploadAvailableGuard = ({ context }) => context.availableDocumentTypes.length === 1 && context.availableDocumentTypes[0] === "manualIdUpload";
1227
+ /** No capture option is enabled — the ID module is misconfigured. */
1228
+ const hasNoDocumentTypesAvailableGuard = ({ context }) => context.availableDocumentTypes.length === 0;
1229
+ const isManualIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCUMENT" && event.documentType === "manualIdUpload";
1230
+ const isDigitalIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCUMENT" && event.documentType === "digitalIdUpload";
1231
+ const isUploadExpiredGuard = ({ context }) => context.uploadResponse?.isDocumentExpired === true;
1232
+ /**
1233
+ * Fixed cap on same-side expired retries, intentionally decoupled from the
1234
+ * dashboard-configurable `captureAttempts`.
1235
+ *
1236
+ * Business decision: the expired-ID retry policy is a fixed UX limit ("let the
1237
+ * user try a different ID a bounded number of times"), separate from the
1238
+ * generic capture-quality retry budget. The value `3` and this separation are
1239
+ * prescribed by the ENG-41643 spec — "[WEB] Document FE - Handle Expired ID
1240
+ * Errors on Front and Back ID Capture"
1241
+ * (https://app.notion.com/p/3264c3caef498080a44adf5ab62fcb77): *"Add
1242
+ * `MAX_EXPIRED_FIRST_SIDE_ATTEMPTS = 3` constant"* / *"Allow up to 3 attempts
1243
+ * when expired ID is detected on first side capture"*. SDK V1 implements it as
1244
+ * exactly this hardcoded constant (incode-welcome `Capture.tsx`), independent
1245
+ * of the configured capture-attempts; this restores that parity for ENG-46592
1246
+ * (https://app.notion.com/p/36b4c3caef4980f58f3ee3b1b4e234f2).
1247
+ *
1248
+ * NOTE: ENG-45666's acceptance text says the cap should follow "a specified
1249
+ * number of times if differently set on dashboard/SDK level". That wording
1250
+ * conflicts with the ENG-41643 spec + V1 for the *expired* path specifically;
1251
+ * V1 parity was chosen as source of truth here (see changeset
1252
+ * `eng-46592-r2-expired-id-v1-parity`). The configurable `captureAttempts`
1253
+ * still governs generic (non-expired) capture retries.
1254
+ */
1255
+ const MAX_EXPIRED_FIRST_SIDE_ATTEMPTS = 3;
1256
+ /**
1257
+ * True when *this* expired upload will exhaust the same-side expired budget.
1258
+ * Compares the post-increment count, so the exhaustion branch can be picked in
1259
+ * the same tick that runs `incrementExpiredAttempts`:
1260
+ * - attempt 1 → 0+1=1 (not exhausted)
1261
+ * - attempt 2 → 1+1=2 (not exhausted)
1262
+ * - attempt 3 → 2+1=3 (exhausted, force-back / finish)
1263
+ */
1264
+ const isExpiredAttemptsExhaustedGuard = ({ context }) => context.expiredAttempts + 1 >= MAX_EXPIRED_FIRST_SIDE_ATTEMPTS;
1265
+ const isNotPassportModeGuard = ({ context }) => context.currentMode !== "passport";
1266
+ /**
1267
+ * V1 parity for `shouldApplyAlwaysCaptureBackOverride` — force-redirects to
1268
+ * back capture after expired-front-attempts exhaust, but only when:
1269
+ * - we're on the front side
1270
+ * - `alwaysCaptureBackOfId` is set
1271
+ * - the flow isn't single-side (onlyBack / usSmartCapture)
1272
+ * - the session isn't a Digital ID upload (digital IDs are PDFs — no back
1273
+ * side exists, so the override never applies regardless of config)
1274
+ */
1275
+ const shouldForceBackOnExpiredGuard = ({ context }) => context.currentMode === "front" && context.config.alwaysCaptureBackOfId === true && !context.config.onlyBack && !context.config.usSmartCapture && !context.isDigitalUpload;
1276
+ const wasExpiredFromUploadGuard = ({ context }) => context.expiredFromUpload === true;
1277
+ const shouldSkipProcessIdGuard = ({ context }) => context.skipProcessId === true;
1203
1278
  /**
1204
- * Default model version for ID capture.
1279
+ * Bug 4 fix: when `expiredExhausted` is reached via the per-upload-expired
1280
+ * exhaustion path with a back side captured (or the entire single-side back
1281
+ * flow), we want `processId` to run once on Continue so the backend
1282
+ * processes whatever sides were uploaded. Front-only exhaustion (no back to
1283
+ * process) and the force-back V1 path keep using `setSkipProcessId` instead.
1205
1284
  */
1206
- const DEFAULT_ID_CAPTURE_MODEL_VERSION = "v2";
1285
+ const shouldProcessAfterExhaustionGuard = ({ context }) => context.exhaustedFromUpload === true && context.currentMode === "back" && (context.config.onlyBack === true || context.config.usSmartCapture === true);
1286
+ /**
1287
+ * `processing.onDone` reads this to short-circuit straight to `finished`
1288
+ * after the post-exhaustion `processId` call returns — without it, an
1289
+ * `isDocumentExpired:true` response would loop back to the Expired screen
1290
+ * we just terminated.
1291
+ */
1292
+ const forceFinishAfterProcessingGuard = ({ context }) => context.forceFinishAfterProcessing === true;
1293
+ /**
1294
+ * Cap on the end-of-flow (`processId`) expired path — digital uploads and the
1295
+ * multi-side post-capture process step. This path intentionally still keys off
1296
+ * the dashboard-configurable `config.captureAttempts`, unlike the per-upload
1297
+ * (camera) same-side expired path, which uses the fixed
1298
+ * `MAX_EXPIRED_FIRST_SIDE_ATTEMPTS` (decoupled for V1 parity — see ENG-46592).
1299
+ * The two expired caps are therefore different by design.
1300
+ */
1301
+ const isProcessingExpiredExhaustedGuard = ({ context }) => context.processingExpiredAttempts + 1 >= context.config.captureAttempts;
1302
+ /**
1303
+ * True when capturing the back side of a two-sided (front+back) ID flow.
1304
+ * Used to redirect an expired-back capture to front rather than retrying
1305
+ * the same back side (Figma Story #2.1).
1306
+ * Excludes onlyBack and usSmartCapture — those are single-side back flows
1307
+ * with no front to redirect to.
1308
+ */
1309
+ const isBackModeInMultiSideFlowGuard = ({ context }) => context.currentMode === "back" && !context.config.onlyBack && !context.config.usSmartCapture;
1310
+ /**
1311
+ * True once the user has already been redirected from an expired second-side
1312
+ * (back) capture to the first side (front) for their one extra attempt
1313
+ * (V1's `expiredRedirected`). Used to make the expired-back→front redirect a
1314
+ * one-shot: any subsequent expired upload routes to `expiredExhausted` instead
1315
+ * of redirecting again, so total captures stay within the backend's
1316
+ * max-attempts/OCR cap (ENG-46592 / re-respects ENG-45666).
1317
+ */
1318
+ const wasExpiredRedirectedGuard = ({ context }) => context.expiredRedirected === true;
1319
+
1320
+ //#endregion
1321
+ //#region src/modules/id/idCaptureHelpers.ts
1322
+ /**
1323
+ * Map of config properties received from the backend to adjusted, internal document types.
1324
+ */
1325
+ const DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP = [
1326
+ ["enableId", "id"],
1327
+ ["enablePassport", "passport"],
1328
+ ["manualUploadIdCapture", "manualIdUpload"],
1329
+ ["digitalIdsUpload", "digitalIdUpload"],
1330
+ ["deviceWallet", "digitalId"]
1331
+ ];
1332
+ /**
1333
+ * Returns the list of document types enabled by config for the chooser screen, in display order.
1334
+ * Used to populate chooser state so UI and headless consumers can render the correct options.
1335
+ *
1336
+ * @param config - ID capture configuration (from flow or init)
1337
+ * @returns Array of IdDocumentType values that should be shown in the document type chooser
1338
+ */
1339
+ function getAvailableDocumentTypes(config) {
1340
+ const adjustedDocumentTypes = [];
1341
+ for (const [configProperty, adjustedType] of DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP) if (config[configProperty]) adjustedDocumentTypes.push(adjustedType);
1342
+ return adjustedDocumentTypes;
1343
+ }
1344
+ /**
1345
+ * Which manual-upload tabs to show. Falls back to both tabs when neither
1346
+ * `enableId` nor `enablePassport` is set (no accepted documents).
1347
+ */
1348
+ function getManualUploadTabs(config) {
1349
+ const showIdTab = !!config.enableId;
1350
+ const showPassportTab = !!config.enablePassport;
1351
+ if (!showIdTab && !showPassportTab) return {
1352
+ showIdTab: true,
1353
+ showPassportTab: true
1354
+ };
1355
+ return {
1356
+ showIdTab,
1357
+ showPassportTab
1358
+ };
1359
+ }
1207
1360
 
1208
1361
  //#endregion
1209
1362
  //#region src/modules/id/idCaptureActors.ts
@@ -1507,7 +1660,7 @@ const startRecordingActor = fromPromise(async ({ input }) => {
1507
1660
  });
1508
1661
  const initializeDeepsightSessionActor = fromPromise(async ({ input }) => {
1509
1662
  if (!input.dependencies) return;
1510
- const { loadDeepsightSession } = await import("./deepsightLoader-8tnddNx-.esm.js");
1663
+ const { loadDeepsightSession } = await import("./deepsightLoader-DHSVD776.esm.js");
1511
1664
  return loadDeepsightSession({
1512
1665
  ds: input.ds,
1513
1666
  storage: input.dependencies.storage,
@@ -1765,115 +1918,12 @@ function getCurrentModeFromEvent(context, event) {
1765
1918
  }
1766
1919
 
1767
1920
  //#endregion
1768
- //#region src/modules/id/idCaptureGuards.ts
1769
- const hasShowTutorialGuard = ({ context }) => context.config.showTutorial;
1770
- const hasAgeAssuranceGuard = ({ context }) => context.config.ageAssurance === true;
1771
- const hasShowDocumentChooserGuard = ({ context }) => !context.config.onlyBack && (context.config.showDocumentChooserScreen ?? false);
1772
- const isPermissionGrantedGuard = ({ event }) => {
1773
- if ("output" in event) return event.output === "granted";
1774
- return false;
1775
- };
1776
- const isReadyForCaptureGuard = ({ context, event }) => {
1777
- return isReadyForCaptureFromPermission(resolveStoredPermissionResult("output" in event ? event.output : void 0, context.permissionResult), context.config.ds);
1778
- };
1779
- const needsMotionPrimeOnlyGuard = ({ context, event }) => {
1780
- return needsMotionPrimeOnlyFromPermission(resolveStoredPermissionResult("output" in event ? event.output : void 0, context.permissionResult), context.config.ds);
1781
- };
1782
- const isPermissionDeniedErrorGuard = ({ event }) => {
1783
- if ("error" in event) {
1784
- const error = event.error;
1785
- return error?.name === "NotAllowedError" || error?.name === "PermissionDeniedError";
1786
- }
1787
- return false;
1788
- };
1789
- const hasStreamGuard = ({ context }) => context.stream !== void 0;
1790
- const hasAttemptsRemainingGuard = ({ context }) => context.attemptsRemaining > 0;
1791
- const hasCapturedImageGuard = ({ context }) => {
1792
- return context.provider?.getCapturedCanvas() !== null;
1793
- };
1794
- const hasUploadValidationErrorGuard = ({ context }) => {
1795
- if (!context.uploadResponse) return false;
1796
- return validateUploadResponse(context.uploadResponse, {
1797
- skipGlareFront: context.uploadResponse.skipGlareFront,
1798
- skipGlareBack: context.uploadResponse.skipGlareBack
1799
- }) !== void 0;
1800
- };
1801
- const isFrontModeGuard = ({ context }) => context.currentMode === "front" || context.currentMode === "passport";
1802
- /**
1803
- * `config.onlyFront` from the orchestrated flow JSON is intentionally not
1804
- * read here: the flow value cannot account for per-document overrides, so the
1805
- * backend resolves the real policy per document at upload time
1806
- * (via `skipBackIdCapture` on the upload response). Standalone
1807
- * `idCaptureManager` consumers that pass `onlyFront: true` directly will
1808
- * therefore also be ignored — re-wire this guard if that capability is needed
1809
- * again.
1810
- */
1811
- const isOnlyFrontGuard = (_args) => false;
1812
- const shouldContinueToBackGuard = ({ context }) => {
1813
- if (context.currentMode !== "front" && context.currentMode !== "passport") return false;
1814
- if (context.config.onlyBack) return false;
1815
- if (context.config.usSmartCapture) return false;
1816
- if (context.uploadResponse?.skipBackIdCapture) {
1817
- if (!(context.config.alwaysCaptureBackOfId === true && context.currentMode !== "passport")) return false;
1818
- }
1819
- return true;
1820
- };
1821
- const shouldContinueToFrontGuard = ({ context }) => context.config.usSmartCapture === true && context.currentMode === "back" && context.uploadResponse?.forceFrontIdCapture === true;
1822
- const hasMandatoryConsentGuard = ({ context }) => context.uploadResponse?.showMandatoryConsent === true;
1823
- const isDeepsightEnabledGuard = ({ context }) => context.dependencies !== void 0;
1824
- const isDeepsightReadyGuard = ({ context }) => context.deepsightService !== void 0;
1825
- const needsDeepsightInitGuard = ({ context }) => context.dependencies !== void 0 && context.deepsightService === void 0 && !context.deepsightInitAttempted;
1826
- const hasOnlyManualUploadAvailableGuard = ({ context }) => context.availableDocumentTypes.length === 1 && context.availableDocumentTypes[0] === "manualIdUpload";
1827
- const isManualIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCUMENT" && event.documentType === "manualIdUpload";
1828
- const isDigitalIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCUMENT" && event.documentType === "digitalIdUpload";
1829
- const isUploadExpiredGuard = ({ context }) => context.uploadResponse?.isDocumentExpired === true;
1830
- /**
1831
- * True when *this* expired upload will exhaust the budget. Compares the
1832
- * post-increment count, so the exhaustion branch can be picked in the same
1833
- * tick that runs `incrementExpiredAttempts`. With `captureAttempts=3`:
1834
- * - attempt 1 → 0+1=1 (not exhausted)
1835
- * - attempt 2 → 1+1=2 (not exhausted)
1836
- * - attempt 3 → 2+1=3 (exhausted, force-back / finish)
1837
- */
1838
- const isExpiredAttemptsExhaustedGuard = ({ context }) => context.expiredAttempts + 1 >= context.config.captureAttempts;
1839
- const isNotPassportModeGuard = ({ context }) => context.currentMode !== "passport";
1840
- /**
1841
- * V1 parity for `shouldApplyAlwaysCaptureBackOverride` — force-redirects to
1842
- * back capture after expired-front-attempts exhaust, but only when:
1843
- * - we're on the front side
1844
- * - `alwaysCaptureBackOfId` is set
1845
- * - the flow isn't single-side (onlyBack / usSmartCapture)
1846
- * - the session isn't a Digital ID upload (digital IDs are PDFs — no back
1847
- * side exists, so the override never applies regardless of config)
1848
- */
1849
- const shouldForceBackOnExpiredGuard = ({ context }) => context.currentMode === "front" && context.config.alwaysCaptureBackOfId === true && !context.config.onlyBack && !context.config.usSmartCapture && !context.isDigitalUpload;
1850
- const wasExpiredFromUploadGuard = ({ context }) => context.expiredFromUpload === true;
1851
- const shouldSkipProcessIdGuard = ({ context }) => context.skipProcessId === true;
1852
- /**
1853
- * Bug 4 fix: when `expiredExhausted` is reached via the per-upload-expired
1854
- * exhaustion path with a back side captured (or the entire single-side back
1855
- * flow), we want `processId` to run once on Continue so the backend
1856
- * processes whatever sides were uploaded. Front-only exhaustion (no back to
1857
- * process) and the force-back V1 path keep using `setSkipProcessId` instead.
1858
- */
1859
- const shouldProcessAfterExhaustionGuard = ({ context }) => context.exhaustedFromUpload === true && context.currentMode === "back";
1860
- /**
1861
- * `processing.onDone` reads this to short-circuit straight to `finished`
1862
- * after the post-exhaustion `processId` call returns — without it, an
1863
- * `isDocumentExpired:true` response would loop back to the Expired screen
1864
- * we just terminated.
1865
- */
1866
- const forceFinishAfterProcessingGuard = ({ context }) => context.forceFinishAfterProcessing === true;
1921
+ //#region src/modules/id/idCaptureStateMachine.ts
1867
1922
  /**
1868
- * Cap on the end-of-flow expired path. All capture types (camera, digital,
1869
- * manual) share `config.captureAttempts` for consistency the user-visible
1870
- * "X attempts remaining" counter is the same regardless of how the document
1871
- * was submitted.
1923
+ * Shown/logged when an ID capture module has no accepted documents and no
1924
+ * other capture option enabledthere is nothing to capture (ENG-43983).
1872
1925
  */
1873
- const isProcessingExpiredExhaustedGuard = ({ context }) => context.processingExpiredAttempts + 1 >= context.config.captureAttempts;
1874
-
1875
- //#endregion
1876
- //#region src/modules/id/idCaptureStateMachine.ts
1926
+ const ID_CAPTURE_NO_DOCUMENT_TYPES_ERROR = "ID capture module has no accepted documents and no capture option enabled";
1877
1927
  function getIdErrorCodeFromUnknown(error) {
1878
1928
  if (error instanceof Error) {
1879
1929
  const message = error.message;
@@ -2069,6 +2119,7 @@ const _idCaptureMachine = setup({
2069
2119
  setSkipProcessId: assign({ skipProcessId: () => true }),
2070
2120
  setExpiredFromUpload: assign({ expiredFromUpload: () => true }),
2071
2121
  setExhaustedFromUpload: assign({ exhaustedFromUpload: () => true }),
2122
+ setExpiredRedirected: assign({ expiredRedirected: () => true }),
2072
2123
  setForceFinishAfterProcessing: assign({ forceFinishAfterProcessing: () => true }),
2073
2124
  clearExpiredFromUpload: assign({ expiredFromUpload: () => false })
2074
2125
  },
@@ -2093,6 +2144,7 @@ const _idCaptureMachine = setup({
2093
2144
  isDeepsightReady: isDeepsightReadyGuard,
2094
2145
  needsDeepsightInit: needsDeepsightInitGuard,
2095
2146
  hasOnlyManualUploadAvailable: hasOnlyManualUploadAvailableGuard,
2147
+ hasNoDocumentTypesAvailable: hasNoDocumentTypesAvailableGuard,
2096
2148
  isManualIdUploadSelected: isManualIdUploadSelectedGuard,
2097
2149
  isDigitalIdUploadSelected: isDigitalIdUploadSelectedGuard,
2098
2150
  isUploadExpired: isUploadExpiredGuard,
@@ -2104,6 +2156,8 @@ const _idCaptureMachine = setup({
2104
2156
  isProcessingExpiredExhausted: isProcessingExpiredExhaustedGuard,
2105
2157
  shouldProcessAfterExhaustion: shouldProcessAfterExhaustionGuard,
2106
2158
  forceFinishAfterProcessing: forceFinishAfterProcessingGuard,
2159
+ isBackModeInMultiSideFlow: isBackModeInMultiSideFlowGuard,
2160
+ wasExpiredRedirected: wasExpiredRedirectedGuard,
2107
2161
  isManualUploadExhausted: ({ event }) => event.output?.result === "exhausted",
2108
2162
  isDigitalUploadExhausted: ({ event }) => event.output?.result === "exhausted",
2109
2163
  isDigitalUploadSuccessful: ({ event }) => event.output?.result === "success"
@@ -2130,6 +2184,7 @@ const _idCaptureMachine = setup({
2130
2184
  recordingSession: void 0,
2131
2185
  attemptsRemaining: input.config.captureAttempts,
2132
2186
  expiredAttempts: 0,
2187
+ expiredRedirected: false,
2133
2188
  processingExpiredAttempts: 0,
2134
2189
  skipProcessId: input.config.skipProcessId === true,
2135
2190
  expiredFromUpload: false,
@@ -2163,6 +2218,11 @@ const _idCaptureMachine = setup({
2163
2218
  },
2164
2219
  states: {
2165
2220
  idle: { on: { LOAD: [
2221
+ {
2222
+ target: "error",
2223
+ guard: "hasNoDocumentTypesAvailable",
2224
+ actions: [() => console.error(ID_CAPTURE_NO_DOCUMENT_TYPES_ERROR), assign({ error: () => ID_CAPTURE_NO_DOCUMENT_TYPES_ERROR })]
2225
+ },
2166
2226
  {
2167
2227
  target: "manualIdUpload",
2168
2228
  guard: "hasOnlyManualUploadAvailable"
@@ -2659,6 +2719,15 @@ const _idCaptureMachine = setup({
2659
2719
  target: "#idCapture.finished",
2660
2720
  guard: and(["shouldSkipProcessId", "isUploadExpired"])
2661
2721
  },
2722
+ {
2723
+ target: "#idCapture.expiredExhausted",
2724
+ guard: and([
2725
+ "isNotPassportMode",
2726
+ "isUploadExpired",
2727
+ "wasExpiredRedirected"
2728
+ ]),
2729
+ actions: ["setExhaustedFromUpload"]
2730
+ },
2662
2731
  {
2663
2732
  target: "#idCapture.expiredExhausted",
2664
2733
  guard: and([
@@ -2858,6 +2927,20 @@ const _idCaptureMachine = setup({
2858
2927
  }
2859
2928
  },
2860
2929
  expired: { on: { RETRY_CAPTURE: [
2930
+ {
2931
+ target: "#idCapture.backFinished",
2932
+ guard: and([
2933
+ "wasExpiredFromUpload",
2934
+ "isBackModeInMultiSideFlow",
2935
+ not("wasExpiredRedirected")
2936
+ ]),
2937
+ actions: [
2938
+ "resetDetection",
2939
+ "clearExpiredFromUpload",
2940
+ "clearUploadFailure",
2941
+ "setExpiredRedirected"
2942
+ ]
2943
+ },
2861
2944
  {
2862
2945
  target: "#idCapture.capture",
2863
2946
  guard: "wasExpiredFromUpload",
@@ -2887,22 +2970,25 @@ const _idCaptureMachine = setup({
2887
2970
  actions: "resetContext"
2888
2971
  }
2889
2972
  ] } },
2890
- expiredExhausted: { on: { CONTINUE_EXHAUSTED: [
2891
- {
2892
- target: "#idCapture.frontFinished",
2893
- guard: "shouldForceBackOnExpired",
2894
- actions: ["setSkipProcessId"]
2895
- },
2896
- {
2897
- target: "#idCapture.processing",
2898
- guard: "shouldProcessAfterExhaustion",
2899
- actions: ["setForceFinishAfterProcessing"]
2900
- },
2901
- {
2902
- target: "#idCapture.finished",
2903
- actions: ["setSkipProcessId"]
2904
- }
2905
- ] } },
2973
+ expiredExhausted: {
2974
+ entry: "flagIdManualReview",
2975
+ on: { CONTINUE_EXHAUSTED: [
2976
+ {
2977
+ target: "#idCapture.frontFinished",
2978
+ guard: "shouldForceBackOnExpired",
2979
+ actions: ["setSkipProcessId"]
2980
+ },
2981
+ {
2982
+ target: "#idCapture.processing",
2983
+ guard: "shouldProcessAfterExhaustion",
2984
+ actions: ["setForceFinishAfterProcessing"]
2985
+ },
2986
+ {
2987
+ target: "#idCapture.finished",
2988
+ actions: ["setSkipProcessId"]
2989
+ }
2990
+ ] }
2991
+ },
2906
2992
  finished: {
2907
2993
  entry: [
2908
2994
  "stopMediaRecording",
@@ -3009,4 +3095,4 @@ const _idCaptureMachine = setup({
3009
3095
  const idCaptureMachine = _idCaptureMachine;
3010
3096
 
3011
3097
  //#endregion
3012
- export { startRecordingSession as a, uploadIdImage as c, ID_ERROR_CODES as d, MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS as f, mapDigitalIdScreenName as h, processId as i, uploadManualIdFile as l, MANUAL_UPLOAD_MAX_RETRIES as m, initializeIdCapture as n, stopRecording as o, MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES as p, preloadIdRecordingProvider as r, stopStream as s, idCaptureMachine as t, validateUploadResponse as u };
3098
+ export { MANUAL_UPLOAD_MAX_RETRIES as _, initializeIdCapture as a, startRecordingSession as c, uploadIdImage as d, uploadManualIdFile as f, MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES as g, MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS as h, mapIdManualUploadScreenName as i, stopRecording as l, ID_ERROR_CODES as m, getManualUploadTabs as n, preloadIdRecordingProvider as o, validateUploadResponse as p, MAX_EXPIRED_FIRST_SIDE_ATTEMPTS as r, processId as s, idCaptureMachine as t, stopStream as u, mapDigitalIdScreenName as v };