@incodetech/core 0.0.0-dev-20260613-66946835 → 0.0.0-dev-20260616-e026f0c8

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 (218) hide show
  1. package/dist/{OpenViduRecordingProvider-DtCkxhaa.esm.js → OpenViduRecordingProvider-BDIlX9Cq.esm.js} +1 -1
  2. package/dist/{StreamCanvasCapture-CPTcu6u6.esm.js → StreamCanvasCapture-Dr5n_iK1.esm.js} +1 -1
  3. package/dist/{StreamCanvasCapture-DFBEzBLB.d.ts → StreamCanvasCapture-uQFmjDCE.d.ts} +1 -1
  4. package/dist/{addressSearch-BQCvIe1E.esm.js → addressSearch-4xxBiFtH.esm.js} +4 -4
  5. package/dist/{ae-signature-DxX99lOP.esm.js → ae-signature-C8mNUYSC.esm.js} +1 -1
  6. package/dist/ae-signature.d.ts +3 -3
  7. package/dist/ae-signature.esm.js +9 -9
  8. package/dist/antifraud.d.ts +3 -3
  9. package/dist/antifraud.esm.js +6 -6
  10. package/dist/{antifraudManager-DI9S7XTK.esm.js → antifraudManager-By70WUpS.esm.js} +3 -3
  11. package/dist/{antifraudManager-CMzQ05Gx.d.ts → antifraudManager-vkuogwAe.d.ts} +2 -2
  12. package/dist/{antifraudStateMachine-ZzjAr546.esm.js → antifraudStateMachine-DPs0Knyq.esm.js} +3 -3
  13. package/dist/authentication.d.ts +13 -13
  14. package/dist/authentication.esm.js +27 -27
  15. package/dist/{authenticationManager-bKzA0gLB.d.ts → authenticationManager-CDxVMHF1.d.ts} +2 -2
  16. package/dist/{authenticationManager-CwcMuMzK.esm.js → authenticationManager-Dz4IJIrK.esm.js} +6 -6
  17. package/dist/{authenticationStateMachine-D7BUqBCb.esm.js → authenticationStateMachine-ZqIWl4M4.esm.js} +8 -8
  18. package/dist/{backCameraStream-lMXrbEpC.esm.js → backCameraStream-iftkf3rd.esm.js} +3 -3
  19. package/dist/browser-8Za96B1X-CUY3snMa.esm.js +1425 -0
  20. package/dist/{browserSimulation-DJfvkbAE.esm.js → browserSimulation-CGjpdNA1.esm.js} +2 -2
  21. package/dist/camera.d.ts +1 -1
  22. package/dist/camera.esm.js +4 -4
  23. package/dist/certificate-issuance.d.ts +30 -30
  24. package/dist/certificate-issuance.esm.js +7 -7
  25. package/dist/{certificateIssuanceStateMachine-DpPZoGT3.esm.js → certificateIssuanceStateMachine-DB2r-cpB.esm.js} +4 -4
  26. package/dist/consent.d.ts +3 -3
  27. package/dist/consent.esm.js +6 -6
  28. package/dist/{consentManager-BIoVcRI-.esm.js → consentManager-ChvHt6T_.esm.js} +3 -3
  29. package/dist/{consentManager-DnLUS1W3.d.ts → consentManager-DWB0fOnC.d.ts} +52 -52
  30. package/dist/{consentStateMachine-DbaAIypS.esm.js → consentStateMachine-CWypW8J8.esm.js} +3 -3
  31. package/dist/cpf-ocr.d.ts +3 -3
  32. package/dist/cpf-ocr.esm.js +6 -6
  33. package/dist/{cpfOcrManager-qoIZene3.esm.js → cpfOcrManager-B52QLxQV.esm.js} +5 -5
  34. package/dist/{cpfOcrManager-aJ4f8mX0.d.ts → cpfOcrManager-DZudorH5.d.ts} +25 -25
  35. package/dist/cross-document-data-match.d.ts +1 -1
  36. package/dist/cross-document-data-match.esm.js +5 -5
  37. package/dist/curp-validation.d.ts +7 -7
  38. package/dist/curp-validation.esm.js +6 -6
  39. package/dist/{curpValidationManager-BYxOLnL5.d.ts → curpValidationManager-CeXO_2dN.d.ts} +3 -3
  40. package/dist/{curpValidationManager-Bzxw5FVS.esm.js → curpValidationManager-De6xoNE4.esm.js} +3 -3
  41. package/dist/{curpValidationStateMachine-HGNg1cZZ.esm.js → curpValidationStateMachine-Cx2u6xYU.esm.js} +3 -3
  42. package/dist/custom-fields.d.ts +2 -2
  43. package/dist/custom-fields.esm.js +5 -5
  44. package/dist/custom-watchlist.d.ts +1 -1
  45. package/dist/custom-watchlist.esm.js +5 -5
  46. package/dist/{customWatchlistStateMachine-DOv0pHd_.esm.js → customWatchlistStateMachine-EkXjc819.esm.js} +3 -3
  47. package/dist/{deepsightLoader-Cm_PBWfU.esm.js → deepsightLoader-cR0EgL9O.esm.js} +13 -13
  48. package/dist/{deepsightService-C5vSOVue.esm.js → deepsightService-40p8oygL.esm.js} +7 -7
  49. package/dist/{deepsightService-DmCqRh9-.d.ts → deepsightService-BpVpDm2O.d.ts} +1 -1
  50. package/dist/device.esm.js +4 -4
  51. package/dist/document-capture.d.ts +248 -248
  52. package/dist/document-capture.esm.js +13 -13
  53. package/dist/document-upload.d.ts +50 -50
  54. package/dist/document-upload.esm.js +8 -8
  55. package/dist/{documentCaptureStateMachine-D6ZC_Ty0.esm.js → documentCaptureStateMachine-BBEoBbLb.esm.js} +7 -7
  56. package/dist/dynamic-forms.d.ts +2 -2
  57. package/dist/dynamic-forms.esm.js +5 -5
  58. package/dist/ekyb.d.ts +6 -6
  59. package/dist/ekyb.esm.js +16 -16
  60. package/dist/{ekybStateMachine-B0r8yOSu.esm.js → ekybStateMachine-iBJaSAJs.esm.js} +5 -5
  61. package/dist/ekyc.d.ts +3 -3
  62. package/dist/ekyc.esm.js +8 -8
  63. package/dist/{ekycStateMachine-IqmWlBh8.esm.js → ekycStateMachine-dXnYshTa.esm.js} +5 -5
  64. package/dist/electronic-signature.d.ts +3 -3
  65. package/dist/electronic-signature.esm.js +8 -8
  66. package/dist/{electronicSignatureManager-D2WzDJUK.esm.js → electronicSignatureManager-Db9SeoGj.esm.js} +6 -6
  67. package/dist/email.d.ts +4 -4
  68. package/dist/email.esm.js +8 -8
  69. package/dist/{emailManager-DnID6SGV.d.ts → emailManager-DLFWfHIl.d.ts} +3 -3
  70. package/dist/{emailManager-BbI08-We.esm.js → emailManager-DQJIAsix.esm.js} +4 -4
  71. package/dist/{emailStateMachine-CgLix5Wg.esm.js → emailStateMachine-C1DabizS.esm.js} +5 -5
  72. package/dist/{events-BAfXOOYZ.esm.js → events-CmarQoum.esm.js} +1 -1
  73. package/dist/events.esm.js +2 -2
  74. package/dist/extensibility.d.ts +26 -26
  75. package/dist/extensibility.esm.js +57 -57
  76. package/dist/{externalFetch-h7WAdNPQ.esm.js → externalFetch-crimxkN9.esm.js} +1 -1
  77. package/dist/face-match.d.ts +1 -1
  78. package/dist/face-match.esm.js +5 -5
  79. package/dist/{faceCaptureManagerFactory-C2o4b80r.d.ts → faceCaptureManagerFactory-BQg4HVQ0.d.ts} +9 -9
  80. package/dist/{faceCaptureManagerFactory-BIG0X_6p.esm.js → faceCaptureManagerFactory-ByC4Qa8y.esm.js} +4 -4
  81. package/dist/{faceCaptureSetup-CWZnwDLg.esm.js → faceCaptureSetup-B2H2mNGa.esm.js} +7 -7
  82. package/dist/{faceMatchStateMachine-dCBdFrmq.esm.js → faceMatchStateMachine-eQOGyK1R.esm.js} +3 -3
  83. package/dist/field-comparison.d.ts +3 -3
  84. package/dist/field-comparison.esm.js +5 -5
  85. package/dist/{fieldComparisonManager-BOIJSYPj.d.ts → fieldComparisonManager-CgJctoEw.d.ts} +2 -2
  86. package/dist/{fieldComparisonManager-Ce8rDT_m.esm.js → fieldComparisonManager-IaJfvmEt.esm.js} +4 -4
  87. package/dist/fiscal-qr.d.ts +3 -3
  88. package/dist/fiscal-qr.esm.js +12 -12
  89. package/dist/flow-events.d.ts +6 -6
  90. package/dist/flow.d.ts +12 -12
  91. package/dist/flow.esm.js +16 -16
  92. package/dist/{flowCompletionService-D8OXFjRA.esm.js → flowCompletionService-D9l6fDFY.esm.js} +3 -3
  93. package/dist/{flowServices-D2O1zeDp.esm.js → flowServices-BRfa1_9p.esm.js} +4 -4
  94. package/dist/geolocation.d.ts +2 -2
  95. package/dist/geolocation.esm.js +6 -6
  96. package/dist/{geolocationStateMachine-CiwWx_j9.esm.js → geolocationStateMachine-CB4yyRz1.esm.js} +4 -4
  97. package/dist/{getDeviceClass-BnkJjTVR.esm.js → getDeviceClass-rXKlXywy.esm.js} +1 -1
  98. package/dist/government-validation.d.ts +3 -3
  99. package/dist/government-validation.esm.js +7 -7
  100. package/dist/{governmentValidationStateMachine-Kvfdljb6.esm.js → governmentValidationStateMachine-DXqbvuKL.esm.js} +5 -5
  101. package/dist/home.d.ts +15 -15
  102. package/dist/home.esm.js +3 -3
  103. package/dist/http.esm.js +2 -2
  104. package/dist/id-ocr.d.ts +54 -54
  105. package/dist/id-ocr.esm.js +6 -6
  106. package/dist/id-verification.d.ts +27 -27
  107. package/dist/id-verification.esm.js +5 -5
  108. package/dist/id.d.ts +12 -12
  109. package/dist/id.esm.js +31 -31
  110. package/dist/{idCaptureManager-MCG6QtGK.esm.js → idCaptureManager-Cm-IXB70.esm.js} +5 -5
  111. package/dist/{idCaptureManager-CLOK998H.d.ts → idCaptureManager-Wn84cPTa.d.ts} +8 -8
  112. package/dist/{idCaptureStateMachine-vkppQGiI.esm.js → idCaptureStateMachine-CU3F89Pn.esm.js} +19 -19
  113. package/dist/{idOcrStateMachine-Dmqb6Lay.esm.js → idOcrStateMachine-BwksZ-bt.esm.js} +5 -5
  114. package/dist/{idVerificationStateMachine-DoxfID_7.esm.js → idVerificationStateMachine-BMzgkkbQ.esm.js} +3 -3
  115. package/dist/identity-reuse.d.ts +3 -3
  116. package/dist/identity-reuse.esm.js +6 -6
  117. package/dist/{identityReuseManager-DcBFqi3g.esm.js → identityReuseManager-Bew667Pj.esm.js} +3 -3
  118. package/dist/{identityReuseManager-DvE8_LEf.d.ts → identityReuseManager-mEnl2R8N.d.ts} +33 -33
  119. package/dist/{identityReuseStateMachine-BYee6d-o.esm.js → identityReuseStateMachine-CbR5itoo.esm.js} +3 -3
  120. package/dist/{index-D6hZs1C6.d.ts → index-B1r8U5de.d.ts} +169 -169
  121. package/dist/index-Dn9cDS6f.d.ts +99 -0
  122. package/dist/{index-BbKckxUr.d.ts → index-cIuvyWMa.d.ts} +2 -2
  123. package/dist/index.d.ts +3 -2
  124. package/dist/index.esm.js +13 -12
  125. package/dist/{invokeOnCaptureCallback-DW53sNuV.esm.js → invokeOnCaptureCallback-DyJrH089.esm.js} +1 -1
  126. package/dist/{lib-BCAntT8H.esm.js → lib-DOI53AqI.esm.js} +1 -1
  127. package/dist/mandatory-consent.d.ts +7 -7
  128. package/dist/mandatory-consent.esm.js +6 -6
  129. package/dist/{mandatoryConsentManager-BjX0zGkL.d.ts → mandatoryConsentManager-HAXD0YGt.d.ts} +50 -50
  130. package/dist/{mandatoryConsentManager-CaZap2vM.esm.js → mandatoryConsentManager-kbO0Dr65.esm.js} +3 -3
  131. package/dist/{mandatoryConsentStateMachine-DebtfjHH.esm.js → mandatoryConsentStateMachine-DtjGqH2e.esm.js} +3 -3
  132. package/dist/openviduLazy--VDjpeVq.esm.js +3 -0
  133. package/dist/{openviduLazy-D7RY-Wk1.esm.js → openviduLazy-BapX8Ljx.esm.js} +2 -2
  134. package/dist/{permissionGuards-D-u5o-ZS.esm.js → permissionGuards-MDEdZAXO.esm.js} +1 -1
  135. package/dist/{permissionServices-DOMAS5FL.esm.js → permissionServices-BApXq7a0.esm.js} +3 -3
  136. package/dist/phone.d.ts +4 -4
  137. package/dist/phone.esm.js +8 -8
  138. package/dist/{phoneManager-C0NWX3dt.esm.js → phoneManager-CZA4CST1.esm.js} +4 -4
  139. package/dist/{phoneManager-BjqCfWeD.d.ts → phoneManager-CkEiuAuM.d.ts} +3 -3
  140. package/dist/{phoneStateMachine-BGhYP8mx.esm.js → phoneStateMachine-BQNuJGjq.esm.js} +5 -5
  141. package/dist/{qe-signature-D10dlZ0x.esm.js → qe-signature-BVUV3TE_.esm.js} +1 -1
  142. package/dist/qe-signature.d.ts +3 -3
  143. package/dist/qe-signature.esm.js +9 -9
  144. package/dist/{recordingService-CBkqroyl.esm.js → recordingService-Cw3hJgT2.esm.js} +15 -15
  145. package/dist/redirect-to-mobile.d.ts +3 -3
  146. package/dist/redirect-to-mobile.esm.js +8 -8
  147. package/dist/{redirectToMobileManager-DK7C4-jS.esm.js → redirectToMobileManager-B4PTmB3H.esm.js} +4 -4
  148. package/dist/{redirectToMobileManager-BzdVum0z.d.ts → redirectToMobileManager-DYQsXMqo.d.ts} +2 -2
  149. package/dist/{redirectToMobileStateMachine-POVmJ2pQ.esm.js → redirectToMobileStateMachine-BWrpS_sN.esm.js} +5 -5
  150. package/dist/{runChildModule-D1kJKuZp.esm.js → runChildModule-DaOsL9FE.esm.js} +3 -3
  151. package/dist/selfie.d.ts +13 -13
  152. package/dist/selfie.esm.js +28 -28
  153. package/dist/{selfieManager-CEO1DECO.d.ts → selfieManager-CxktnRiy.d.ts} +2 -2
  154. package/dist/{selfieManager-CQwbCfx1.esm.js → selfieManager-MGv9xxlB.esm.js} +6 -6
  155. package/dist/{selfieStateMachine-D0azn4SB.esm.js → selfieStateMachine-DIep8sRA.esm.js} +4 -4
  156. package/dist/{session-Bdskj4-a.esm.js → session-C_G3d7av.esm.js} +3 -3
  157. package/dist/session.d.ts +5 -5
  158. package/dist/session.esm.js +12 -12
  159. package/dist/{sessionInitializer-Dx4LN7nF.esm.js → sessionInitializer-Qlg7EwTl.esm.js} +7 -7
  160. package/dist/{setup-Xw_UwsPu.d.ts → setup-CPD1Cb_d.d.ts} +47 -1
  161. package/dist/{setup-ldc4smxh.esm.js → setup-wZGxwi9m.esm.js} +36 -7
  162. package/dist/signature.d.ts +2 -2
  163. package/dist/signature.esm.js +5 -5
  164. package/dist/{signatureStateMachine-B8MOqm3t.esm.js → signatureStateMachine-B7hxdXio.esm.js} +3 -3
  165. package/dist/{stats-DYtpAi8r.esm.js → stats-32mOt6D8.esm.js} +2 -2
  166. package/dist/stats.esm.js +3 -3
  167. package/dist/tri-Bn_ESCop.esm.js +326 -0
  168. package/dist/tri.d.ts +2 -0
  169. package/dist/tri.esm-Drm5tKql.esm.js +2590 -0
  170. package/dist/tri.esm.js +4 -0
  171. package/dist/trust-graph.d.ts +3 -3
  172. package/dist/trust-graph.esm.js +3 -3
  173. package/dist/{types-CMtiO-70.d.ts → types-CNiMvUpA.d.ts} +1 -1
  174. package/dist/{types-DVP3cl71.d.ts → types-D8y52YD5.d.ts} +2 -2
  175. package/dist/{types-GHZBxVAa.d.ts → types-DR2YKE_o.d.ts} +1 -1
  176. package/dist/wasm.d.ts +3 -2
  177. package/dist/wasm.esm.js +13 -12
  178. package/dist/watchlist-for-business.d.ts +1 -1
  179. package/dist/watchlist-for-business.esm.js +5 -5
  180. package/dist/watchlist.d.ts +1 -1
  181. package/dist/watchlist.esm.js +5 -5
  182. package/dist/{watchlistForBusinessStateMachine-C_w0OJjF.esm.js → watchlistForBusinessStateMachine-D3W0_TEt.esm.js} +3 -3
  183. package/dist/{watchlistStateMachine-C6vF9Zrp.esm.js → watchlistStateMachine-D8EXhr5W.esm.js} +3 -3
  184. package/dist/workflow.d.ts +145 -145
  185. package/dist/workflow.esm.js +63 -63
  186. package/package.json +8 -3
  187. package/dist/openviduLazy-Cen9OnxA.esm.js +0 -3
  188. /package/dist/{Actor-VPMjMiQi.d.ts → Actor-CeqUTqL9.d.ts} +0 -0
  189. /package/dist/{BrowserStorageProvider-r6RSzdfq.esm.js → BrowserStorageProvider-CGCKial0.esm.js} +0 -0
  190. /package/dist/{BrowserTimerProvider-CswUX7jZ.esm.js → BrowserTimerProvider-BVgutW_b.esm.js} +0 -0
  191. /package/dist/{ITimerCapability-BAVwUNw-.esm.js → ITimerCapability-BvH0pDwp.esm.js} +0 -0
  192. /package/dist/{IpifyProvider-WAAszwtP.esm.js → IpifyProvider-oZf7Ke1O.esm.js} +0 -0
  193. /package/dist/{Manager-TNEsbB6B.d.ts → Manager-CHiHBvMT.d.ts} +0 -0
  194. /package/dist/{MotionSensorProvider-CnpzpFUv.esm.js → MotionSensorProvider-C9fPAJdS.esm.js} +0 -0
  195. /package/dist/{StateMachine-D1N4vDv3.d.ts → StateMachine-HpHVxl3G.d.ts} +0 -0
  196. /package/dist/{WasmUtilProvider-DrWyN0yi.esm.js → WasmUtilProvider-CAZ4AD98.esm.js} +0 -0
  197. /package/dist/{api-D5AupVUC.esm.js → api-DUZwyz0o.esm.js} +0 -0
  198. /package/dist/{apiError-DNxc6p50.esm.js → apiError-D-GTvFrH.esm.js} +0 -0
  199. /package/dist/{camera-q1KoKNR1.d.ts → camera-D0c7ez3w.d.ts} +0 -0
  200. /package/dist/{camera-CBMl39hO.esm.js → camera-x4LjGTjZ.esm.js} +0 -0
  201. /package/dist/{canvas-Q8Scx3Gn.esm.js → canvas-7uX2izHb.esm.js} +0 -0
  202. /package/dist/{chunk-DHPE1s-n.esm.js → chunk-BK1xu56N.esm.js} +0 -0
  203. /package/dist/{cpf-BSpGHuIr.esm.js → cpf-xBg-DFNn.esm.js} +0 -0
  204. /package/dist/{dateUtils-D-YO9_Hp.esm.js → dateUtils-8dCcuArE.esm.js} +0 -0
  205. /package/dist/{endpoints-BUiak39U.esm.js → endpoints-B2t80MAM.esm.js} +0 -0
  206. /package/dist/{flowCompletionService-CamSPuV-.d.ts → flowCompletionService-DSPt5J5M.d.ts} +0 -0
  207. /package/dist/{getBrowser-CNCEFWPH.esm.js → getBrowser-Dv8LZyHE.esm.js} +0 -0
  208. /package/dist/{getDeviceClass-C3N2KaOI.esm.js → getDeviceClass-C0zrM97a.esm.js} +0 -0
  209. /package/dist/{http-CkcES084.esm.js → http-B2UWIXGr.esm.js} +0 -0
  210. /package/dist/{otp-Buh7Tv8k.d.ts → otp-BHJnjEEc.d.ts} +0 -0
  211. /package/dist/{otp-BiWjw9ZQ.esm.js → otp-BcSa5nTM.esm.js} +0 -0
  212. /package/dist/{platform-DctkySJU.esm.js → platform-BfoqeM61.esm.js} +0 -0
  213. /package/dist/{types-CruqHl68.d.ts → types-C1ixFPzO.d.ts} +0 -0
  214. /package/dist/{types-rL_0z8ZR.esm.js → types-C3Yf5jrM.esm.js} +0 -0
  215. /package/dist/{types-BBaEWy5n.d.ts → types-F0IXbaCB.d.ts} +0 -0
  216. /package/dist/{urlUtils-C9o6zrp8.esm.js → urlUtils-8RNHyW3x.esm.js} +0 -0
  217. /package/dist/{warmup-bRMrjEVP.d.ts → warmup-CdT_pVcp.d.ts} +0 -0
  218. /package/dist/{xstate.esm-BMAePvR6.esm.js → xstate.esm-CbU9dpcC.esm.js} +0 -0
