@incodetech/core 0.0.0-dev-20260515-a07df20 → 0.0.0-dev-20260515-5ea50d5
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.
- package/dist/ae-signature.d.ts +1 -1
- package/dist/consent.d.ts +47 -47
- package/dist/cpf-ocr.d.ts +17 -17
- package/dist/document-capture.d.ts +68 -68
- package/dist/document-upload.d.ts +40 -40
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybStateMachine-BihTKkNC.esm.js → ekybStateMachine-CQyZTMF0.esm.js} +1 -1
- package/dist/electronic-signature.d.ts +1 -1
- package/dist/extensibility.d.ts +1 -1
- package/dist/extensibility.esm.js +3 -3
- package/dist/flow.d.ts +2 -2
- package/dist/flow.esm.js +2 -2
- package/dist/{flowServices-DZAOYIFW.esm.js → flowServices-jTW-yhzr.esm.js} +5 -1
- package/dist/home.d.ts +10 -10
- package/dist/id-ocr.d.ts +52 -52
- package/dist/id-verification.d.ts +25 -25
- package/dist/id.d.ts +1 -1
- package/dist/id.esm.js +3 -3
- package/dist/{idCaptureManager-Dzaillra.d.ts → idCaptureManager-B9TGA5dq.d.ts} +15 -0
- package/dist/{idCaptureManager-Ch64CD8w.esm.js → idCaptureManager-DFk3Tytl.esm.js} +1 -1
- package/dist/{idCaptureStateMachine-KxWTQqcZ.esm.js → idCaptureStateMachine-DAO1IbBO.esm.js} +49 -10
- package/dist/identity-reuse.d.ts +40 -40
- package/dist/{index-CNUtzsRO.d.ts → index-CoVWTOZj.d.ts} +119 -119
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/qe-signature.d.ts +1 -1
- package/dist/{session-CONcSjo_.esm.js → session-DwRz_09p.esm.js} +20 -13
- package/dist/session.d.ts +78 -1
- package/dist/session.esm.js +2 -2
- package/dist/{setup-FpVUZIRi.d.ts → setup-C5AITV8m.d.ts} +48 -14
- package/dist/{setup-BWHiqu6S.esm.js → setup-Ewnwm56p.esm.js} +47 -25
- package/dist/wasm.d.ts +1 -1
- package/dist/wasm.esm.js +2 -2
- package/dist/workflow.d.ts +84 -84
- package/dist/workflow.esm.js +4 -4
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as setup, n as isConfigured, r as reset } from "./setup-
|
|
1
|
+
import { a as setup, n as isConfigured, r as reset } from "./setup-Ewnwm56p.esm.js";
|
|
2
2
|
import "./BaseWasmProvider-C_DLEI40.esm.js";
|
|
3
3
|
import "./WasmUtilProvider-j98OJf-S.esm.js";
|
|
4
4
|
import "./BrowserTimerProvider-DhNc_x02.esm.js";
|
|
5
5
|
import "./api-CESGtpbH.esm.js";
|
|
6
6
|
import "./events-D6-e4vok.esm.js";
|
|
7
7
|
import "./endpoints-CnN3SyDa.esm.js";
|
|
8
|
-
import "./session-
|
|
8
|
+
import "./session-DwRz_09p.esm.js";
|
|
9
9
|
import "./IpifyProvider-D7jx52AL.esm.js";
|
|
10
10
|
import "./browserSimulation-gxD8cSpM.esm.js";
|
|
11
11
|
|
package/dist/qe-signature.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-C8PrhBOx.js";
|
|
2
2
|
import "./Actor-CI32dTbG.js";
|
|
3
|
-
import { c as ConsentKey, f as QE_CONSENT_KEYS, g as getDefaultConsentChecks, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, s as ConsentChecks, u as ElectronicSignatureDocument } from "./index-
|
|
3
|
+
import { c as ConsentKey, f as QE_CONSENT_KEYS, g as getDefaultConsentChecks, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, s as ConsentChecks, u as ElectronicSignatureDocument } from "./index-CoVWTOZj.js";
|
|
4
4
|
|
|
5
5
|
//#region src/modules/qe-signature/index.d.ts
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as getApi, t as api } from "./api-CESGtpbH.esm.js";
|
|
2
|
-
import { h as addEvent } from "./events-D6-e4vok.esm.js";
|
|
1
|
+
import { n as getApi, r as getToken, s as setToken, t as api } from "./api-CESGtpbH.esm.js";
|
|
2
|
+
import { g as getAnalyticsBatcher, h as addEvent } from "./events-D6-e4vok.esm.js";
|
|
3
3
|
import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
|
|
4
4
|
import { n as resetIpifyCache, r as BrowserEnvironmentProvider, t as IpifyProvider } from "./IpifyProvider-D7jx52AL.esm.js";
|
|
5
5
|
import { t as isBrowserSimulation } from "./browserSimulation-gxD8cSpM.esm.js";
|
|
@@ -3036,7 +3036,7 @@ function resetFeatureConfigCache() {
|
|
|
3036
3036
|
|
|
3037
3037
|
//#endregion
|
|
3038
3038
|
//#region src/internal/version/sdkVersion.ts
|
|
3039
|
-
const SDK_VERSION = "0.0.0-dev-20260515-
|
|
3039
|
+
const SDK_VERSION = "0.0.0-dev-20260515-5ea50d5";
|
|
3040
3040
|
|
|
3041
3041
|
//#endregion
|
|
3042
3042
|
//#region src/internal/fingerprint/fingerprintService.ts
|
|
@@ -3077,24 +3077,26 @@ let cachedFingerprintSuccess = false;
|
|
|
3077
3077
|
let cachedFingerprintResult;
|
|
3078
3078
|
let sessionInitPromise = null;
|
|
3079
3079
|
/**
|
|
3080
|
-
*
|
|
3081
|
-
*
|
|
3080
|
+
* Activates a session by setting the auth token on the HTTP client and
|
|
3081
|
+
* preloading session-scoped state.
|
|
3082
3082
|
*
|
|
3083
3083
|
* Performs:
|
|
3084
|
-
* 1.
|
|
3085
|
-
* 2.
|
|
3084
|
+
* 1. Sets the token (and clears stale session-init cache if the token changed)
|
|
3085
|
+
* 2. Fetches feature configuration from backend
|
|
3086
|
+
* 3. Submits device fingerprint
|
|
3087
|
+
* 4. Starts the analytics batcher so buffered events are flushed
|
|
3086
3088
|
*
|
|
3087
|
-
* Results are cached
|
|
3089
|
+
* Results are cached per token. Calling again with the same token returns the
|
|
3090
|
+
* cached result; calling with a different token re-initializes from scratch.
|
|
3088
3091
|
*
|
|
3089
|
-
* @param options -
|
|
3092
|
+
* @param options - Session activation options (`token` required)
|
|
3090
3093
|
* @returns Session initialization result with feature config
|
|
3091
3094
|
*
|
|
3092
3095
|
* @example
|
|
3093
3096
|
* ```ts
|
|
3094
|
-
*
|
|
3097
|
+
* await setup({ apiURL: 'https://api.incode.com' });
|
|
3095
3098
|
* const session = await createSession('api-key', options);
|
|
3096
|
-
*
|
|
3097
|
-
* const { features } = await initializeSession();
|
|
3099
|
+
* const { features } = await initializeSession({ token: session.token });
|
|
3098
3100
|
*
|
|
3099
3101
|
* // Check feature flags
|
|
3100
3102
|
* if (isFeatureEnabled('DISABLE_IPIFY', features.features)) {
|
|
@@ -3103,7 +3105,11 @@ let sessionInitPromise = null;
|
|
|
3103
3105
|
* ```
|
|
3104
3106
|
*/
|
|
3105
3107
|
async function initializeSession(options = {}) {
|
|
3106
|
-
const { hostingApp, signal } = options;
|
|
3108
|
+
const { token, hostingApp, signal } = options;
|
|
3109
|
+
if (token !== void 0 && token !== getToken()) {
|
|
3110
|
+
setToken(token);
|
|
3111
|
+
resetSessionInit();
|
|
3112
|
+
}
|
|
3107
3113
|
if (sessionInitialized && cachedFeatures) return {
|
|
3108
3114
|
features: cachedFeatures,
|
|
3109
3115
|
disableIpify: cachedDisableIpify,
|
|
@@ -3167,6 +3173,7 @@ async function initializeSession(options = {}) {
|
|
|
3167
3173
|
};
|
|
3168
3174
|
})().finally(() => {
|
|
3169
3175
|
sessionInitPromise = null;
|
|
3176
|
+
getAnalyticsBatcher()?.start();
|
|
3170
3177
|
});
|
|
3171
3178
|
return sessionInitPromise;
|
|
3172
3179
|
}
|
package/dist/session.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import "./camera-DBSxa6ML.js";
|
|
2
|
+
import "./types-CFV9G_7j.js";
|
|
3
|
+
import { a as RegulationTypes } from "./types-BP1m8VRw.js";
|
|
1
4
|
import { n as GetFinishStatusFn, r as getFinishStatus, t as FinishStatus } from "./flowCompletionService-DhkT4SRY.js";
|
|
2
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
|
|
3
15
|
//#region src/internal/session/sessionService.d.ts
|
|
4
16
|
type CreateSessionOptions = {
|
|
5
17
|
/** The configuration/flow ID from the Incode dashboard */
|
|
@@ -137,4 +149,69 @@ declare function refreshQrUrlUuid(options: RefreshQrUrlUuidOptions, signal?: Abo
|
|
|
137
149
|
*/
|
|
138
150
|
declare function bootstrapSession(apiKey: string, options: BootstrapSessionOptions, signal?: AbortSignal): Promise<Session>;
|
|
139
151
|
//#endregion
|
|
140
|
-
|
|
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 };
|
package/dist/session.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./api-CESGtpbH.esm.js";
|
|
2
2
|
import "./events-D6-e4vok.esm.js";
|
|
3
3
|
import "./endpoints-CnN3SyDa.esm.js";
|
|
4
|
-
import { c as QrValidationError, d as refreshQrUrlUuid, f as validateQrUuid, l as bootstrapSession, s as QR_VALIDATION_ERROR_CODES, u as createSession } from "./session-
|
|
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-DwRz_09p.esm.js";
|
|
5
5
|
import "./IpifyProvider-D7jx52AL.esm.js";
|
|
6
6
|
import "./browserSimulation-gxD8cSpM.esm.js";
|
|
7
7
|
import { t as getFinishStatus } from "./flowCompletionService-P54yzGvA.esm.js";
|
|
8
8
|
|
|
9
|
-
export { QR_VALIDATION_ERROR_CODES, QrValidationError, bootstrapSession, createSession, getFinishStatus, refreshQrUrlUuid, validateQrUuid };
|
|
9
|
+
export { QR_VALIDATION_ERROR_CODES, QrValidationError, bootstrapSession, createSession, getFinishStatus, initializeSession, refreshQrUrlUuid, validateQrUuid };
|
|
@@ -57,7 +57,16 @@ type EncryptionOptions = {
|
|
|
57
57
|
type SetupOptions = {
|
|
58
58
|
/** The base URL for the API. When omitted, no HTTP client is created — useful when all API actors are overridden via .provide(). */
|
|
59
59
|
apiURL?: string;
|
|
60
|
-
/**
|
|
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
|
+
*/
|
|
61
70
|
token?: string;
|
|
62
71
|
/** Custom headers to include in all requests */
|
|
63
72
|
customHeaders?: Record<string, string>;
|
|
@@ -120,43 +129,63 @@ type SetupOptions = {
|
|
|
120
129
|
*
|
|
121
130
|
* WASM loads only when `options.wasm` is provided as an object.
|
|
122
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
|
+
*
|
|
123
138
|
* @param options - Configuration options for the SDK
|
|
124
139
|
*
|
|
125
|
-
* @example
|
|
140
|
+
* @example Boot first, activate the session later (preferred)
|
|
126
141
|
* ```ts
|
|
127
142
|
* import { setup } from '@incodetech/core';
|
|
143
|
+
* import { createSession, initializeSession } from '@incodetech/core/session';
|
|
128
144
|
*
|
|
129
|
-
*
|
|
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
|
|
130
152
|
* await setup({ apiURL: 'https://api.incode.com', token: 'session-token' });
|
|
153
|
+
* ```
|
|
131
154
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
155
|
+
* @example Explicitly disable WASM
|
|
156
|
+
* ```ts
|
|
157
|
+
* await setup({ apiURL: 'https://api.incode.com', wasm: false });
|
|
158
|
+
* ```
|
|
134
159
|
*
|
|
135
|
-
*
|
|
160
|
+
* @example Use CDN defaults for paths and preload only one pipeline
|
|
161
|
+
* ```ts
|
|
136
162
|
* await setup({
|
|
137
163
|
* apiURL: 'https://api.incode.com',
|
|
138
|
-
* token: 'session-token',
|
|
139
164
|
* wasm: { pipelines: ['selfie'] },
|
|
140
165
|
* });
|
|
166
|
+
* ```
|
|
141
167
|
*
|
|
142
|
-
*
|
|
168
|
+
* @example Self-hosted / custom version (full or partial path overrides)
|
|
169
|
+
* ```ts
|
|
143
170
|
* await setup({
|
|
144
171
|
* apiURL: 'https://api.incode.com',
|
|
145
|
-
* token: 'session-token',
|
|
146
172
|
* wasm: {
|
|
147
173
|
* wasmPath: '/my-cdn/webLib.wasm',
|
|
148
174
|
* glueCodePath: '/my-cdn/webLib.js',
|
|
149
175
|
* },
|
|
150
176
|
* });
|
|
177
|
+
* ```
|
|
151
178
|
*
|
|
152
|
-
*
|
|
179
|
+
* @example Partial override: only models path, rest from CDN
|
|
180
|
+
* ```ts
|
|
153
181
|
* await setup({
|
|
154
182
|
* apiURL: 'https://api.incode.com',
|
|
155
|
-
* token: 'session-token',
|
|
156
183
|
* wasm: { modelsBasePath: 'https://my-cdn/models' },
|
|
157
184
|
* });
|
|
185
|
+
* ```
|
|
158
186
|
*
|
|
159
|
-
*
|
|
187
|
+
* @example Sessionless setup (all API actors overridden via .provide())
|
|
188
|
+
* ```ts
|
|
160
189
|
* await setup({
|
|
161
190
|
* wasm: {
|
|
162
191
|
* wasmPath: '/wasm/ml-wasm.wasm',
|
|
@@ -164,15 +193,20 @@ type SetupOptions = {
|
|
|
164
193
|
* pipelines: ['selfie'],
|
|
165
194
|
* },
|
|
166
195
|
* });
|
|
196
|
+
* ```
|
|
167
197
|
*
|
|
168
|
-
*
|
|
198
|
+
* @example Enable end-to-end encryption at boot (defaults to MGF1 = SHA-1)
|
|
199
|
+
* ```ts
|
|
169
200
|
* await setup({ apiURL: 'https://api.incode.com', encryption: true });
|
|
201
|
+
* ```
|
|
170
202
|
*
|
|
171
|
-
*
|
|
203
|
+
* @example Enable encryption with the SHA-256 MGF1 padding
|
|
204
|
+
* ```ts
|
|
172
205
|
* await setup({
|
|
173
206
|
* apiURL: 'https://api.incode.com',
|
|
174
207
|
* encryption: { mgf1: 'sha256' },
|
|
175
208
|
* });
|
|
209
|
+
* ```
|
|
176
210
|
*/
|
|
177
211
|
declare function setup(options: SetupOptions): Promise<void>;
|
|
178
212
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as executeWasmRequest, c as setupWasmConnection, i as WasmWebClientError, n as warmupWasm, o as initializeWasmWebClient, s as setWebApiHttpTransport } from "./BaseWasmProvider-C_DLEI40.esm.js";
|
|
2
2
|
import { t as WasmUtilProvider } from "./WasmUtilProvider-j98OJf-S.esm.js";
|
|
3
3
|
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-DhNc_x02.esm.js";
|
|
4
|
-
import { a as resetApi, i as isApiConfigured, n as getApi, o as setClient, r as getToken,
|
|
4
|
+
import { a as resetApi, i as isApiConfigured, n as getApi, o as setClient, r as getToken, t as api } from "./api-CESGtpbH.esm.js";
|
|
5
5
|
import { _ as resetAnalyticsBatcher, g as getAnalyticsBatcher, m as createAnalyticsBatchingService, v as setAnalyticsBatcher } from "./events-D6-e4vok.esm.js";
|
|
6
6
|
import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
|
|
7
|
-
import { i as resetSessionInit, r as initializeSession } from "./session-
|
|
7
|
+
import { i as resetSessionInit, r as initializeSession } from "./session-DwRz_09p.esm.js";
|
|
8
8
|
|
|
9
9
|
//#region ../infra/src/wasm/wasmDefaults.ts
|
|
10
10
|
const WASM_CDN_BASE_URL = "https://cdn.incodesmile.com/ml-wasm-kit-release";
|
|
@@ -702,43 +702,63 @@ let configured = false;
|
|
|
702
702
|
*
|
|
703
703
|
* WASM loads only when `options.wasm` is provided as an object.
|
|
704
704
|
*
|
|
705
|
+
* `setup` is boot — it provisions the HTTP client, the optional E2EE
|
|
706
|
+
* handshake, WASM warmup, and the analytics batcher. The session token is a
|
|
707
|
+
* separate concern: hand it off via `initializeSession({ token })` from
|
|
708
|
+
* `@incodetech/core/session`, or pass it inline as `setup({ apiURL, token })`
|
|
709
|
+
* (a convenience that delegates to `initializeSession` for you).
|
|
710
|
+
*
|
|
705
711
|
* @param options - Configuration options for the SDK
|
|
706
712
|
*
|
|
707
|
-
* @example
|
|
713
|
+
* @example Boot first, activate the session later (preferred)
|
|
708
714
|
* ```ts
|
|
709
715
|
* import { setup } from '@incodetech/core';
|
|
716
|
+
* import { createSession, initializeSession } from '@incodetech/core/session';
|
|
717
|
+
*
|
|
718
|
+
* await setup({ apiURL: 'https://api.incode.com' });
|
|
719
|
+
* const session = await createSession(apiKey, { configurationId });
|
|
720
|
+
* await initializeSession({ token: session.token });
|
|
721
|
+
* ```
|
|
710
722
|
*
|
|
711
|
-
*
|
|
723
|
+
* @example One-shot convenience
|
|
724
|
+
* ```ts
|
|
712
725
|
* await setup({ apiURL: 'https://api.incode.com', token: 'session-token' });
|
|
726
|
+
* ```
|
|
713
727
|
*
|
|
714
|
-
*
|
|
715
|
-
*
|
|
728
|
+
* @example Explicitly disable WASM
|
|
729
|
+
* ```ts
|
|
730
|
+
* await setup({ apiURL: 'https://api.incode.com', wasm: false });
|
|
731
|
+
* ```
|
|
716
732
|
*
|
|
717
|
-
*
|
|
733
|
+
* @example Use CDN defaults for paths and preload only one pipeline
|
|
734
|
+
* ```ts
|
|
718
735
|
* await setup({
|
|
719
736
|
* apiURL: 'https://api.incode.com',
|
|
720
|
-
* token: 'session-token',
|
|
721
737
|
* wasm: { pipelines: ['selfie'] },
|
|
722
738
|
* });
|
|
739
|
+
* ```
|
|
723
740
|
*
|
|
724
|
-
*
|
|
741
|
+
* @example Self-hosted / custom version (full or partial path overrides)
|
|
742
|
+
* ```ts
|
|
725
743
|
* await setup({
|
|
726
744
|
* apiURL: 'https://api.incode.com',
|
|
727
|
-
* token: 'session-token',
|
|
728
745
|
* wasm: {
|
|
729
746
|
* wasmPath: '/my-cdn/webLib.wasm',
|
|
730
747
|
* glueCodePath: '/my-cdn/webLib.js',
|
|
731
748
|
* },
|
|
732
749
|
* });
|
|
750
|
+
* ```
|
|
733
751
|
*
|
|
734
|
-
*
|
|
752
|
+
* @example Partial override: only models path, rest from CDN
|
|
753
|
+
* ```ts
|
|
735
754
|
* await setup({
|
|
736
755
|
* apiURL: 'https://api.incode.com',
|
|
737
|
-
* token: 'session-token',
|
|
738
756
|
* wasm: { modelsBasePath: 'https://my-cdn/models' },
|
|
739
757
|
* });
|
|
758
|
+
* ```
|
|
740
759
|
*
|
|
741
|
-
*
|
|
760
|
+
* @example Sessionless setup (all API actors overridden via .provide())
|
|
761
|
+
* ```ts
|
|
742
762
|
* await setup({
|
|
743
763
|
* wasm: {
|
|
744
764
|
* wasmPath: '/wasm/ml-wasm.wasm',
|
|
@@ -746,18 +766,23 @@ let configured = false;
|
|
|
746
766
|
* pipelines: ['selfie'],
|
|
747
767
|
* },
|
|
748
768
|
* });
|
|
769
|
+
* ```
|
|
749
770
|
*
|
|
750
|
-
*
|
|
771
|
+
* @example Enable end-to-end encryption at boot (defaults to MGF1 = SHA-1)
|
|
772
|
+
* ```ts
|
|
751
773
|
* await setup({ apiURL: 'https://api.incode.com', encryption: true });
|
|
774
|
+
* ```
|
|
752
775
|
*
|
|
753
|
-
*
|
|
776
|
+
* @example Enable encryption with the SHA-256 MGF1 padding
|
|
777
|
+
* ```ts
|
|
754
778
|
* await setup({
|
|
755
779
|
* apiURL: 'https://api.incode.com',
|
|
756
780
|
* encryption: { mgf1: 'sha256' },
|
|
757
781
|
* });
|
|
782
|
+
* ```
|
|
758
783
|
*/
|
|
759
784
|
async function setup(options) {
|
|
760
|
-
|
|
785
|
+
if (!getAnalyticsBatcher()) setAnalyticsBatcher(createAnalyticsBatchingService({
|
|
761
786
|
endpoint: endpoints.events,
|
|
762
787
|
authToken: () => getToken(),
|
|
763
788
|
apiBaseUrl: () => getApi().defaults.baseURL,
|
|
@@ -777,15 +802,12 @@ async function setup(options) {
|
|
|
777
802
|
};
|
|
778
803
|
const effectiveWasm = options.wasm || requestedEncryption?.enabled ? resolveWasmConfig(options.wasm || {}) : void 0;
|
|
779
804
|
if (options.apiURL) await installFreshHttpClient(options.apiURL, options, effectiveWasm, effectiveEncryption);
|
|
780
|
-
if (options.token && isApiConfigured()) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
batcher.start();
|
|
787
|
-
});
|
|
788
|
-
}
|
|
805
|
+
if (options.token && isApiConfigured()) initializeSession({
|
|
806
|
+
token: options.token,
|
|
807
|
+
hostingApp: options.hostingApp
|
|
808
|
+
}).catch((error) => {
|
|
809
|
+
console.warn("Session initialization failed:", error);
|
|
810
|
+
});
|
|
789
811
|
configured = true;
|
|
790
812
|
if (effectiveWasm) {
|
|
791
813
|
await warmupWasm(effectiveWasm);
|
package/dist/wasm.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as WasmPipeline, r as warmupWasm, t as WarmupConfig } from "./warmup-CEcppFiS.js";
|
|
2
|
-
import { c as upgradeToWasmHttpClient, n as WasmConfig, o as setWasmConfig, r as initializeWasmUtil } from "./setup-
|
|
2
|
+
import { c as upgradeToWasmHttpClient, n as WasmConfig, o as setWasmConfig, r as initializeWasmUtil } from "./setup-C5AITV8m.js";
|
|
3
3
|
|
|
4
4
|
//#region ../infra/src/wasm/wasmDefaults.d.ts
|
|
5
5
|
/** The WASM version bundled and tested with this SDK release. */
|
package/dist/wasm.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as buildDefaultWasmConfig, i as setWasmConfig, l as resolveWasmConfig, o as upgradeToWasmHttpClient, s as DEFAULT_WASM_VERSION, t as initializeWasmUtil } from "./setup-
|
|
1
|
+
import { c as buildDefaultWasmConfig, i as setWasmConfig, l as resolveWasmConfig, o as upgradeToWasmHttpClient, s as DEFAULT_WASM_VERSION, t as initializeWasmUtil } from "./setup-Ewnwm56p.esm.js";
|
|
2
2
|
import { n as warmupWasm } from "./BaseWasmProvider-C_DLEI40.esm.js";
|
|
3
3
|
import "./WasmUtilProvider-j98OJf-S.esm.js";
|
|
4
4
|
import "./BrowserTimerProvider-DhNc_x02.esm.js";
|
|
5
5
|
import "./api-CESGtpbH.esm.js";
|
|
6
6
|
import "./events-D6-e4vok.esm.js";
|
|
7
7
|
import "./endpoints-CnN3SyDa.esm.js";
|
|
8
|
-
import "./session-
|
|
8
|
+
import "./session-DwRz_09p.esm.js";
|
|
9
9
|
import "./IpifyProvider-D7jx52AL.esm.js";
|
|
10
10
|
import "./browserSimulation-gxD8cSpM.esm.js";
|
|
11
11
|
|