@incodetech/core 2.0.0 → 2.0.1-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 (178) hide show
  1. package/dist/Actor-CI32dTbG.d.ts +2 -0
  2. package/dist/BaseWasmProvider-C_DLEI40.esm.js +1118 -0
  3. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +55 -0
  4. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +22 -0
  5. package/dist/ITimerCapability-C67ZRskg.esm.js +7 -0
  6. package/dist/IpifyProvider-D7jx52AL.esm.js +139 -0
  7. package/dist/Manager-C8PrhBOx.d.ts +19 -0
  8. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
  9. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
  10. package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
  11. package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
  12. package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
  13. package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
  14. package/dist/ae-signature.d.ts +25 -0
  15. package/dist/ae-signature.esm.js +8 -0
  16. package/dist/antifraud.d.ts +57 -0
  17. package/dist/antifraud.esm.js +45 -0
  18. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
  19. package/dist/api-CESGtpbH.esm.js +53 -0
  20. package/dist/authentication.d.ts +12 -0
  21. package/dist/authentication.esm.js +25 -0
  22. package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
  23. package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
  24. package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
  25. package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
  26. package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
  27. package/dist/camera-DBSxa6ML.d.ts +4 -0
  28. package/dist/camera-PA2Ljri3.esm.js +22 -0
  29. package/dist/camera.d.ts +15 -0
  30. package/dist/camera.esm.js +5 -0
  31. package/dist/chunk-CRF6K_H_.esm.js +49 -0
  32. package/dist/consent.d.ts +398 -0
  33. package/dist/consent.esm.js +79 -0
  34. package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
  35. package/dist/cpf-PPz2Njto.esm.js +38 -0
  36. package/dist/cpf-ocr.d.ts +204 -0
  37. package/dist/cpf-ocr.esm.js +177 -0
  38. package/dist/cross-document-data-match.d.ts +34 -0
  39. package/dist/cross-document-data-match.esm.js +71 -0
  40. package/dist/curp-validation.d.ts +188 -0
  41. package/dist/curp-validation.esm.js +110 -0
  42. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
  43. package/dist/custom-fields.d.ts +115 -0
  44. package/dist/custom-fields.esm.js +177 -0
  45. package/dist/custom-watchlist.d.ts +66 -0
  46. package/dist/custom-watchlist.esm.js +86 -0
  47. package/dist/dateUtils-UoN5xswP.esm.js +23 -0
  48. package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
  49. package/dist/deepsightService-CEVxzehb.d.ts +412 -0
  50. package/dist/deepsightService-O74l4Y__.esm.js +489 -0
  51. package/dist/device.d.ts +46 -0
  52. package/dist/device.esm.js +106 -0
  53. package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
  54. package/dist/document-capture.d.ts +906 -0
  55. package/dist/document-capture.esm.js +156 -0
  56. package/dist/document-upload.d.ts +331 -0
  57. package/dist/document-upload.esm.js +203 -0
  58. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
  59. package/dist/dynamic-forms.d.ts +178 -0
  60. package/dist/dynamic-forms.esm.js +323 -0
  61. package/dist/ekyb.d.ts +148 -0
  62. package/dist/ekyb.esm.js +127 -0
  63. package/dist/ekybStateMachine-BR2let5f.esm.js +674 -0
  64. package/dist/ekyc.d.ts +164 -0
  65. package/dist/ekyc.esm.js +104 -0
  66. package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
  67. package/dist/electronic-signature.d.ts +4 -0
  68. package/dist/electronic-signature.esm.js +7 -0
  69. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
  70. package/dist/email.d.ts +4 -0
  71. package/dist/email.esm.js +9 -0
  72. package/dist/emailManager-DIfnS5g1.d.ts +352 -0
  73. package/dist/emailManager-wAV0LE-H.esm.js +238 -0
  74. package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
  75. package/dist/endpoints-CnN3SyDa.esm.js +87 -0
  76. package/dist/events-D6-e4vok.esm.js +596 -0
  77. package/dist/events.d.ts +265 -0
  78. package/dist/events.esm.js +4 -0
  79. package/dist/extensibility.d.ts +122 -0
  80. package/dist/extensibility.esm.js +43 -0
  81. package/dist/face-match.d.ts +228 -0
  82. package/dist/face-match.esm.js +173 -0
  83. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
  84. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
  85. package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
  86. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
  87. package/dist/flow-events.d.ts +6 -0
  88. package/dist/flow-events.esm.js +0 -0
  89. package/dist/flow.d.ts +358 -0
  90. package/dist/flow.esm.js +825 -0
  91. package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
  92. package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
  93. package/dist/flowServices-DG3IdWw6.esm.js +188 -0
  94. package/dist/geolocation.d.ts +127 -0
  95. package/dist/geolocation.esm.js +89 -0
  96. package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
  97. package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
  98. package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
  99. package/dist/government-validation.d.ts +67 -0
  100. package/dist/government-validation.esm.js +81 -0
  101. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
  102. package/dist/home.d.ts +99 -0
  103. package/dist/home.esm.js +61 -0
  104. package/dist/http.d.ts +68 -0
  105. package/dist/http.esm.js +3 -0
  106. package/dist/id-ocr.d.ts +635 -0
  107. package/dist/id-ocr.esm.js +86 -0
  108. package/dist/id-verification.d.ts +190 -0
  109. package/dist/id-verification.esm.js +43 -0
  110. package/dist/id.d.ts +24 -0
  111. package/dist/id.esm.js +164 -0
  112. package/dist/idCaptureManager-Fyd0eam-.d.ts +958 -0
  113. package/dist/idCaptureManager-ZPkD7Gjk.esm.js +581 -0
  114. package/dist/idCaptureStateMachine-BK0bPHoc.esm.js +2963 -0
  115. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
  116. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
  117. package/dist/identity-reuse.d.ts +530 -0
  118. package/dist/identity-reuse.esm.js +274 -0
  119. package/dist/index-BcRG8rtJ.d.ts +97 -0
  120. package/dist/index-DZoqeAo9.d.ts +1177 -0
  121. package/dist/index.d.ts +3 -0
  122. package/dist/index.esm.js +12 -0
  123. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
  124. package/dist/lib-BB0B_qQX.esm.js +12499 -0
  125. package/dist/mandatory-consent.d.ts +412 -0
  126. package/dist/mandatory-consent.esm.js +78 -0
  127. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
  128. package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
  129. package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
  130. package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
  131. package/dist/phone.d.ts +4 -0
  132. package/dist/phone.esm.js +9 -0
  133. package/dist/phoneManager-B6M30hKE.d.ts +397 -0
  134. package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
  135. package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
  136. package/dist/platform-CfrjKhmi.esm.js +83 -0
  137. package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
  138. package/dist/qe-signature.d.ts +25 -0
  139. package/dist/qe-signature.esm.js +8 -0
  140. package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
  141. package/dist/redirect-to-mobile.d.ts +107 -0
  142. package/dist/redirect-to-mobile.esm.js +102 -0
  143. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
  144. package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
  145. package/dist/selfie.d.ts +26 -0
  146. package/dist/selfie.esm.js +146 -0
  147. package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
  148. package/dist/selfieManager-Duisl7qN.esm.js +60 -0
  149. package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
  150. package/dist/session-CGtQJJzB.esm.js +3206 -0
  151. package/dist/session.d.ts +217 -0
  152. package/dist/session.esm.js +9 -0
  153. package/dist/setup-C5AITV8m.d.ts +254 -0
  154. package/dist/setup-DsM8IG7k.esm.js +887 -0
  155. package/dist/signature.d.ts +94 -0
  156. package/dist/signature.esm.js +66 -0
  157. package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
  158. package/dist/stats-CIfiPzb1.esm.js +16 -0
  159. package/dist/stats.d.ts +16 -0
  160. package/dist/stats.esm.js +4 -0
  161. package/dist/trust-graph.d.ts +54 -0
  162. package/dist/trust-graph.esm.js +56 -0
  163. package/dist/types-B06Ypu2F.d.ts +49 -0
  164. package/dist/types-BP1m8VRw.d.ts +340 -0
  165. package/dist/types-CAD4va6a.d.ts +5 -0
  166. package/dist/types-CFV9G_7j.d.ts +24 -0
  167. package/dist/warmup-CEcppFiS.d.ts +63 -0
  168. package/dist/wasm.d.ts +15 -0
  169. package/dist/wasm.esm.js +12 -0
  170. package/dist/watchlist-for-business.d.ts +79 -0
  171. package/dist/watchlist-for-business.esm.js +148 -0
  172. package/dist/watchlist.d.ts +62 -0
  173. package/dist/watchlist.esm.js +86 -0
  174. package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
  175. package/dist/workflow.d.ts +907 -0
  176. package/dist/workflow.esm.js +702 -0
  177. package/dist/xstate.esm-B70JrNqo.esm.js +3404 -0
  178. package/package.json +1 -1
