@incodetech/core 2.4.1 → 2.5.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) 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-n9u4dEn_.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-ixfy84ys.d.ts} +13 -4
  16. package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +42 -0
  17. package/dist/{WasmUtilProvider-DtJuBdt-.esm.js → WasmUtilProvider-0xTxgP0R.esm.js} +114 -25
  18. package/dist/WorkerEncoderRecordingProvider-CsDED9UU.esm.js +80 -0
  19. package/dist/addressSearch-Rxm1K67A.esm.js +73 -0
  20. package/dist/{advanceableErrors-q_pfU3Cn.esm.js → advanceableErrors-CxZyPRyh.esm.js} +4 -2
  21. package/dist/ae-signature.d.ts +2 -2
  22. package/dist/ae-signature.esm.js +1 -1
  23. package/dist/antifraud.d.ts +1 -1
  24. package/dist/antifraud.esm.js +2 -2
  25. package/dist/{antifraudManager-DbGCvlJs.d.ts → antifraudManager-BxfCsyA7.d.ts} +3 -3
  26. package/dist/{antifraudManager-CaweCYnY.esm.js → antifraudManager-DKNOi9-z.esm.js} +5 -3
  27. package/dist/{antifraudStateMachine-DRl0UVyA.esm.js → antifraudStateMachine-BJ6PmCsw.esm.js} +3 -3
  28. package/dist/{api-Cz90EHyu.esm.js → api-CZpuJuZl.esm.js} +11 -6
  29. package/dist/{apiError-9Yi8xMeB.esm.js → apiError-CtArBUt-.esm.js} +1 -1
  30. package/dist/attemptCarry-BecGGZK8.esm.js +45 -0
  31. package/dist/authentication.d.ts +3 -3
  32. package/dist/authentication.esm.js +2 -2
  33. package/dist/{authenticationManager-pKQS4fHT.esm.js → authenticationManager-9N3eg3Uh.esm.js} +7 -6
  34. package/dist/{authenticationManager-BIZC55Bi.d.ts → authenticationManager-DRaugLgH.d.ts} +2 -2
  35. package/dist/{authenticationStateMachine-D_DygKtQ.esm.js → authenticationStateMachine-DoK5RKIS.esm.js} +50 -18
  36. package/dist/avatar.d.ts +1 -1
  37. package/dist/backCameraLabel-yda5ugE4.esm.js +67 -0
  38. package/dist/{backCameraStream-CMvXj4X4.esm.js → backCameraStream-DS1oDiUq.esm.js} +12 -107
  39. package/dist/{callback-645_omgz.d.ts → callback-BmjJ1G-5.d.ts} +1 -1
  40. package/dist/{camera-sIa9ceW2.esm.js → camera-E_Kcre4O.esm.js} +15 -23
  41. package/dist/camera.d.ts +2 -2
  42. package/dist/camera.esm.js +1 -1
  43. package/dist/certificate-issuance.d.ts +1 -1
  44. package/dist/certificate-issuance.esm.js +2 -2
  45. package/dist/{certificateIssuanceManager-Dr8A4Lgr.d.ts → certificateIssuanceManager-BcYhxO63.d.ts} +4 -3
  46. package/dist/{certificateIssuanceManager-BfeMv2PU.esm.js → certificateIssuanceManager-DaUklfNj.esm.js} +5 -3
  47. package/dist/{certificateIssuanceStateMachine-Frgjbjw8.esm.js → certificateIssuanceStateMachine-_EQcjGE3.esm.js} +4 -4
  48. package/dist/cnpj-Bl_olpdX.esm.js +79 -0
  49. package/dist/connectivity-BCuEoQ-n.esm.js +114 -0
  50. package/dist/consent.d.ts +1 -1
  51. package/dist/consent.esm.js +2 -2
  52. package/dist/{consentManager-CvEu8h_W.esm.js → consentManager-BPocwpm2.esm.js} +7 -4
  53. package/dist/{consentManager-Ca8FHlC4.d.ts → consentManager-vI6QHkHU.d.ts} +16 -8
  54. package/dist/{consentStateMachine-DJTgN_-1.esm.js → consentStateMachine-DgiIcT9q.esm.js} +22 -9
  55. package/dist/cpf-DDXMTLYr.esm.js +37 -0
  56. package/dist/{createFaceAvatar-lYX0VTYs.d.ts → createFaceAvatar-BimBTONm.d.ts} +1 -1
  57. package/dist/cross-document-data-match.d.ts +1 -1
  58. package/dist/cross-document-data-match.esm.js +1 -1
  59. package/dist/{crossDocumentDataMatchManager-Cu141CE8.esm.js → crossDocumentDataMatchManager-BfA29Aji.esm.js} +6 -4
  60. package/dist/{crossDocumentDataMatchManager-yCWCOzcU.d.ts → crossDocumentDataMatchManager-crZcIUSY.d.ts} +3 -3
  61. package/dist/curp-DZGvefg3.esm.js +14 -0
  62. package/dist/curp-validation.d.ts +1 -1
  63. package/dist/curp-validation.esm.js +2 -2
  64. package/dist/{curpValidationManager-B-z9q5V3.esm.js → curpValidationManager-CbvBDoE1.esm.js} +6 -3
  65. package/dist/{curpValidationManager-C9sqoh9n.d.ts → curpValidationManager-Ci2iVuog.d.ts} +4 -4
  66. package/dist/{curpValidationStateMachine-vDEFLMPw.esm.js → curpValidationStateMachine-BQ8XK2Y3.esm.js} +30 -22
  67. package/dist/custom-fields.d.ts +1 -1
  68. package/dist/custom-fields.esm.js +1 -1
  69. package/dist/custom-watchlist.d.ts +1 -1
  70. package/dist/custom-watchlist.esm.js +2 -2
  71. package/dist/{customFieldsManager-D1ex2cFM.esm.js → customFieldsManager-BRqSCR9R.esm.js} +6 -4
  72. package/dist/{customFieldsManager-CF-cO8ap.d.ts → customFieldsManager-CdWTbsew.d.ts} +3 -3
  73. package/dist/{customWatchlistManager-CTI-SGk0.esm.js → customWatchlistManager-Bd1ooIDB.esm.js} +5 -3
  74. package/dist/{customWatchlistManager-DolUswyR.d.ts → customWatchlistManager-lJrveDS4.d.ts} +3 -3
  75. package/dist/{customWatchlistStateMachine-hmRd0f2I.esm.js → customWatchlistStateMachine-r8nGhyo1.esm.js} +3 -3
  76. package/dist/{deepsightService-C3DVBOZd.esm.js → deepsightLoader-zG373VVx.esm.js} +39 -69
  77. package/dist/definitionSource-Nw0YCbpe.esm.js +221 -0
  78. package/dist/{createCameraCycleOwnership-Dj_LHUvN.esm.js → desktopCameraElection-BKFjsQpO.esm.js} +178 -41
  79. package/dist/device.esm.js +2 -2
  80. package/dist/document-capture.d.ts +3 -3
  81. package/dist/document-capture.esm.js +2 -2
  82. package/dist/{documentCaptureManager-DUJwpKC5.esm.js → documentCaptureManager-BKaJVQxg.esm.js} +30 -20
  83. package/dist/{documentCaptureManager-DkyDtm3Y.d.ts → documentCaptureManager-CoGcEiMK.d.ts} +42 -8
  84. package/dist/{documentCaptureStateMachine-B8i7GnLh.esm.js → documentCaptureStateMachine-BYLb5Azk.esm.js} +107 -58
  85. package/dist/dynamic-forms.d.ts +2 -2
  86. package/dist/dynamic-forms.esm.js +2 -2
  87. package/dist/{dynamicFormsManager-DK_oc5Oy.esm.js → dynamicFormsManager-BfQKWG7a.esm.js} +5 -3
  88. package/dist/{dynamicFormsManager-C0dHs1ty.d.ts → dynamicFormsManager-C45pTncO.d.ts} +4 -4
  89. package/dist/{dynamicFormsStateMachine-CGlIAWZ6.esm.js → dynamicFormsStateMachine-CRq01QNK.esm.js} +4 -4
  90. package/dist/ekyb.d.ts +5 -5
  91. package/dist/ekyb.esm.js +3 -3
  92. package/dist/{ekybManager-BLgkiWXw.esm.js → ekybManager-B489iXyO.esm.js} +5 -3
  93. package/dist/{ekybManager-BaZ_7CEu.d.ts → ekybManager-BflWuTe4.d.ts} +5 -5
  94. package/dist/{ekybStateMachine-BfgOUZMK.esm.js → ekybStateMachine-DZxg8T0H.esm.js} +40 -56
  95. package/dist/ekybUtils-Cw8Ta9Qi.esm.js +140 -0
  96. package/dist/ekyc-prefill.d.ts +17 -0
  97. package/dist/ekyc-prefill.esm.js +3 -0
  98. package/dist/ekyc.d.ts +4 -3
  99. package/dist/ekyc.esm.js +3 -3
  100. package/dist/{ekycManager-DW-ynodd.d.ts → ekycManager-BKVQazAb.d.ts} +49 -7
  101. package/dist/{ekycManager-BO-Lui3t.esm.js → ekycManager-nRT0rxei.esm.js} +39 -16
  102. package/dist/ekycPrefillManager-BXWDF7vT.esm.js +103 -0
  103. package/dist/ekycPrefillManager-DOTl3Y2w.d.ts +566 -0
  104. package/dist/ekycPrefillStateMachine-CuWTVze1.esm.js +687 -0
  105. package/dist/ekycRules-DXP2hqVw.esm.js +479 -0
  106. package/dist/ekycStateMachine-nwJRel2s.esm.js +7897 -0
  107. package/dist/ekycUtils-FcqA6oU4.esm.js +1491 -0
  108. package/dist/electronic-signature.d.ts +1 -1
  109. package/dist/electronic-signature.esm.js +1 -1
  110. package/dist/{electronicSignatureManager-DTSLOvKR.d.ts → electronicSignatureManager-5tYz-a4o.d.ts} +4 -3
  111. package/dist/{electronicSignatureManager-CjKvJ6E-.esm.js → electronicSignatureManager-BcE0XMrN.esm.js} +8 -6
  112. package/dist/email.d.ts +1 -1
  113. package/dist/email.esm.js +2 -2
  114. package/dist/{emailManager-ButFktRm.esm.js → emailManager-Co4jarT1.esm.js} +5 -3
  115. package/dist/{emailManager-Dy6omJVp.d.ts → emailManager-pM7ZPuMa.d.ts} +3 -3
  116. package/dist/{emailStateMachine-BXtlC0NV.esm.js → emailStateMachine-CTEaYncs.esm.js} +34 -22
  117. package/dist/events-CP3yOzAl.esm.js +299 -0
  118. package/dist/events.d.ts +3 -1
  119. package/dist/events.esm.js +2 -1
  120. package/dist/extensibility.d.ts +43 -41
  121. package/dist/extensibility.esm.js +39 -37
  122. package/dist/{externalFetch-DrR9xshk.esm.js → externalFetch-CQY41QT1.esm.js} +4 -1
  123. package/dist/face-match.d.ts +1 -1
  124. package/dist/face-match.esm.js +2 -2
  125. package/dist/{faceCaptureManagerFactory-BDGhg24q.esm.js → faceCaptureManagerFactory-BBQzNrku.esm.js} +17 -6
  126. package/dist/{faceCaptureManagerFactory-1hzeS_rB.d.ts → faceCaptureManagerFactory-CRGajjZ4.d.ts} +84 -72
  127. package/dist/{faceCaptureSetup-CvGYG4GZ.esm.js → faceCaptureSetup-D8_ilXFc.esm.js} +117 -482
  128. package/dist/{faceMatchManager-DIgG-UFS.d.ts → faceMatchManager-C5b5WtcY.d.ts} +23 -7
  129. package/dist/{faceMatchManager-DWFUQjMQ.esm.js → faceMatchManager-CGmNGbov.esm.js} +5 -3
  130. package/dist/{faceMatchStateMachine-CUCvlydD.esm.js → faceMatchStateMachine-BuHt7kec.esm.js} +68 -29
  131. package/dist/{feature-management-D4ne_hXW.esm.js → feature-management-SIBmKJs8.esm.js} +35 -21
  132. package/dist/feature-management.esm.js +1 -1
  133. package/dist/field-comparison.d.ts +1 -1
  134. package/dist/field-comparison.esm.js +1 -1
  135. package/dist/{fieldComparisonManager-v3knTYV_.esm.js → fieldComparisonManager-VgCU4X96.esm.js} +6 -4
  136. package/dist/{fieldComparisonManager-CUX4gza2.d.ts → fieldComparisonManager-mFOHRhVd.d.ts} +3 -3
  137. package/dist/fiscal-qr.d.ts +1 -1
  138. package/dist/fiscal-qr.esm.js +1 -1
  139. package/dist/{fiscalQrManager-D0Iy7EKR.d.ts → fiscalQrManager-DFnFVpP9.d.ts} +3 -3
  140. package/dist/{fiscalQrManager-Dt9fHG7h.esm.js → fiscalQrManager-DOLq45ph.esm.js} +8 -6
  141. package/dist/flow-events.d.ts +1 -1
  142. package/dist/flow.d.ts +75 -24
  143. package/dist/flow.esm.js +288 -70
  144. package/dist/{flowCompletionService-Cemwaa5b.esm.js → flowCompletionService-BFCddN3G.esm.js} +24 -3
  145. package/dist/{flowServices-X6Rwf_7E.esm.js → flowServices-NX4ksmS5.esm.js} +447 -183
  146. package/dist/geolocation.d.ts +1 -1
  147. package/dist/geolocation.esm.js +2 -2
  148. package/dist/{geolocationManager-Dn24g1fl.d.ts → geolocationManager-CENrvxpK.d.ts} +19 -20
  149. package/dist/{geolocationManager-B0dc5rW9.esm.js → geolocationManager-D1Ga7_lB.esm.js} +9 -9
  150. package/dist/{geolocationStateMachine-B3rcoODF.esm.js → geolocationStateMachine-oPgI5FIQ.esm.js} +14 -10
  151. package/dist/{getDeviceClass-bsWdEDxP.esm.js → getDeviceClass-DoIWuKI8.esm.js} +1 -1
  152. package/dist/government-validation.d.ts +1 -1
  153. package/dist/government-validation.esm.js +2 -2
  154. package/dist/{governmentValidationManager-BtXWHICu.esm.js → governmentValidationManager-6JQQkzha.esm.js} +5 -3
  155. package/dist/{governmentValidationManager-B82zOut8.d.ts → governmentValidationManager-De_vU7bm.d.ts} +4 -4
  156. package/dist/{governmentValidationStateMachine-COL-Vs48.esm.js → governmentValidationStateMachine-wBunpfQ9.esm.js} +3 -3
  157. package/dist/home.d.ts +4 -3
  158. package/dist/home.esm.js +4 -2
  159. package/dist/http.esm.js +1 -1
  160. package/dist/id-ocr.d.ts +2 -2
  161. package/dist/id-ocr.esm.js +3 -19
  162. package/dist/id-selfie-flow.d.ts +6 -5
  163. package/dist/id-selfie-flow.esm.js +13 -11
  164. package/dist/id-verification.d.ts +1 -1
  165. package/dist/id-verification.esm.js +2 -2
  166. package/dist/id.d.ts +4 -17
  167. package/dist/id.esm.js +4 -4
  168. package/dist/{idCaptureDefaults-BGsG2OAs.esm.js → idCaptureDefaults-Drh207VJ.esm.js} +3 -3
  169. package/dist/{idCaptureManager-0M02hSuC.d.ts → idCaptureManager-Cqx2y_fC.d.ts} +76 -12
  170. package/dist/{idCaptureManager-IouAnrFm.esm.js → idCaptureManager-DjZyIbxc.esm.js} +68 -19
  171. package/dist/{idCaptureServices-VTKIPSpT.esm.js → idCaptureServices-DWs9Fb58.esm.js} +29 -198
  172. package/dist/{idCaptureStateMachine-_Pn2Xkpb.esm.js → idCaptureStateMachine-BGMkWF9t.esm.js} +961 -553
  173. package/dist/idOcrCpfUtils-D5Gwskxu.esm.js +18 -0
  174. package/dist/{idOcrManager-DT3kPIB3.d.ts → idOcrManager-DflRx-_u.d.ts} +6 -5
  175. package/dist/{idOcrManager-D3-HNMXP.esm.js → idOcrManager-im7VfJQi.esm.js} +5 -3
  176. package/dist/{idOcrStateMachine-DyENX6Ki.esm.js → idOcrStateMachine-B832arAl.esm.js} +11 -10
  177. package/dist/{idVerificationManager-BJapZfpy.d.ts → idVerificationManager-B6R8xNZq.d.ts} +4 -3
  178. package/dist/{idVerificationManager-iWz7Avkr.esm.js → idVerificationManager-PMGM4hXY.esm.js} +5 -3
  179. package/dist/{idVerificationStateMachine-CL1kUdBe.esm.js → idVerificationStateMachine-DeeugC00.esm.js} +3 -3
  180. package/dist/identity-reuse.d.ts +2 -2
  181. package/dist/identity-reuse.esm.js +2 -2
  182. package/dist/identity-search.d.ts +97 -0
  183. package/dist/identity-search.esm.js +97 -0
  184. package/dist/{identityReuseManager-ooAbp6Kc.d.ts → identityReuseManager-C40ngKeM.d.ts} +86 -19
  185. package/dist/{identityReuseManager-CD1ucp1d.esm.js → identityReuseManager-CjFZ7WRa.esm.js} +9 -4
  186. package/dist/{identityReuseStateMachine-DfV81wQC.esm.js → identityReuseStateMachine-CLFjPp13.esm.js} +22 -25
  187. package/dist/index-DHuAkTe0.d.ts +1 -0
  188. package/dist/{index-CKQ9QBZP.d.ts → index-DxYNO94y.d.ts} +2 -2
  189. package/dist/index.d.ts +1 -1
  190. package/dist/index.esm.js +1 -1
  191. package/dist/{invokeOnCaptureCallback-DYrkOXO6.esm.js → invokeOnCaptureCallback-lXP41N7b.esm.js} +1 -1
  192. package/dist/kyb-checks.d.ts +3 -0
  193. package/dist/kyb-checks.esm.js +3 -0
  194. package/dist/kybChecksManager-B7Di9auB.d.ts +95 -0
  195. package/dist/kybChecksManager-eRU3ht0m.esm.js +90 -0
  196. package/dist/kybChecksStateMachine-CU0oIYDR.esm.js +720 -0
  197. package/dist/mandatory-consent.d.ts +2 -2
  198. package/dist/mandatory-consent.esm.js +2 -2
  199. package/dist/{mandatoryConsentManager-qYojnZYg.d.ts → mandatoryConsentManager-C1B2ERZk.d.ts} +28 -11
  200. package/dist/{mandatoryConsentManager-Cwqx1nK7.esm.js → mandatoryConsentManager-Dh3pBhOe.esm.js} +7 -4
  201. package/dist/{mandatoryConsentStateMachine-pXWqAHo_.esm.js → mandatoryConsentStateMachine-BjuI72HZ.esm.js} +32 -13
  202. package/dist/mediaRecorderOptions-g1TwTlhd.esm.js +87 -0
  203. package/dist/multipartRecordingService-WgK8ieRI.esm.js +407 -0
  204. package/dist/{permissionGuards-gcy3U0SL.esm.js → permissionGuards-pcrrqrPR.esm.js} +1 -1
  205. package/dist/{permissionServices-Ca-tSNhT.esm.js → permissionServices-DFJlH7K3.esm.js} +11 -9
  206. package/dist/phone-number.d.ts +7 -1
  207. package/dist/phone-number.esm.js +15 -2
  208. package/dist/phone.d.ts +1 -1
  209. package/dist/phone.esm.js +2 -2
  210. package/dist/phoneFormat-C3q0Ukh4.esm.js +27 -0
  211. package/dist/{phoneManager-BO-LTih5.d.ts → phoneManager-VO1HEoUZ.d.ts} +8 -3
  212. package/dist/{phoneManager-KKUq-Vgo.esm.js → phoneManager-rA7updqF.esm.js} +6 -4
  213. package/dist/phoneServices-CFXcwCFr.esm.js +77 -0
  214. package/dist/{phoneStateMachine-D2QWS2cu.esm.js → phoneStateMachine-DKdY2Scx.esm.js} +56 -84
  215. package/dist/{phoneValidation-DnBcNUNh.esm.js → phoneValidation-OggtfjRt.esm.js} +1 -2
  216. package/dist/{platform-DkcRc9JV.esm.js → platform-aPh7gTWh.esm.js} +15 -1
  217. package/dist/processFaceMatch-B_DkDTE5.esm.js +21 -0
  218. package/dist/qe-signature.d.ts +2 -2
  219. package/dist/qe-signature.esm.js +1 -1
  220. package/dist/recordingService-DxiwS8TV.esm.js +397 -0
  221. package/dist/redirect-to-mobile.d.ts +2 -2
  222. package/dist/redirect-to-mobile.esm.js +2 -2
  223. package/dist/{redirectToMobileManager-uHW3dyuQ.esm.js → redirectToMobileManager-DjsEtWLq.esm.js} +9 -6
  224. package/dist/{redirectToMobileManager-CVsvpVbQ.d.ts → redirectToMobileManager-pT6FiPE7.d.ts} +6 -4
  225. package/dist/{redirectToMobileStateMachine-b-H-ipGM.esm.js → redirectToMobileStateMachine-CMjjUXSu.esm.js} +67 -28
  226. package/dist/resolveForm-DaaQSVWp.esm.js +146 -0
  227. package/dist/{runChildModule-DSpP41Hl.esm.js → runChildModule-CJ_aQO92.esm.js} +9 -7
  228. package/dist/{sdkVersion-DKHwWEyH.esm.js → sdkVersion-C9kbIDeX.esm.js} +1 -1
  229. package/dist/selfie.d.ts +4 -4
  230. package/dist/selfie.esm.js +13 -12
  231. package/dist/{selfieErrorUtils-DoN1KFSQ.esm.js → selfieErrorUtils-DUokfsv4.esm.js} +1 -1
  232. package/dist/{selfieManager-BJdNu_nd.d.ts → selfieManager-DihwheJ6.d.ts} +2 -2
  233. package/dist/{selfieManager-DtQegA6T.esm.js → selfieManager-uJtbzEp9.esm.js} +7 -6
  234. package/dist/{selfieStateMachine-CnCwJZuC.esm.js → selfieStateMachine-CKXAmNkA.esm.js} +5 -5
  235. package/dist/{session-CNUfjlRc.esm.js → session-Bk2K8TEv.esm.js} +77 -9
  236. package/dist/session.d.ts +96 -10
  237. package/dist/session.esm.js +7 -6
  238. package/dist/{sessionInitializer-JM_glXR2.esm.js → sessionInitializer-CUCBGZ_s.esm.js} +359 -115
  239. package/dist/{setup-C5tfWt6W.esm.js → setup-B3a5KQeI.esm.js} +36 -27
  240. package/dist/{setup-YPKTUCY5.d.ts → setup-DpOr8H_l.d.ts} +2 -2
  241. package/dist/signature.d.ts +1 -1
  242. package/dist/signature.esm.js +2 -2
  243. package/dist/{signatureManager-f_dPAGXn.esm.js → signatureManager-BgAja97K.esm.js} +5 -3
  244. package/dist/{signatureManager-BpVt_Jv7.d.ts → signatureManager-daT_8fj_.d.ts} +3 -3
  245. package/dist/{signatureStateMachine-C-nUq_oq.esm.js → signatureStateMachine-CVPmvU2p.esm.js} +3 -3
  246. package/dist/{spawn-D9jgw9pW.d.ts → spawn-COZKetCS.d.ts} +1 -1
  247. package/dist/{stats-BEvexnKC.esm.js → stats-DoByUnTa.esm.js} +1 -1
  248. package/dist/stats.esm.js +1 -1
  249. package/dist/textRules-D4NRinKY.d.ts +41 -0
  250. package/dist/{trueSightService-fLmL_cyg.esm.js → trueSightService-BnQDjqUu.esm.js} +22 -10
  251. package/dist/trust-graph.d.ts +4 -3
  252. package/dist/trust-graph.esm.js +5 -3
  253. package/dist/{types-yPH8lAH-.d.ts → types-9wlf1-GE.d.ts} +3 -3
  254. package/dist/types-B-PIc0en.d.ts +115 -0
  255. package/dist/types-B9C8W01q.d.ts +34 -0
  256. package/dist/{types-0L-eFDmr.d.ts → types-BgRHw-dR.d.ts} +1 -1
  257. package/dist/{types-CJ7Yl9K-.d.ts → types-Bpo97EOh.d.ts} +4 -2
  258. package/dist/{types-BQA7lRDV.d.ts → types-C3rfDzgE.d.ts} +4 -2
  259. package/dist/types-CE1jkHw3.d.ts +6 -0
  260. package/dist/types-CTaL0XJz.d.ts +80 -0
  261. package/dist/{types-BAxn7MpY.d.ts → types-Cpdum4vi.d.ts} +125 -50
  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/{urlUtils-6jsE6rKp.esm.js → urlUtils-eYiyWjh0.esm.js} +4 -1
  270. package/dist/usStates-CwOQ2kAx.esm.js +209 -0
  271. package/dist/video-selfie.d.ts +16 -14
  272. package/dist/video-selfie.esm.js +100 -24
  273. package/dist/{videoSelfieCameraWarmer-BBNKiau1.esm.js → videoSelfieCameraWarmer-CgqaNI-W.esm.js} +26 -27
  274. package/dist/{videoSelfieFlowModuleMachine-BCFVHBQ1.esm.js → videoSelfieFlowModuleMachine-IWdxw1TW.esm.js} +1 -1
  275. package/dist/{videoSelfieStepDetector-CGsTltqB.d.ts → videoSelfieStepDetector-DRrh4P0A.d.ts} +10 -5
  276. package/dist/virtualCameraCheck-eFOm2C9q.esm.js +27 -0
  277. package/dist/{warmup-BO57syF6.d.ts → warmup-BNhIuURi.d.ts} +18 -2
  278. package/dist/{warmup-BElYWRh7.esm.js → warmup-BZOMg303.esm.js} +243 -30
  279. package/dist/wasm.d.ts +9 -3
  280. package/dist/wasm.esm.js +3 -3
  281. package/dist/{wasmDsFlagSync-CYj5LL9z.esm.js → wasmDsFlagSync-DPK7qGgo.esm.js} +1 -1
  282. package/dist/wasmMetadataVersionSync-U8EFUr1T.esm.js +27 -0
  283. package/dist/{wasmWebClient-BjZw_7OB.esm.js → wasmWebClient-CyLCM31e.esm.js} +45 -26
  284. package/dist/watchlist-for-business.d.ts +2 -1
  285. package/dist/watchlist-for-business.esm.js +2 -2
  286. package/dist/watchlist.d.ts +1 -1
  287. package/dist/watchlist.esm.js +2 -2
  288. package/dist/{watchlistForBusinessManager-CZZOFkGl.esm.js → watchlistForBusinessManager-BH6M4kqA.esm.js} +40 -8
  289. package/dist/{watchlistForBusinessManager-B3GDPZrr.d.ts → watchlistForBusinessManager-l7ZERQcV.d.ts} +57 -21
  290. package/dist/watchlistForBusinessStateMachine-BMWm5mcP.esm.js +166 -0
  291. package/dist/{watchlistManager-DXtX94SN.esm.js → watchlistManager-BDaVjzLW.esm.js} +5 -3
  292. package/dist/{watchlistManager-DJQOd8Pw.d.ts → watchlistManager-DQq4GxBO.d.ts} +3 -3
  293. package/dist/{watchlistStateMachine-McALifag.esm.js → watchlistStateMachine-Cx-6QAvu.esm.js} +3 -3
  294. package/dist/workflow.d.ts +234 -45
  295. package/dist/workflow.esm.js +194 -80
  296. package/dist/{xstate-actors.esm-8Gzepa_A.esm.js → xstate-actors.esm-BCcwgosu.esm.js} +1 -1
  297. package/dist/xstate.cjs-D6Ur0X1F.d.ts +7 -0
  298. package/dist/{xstate.esm-DSajW7CJ.esm.js → xstate.esm-CIqUf_i6.esm.js} +1 -125
  299. package/package.json +22 -5
  300. package/dist/Actor-DpTj5PFb.d.ts +0 -1
  301. package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +0 -9
  302. package/dist/addressSearch-DPjIKJrX.esm.js +0 -563
  303. package/dist/cpf-uAZTPUBy.esm.js +0 -61
  304. package/dist/deepsightLoader-sH7920zw.esm.js +0 -55
  305. package/dist/ekycStateMachine-CDnI_NRq.esm.js +0 -1443
  306. package/dist/ekycUtils-zY8CdKJL.esm.js +0 -300
  307. package/dist/index-DpTj5PFb.d.ts +0 -1
  308. package/dist/types-BvLo3U4u.d.ts +0 -134
  309. package/dist/types-zOgZqMni.d.ts +0 -6
  310. package/dist/watchlistForBusinessStateMachine-B66E7jud.esm.js +0 -78
  311. /package/dist/{types-BSBzhHRH2.d.ts → types-BSBzhHRH.d.ts} +0 -0