@@ -0,0 +1,326 @@
1
+ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BVgutW_b.esm.js";
2
+
3
+ //#region ../infra/src/providers/browser/BrowserLazyImportProvider.ts
4
+ /**
5
+ * Per-module {@link LazyImport} handle.
6
+ *
7
+ * Encapsulates the caching, deduplication, and optional-timeout logic for a
8
+ * single lazily-imported module:
9
+ * - Caches the resolved module (via a dedicated `loaded` flag, so a module
10
+ * that legitimately resolves `undefined` is still cached) and returns it
11
+ * immediately on subsequent calls.
12
+ * - Deduplicates concurrent `load()` calls behind a single in-flight promise.
13
+ * - Optionally races the dynamic import against a configurable timeout (ms).
14
+ * - On timeout or import error: emits a `console.warn`, clears the in-flight
15
+ * promise so the next `load()` call retries, and resolves `undefined`.
16
+ *
17
+ * An attempt-generation token (`attempt`) guards against a stale import
18
+ * mutating state after it has been superseded: when a load times out (or the
19
+ * handle is `reset()`), the token is bumped so the still-pending import can no
20
+ * longer write to `cachedValue` / `loaded`.
21
+ */
22
+ var LazyImportHandle = class {
23
+ constructor(_loader, _options, _timer) {
24
+ this._loader = _loader;
25
+ this._options = _options;
26
+ this._timer = _timer;
27
+ this._loaded = false;
28
+ this._attempt = 0;
29
+ }
30
+ get() {
31
+ return this._cachedValue;
32
+ }
33
+ load() {
34
+ if (this._loaded) return Promise.resolve(this._cachedValue);
35
+ if (!this._inFlight) this._inFlight = this.startLoad();
36
+ return this._inFlight;
37
+ }
38
+ reset() {
39
+ this._cachedValue = void 0;
40
+ this._loaded = false;
41
+ this._inFlight = void 0;
42
+ this._attempt++;
43
+ }
44
+ startLoad() {
45
+ const attempt = ++this._attempt;
46
+ const { timeoutMs } = this._options;
47
+ let loaderResult;
48
+ try {
49
+ loaderResult = this._loader();
50
+ } catch (err) {
51
+ loaderResult = Promise.reject(err);
52
+ }
53
+ const loadPromise = loaderResult.then((value) => {
54
+ if (attempt === this._attempt) {
55
+ this._cachedValue = value;
56
+ this._loaded = true;
57
+ }
58
+ return value;
59
+ }, (err) => {
60
+ if (attempt === this._attempt) {
61
+ this.warnFailure(err);
62
+ this._inFlight = void 0;
63
+ }
64
+ });
65
+ if (timeoutMs === void 0) return loadPromise;
66
+ let timeoutHandle;
67
+ const timeoutPromise = new Promise((resolve) => {
68
+ timeoutHandle = this._timer.setTimeout(() => {
69
+ if (attempt === this._attempt) {
70
+ this.warnTimeout(timeoutMs);
71
+ this._inFlight = void 0;
72
+ this._attempt++;
73
+ }
74
+ resolve(void 0);
75
+ }, timeoutMs);
76
+ });
77
+ return Promise.race([loadPromise, timeoutPromise]).finally(() => {
78
+ if (timeoutHandle !== void 0) this._timer.clearTimeout(timeoutHandle);
79
+ });
80
+ }
81
+ warnFailure(err) {
82
+ const { label, moduleName } = this._options;
83
+ console.warn(`[${label}] Failed to load ${moduleName}; ${this.fallback()}`, err);
84
+ }
85
+ warnTimeout(timeoutMs) {
86
+ const { label, moduleName } = this._options;
87
+ console.warn(`[${label}] ${moduleName} failed to load within ${timeoutMs / 1e3}s; ${this.fallback()}`);
88
+ }
89
+ fallback() {
90
+ return this._options.disabledMessage ?? "module will be unavailable.";
91
+ }
92
+ };
93
+ /**
94
+ * Concrete implementation of {@link ILazyImportCapability}.
95
+ *
96
+ * `create()` returns a per-module {@link LazyImportHandle}. The
97
+ * {@link ITimerCapability} is injected so tests can replace the real
98
+ * `setTimeout`/`clearTimeout` with a controllable fake.
99
+ */
100
+ var BrowserLazyImportProvider = class BrowserLazyImportProvider {
101
+ constructor(timer) {
102
+ this._timer = timer ?? BrowserTimerProvider.getInstance();
103
+ }
104
+ static getInstance() {
105
+ return this._instance ??= new BrowserLazyImportProvider();
106
+ }
107
+ static resetInstance() {
108
+ this._instance = void 0;
109
+ }
110
+ create(loader, options) {
111
+ return new LazyImportHandle(loader, options, this._timer);
112
+ }
113
+ };
114
+
115
+ //#endregion
116
+ //#region ../infra/src/providers/browser/TransactionalRiskIntelligenceProvider.ts
117
+ const LAZY_IMPORT_OPTIONS = {
118
+ label: "TRI",
119
+ moduleName: "@incodetech/tri-sdk",
120
+ timeoutMs: 1e4,
121
+ disabledMessage: "TRI will be disabled for this session."
122
+ };
123
+ const importSdk = () => import("./tri.esm-Drm5tKql.esm.js");
124
+ /**
125
+ * Concrete implementation of {@link ITransactionalRiskIntelligenceCapability}.
126
+ *
127
+ * This is the **only** file in the repo that references `@incodetech/tri-sdk`.
128
+ * The third-party module is loaded via a dynamic `import()` the first time
129
+ * {@link setup} is called, so consumers that never opt into TRI (i.e. never
130
+ * pass `tri` to `setup()`) do not pay the bundle cost.
131
+ *
132
+ * `start()`, `stop()`, and `reset()` require a prior successful `setup()`
133
+ * call. The SDK cannot start without the foundation, collection-status check,
134
+ * and managers that `setup()` establishes. Calling these methods before
135
+ * `setup()` is a no-op that returns `'init-failed'`.
136
+ *
137
+ * The dynamic `import('@incodetech/tri-sdk')` is managed by
138
+ * {@link BrowserLazyImportProvider}, which races the import against a
139
+ * {@link LOAD_TIMEOUT_MS}-ms timeout. On timeout the provider warns, clears
140
+ * the cached promise (so a subsequent `setup()` can retry), and resolves
141
+ * `undefined`, gracefully disabling TRI for the session.
142
+ */
143
+ var TransactionalRiskIntelligenceProvider = class TransactionalRiskIntelligenceProvider {
144
+ constructor() {
145
+ this._lazySdk = BrowserLazyImportProvider.getInstance().create(importSdk, LAZY_IMPORT_OPTIONS);
146
+ }
147
+ static getInstance() {
148
+ return this._instance ??= new TransactionalRiskIntelligenceProvider();
149
+ }
150
+ static resetInstance() {
151
+ this._instance = void 0;
152
+ }
153
+ /**
154
+ * Lazy-loads `@incodetech/tri-sdk` (shared lazy handle) and exchanges the
155
+ * organization API key for a short-lived SDK token via the module's
156
+ * `createSession`. On a load timeout/failure returns an error-shaped session
157
+ * rather than throwing, so the boot path is never blocked.
158
+ */
159
+ async createSession(apiKey, options) {
160
+ const module = await this._lazySdk.load();
161
+ if (!module) return {
162
+ token: null,
163
+ eventsCollectionEnabled: false,
164
+ error: {
165
+ status: 0,
166
+ message: "TRI SDK failed to load"
167
+ }
168
+ };
169
+ return module.createSession(apiKey, options);
170
+ }
171
+ /**
172
+ * Lazy-loads `@incodetech/tri-sdk` on first call (with a {@link LOAD_TIMEOUT_MS}-ms
173
+ * timeout), then delegates to its `setup()`. Returns a promise that resolves
174
+ * once the SDK module has been fetched and the backend collection-status
175
+ * check has completed.
176
+ */
177
+ async setup(config) {
178
+ try {
179
+ const module = await this._lazySdk.load();
180
+ if (!module) return "init-failed";
181
+ return await module.default.setup(config);
182
+ } catch {
183
+ return "init-failed";
184
+ }
185
+ }
186
+ /**
187
+ * Begins behavioral data collection. Requires a prior successful `setup()`.
188
+ * Returns `'init-failed'` without starting if called before `setup()`.
189
+ */
190
+ async start() {
191
+ return this._getSdk()?.start() ?? Promise.resolve("init-failed");
192
+ }
193
+ /**
194
+ * Stops all collectors and managers. No-op when called before `setup()`.
195
+ */
196
+ async stop() {
197
+ return this._getSdk()?.stop() ?? Promise.resolve("init-failed");
198
+ }
199
+ /**
200
+ * Resets the TRI SDK to its initial state. No-op when called before `setup()`.
201
+ */
202
+ async reset() {
203
+ return this._getSdk()?.reset() ?? Promise.resolve("init-failed");
204
+ }
205
+ _getSdk() {
206
+ return this._lazySdk.get()?.default ?? null;
207
+ }
208
+ };
209
+
210
+ //#endregion
211
+ //#region src/integrations/tri/tri.ts
212
+ /**
213
+ * Returns the active TRI capability implementation.
214
+ *
215
+ * Core functions depend on {@link ITransactionalRiskIntelligenceCapability}
216
+ * (the interface) rather than the concrete provider class. The provider is
217
+ * referenced here only to supply the default singleton. This integration
218
+ * module is the single owner of the concrete provider reference — the rest of
219
+ * core goes through these functions ({@link resetTRIProviderInstance}, etc.)
220
+ * instead of importing the provider directly.
221
+ */
222
+ function getProvider() {
223
+ return TransactionalRiskIntelligenceProvider.getInstance();
224
+ }
225
+ /**
226
+ * Discards the cached TRI provider singleton so the next access constructs a
227
+ * fresh instance. Call from the SDK's `reset()` after `resetTRI()` to clear
228
+ * the started flag and lazy-import state.
229
+ */
230
+ function resetTRIProviderInstance() {
231
+ TransactionalRiskIntelligenceProvider.resetInstance();
232
+ }
233
+ /**
234
+ * Exchanges an organization API key for a short-lived TRI SDK token. This is
235
+ * the entry point that triggers the lazy-load of `@incodetech/tri-sdk` (via the
236
+ * provider's dynamic `import()`); the cached lazy handle is reused by a
237
+ * subsequent `setupTRI()`.
238
+ *
239
+ * In production the exchange should happen server-side. On a load timeout or
240
+ * failure the returned session carries `token: null` and an `error`, rather
241
+ * than throwing.
242
+ *
243
+ * @param apiKey - Organization API key.
244
+ * @param options - Optional `apiURL`, `signal`, and `timeout` overrides.
245
+ */
246
+ async function createTRISession(apiKey, options) {
247
+ return getProvider().createSession(apiKey, options);
248
+ }
249
+ /**
250
+ * Initializes TRI in a single step: resolves the config, calls `setupTRI`,
251
+ * and calls `startTRI`.
252
+ *
253
+ * Returns the resolved {@link TransactionalRiskIntelligenceState}. If the
254
+ * config cannot be resolved (e.g. missing `token` or `apiURL`), returns
255
+ * `'init-failed'` after emitting a `[TRI]` warning.
256
+ *
257
+ * @param config - TRI setup config (must include `token` and `apiURL`).
258
+ */
259
+ async function initializeTRI(config) {
260
+ const resolvedTriConfig = resolveTRIConfig(config);
261
+ if (!resolvedTriConfig) return "init-failed";
262
+ const setupState = await setupTRI(resolvedTriConfig);
263
+ if (setupState !== "ready") return setupState;
264
+ return startTRI();
265
+ }
266
+ /**
267
+ * Calls the provider's `setup()` with the given config. This is the step that
268
+ * lazy-loads `@incodetech/tri-sdk`, validates the config, and checks the
269
+ * backend collection-status endpoint. Must be called before `startTRI`.
270
+ *
271
+ * @param config - Resolved TRI config (`token` and `apiURL` required).
272
+ * @returns The resulting {@link TransactionalRiskIntelligenceState}.
273
+ */
274
+ async function setupTRI(config) {
275
+ return getProvider().setup(config);
276
+ }
277
+ /**
278
+ * Begins behavioral data collection. Requires a prior successful `setupTRI()`
279
+ * call. Returns `'init-failed'` without starting if called beforehand.
280
+ *
281
+ * @returns The resulting {@link TransactionalRiskIntelligenceState}.
282
+ */
283
+ async function startTRI() {
284
+ return getProvider().start();
285
+ }
286
+ /**
287
+ * Stops all TRI collectors and managers. Idempotent. No-op if TRI was never
288
+ * set up.
289
+ */
290
+ async function stopTRI() {
291
+ return getProvider().stop();
292
+ }
293
+ /**
294
+ * Resets the TRI SDK to its initial state. Call this from the SDK's `reset()`
295
+ * so that a subsequent `setupTRI` / `startTRI` can begin fresh.
296
+ */
297
+ async function resetTRI() {
298
+ return getProvider().reset();
299
+ }
300
+ /**
301
+ * @private This function is not used outside of this file.
302
+ *
303
+ * Validates and narrows a {@link TransactionalRiskIntelligenceSetupConfig}
304
+ * into a {@link TransactionalRiskIntelligenceConfig} suitable for passing to
305
+ * the provider's `setup()`.
306
+ *
307
+ * Returns `null` (with a `[TRI]` warning) when a required field is missing.
308
+ * Returns `null` silently when `config` is `undefined` (intentional opt-out).
309
+ *
310
+ * @param config - Raw setup-time config from `SetupOptions.tri`.
311
+ */
312
+ function resolveTRIConfig(config) {
313
+ if (!config) return null;
314
+ if (!config.token) {
315
+ console.warn("[TRI] Not initialized: token is required.");
316
+ return null;
317
+ }
318
+ if (!config.apiURL) {
319
+ console.warn("[TRI] Not initialized: apiURL is required.");
320
+ return null;
321
+ }
322
+ return config;
323
+ }
324
+
325
+ //#endregion
326
+ export { setupTRI as a, resetTRIProviderInstance as i, initializeTRI as n, startTRI as o, resetTRI as r, stopTRI as s, createTRISession as t };
package/dist/tri.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { a as startTRI, i as setupTRI, n as initializeTRI, o as stopTRI, r as resetTRI, s as TransactionalRiskIntelligenceSetupConfig, t as createTRISession } from "./index-Dn9cDS6f.js";
2
+ export { TransactionalRiskIntelligenceSetupConfig, createTRISession, initializeTRI, resetTRI, setupTRI, startTRI, stopTRI };