@incodetech/core 0.0.0-dev-20260728-af4e1aee → 0.0.0-dev-20260729-e2dda0b0

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 (170) hide show
  1. package/dist/BrowserDiagnosticsCryptoProvider-BZqV7sJR.esm.js +96 -0
  2. package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +9 -0
  3. package/dist/{WasmUtilProvider-BrWOTaVG.esm.js → WasmUtilProvider-D13sxEmA.esm.js} +2 -406
  4. package/dist/{addressSearch-DEYnZoez.esm.js → addressSearch-D_0t2Wdn.esm.js} +2 -2
  5. package/dist/ae-signature.esm.js +1 -1
  6. package/dist/antifraud.esm.js +2 -2
  7. package/dist/{antifraudManager-CFsD4BgV.esm.js → antifraudManager-COYh4O_y.esm.js} +2 -2
  8. package/dist/{antifraudStateMachine-VB-aXHct.esm.js → antifraudStateMachine-NuzlVVte.esm.js} +2 -2
  9. package/dist/api-Bx3gKW_y.esm.js +129 -0
  10. package/dist/{apiError-B-PkYxln.esm.js → apiError-GA6MbJpI.esm.js} +12 -1
  11. package/dist/authentication.d.ts +3 -3
  12. package/dist/authentication.esm.js +2 -2
  13. package/dist/{authenticationManager-BDkpqQ-5.esm.js → authenticationManager-B7v0Jy-x.esm.js} +5 -5
  14. package/dist/{authenticationManager-B2KZQ9zw.d.ts → authenticationManager-BGM8bpD0.d.ts} +1 -1
  15. package/dist/{authenticationStateMachine-lTogTlQv.esm.js → authenticationStateMachine-DAh9ziFC.esm.js} +5 -5
  16. package/dist/camera.esm.js +1 -1
  17. package/dist/certificate-issuance.esm.js +2 -2
  18. package/dist/{certificateIssuanceStateMachine-Di_bLlkP.esm.js → certificateIssuanceStateMachine-N__sTAgu.esm.js} +2 -2
  19. package/dist/consent.d.ts +1 -1
  20. package/dist/consent.esm.js +2 -2
  21. package/dist/{consentManager-DLOyIZzt.d.ts → consentManager-BhYFeKiG.d.ts} +9 -9
  22. package/dist/{consentManager-0EiBXYtL.esm.js → consentManager-CWEAhAJ5.esm.js} +2 -2
  23. package/dist/{consentStateMachine-STURxpEc.esm.js → consentStateMachine-DWL-X0Jb.esm.js} +2 -2
  24. package/dist/cross-document-data-match.esm.js +1 -1
  25. package/dist/{crossDocumentDataMatchManager-Dw7euiiZ.esm.js → crossDocumentDataMatchManager-Bk4W2TDJ.esm.js} +3 -3
  26. package/dist/curp-validation.d.ts +1 -1
  27. package/dist/curp-validation.esm.js +2 -2
  28. package/dist/{curpValidationManager-BGj9U3E0.esm.js → curpValidationManager-B6gYKygj.esm.js} +2 -2
  29. package/dist/{curpValidationManager-BEWD-Lvo.d.ts → curpValidationManager-DVGr7Fq7.d.ts} +1 -1
  30. package/dist/{curpValidationStateMachine-Dq6l4oeZ.esm.js → curpValidationStateMachine-42RbYcam.esm.js} +2 -2
  31. package/dist/custom-fields.esm.js +3 -3
  32. package/dist/custom-watchlist.esm.js +2 -2
  33. package/dist/{customWatchlistStateMachine-BuQML-pk.esm.js → customWatchlistStateMachine-BbDtH5kk.esm.js} +2 -2
  34. package/dist/{deepsightLoader-DDu_KUyv.esm.js → deepsightLoader-CHG26pOB.esm.js} +14 -4
  35. package/dist/document-capture.d.ts +1 -1
  36. package/dist/document-capture.esm.js +2 -2
  37. package/dist/document-upload.d.ts +8 -8
  38. package/dist/document-upload.esm.js +3 -3
  39. package/dist/{documentCaptureManager-B-J1lXcH.d.ts → documentCaptureManager-BK_4RbHt.d.ts} +73 -73
  40. package/dist/{documentCaptureManager-DBRQX16v.esm.js → documentCaptureManager-FvcNYpkS.esm.js} +2 -2
  41. package/dist/{documentCaptureStateMachine-BXgH9gGq.esm.js → documentCaptureStateMachine-BlzN0-mU.esm.js} +4 -4
  42. package/dist/dynamic-forms.d.ts +2 -2
  43. package/dist/dynamic-forms.esm.js +2 -2
  44. package/dist/{dynamicFormsManager-DI0sCyVB.esm.js → dynamicFormsManager-CfJixpOW.esm.js} +8 -4
  45. package/dist/{dynamicFormsManager-BYac2uEY.d.ts → dynamicFormsManager-fhK0yINk.d.ts} +9 -1
  46. package/dist/{dynamicFormsStateMachine-BQqAwNQ-.esm.js → dynamicFormsStateMachine-DrPO1i45.esm.js} +71 -6
  47. package/dist/ekyb.d.ts +1 -1
  48. package/dist/ekyb.esm.js +3 -3
  49. package/dist/{ekybManager-BQQyRMqw.esm.js → ekybManager-DVCqaSzz.esm.js} +2 -2
  50. package/dist/{ekybStateMachine-jsiqdGjv.esm.js → ekybStateMachine-C3y-Qx1a.esm.js} +4 -4
  51. package/dist/ekyc.esm.js +2 -2
  52. package/dist/{ekycManager-Cl2e4Knv.esm.js → ekycManager-dimNksoE.esm.js} +2 -2
  53. package/dist/{ekycStateMachine-9Mm7LBea.esm.js → ekycStateMachine-Yl3sQmhm.esm.js} +3 -3
  54. package/dist/electronic-signature.esm.js +1 -1
  55. package/dist/{electronicSignatureManager-BXIpAJ5m.esm.js → electronicSignatureManager-D0X7P-de.esm.js} +4 -4
  56. package/dist/email.esm.js +2 -2
  57. package/dist/{emailManager-Dmt1YrtS.esm.js → emailManager-BqJMritP.esm.js} +2 -2
  58. package/dist/{emailStateMachine-DQS-QMgQ.esm.js → emailStateMachine-CLtrh2Ot.esm.js} +2 -2
  59. package/dist/{endpoints-CfRg7iAr.esm.js → endpoints-DOfmJylF.esm.js} +8 -1
  60. package/dist/{events-Dy8PyVO5.esm.js → events-CMFCCu1H.esm.js} +2 -9
  61. package/dist/events.esm.js +1 -1
  62. package/dist/extensibility.d.ts +13 -13
  63. package/dist/extensibility.esm.js +26 -32
  64. package/dist/face-match.esm.js +2 -2
  65. package/dist/{faceCaptureManagerFactory-B2TUje5s.d.ts → faceCaptureManagerFactory-B92LFT16.d.ts} +3 -3
  66. package/dist/{faceCaptureManagerFactory-DaYwl0Yq.esm.js → faceCaptureManagerFactory-D2pR3ZnX.esm.js} +3 -3
  67. package/dist/{faceCaptureSetup-DlmX-9nD.esm.js → faceCaptureSetup-DbhDPMjb.esm.js} +5 -5
  68. package/dist/{faceMatchManager-fPX11GnX.esm.js → faceMatchManager-XxTEAj9C.esm.js} +2 -2
  69. package/dist/{faceMatchStateMachine-D_7UX1rV.esm.js → faceMatchStateMachine-ubds4WlI.esm.js} +2 -2
  70. package/dist/field-comparison.esm.js +1 -1
  71. package/dist/{fieldComparisonManager-USUE9qDr.esm.js → fieldComparisonManager-BzaX4TvX.esm.js} +3 -3
  72. package/dist/fiscal-qr.esm.js +3 -3
  73. package/dist/flow-events.d.ts +1 -1
  74. package/dist/flow.d.ts +6 -6
  75. package/dist/flow.esm.js +4 -4
  76. package/dist/{flowCompletionService-D5oIlcza.esm.js → flowCompletionService-BdZR6HyE.esm.js} +3 -3
  77. package/dist/{flowServices-T5JoA_1N.esm.js → flowServices-CPti9am-.esm.js} +8 -6
  78. package/dist/geolocation.esm.js +2 -2
  79. package/dist/{geolocationManager-zeqAcVHC.esm.js → geolocationManager-DW27-LTL.esm.js} +2 -2
  80. package/dist/{geolocationStateMachine-DxSETS9_.esm.js → geolocationStateMachine-Cz3Q6az0.esm.js} +3 -3
  81. package/dist/government-validation.esm.js +2 -2
  82. package/dist/{governmentValidationStateMachine-loZfWcU9.esm.js → governmentValidationStateMachine-CtG3bIdM.esm.js} +2 -2
  83. package/dist/home.d.ts +1 -1
  84. package/dist/home.esm.js +1 -1
  85. package/dist/http.esm.js +1 -1
  86. package/dist/id-ocr.d.ts +1 -1
  87. package/dist/id-ocr.esm.js +2 -2
  88. package/dist/id-verification.esm.js +2 -2
  89. package/dist/id.d.ts +2 -2
  90. package/dist/id.esm.js +5 -5
  91. package/dist/{idCaptureDefaults-DCrjeNl5.esm.js → idCaptureDefaults-BDS43fFL.esm.js} +2 -2
  92. package/dist/{idCaptureManager-D6fKtXhM.d.ts → idCaptureManager-C-WjmsN4.d.ts} +2 -2
  93. package/dist/{idCaptureManager-DaqabBBZ.esm.js → idCaptureManager-CPzgzVu8.esm.js} +4 -4
  94. package/dist/{idCaptureStateMachine-CU1CsT7x.esm.js → idCaptureStateMachine-CAKztWBq.esm.js} +28 -17
  95. package/dist/{idOcrManager-dLuxey6y.d.ts → idOcrManager-DXc_xRN7.d.ts} +1 -1
  96. package/dist/{idOcrManager-CnIWzuqU.esm.js → idOcrManager-Drs6frVO.esm.js} +2 -2
  97. package/dist/{idOcrStateMachine-Cqi8173Y.esm.js → idOcrStateMachine-s08FLvEh.esm.js} +3 -3
  98. package/dist/{idVerificationManager-BTsyXjv6.esm.js → idVerificationManager-Df97Bf0n.esm.js} +2 -2
  99. package/dist/{idVerificationStateMachine-7BSciEJk.esm.js → idVerificationStateMachine-tAF7pvC8.esm.js} +2 -2
  100. package/dist/identity-reuse.d.ts +1 -1
  101. package/dist/identity-reuse.esm.js +2 -2
  102. package/dist/{identityReuseManager-BjMJHKLP.esm.js → identityReuseManager-0ZHGWr9T.esm.js} +2 -2
  103. package/dist/{identityReuseManager-D6pD4hcZ.d.ts → identityReuseManager-v2TH5g7e.d.ts} +1 -1
  104. package/dist/{identityReuseStateMachine-B0IFF3R7.esm.js → identityReuseStateMachine-DG8kbKuy.esm.js} +2 -2
  105. package/dist/{index-X9serOZT.d.ts → index-CLMF0QLQ.d.ts} +1 -1
  106. package/dist/index.d.ts +1 -1
  107. package/dist/index.esm.js +1 -1
  108. package/dist/{invokeOnCaptureCallback-B-QfsCQY.esm.js → invokeOnCaptureCallback-Cgl54qED.esm.js} +1 -1
  109. package/dist/mandatory-consent.d.ts +2 -2
  110. package/dist/mandatory-consent.esm.js +2 -2
  111. package/dist/{mandatoryConsentManager-IKpruo6V.d.ts → mandatoryConsentManager-CzsVFG33.d.ts} +6 -6
  112. package/dist/{mandatoryConsentManager-BOOjm7SU.esm.js → mandatoryConsentManager-DaKK7S4q.esm.js} +2 -2
  113. package/dist/{mandatoryConsentStateMachine-BP3npRnI.esm.js → mandatoryConsentStateMachine-CjKpOQXU.esm.js} +2 -2
  114. package/dist/{onDeviceFaceResults-bUR2uNg0.esm.js → onDeviceFaceResults-CVhk1BWp.esm.js} +13 -6
  115. package/dist/{permissionGuards-5Cu6a8iN.esm.js → permissionGuards-UMiLlPfq.esm.js} +1 -1
  116. package/dist/{permissionServices-CkHL1BjH.esm.js → permissionServices-C4qKxOl4.esm.js} +1 -1
  117. package/dist/personhood.d.ts +1 -1
  118. package/dist/personhood.esm.js +9 -22
  119. package/dist/phone.esm.js +2 -2
  120. package/dist/{phoneManager-C3aqq6jS.esm.js → phoneManager-WImoAp4i.esm.js} +2 -2
  121. package/dist/{phoneStateMachine-CLGcLA8t.esm.js → phoneStateMachine-FJ-_x1G4.esm.js} +2 -2
  122. package/dist/qe-signature.esm.js +1 -1
  123. package/dist/{recordingService-ChBo1rvx.esm.js → recordingService-BGPq5vGr.esm.js} +3 -3
  124. package/dist/redirect-to-mobile.esm.js +2 -2
  125. package/dist/{redirectToMobileManager-BO0BVfgM.esm.js → redirectToMobileManager-CxEu6KnV.esm.js} +2 -2
  126. package/dist/{redirectToMobileStateMachine-BQuhw8_L.esm.js → redirectToMobileStateMachine-jI5XPtZJ.esm.js} +2 -2
  127. package/dist/{runChildModule-Crz1nHwJ.esm.js → runChildModule-fagPe5Ct.esm.js} +6 -1
  128. package/dist/selfie.d.ts +3 -3
  129. package/dist/selfie.esm.js +9 -9
  130. package/dist/{selfieErrorUtils-BAEYvNVr.esm.js → selfieErrorUtils-DCRRRj38.esm.js} +3 -3
  131. package/dist/{selfieManager-BT7dmOHi.d.ts → selfieManager-CxeMb2tM.d.ts} +1 -1
  132. package/dist/{selfieManager-9Eci1f5e.esm.js → selfieManager-DTiBsQNn.esm.js} +5 -5
  133. package/dist/{selfieStateMachine-CKRTfYh8.esm.js → selfieStateMachine-CxabK5_3.esm.js} +3 -3
  134. package/dist/session-Ccob4IUP.esm.js +161 -0
  135. package/dist/session.d.ts +9 -2
  136. package/dist/session.esm.js +4 -152
  137. package/dist/{sessionInitializer-CgjN51b2.esm.js → sessionInitializer-DEd0CQ74.esm.js} +27 -32
  138. package/dist/{setup-BFGd-cxt.esm.js → setup-BR4G3NHV.esm.js} +78 -11
  139. package/dist/{setup-B1WTXTQV.d.ts → setup-Dj8n_YLP.d.ts} +22 -0
  140. package/dist/signature.esm.js +2 -2
  141. package/dist/{signatureStateMachine-zRLvEGTw.esm.js → signatureStateMachine-Dx92l8pR.esm.js} +2 -2
  142. package/dist/{stats-4DAk7TYl.esm.js → stats-6sK3f5pc.esm.js} +2 -2
  143. package/dist/stats.esm.js +1 -1
  144. package/dist/trueSight-4L5GCqKy.esm.js +1 -0
  145. package/dist/trueSightService-DKC-gmQC.esm.js +1891 -0
  146. package/dist/trust-graph.esm.js +1 -1
  147. package/dist/{types-BK-v1UYb.d.ts → types-BBQjIaK4.d.ts} +1 -1
  148. package/dist/{types-xIEGXWk8.d.ts → types-BSBzhHRH.d.ts} +9 -0
  149. package/dist/{types-DjHL5Wa9.d.ts → types-BX_XkMsQ.d.ts} +1 -1
  150. package/dist/{types-DznwkfTc.d.ts → types-C2n-6lCx.d.ts} +1 -1
  151. package/dist/types-CrUhpMDP.d.ts +6 -0
  152. package/dist/{types-NSJbROLr.d.ts → types-KPvmag_B.d.ts} +2 -0
  153. package/dist/video-selfie.d.ts +2 -2
  154. package/dist/video-selfie.esm.js +9 -9
  155. package/dist/wasm.d.ts +1 -1
  156. package/dist/wasm.esm.js +3 -3
  157. package/dist/{wasmDefaults-B4DUtYET.esm.js → wasmDefaults-DJiEvV7f.esm.js} +1 -1
  158. package/dist/wasmWebClient-DM8lkb0z.esm.js +407 -0
  159. package/dist/watchlist-for-business.esm.js +2 -2
  160. package/dist/watchlist.esm.js +2 -2
  161. package/dist/{watchlistForBusinessStateMachine-Rc6BAwlr.esm.js → watchlistForBusinessStateMachine-Eo-WEYha.esm.js} +2 -2
  162. package/dist/{watchlistManager-FRMpgcWW.esm.js → watchlistManager-DnVfNc1v.esm.js} +2 -2
  163. package/dist/{watchlistStateMachine-64y9XBjm.esm.js → watchlistStateMachine-DZSOauwp.esm.js} +2 -2
  164. package/dist/workflow.d.ts +17 -9
  165. package/dist/workflow.esm.js +55 -40
  166. package/package.json +3 -3
  167. package/dist/api-BDTZNnca.esm.js +0 -71
  168. package/dist/clientLifecycle-BX83zwtT.esm.js +0 -528
  169. package/dist/session-B3d0Xtee.esm.js +0 -1
  170. package/dist/types-sK-eGomM.d.ts +0 -6