@@ -0,0 +1,217 @@
1
+ import "./camera-DBSxa6ML.js";
2
+ import "./types-CFV9G_7j.js";
3
+ import { a as RegulationTypes } from "./types-BP1m8VRw.js";
4
+ import { n as GetFinishStatusFn, r as getFinishStatus, t as FinishStatus } from "./flowCompletionService-DhkT4SRY.js";
5
+
6
+ //#region src/internal/fingerprint/types.d.ts
7
+
8
+ type DeviceFingerprintResult = {
9
+ success: boolean;
10
+ sessionStatus: string;
11
+ showMandatoryConsent?: boolean;
12
+ regulationType?: RegulationTypes;
13
+ };
14
+ //#endregion
15
+ //#region src/internal/session/sessionService.d.ts
16
+ type CreateSessionOptions = {
17
+ /** The configuration/flow ID from the Incode dashboard */
18
+ configurationId: string;
19
+ /** External ID to associate with this session */
20
+ externalId?: string;
21
+ /** External customer ID */
22
+ externalCustomerId?: string;
23
+ /** Language for the session (e.g., 'en-US', 'es-MX') */
24
+ language?: string;
25
+ /** Custom fields to attach to the session */
26
+ customFields?: Record<string, unknown>;
27
+ /** UUID for continuing an existing session */
28
+ uuid?: string;
29
+ /** QR anti-phishing token for continuing a phishing-resistant session from a mobile link */
30
+ urlUuid?: string;
31
+ /** Interview ID for continuing an existing interview */
32
+ interviewId?: string;
33
+ /** Hint forwarded to POST /omni/start as `loginHint` (e.g. from `auth_hint` URL param for identity search). */
34
+ loginHint?: string;
35
+ };
36
+ type Session = {
37
+ token: string;
38
+ interviewId: string;
39
+ uuid?: string;
40
+ regulationType?: string;
41
+ showMandatoryConsent?: boolean;
42
+ };
43
+ type ValidateQrUuidOptions = {
44
+ onboardingId: string | null;
45
+ urlUuid: string;
46
+ };
47
+ type QrValidationResult = {
48
+ urlUuid: string;
49
+ };
50
+ /**
51
+ * HTTP status codes the QR validation endpoint emits, keyed by their semantic
52
+ * name. Hosts switch on these to render distinct messaging — `invalidQRuuid`
53
+ * for an unknown/expired link, `onboardingUrlAlreadyUsed` for a one-time link
54
+ * that has already been consumed.
55
+ */
56
+ declare const QR_VALIDATION_ERROR_CODES: {
57
+ readonly expiredUUID: 4026;
58
+ readonly invalidQRuuid: 4081;
59
+ readonly onboardingUrlAlreadyUsed: 4083;
60
+ };
61
+ type QrValidationErrorCode = (typeof QR_VALIDATION_ERROR_CODES)[keyof typeof QR_VALIDATION_ERROR_CODES];
62
+ type RefreshQrUrlUuidOptions = {
63
+ /** QR anti-phishing token from the incoming URL. When empty/undefined, the call is a no-op. */
64
+ urlUuid?: string;
65
+ /** Onboarding session UUID, if known. Pass `null` or omit when the caller has no session yet. */
66
+ onboardingId?: string | null;
67
+ /** Invoked with the refreshed `urlUuid` once the server rotates it. */
68
+ onRefreshed?: (urlUuid: string) => void;
69
+ };
70
+ type BootstrapSessionOptions = CreateSessionOptions & {
71
+ /** Invoked with the rotated `urlUuid` after `validateQrUuid` succeeds. Hosts
72
+ * typically use this to update the address bar via `history.replaceState`. */
73
+ onUrlUuidRefreshed?: (urlUuid: string) => void;
74
+ };
75
+ declare class QrValidationError extends Error {
76
+ readonly status: number;
77
+ readonly statusText: string;
78
+ constructor(status: number, statusText: string);
79
+ }
80
+ /**
81
+ * Creates a new onboarding session.
82
+ *
83
+ * @param apiKey - The API key from the Incode dashboard
84
+ * @param options - Session creation options
85
+ * @param signal - Optional AbortSignal for request cancellation
86
+ * @returns The created session with token
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const session = await createSession('your-api-key', {
91
+ * configurationId: 'your-flow-id',
92
+ * language: 'en-US',
93
+ * });
94
+ * console.log(session.token); // Use this token for subsequent API calls
95
+ * ```
96
+ */
97
+ declare function createSession(apiKey: string, options: CreateSessionOptions, signal?: AbortSignal): Promise<Session>;
98
+ /**
99
+ * Validates and rotates a QR anti-phishing URL UUID before creating a session.
100
+ *
101
+ * This call is unauthenticated; the `{ onboardingId, urlUuid }` pair itself
102
+ * acts as the credential. The server burns the incoming `urlUuid` and returns
103
+ * a freshly minted one that must be used in the subsequent `createSession`
104
+ * call.
105
+ *
106
+ * @param options - `{ onboardingId, urlUuid }` from the incoming URL
107
+ * @param signal - Optional AbortSignal for request cancellation
108
+ * @returns The refreshed `urlUuid` to use for the session
109
+ * @throws {QrValidationError} When the server rejects the validation request.
110
+ */
111
+ declare function validateQrUuid(options: ValidateQrUuidOptions, signal?: AbortSignal): Promise<QrValidationResult>;
112
+ /**
113
+ * One-shot QR phishing-resistance helper.
114
+ *
115
+ * When `urlUuid` is a non-empty string, burns the stale value via
116
+ * `validateQrUuid`, invokes `onRefreshed` with the fresh value, and returns
117
+ * it so callers can forward it into `createSession`. When `urlUuid` is
118
+ * absent, returns `undefined` without making any network call.
119
+ *
120
+ * Consolidates the rotation + callback logic shared by Flow self-loading and
121
+ * Workflow token-mode bootstraps.
122
+ *
123
+ * @throws {QrValidationError} When the server rejects the validation request.
124
+ */
125
+ declare function refreshQrUrlUuid(options: RefreshQrUrlUuidOptions, signal?: AbortSignal): Promise<string | undefined>;
126
+ /**
127
+ * Validates and rotates a QR anti-phishing `urlUuid` (when present), then
128
+ * creates a session bound to the refreshed value. When `urlUuid` is absent,
129
+ * behaves identically to {@link createSession}.
130
+ *
131
+ * Use this when the host owns session creation and wants the SDK to handle
132
+ * phishing-resistance rotation in a single call. For raw control, compose
133
+ * `refreshQrUrlUuid` and `createSession` directly.
134
+ *
135
+ * @throws {QrValidationError} When the server rejects the QR validation step.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const session = await bootstrapSession(apiKey, {
140
+ * configurationId,
141
+ * urlUuid,
142
+ * onUrlUuidRefreshed: (refreshed) => {
143
+ * const url = new URL(window.location.href);
144
+ * url.searchParams.set('url_uuid', refreshed);
145
+ * window.history.replaceState({}, '', url);
146
+ * },
147
+ * });
148
+ * ```
149
+ */
150
+ declare function bootstrapSession(apiKey: string, options: BootstrapSessionOptions, signal?: AbortSignal): Promise<Session>;
151
+ //#endregion
152
+ //#region src/internal/featureConfig/types.d.ts
153
+ type FeatureName = 'VIDEO_SELFIE_V2' | 'USE_CLIENT_GLARE' | 'USE_OPEN_VIDU' | 'DISABLE_IPIFY';
154
+ type FeatureConfig = {
155
+ enabled: boolean;
156
+ feature: FeatureName;
157
+ config?: number | string;
158
+ };
159
+ type Features = {
160
+ features?: FeatureConfig[];
161
+ sessionIdentifier: string;
162
+ };
163
+ //#endregion
164
+ //#region src/internal/session/sessionInitializer.d.ts
165
+ type SessionInitOptions = {
166
+ /**
167
+ * Session token returned by `createSession`. Persisted on the HTTP client
168
+ * for the rest of the session.
169
+ *
170
+ * Optional only for internal re-triggers from inside flow/workflow loaders,
171
+ * where the token was already activated by an earlier `initializeSession`
172
+ * call. When omitted the function falls back to the currently registered
173
+ * token. Application code should always pass `token` explicitly.
174
+ */
175
+ token?: string;
176
+ /** Custom hosting app name for fingerprint */
177
+ hostingApp?: string;
178
+ /** Abort signal for cancellation */
179
+ signal?: AbortSignal;
180
+ };
181
+ type SessionInitResult = {
182
+ features: Features;
183
+ disableIpify: boolean;
184
+ fingerprintSuccess: boolean;
185
+ fingerprintResult: DeviceFingerprintResult | undefined;
186
+ };
187
+ /**
188
+ * Activates a session by setting the auth token on the HTTP client and
189
+ * preloading session-scoped state.
190
+ *
191
+ * Performs:
192
+ * 1. Sets the token (and clears stale session-init cache if the token changed)
193
+ * 2. Fetches feature configuration from backend
194
+ * 3. Submits device fingerprint
195
+ * 4. Starts the analytics batcher so buffered events are flushed
196
+ *
197
+ * Results are cached per token. Calling again with the same token returns the
198
+ * cached result; calling with a different token re-initializes from scratch.
199
+ *
200
+ * @param options - Session activation options (`token` required)
201
+ * @returns Session initialization result with feature config
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * await setup({ apiURL: 'https://api.incode.com' });
206
+ * const session = await createSession('api-key', options);
207
+ * const { features } = await initializeSession({ token: session.token });
208
+ *
209
+ * // Check feature flags
210
+ * if (isFeatureEnabled('DISABLE_IPIFY', features.features)) {
211
+ * // Handle disabled ipify
212
+ * }
213
+ * ```
214
+ */
215
+ declare function initializeSession(options?: SessionInitOptions): Promise<SessionInitResult>;
216
+ //#endregion
217
+ export { type BootstrapSessionOptions, type CreateSessionOptions, type FinishStatus, type GetFinishStatusFn, QR_VALIDATION_ERROR_CODES, QrValidationError, type QrValidationErrorCode, type QrValidationResult, type RefreshQrUrlUuidOptions, type Session, type SessionInitOptions, type SessionInitResult, type ValidateQrUuidOptions, bootstrapSession, createSession, getFinishStatus, initializeSession, refreshQrUrlUuid, validateQrUuid };
@@ -0,0 +1,9 @@
1
+ import "./api-CESGtpbH.esm.js";
2
+ import "./events-D6-e4vok.esm.js";
3
+ import "./endpoints-CnN3SyDa.esm.js";
4
+ import { c as QrValidationError, d as refreshQrUrlUuid, f as validateQrUuid, l as bootstrapSession, r as initializeSession, s as QR_VALIDATION_ERROR_CODES, u as createSession } from "./session-CGtQJJzB.esm.js";
5
+ import "./IpifyProvider-D7jx52AL.esm.js";
6
+ import "./browserSimulation-gxD8cSpM.esm.js";
7
+ import { t as getFinishStatus } from "./flowCompletionService-P54yzGvA.esm.js";
8
+
9
+ export { QR_VALIDATION_ERROR_CODES, QrValidationError, bootstrapSession, createSession, getFinishStatus, initializeSession, refreshQrUrlUuid, validateQrUuid };
@@ -0,0 +1,254 @@
1
+ import { n as WasmPipeline } from "./warmup-CEcppFiS.js";
2
+
3
+ //#region src/setup.d.ts
4
+
5
+ /**
6
+ * WASM warmup configuration. Path fields are optional; omitted values resolve to the Incode CDN defaults.
7
+ */
8
+ type WasmConfig = {
9
+ /** Path to the WASM binary */
10
+ wasmPath?: string;
11
+ /** Path to the SIMD-optimized WASM binary (optional) */
12
+ wasmSimdPath?: string;
13
+ /** Path to the WASM glue code (paired with `wasmPath`) */
14
+ glueCodePath?: string;
15
+ /**
16
+ * Path to the SIMD-optimized WASM glue code (paired with `wasmSimdPath`).
17
+ * If omitted, defaults to a sibling `.js` derived from `wasmSimdPath`.
18
+ */
19
+ glueCodeSimdPath?: string;
20
+ /** Whether to use SIMD optimizations (default: true) */
21
+ useSimd?: boolean;
22
+ /** Which pipelines to preload models for */
23
+ pipelines?: WasmPipeline[];
24
+ /**
25
+ * Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
26
+ * If not provided, models are expected in a 'models' subdirectory relative to the WASM binary.
27
+ */
28
+ modelsBasePath?: string;
29
+ };
30
+ /**
31
+ * Object form of the `encryption` option for {@link SetupOptions}. Reach for
32
+ * this when you need to pin the OAEP MGF1 hash; the boolean shorthand
33
+ * (`encryption: true`) is equivalent to `{}` and uses the SHA-1 default.
34
+ *
35
+ * Which value to pass is **dictated by the E2EE environment Incode has
36
+ * provisioned for your account** — confirm with your Incode account team
37
+ * before changing it.
38
+ */
39
+ type EncryptionOptions = {
40
+ /**
41
+ * OAEP MGF1 hash for the in-binary RSA handshake.
42
+ * - `'sha1'` (default) — matches the legacy Java backend default. Most
43
+ * E2EE environments are happy with this.
44
+ * - `'sha256'` — sends the
45
+ * `X-RSA-Encryption-Scheme: RSA/NONE/OAEPWITHSHA-256ANDMGF1PADDING`
46
+ * header on every encrypted request so the server matches. Only use this
47
+ * if the environment has been configured to honor the explicit header.
48
+ *
49
+ * Locked at the first `setup()` call. To change it, call `reset()` and
50
+ * re-`setup()` from scratch.
51
+ */
52
+ mgf1?: 'sha1' | 'sha256';
53
+ };
54
+ /**
55
+ * Configuration options for the SDK setup.
56
+ */
57
+ type SetupOptions = {
58
+ /** The base URL for the API. When omitted, no HTTP client is created — useful when all API actors are overridden via .provide(). */
59
+ apiURL?: string;
60
+ /**
61
+ * The session token for API requests.
62
+ *
63
+ * Optional convenience — when provided, `setup` delegates to
64
+ * `initializeSession({ token, hostingApp })` after the HTTP client is in
65
+ * place. Equivalent to calling `initializeSession` yourself after
66
+ * `setup({ apiURL })` returns, which is the preferred shape when you want to
67
+ * own the moment the session is activated (e.g. between `createSession` and
68
+ * mounting `<incode-flow>`).
69
+ */
70
+ token?: string;
71
+ /** Custom headers to include in all requests */
72
+ customHeaders?: Record<string, string>;
73
+ /** Request timeout in milliseconds */
74
+ timeout?: number;
75
+ /**
76
+ * WASM warmup config.
77
+ * - Omit (default): does not load WASM.
78
+ * - `false`: explicitly disable WASM loading.
79
+ * - Object: load WASM with CDN defaults plus any overrides you provide.
80
+ */
81
+ wasm?: WasmConfig | false;
82
+ /**
83
+ * Enable end-to-end encryption for SDK traffic. When enabled, the SDK
84
+ * negotiates an encrypted transport during initialization (RSA-OAEP key
85
+ * transport + AES-GCM payload encryption). Independent of `token` —
86
+ * encryption can be set up before a session token is known.
87
+ *
88
+ * **Not a self-serve flag.** E2EE has to be provisioned for your account
89
+ * by Incode, and you'll be given a dedicated `apiURL` (typically a
90
+ * `*-e2ee-api.incodesmile.com` host) plus the `mgf1` scheme that
91
+ * environment expects. Pointing this at a non-E2EE host will fail the
92
+ * handshake at `setup()`. Coordinate with your Incode account team before
93
+ * flipping this on.
94
+ *
95
+ * Accepts:
96
+ * - `true` → enabled with the default OAEP MGF1 hash (`'sha1'`).
97
+ * - `false` (or omitted) → disabled.
98
+ * - `{}` → same as `true`.
99
+ * - `{ mgf1: 'sha256' }` → enabled with the SHA-256 MGF1 hash.
100
+ *
101
+ * Encryption requires the binary (WASM) transport. If `wasm: false` is set,
102
+ * `setup` throws. If `wasm` is omitted, the binary transport is provisioned
103
+ * automatically with CDN defaults.
104
+ *
105
+ * **Locked at boot.** The first `setup()` call decides whether encryption
106
+ * is on, and if so which MGF1 scheme is used. Subsequent `setup()` calls
107
+ * that would change either of those values throw with a descriptive error.
108
+ * Call `reset()` if you need to change them.
109
+ *
110
+ * **Failure modes.** `setup()` rejects with a descriptive error if the
111
+ * encrypted-transport handshake (`GET /e2ee/key/v2` + `POST /e2ee/key`)
112
+ * cannot complete — most commonly because `apiURL` points at a host that
113
+ * isn't provisioned for E2EE, or because the requested `mgf1` doesn't
114
+ * match what the environment expects. There is no built-in retry; catch
115
+ * and re-call `setup()` after `reset()` if your environment is
116
+ * known-flaky.
117
+ *
118
+ * @throws If `wasm: false` is also set, or if the handshake fails, or if
119
+ * the encryption value differs from what was locked in on the first
120
+ * `setup()` call.
121
+ */
122
+ encryption?: boolean | EncryptionOptions;
123
+ /** Optional hosting app identifier for fingerprint tracking */
124
+ hostingApp?: string;
125
+ };
126
+ /**
127
+ * Initializes the SDK with the provided configuration.
128
+ * Must be called before using any SDK functionality.
129
+ *
130
+ * WASM loads only when `options.wasm` is provided as an object.
131
+ *
132
+ * `setup` is boot — it provisions the HTTP client, the optional E2EE
133
+ * handshake, WASM warmup, and the analytics batcher. The session token is a
134
+ * separate concern: hand it off via `initializeSession({ token })` from
135
+ * `@incodetech/core/session`, or pass it inline as `setup({ apiURL, token })`
136
+ * (a convenience that delegates to `initializeSession` for you).
137
+ *
138
+ * @param options - Configuration options for the SDK
139
+ *
140
+ * @example Boot first, activate the session later (preferred)
141
+ * ```ts
142
+ * import { setup } from '@incodetech/core';
143
+ * import { createSession, initializeSession } from '@incodetech/core/session';
144
+ *
145
+ * await setup({ apiURL: 'https://api.incode.com' });
146
+ * const session = await createSession(apiKey, { configurationId });
147
+ * await initializeSession({ token: session.token });
148
+ * ```
149
+ *
150
+ * @example One-shot convenience
151
+ * ```ts
152
+ * await setup({ apiURL: 'https://api.incode.com', token: 'session-token' });
153
+ * ```
154
+ *
155
+ * @example Explicitly disable WASM
156
+ * ```ts
157
+ * await setup({ apiURL: 'https://api.incode.com', wasm: false });
158
+ * ```
159
+ *
160
+ * @example Use CDN defaults for paths and preload only one pipeline
161
+ * ```ts
162
+ * await setup({
163
+ * apiURL: 'https://api.incode.com',
164
+ * wasm: { pipelines: ['selfie'] },
165
+ * });
166
+ * ```
167
+ *
168
+ * @example Self-hosted / custom version (full or partial path overrides)
169
+ * ```ts
170
+ * await setup({
171
+ * apiURL: 'https://api.incode.com',
172
+ * wasm: {
173
+ * wasmPath: '/my-cdn/webLib.wasm',
174
+ * glueCodePath: '/my-cdn/webLib.js',
175
+ * },
176
+ * });
177
+ * ```
178
+ *
179
+ * @example Partial override: only models path, rest from CDN
180
+ * ```ts
181
+ * await setup({
182
+ * apiURL: 'https://api.incode.com',
183
+ * wasm: { modelsBasePath: 'https://my-cdn/models' },
184
+ * });
185
+ * ```
186
+ *
187
+ * @example Sessionless setup (all API actors overridden via .provide())
188
+ * ```ts
189
+ * await setup({
190
+ * wasm: {
191
+ * wasmPath: '/wasm/ml-wasm.wasm',
192
+ * glueCodePath: '/wasm/ml-wasm.js',
193
+ * pipelines: ['selfie'],
194
+ * },
195
+ * });
196
+ * ```
197
+ *
198
+ * @example Enable end-to-end encryption at boot (defaults to MGF1 = SHA-1)
199
+ * ```ts
200
+ * await setup({ apiURL: 'https://api.incode.com', encryption: true });
201
+ * ```
202
+ *
203
+ * @example Enable encryption with the SHA-256 MGF1 padding
204
+ * ```ts
205
+ * await setup({
206
+ * apiURL: 'https://api.incode.com',
207
+ * encryption: { mgf1: 'sha256' },
208
+ * });
209
+ * ```
210
+ */
211
+ declare function setup(options: SetupOptions): Promise<void>;
212
+ /**
213
+ * Sets the WASM configuration without performing warmup.
214
+ * Useful when WASM warmup is handled separately (e.g., conditionally based on flow).
215
+ *
216
+ * @param config - WASM configuration to store
217
+ */
218
+ declare function setWasmConfig(config: WasmConfig): void;
219
+ /**
220
+ * Initializes WasmUtilProvider with the stored WASM configuration.
221
+ * Should be called after warmupWasm() completes when using conditional warmup.
222
+ * This ensures image encryption works properly.
223
+ *
224
+ * @param config - Optional WASM configuration. If not provided, uses the stored config from setWasmConfig().
225
+ * @throws Error if no config is provided and none is stored
226
+ */
227
+ declare function initializeWasmUtil(config?: WasmConfig): Promise<void>;
228
+ /**
229
+ * Replaces the active HTTP client with the WASM-backed one. Used internally
230
+ * by lazy-loading UI components (`<incode-flow>`, `<incode-workflow>`) when
231
+ * WASM finishes warming up.
232
+ *
233
+ * No-op when no apiURL was originally configured, or when the active client is
234
+ * already the WASM one.
235
+ *
236
+ * @internal NOT a public API. Application code should use
237
+ * `setup({ wasm: {...} })` instead — that path is the supported way to opt
238
+ * into the WASM HTTP client.
239
+ *
240
+ * @param config - Optional WASM configuration. Defaults to the config stored via `setWasmConfig`.
241
+ */
242
+ declare function upgradeToWasmHttpClient(config?: WasmConfig): Promise<void>;
243
+ /**
244
+ * Checks if the SDK has been configured.
245
+ *
246
+ * @returns true if setup() has been called, false otherwise
247
+ */
248
+ declare function isConfigured(): boolean;
249
+ /**
250
+ * Resets the SDK configuration. Useful for testing.
251
+ */
252
+ declare function reset(): void;
253
+ //#endregion
254
+ export { reset as a, upgradeToWasmHttpClient as c, isConfigured as i, WasmConfig as n, setWasmConfig as o, initializeWasmUtil as r, setup as s, SetupOptions as t };