@@ -1,33 +1,36 @@
1
- import { n as revokeObjectURL, t as getTimestamp } from "./IBrowserEnvironmentCapability-DEaRRk-R.esm.js";
2
- import { l as isGoogleWalletSignedRequestsEnabled, u as BrowserStorageProvider } from "./setup-C5tfWt6W.esm.js";
3
- import { t as WasmUtilProvider } from "./WasmUtilProvider-DtJuBdt-.esm.js";
4
- import { n as eventModuleNames, o as createManagerInstrumentation, s as recordExperimentAssignmentOnce, y as addEvent } from "./events-Du2A4-Qr.esm.js";
5
- import { r as getToken, t as api, u as endpoints } from "./api-Cz90EHyu.esm.js";
6
- import { l as trueSightHintTransition, r as noteTrueSightCaptureActivity, u as trueSightLog, y as isTrueSightTesting } from "./trueSightService-fLmL_cyg.esm.js";
7
- import { t as getDisableIpify } from "./sessionInitializer-JM_glXR2.esm.js";
1
+ import { n as getTimestamp, r as revokeObjectURL } from "./IBrowserEnvironmentCapability-D7JG7ML3.esm.js";
2
+ import { l as isGoogleWalletSignedRequestsEnabled, t as ensureWasmPipelines, u as BrowserStorageProvider } from "./setup-B3a5KQeI.esm.js";
3
+ import { t as WasmUtilProvider } from "./WasmUtilProvider-0xTxgP0R.esm.js";
4
+ import { n as eventModuleNames, v as addEvent } from "./types-DYYMdAGv.esm.js";
5
+ import { r as getToken, t as api, u as endpoints } from "./api-CZpuJuZl.esm.js";
6
+ import { n as recordExperimentAssignmentOnce, t as createManagerInstrumentation } from "./events-CP3yOzAl.esm.js";
7
+ import { l as trueSightHintTransition, r as noteTrueSightCaptureActivity, u as trueSightLog, y as isTrueSightTesting } from "./trueSightService-BnQDjqUu.esm.js";
8
+ import { n as getDisableIpify } from "./sessionInitializer-CUCBGZ_s.esm.js";
8
9
  import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