@@ -1,6 +1,6 @@
1
1
  import { t as Manager } from "./Manager-CQQ99QOI.js";
2
2
  import { t as IVisibilityObserverCapability } from "./IVisibilityObserverCapability-D4tvIB5v.js";
3
- import { c as SelfieActor, n as FaceCaptureManagerState, s as CreateSelfieActorOptions, t as FaceCaptureManager } from "./faceCaptureManagerFactory-B2TUje5s.js";
3
+ import { c as SelfieActor, n as FaceCaptureManagerState, s as CreateSelfieActorOptions, t as FaceCaptureManager } from "./faceCaptureManagerFactory-B92LFT16.js";
4
4
  //#region src/modules/selfie/selfieUploadService.d.ts
5
5
  type ProcessFaceImageType = 'selfie' | 'videoSelfie';
6
6
  type ProcessFaceResponse = {
@@ -1,9 +1,9 @@
1
- import { t as WasmUtilProvider } from "./WasmUtilProvider-BrWOTaVG.esm.js";
2
- import { n as eventModuleNames } from "./events-Dy8PyVO5.esm.js";
3
- import { o as createActor } from "./xstate.esm-Cf4e0Cfd.esm.js";
4
- import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-DaYwl0Yq.esm.js";
1
+ import { t as WasmUtilProvider } from "./WasmUtilProvider-D13sxEmA.esm.js";
5
2
  import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.esm.js";
6
- import { t as selfieMachine } from "./selfieStateMachine-CKRTfYh8.esm.js";
3
+ import { n as eventModuleNames } from "./events-CMFCCu1H.esm.js";
4
+ import { o as createActor } from "./xstate.esm-Cf4e0Cfd.esm.js";
5
+ import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-D2pR3ZnX.esm.js";
6
+ import { t as selfieMachine } from "./selfieStateMachine-CxabK5_3.esm.js";
7
7
  //#region src/modules/selfie/selfieActor.ts
8
8
  function createSelfieActor(options) {
9
9
  const dependencies = options.dependencies ?? {
@@ -1,9 +1,9 @@
1
1
  import { r as assign } from "./xstate.esm-Cf4e0Cfd.esm.js";
2
2
  import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
3
- import { t as faceCaptureMachine } from "./faceCaptureSetup-DlmX-9nD.esm.js";
4
- import { i as prepareOnDeviceFaceUpload, n as isOnDeviceMode, r as postOnDeviceFaceResults, t as defaultPrepareFaceUpload } from "./onDeviceFaceResults-bUR2uNg0.esm.js";
3
+ import { t as faceCaptureMachine } from "./faceCaptureSetup-DbhDPMjb.esm.js";
4
+ import { i as prepareOnDeviceFaceUpload, n as isOnDeviceMode, r as postOnDeviceFaceResults, t as defaultPrepareFaceUpload } from "./onDeviceFaceResults-CVhk1BWp.esm.js";
5
5
  import { t as FACE_ERROR_CODES } from "./types-BN5RPPIZ.esm.js";
6
- import { i as uploadSelfie, n as validateUploadResponse, r as processFace } from "./selfieErrorUtils-BAEYvNVr.esm.js";
6
+ import { i as uploadSelfie, n as validateUploadResponse, r as processFace } from "./selfieErrorUtils-DCRRRj38.esm.js";
7
7
  /**
8
8
  * The selfie capture state machine.
9
9
  *
@@ -0,0 +1,161 @@
1
+ import { n as getApi } from "./api-Bx3gKW_y.esm.js";
2
+ import { h as noteSessionCreated, l as trueSightLog } from "./trueSightService-DKC-gmQC.esm.js";
3
+ import "./sessionInitializer-DEd0CQ74.esm.js";
4
+ import { t as endpoints } from "./endpoints-DOfmJylF.esm.js";
5
+ import "./trueSight-4L5GCqKy.esm.js";
6
+ import { r as toIncodeApiError } from "./apiError-GA6MbJpI.esm.js";
7
+ //#region src/internal/session/sessionService.ts
8
+ /**
9
+ * HTTP status codes the QR validation endpoint emits, keyed by their semantic
10
+ * name. Hosts switch on these to render distinct messaging — `invalidQRuuid`
11
+ * for an unknown/expired link, `onboardingUrlAlreadyUsed` for a one-time link
12
+ * that has already been consumed.
13
+ */
14
+ const QR_VALIDATION_ERROR_CODES = {
15
+ expiredUUID: 4026,
16
+ invalidQRuuid: 4081,
17
+ onboardingUrlAlreadyUsed: 4083
18
+ };
19
+ var QrValidationError = class extends Error {
20
+ constructor(status, statusText) {
21
+ super(`POST ${endpoints.qrValidateUuid} failed: ${status} ${statusText}`);
22
+ this.name = "QrValidationError";
23
+ this.status = status;
24
+ this.statusText = statusText;
25
+ }
26
+ };
27
+ /**
28
+ * Creates a new onboarding session.
29
+ *
30
+ * @param apiKey - The API key from the Incode dashboard
31
+ * @param options - Session creation options
32
+ * @param signal - Optional AbortSignal for request cancellation
33
+ * @returns The created session with token
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const session = await createSession('your-api-key', {
38
+ * configurationId: 'your-flow-id',
39
+ * language: 'en-US',
40
+ * });
41
+ * console.log(session.token); // Use this token for subsequent API calls
42
+ * ```
43
+ */
44
+ async function createSession(apiKey, options, signal) {
45
+ try {
46
+ const session = (await getApi().post(endpoints.createSession, {
47
+ configurationId: options.configurationId,
48
+ externalId: options.externalId,
49
+ externalCustomerId: options.externalCustomerId,
50
+ language: options.language ?? "en-US",
51
+ customFields: options.customFields,
52
+ uuid: options.uuid ?? null,
53
+ urlUuid: options.urlUuid ?? null,
54
+ interviewId: options.interviewId ?? null,
55
+ ...options.loginHint != null && options.loginHint !== "" ? { loginHint: options.loginHint } : {}
56
+ }, {
57
+ headers: {
58
+ "x-api-key": apiKey,
59
+ "api-version": "1.0"
60
+ },
61
+ signal
62
+ })).data;
63
+ noteSessionCreated(session, {
64
+ configurationId: options.configurationId,
65
+ externalCustomerId: options.externalCustomerId,
66
+ interviewId: options.interviewId,
67
+ language: options.language
68
+ });
69
+ trueSightLog("info", "session", "orchestration", "session created");
70
+ return session;
71
+ } catch (error) {
72
+ toIncodeApiError(endpoints.createSession, error);
73
+ }
74
+ }
75
+ /**
76
+ * Validates and rotates a QR anti-phishing URL UUID before creating a session.
77
+ *
78
+ * This call is unauthenticated; the `{ onboardingId, urlUuid }` pair itself
79
+ * acts as the credential. The server burns the incoming `urlUuid` and returns
80
+ * a freshly minted one that must be used in the subsequent `createSession`
81
+ * call.
82
+ *
83
+ * @param options - `{ onboardingId, urlUuid }` from the incoming URL
84
+ * @param signal - Optional AbortSignal for request cancellation
85
+ * @returns The refreshed `urlUuid` to use for the session
86
+ * @throws {QrValidationError} When the server rejects the validation request.
87
+ */
88
+ async function validateQrUuid(options, signal) {
89
+ try {
90
+ return (await getApi().post(endpoints.qrValidateUuid, {
91
+ onboardingId: options.onboardingId,
92
+ urlUuid: options.urlUuid
93
+ }, {
94
+ headers: { "api-version": "1.0" },
95
+ signal
96
+ })).data;
97
+ } catch (error) {
98
+ const httpError = error;
99
+ throw new QrValidationError(httpError.data?.status ?? httpError.status, httpError.statusText);
100
+ }
101
+ }
102
+ /**
103
+ * One-shot QR phishing-resistance helper.
104
+ *
105
+ * When `urlUuid` is a non-empty string, burns the stale value via
106
+ * `validateQrUuid`, invokes `onRefreshed` with the fresh value, and returns
107
+ * it so callers can forward it into `createSession`. When `urlUuid` is
108
+ * absent, returns `undefined` without making any network call.
109
+ *
110
+ * Consolidates the rotation + callback logic shared by Flow self-loading and
111
+ * Workflow token-mode bootstraps.
112
+ *
113
+ * @throws {QrValidationError} When the server rejects the validation request.
114
+ */
115
+ async function refreshQrUrlUuid(options, signal) {
116
+ if (typeof options.urlUuid !== "string" || options.urlUuid.length === 0) return;
117
+ const result = await validateQrUuid({
118
+ onboardingId: options.onboardingId ?? null,
119
+ urlUuid: options.urlUuid
120
+ }, signal);
121
+ options.onRefreshed?.(result.urlUuid);
122
+ return result.urlUuid;
123
+ }
124
+ /**
125
+ * Validates and rotates a QR anti-phishing `urlUuid` (when present), then
126
+ * creates a session bound to the refreshed value. When `urlUuid` is absent,
127
+ * behaves identically to {@link createSession}.
128
+ *
129
+ * Use this when the host owns session creation and wants the SDK to handle
130
+ * phishing-resistance rotation in a single call. For raw control, compose
131
+ * `refreshQrUrlUuid` and `createSession` directly.
132
+ *
133
+ * @throws {QrValidationError} When the server rejects the QR validation step.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * const session = await bootstrapSession(apiKey, {
138
+ * configurationId,
139
+ * urlUuid,
140
+ * onUrlUuidRefreshed: (refreshed) => {
141
+ * const url = new URL(window.location.href);
142
+ * url.searchParams.set('url_uuid', refreshed);
143
+ * window.history.replaceState({}, '', url);
144
+ * },
145
+ * });
146
+ * ```
147
+ */
148
+ async function bootstrapSession(apiKey, options, signal) {
149
+ const { onUrlUuidRefreshed, ...createSessionOptions } = options;
150
+ const refreshedUrlUuid = await refreshQrUrlUuid({
151
+ urlUuid: options.urlUuid,
152
+ onboardingId: options.uuid ?? null,
153
+ onRefreshed: onUrlUuidRefreshed
154
+ }, signal);
155
+ return createSession(apiKey, {
156
+ ...createSessionOptions,
157
+ urlUuid: refreshedUrlUuid
158
+ }, signal);
159
+ }
160
+ //#endregion
161
+ export { refreshQrUrlUuid as a, createSession as i, QrValidationError as n, validateQrUuid as o, bootstrapSession as r, QR_VALIDATION_ERROR_CODES as t };
package/dist/session.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as RegulationTypes } from "./types-NSJbROLr.js";
1
+ import { a as RegulationTypes } from "./types-KPvmag_B.js";
2
2
  import { n as FinishStatus, r as GetFinishStatusFn, s as getFinishStatus } from "./flowCompletionService-BlAHsKyv.js";
3
3
  //#region src/internal/fingerprint/types.d.ts
4
4
  type DeviceFingerprintResult = {
@@ -177,7 +177,14 @@ declare class IncodeApiError extends Error {
177
177
  }
178
178
  //#endregion
179
179
  //#region src/internal/featureConfig/types.d.ts
180
- type FeatureName = 'VIDEO_SELFIE_V2' | 'USE_CLIENT_GLARE' | 'USE_OPEN_VIDU' | 'DISABLE_IPIFY';
180
+ type FeatureName = 'VIDEO_SELFIE_V2' | 'USE_CLIENT_GLARE' | 'USE_OPEN_VIDU' | 'DISABLE_IPIFY' |
181
+ /**
182
+ * TrueSight diagnostics remote kill-switch (ENG-48677). Only an explicit
183
+ * `enabled: false` entry disables uploads — `true`, absent, or an
184
+ * unresolvable config all proceed (fail-open; the proxy's
185
+ * `truesight.api.enabled` is the environment authority).
186
+ */
187
+ 'TRUESIGHT_DIAGNOSTICS';
181
188
  type FeatureConfig = {
182
189
  enabled: boolean;
183
190
  feature: FeatureName;
@@ -1,153 +1,5 @@
1
- import { n as getApi } from "./api-BDTZNnca.esm.js";
2
- import { t as endpoints } from "./endpoints-CfRg7iAr.esm.js";
3
- import { i as initializeSession } from "./sessionInitializer-CgjN51b2.esm.js";
4
- import { r as toIncodeApiError, t as IncodeApiError } from "./apiError-B-PkYxln.esm.js";
5
- import "./session-B3d0Xtee.esm.js";
6
- import { n as getFinishStatus } from "./flowCompletionService-D5oIlcza.esm.js";
7
- //#region src/internal/session/sessionService.ts
8
- /**
9
- * HTTP status codes the QR validation endpoint emits, keyed by their semantic
10
- * name. Hosts switch on these to render distinct messaging — `invalidQRuuid`
11
- * for an unknown/expired link, `onboardingUrlAlreadyUsed` for a one-time link
12
- * that has already been consumed.
13
- */
14
- const QR_VALIDATION_ERROR_CODES = {
15
- expiredUUID: 4026,
16
- invalidQRuuid: 4081,
17
- onboardingUrlAlreadyUsed: 4083
18
- };
19
- var QrValidationError = class extends Error {
20
- constructor(status, statusText) {
21
- super(`POST ${endpoints.qrValidateUuid} failed: ${status} ${statusText}`);
22
- this.name = "QrValidationError";
23
- this.status = status;
24
- this.statusText = statusText;
25
- }
26
- };
27
- /**
28
- * Creates a new onboarding session.
29
- *
30
- * @param apiKey - The API key from the Incode dashboard
31
- * @param options - Session creation options
32
- * @param signal - Optional AbortSignal for request cancellation
33
- * @returns The created session with token
34
- *
35
- * @example
36
- * ```ts
37
- * const session = await createSession('your-api-key', {
38
- * configurationId: 'your-flow-id',
39
- * language: 'en-US',
40
- * });
41
- * console.log(session.token); // Use this token for subsequent API calls
42
- * ```
43
- */
44
- async function createSession(apiKey, options, signal) {
45
- try {
46
- return (await getApi().post(endpoints.createSession, {
47
- configurationId: options.configurationId,
48
- externalId: options.externalId,
49
- externalCustomerId: options.externalCustomerId,
50
- language: options.language ?? "en-US",
51
- customFields: options.customFields,
52
- uuid: options.uuid ?? null,
53
- urlUuid: options.urlUuid ?? null,
54
- interviewId: options.interviewId ?? null,
55
- ...options.loginHint != null && options.loginHint !== "" ? { loginHint: options.loginHint } : {}
56
- }, {
57
- headers: {
58
- "x-api-key": apiKey,
59
- "api-version": "1.0"
60
- },
61
- signal
62
- })).data;
63
- } catch (error) {
64
- toIncodeApiError(endpoints.createSession, error);
65
- }
66
- }
67
- /**
68
- * Validates and rotates a QR anti-phishing URL UUID before creating a session.
69
- *
70
- * This call is unauthenticated; the `{ onboardingId, urlUuid }` pair itself
71
- * acts as the credential. The server burns the incoming `urlUuid` and returns
72
- * a freshly minted one that must be used in the subsequent `createSession`
73
- * call.
74
- *
75
- * @param options - `{ onboardingId, urlUuid }` from the incoming URL
76
- * @param signal - Optional AbortSignal for request cancellation
77
- * @returns The refreshed `urlUuid` to use for the session
78
- * @throws {QrValidationError} When the server rejects the validation request.
79
- */
80
- async function validateQrUuid(options, signal) {
81
- try {
82
- return (await getApi().post(endpoints.qrValidateUuid, {
83
- onboardingId: options.onboardingId,
84
- urlUuid: options.urlUuid
85
- }, {
86
- headers: { "api-version": "1.0" },
87
- signal
88
- })).data;
89
- } catch (error) {
90
- const httpError = error;
91
- throw new QrValidationError(httpError.data?.status ?? httpError.status, httpError.statusText);
92
- }
93
- }
94
- /**
95
- * One-shot QR phishing-resistance helper.
96
- *
97
- * When `urlUuid` is a non-empty string, burns the stale value via
98
- * `validateQrUuid`, invokes `onRefreshed` with the fresh value, and returns
99
- * it so callers can forward it into `createSession`. When `urlUuid` is
100
- * absent, returns `undefined` without making any network call.
101
- *
102
- * Consolidates the rotation + callback logic shared by Flow self-loading and
103
- * Workflow token-mode bootstraps.
104
- *
105
- * @throws {QrValidationError} When the server rejects the validation request.
106
- */
107
- async function refreshQrUrlUuid(options, signal) {
108
- if (typeof options.urlUuid !== "string" || options.urlUuid.length === 0) return;
109
- const result = await validateQrUuid({
110
- onboardingId: options.onboardingId ?? null,
111
- urlUuid: options.urlUuid
112
- }, signal);
113
- options.onRefreshed?.(result.urlUuid);
114
- return result.urlUuid;
115
- }
116
- /**
117
- * Validates and rotates a QR anti-phishing `urlUuid` (when present), then
118
- * creates a session bound to the refreshed value. When `urlUuid` is absent,
119
- * behaves identically to {@link createSession}.
120
- *
121
- * Use this when the host owns session creation and wants the SDK to handle
122
- * phishing-resistance rotation in a single call. For raw control, compose
123
- * `refreshQrUrlUuid` and `createSession` directly.
124
- *
125
- * @throws {QrValidationError} When the server rejects the QR validation step.
126
- *
127
- * @example
128
- * ```ts
129
- * const session = await bootstrapSession(apiKey, {
130
- * configurationId,
131
- * urlUuid,
132
- * onUrlUuidRefreshed: (refreshed) => {
133
- * const url = new URL(window.location.href);
134
- * url.searchParams.set('url_uuid', refreshed);
135
- * window.history.replaceState({}, '', url);
136
- * },
137
- * });
138
- * ```
139
- */
140
- async function bootstrapSession(apiKey, options, signal) {
141
- const { onUrlUuidRefreshed, ...createSessionOptions } = options;
142
- const refreshedUrlUuid = await refreshQrUrlUuid({
143
- urlUuid: options.urlUuid,
144
- onboardingId: options.uuid ?? null,
145
- onRefreshed: onUrlUuidRefreshed
146
- }, signal);
147
- return createSession(apiKey, {
148
- ...createSessionOptions,
149
- urlUuid: refreshedUrlUuid
150
- }, signal);
151
- }
152
- //#endregion
1
+ import { i as initializeSession } from "./sessionInitializer-DEd0CQ74.esm.js";
2
+ import { t as IncodeApiError } from "./apiError-GA6MbJpI.esm.js";
3
+ import { a as refreshQrUrlUuid, i as createSession, n as QrValidationError, o as validateQrUuid, r as bootstrapSession, t as QR_VALIDATION_ERROR_CODES } from "./session-Ccob4IUP.esm.js";
4
+ import { n as getFinishStatus } from "./flowCompletionService-BdZR6HyE.esm.js";
153
5
  export { IncodeApiError, QR_VALIDATION_ERROR_CODES, QrValidationError, bootstrapSession, createSession, getFinishStatus, initializeSession, refreshQrUrlUuid, validateQrUuid };
@@ -1,8 +1,10 @@
1
1
  import { g as updateFeatureManagementUser } from "./feature-management-Dw96qEMs.esm.js";
2
- import { r as getToken, s as setToken, t as api } from "./api-BDTZNnca.esm.js";
3
- import { h as getAnalyticsBatcher, m as addEvent } from "./events-Dy8PyVO5.esm.js";
4
- import { t as endpoints } from "./endpoints-CfRg7iAr.esm.js";
5
- import { n as flushDeviceStatsQueue, r as resetDeviceStatsQueue } from "./stats-4DAk7TYl.esm.js";
2
+ import { c as setToken, r as getToken, t as api } from "./api-Bx3gKW_y.esm.js";
3
+ import { _ as noteTokenActivated, d as fetchFeatureConfig, f as isFeatureEnabled, l as trueSightLog, m as noteEnvironment, p as resetFeatureConfigCache, s as startTrueSightCollection, v as SDK_VERSION } from "./trueSightService-DKC-gmQC.esm.js";
4
+ import { h as getAnalyticsBatcher, m as addEvent } from "./events-CMFCCu1H.esm.js";
5
+ import { t as endpoints } from "./endpoints-DOfmJylF.esm.js";
6
+ import "./trueSight-4L5GCqKy.esm.js";
7
+ import { n as flushDeviceStatsQueue, r as resetDeviceStatsQueue } from "./stats-6sK3f5pc.esm.js";
6
8
  import { n as UAParser, t as getParsedUserAgent } from "./getParsedUserAgent-pJjATANs.esm.js";
7
9
  import { r as isIOS } from "./platform-Cd_yWGNG.esm.js";
8
10
  import { t as getUserAgent } from "./getBrowser-Cb8Zgrgp.esm.js";
@@ -1530,30 +1532,10 @@ var IpifyProvider = class {
1530
1532
  }
1531
1533
  };
1532
1534
  //#endregion
1533
- //#region src/internal/featureConfig/featureConfigService.ts
1534
- let cachedFeatures$1 = null;
1535
- /**
1536
- * Checks if a feature is enabled in the feature config.
1537
- */
1538
- function isFeatureEnabled(feature, features) {
1539
- return features?.find((f) => f.feature === feature)?.enabled ?? false;
1540
- }
1541
- /**
1542
- * Fetches feature configuration from the backend.
1543
- * Results are cached for the session lifetime.
1544
- */
1545
- async function fetchFeatureConfig(signal) {
1546
- if (cachedFeatures$1) return cachedFeatures$1;
1547
- const response = await api.get(endpoints.featureConfig, { signal });
1548
- if (!response.ok) throw new Error(`Failed to fetch feature config: ${response.status} ${response.statusText}`);
1549
- cachedFeatures$1 = response.data;
1550
- return cachedFeatures$1;
1551
- }
1552
- /**
1553
- * Resets the cached feature config (useful for testing).
1554
- */
1555
- function resetFeatureConfigCache() {
1556
- cachedFeatures$1 = null;
1535
+ //#region src/internal/fingerprint/fingerprintApi.ts
1536
+ async function getFingerprint(disableIpify) {
1537
+ const shouldDisableIpify = disableIpify ?? getDisableIpify();
1538
+ return new FingerprintProvider(new IpifyProvider()).getFingerprint(shouldDisableIpify);
1557
1539
  }
1558
1540
  //#endregion
1559
1541
  //#region src/internal/device/hasLiedBrowser.ts
@@ -1613,9 +1595,6 @@ function isBrowserSimulation(browserEnv) {
1613
1595
  return false;
1614
1596
  }
1615
1597
  //#endregion
1616
- //#region src/internal/version/sdkVersion.ts
1617
- const SDK_VERSION = "0.0.0-dev-20260728-af4e1aee";
1618
- //#endregion
1619
1598
  //#region src/internal/fingerprint/fingerprintService.ts
1620
1599
  function formatOsVersion(os) {
1621
1600
  return `${os.name || "Unknown"} ${os.version || ""}`.trim();
@@ -1691,6 +1670,11 @@ function setClientFingerprintEnabled(enabled) {
1691
1670
  function resolveDisableIpify(serverDisableIpify) {
1692
1671
  return !clientIpLookupEnabled || serverDisableIpify;
1693
1672
  }
1673
+ /** `"Chrome" + "126"` -> `"Chrome 126"`; undefined when nothing was parsed. */
1674
+ function composeNameVersion(name, version) {
1675
+ const value = [name, version].filter(Boolean).join(" ");
1676
+ return value === "" ? void 0 : value;
1677
+ }
1694
1678
  function preloadOptionalFlow() {
1695
1679
  try {
1696
1680
  return preloadSessionFlow().catch(() => void 0);
@@ -1738,6 +1722,7 @@ async function initializeSession(options = {}) {
1738
1722
  resetSessionInit();
1739
1723
  if (isTRIStarted()) triLinkPromise = linkSessionWithTRI(token);
1740
1724
  }
1725
+ if (token !== void 0) noteTokenActivated();
1741
1726
  const flowPreloadPromise = getToken() && preloadFlow === true ? preloadOptionalFlow() : Promise.resolve();
1742
1727
  await triLinkPromise;
1743
1728
  if (sessionInitialized && cachedFeatures) {
@@ -1760,8 +1745,11 @@ async function initializeSession(options = {}) {
1760
1745
  try {
1761
1746
  features = await fetchFeatureConfig(signal);
1762
1747
  serverDisableIpify = isFeatureEnabled("DISABLE_IPIFY", features.features);
1748
+ startTrueSightCollection(features);
1763
1749
  } catch {
1764
1750
  features = { sessionIdentifier: "" };
1751
+ trueSightLog("warning", "session", "orchestration", "feature-config fetch failed");
1752
+ startTrueSightCollection();
1765
1753
  }
1766
1754
  const disableIpify = resolveDisableIpify(serverDisableIpify);
1767
1755
  await updateFeatureManagementUser({ customIDs: { hashed_onboarding_id: features.sessionIdentifier || void 0 } });
@@ -1782,10 +1770,17 @@ async function initializeSession(options = {}) {
1782
1770
  flushDeviceStatsQueue();
1783
1771
  } catch (error) {
1784
1772
  console.warn("Failed to submit device fingerprint:", error);
1773
+ trueSightLog("warning", "session", "other", "device fingerprint submit failed");
1785
1774
  }
1786
1775
  else flushDeviceStatsQueue();
1787
1776
  try {
1788
1777
  const browserInfo = new BrowserInfoProvider().getBrowserInfo();
1778
+ const language = new BrowserEnvironmentProvider().getNavigatorProperty("language");
1779
+ noteEnvironment({
1780
+ browser: composeNameVersion(browserInfo.browser.name, browserInfo.browser.version),
1781
+ osVersion: composeNameVersion(browserInfo.os.name, browserInfo.os.version),
1782
+ osLanguage: typeof language === "string" ? language : void 0
1783
+ });
1789
1784
  addEvent({
1790
1785
  code: "browser",
1791
1786
  payload: {
@@ -1854,4 +1849,4 @@ function resetSessionInit() {
1854
1849
  resetDeviceStatsQueue();
1855
1850
  }
1856
1851
  //#endregion
1857
- export { getDeviceFingerprintInfo as _, resetSessionInit as a, getStandaloneFlowPolicy as c, resolveStandaloneFlowPolicy as d, setStandaloneFlowPolicy as f, getThumbmarkId as g, FingerprintProvider as h, initializeSession as i, registerFlowPreloader as l, IpifyProvider as m, getFingerprintEnabled as n, setClientFingerprintEnabled as o, isBrowserSimulation as p, getSessionFingerprintResult as r, setClientIpLookupEnabled as s, getDisableIpify as t, resetStandaloneFlowPolicy as u, BrowserEnvironmentProvider as v };
1852
+ export { getDeviceFingerprintInfo as _, resetSessionInit as a, getStandaloneFlowPolicy as c, resolveStandaloneFlowPolicy as d, setStandaloneFlowPolicy as f, getThumbmarkId as g, IpifyProvider as h, initializeSession as i, registerFlowPreloader as l, getFingerprint as m, getFingerprintEnabled as n, setClientFingerprintEnabled as o, isBrowserSimulation as p, getSessionFingerprintResult as r, setClientIpLookupEnabled as s, getDisableIpify as t, resetStandaloneFlowPolicy as u, BrowserEnvironmentProvider as v };
@@ -1,15 +1,18 @@
1
- import { a as warmupWasm, i as setWasmOnDeviceMode, t as WasmUtilProvider } from "./WasmUtilProvider-BrWOTaVG.esm.js";
2
- import { a as resolveWasmConfig } from "./wasmDefaults-B4DUtYET.esm.js";
1
+ import { a as resolveWasmConfig } from "./wasmDefaults-DJiEvV7f.esm.js";
2
+ import { a as warmupWasm, i as setWasmOnDeviceMode, t as WasmUtilProvider } from "./WasmUtilProvider-D13sxEmA.esm.js";
3
+ import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.esm.js";
3
4
  import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
4
5
  import { _ as applyEnvironment, c as getIsFeatureManagementLocked, f as optOutFeatureManagement, m as resetFeatureManagementProviderInstance, p as resetFeatureManagement, u as initializeFeatureManagement, v as getEnvironment, y as resetEnvironment } from "./feature-management-Dw96qEMs.esm.js";
5
- import { a as resetApi, i as isApiConfigured, n as getApi, r as getToken, t as api } from "./api-BDTZNnca.esm.js";
6
- import { i as upgradeToWasmHttpClient$1, n as installFreshHttpClient, r as resetHttpClientState, t as getStoredHttpConfig } from "./clientLifecycle-BX83zwtT.esm.js";
7
- import { _ as setAnalyticsBatcher, g as resetAnalyticsBatcher, h as getAnalyticsBatcher } from "./events-Dy8PyVO5.esm.js";
8
- import { t as endpoints } from "./endpoints-CfRg7iAr.esm.js";
9
- import { r as resetDeviceStatsQueue, t as addDeviceStats } from "./stats-4DAk7TYl.esm.js";
10
- import { a as resetSessionInit, d as resolveStandaloneFlowPolicy, f as setStandaloneFlowPolicy, i as initializeSession, l as registerFlowPreloader, o as setClientFingerprintEnabled, s as setClientIpLookupEnabled, u as resetStandaloneFlowPolicy } from "./sessionInitializer-CgjN51b2.esm.js";
6
+ import { t as getTimestamp } from "./IBrowserEnvironmentCapability-DEaRRk-R.esm.js";
7
+ import { a as resetApi, i as isApiConfigured, n as getApi, r as getToken, s as setHttpRequestObserver, t as api } from "./api-Bx3gKW_y.esm.js";
8
+ import { C as upgradeToWasmHttpClient$1, S as resetHttpClientState, b as getStoredHttpConfig, g as noteTestingSignals, l as trueSightLog, n as initializeTrueSightDiagnostics, o as resetTrueSight, t as finalizeTrueSight, u as categoryForEndpoint, x as installFreshHttpClient } from "./trueSightService-DKC-gmQC.esm.js";
9
+ import { _ as setAnalyticsBatcher, g as resetAnalyticsBatcher, h as getAnalyticsBatcher } from "./events-CMFCCu1H.esm.js";
10
+ import { a as resetSessionInit, d as resolveStandaloneFlowPolicy, f as setStandaloneFlowPolicy, i as initializeSession, l as registerFlowPreloader, o as setClientFingerprintEnabled, s as setClientIpLookupEnabled, u as resetStandaloneFlowPolicy, v as BrowserEnvironmentProvider } from "./sessionInitializer-DEd0CQ74.esm.js";
11
+ import { t as endpoints } from "./endpoints-DOfmJylF.esm.js";
12
+ import "./trueSight-4L5GCqKy.esm.js";
13
+ import { r as resetDeviceStatsQueue, t as addDeviceStats } from "./stats-6sK3f5pc.esm.js";
11
14
  import { a as resetTRI, n as initializeTRI, o as resetTRIProviderInstance } from "./tri-4RsGrIt6.esm.js";
12
- import { n as preloadDashboardFlow, r as resetDashboardFlowCache } from "./flowServices-T5JoA_1N.esm.js";
15
+ import { n as preloadDashboardFlow, r as resetDashboardFlowCache } from "./flowServices-CPti9am-.esm.js";
13
16
  //#region ../infra/src/providers/browser/BrowserPageLifecycleProvider.ts
14
17
  var BrowserPageLifecycleProvider = class {
15
18
  sendBeacon(url, body, contentType = "application/json") {
@@ -288,6 +291,44 @@ function normalizeEncryption(input) {
288
291
  }
289
292
  let configured = false;
290
293
  /**
294
+ * One-line environment facts for TrueSight's snapshot-on-first-error entry
295
+ * (navigator facts read through the L0 provider — core never touches
296
+ * browser globals directly).
297
+ */
298
+ function buildEnvironmentSnapshot() {
299
+ const environment = new BrowserEnvironmentProvider();
300
+ const read = (property) => {
301
+ try {
302
+ return environment.getNavigatorProperty(property);
303
+ } catch {
304
+ return;
305
+ }
306
+ };
307
+ const connection = read("connection");
308
+ return [
309
+ `connection=${typeof connection?.effectiveType === "string" ? connection.effectiveType : "unknown"}`,
310
+ `saveData=${connection?.saveData === true}`,
311
+ `online=${read("onLine") !== false}`,
312
+ `language=${typeof read("language") === "string" ? String(read("language")) : "unknown"}`
313
+ ].join(" ");
314
+ }
315
+ /**
316
+ * ENG-48677 event map row 23b: every Incode HTTP request, success or
317
+ * failure, becomes a self-health line (Android-dashboard parity). Lives here
318
+ * rather than in `api.ts` — `trueSightService` already imports from that
319
+ * module, so a direct `trueSightLog` import there would cycle; `setup()`
320
+ * wires this adapter in as the decoupled observer instead.
321
+ */
322
+ function logHttpRequestTiming(entry) {
323
+ const category = categoryForEndpoint(entry.endpoint);
324
+ const status = entry.httpStatus ?? "unknown";
325
+ if (entry.outcome === "success") {
326
+ trueSightLog("debug", "http", category, `http request completed endpoint=${entry.endpoint} method=${entry.method} httpStatus=${status} durationMs=${entry.durationMs}`);
327
+ return;
328
+ }
329
+ trueSightLog("error", "http", category, `http request failed endpoint=${entry.endpoint} method=${entry.method} httpStatus=${status} durationMs=${entry.durationMs}`);
330
+ }
331
+ /**
291
332
  * Initializes the SDK with the provided configuration.
292
333
  * Must be called before using any SDK functionality.
293
334
  *
@@ -442,6 +483,18 @@ async function setup(options) {
442
483
  pageLifecycle: new BrowserPageLifecycleProvider(),
443
484
  timer: BrowserTimerProvider.getInstance()
444
485
  }));
486
+ initializeTrueSightDiagnostics({
487
+ enabled: options.trueSight?.enabled !== false,
488
+ pageLifecycle: new BrowserPageLifecycleProvider(),
489
+ timer: BrowserTimerProvider.getInstance(),
490
+ storage: new BrowserStorageProvider(),
491
+ getEnvironmentSnapshot: buildEnvironmentSnapshot
492
+ });
493
+ noteTestingSignals({
494
+ devMode: options.devMode,
495
+ apiUrl: options.apiURL
496
+ });
497
+ setHttpRequestObserver(logHttpRequestTiming);
445
498
  const requestedEncryption = normalizeEncryption(options.encryption);
446
499
  const stored = getStoredHttpConfig();
447
500
  if (requestedEncryption && stored) {
@@ -453,7 +506,12 @@ async function setup(options) {
453
506
  mgf1: "sha1"
454
507
  };
455
508
  const effectiveWasm = options.wasm || requestedEncryption?.enabled ? resolveWasmConfig(options.wasm || {}) : void 0;
456
- if (options.apiURL) await installFreshHttpClient(options.apiURL, options, effectiveWasm, effectiveEncryption);
509
+ if (options.apiURL) try {
510
+ await installFreshHttpClient(options.apiURL, options, effectiveWasm, effectiveEncryption);
511
+ } catch (error) {
512
+ trueSightLog("severe", "http", "other", `http client install failed error=${String(error)}`);
513
+ throw error;
514
+ }
457
515
  if (options.token && isApiConfigured()) {
458
516
  const sessionOptions = {
459
517
  token: options.token,
@@ -473,7 +531,14 @@ async function setup(options) {
473
531
  ...effectiveWasm,
474
532
  pipelines: effectiveWasm.pipelines ? [...effectiveWasm.pipelines] : void 0
475
533
  };
476
- await warmupWasm(effectiveWasm);
534
+ const warmupStartedAt = getTimestamp();
535
+ try {
536
+ await warmupWasm(effectiveWasm);
537
+ } catch (error) {
538
+ trueSightLog("severe", "wasm", "other", `wasm warmup failed error=${String(error)} durationMs=${getTimestamp() - warmupStartedAt}`);
539
+ throw error;
540
+ }
541
+ trueSightLog("debug", "wasm", "other", `wasm warmup completed durationMs=${getTimestamp() - warmupStartedAt}`);
477
542
  const provider = await WasmUtilProvider.getInstance();
478
543
  await provider.initialize({
479
544
  ...effectiveWasm,
@@ -574,6 +639,7 @@ function isConfigured() {
574
639
  * Resets the SDK configuration. Useful for testing.
575
640
  */
576
641
  function reset() {
642
+ finalizeTrueSight("failure", "sdk_reset");
577
643
  stopDevtoolsDetector();
578
644
  resetDeviceStatsQueue();
579
645
  resetApi();
@@ -593,6 +659,7 @@ function reset() {
593
659
  resetFeatureManagement();
594
660
  resetFeatureManagementProviderInstance();
595
661
  resetEnvironment();
662
+ resetTrueSight();
596
663
  }
597
664
  //#endregion
598
665
  export { setWasmConfig as a, reset as i, initializeWasmUtil as n, setup as o, isConfigured as r, upgradeToWasmHttpClient as s, ensureWasmPipelines as t };
@@ -240,6 +240,28 @@ type SetupOptions = {
240
240
  * collection should begin.
241
241
  */
242
242
  tri?: TransactionalRiskIntelligenceSetupConfig;
243
+ /**
244
+ * TrueSight diagnostics — Incode-internal SDK-health telemetry
245
+ * (engineering-only dashboard, not customer analytics). During a session
246
+ * the SDK buffers sanitized, structured diagnostic breadcrumbs (module
247
+ * outcomes, error codes, timings — never PII, never captured images) and,
248
+ * at the session terminal, uploads ONE encrypted record to the Incode
249
+ * diagnostics backend. Used by Incode to debug customer-reported capture
250
+ * issues. Fire-and-forget and fail-open: it adds no retries, no blocking
251
+ * work, and can never affect the host flow.
252
+ *
253
+ * - `enabled` — set `false` to opt out entirely (no collection, no
254
+ * subscriptions, no upload). Default: `true` (native SDK parity). Also
255
+ * subject to a server-side kill-switch; an explicit server `false` stops
256
+ * collection remotely regardless of this option.
257
+ *
258
+ * Decided by the first `setup()` call of the SDK lifecycle; later `setup()`
259
+ * calls cannot re-enable or disable it mid-session. Call `reset()` to start
260
+ * a new lifecycle with a different value.
261
+ */
262
+ trueSight?: {
263
+ enabled?: boolean;
264
+ };
243
265
  /**
244
266
  * Enables feature management. Loaded during `setup()` as a separate dynamic chunk,
245
267
  * never part of the main `@incodetech/core` bundle.