9
- import { s as exposeExperimentOnce } from "./feature-management-D4ne_hXW.esm.js";
10
- import { t as addDeviceStats } from "./stats-BEvexnKC.esm.js";
11
- import { a as isIOS, s as isIPad, t as isAndroid, u as isMacOsSafari } from "./platform-DkcRc9JV.esm.js";
12
- import "./session-CNUfjlRc.esm.js";
13
- import { c as not, i as assign, l as raise, n as enqueueActions, o as and, r as sendTo, s as createActor, t as setup, u as createManager } from "./xstate.esm-DSajW7CJ.esm.js";
14
- import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-8Gzepa_A.esm.js";
15
- import { n as getUrlSearchParam, t as buildUrlWithSearchParams } from "./urlUtils-6jsE6rKp.esm.js";
16
- import { r as getCameraReacquisitionConstraints } from "./camera-sIa9ceW2.esm.js";
17
- import { i as requestMotionPermission, n as invokeRequestPermissionActor, o as requiresMotionPermissionUserGesture, t as checkPermission } from "./permissionServices-Ca-tSNhT.esm.js";
18
- import { a as flagIdManualReview, n as runProtectedAttempt, o as PROTECTED_CAPTURE_TARGET, r as cameraCycleProvider, t as createCameraCycleOwnership } from "./createCameraCycleOwnership-Dj_LHUvN.esm.js";
10
+ import { s as exposeExperimentOnce } from "./feature-management-SIBmKJs8.esm.js";
11
+ import { t as addDeviceStats } from "./stats-DoByUnTa.esm.js";
12
+ import { a as isIOS, c as isIPhone14OrHigher, f as isSamsungDevice, s as isIPad, t as isAndroid, u as isMacOsSafari } from "./platform-aPh7gTWh.esm.js";
13
+ import "./session-Bk2K8TEv.esm.js";
14
+ import { t as createManager } from "./Manager-BvXAwDv9.esm.js";
15
+ import { c as not, i as assign, l as raise, n as enqueueActions, o as and, r as sendTo, s as createActor, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
16
+ import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-BCcwgosu.esm.js";
17
+ import { n as getUrlSearchParam, t as buildUrlWithSearchParams } from "./urlUtils-eYiyWjh0.esm.js";
18
+ import { s as isCameraDenialErrorName } from "./camera-E_Kcre4O.esm.js";
19
+ import { i as requestMotionPermission, n as invokeRequestPermissionActor, o as requiresMotionPermissionUserGesture, t as checkPermission, u as queryPermission } from "./permissionServices-DFJlH7K3.esm.js";
20
+ import { i as cameraCycleProvider, n as createCameraCycleOwnership, o as flagIdManualReview, r as runProtectedAttempt, s as PROTECTED_CAPTURE_TARGET, t as electDesktopCameraDevice } from "./desktopCameraElection-BKFjsQpO.esm.js";
19
21
  import { t as IncodeCanvas } from "./canvas-BxFzWTt-.esm.js";
20
- import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-gcy3U0SL.esm.js";
21
- import { o as StreamCanvasProcessingSession } from "./multipartRecordingService-CLwrF5wD.esm.js";
22
+ import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-pcrrqrPR.esm.js";
23
+ import { t as carryAttempts } from "./attemptCarry-BecGGZK8.esm.js";
24
+ import { t as StreamCanvasProcessingSession } from "./StreamCanvasProcessingSession-CBnbTnOr.esm.js";
22
25
  import { t as sleep } from "./ITimerCapability-DgdDzp8G.esm.js";
23
26
  import { t as getBrowser } from "./getBrowser-Cbe1C4Tn.esm.js";
24
- import { a as isBackCameraLabel } from "./backCameraStream-CMvXj4X4.esm.js";
27
+ import { t as isBackCameraLabel } from "./backCameraLabel-yda5ugE4.esm.js";
25
28
  import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
26
- import { n as frameSources, r as runVirtualCameraCheck } from "./deepsightService-C3DVBOZd.esm.js";
27
- import { t as getDeviceClass } from "./getDeviceClass-bsWdEDxP.esm.js";
28
- import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-BGsG2OAs.esm.js";
29
- import { C as getIdCameraStream, S as OPTIMIZING_WATCHDOG_MARGIN_MS, _ as ID_ERROR_CODES, a as getRealQualityValue, b as resolveIdCaptureThresholds, c as pauseRecordingForAttempt, d as resumeRecordingAfterPause, f as startRecordingSession, g as validateUploadResponse, h as uploadIdImage, i as finalizeRecordingSession, l as prepareRecordingForCameraRetry, m as stopStream, o as initializeIdCapture, p as stopRecording, r as disposeRecordingSession, s as isSuspendableRecordingSession, t as addBarcode, u as processId, x as CAPTURE_OPTIMIZING, y as resolveCountdownStepMs } from "./idCaptureServices-VTKIPSpT.esm.js";
29
+ import { t as getDeviceClass } from "./getDeviceClass-DoIWuKI8.esm.js";
30
+ import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-Drh207VJ.esm.js";
31
+ import { C as OPTIMIZING_WATCHDOG_MARGIN_MS, S as CAPTURE_OPTIMIZING, _ as validateUploadResponse, a as finalizeRecordingSession, b as resolveCountdownStepMs, c as isSuspendableRecordingSession, d as processId, f as resumeRecordingAfterPause, g as uploadIdImage, h as stopStream, i as disposeRecordingSession, l as pauseRecordingForAttempt, m as stopRecording, n as addBarcode, o as getRealQualityValue, p as startRecordingSession, s as initializeIdCapture, u as prepareRecordingForCameraRetry, v as ID_ERROR_CODES, w as getIdCameraStream, x as resolveIdCaptureThresholds } from "./idCaptureServices-DWs9Fb58.esm.js";
30
32
  import { t as StreamCanvasCapture } from "./StreamCanvasCapture-C9jtgBdT.esm.js";
33
+ import { n as runVirtualCameraCheck, t as frameSources } from "./virtualCameraCheck-eFOm2C9q.esm.js";
31
34
  //#region src/modules/id/digitalUpload/digitalUploadErrors.ts
32
35
  const TERMINAL_FAIL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
33
36
  function isKnownFailReason(reason) {
@@ -550,7 +553,36 @@ const deviceWalletMachine = setup({
550
553
  function resolveWalletPlatform(provider) {
551
554
  if (provider === "apple_web") return "ios";
552
555
  if (provider === "google") return "android";
553
- return isIOS() || isMacOsSafari() || isIPad() ? "ios" : "android";
556
+ return isApplePlatform() ? "ios" : "android";
557
+ }
558
+ /** iOS / iPadOS / macOS Safari — the only platforms Apple Wallet web runs on. */
559
+ function isApplePlatform() {
560
+ return isIOS() || isMacOsSafari() || isIPad();
561
+ }
562
+ /**
563
+ * The wallet family this device *certainly* reaches, for naming it in the UI:
564
+ * `apple` on the Apple platform, `samsung` on a detectable Samsung Android
565
+ * device, `android` on any other Android device. `undefined` when the OS gives
566
+ * no certain answer (desktop Chrome, Windows, Linux). Unlike
567
+ * `resolveWalletPlatform`, which must pick a handshake and so maps every
568
+ * non-Apple browser to Google, this does not guess.
569
+ */
570
+ function resolveWalletDevice() {
571
+ if (isApplePlatform()) return "apple";
572
+ if (isAndroid()) return isSamsungDevice() ? "samsung" : "android";
573
+ }
574
+ /**
575
+ * The device facts the digital-ID funnel filters wallets on: Credentials API
576
+ * availability, the OS wallet the device reaches (the same answer the
577
+ * handshake later launches with) and whether it is a Samsung device.
578
+ * No injected capability reads as "no Credentials API".
579
+ */
580
+ function getDigitalIdPlatformSupport(credentials) {
581
+ return {
582
+ credentialsAvailable: credentials?.isAvailable() ?? false,
583
+ walletPlatform: resolveWalletPlatform(),
584
+ samsungDevice: isSamsungDevice()
585
+ };
554
586
  }
555
587
  //#endregion
556
588
  //#region src/modules/id/deviceWallet/instrumentation.ts
@@ -769,6 +801,580 @@ function renderWallet({ onSuccess, onError, ...actorOptions }) {
769
801
  });
770
802
  }
771
803
  //#endregion
804
+ //#region src/modules/id/digitalIdCountry.ts
805
+ /** Longest the chooser waits for country signals before rendering. */
806
+ const DIGITAL_ID_COUNTRY_DETECTION_TIMEOUT_MS = 1e3;
807
+ /** Upper-cased ISO 3166-1 alpha-2, or `undefined` for anything else. */
808
+ function normalizeCountryCode(value) {
809
+ if (typeof value !== "string") return;
810
+ const code = value.trim().toUpperCase();
811
+ return /^[A-Z]{2}$/.test(code) ? code : void 0;
812
+ }
813
+ /**
814
+ * The region subtags of BCP 47 language tags, in order, deduped. Tags without
815
+ * an explicit alpha-2 region (`sv`, `es-419`) or that do not parse contribute
816
+ * nothing — a bare language is not a country.
817
+ */
818
+ function getLocaleRegions(tags) {
819
+ const regions = [];
820
+ for (const tag of tags) {
821
+ let region;
822
+ try {
823
+ region = new Intl.Locale(tag).region;
824
+ } catch {
825
+ region = void 0;
826
+ }
827
+ const code = normalizeCountryCode(region);
828
+ if (code && !regions.includes(code)) regions.push(code);
829
+ }
830
+ return regions;
831
+ }
832
+ /** Whether any signal is wired at all (otherwise detection is a no-op). */
833
+ function hasCountrySignals(dependencies) {
834
+ if (!dependencies) return false;
835
+ return dependencies.ipCountry !== void 0 || dependencies.locale !== void 0 || dependencies.geolocation !== void 0 && dependencies.reverseGeocodeCountry !== void 0;
836
+ }
837
+ async function detectGpsCountry(dependencies, signal) {
838
+ const { geolocation, reverseGeocodeCountry } = dependencies;
839
+ if (!geolocation || !reverseGeocodeCountry) return;
840
+ if (await queryPermission("geolocation") !== "granted") return;
841
+ return reverseGeocodeCountry(await geolocation.getCurrentPosition(), signal);
842
+ }
843
+ /**
844
+ * Region subtags of the browser languages. A locale capability that throws
845
+ * (e.g. a custom one) is dropped like any other failing signal, so detection
846
+ * still never rejects.
847
+ */
848
+ function readLocaleRegions(locale) {
849
+ if (!locale) return [];
850
+ try {
851
+ return getLocaleRegions(locale.getPreferredLanguages());
852
+ } catch {
853
+ return [];
854
+ }
855
+ }
856
+ /**
857
+ * Collects the country signals and returns their countries, strongest first,
858
+ * deduped (see the module doc for the order). Never rejects: a failing or
859
+ * late signal is dropped.
860
+ */
861
+ async function detectDigitalIdCountries(dependencies, options = {}) {
862
+ const { timeoutMs = DIGITAL_ID_COUNTRY_DETECTION_TIMEOUT_MS, signal } = options;
863
+ const timer = BrowserTimerProvider.getInstance();
864
+ let deadlineHandle;
865
+ const deadline = new Promise((resolve) => {
866
+ deadlineHandle = timer.setTimeout(() => resolve(void 0), timeoutMs);
867
+ });
868
+ const settle = (run) => Promise.race([Promise.resolve().then(run).catch(() => void 0), deadline]);
869
+ try {
870
+ const [gpsCountry, ipCountry] = await Promise.all([settle(() => detectGpsCountry(dependencies, signal)), settle(() => dependencies.ipCountry ? dependencies.ipCountry(signal) : Promise.resolve(void 0))]);
871
+ const localeRegions = readLocaleRegions(dependencies.locale);
872
+ const countries = [];
873
+ for (const candidate of [
874
+ gpsCountry,
875
+ ipCountry,
876
+ ...localeRegions
877
+ ]) {
878
+ const code = normalizeCountryCode(candidate);
879
+ if (code && !countries.includes(code)) countries.push(code);
880
+ }
881
+ return countries;
882
+ } finally {
883
+ if (deadlineHandle !== void 0) timer.clearTimeout(deadlineHandle);
884
+ }
885
+ }
886
+ //#endregion
887
+ //#region src/modules/id/digitalIdRegistry.ts
888
+ /**
889
+ * True when a digital-ID method uses a full-page web-redirect flow (Trinsic
890
+ * iDIN, FTN, itsme, …). Accepts both the module `FlowType` value (`REDIRECT`) and the
891
+ * backend value (`WEB_REDIRECT`). (Lives here rather than in
892
+ * `idCaptureHelpers` to keep the registry free of circular imports; the
893
+ * helpers re-export it.)
894
+ */
895
+ function isRedirectFlowType(flowType) {
896
+ return flowType === "REDIRECT" || flowType === "WEB_REDIRECT";
897
+ }
898
+ const DIGITAL_ID_REGISTRY = {
899
+ mDL: [{
900
+ kind: "incodeWallet",
901
+ documentType: "digitalId"
902
+ }, {
903
+ kind: "trinsicRedirect",
904
+ documentType: "digitalIdRedirect",
905
+ providerId: "trinsic_mdl_placeholder",
906
+ method: "MDL"
907
+ }],
908
+ iDIN: [{
909
+ kind: "trinsicRedirect",
910
+ documentType: "digitalIdRedirect",
911
+ providerId: "trinsic_netherlands_idin",
912
+ method: "IDIN",
913
+ countries: ["NL"]
914
+ }],
915
+ FTN: [{
916
+ kind: "trinsicRedirect",
917
+ documentType: "digitalIdRedirect",
918
+ providerId: "trinsic_finnish_trust_network",
919
+ method: "FTN",
920
+ countries: ["FI"]
921
+ }],
922
+ itsme: [{
923
+ kind: "trinsicRedirect",
924
+ documentType: "digitalIdRedirect",
925
+ providerId: "trinsic_belgium_itsme",
926
+ method: "ITSME",
927
+ countries: ["BE"]
928
+ }],
929
+ SPID: [{
930
+ kind: "trinsicRedirect",
931
+ documentType: "digitalIdRedirect",
932
+ providerId: "trinsic_italy_spid",
933
+ method: "SPID",
934
+ countries: ["IT"]
935
+ }],
936
+ MitID: [{
937
+ kind: "trinsicRedirect",
938
+ documentType: "digitalIdRedirect",
939
+ providerId: "trinsic_denmark_mitid",
940
+ method: "MITID",
941
+ countries: ["DK"]
942
+ }],
943
+ BankIDSweden: [{
944
+ kind: "trinsicRedirect",
945
+ documentType: "digitalIdRedirect",
946
+ providerId: "trinsic_sweden_bankid",
947
+ method: "BANKID_SWEDEN",
948
+ countries: ["SE"]
949
+ }],
950
+ FranceIdentite: [{
951
+ kind: "trinsicRedirect",
952
+ documentType: "digitalIdRedirect",
953
+ providerId: "trinsic_france_identite",
954
+ method: "FRANCE_IDENTITE",
955
+ countries: ["FR"]
956
+ }],
957
+ IdentiteNumerique: [{
958
+ kind: "trinsicRedirect",
959
+ documentType: "digitalIdRedirect",
960
+ providerId: "trinsic_france_identite_numerique",
961
+ method: "IDENTITE_NUMERIQUE",
962
+ countries: ["FR"]
963
+ }],
964
+ LAWallet: [{
965
+ kind: "trinsicRedirect",
966
+ documentType: "digitalIdRedirect",
967
+ providerId: "trinsic_usa_louisiana_wallet",
968
+ method: "LA_WALLET",
969
+ countries: ["US"]
970
+ }],
971
+ DigiLocker: [{
972
+ kind: "trinsicRedirect",
973
+ documentType: "digitalIdRedirect",
974
+ providerId: "trinsic_india_digilocker_aadhaar",
975
+ method: "DIGILOCKER",
976
+ countries: ["IN"]
977
+ }]
978
+ };
979
+ const DIGITAL_ID_DOCUMENT_TYPES = Object.keys(DIGITAL_ID_REGISTRY);
980
+ /**
981
+ * Single place that widens `config.digitalIds` to the shapes the backend
982
+ * actually sends — the mapped array or the raw `{ enabled, methods }` object.
983
+ * Shared so the cast is written once.
984
+ */
985
+ function asDigitalIdsConfig(config) {
986
+ return config.digitalIds;
987
+ }
988
+ /**
989
+ * TODO(test-only): the identity network's test-environment mock providers, one per
990
+ * integration type, for E2E testing — remove before production. Persisted method →
991
+ * provider id only: they are standalone redirect cards, never part of a wallet
992
+ * funnel, so they need no `DigitalIdDocumentType` / `DIGITAL_ID_REGISTRY` entry and
993
+ * stay off the public API. Like every redirect method they render a card only
994
+ * when a flow enables the method in `digitalIds.methods`.
995
+ */
996
+ const TEST_MOCK_REDIRECT_PROVIDER_BY_METHOD = {
997
+ TRINSIC_TEST_REDIRECT: "trinsic_trinsic_test_redirect",
998
+ TRINSIC_TEST_DELAYED_RESULTS: "trinsic_trinsic_test_delayed_results",
999
+ TRINSIC_TEST_SUB_PROVIDERS: "trinsic_trinsic_test_sub_providers",
1000
+ TRINSIC_TEST_DEEPLINK: "trinsic_trinsic_test_deeplink",
1001
+ TRINSIC_TEST_DEEPLINK_REFRESH: "trinsic_trinsic_test_deeplink_refresh",
1002
+ TRINSIC_TEST_SHOW_CONTENT: "trinsic_trinsic_test_show_content",
1003
+ TRINSIC_TEST_SHOW_CONTENT_REFRESH: "trinsic_trinsic_test_show_content_refresh",
1004
+ TRINSIC_TEST_HANDOFF: "trinsic_trinsic_test_handoff",
1005
+ TRINSIC_TEST_OFFLINE: "trinsic_trinsic_test_offline",
1006
+ TRINSIC_MOCK_OUTPUT: "trinsic_trinsic_mock_output"
1007
+ };
1008
+ /**
1009
+ * Persisted method name → catalog provider id, derived from the registry's
1010
+ * Trinsic entries (single source of truth). Lets the SDK launch iDIN / FTN
1011
+ * from a backend that does not yet send `providerId` on each method.
1012
+ * TODO(roadmap: fully-catalog-driven): remove once every backend enriches
1013
+ * `digitalIds.methods[]` with `providerId` + `flowType`.
1014
+ */
1015
+ const REDIRECT_PROVIDER_BY_METHOD = (() => {
1016
+ const map = { ...TEST_MOCK_REDIRECT_PROVIDER_BY_METHOD };
1017
+ for (const docType of DIGITAL_ID_DOCUMENT_TYPES) for (const entry of DIGITAL_ID_REGISTRY[docType]) if (entry.kind === "trinsicRedirect") map[entry.method] = entry.providerId;
1018
+ return map;
1019
+ })();
1020
+ /**
1021
+ * Catalog provider id → the countries it serves, from the registry. Lets the
1022
+ * chooser rank redirect providers by country even when the backend does not enrich
1023
+ * `digitalIds.methods[]` with `countries`.
1024
+ */
1025
+ const REDIRECT_PROVIDER_COUNTRIES = Object.fromEntries(DIGITAL_ID_DOCUMENT_TYPES.flatMap((docType) => DIGITAL_ID_REGISTRY[docType].flatMap((entry) => entry.kind === "trinsicRedirect" && entry.countries ? [[entry.providerId, entry.countries]] : [])));
1026
+ /**
1027
+ * Redirect providers that are the fallback leg of a wallet-first funnel
1028
+ * (mDL): they are reached through the `digitalId` tile's funnel resolution,
1029
+ * not offered as a standalone chooser card.
1030
+ */
1031
+ const WALLET_FUNNEL_REDIRECT_PROVIDER_IDS = new Set(DIGITAL_ID_DOCUMENT_TYPES.flatMap((docType) => {
1032
+ const entries = DIGITAL_ID_REGISTRY[docType];
1033
+ if (!entries.some((entry) => entry.kind === "incodeWallet")) return [];
1034
+ return entries.flatMap((entry) => entry.kind === "trinsicRedirect" ? [entry.providerId] : []);
1035
+ }));
1036
+ /**
1037
+ * True for a redirect provider that gets its own chooser card (iDIN, FTN, any
1038
+ * catalog-enriched redirect method) — as opposed to the mDL wallet fallback,
1039
+ * which only surfaces through the Digital ID tile.
1040
+ */
1041
+ function isStandaloneRedirectProvider(providerId) {
1042
+ return !WALLET_FUNNEL_REDIRECT_PROVIDER_IDS.has(providerId);
1043
+ }
1044
+ /**
1045
+ * The provider id a configured method launches with, when it is a
1046
+ * web-redirect method; `undefined` for wallets / other flow shapes.
1047
+ *
1048
+ * Resolution order:
1049
+ * 1. an explicit redirect `flowType` with a `provider` (mapped shape) or
1050
+ * `providerId` (catalog-enriched raw shape) — backend-authoritative;
1051
+ * 2. otherwise the persisted method name via the registry (legacy raw shape).
1052
+ */
1053
+ function resolveRedirectProviderId(method) {
1054
+ if (method.flowType) {
1055
+ if (!isRedirectFlowType(method.flowType)) return;
1056
+ const explicit = method.provider ?? method.providerId;
1057
+ if (explicit) return explicit;
1058
+ }
1059
+ return method.method ? REDIRECT_PROVIDER_BY_METHOD[method.method.toUpperCase()] : void 0;
1060
+ }
1061
+ /**
1062
+ * Tolerant view over `config.digitalIds`: accepts both the mapped array
1063
+ * (`IdCaptureDigitalIdMethod[]`) and the raw backend object
1064
+ * (`{ enabled, methods: [...] }`). Extracted from the old
1065
+ * `getDigitalIdRedirectMethod` cast so every consumer parses it the same way.
1066
+ *
1067
+ * Honors both dashboard toggles: a raw object with `enabled: false` yields no
1068
+ * methods, and individual methods with `enabled: false` are dropped (absent
1069
+ * `enabled` counts as on). This is what "enabled for the flow / workflow"
1070
+ * means — for the redirect chooser cards as much as for the wallet tile.
1071
+ */
1072
+ function normalizeDigitalIdMethods(config) {
1073
+ const raw = asDigitalIdsConfig(config);
1074
+ if (!Array.isArray(raw) && raw?.enabled === false) return [];
1075
+ return (Array.isArray(raw) ? raw : raw?.methods ?? []).filter((method) => method.enabled !== false);
1076
+ }
1077
+ /**
1078
+ * Persisted method names of the Incode-native device wallets — the backend
1079
+ * `DigitalIdMethodCatalog` entries of type `MDL`. A catalog-enriched method
1080
+ * carries `type: 'MDL'` instead of relying on the name; both are honoured.
1081
+ *
1082
+ * `SAMSUNG_WALLET` is listed by name because the onboarding catalog does not
1083
+ * enrich it yet: it arrives as a bare `{ method: 'SAMSUNG_WALLET' }`. Without
1084
+ * the name it would fall through to the unfiltered `deviceWallet` flag and
1085
+ * skip `WALLET_PLATFORM_RULES`' Samsung-only rule.
1086
+ */
1087
+ const DEVICE_WALLET_METHODS = /* @__PURE__ */ new Set([
1088
+ "APPLE_WALLET",
1089
+ "GOOGLE_WALLET",
1090
+ "CA_DMV_WALLET",
1091
+ "SAMSUNG_WALLET"
1092
+ ]);
1093
+ /**
1094
+ * True for a configured method the native device-wallet handshake can fulfil.
1095
+ * Redirect methods (iDIN, FTN) never count, whatever their name or type — they
1096
+ * must not surface a wallet tile with no wallet behind it.
1097
+ *
1098
+ * Classifies by *kind* only. Whether a method is switched on is already
1099
+ * settled by `normalizeDigitalIdMethods`, which drops disabled methods before
1100
+ * any caller walks the list.
1101
+ */
1102
+ function isDeviceWalletMethod(method) {
1103
+ if (method.flowType && isRedirectFlowType(method.flowType)) return false;
1104
+ if (method.type?.toUpperCase() === "MDL") return true;
1105
+ return method.method !== void 0 && DEVICE_WALLET_METHODS.has(method.method.toUpperCase());
1106
+ }
1107
+ /**
1108
+ * Device-level hard filter per wallet method: a wallet the device cannot reach
1109
+ * is never offered. Apple Wallet needs the Apple platform, Google Wallet any
1110
+ * other, and Samsung Wallet a Samsung device. Methods without a rule (CA DMV
1111
+ * Wallet, an unknown catalog `MDL` method) run on either platform.
1112
+ *
1113
+ * A rule only rejects on a known platform fact, so a caller that omits
1114
+ * `walletPlatform` / `samsungDevice` gets no filtering.
1115
+ */
1116
+ const WALLET_PLATFORM_RULES = {
1117
+ APPLE_WALLET: (platform) => platform.walletPlatform !== "android",
1118
+ GOOGLE_WALLET: (platform) => platform.walletPlatform !== "ios",
1119
+ SAMSUNG_WALLET: (platform) => platform.walletPlatform !== "ios" && platform.samsungDevice !== false
1120
+ };
1121
+ function isDeviceWalletMethodEligible(method, platform) {
1122
+ const rule = method.method !== void 0 ? WALLET_PLATFORM_RULES[method.method.toUpperCase()] : void 0;
1123
+ return rule ? rule(platform) : true;
1124
+ }
1125
+ /**
1126
+ * Whether a device wallet can run for this config on this device: an enabled
1127
+ * wallet method that passes `WALLET_PLATFORM_RULES`, or, when the config lists
1128
+ * no wallet method at all, the legacy `deviceWallet` flag (which names no
1129
+ * wallet, so there is nothing to filter).
1130
+ *
1131
+ * The method list is the authority. The dashboard persists a wallet only in
1132
+ * `digitalIds.methods` and leaves the legacy `deviceWallet` / `appleWallet`
1133
+ * booleans at their stored `false`; the workflow-node response historically
1134
+ * shipped them raw, so reading the list is what keeps the tile visible there
1135
+ * (and matches SDK 1). It also means a config whose only wallet is Apple
1136
+ * Wallet yields `false` on Android even when `deviceWallet` is `true`. Unlike
1137
+ * the backend's `deriveDeviceWalletFlag`, an unrecognised method does not
1138
+ * count as a wallet: it must not launch a handshake that cannot know what to
1139
+ * request.
1140
+ */
1141
+ function hasEligibleDeviceWallet(config, platform) {
1142
+ const walletMethods = normalizeDigitalIdMethods(config).filter(isDeviceWalletMethod);
1143
+ if (walletMethods.length > 0) return walletMethods.some((method) => isDeviceWalletMethodEligible(method, platform));
1144
+ return config.deviceWallet === true;
1145
+ }
1146
+ /** Whether a funnel entry is activated by config + platform capabilities. */
1147
+ function isEntryActive(entry, config, platform) {
1148
+ if (entry.kind === "incodeWallet") return platform.credentialsAvailable && hasEligibleDeviceWallet(config, platform);
1149
+ return findConfiguredMethod(entry, config) !== void 0;
1150
+ }
1151
+ /**
1152
+ * The configured `digitalIds` method matching a Trinsic funnel entry — by
1153
+ * persisted method name, or (mapped shape) by provider id on a redirect
1154
+ * flowType. First match wins; disabled methods are already dropped by
1155
+ * `normalizeDigitalIdMethods`.
1156
+ */
1157
+ function findConfiguredMethod(entry, config) {
1158
+ return normalizeDigitalIdMethods(config).find((method) => method.method?.toUpperCase() === entry.method || method.provider === entry.providerId && !!method.flowType && isRedirectFlowType(method.flowType));
1159
+ }
1160
+ /** Normalizes a raw configured method into the mapped shape for the child input. */
1161
+ function toMappedMethod(entry, method) {
1162
+ if (method.flowType && isRedirectFlowType(method.flowType)) return method;
1163
+ return {
1164
+ method: method.method,
1165
+ provider: entry.providerId,
1166
+ flowType: "WEB_REDIRECT",
1167
+ country: method.country ?? method.countries?.[0],
1168
+ displayName: method.displayName,
1169
+ logoUrl: method.logoUrl
1170
+ };
1171
+ }
1172
+ /**
1173
+ * Resolves the implementation that should fulfil a digital-ID document type:
1174
+ * the first funnel entry that is active under the given config and platform.
1175
+ * `undefined` when nothing can run it (the chooser then shows no tile for it).
1176
+ */
1177
+ function resolveDigitalIdImplementation(docType, config, platform) {
1178
+ for (const entry of DIGITAL_ID_REGISTRY[docType]) {
1179
+ if (!isEntryActive(entry, config, platform)) continue;
1180
+ if (entry.kind === "incodeWallet") return { kind: "incodeWallet" };
1181
+ const method = findConfiguredMethod(entry, config);
1182
+ return {
1183
+ kind: "trinsicRedirect",
1184
+ providerId: entry.providerId,
1185
+ method: method ? toMappedMethod(entry, method) : void 0
1186
+ };
1187
+ }
1188
+ }
1189
+ //#endregion
1190
+ //#region src/modules/id/idCaptureHelpers.ts
1191
+ /**
1192
+ * Normalizes a configured method into the mapped redirect shape for a
1193
+ * resolved provider. The already-mapped shape is returned as-is; the raw
1194
+ * backend shape gets `provider` + `WEB_REDIRECT` filled in.
1195
+ */
1196
+ function toRedirectMethod(method, provider) {
1197
+ if (method.provider && method.flowType) return method;
1198
+ return {
1199
+ method: method.method,
1200
+ provider,
1201
+ flowType: "WEB_REDIRECT",
1202
+ country: method.country ?? method.countries?.[0],
1203
+ displayName: method.displayName,
1204
+ logoUrl: method.logoUrl
1205
+ };
1206
+ }
1207
+ /**
1208
+ * The enabled web-redirect digital-ID method to launch — the one matching
1209
+ * `providerId` when given (a chooser card was picked), else the first
1210
+ * configured redirect method — or `undefined` when none is configured.
1211
+ * Drives the provider and country passed to the `digitalIdRedirectMachine`.
1212
+ *
1213
+ * Accepts both the mapped array (`IdCaptureDigitalIdMethod[]`) and the raw
1214
+ * backend `configuration.digitalIds` object (`{ enabled, methods: [...] }`);
1215
+ * for the raw shape the provider comes from the backend-enriched
1216
+ * `providerId`/`flowType` when present, else from the persisted method name
1217
+ * via the digital-ID registry (`IDIN` → `trinsic_netherlands_idin`).
1218
+ */
1219
+ function getDigitalIdRedirectMethod(config, providerId) {
1220
+ for (const method of normalizeDigitalIdMethods(config)) {
1221
+ const provider = resolveRedirectProviderId(method);
1222
+ if (!provider || providerId !== void 0 && provider !== providerId) continue;
1223
+ return toRedirectMethod(method, provider);
1224
+ }
1225
+ }
1226
+ function collectDigitalIdRedirectOptions(config) {
1227
+ const entries = [];
1228
+ for (const method of normalizeDigitalIdMethods(config)) {
1229
+ const providerId = resolveRedirectProviderId(method);
1230
+ if (!providerId || !isStandaloneRedirectProvider(providerId) || entries.some((entry) => entry.option.providerId === providerId)) continue;
1231
+ const countries = (method.countries ?? (method.country ? [method.country] : void 0) ?? REDIRECT_PROVIDER_COUNTRIES[providerId] ?? []).flatMap((country) => normalizeCountryCode(country) ?? []);
1232
+ entries.push({
1233
+ option: {
1234
+ providerId,
1235
+ method: method.method,
1236
+ displayName: method.displayName,
1237
+ logoUrl: method.logoUrl,
1238
+ country: method.country ?? method.countries?.[0] ?? countries[0]
1239
+ },
1240
+ countries
1241
+ });
1242
+ }
1243
+ return entries;
1244
+ }
1245
+ /**
1246
+ * Rank of an option against the detected countries: the index of the
1247
+ * strongest detected country it serves, `Infinity` when it serves none.
1248
+ */
1249
+ function countryRank(countries, preferredCountries) {
1250
+ const ranks = countries.map((country) => preferredCountries.indexOf(country)).filter((index) => index >= 0);
1251
+ return ranks.length > 0 ? Math.min(...ranks) : Number.POSITIVE_INFINITY;
1252
+ }
1253
+ /**
1254
+ * The digital-ID web-redirect providers that get their own chooser card: one
1255
+ * per enabled redirect method in `config.digitalIds`, deduped by provider.
1256
+ * Wallet-funnel fallbacks (the Trinsic mDL leg) are excluded — they surface
1257
+ * through the Digital ID tile instead.
1258
+ *
1259
+ * Order: providers serving the strongest detected country first
1260
+ * (`preferredCountries`, see `detectDigitalIdCountries`), then those serving
1261
+ * weaker ones, then the rest. Country only ranks — nothing is hidden — and
1262
+ * ties keep backend (dashboard) order. With no detected country this is plain
1263
+ * backend order.
1264
+ *
1265
+ * Card display data (`displayName`, `logoUrl`, `country`) is whatever the
1266
+ * backend enriched the method with; the UI falls back to generic copy / icon
1267
+ * when absent.
1268
+ */
1269
+ function getAvailableDigitalIdRedirectOptions(config, preferredCountries = []) {
1270
+ const entries = collectDigitalIdRedirectOptions(config);
1271
+ if (preferredCountries.length === 0) return entries.map((entry) => entry.option);
1272
+ return entries.map((entry) => ({
1273
+ entry,
1274
+ rank: countryRank(entry.countries, preferredCountries)
1275
+ })).sort((a, b) => a.rank - b.rank).map(({ entry }) => entry.option);
1276
+ }
1277
+ /**
1278
+ * Re-orders the given redirect options for `preferredCountries` without
1279
+ * changing the set: same ranking as `getAvailableDigitalIdRedirectOptions`,
1280
+ * ties in backend order. Each option's countries come from its configured
1281
+ * method (all of them), falling back to the option's own `country`.
1282
+ */
1283
+ function rankDigitalIdRedirectOptions(options, config, preferredCountries) {
1284
+ const entries = collectDigitalIdRedirectOptions(config);
1285
+ const backendIndex = (option) => {
1286
+ const index = entries.findIndex((entry) => entry.option.providerId === option.providerId);
1287
+ return index >= 0 ? index : entries.length;
1288
+ };
1289
+ const countriesOf = (option) => {
1290
+ const configured = entries.find((entry) => entry.option.providerId === option.providerId);
1291
+ const own = normalizeCountryCode(option.country);
1292
+ return configured?.countries ?? (own ? [own] : []);
1293
+ };
1294
+ return options.map((option, position) => ({
1295
+ option,
1296
+ rank: countryRank(countriesOf(option), preferredCountries),
1297
+ order: backendIndex(option),
1298
+ position
1299
+ })).sort((a, b) => a.rank - b.rank || a.order - b.order || a.position - b.position).map(({ option }) => option);
1300
+ }
1301
+ /**
1302
+ * Whether country ranking can change the order of the redirect options: at
1303
+ * least two options serving different countries. When it cannot, the chooser
1304
+ * skips country detection entirely (no request, no wait).
1305
+ */
1306
+ function canRankDigitalIdRedirectOptionsByCountry(config) {
1307
+ const entries = collectDigitalIdRedirectOptions(config);
1308
+ if (entries.length < 2) return false;
1309
+ return new Set(entries.map((entry) => [...entry.countries].sort().join(","))).size > 1;
1310
+ }
1311
+ /**
1312
+ * Map of config properties received from the backend to adjusted, internal document types.
1313
+ */
1314
+ const DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP = [
1315
+ ["enableId", "id"],
1316
+ ["enablePassport", "passport"],
1317
+ ["digitalIdsUpload", "digitalIdUpload"]
1318
+ ];
1319
+ /**
1320
+ * Returns the list of document types enabled by config for the chooser screen, in display order.
1321
+ * Used to populate chooser state so UI and headless consumers can render the correct options.
1322
+ *
1323
+ * Digital-ID document types (device wallet, Trinsic web-redirect) come from
1324
+ * the digital-ID registry funnel: each registry document type contributes the
1325
+ * tile of its first active implementation. A `deviceWallet: true` config on a
1326
+ * platform without the Credentials API therefore shows the Trinsic fallback
1327
+ * tile when one is configured — or no tile at all, instead of a dead-end one.
1328
+ *
1329
+ * @param config - ID capture configuration (from flow or init)
1330
+ * @param platform - Platform capabilities consulted by the digital-ID funnel.
1331
+ * Defaults to no Credentials API for pure-node callers; the machine passes
1332
+ * the real capability check.
1333
+ * @returns Array of IdDocumentType values that should be shown in the document type chooser
1334
+ */
1335
+ function getAvailableDocumentTypes(config, platform = { credentialsAvailable: false }) {
1336
+ const adjustedDocumentTypes = [];
1337
+ for (const [configProperty, adjustedType] of DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP) if (config[configProperty]) adjustedDocumentTypes.push(adjustedType);
1338
+ for (const docType of DIGITAL_ID_DOCUMENT_TYPES) {
1339
+ const route = resolveDigitalIdImplementation(docType, config, platform);
1340
+ if (!route) continue;
1341
+ const documentType = route.kind === "incodeWallet" ? "digitalId" : "digitalIdRedirect";
1342
+ if (!adjustedDocumentTypes.includes(documentType)) adjustedDocumentTypes.push(documentType);
1343
+ }
1344
+ if (!adjustedDocumentTypes.includes("digitalIdRedirect") && getAvailableDigitalIdRedirectOptions(config).length > 0) adjustedDocumentTypes.push("digitalIdRedirect");
1345
+ return adjustedDocumentTypes;
1346
+ }
1347
+ /**
1348
+ * Computes `idCaptureMachine`'s terminal output — the downstream module-skip
1349
+ * signal read by the Flow orchestrator (via `runChildModule`'s `MODULE_COMPLETE`).
1350
+ *
1351
+ * `skipFaceMatch` is set ONLY for the US Smart Capture *camera back-only* path:
1352
+ * a back image was captured on-device (`capturedImages.back`) and no front was
1353
+ * (`!capturedImages.front`) — "no front, no ID face, no match".
1354
+ *
1355
+ * Requiring a captured back is deliberate and load-bearing: the digital-ID
1356
+ * upload path submits a full ID (front face present) but does NOT
1357
+ * populate `capturedImages` (only the camera path does). Gating on a captured
1358
+ * back excludes those upload paths so a real ID-vs-selfie match is never
1359
+ * silently skipped. `capturedImages.front`/`forceFrontIdCapture` alone are not
1360
+ * enough (a later front upload clears the request; uploads set neither field).
1361
+ *
1362
+ * Always `false` outside US Smart Capture. The selfie/face capture itself is
1363
+ * unaffected — only the ID-vs-selfie match is skipped.
1364
+ *
1365
+ * Also `true` on the Digital ID web-redirect (Trinsic iDIN/FTN) COMPLETED path
1366
+ * when the scheme returned no portrait (`isDigitalIdRedirect && !portraitPresent`,
1367
+ * FM-1/FM-2): there is no ID face to match the selfie against.
1368
+ */
1369
+ function computeIdCaptureOutput(context) {
1370
+ const frontIdCaptured = Boolean(context.capturedImages.front);
1371
+ const backIdCaptured = Boolean(context.capturedImages.back);
1372
+ return {
1373
+ frontIdCaptured,
1374
+ skipFaceMatch: context.isDigitalIdRedirect === true && context.portraitPresent !== true || context.config.usSmartCapture === true && backIdCaptured && !frontIdCaptured
1375
+ };
1376
+ }
1377
+ //#endregion
772
1378
  //#region src/modules/id/idCaptureGuards.ts
773
1379
  function getPermissionOutput(event) {
774
1380
  if (!("output" in event)) return;
@@ -778,7 +1384,20 @@ function getPermissionOutput(event) {
778
1384
  }
779
1385
  const hasShowTutorialGuard = ({ context }) => context.config.showTutorial;
780
1386
  const hasAgeAssuranceGuard = ({ context }) => context.config.ageAssurance === true;
781
- const hasShowDocumentChooserGuard = ({ context }) => !context.config.onlyBack && (context.config.showDocumentChooserScreen ?? false);
1387
+ /** Camera capture has something to capture: an ID or a passport is accepted. */
1388
+ const hasPhysicalDocumentType = (context) => context.availableDocumentTypes.some((type) => type === "id" || type === "passport");
1389
+ /**
1390
+ * The chooser shows when configured, and also when only digital-ID options
1391
+ * are available: hiding it would otherwise fall through to camera capture of
1392
+ * a document the module does not accept (PRI-6436).
1393
+ */
1394
+ const hasShowDocumentChooserGuard = ({ context }) => context.availableDocumentTypes.length > 0 && !hasPhysicalDocumentType(context) || !context.config.onlyBack && (context.config.showDocumentChooserScreen ?? false);
1395
+ /**
1396
+ * Chooser hidden and a single web-redirect provider (e.g. FTN) is the only
1397
+ * option: enter it directly. Unlike the device wallet, the redirect needs no
1398
+ * user activation, so no chooser click is required (PRI-6436).
1399
+ */
1400
+ const isSoleDigitalIdRedirectWithoutChooserGuard = ({ context }) => !(context.config.showDocumentChooserScreen ?? false) && context.availableDocumentTypes.length === 1 && context.availableDocumentTypes[0] === "digitalIdRedirect" && context.digitalIdRedirectOptions.length === 1;
782
1401
  const isPermissionGrantedGuard = ({ event }) => {
783
1402
  return getPermissionOutput(event) === "granted";
784
1403
  };
@@ -874,6 +1493,13 @@ const supportsOptimizingStatusGuard = ({ context }) => context.config.supportsOp
874
1493
  const isDeepsightEnabledGuard = ({ context }) => context.dependencies !== void 0;
875
1494
  const isDeepsightReadyGuard = ({ context }) => context.deepsightService !== void 0;
876
1495
  const needsDeepsightInitGuard = ({ context }) => context.dependencies !== void 0 && context.deepsightService === void 0 && !context.deepsightInitAttempted;
1496
+ /**
1497
+ * Route into the chooser through `detectingCountry`: detection has not run
1498
+ * yet, a country signal is wired, and the ranking could actually reorder the
1499
+ * redirect options (two or more serving different countries). Otherwise the
1500
+ * chooser opens at once, with no request and no spinner.
1501
+ */
1502
+ const needsCountryDetectionGuard = ({ context }) => context.detectedCountries === void 0 && hasCountrySignals(context.dependencies?.countryDetection) && canRankDigitalIdRedirectOptionsByCountry(context.config);
877
1503
  /** No capture option is enabled — the ID module is misconfigured. */
878
1504
  const hasNoDocumentTypesAvailableGuard = ({ context }) => context.availableDocumentTypes.length === 0;
879
1505
  const isDigitalIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCUMENT" && event.documentType === "digitalIdUpload";
@@ -1420,7 +2046,7 @@ fromPromise(async ({ input }) => {
1420
2046
  });
1421
2047
  fromPromise(async ({ input }) => {
1422
2048
  if (!input.dependencies) return;
1423
- const { loadDeepsightSession } = await import("./deepsightLoader-sH7920zw.esm.js");
2049
+ const { loadDeepsightSession } = await import("./deepsightLoader-zG373VVx.esm.js");
1424
2050
  return loadDeepsightSession({
1425
2051
  ds: input.ds,
1426
2052
  storage: input.dependencies.storage,
@@ -1863,21 +2489,28 @@ function cleanup(service) {
1863
2489
  service.cleanup();
1864
2490
  } catch {}
1865
2491
  }
1866
- function createIdMetadataPreparationCoordinator(load = async (input) => (await import("./deepsightLoader-sH7920zw.esm.js")).loadDeepsightSession(input)) {
2492
+ function createIdMetadataPreparationCoordinator(load = async (input) => (await import("./deepsightLoader-zG373VVx.esm.js")).loadDeepsightSession(input)) {
1867
2493
  let disposed = false;
1868
2494
  let preparation;
1869
2495
  let service;
2496
+ let failure;
1870
2497
  const prepare = (input) => {
1871
2498
  if (disposed) return Promise.reject(/* @__PURE__ */ new Error("ID metadata coordinator is disposed"));
1872
- preparation ??= (async () => {
1873
- const prepared = await load(input);
1874
- if (disposed) {
1875
- cleanup(prepared);
1876
- throw new Error("ID metadata coordinator is disposed");
1877
- }
1878
- service = prepared;
1879
- return prepared;
1880
- })();
2499
+ if (!preparation) {
2500
+ const pending = (async () => {
2501
+ const prepared = await load(input);
2502
+ if (disposed) {
2503
+ cleanup(prepared);
2504
+ throw new Error("ID metadata coordinator is disposed");
2505
+ }
2506
+ service = prepared;
2507
+ return prepared;
2508
+ })();
2509
+ preparation = pending;
2510
+ pending.catch((error) => {
2511
+ if (preparation === pending) failure = { error };
2512
+ });
2513
+ }
1881
2514
  return preparation;
1882
2515
  };
1883
2516
  return {
@@ -1885,10 +2518,19 @@ function createIdMetadataPreparationCoordinator(load = async (input) => (await i
1885
2518
  prepare(input).catch(() => void 0);
1886
2519
  },
1887
2520
  prepare,
2521
+ /**
2522
+ * The memoized preparation's rejection once it has settled. `undefined`
2523
+ * while it is pending or after it succeeded. Preparation is never retried,
2524
+ * so a failure here fails every later attempt of this capture too.
2525
+ */
2526
+ settledFailure() {
2527
+ return failure;
2528
+ },
1888
2529
  dispose() {
1889
2530
  if (disposed) return;
1890
2531
  disposed = true;
1891
2532
  preparation = void 0;
2533
+ failure = void 0;
1892
2534
  const prepared = service;
1893
2535
  service = void 0;
1894
2536
  if (prepared) cleanup(prepared);
@@ -1981,18 +2623,18 @@ function streamUsesBackCamera(stream) {
1981
2623
  if (isBackCameraLabel(label)) return true;
1982
2624
  if (label.includes("front") || label.includes("user")) return false;
1983
2625
  }
2626
+ /** The tutorial pre-acquire's default work: have the ID pipeline loaded. */
2627
+ const warmupIdPipeline = () => ensureWasmPipelines(["idCapture"]);
1984
2628
  function createIdProtectedCaptureController(dependencies = {}) {
1985
2629
  const metadataCoordinator = createIdMetadataPreparationCoordinator(dependencies.loadMetadata);
1986
2630
  let disposed = false;
1987
2631
  let visible = true;
1988
2632
  let preAcquired;
1989
2633
  let preAcquirePromise;
1990
- let preAcquireGeneration = 0;
1991
2634
  let provider;
1992
2635
  let displayStream;
1993
2636
  let frameCapturer;
1994
2637
  let captureResolution;
1995
- let cameraFallbackLevel;
1996
2638
  let usingBackCamera;
1997
2639
  let previewImageUrl;
1998
2640
  let pendingPreviewCanvas;
@@ -2042,23 +2684,21 @@ function createIdProtectedCaptureController(dependencies = {}) {
2042
2684
  releasePreAcquired();
2043
2685
  preAcquired = value;
2044
2686
  captureResolution = streamResolution(value.stream);
2045
- cameraFallbackLevel = value.fallbackLevel;
2046
2687
  usingBackCamera = streamUsesBackCamera(value.stream);
2047
2688
  return true;
2048
2689
  };
2690
+ /**
2691
+ * Overlaps the ID pipeline warm-up with the tutorial so the attempt's
2692
+ * `configureWorkflow` finds it loaded. Nothing here opens a camera: since
2693
+ * ml-wasm-kit v2.14.52 the kit acquires it inside the protected camera step.
2694
+ * In-flight calls are deduplicated; the warm-up itself is idempotent.
2695
+ */
2049
2696
  const preAcquire = () => {
2050
2697
  if (disposed) return Promise.reject(/* @__PURE__ */ new Error("ID protected capture controller is disposed"));
2051
- if (preAcquired) return Promise.resolve();
2052
2698
  if (preAcquirePromise) return preAcquirePromise;
2053
- const generation = preAcquireGeneration;
2054
2699
  const pending = (async () => {
2055
- const value = await (dependencies.acquireCamera ?? getIdCameraStream)();
2056
- if (disposed || generation !== preAcquireGeneration) {
2057
- stopStream(value.stream);
2058
- if (disposed) throw new Error("ID protected capture controller is disposed");
2059
- return;
2060
- }
2061
- acceptPreAcquired(value);
2700
+ await (dependencies.warmupPipelines ?? warmupIdPipeline)();
2701
+ if (disposed) throw new Error("ID protected capture controller is disposed");
2062
2702
  })();
2063
2703
  preAcquirePromise = pending;
2064
2704
  pending.then(() => {
@@ -2148,6 +2788,7 @@ function createIdProtectedCaptureController(dependencies = {}) {
2148
2788
  beginAttempt(context, send, getLiveContext) {
2149
2789
  if (disposed) throw new Error("ID protected capture controller is disposed");
2150
2790
  clearAttempt();
2791
+ usingBackCamera = getDeviceClass() !== "desktop";
2151
2792
  if (stepRecording.session && stepRecording.scope !== recordingScopeFor(context)) completeStepRecording();
2152
2793
  diagnosticAttempt = {
2153
2794
  attempt: ++protectedIdAttemptSequence,
@@ -2158,7 +2799,6 @@ function createIdProtectedCaptureController(dependencies = {}) {
2158
2799
  attemptSend = send;
2159
2800
  getAttemptLiveContext = getLiveContext;
2160
2801
  provider = (dependencies.createProvider ?? createProtectedIdProvider)(context.config, context.currentMode);
2161
- cycleOwnership = createCameraCycleOwnership(cameraCycleProvider);
2162
2802
  logDiagnostic("attempt-start", { aggregationMs: context.config?.thresholds?.framesAggregationInterval ?? DEFAULT_ID_CAPTURE_THRESHOLDS.framesAggregationInterval });
2163
2803
  noteTrueSightCaptureActivity(true);
2164
2804
  },
@@ -2171,6 +2811,9 @@ function createIdProtectedCaptureController(dependencies = {}) {
2171
2811
  disableIpify: context.disableIpify
2172
2812
  });
2173
2813
  },
2814
+ settledMetadataFailure() {
2815
+ return metadataCoordinator.settledFailure();
2816
+ },
2174
2817
  prepareMetadata(context) {
2175
2818
  const storage = context.dependencies?.storage;
2176
2819
  if (!storage) return Promise.reject(/* @__PURE__ */ new Error("ID metadata storage is unavailable"));
@@ -2184,7 +2827,6 @@ function createIdProtectedCaptureController(dependencies = {}) {
2184
2827
  dispose() {
2185
2828
  if (disposed) return;
2186
2829
  disposed = true;
2187
- preAcquireGeneration += 1;
2188
2830
  metadataCoordinator.dispose();
2189
2831
  releasePreAcquired();
2190
2832
  clearAttempt();
@@ -2218,27 +2860,26 @@ function createIdProtectedCaptureController(dependencies = {}) {
2218
2860
  return visible;
2219
2861
  },
2220
2862
  storePreAcquiredStream(value) {
2221
- preAcquireGeneration += 1;
2222
2863
  return acceptPreAcquired(value);
2223
2864
  },
2224
2865
  takePreAcquiredStream() {
2225
2866
  const value = preAcquired;
2226
2867
  preAcquired = void 0;
2227
- if (value) cameraFallbackLevel = value.fallbackLevel;
2228
2868
  return value;
2229
2869
  },
2230
2870
  getProvider() {
2231
2871
  return provider;
2232
2872
  },
2233
2873
  getCycleOwnership() {
2234
- if (!cycleOwnership) throw new Error("Protected ID cycle ownership is unavailable");
2874
+ if (!attemptContext) throw new Error("Protected ID cycle ownership is unavailable");
2875
+ cycleOwnership ??= createCameraCycleOwnership(cameraCycleProvider);
2235
2876
  return cycleOwnership;
2236
2877
  },
2237
2878
  getProjection() {
2238
2879
  return {
2239
2880
  stream: displayStream,
2240
2881
  captureResolution,
2241
- cameraFallbackLevel,
2882
+ cameraFallbackLevel: void 0,
2242
2883
  usingBackCamera
2243
2884
  };
2244
2885
  },
@@ -2287,14 +2928,12 @@ function createIdProtectedCaptureController(dependencies = {}) {
2287
2928
  type,
2288
2929
  qualityElements: context.qualityElements,
2289
2930
  onProgress,
2290
- deepsightService: void 0,
2291
2931
  stream: displayStream,
2292
2932
  isSecondId: context.config.isSecondId ?? false,
2293
2933
  onlyFront: type === "front" && (context.config.onlyFront ?? false),
2294
2934
  ageAssurance: context.config.ageAssurance,
2295
2935
  dependencies: context.dependencies,
2296
2936
  captureResolution,
2297
- cameraFallbackLevel,
2298
2937
  extractIdFace: context.config.extractIdFace,
2299
2938
  croppedCanvas: provider?.getCapturedCanvas() ?? null
2300
2939
  };
@@ -2313,12 +2952,18 @@ function createIdProtectedCaptureController(dependencies = {}) {
2313
2952
  },
2314
2953
  async deliverCaptureOnly(signal) {
2315
2954
  if (!dependencies.finalizeCaptureOnly || !attemptContext || !attemptSend) throw new Error(ID_ERROR_CODES.UPLOAD_ERROR);
2316
- return dependencies.finalizeCaptureOnly(controller.buildCaptureOnlyUpload(attemptContext, (progress) => {
2955
+ const upload = controller.buildCaptureOnlyUpload(attemptContext, (progress) => {
2317
2956
  attemptSend?.({
2318
2957
  type: "UPLOAD_PROGRESS",
2319
2958
  progress
2320
2959
  });
2321
- }), signal);
2960
+ });
2961
+ const deepsightService = await controller.prepareMetadata(attemptContext).catch(() => void 0);
2962
+ if (signal.aborted) throw new DOMException("Aborted", "AbortError");
2963
+ return dependencies.finalizeCaptureOnly({
2964
+ ...upload,
2965
+ deepsightService
2966
+ }, signal);
2322
2967
  },
2323
2968
  resourceSink: {
2324
2969
  ready(stream) {
@@ -2327,10 +2972,7 @@ function createIdProtectedCaptureController(dependencies = {}) {
2327
2972
  return;
2328
2973
  }
2329
2974
  replaceDisplayStream(stream);
2330
- logDiagnostic("protected-camera-ready", {
2331
- ...getIdCameraTrackDiagnosticFields(stream.getVideoTracks()[0]),
2332
- fallbackLevel: cameraFallbackLevel
2333
- });
2975
+ logDiagnostic("protected-camera-ready", getIdCameraTrackDiagnosticFields(stream.getVideoTracks()[0]));
2334
2976
  },
2335
2977
  autoCommitted: storeCommit,
2336
2978
  manualCommitted: storeCommit,
@@ -2775,48 +3417,34 @@ function createProtectedIdAttemptInput(input) {
2775
3417
  const target = resolveProtectedIdTarget(context.config, context.currentMode);
2776
3418
  const callbackSession = createProtectedIdCallbackSession(input);
2777
3419
  let wasmUtil;
2778
- const preAcquired = controller.takePreAcquiredStream();
2779
- let selectedVideoTrack = preAcquired?.stream.getVideoTracks()[0];
2780
- const constraints = getCameraReacquisitionConstraints(selectedVideoTrack, preAcquired?.constraints);
2781
3420
  const captureOnly = hasOnCaptureCallback(context.config);
2782
3421
  const diagnosticAttempt = controller.getDiagnosticAttempt();
2783
3422
  const isAttemptActive = () => !controller.disposed && controller.getProvider() === provider && controller.getDiagnosticAttempt() === diagnosticAttempt;
2784
- const logSelectedCamera = (stream, fallbackLevel, reacquisitionConstraints, preAcquiredStream) => {
2785
- if (!diagnosticAttempt) return;
2786
- logIdCameraDiagnostic("selected-camera", {
2787
- attempt: diagnosticAttempt.attempt,
2788
- side: diagnosticAttempt.side,
2789
- elapsedMs: Math.round(getTimestamp() - diagnosticAttempt.startedAt),
2790
- ...getIdCameraTrackDiagnosticFields(stream.getVideoTracks()[0]),
2791
- preAcquired: preAcquiredStream,
2792
- fallbackLevel,
2793
- workflow: String(workflow),
2794
- devicePinned: reacquisitionConstraints?.deviceId !== void 0
2795
- });
2796
- };
2797
- if (preAcquired) logSelectedCamera(preAcquired.stream, preAcquired.fallbackLevel, constraints, true);
3423
+ let cameraStepFacts = {};
2798
3424
  return {
2799
3425
  attemptId: `protected-id-${diagnosticAttempt?.attempt ?? ++protectedIdAttemptSequence}`,
2800
3426
  target,
2801
3427
  workflow,
2802
- streamSource: preAcquired ? {
2803
- kind: "preAcquired",
2804
- stream: preAcquired.stream,
2805
- constraints
2806
- } : {
2807
- kind: "acquire",
2808
- async acquire() {
2809
- await controller.preAcquire();
2810
- const adopted = controller.takePreAcquiredStream();
2811
- if (!adopted) throw new Error("Protected ID stream acquisition was cancelled");
2812
- selectedVideoTrack = adopted.stream.getVideoTracks()[0];
2813
- const reacquisitionConstraints = getCameraReacquisitionConstraints(selectedVideoTrack, adopted.constraints);
2814
- logSelectedCamera(adopted.stream, adopted.fallbackLevel, reacquisitionConstraints, false);
2815
- return {
2816
- stream: adopted.stream,
2817
- constraints: reacquisitionConstraints
2818
- };
2819
- }
3428
+ preflight: captureOnly ? void 0 : () => {
3429
+ const failure = controller.settledMetadataFailure();
3430
+ if (failure) throw failure.error;
3431
+ },
3432
+ cameraStep: async () => {
3433
+ const di = await electDesktopCameraDevice("environment");
3434
+ const hs = controller.takePreAcquiredStream()?.stream;
3435
+ cameraStepFacts = {
3436
+ preAcquired: hs !== void 0,
3437
+ devicePinned: di !== ""
3438
+ };
3439
+ return {
3440
+ vs: "environment",
3441
+ di,
3442
+ ew: 0,
3443
+ eh: 0,
3444
+ i14: isIPhone14OrHigher(),
3445
+ pa: false,
3446
+ hs
3447
+ };
2820
3448
  },
2821
3449
  initiallyBackgrounded: !controller.isVisible(),
2822
3450
  resourceSink: controller.resourceSink,
@@ -2830,13 +3458,11 @@ function createProtectedIdAttemptInput(input) {
2830
3458
  enabled: !captureOnly,
2831
3459
  stepRecording: controller.getStepRecording()
2832
3460
  }),
2833
- releaseUnadoptedStream: stopStream,
2834
- beforeAdopt: captureOnly ? void 0 : async (stream) => {
2835
- const track = stream.getVideoTracks()[0];
2836
- if (!track) throw new Error("Protected ID camera has no selected video track");
3461
+ afterReady: captureOnly ? void 0 : async (displayStream) => {
2837
3462
  const metadata = await controller.prepareMetadata(context);
2838
3463
  if (!isAttemptActive()) return;
2839
- await metadata.checkVirtualCamera(track);
3464
+ const track = displayStream.getVideoTracks()[0];
3465
+ if (track) await metadata.checkVirtualCamera(track);
2840
3466
  },
2841
3467
  onStartupTiming(timing) {
2842
3468
  if (!diagnosticAttempt) return;
@@ -2844,6 +3470,8 @@ function createProtectedIdAttemptInput(input) {
2844
3470
  attempt: diagnosticAttempt.attempt,
2845
3471
  side: diagnosticAttempt.side,
2846
3472
  elapsedMs: Math.round(getTimestamp() - diagnosticAttempt.startedAt),
3473
+ workflow: String(workflow),
3474
+ ...cameraStepFacts,
2847
3475
  ...timing
2848
3476
  });
2849
3477
  },
@@ -2862,12 +3490,6 @@ function createProtectedIdAttemptInput(input) {
2862
3490
  callbacks: callbackSession.callbacks
2863
3491
  });
2864
3492
  },
2865
- async runPrc() {
2866
- if (!isAttemptActive()) return;
2867
- wasmUtil = await (input.getWasmUtil ?? WasmUtilProvider.getInstance)();
2868
- if (!isAttemptActive()) return;
2869
- await wasmUtil.prc();
2870
- },
2871
3493
  async runPoc() {
2872
3494
  if (captureOnly) return;
2873
3495
  if (!isAttemptActive()) return;
@@ -2898,398 +3520,66 @@ function createProtectedIdAttemptInput(input) {
2898
3520
  motionStatus
2899
3521
  });
2900
3522
  } catch {}
2901
- try {
2902
- const logs = metadata.getPipelineState();
2903
- if (!isAttemptActive()) return;
2904
- const projection = controller.getProjection();
2905
- context.dependencies?.trackCaptureAttemptFinished?.({
2906
- logs,
2907
- resolution: projection.captureResolution,
2908
- fallbackLevel: projection.cameraFallbackLevel
2909
- });
2910
- } catch {
2911
- if (isAttemptActive()) trueSightLog("warning", "deepsight", "idScan", "protected capture diagnostics failed");
2912
- }
2913
- }
2914
- }
2915
- };
2916
- }
2917
- function protectedIdResultToCaptureResponse(result) {
2918
- const regulationType = result.regulationType === "US" || result.regulationType === "Worldwide" || result.regulationType === "Other" || result.regulationType === "US_Illinois" || result.regulationType === "US_Texas" || result.regulationType === "US_California" || result.regulationType === "US_Washington" ? result.regulationType : void 0;
2919
- return {
2920
- sharpness: result.sharpness ?? 0,
2921
- correctSharpness: result.sharpness != null && result.sharpness >= 10,
2922
- glare: result.glare ?? 0,
2923
- correctGlare: result.glare != null && result.glare >= 10,
2924
- horizontalResolution: 0,
2925
- classification: result.classification === true,
2926
- readability: result.readability === true,
2927
- typeOfId: result.typeOfId ?? "",
2928
- issueYear: 0,
2929
- issueName: "",
2930
- sessionStatus: result.sessionStatus ?? "",
2931
- countryCode: result.countryCode ?? "",
2932
- skipBackIdCapture: result.skipBackIdCapture,
2933
- skipGlareFront: result.skipGlareFront,
2934
- skipGlareBack: result.skipGlareBack,
2935
- acceptedDocuments: result.acceptedDocuments ? [...result.acceptedDocuments] : void 0,
2936
- forceFrontIdCapture: result.forceFrontIdCapture,
2937
- idValidationCompleted: result.idValidationCompleted,
2938
- showMandatoryConsent: result.showMandatoryConsent,
2939
- regulationType,
2940
- failReason: result.failReason,
2941
- side: result.side,
2942
- idQualityAttemptApproved: result.idQualityAttemptApproved,
2943
- isDocumentExpired: result.isDocumentExpired,
2944
- success: result.success
2945
- };
2946
- }
2947
- function getProtectedIdUploadRequest(context, sessionToken = getToken()) {
2948
- const target = resolveProtectedIdTarget(context.config, context.currentMode);
2949
- const front = context.currentMode !== "back";
2950
- const params = { captureType: context.manualCaptureTriggered ? "MANUAL" : "AUTO" };
2951
- if (front && context.config.onlyFront === true) params.onlyFront = true;
2952
- if (front && context.config.extractIdFace === false) params.extractIdFace = false;
2953
- const sharpness = context.qualityElements?.sharpness;
2954
- if (sharpness !== void 0 && sharpness !== 0 && Number.isFinite(sharpness)) params.sharpness = getRealQualityValue(sharpness);
2955
- return {
2956
- target,
2957
- config: {
2958
- ...sessionToken ? { headers: { "X-Incode-Hardware-Id": sessionToken } } : {},
2959
- params
2960
- }
2961
- };
2962
- }
2963
- //#endregion
2964
- //#region src/modules/id/digitalIdRegistry.ts
2965
- /**
2966
- * True when a digital-ID method uses a full-page web-redirect flow (Trinsic
2967
- * iDIN/FTN). Accepts both the module `FlowType` value (`REDIRECT`) and the
2968
- * backend value (`WEB_REDIRECT`). (Lives here rather than in
2969
- * `idCaptureHelpers` to keep the registry free of circular imports; the
2970
- * helpers re-export it.)
2971
- */
2972
- function isRedirectFlowType(flowType) {
2973
- return flowType === "REDIRECT" || flowType === "WEB_REDIRECT";
2974
- }
2975
- const DIGITAL_ID_REGISTRY = {
2976
- mDL: [{
2977
- kind: "incodeWallet",
2978
- documentType: "digitalId"
2979
- }, {
2980
- kind: "trinsicRedirect",
2981
- documentType: "digitalIdRedirect",
2982
- providerId: "trinsic_mdl_placeholder",
2983
- method: "MDL"
2984
- }],
2985
- iDIN: [{
2986
- kind: "trinsicRedirect",
2987
- documentType: "digitalIdRedirect",
2988
- providerId: "trinsic_netherlands_idin",
2989
- method: "IDIN"
2990
- }],
2991
- FTN: [{
2992
- kind: "trinsicRedirect",
2993
- documentType: "digitalIdRedirect",
2994
- providerId: "trinsic_finnish_trust_network",
2995
- method: "FTN"
2996
- }]
2997
- };
2998
- const DIGITAL_ID_DOCUMENT_TYPES = Object.keys(DIGITAL_ID_REGISTRY);
2999
- /**
3000
- * Single place that widens `config.digitalIds` to the shapes the backend
3001
- * actually sends — the mapped array or the raw `{ enabled, methods }` object.
3002
- * Shared so the cast is written once.
3003
- */
3004
- function asDigitalIdsConfig(config) {
3005
- return config.digitalIds;
3006
- }
3007
- /**
3008
- * Persisted method name → catalog provider id, derived from the registry's
3009
- * Trinsic entries (single source of truth). Lets the SDK launch iDIN / FTN
3010
- * from a backend that does not yet send `providerId` on each method.
3011
- * TODO(roadmap: fully-catalog-driven): remove once every backend enriches
3012
- * `digitalIds.methods[]` with `providerId` + `flowType`.
3013
- */
3014
- const REDIRECT_PROVIDER_BY_METHOD = (() => {
3015
- const map = {};
3016
- for (const docType of DIGITAL_ID_DOCUMENT_TYPES) for (const entry of DIGITAL_ID_REGISTRY[docType]) if (entry.kind === "trinsicRedirect") map[entry.method] = entry.providerId;
3017
- return map;
3018
- })();
3019
- /**
3020
- * Redirect providers that are the fallback leg of a wallet-first funnel
3021
- * (mDL): they are reached through the `digitalId` tile's funnel resolution,
3022
- * not offered as a standalone chooser card.
3023
- */
3024
- const WALLET_FUNNEL_REDIRECT_PROVIDER_IDS = new Set(DIGITAL_ID_DOCUMENT_TYPES.flatMap((docType) => {
3025
- const entries = DIGITAL_ID_REGISTRY[docType];
3026
- if (!entries.some((entry) => entry.kind === "incodeWallet")) return [];
3027
- return entries.flatMap((entry) => entry.kind === "trinsicRedirect" ? [entry.providerId] : []);
3028
- }));
3029
- /**
3030
- * True for a redirect provider that gets its own chooser card (iDIN, FTN, any
3031
- * catalog-enriched redirect method) — as opposed to the mDL wallet fallback,
3032
- * which only surfaces through the Digital ID tile.
3033
- */
3034
- function isStandaloneRedirectProvider(providerId) {
3035
- return !WALLET_FUNNEL_REDIRECT_PROVIDER_IDS.has(providerId);
3036
- }
3037
- /**
3038
- * The provider id a configured method launches with, when it is a
3039
- * web-redirect method; `undefined` for wallets / other flow shapes.
3040
- *
3041
- * Resolution order:
3042
- * 1. an explicit redirect `flowType` with a `provider` (mapped shape) or
3043
- * `providerId` (catalog-enriched raw shape) — backend-authoritative;
3044
- * 2. otherwise the persisted method name via the registry (legacy raw shape).
3045
- */
3046
- function resolveRedirectProviderId(method) {
3047
- if (method.flowType) {
3048
- if (!isRedirectFlowType(method.flowType)) return;
3049
- const explicit = method.provider ?? method.providerId;
3050
- if (explicit) return explicit;
3051
- }
3052
- return method.method ? REDIRECT_PROVIDER_BY_METHOD[method.method.toUpperCase()] : void 0;
3053
- }
3054
- /**
3055
- * Tolerant view over `config.digitalIds`: accepts both the mapped array
3056
- * (`IdCaptureDigitalIdMethod[]`) and the raw backend object
3057
- * (`{ enabled, methods: [...] }`). Extracted from the old
3058
- * `getDigitalIdRedirectMethod` cast so every consumer parses it the same way.
3059
- *
3060
- * Honors both dashboard toggles: a raw object with `enabled: false` yields no
3061
- * methods, and individual methods with `enabled: false` are dropped (absent
3062
- * `enabled` counts as on). This is what "enabled for the flow / workflow"
3063
- * means — for the redirect chooser cards as much as for the wallet tile.
3064
- */
3065
- function normalizeDigitalIdMethods(config) {
3066
- const raw = asDigitalIdsConfig(config);
3067
- if (!Array.isArray(raw) && raw?.enabled === false) return [];
3068
- return (Array.isArray(raw) ? raw : raw?.methods ?? []).filter((method) => method.enabled !== false);
3069
- }
3070
- /**
3071
- * Persisted method names of the Incode-native device wallets — the backend
3072
- * `DigitalIdMethodCatalog` entries of type `MDL`. A catalog-enriched method
3073
- * carries `type: 'MDL'` instead of relying on the name; both are honoured.
3074
- */
3075
- const DEVICE_WALLET_METHODS = /* @__PURE__ */ new Set([
3076
- "APPLE_WALLET",
3077
- "GOOGLE_WALLET",
3078
- "CA_DMV_WALLET"
3079
- ]);
3080
- /**
3081
- * True for a configured method the native device-wallet handshake can fulfil.
3082
- * Redirect methods (iDIN, FTN) never count, whatever their name or type — they
3083
- * must not surface a wallet tile with no wallet behind it.
3084
- *
3085
- * Classifies by *kind* only. Whether a method is switched on is already
3086
- * settled by `normalizeDigitalIdMethods`, which drops disabled methods before
3087
- * any caller walks the list.
3088
- */
3089
- function isDeviceWalletMethod(method) {
3090
- if (method.flowType && isRedirectFlowType(method.flowType)) return false;
3091
- if (method.type?.toUpperCase() === "MDL") return true;
3092
- return method.method !== void 0 && DEVICE_WALLET_METHODS.has(method.method.toUpperCase());
3093
- }
3094
- /**
3095
- * Whether a device wallet is enabled for this ID-capture config: the coarse
3096
- * `deviceWallet` flag, or an enabled wallet method in `config.digitalIds`.
3097
- *
3098
- * The dashboard persists a wallet only in `digitalIds.methods` and leaves the
3099
- * legacy `deviceWallet` / `appleWallet` booleans at their stored `false`. The
3100
- * backend derives the booleans from `digitalIds` for the flow response, but
3101
- * the workflow-node response historically shipped them raw — so a workflow
3102
- * with Apple Wallet enabled arrived here as `deviceWallet: false`, and the
3103
- * tile was dropped while SDK 1 (which reads `digitalIds` itself) showed it.
3104
- * Mirrors the backend's own `deriveDeviceWalletFlag`, minus its "unknown
3105
- * method counts as a wallet" fallback: an unrecognised method must not
3106
- * launch a handshake that cannot know what to request.
3107
- */
3108
- function isDeviceWalletEnabled(config) {
3109
- if (config.deviceWallet === true) return true;
3110
- return hasEnabledDeviceWalletMethod(config);
3111
- }
3112
- /** Whether a funnel entry is activated by config + platform capabilities. */
3113
- function isEntryActive(entry, config, platform) {
3114
- if (entry.kind === "incodeWallet") return isDeviceWalletEnabled(config) && platform.credentialsAvailable;
3115
- return findConfiguredMethod(entry, config) !== void 0;
3116
- }
3117
- /**
3118
- * The configured `digitalIds` method matching a Trinsic funnel entry — by
3119
- * persisted method name, or (mapped shape) by provider id on a redirect
3120
- * flowType. First match wins; disabled methods are already dropped by
3121
- * `normalizeDigitalIdMethods`.
3122
- */
3123
- function findConfiguredMethod(entry, config) {
3124
- return normalizeDigitalIdMethods(config).find((method) => method.method?.toUpperCase() === entry.method || method.provider === entry.providerId && !!method.flowType && isRedirectFlowType(method.flowType));
3125
- }
3126
- /** Normalizes a raw configured method into the mapped shape for the child input. */
3127
- function toMappedMethod(entry, method) {
3128
- if (method.flowType && isRedirectFlowType(method.flowType)) return method;
3129
- return {
3130
- method: method.method,
3131
- provider: entry.providerId,
3132
- flowType: "WEB_REDIRECT",
3133
- country: method.country ?? method.countries?.[0],
3134
- displayName: method.displayName,
3135
- logoUrl: method.logoUrl
3136
- };
3137
- }
3138
- /**
3139
- * True when `config.digitalIds` carries a device-wallet method that is switched
3140
- * on, honouring both dashboard toggles: the `digitalIds.enabled` master switch
3141
- * and each method's own `enabled` flag. An absent `enabled` counts as on, the
3142
- * tolerant reading the rest of this module uses.
3143
- *
3144
- * Both toggles are applied by `normalizeDigitalIdMethods`, so this only has to
3145
- * ask whether any surviving method is a wallet.
3146
- */
3147
- function hasEnabledDeviceWalletMethod(config) {
3148
- return normalizeDigitalIdMethods(config).some(isDeviceWalletMethod);
3149
- }
3150
- /**
3151
- * Resolves the implementation that should fulfil a digital-ID document type:
3152
- * the first funnel entry that is active under the given config and platform.
3153
- * `undefined` when nothing can run it (the chooser then shows no tile for it).
3154
- */
3155
- function resolveDigitalIdImplementation(docType, config, platform) {
3156
- for (const entry of DIGITAL_ID_REGISTRY[docType]) {
3157
- if (!isEntryActive(entry, config, platform)) continue;
3158
- if (entry.kind === "incodeWallet") return { kind: "incodeWallet" };
3159
- const method = findConfiguredMethod(entry, config);
3160
- return {
3161
- kind: "trinsicRedirect",
3162
- providerId: entry.providerId,
3163
- method: method ? toMappedMethod(entry, method) : void 0
3164
- };
3165
- }
3523
+ try {
3524
+ const logs = metadata.getPipelineState();
3525
+ if (!isAttemptActive()) return;
3526
+ const projection = controller.getProjection();
3527
+ context.dependencies?.trackCaptureAttemptFinished?.({
3528
+ logs,
3529
+ resolution: projection.captureResolution,
3530
+ fallbackLevel: projection.cameraFallbackLevel
3531
+ });
3532
+ } catch {
3533
+ if (isAttemptActive()) trueSightLog("warning", "deepsight", "idScan", "protected capture diagnostics failed");
3534
+ }
3535
+ }
3536
+ }
3537
+ };
3166
3538
  }
3167
- //#endregion
3168
- //#region src/modules/id/idCaptureHelpers.ts
3169
- /**
3170
- * Normalizes a configured method into the mapped redirect shape for a
3171
- * resolved provider. The already-mapped shape is returned as-is; the raw
3172
- * backend shape gets `provider` + `WEB_REDIRECT` filled in.
3173
- */
3174
- function toRedirectMethod(method, provider) {
3175
- if (method.provider && method.flowType) return method;
3539
+ function protectedIdResultToCaptureResponse(result) {
3540
+ const regulationType = result.regulationType === "US" || result.regulationType === "Worldwide" || result.regulationType === "Other" || result.regulationType === "US_Illinois" || result.regulationType === "US_Texas" || result.regulationType === "US_California" || result.regulationType === "US_Washington" ? result.regulationType : void 0;
3176
3541
  return {
3177
- method: method.method,
3178
- provider,
3179
- flowType: "WEB_REDIRECT",
3180
- country: method.country ?? method.countries?.[0],
3181
- displayName: method.displayName,
3182
- logoUrl: method.logoUrl
3542
+ sharpness: result.sharpness ?? 0,
3543
+ correctSharpness: result.sharpness != null && result.sharpness >= 10,
3544
+ glare: result.glare ?? 0,
3545
+ correctGlare: result.glare != null && result.glare >= 10,
3546
+ horizontalResolution: 0,
3547
+ classification: result.classification === true,
3548
+ readability: result.readability === true,
3549
+ typeOfId: result.typeOfId ?? "",
3550
+ issueYear: 0,
3551
+ issueName: "",
3552
+ sessionStatus: result.sessionStatus ?? "",
3553
+ countryCode: result.countryCode ?? "",
3554
+ skipBackIdCapture: result.skipBackIdCapture,
3555
+ skipGlareFront: result.skipGlareFront,
3556
+ skipGlareBack: result.skipGlareBack,
3557
+ acceptedDocuments: result.acceptedDocuments ? [...result.acceptedDocuments] : void 0,
3558
+ forceFrontIdCapture: result.forceFrontIdCapture,
3559
+ idValidationCompleted: result.idValidationCompleted,
3560
+ showMandatoryConsent: result.showMandatoryConsent,
3561
+ regulationType,
3562
+ failReason: result.failReason,
3563
+ side: result.side,
3564
+ idQualityAttemptApproved: result.idQualityAttemptApproved,
3565
+ isDocumentExpired: result.isDocumentExpired,
3566
+ success: result.success
3183
3567
  };
3184
3568
  }
3185
- /**
3186
- * The enabled web-redirect digital-ID method to launch — the one matching
3187
- * `providerId` when given (a chooser card was picked), else the first
3188
- * configured redirect method — or `undefined` when none is configured.
3189
- * Drives the provider and country passed to the `digitalIdRedirectMachine`.
3190
- *
3191
- * Accepts both the mapped array (`IdCaptureDigitalIdMethod[]`) and the raw
3192
- * backend `configuration.digitalIds` object (`{ enabled, methods: [...] }`);
3193
- * for the raw shape the provider comes from the backend-enriched
3194
- * `providerId`/`flowType` when present, else from the persisted method name
3195
- * via the digital-ID registry (`IDIN` → `trinsic_netherlands_idin`).
3196
- */
3197
- function getDigitalIdRedirectMethod(config, providerId) {
3198
- for (const method of normalizeDigitalIdMethods(config)) {
3199
- const provider = resolveRedirectProviderId(method);
3200
- if (!provider || providerId !== void 0 && provider !== providerId) continue;
3201
- return toRedirectMethod(method, provider);
3202
- }
3203
- }
3204
- /**
3205
- * The digital-ID web-redirect providers that get their own chooser card: one
3206
- * per enabled redirect method in `config.digitalIds`, in backend (dashboard)
3207
- * order, deduped by provider. Wallet-funnel fallbacks (the Trinsic mDL leg)
3208
- * are excluded — they surface through the Digital ID tile instead.
3209
- *
3210
- * Card display data (`displayName`, `logoUrl`, `country`) is whatever the
3211
- * backend enriched the method with; the UI falls back to generic copy / icon
3212
- * when absent.
3213
- */
3214
- function getAvailableDigitalIdRedirectOptions(config) {
3215
- const options = [];
3216
- for (const method of normalizeDigitalIdMethods(config)) {
3217
- const providerId = resolveRedirectProviderId(method);
3218
- if (!providerId || !isStandaloneRedirectProvider(providerId) || options.some((option) => option.providerId === providerId)) continue;
3219
- options.push({
3220
- providerId,
3221
- method: method.method,
3222
- displayName: method.displayName,
3223
- logoUrl: method.logoUrl,
3224
- country: method.country ?? method.countries?.[0]
3225
- });
3226
- }
3227
- return options;
3228
- }
3229
- /**
3230
- * Map of config properties received from the backend to adjusted, internal document types.
3231
- */
3232
- const DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP = [
3233
- ["enableId", "id"],
3234
- ["enablePassport", "passport"],
3235
- ["digitalIdsUpload", "digitalIdUpload"]
3236
- ];
3237
- /**
3238
- * Returns the list of document types enabled by config for the chooser screen, in display order.
3239
- * Used to populate chooser state so UI and headless consumers can render the correct options.
3240
- *
3241
- * Digital-ID document types (device wallet, Trinsic web-redirect) come from
3242
- * the digital-ID registry funnel: each registry document type contributes the
3243
- * tile of its first active implementation. A `deviceWallet: true` config on a
3244
- * platform without the Credentials API therefore shows the Trinsic fallback
3245
- * tile when one is configured — or no tile at all, instead of a dead-end one.
3246
- *
3247
- * @param config - ID capture configuration (from flow or init)
3248
- * @param platform - Platform capabilities consulted by the digital-ID funnel.
3249
- * Defaults to no Credentials API for pure-node callers; the machine passes
3250
- * the real capability check.
3251
- * @returns Array of IdDocumentType values that should be shown in the document type chooser
3252
- */
3253
- function getAvailableDocumentTypes(config, platform = { credentialsAvailable: false }) {
3254
- const adjustedDocumentTypes = [];
3255
- for (const [configProperty, adjustedType] of DOCUMENT_TYPES_CONFIG_TO_ADJUSTED_MAP) if (config[configProperty]) adjustedDocumentTypes.push(adjustedType);
3256
- for (const docType of DIGITAL_ID_DOCUMENT_TYPES) {
3257
- const route = resolveDigitalIdImplementation(docType, config, platform);
3258
- if (!route) continue;
3259
- const documentType = route.kind === "incodeWallet" ? "digitalId" : "digitalIdRedirect";
3260
- if (!adjustedDocumentTypes.includes(documentType)) adjustedDocumentTypes.push(documentType);
3261
- }
3262
- if (!adjustedDocumentTypes.includes("digitalIdRedirect") && getAvailableDigitalIdRedirectOptions(config).length > 0) adjustedDocumentTypes.push("digitalIdRedirect");
3263
- return adjustedDocumentTypes;
3264
- }
3265
- /**
3266
- * Computes `idCaptureMachine`'s terminal output — the downstream module-skip
3267
- * signal read by the Flow orchestrator (via `runChildModule`'s `MODULE_COMPLETE`).
3268
- *
3269
- * `skipFaceMatch` is set ONLY for the US Smart Capture *camera back-only* path:
3270
- * a back image was captured on-device (`capturedImages.back`) and no front was
3271
- * (`!capturedImages.front`) — "no front, no ID face, no match".
3272
- *
3273
- * Requiring a captured back is deliberate and load-bearing: the digital-ID
3274
- * upload path submits a full ID (front face present) but does NOT
3275
- * populate `capturedImages` (only the camera path does). Gating on a captured
3276
- * back excludes those upload paths so a real ID-vs-selfie match is never
3277
- * silently skipped. `capturedImages.front`/`forceFrontIdCapture` alone are not
3278
- * enough (a later front upload clears the request; uploads set neither field).
3279
- *
3280
- * Always `false` outside US Smart Capture. The selfie/face capture itself is
3281
- * unaffected — only the ID-vs-selfie match is skipped.
3282
- *
3283
- * Also `true` on the Digital ID web-redirect (Trinsic iDIN/FTN) COMPLETED path
3284
- * when the scheme returned no portrait (`isDigitalIdRedirect && !portraitPresent`,
3285
- * FM-1/FM-2): there is no ID face to match the selfie against.
3286
- */
3287
- function computeIdCaptureOutput(context) {
3288
- const frontIdCaptured = Boolean(context.capturedImages.front);
3289
- const backIdCaptured = Boolean(context.capturedImages.back);
3569
+ function getProtectedIdUploadRequest(context, sessionToken = getToken()) {
3570
+ const target = resolveProtectedIdTarget(context.config, context.currentMode);
3571
+ const front = context.currentMode !== "back";
3572
+ const params = { captureType: context.manualCaptureTriggered ? "MANUAL" : "AUTO" };
3573
+ if (front && context.config.onlyFront === true) params.onlyFront = true;
3574
+ if (front && context.config.extractIdFace === false) params.extractIdFace = false;
3575
+ const sharpness = context.qualityElements?.sharpness;
3576
+ if (sharpness !== void 0 && sharpness !== 0 && Number.isFinite(sharpness)) params.sharpness = getRealQualityValue(sharpness);
3290
3577
  return {
3291
- frontIdCaptured,
3292
- skipFaceMatch: context.isDigitalIdRedirect === true && context.portraitPresent !== true || context.config.usSmartCapture === true && backIdCaptured && !frontIdCaptured
3578
+ target,
3579
+ config: {
3580
+ ...sessionToken ? { headers: { "X-Incode-Hardware-Id": sessionToken } } : {},
3581
+ params
3582
+ }
3293
3583
  };
3294
3584
  }
3295
3585
  //#endregion
@@ -3834,12 +4124,8 @@ const idCaptureMachine = setup({
3834
4124
  digitalUploadMachine,
3835
4125
  digitalIdRedirectMachine,
3836
4126
  deviceWalletMachine,
3837
- readPendingDigitalIdRedirect: fromPromise(async ({ input }) => {
3838
- const pending = await readPendingRedirect(input.storage);
3839
- if (!pending) return null;
3840
- await clearPendingRedirect(input.storage);
3841
- return pending;
3842
- })
4127
+ readPendingDigitalIdRedirect: fromPromise(({ input }) => readPendingRedirect(input.storage)),
4128
+ detectCountries: fromPromise(({ input, signal }) => detectDigitalIdCountries(input.dependencies, { signal }))
3843
4129
  },
3844
4130
  actions: {
3845
4131
  attachProtectedController: assign(({ self }) => {
@@ -3847,7 +4133,7 @@ const idCaptureMachine = setup({
3847
4133
  return {};
3848
4134
  }),
3849
4135
  startProtectedMetadataPreparation: ({ context, self }) => {
3850
- if (!hasOnCaptureCallback(context.config)) getIdProtectedCaptureController(self).startMetadataPreparation(context);
4136
+ getIdProtectedCaptureController(self).startMetadataPreparation(context);
3851
4137
  },
3852
4138
  bindProtectedControllerLifetime: sendTo("protectedControllerLifetime", ({ self }) => ({
3853
4139
  type: "BIND_PROTECTED_ID_CONTROLLER",
@@ -4109,6 +4395,10 @@ const idCaptureMachine = setup({
4109
4395
  performStopMediaRecording(context);
4110
4396
  },
4111
4397
  clearRecordingSession: assign({ recordingSession: () => void 0 }),
4398
+ selectSoleDigitalIdRedirect: assign({
4399
+ selectedDocumentType: () => "digitalIdRedirect",
4400
+ selectedDigitalIdProviderId: ({ context }) => context.digitalIdRedirectOptions[0]?.providerId
4401
+ }),
4112
4402
  setSelectedDocument: assign({
4113
4403
  selectedDocumentType: ({ event }) => {
4114
4404
  if ("documentType" in event) return event.documentType;
@@ -4229,7 +4519,35 @@ const idCaptureMachine = setup({
4229
4519
  * it runs inside the tile click's `send()`, preserving the transient
4230
4520
  * user activation `navigator.credentials.get()` needs on iOS Safari.
4231
4521
  */
4232
- resolveDigitalIdRoute: assign(({ context }) => ({ digitalIdRoute: resolveDigitalIdImplementation("mDL", context.config, { credentialsAvailable: context.dependencies?.credentials?.isAvailable() ?? false }) })),
4522
+ resolveDigitalIdRoute: assign(({ context }) => ({ digitalIdRoute: resolveDigitalIdImplementation("mDL", context.config, getDigitalIdPlatformSupport(context.dependencies?.credentials)) })),
4523
+ /**
4524
+ * Stores the detected countries and re-ranks the redirect options by them
4525
+ * (`getAvailableDigitalIdRedirectOptions`). The option *set* is unchanged —
4526
+ * country only reorders.
4527
+ */
4528
+ storeDetectedCountries: assign(({ context, event }) => {
4529
+ const countries = event.output ?? [];
4530
+ return {
4531
+ detectedCountries: countries,
4532
+ digitalIdRedirectOptions: getAvailableDigitalIdRedirectOptions(context.config, countries)
4533
+ };
4534
+ }),
4535
+ /**
4536
+ * The user picked a country on the chooser: it becomes the strongest
4537
+ * country, the detected ones stay behind it as tiebreakers, and the
4538
+ * redirect options are re-ranked. An invalid code is ignored.
4539
+ */
4540
+ setChooserCountry: assign(({ context, event }) => {
4541
+ const country = event.type === "SET_CHOOSER_COUNTRY" ? normalizeCountryCode(event.country) : void 0;
4542
+ if (!country) return {};
4543
+ const countries = [country, ...(context.detectedCountries ?? []).filter((detected) => detected !== country)];
4544
+ return {
4545
+ detectedCountries: countries,
4546
+ digitalIdRedirectOptions: rankDigitalIdRedirectOptions(context.digitalIdRedirectOptions, context.config, countries)
4547
+ };
4548
+ }),
4549
+ /** Detection failed outright: mark it done so it is not retried. */
4550
+ markCountryDetectionFailed: assign({ detectedCountries: () => [] }),
4233
4551
  /**
4234
4552
  * Records a completed device-wallet (mDL) handshake from the child's
4235
4553
  * `onDone` output. Wallet credentials are single-side; the verified
@@ -4271,6 +4589,13 @@ const idCaptureMachine = setup({
4271
4589
  digitalIdResumeProviderId: () => void 0,
4272
4590
  digitalIdRoute: () => void 0
4273
4591
  }),
4592
+ /**
4593
+ * Drops the persisted return-leg record once the digital-ID attempt ends.
4594
+ * Fire-and-forget: a stale record is only read on the host's return route.
4595
+ */
4596
+ clearPendingDigitalIdRedirect: ({ context }) => {
4597
+ clearPendingRedirect(resolveIdCaptureDependencies(context.dependencies).storage).catch(() => void 0);
4598
+ },
4274
4599
  incrementProcessingExpiredAttempts: assign(({ context }) => ({ processingExpiredAttempts: context.processingExpiredAttempts + 1 })),
4275
4600
  setSkipProcessId: assign({ skipProcessId: () => true }),
4276
4601
  setExpiredFromUpload: assign({ expiredFromUpload: () => true }),
@@ -4283,10 +4608,15 @@ const idCaptureMachine = setup({
4283
4608
  isCaptureOnlyDelivery: ({ context }) => hasOnCaptureCallback(context.config),
4284
4609
  isProtectedUploadFailure: ({ event }) => protectedFailure(event)?.failure.stage === "upload",
4285
4610
  isProtectedManualRefusal: ({ event }) => protectedFailure(event)?.failure.stage === "manualCommit",
4611
+ isProtectedAcquireDenied: ({ event }) => {
4612
+ const failure = protectedFailure(event)?.failure;
4613
+ return failure?.stage === "acquire" && isCameraDenialErrorName(failure.errorName);
4614
+ },
4286
4615
  canCaptureManuallyDuringDetection: ({ context }) => context.config.showCaptureButtonInAuto === true && context.detectionStatus !== "capturing",
4287
4616
  hasShowTutorial: hasShowTutorialGuard,
4288
4617
  hasAgeAssurance: hasAgeAssuranceGuard,
4289
4618
  hasShowDocumentChooser: hasShowDocumentChooserGuard,
4619
+ needsCountryDetection: needsCountryDetectionGuard,
4290
4620
  isPermissionGranted: ({ event }) => isPermissionGrantedGuard({ event: asPublicIdEvent(event) }),
4291
4621
  isReadyForCapture: ({ context, event }) => isReadyForCaptureGuard({
4292
4622
  context,
@@ -4313,6 +4643,7 @@ const idCaptureMachine = setup({
4313
4643
  isDeepsightReady: isDeepsightReadyGuard,
4314
4644
  needsDeepsightInit: needsDeepsightInitGuard,
4315
4645
  hasNoDocumentTypesAvailable: hasNoDocumentTypesAvailableGuard,
4646
+ isSoleDigitalIdRedirectWithoutChooser: isSoleDigitalIdRedirectWithoutChooserGuard,
4316
4647
  isDigitalIdUploadSelected: ({ event }) => isDigitalIdUploadSelectedGuard({ event: asPublicIdEvent(event) }),
4317
4648
  isDigitalIdRedirectSelected: ({ event }) => isDigitalIdRedirectSelectedGuard({ event: asPublicIdEvent(event) }),
4318
4649
  isDigitalIdSelected: ({ event }) => isDigitalIdSelectedGuard({ event: asPublicIdEvent(event) }),
@@ -4383,9 +4714,22 @@ const idCaptureMachine = setup({
4383
4714
  },
4384
4715
  context: ({ input, self }) => {
4385
4716
  attachIdProtectedCaptureController(self, createIdProtectedCaptureController());
4717
+ const carried = carryAttempts(input.config.isSecondId ? "secondIdCapture" : "idCapture", self, (s, previous) => {
4718
+ const c = s.context;
4719
+ const child = s.children.digitalIdUpload?.getSnapshot()?.context;
4720
+ const left = Math.min(previous.attemptsRemaining ?? Infinity, c.attemptsRemaining, child?.attemptsRemaining ?? Infinity);
4721
+ return {
4722
+ attemptsRemaining: s.matches("expiredExhausted") || left <= 0 && left < c.config.captureAttempts ? -1 : left,
4723
+ expiredAttempts: Math.max(previous.expiredAttempts ?? 0, c.expiredAttempts),
4724
+ expiredRedirected: c.expiredRedirected,
4725
+ processingExpiredAttempts: c.processingExpiredAttempts,
4726
+ skipProcessId: previous.skipProcessId === true || c.skipProcessId || s.matches("expiredExhausted") && !shouldProcessAfterExhaustionGuard({ context: c })
4727
+ };
4728
+ });
4729
+ const configured = input.config.captureAttempts ?? 1;
4386
4730
  const config = {
4387
4731
  ...input.config,
4388
- captureAttempts: input.config.captureAttempts ?? 1
4732
+ captureAttempts: Math.max(0, Math.min(configured, carried.attemptsRemaining ?? configured))
4389
4733
  };
4390
4734
  const currentMode = input.config.onlyBack ? "back" : !input.config.enableId && input.config.enablePassport ? "passport" : input.config.usSmartCapture ? "back" : "front";
4391
4735
  return {
@@ -4409,11 +4753,11 @@ const idCaptureMachine = setup({
4409
4753
  barcodeFastPathAttempted: false,
4410
4754
  barcodeFastPathCaptured: false,
4411
4755
  recordingSession: void 0,
4412
- attemptsRemaining: config.captureAttempts,
4413
- expiredAttempts: 0,
4414
- expiredRedirected: false,
4415
- processingExpiredAttempts: 0,
4416
- skipProcessId: input.config.skipProcessId === true,
4756
+ attemptsRemaining: Math.min(config.captureAttempts, carried.attemptsRemaining ?? Infinity),
4757
+ expiredAttempts: carried.expiredAttempts ?? 0,
4758
+ expiredRedirected: carried.expiredRedirected ?? false,
4759
+ processingExpiredAttempts: carried.processingExpiredAttempts ?? 0,
4760
+ skipProcessId: input.config.skipProcessId === true || (carried.attemptsRemaining ?? 0) < 0 && carried.skipProcessId === true,
4417
4761
  expiredFromUpload: false,
4418
4762
  isDigitalUpload: false,
4419
4763
  isDigitalIdRedirect: false,
@@ -4442,8 +4786,10 @@ const idCaptureMachine = setup({
4442
4786
  dependencies: resolveIdCaptureDependencies(input.dependencies),
4443
4787
  disableIpify: getDisableIpify(),
4444
4788
  deepsightInitAttempted: false,
4445
- availableDocumentTypes: getAvailableDocumentTypes(input.config, { credentialsAvailable: input.dependencies?.credentials?.isAvailable() ?? false }),
4789
+ availableDocumentTypes: getAvailableDocumentTypes(input.config, getDigitalIdPlatformSupport(input.dependencies?.credentials)),
4446
4790
  digitalIdRedirectOptions: getAvailableDigitalIdRedirectOptions(input.config),
4791
+ detectedCountries: void 0,
4792
+ walletDevice: resolveWalletDevice(),
4447
4793
  selectedDigitalIdProviderId: void 0,
4448
4794
  captureResolution: void 0,
4449
4795
  cameraFallbackLevel: void 0,
@@ -4460,11 +4806,25 @@ const idCaptureMachine = setup({
4460
4806
  target: "digitalIdRedirectReturning",
4461
4807
  guard: "hasDigitalIdReturn"
4462
4808
  },
4809
+ {
4810
+ target: "processing",
4811
+ guard: ({ context }) => context.attemptsRemaining < 0,
4812
+ actions: ["flagIdManualReview", "setForceFinishAfterProcessing"]
4813
+ },
4463
4814
  {
4464
4815
  target: "error",
4465
4816
  guard: "hasNoDocumentTypesAvailable",
4466
4817
  actions: [() => console.error(ID_CAPTURE_NO_DOCUMENT_TYPES_ERROR), assign({ error: () => ID_CAPTURE_NO_DOCUMENT_TYPES_ERROR })]
4467
4818
  },
4819
+ {
4820
+ target: "digitalIdRedirect",
4821
+ guard: "isSoleDigitalIdRedirectWithoutChooser",
4822
+ actions: ["selectSoleDigitalIdRedirect"]
4823
+ },
4824
+ {
4825
+ target: "detectingCountry",
4826
+ guard: and(["hasShowDocumentChooser", "needsCountryDetection"])
4827
+ },
4468
4828
  {
4469
4829
  target: "chooser",
4470
4830
  guard: "hasShowDocumentChooser"
@@ -4479,37 +4839,53 @@ const idCaptureMachine = setup({
4479
4839
  },
4480
4840
  { target: "loading" }
4481
4841
  ] } },
4482
- chooser: { on: { SELECT_DOCUMENT: [
4483
- {
4484
- target: "digitalIdRouting",
4485
- guard: "isDigitalIdSelected",
4486
- actions: ["setSelectedDocument", "resolveDigitalIdRoute"]
4487
- },
4488
- {
4489
- target: "digitalIdRedirect",
4490
- guard: "isDigitalIdRedirectSelected",
4491
- actions: ["setSelectedDocument"]
4492
- },
4493
- {
4494
- target: "digitalIdUpload",
4495
- guard: "isDigitalIdUploadSelected",
4496
- actions: ["setSelectedDocument"]
4497
- },
4498
- {
4499
- target: "ageVerification",
4500
- guard: "hasAgeAssurance",
4501
- actions: ["setSelectedDocument", "setCurrentMode"]
4502
- },
4503
- {
4504
- target: "tutorial",
4505
- guard: "hasShowTutorial",
4506
- actions: ["setSelectedDocument", "setCurrentMode"]
4842
+ detectingCountry: { invoke: {
4843
+ id: "detectCountries",
4844
+ src: "detectCountries",
4845
+ input: ({ context }) => ({ dependencies: context.dependencies?.countryDetection ?? {} }),
4846
+ onDone: {
4847
+ target: "chooser",
4848
+ actions: "storeDetectedCountries"
4507
4849
  },
4508
- {
4509
- target: "loading",
4510
- actions: ["setSelectedDocument", "setCurrentMode"]
4850
+ onError: {
4851
+ target: "chooser",
4852
+ actions: "markCountryDetectionFailed"
4511
4853
  }
4512
- ] } },
4854
+ } },
4855
+ chooser: { on: {
4856
+ SET_CHOOSER_COUNTRY: { actions: "setChooserCountry" },
4857
+ SELECT_DOCUMENT: [
4858
+ {
4859
+ target: "digitalIdRouting",
4860
+ guard: "isDigitalIdSelected",
4861
+ actions: ["setSelectedDocument", "resolveDigitalIdRoute"]
4862
+ },
4863
+ {
4864
+ target: "digitalIdRedirect",
4865
+ guard: "isDigitalIdRedirectSelected",
4866
+ actions: ["setSelectedDocument"]
4867
+ },
4868
+ {
4869
+ target: "digitalIdUpload",
4870
+ guard: "isDigitalIdUploadSelected",
4871
+ actions: ["setSelectedDocument"]
4872
+ },
4873
+ {
4874
+ target: "ageVerification",
4875
+ guard: "hasAgeAssurance",
4876
+ actions: ["setSelectedDocument", "setCurrentMode"]
4877
+ },
4878
+ {
4879
+ target: "tutorial",
4880
+ guard: "hasShowTutorial",
4881
+ actions: ["setSelectedDocument", "setCurrentMode"]
4882
+ },
4883
+ {
4884
+ target: "loading",
4885
+ actions: ["setSelectedDocument", "setCurrentMode"]
4886
+ }
4887
+ ]
4888
+ } },
4513
4889
  ageVerification: {
4514
4890
  entry: "startProtectedMetadataPreparation",
4515
4891
  on: { NEXT_STEP: [{
@@ -4824,6 +5200,11 @@ const idCaptureMachine = setup({
4824
5200
  guard: "isProtectedUploadFailure",
4825
5201
  actions: "setProtectedUploadFailure"
4826
5202
  },
5203
+ {
5204
+ target: "#idCapture.permissions.denied",
5205
+ guard: "isProtectedAcquireDenied",
5206
+ actions: assign({ permissionResult: () => "denied" })
5207
+ },
4827
5208
  {
4828
5209
  target: "#idCapture.error",
4829
5210
  actions: "setProtectedFailure"
@@ -5475,6 +5856,11 @@ const idCaptureMachine = setup({
5475
5856
  target: "digitalIdRedirect",
5476
5857
  actions: ["storePendingDigitalIdRedirect"]
5477
5858
  },
5859
+ {
5860
+ target: "detectingCountry",
5861
+ guard: and(["hasShowDocumentChooser", "needsCountryDetection"]),
5862
+ actions: ["clearDigitalIdAttempt"]
5863
+ },
5478
5864
  {
5479
5865
  target: "chooser",
5480
5866
  guard: "hasShowDocumentChooser",
@@ -5485,14 +5871,22 @@ const idCaptureMachine = setup({
5485
5871
  actions: ["clearDigitalIdAttempt"]
5486
5872
  }
5487
5873
  ],
5488
- onError: [{
5489
- target: "chooser",
5490
- guard: "hasShowDocumentChooser",
5491
- actions: ["clearDigitalIdAttempt"]
5492
- }, {
5493
- target: "loading",
5494
- actions: ["clearDigitalIdAttempt"]
5495
- }]
5874
+ onError: [
5875
+ {
5876
+ target: "detectingCountry",
5877
+ guard: and(["hasShowDocumentChooser", "needsCountryDetection"]),
5878
+ actions: ["clearDigitalIdAttempt"]
5879
+ },
5880
+ {
5881
+ target: "chooser",
5882
+ guard: "hasShowDocumentChooser",
5883
+ actions: ["clearDigitalIdAttempt"]
5884
+ },
5885
+ {
5886
+ target: "loading",
5887
+ actions: ["clearDigitalIdAttempt"]
5888
+ }
5889
+ ]
5496
5890
  },
5497
5891
  on: { QUIT: { target: "closed" } }
5498
5892
  },
@@ -5525,17 +5919,31 @@ const idCaptureMachine = setup({
5525
5919
  {
5526
5920
  guard: "isDigitalIdRedirectCompleted",
5527
5921
  target: "#idCapture.finished",
5528
- actions: ["storeDigitalIdRedirectResult"]
5922
+ actions: ["storeDigitalIdRedirectResult", "clearPendingDigitalIdRedirect"]
5923
+ },
5924
+ {
5925
+ target: "closed",
5926
+ guard: "isSoleDigitalIdRedirectWithoutChooser",
5927
+ actions: ["clearPendingDigitalIdRedirect"]
5928
+ },
5929
+ {
5930
+ target: "detectingCountry",
5931
+ guard: and(["hasShowDocumentChooser", "needsCountryDetection"]),
5932
+ actions: ["clearPendingDigitalIdRedirect"]
5529
5933
  },
5530
5934
  {
5531
5935
  target: "chooser",
5532
- guard: "hasShowDocumentChooser"
5936
+ guard: "hasShowDocumentChooser",
5937
+ actions: ["clearPendingDigitalIdRedirect"]
5533
5938
  },
5534
- { target: "closed" }
5939
+ {
5940
+ target: "closed",
5941
+ actions: ["clearPendingDigitalIdRedirect"]
5942
+ }
5535
5943
  ],
5536
5944
  onError: {
5537
5945
  target: "#idCapture.error",
5538
- actions: assign({ error: ({ event }) => String(event.error) })
5946
+ actions: [assign({ error: ({ event }) => String(event.error) }), "clearPendingDigitalIdRedirect"]
5539
5947
  }
5540
5948
  },
5541
5949
  on: {
@@ -5615,4 +6023,4 @@ function provideIdProtectedCaptureController(machine, controller) {
5615
6023
  });
5616
6024
  }
5617
6025
  //#endregion
5618
- export { mapDeviceWalletScreenName as _, isRedirectFlowType as a, createIdCaptureOnlyDeliveryActor as c, captureOnlyNeedsBack as d, hasOnCaptureCallback as f, BrowserDigitalCredentialsProvider as g, createDeviceWalletManager as h, DIGITAL_ID_REGISTRY as i, createIdProtectedCaptureController as l, renderWallet as m, provideIdProtectedCaptureController as n, resolveDigitalIdImplementation as o, pickIdCaptureOnlyConfig as p, DIGITAL_ID_DOCUMENT_TYPES as r, attachIdProtectedCaptureController as s, idCaptureMachine as t, findIdProtectedCaptureController as u, resolveWalletPlatform as v };
6026
+ export { mapDeviceWalletScreenName as _, createIdProtectedCaptureController as a, hasOnCaptureCallback as c, DIGITAL_ID_REGISTRY as d, isRedirectFlowType as f, BrowserDigitalCredentialsProvider as g, createDeviceWalletManager as h, createIdCaptureOnlyDeliveryActor as i, pickIdCaptureOnlyConfig as l, renderWallet as m, provideIdProtectedCaptureController as n, findIdProtectedCaptureController as o, resolveDigitalIdImplementation as p, attachIdProtectedCaptureController as r, captureOnlyNeedsBack as s, idCaptureMachine as t, DIGITAL_ID_DOCUMENT_TYPES as u, resolveWalletPlatform as v };