@incodetech/core 0.0.0-dev-20260716-2b4f5edb → 0.0.0-dev-20260717-87fac45b

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 (53) hide show
  1. package/dist/BrowserLazyImportProvider-BhoA957O.esm.js +114 -0
  2. package/dist/IFeatureManagementCapability-ErPJywQ_.d.ts +1121 -0
  3. package/dist/authentication.esm.js +2 -2
  4. package/dist/{authenticationManager-BVMQTy2C.esm.js → authenticationManager-DK8fsUqL.esm.js} +2 -2
  5. package/dist/{authenticationStateMachine-DvFeGMIc.esm.js → authenticationStateMachine-BlT8fkR6.esm.js} +2 -2
  6. package/dist/consent.d.ts +1 -1
  7. package/dist/{consentManager-2h_w6wFc.d.ts → consentManager-CsyToF8t.d.ts} +5 -5
  8. package/dist/{deepsightLoader-BGu6zfoZ.esm.js → deepsightLoader-C7HOhX6C.esm.js} +1 -1
  9. package/dist/document-capture.d.ts +1 -1
  10. package/dist/document-upload.d.ts +4 -4
  11. package/dist/{documentCaptureManager-Biz_PFqs.d.ts → documentCaptureManager-DBqK5ner.d.ts} +65 -65
  12. package/dist/ekyb.esm.js +2 -2
  13. package/dist/{ekybManager--3WIEWS5.esm.js → ekybManager-BMjf8ZNw.esm.js} +1 -1
  14. package/dist/{ekybStateMachine-B870YzwX.esm.js → ekybStateMachine-DfpEPLzD.esm.js} +1 -1
  15. package/dist/extensibility.d.ts +4 -4
  16. package/dist/extensibility.esm.js +6 -6
  17. package/dist/{faceCaptureManagerFactory-CDpqsxiU.esm.js → faceCaptureManagerFactory-BFv1KlL_.esm.js} +1 -1
  18. package/dist/{faceCaptureSetup-BXueiZo8.esm.js → faceCaptureSetup-Bxo1VNVw.esm.js} +2 -2
  19. package/dist/feature-management-Dw96qEMs.esm.js +468 -0
  20. package/dist/feature-management.d.ts +80 -0
  21. package/dist/feature-management.esm.js +2 -0
  22. package/dist/flow.esm.js +1 -1
  23. package/dist/{flowServices-DL7qnTQR.esm.js → flowServices-ymcivfU0.esm.js} +5 -3
  24. package/dist/id.esm.js +2 -2
  25. package/dist/{idCaptureManager-BoLeZff7.esm.js → idCaptureManager-BBfWW9Y0.esm.js} +1 -1
  26. package/dist/{idCaptureStateMachine-D2H3vwwf.esm.js → idCaptureStateMachine-_1pROAbA.esm.js} +5 -5
  27. package/dist/identity-reuse.d.ts +1 -1
  28. package/dist/{identityReuseManager-aTyLyYrr.d.ts → identityReuseManager-D6pD4hcZ.d.ts} +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.esm.js +1 -1
  31. package/dist/mandatory-consent.d.ts +1 -1
  32. package/dist/{mandatoryConsentManager-B2gRcE_x.d.ts → mandatoryConsentManager-BR8SLvd1.d.ts} +5 -5
  33. package/dist/{onDeviceFaceResults-4ODIm8fO.esm.js → onDeviceFaceResults-B3oTx-NK.esm.js} +1 -1
  34. package/dist/personhood.esm.js +2 -2
  35. package/dist/{recordingService-CkLJ00Pw.esm.js → recordingService-Comyo6yK.esm.js} +1 -1
  36. package/dist/selfie.esm.js +4 -4
  37. package/dist/{selfieManager-C_ynxeGZ.esm.js → selfieManager-CCR6VpoQ.esm.js} +2 -2
  38. package/dist/{selfieStateMachine-CFqYKJFF.esm.js → selfieStateMachine-D30gwMGq.esm.js} +2 -2
  39. package/dist/session-B9KT6qnE.esm.js +1 -0
  40. package/dist/session.esm.js +2 -2
  41. package/dist/{sessionInitializer-B6n-FYf7.esm.js → sessionInitializer-CrzyJ4Y0.esm.js} +4 -2
  42. package/dist/{setup-CgBvqGWw.d.ts → setup-BBfVpTog.d.ts} +115 -0
  43. package/dist/{setup-CeQfb7bE.esm.js → setup-CBijDJ0d.esm.js} +20 -2
  44. package/dist/src-0Jurt29N.esm.js +4482 -0
  45. package/dist/{tri-N-xlKhZK.esm.js → tri-4RsGrIt6.esm.js} +1 -113
  46. package/dist/tri.esm.js +1 -1
  47. package/dist/video-selfie.esm.js +2 -2
  48. package/dist/wasm.d.ts +1 -1
  49. package/dist/wasm.esm.js +1 -1
  50. package/dist/workflow.d.ts +4 -4
  51. package/dist/workflow.esm.js +7 -5
  52. package/package.json +8 -3
  53. package/dist/session-CThOl8m5.esm.js +0 -1
@@ -0,0 +1,468 @@
1
+ import { a as __toESM } from "./rolldown-runtime-FZ4Itg2g.esm.js";
2
+ import { t as BrowserLazyImportProvider } from "./BrowserLazyImportProvider-BhoA957O.esm.js";
3
+ let currentEnvironment;
4
+ /** Effective tier: the explicitly-set value, else the default (see note above). */
5
+ function getEnvironment() {
6
+ return currentEnvironment ?? "production";
7
+ }
8
+ /** Clears the stored tier. Called by the SDK's `reset()`. */
9
+ function resetEnvironment() {
10
+ currentEnvironment = void 0;
11
+ }
12
+ /**
13
+ * Applies a requested tier from a `setup()` call and reports the transition:
14
+ * - `'unchanged'` — omitted, same value as already stored, or first-set to
15
+ * the default.
16
+ * - `'changed'` — first-set (was defaulting) to a non-default value.
17
+ * Informational only: no consumer reconstructs on this today. Feature
18
+ * management reads the tier once at its own first initialization and never
19
+ * rebuilds, regardless of this status.
20
+ * - `'rejected'` — already locked to a different value; logs a
21
+ * `console.error` and keeps the locked value.
22
+ */
23
+ function applyEnvironment(next) {
24
+ if (next === void 0) return "unchanged";
25
+ if (currentEnvironment === void 0) {
26
+ currentEnvironment = next;
27
+ return next === "production" ? "unchanged" : "changed";
28
+ }
29
+ if (next === currentEnvironment) return "unchanged";
30
+ console.error(`[environment] \`environment\` cannot be changed after the initial setup() call. Keeping '${currentEnvironment}'; ignoring '${next}'. Call reset() to change it.`);
31
+ return "rejected";
32
+ }
33
+ //#endregion
34
+ //#region ../infra/src/providers/browser/FeatureManagementProvider.ts
35
+ /**
36
+ * A client SDK key is safe to ship in a public bundle — it only grants
37
+ * read-only evaluation, no console/admin access.
38
+ *
39
+ * Note: Proper improvement would be if backend creates specialized
40
+ * endpoint for returning these type of information, so we could have full decoupling.
41
+ */
42
+ const CLIENT_SDK_KEY = "client-GBTzsiJ99rvyZQdNXDFkftx3ZoMF1TED2rsB3m3IUqc";
43
+ const LOAD_TIMEOUT_MS = 1e4;
44
+ const FEATURE_MANAGEMENT_REQUEST_TIMEOUT_MS = 3e3;
45
+ const LAZY_IMPORT_OPTIONS = {
46
+ label: "FeatureManagement",
47
+ moduleName: "@statsig/js-client",
48
+ timeoutMs: LOAD_TIMEOUT_MS,
49
+ disabledMessage: "Feature gates/experiments/layers will be disabled for this session."
50
+ };
51
+ /**
52
+ * Resolved default for {@link FeatureManagementConfig.redactedUserInfo}:
53
+ * `ip` and `country` are redacted unless a caller explicitly opts out.
54
+ */
55
+ const DEFAULT_REDACTED_USER_INFO = {
56
+ ip: true,
57
+ country: true
58
+ };
59
+ const fallbackTypedGetter = (_paramName, fallback) => fallback;
60
+ function createFallback(status) {
61
+ return Object.freeze({
62
+ get: fallbackTypedGetter,
63
+ groupName: null,
64
+ status
65
+ });
66
+ }
67
+ /**
68
+ * Concrete {@link IFeatureManagementCapability} backed by Statsig
69
+ * (`@statsig/js-client`), lazy-loaded on first `initialize()` call so
70
+ * consumers that never read a gate/experiment/layer never pay its bundle cost.
71
+ *
72
+ * No `apiKey` is ever passed to Statsig — identity is built up purely from
73
+ * randomization-unit `customIDs` supplied at `initialize()`/`updateUser()`
74
+ * time, plus the client SDK's own auto-generated StableID.
75
+ *
76
+ * Mirrors {@link TransactionalRiskIntelligenceProvider}: every public method
77
+ * is graceful — a load failure, timeout, or evaluation error never throws
78
+ * and never rejects. Reads fall back to their documented defaults and
79
+ * mutating calls become no-ops.
80
+ */
81
+ var FeatureManagementProvider = class FeatureManagementProvider {
82
+ constructor() {
83
+ this._user = {};
84
+ this._redactedUserInfo = { ...DEFAULT_REDACTED_USER_INFO };
85
+ this._lazySdk = BrowserLazyImportProvider.getInstance().create(importStatsigJsClient, LAZY_IMPORT_OPTIONS);
86
+ }
87
+ static getInstance() {
88
+ return this._instance ??= new FeatureManagementProvider();
89
+ }
90
+ static resetInstance() {
91
+ this._instance = void 0;
92
+ }
93
+ get initialized() {
94
+ return this._client !== void 0;
95
+ }
96
+ async initialize(config) {
97
+ try {
98
+ const module = await this._lazySdk.load();
99
+ if (!module) return;
100
+ this._redactedUserInfo = {
101
+ ...DEFAULT_REDACTED_USER_INFO,
102
+ ...config.redactedUserInfo
103
+ };
104
+ this._user = this._getAdjustedUser({
105
+ customIDs: config.customIDs,
106
+ custom: config.custom
107
+ });
108
+ const client = new module.StatsigClient(CLIENT_SDK_KEY, this._user, {
109
+ environment: { tier: config.environment },
110
+ disableStableID: config.disableStableId,
111
+ disableStorage: config.disablePersistence
112
+ });
113
+ await client.initializeAsync({ timeoutMs: FEATURE_MANAGEMENT_REQUEST_TIMEOUT_MS });
114
+ this._client = client;
115
+ } catch (error) {
116
+ console.warn("[FeatureManagement] initialize() failed; gates/experiments/layers will be disabled for this session.", error);
117
+ }
118
+ }
119
+ async updateUser(user) {
120
+ if (!this._client) return;
121
+ this._user = this._getAdjustedUser(user);
122
+ try {
123
+ await this._client.updateUserAsync(this._user, { timeoutMs: FEATURE_MANAGEMENT_REQUEST_TIMEOUT_MS });
124
+ } catch (error) {
125
+ console.warn("[FeatureManagement] updateUser() failed.", error);
126
+ }
127
+ }
128
+ getFeatureGate(name) {
129
+ if (!this._client) return {
130
+ enabled: false,
131
+ status: "uninitialized"
132
+ };
133
+ try {
134
+ return {
135
+ enabled: this._client.checkGate(name),
136
+ status: "initialized"
137
+ };
138
+ } catch {
139
+ return {
140
+ enabled: false,
141
+ status: "error"
142
+ };
143
+ }
144
+ }
145
+ getExperiment(name) {
146
+ if (!this._client) return createFallback("uninitialized");
147
+ try {
148
+ const experiment = this._client.getExperiment(name);
149
+ return {
150
+ get: experiment.get,
151
+ groupName: experiment.groupName,
152
+ status: "initialized"
153
+ };
154
+ } catch {
155
+ return createFallback("error");
156
+ }
157
+ }
158
+ getLayer(name) {
159
+ if (!this._client) return createFallback("uninitialized");
160
+ try {
161
+ const layer = this._client.getLayer(name);
162
+ return {
163
+ get: layer.get,
164
+ groupName: layer.groupName,
165
+ status: "initialized"
166
+ };
167
+ } catch {
168
+ return createFallback("error");
169
+ }
170
+ }
171
+ getParameterStore(name) {
172
+ if (!this._client) return createFallback("uninitialized");
173
+ try {
174
+ return {
175
+ get: this._client.getParameterStore(name).get,
176
+ status: "initialized"
177
+ };
178
+ } catch {
179
+ return createFallback("error");
180
+ }
181
+ }
182
+ getDynamicConfig(name) {
183
+ if (!this._client) return null;
184
+ try {
185
+ return this._client.getDynamicConfig(name).value;
186
+ } catch {
187
+ return null;
188
+ }
189
+ }
190
+ logEvent(name, value, options) {
191
+ if (!this._client) return;
192
+ try {
193
+ const metadata = options?.metadata ? stringifyEventMetadata(options.metadata) : void 0;
194
+ this._client.logEvent(name, value, metadata);
195
+ if (options?.type === "immediate") this._client.flush().catch(() => {});
196
+ } catch {}
197
+ }
198
+ async reset() {
199
+ const client = this._client;
200
+ this._client = void 0;
201
+ this._user = {};
202
+ this._redactedUserInfo = { ...DEFAULT_REDACTED_USER_INFO };
203
+ return client?.shutdown().catch(() => {});
204
+ }
205
+ _getAdjustedUser(user) {
206
+ const persistedUserCustomIDs = this._user.customIDs ?? {};
207
+ const persistedUserCustom = this._user.custom ?? {};
208
+ return {
209
+ customIDs: {
210
+ ...persistedUserCustomIDs,
211
+ ...user.customIDs
212
+ },
213
+ custom: {
214
+ ...persistedUserCustom,
215
+ ...user.custom
216
+ },
217
+ ...this._getRedactedFields()
218
+ };
219
+ }
220
+ /** Blanks out every `StatsigUser` field flagged in {@link _redactedUserInfo}. */
221
+ _getRedactedFields() {
222
+ const fields = {};
223
+ for (const key in this._redactedUserInfo) if (this._redactedUserInfo[key]) fields[key] = "";
224
+ return fields;
225
+ }
226
+ };
227
+ /**
228
+ * Statsig's `logEvent` only accepts string metadata values. Non-string
229
+ * values (booleans, numbers, nested objects) are JSON-stringified so
230
+ * callers can pass richer metadata without needing to know that constraint.
231
+ */
232
+ const stringifyEventMetadata = (metadata) => {
233
+ const stringified = {};
234
+ for (const key in metadata) {
235
+ const value = metadata[key];
236
+ if (typeof value === "string") stringified[key] = value;
237
+ else stringified[key] = JSON.stringify(value);
238
+ }
239
+ return stringified;
240
+ };
241
+ const importStatsigJsClient = () => import("./src-0Jurt29N.esm.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
242
+ //#endregion
243
+ //#region src/integrations/feature-management/featureManagement.ts
244
+ /**
245
+ * Returns the active FeatureManagement capability implementation.
246
+ *
247
+ * Core functions depend on {@link IFeatureManagementCapability} (the
248
+ * interface) rather than the concrete provider class. The provider is
249
+ * referenced here only to supply the default singleton — this integration
250
+ * module is the single owner of the concrete provider reference.
251
+ */
252
+ function getProvider() {
253
+ return FeatureManagementProvider.getInstance();
254
+ }
255
+ let resolveReady;
256
+ const freshReady = () => new Promise((resolve) => {
257
+ resolveReady = resolve;
258
+ });
259
+ let readyPromise = freshReady();
260
+ const assignedExperiments = /* @__PURE__ */ new Set();
261
+ let version = 0;
262
+ const listeners = /* @__PURE__ */ new Set();
263
+ /**
264
+ * Subscribes to changes in the FeatureManagement user identity (readiness
265
+ * settling, `updateFeatureManagementUser`, or `resetFeatureManagement`).
266
+ * Returns an unsubscribe function. Intended for UI to re-read
267
+ * gates/experiments/layers whenever the shared identity changes, no matter
268
+ * which caller triggered the change — see `getFeatureManagementVersion`.
269
+ */
270
+ function subscribeFeatureManagement(listener) {
271
+ listeners.add(listener);
272
+ return () => {
273
+ listeners.delete(listener);
274
+ };
275
+ }
276
+ /**
277
+ * Monotonically increasing revision of the FeatureManagement user identity.
278
+ * Pair with {@link subscribeFeatureManagement} (e.g. via
279
+ * `useSyncExternalStore`) to force a re-read after any identity change.
280
+ * The number itself carries no meaning beyond "has this changed since my
281
+ * last read".
282
+ */
283
+ function getFeatureManagementVersion() {
284
+ return version;
285
+ }
286
+ /**
287
+ * Bumps {@link getFeatureManagementVersion} and notifies every
288
+ * {@link subscribeFeatureManagement} listener. Called after readiness
289
+ * settles, a successful `updateFeatureManagementUser`, and `resetFeatureManagement` —
290
+ * never for no-ops, so listeners aren't notified spuriously (which would
291
+ * cause unnecessary re-reads and, for experiments/layers, re-logged exposures).
292
+ */
293
+ function notifyFeatureManagementChanged() {
294
+ version += 1;
295
+ for (const listener of listeners) listener();
296
+ }
297
+ let isFeatureManagementLocked = false;
298
+ /**
299
+ * Initializes feature management for the current (anonymous) user.
300
+ *
301
+ * Deliberately takes no `apiKey` — identity starts with only the client
302
+ * SDK's auto-generated StableID plus the deployment tier from
303
+ * `options.environment` (defaults to `'production'` when omitted), plus
304
+ * `client_experiment_id` when supplied. Additional randomization units
305
+ * (`hashed_onboarding_id`, `flow_id`, and `workflow_id`) are merged in later via
306
+ * {@link updateFeatureManagementUser} as they become known during the
307
+ * session lifecycle.
308
+ *
309
+ * May be called only once per SDK lifecycle. Every later call logs a
310
+ * `console.error` and is ignored; {@link resetFeatureManagement} starts a new
311
+ * lifecycle.
312
+ *
313
+ * Never throws — a failure here must never block SDK boot.
314
+ */
315
+ async function initializeFeatureManagement(options = {}) {
316
+ if (isFeatureManagementLocked) return;
317
+ isFeatureManagementLocked = true;
318
+ try {
319
+ const initializeOptions = buildInitializeOptions(options);
320
+ await getProvider().initialize(initializeOptions);
321
+ } catch (error) {
322
+ console.warn("Feature management initialization failed:", error);
323
+ } finally {
324
+ settleFeatureManagementReady(getProvider().initialized);
325
+ }
326
+ }
327
+ /**
328
+ * Records the opt-out decision for the current SDK lifecycle: locks feature
329
+ * management (so no later `setup()` call can enable it) and settles
330
+ * readiness to `false`.
331
+ *
332
+ * Like {@link initializeFeatureManagement}, this may only run once per SDK
333
+ * lifecycle — call from `setup()` only when the lock is not already held.
334
+ * {@link resetFeatureManagement} starts a new lifecycle.
335
+ */
336
+ function optOutFeatureManagement() {
337
+ isFeatureManagementLocked = true;
338
+ settleFeatureManagementReady(false);
339
+ }
340
+ /** Settles feature-management readiness for the current SDK lifecycle. */
341
+ function settleFeatureManagementReady(initialized) {
342
+ resolveReady(initialized);
343
+ notifyFeatureManagementChanged();
344
+ }
345
+ /**
346
+ * Resolves once feature-management boot for the current SDK lifecycle has
347
+ * settled.
348
+ */
349
+ function getIsFeatureManagementInitialized() {
350
+ return readyPromise;
351
+ }
352
+ /**
353
+ * Merges additional randomization-unit custom IDs (and, optionally,
354
+ * analytics/targeting-only `custom` attributes) into the active
355
+ * FeatureManagement user and re-evaluates.
356
+ *
357
+ * `flow_id` is populated from the flow response before `getFlow` resolves;
358
+ * `workflow_id` is populated from the workflow configuration before
359
+ * `loadWorkflow` resolves. `custom` lets callers enrich identity with
360
+ * attributes discovered later in the session (e.g. a backend-driven flag)
361
+ * without needing a randomization unit — unlike `customIDs`, `custom`
362
+ * values never bucket experiments, only affect targeting conditions and
363
+ * event annotation.
364
+ *
365
+ * `undefined` values in `customIDs` are dropped before merging — they mean
366
+ * "not yet known", never "clear this ID". No-op when every `customIDs`
367
+ * value is `undefined` and no `custom` is supplied, or when
368
+ * `initializeFeatureManagement` was never called (or failed).
369
+ */
370
+ async function updateFeatureManagementUser(update) {
371
+ const { customIDs = {}, custom } = update;
372
+ let hasAdaptedCustomIDs = false;
373
+ const adaptedCustomIDs = {};
374
+ for (const key in customIDs) if (customIDs[key] !== void 0) {
375
+ adaptedCustomIDs[key] = customIDs[key];
376
+ hasAdaptedCustomIDs = true;
377
+ }
378
+ if (!hasAdaptedCustomIDs && !custom) return;
379
+ await getProvider().updateUser({
380
+ customIDs: adaptedCustomIDs,
381
+ custom
382
+ });
383
+ notifyFeatureManagementChanged();
384
+ }
385
+ /** Evaluates a feature gate. Returns a fallback-only result before initialization. */
386
+ function getFeatureGate(name) {
387
+ return getProvider().getFeatureGate(name);
388
+ }
389
+ /** Evaluates an experiment. Returns a fallback-only result before initialization. */
390
+ function getExperiment(name) {
391
+ return getProvider().getExperiment(name);
392
+ }
393
+ /** Evaluates a layer. Returns a fallback-only result before initialization. Exposure is logged natively per-parameter on `.get()`. */
394
+ function getLayer(name) {
395
+ return getProvider().getLayer(name);
396
+ }
397
+ /** Evaluates a parameter store. Returns a fallback-only result before initialization. Exposure is logged natively for the mapped source on `.get()`. */
398
+ function getFeatureParameterStore(name) {
399
+ return getProvider().getParameterStore(name);
400
+ }
401
+ /** Evaluates a dynamic config. Returns `null` before initialization or if the config is unknown. */
402
+ function getFeatureDynamicConfig(name) {
403
+ return getProvider().getDynamicConfig(name);
404
+ }
405
+ /**
406
+ * Logs a custom analytics event to the FeatureManagement provider. No-op
407
+ * before initialization.
408
+ *
409
+ * `type: 'scheduled'` (default) batches the event with the underlying
410
+ * SDK's normal flush cadence. `type: 'immediate'` logs then flushes right
411
+ * away — use for events that must reach the backend even if the page is
412
+ * about to unload (e.g. a one-time experiment-assignment event).
413
+ */
414
+ function logEvent(name, value, options) {
415
+ getProvider().logEvent(name, value, options);
416
+ }
417
+ /**
418
+ * Emits an experiment-assignment event once per flag key for the current SDK
419
+ * lifecycle. Calls before successful feature-management initialization are
420
+ * ignored.
421
+ */
422
+ function assignExperimentOnce(flagKey, payload, eventName = "experimentAssigned") {
423
+ if (!getProvider().initialized || assignedExperiments.has(flagKey)) return;
424
+ assignedExperiments.add(flagKey);
425
+ logEvent(eventName, void 0, {
426
+ metadata: {
427
+ ...payload,
428
+ flagKey
429
+ },
430
+ type: "immediate"
431
+ });
432
+ }
433
+ /**
434
+ * Tears down the active FeatureManagement client and clears the
435
+ * initialization-attempt flag, so a
436
+ * subsequent `setup()` call starts fresh instead of treating the SDK as
437
+ * already booted. Call from the SDK's `reset()`. Safe no-op when never
438
+ * initialized.
439
+ */
440
+ function resetFeatureManagement() {
441
+ isFeatureManagementLocked = false;
442
+ readyPromise = freshReady();
443
+ assignedExperiments.clear();
444
+ getProvider().reset();
445
+ notifyFeatureManagementChanged();
446
+ }
447
+ /**
448
+ * Discards the cached FeatureManagement provider singleton (including its
449
+ * lazy-import cache) so the next access constructs a fresh instance. Call
450
+ * from the SDK's `reset()` alongside {@link resetFeatureManagement}.
451
+ */
452
+ function resetFeatureManagementProviderInstance() {
453
+ FeatureManagementProvider.resetInstance();
454
+ }
455
+ function getIsFeatureManagementLocked() {
456
+ return isFeatureManagementLocked;
457
+ }
458
+ function buildInitializeOptions(options) {
459
+ const initializeOptions = { environment: options.environment ?? "production" };
460
+ if (options.clientExperimentId) initializeOptions.customIDs = { client_experiment_id: options.clientExperimentId };
461
+ if (options.custom) initializeOptions.custom = options.custom;
462
+ if (options.redactedUserInfo) initializeOptions.redactedUserInfo = options.redactedUserInfo;
463
+ initializeOptions.disableStableId = options.disableStableId ?? true;
464
+ initializeOptions.disablePersistence = options.disablePersistence ?? true;
465
+ return initializeOptions;
466
+ }
467
+ //#endregion
468
+ export { applyEnvironment as _, getFeatureManagementVersion as a, getIsFeatureManagementLocked as c, logEvent as d, optOutFeatureManagement as f, updateFeatureManagementUser as g, subscribeFeatureManagement as h, getFeatureGate as i, getLayer as l, resetFeatureManagementProviderInstance as m, getExperiment as n, getFeatureParameterStore as o, resetFeatureManagement as p, getFeatureDynamicConfig as r, getIsFeatureManagementInitialized as s, assignExperimentOnce as t, initializeFeatureManagement as u, getEnvironment as v, resetEnvironment as y };
@@ -0,0 +1,80 @@
1
+ import { a as FeatureManagementParameterStore, c as FeatureManagementUserUpdate, i as FeatureManagementLayer, n as FeatureManagementExperiment, o as FeatureManagementReadStatus, r as FeatureManagementGate, s as FeatureManagementRedactedUserInfo, t as FeatureManagementEventMetadata } from "./IFeatureManagementCapability-ErPJywQ_.js";
2
+ //#region src/integrations/feature-management/featureManagement.d.ts
3
+ /**
4
+ * Subscribes to changes in the FeatureManagement user identity (readiness
5
+ * settling, `updateFeatureManagementUser`, or `resetFeatureManagement`).
6
+ * Returns an unsubscribe function. Intended for UI to re-read
7
+ * gates/experiments/layers whenever the shared identity changes, no matter
8
+ * which caller triggered the change — see `getFeatureManagementVersion`.
9
+ */
10
+ declare function subscribeFeatureManagement(listener: () => void): () => void;
11
+ /**
12
+ * Monotonically increasing revision of the FeatureManagement user identity.
13
+ * Pair with {@link subscribeFeatureManagement} (e.g. via
14
+ * `useSyncExternalStore`) to force a re-read after any identity change.
15
+ * The number itself carries no meaning beyond "has this changed since my
16
+ * last read".
17
+ */
18
+ declare function getFeatureManagementVersion(): number;
19
+ /**
20
+ * Resolves once feature-management boot for the current SDK lifecycle has
21
+ * settled.
22
+ */
23
+ declare function getIsFeatureManagementInitialized(): Promise<boolean>;
24
+ /**
25
+ * Merges additional randomization-unit custom IDs (and, optionally,
26
+ * analytics/targeting-only `custom` attributes) into the active
27
+ * FeatureManagement user and re-evaluates.
28
+ *
29
+ * `flow_id` is populated from the flow response before `getFlow` resolves;
30
+ * `workflow_id` is populated from the workflow configuration before
31
+ * `loadWorkflow` resolves. `custom` lets callers enrich identity with
32
+ * attributes discovered later in the session (e.g. a backend-driven flag)
33
+ * without needing a randomization unit — unlike `customIDs`, `custom`
34
+ * values never bucket experiments, only affect targeting conditions and
35
+ * event annotation.
36
+ *
37
+ * `undefined` values in `customIDs` are dropped before merging — they mean
38
+ * "not yet known", never "clear this ID". No-op when every `customIDs`
39
+ * value is `undefined` and no `custom` is supplied, or when
40
+ * `initializeFeatureManagement` was never called (or failed).
41
+ */
42
+ declare function updateFeatureManagementUser(update: FeatureManagementUserUpdate): Promise<void>;
43
+ /** Evaluates a feature gate. Returns a fallback-only result before initialization. */
44
+ declare function getFeatureGate(name: string): FeatureManagementGate;
45
+ /** Evaluates an experiment. Returns a fallback-only result before initialization. */
46
+ declare function getExperiment(name: string): FeatureManagementExperiment;
47
+ /** Evaluates a layer. Returns a fallback-only result before initialization. Exposure is logged natively per-parameter on `.get()`. */
48
+ declare function getLayer(name: string): FeatureManagementLayer;
49
+ /** Evaluates a parameter store. Returns a fallback-only result before initialization. Exposure is logged natively for the mapped source on `.get()`. */
50
+ declare function getFeatureParameterStore(name: string): FeatureManagementParameterStore;
51
+ /** Evaluates a dynamic config. Returns `null` before initialization or if the config is unknown. */
52
+ declare function getFeatureDynamicConfig(name: string): Record<string, unknown> | null;
53
+ /**
54
+ * Logs a custom analytics event to the FeatureManagement provider. No-op
55
+ * before initialization.
56
+ *
57
+ * `type: 'scheduled'` (default) batches the event with the underlying
58
+ * SDK's normal flush cadence. `type: 'immediate'` logs then flushes right
59
+ * away — use for events that must reach the backend even if the page is
60
+ * about to unload (e.g. a one-time experiment-assignment event).
61
+ */
62
+ declare function logEvent(name: string, value?: string | number, options?: {
63
+ metadata?: FeatureManagementEventMetadata;
64
+ type?: 'scheduled' | 'immediate';
65
+ }): void;
66
+ type ExperimentAssignmentPayload = {
67
+ experimentId: string;
68
+ experimentName: string;
69
+ module: string;
70
+ variant: string;
71
+ conditions: Record<string, boolean | number | string>;
72
+ };
73
+ /**
74
+ * Emits an experiment-assignment event once per flag key for the current SDK
75
+ * lifecycle. Calls before successful feature-management initialization are
76
+ * ignored.
77
+ */
78
+ declare function assignExperimentOnce(flagKey: string, payload: ExperimentAssignmentPayload, eventName?: string): void;
79
+ //#endregion
80
+ export { type ExperimentAssignmentPayload, type FeatureManagementExperiment, type FeatureManagementGate, type FeatureManagementLayer, type FeatureManagementParameterStore, type FeatureManagementReadStatus, type FeatureManagementRedactedUserInfo, type FeatureManagementUserUpdate, assignExperimentOnce, getExperiment, getFeatureDynamicConfig, getFeatureGate, getFeatureManagementVersion, getFeatureParameterStore, getIsFeatureManagementInitialized, getLayer, logEvent, subscribeFeatureManagement, updateFeatureManagementUser };
@@ -0,0 +1,2 @@
1
+ import { a as getFeatureManagementVersion, d as logEvent, g as updateFeatureManagementUser, h as subscribeFeatureManagement, i as getFeatureGate, l as getLayer, n as getExperiment, o as getFeatureParameterStore, r as getFeatureDynamicConfig, s as getIsFeatureManagementInitialized, t as assignExperimentOnce } from "./feature-management-Dw96qEMs.esm.js";
2
+ export { assignExperimentOnce, getExperiment, getFeatureDynamicConfig, getFeatureGate, getFeatureManagementVersion, getFeatureParameterStore, getIsFeatureManagementInitialized, getLayer, logEvent, subscribeFeatureManagement, updateFeatureManagementUser };
package/dist/flow.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { m as addEvent } from "./events-Dy8PyVO5.esm.js";
2
2
  import { c as createManager, o as createActor, r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
3
3
  import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
4
- import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-DL7qnTQR.esm.js";
4
+ import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-ymcivfU0.esm.js";
5
5
  import { n as getFinishStatus, r as getTotalScoreStatus, t as classifyScoreStatus } from "./flowCompletionService-DQSC7Kso.esm.js";
6
6
  import { n as isAdvanceableError, r as attachFlowEventEmitter, t as runChildModule } from "./runChildModule-Crz1nHwJ.esm.js";
7
7
  //#region src/modules/flow/noOpFlowModuleMachine.ts
@@ -1,8 +1,9 @@
1
+ import { g as updateFeatureManagementUser } from "./feature-management-Dw96qEMs.esm.js";
1
2
  import { t as api } from "./api-BDTZNnca.esm.js";
2
3
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
3
- import { i as initializeSession, r as getSessionFingerprintResult } from "./sessionInitializer-B6n-FYf7.esm.js";
4
+ import { i as initializeSession, r as getSessionFingerprintResult } from "./sessionInitializer-CrzyJ4Y0.esm.js";
4
5
  import { n as toIncodeApiError } from "./apiError-COvIGYWe.esm.js";
5
- import "./session-CThOl8m5.esm.js";
6
+ import "./session-B9KT6qnE.esm.js";
6
7
  import { r as videoSelfieWasmPipelines } from "./videoSelfieSteps-DHcibfYH.esm.js";
7
8
  //#region src/modules/flow/flowUtils.ts
8
9
  const WASM_MODULE_PIPELINES = {
@@ -195,7 +196,8 @@ const getFlow = async (signal, options = {}) => {
195
196
  } catch (error) {
196
197
  toIncodeApiError(endpoints.flow, error);
197
198
  }
198
- if (data.mandatoryConsentCheck !== false) await sessionPromise;
199
+ await sessionPromise;
200
+ await updateFeatureManagementUser({ customIDs: { flow_id: data.flowId } });
199
201
  const flow = prependMandatoryConsent(data);
200
202
  const normalizedModules = normalizeFlowModules(flow, options);
201
203
  return {
package/dist/id.esm.js CHANGED
@@ -2,8 +2,8 @@ import { n as eventModuleNames } from "./events-Dy8PyVO5.esm.js";
2
2
  import { o as createActor, r as assign } from "./xstate.esm-Cf4e0Cfd.esm.js";
3
3
  import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
4
4
  import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.esm.js";
5
- import { a as processId, c as stopStream, d as validateUploadResponse, f as ID_ERROR_CODES, h as MANUAL_UPLOAD_MAX_RETRIES, i as preloadIdRecordingProvider, l as uploadIdImage, m as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, o as startRecordingSession, p as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, r as initializeIdCapture, s as stopRecording, t as idCaptureMachine, u as uploadManualIdFile } from "./idCaptureStateMachine-D2H3vwwf.esm.js";
6
- import { n as createIdCaptureActor, r as createIdCaptureManagerFromActor, t as createIdCaptureManager } from "./idCaptureManager-BoLeZff7.esm.js";
5
+ import { a as processId, c as stopStream, d as validateUploadResponse, f as ID_ERROR_CODES, h as MANUAL_UPLOAD_MAX_RETRIES, i as preloadIdRecordingProvider, l as uploadIdImage, m as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, o as startRecordingSession, p as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, r as initializeIdCapture, s as stopRecording, t as idCaptureMachine, u as uploadManualIdFile } from "./idCaptureStateMachine-_1pROAbA.esm.js";
6
+ import { n as createIdCaptureActor, r as createIdCaptureManagerFromActor, t as createIdCaptureManager } from "./idCaptureManager-BBfWW9Y0.esm.js";
7
7
  import { t as invokeOnCaptureCallback } from "./invokeOnCaptureCallback-B-QfsCQY.esm.js";
8
8
  //#region src/modules/id/idCaptureOnlyStateMachine.ts
9
9
  function buildSubImage(canvas) {
@@ -4,7 +4,7 @@ import { c as createManager, o as createActor } from "./xstate.esm-Cf4e0Cfd.esm.
4
4
  import { n as setWasmDsFlagSync, t as BrowserVisibilityObserverProvider } from "./BrowserVisibilityObserverProvider-sJclps4C.esm.js";
5
5
  import { o as resetWasmMotionPrimedForModule, r as primeMotionFromUserGestureIfNeeded } from "./permissionServices-DwNCUB2I.esm.js";
6
6
  import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.esm.js";
7
- import { n as getManualUploadTabs, t as idCaptureMachine } from "./idCaptureStateMachine-D2H3vwwf.esm.js";
7
+ import { n as getManualUploadTabs, t as idCaptureMachine } from "./idCaptureStateMachine-_1pROAbA.esm.js";
8
8
  //#region src/modules/id/digitalUpload/instrumentation.ts
9
9
  const TERMINAL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
10
10
  function isHoldingState(value) {
@@ -3,20 +3,20 @@ import { r as getToken, t as api } from "./api-BDTZNnca.esm.js";
3
3
  import { x as revokeObjectURL } from "./events-Dy8PyVO5.esm.js";
4
4
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
5
5
  import { t as addDeviceStats } from "./stats-Bu6bL_CX.esm.js";
6
- import { t as getDisableIpify } from "./sessionInitializer-B6n-FYf7.esm.js";
6
+ import { t as getDisableIpify } from "./sessionInitializer-CrzyJ4Y0.esm.js";
7
7
  import { n as isDesktop } from "./platform-wmV7oTAJ.esm.js";
8
8
  import { a as and, n as sendTo, r as assign, s as not, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
9
9
  import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
10
10
  import { n as invokeRequestPermissionActor, t as checkPermission } from "./permissionServices-DwNCUB2I.esm.js";
11
- import { _ as StreamCanvasProcessingSession, h as stopRecording$1, m as startRecording, p as createRecordingSession } from "./onDeviceFaceResults-4ODIm8fO.esm.js";
11
+ import { _ as StreamCanvasProcessingSession, h as stopRecording$1, m as startRecording, p as createRecordingSession } from "./onDeviceFaceResults-B3oTx-NK.esm.js";
12
12
  import { t as IncodeCanvas } from "./canvas-E1zGkel4.esm.js";
13
13
  import { n as getBackCameraStream } from "./backCameraStream-Heg6vA1j.esm.js";
14
14
  import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
15
15
  import { t as getDeviceClass } from "./getDeviceClass-CkgnSJel.esm.js";
16
16
  import { t as StreamCanvasCapture } from "./StreamCanvasCapture-D2XcXCZ4.esm.js";
17
17
  import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-DguX5vFY.esm.js";
18
- import { i as flagIdManualReview, n as preloadOpenViduProvider } from "./recordingService-CkLJ00Pw.esm.js";
19
- import "./session-CThOl8m5.esm.js";
18
+ import { i as flagIdManualReview, n as preloadOpenViduProvider } from "./recordingService-Comyo6yK.esm.js";
19
+ import "./session-B9KT6qnE.esm.js";
20
20
  import { n as DEFAULT_ID_CAPTURE_THRESHOLDS$1, r as IdCaptureProvider } from "./idCaptureDefaults-Dzfws4i0.esm.js";
21
21
  //#region src/modules/id/digitalUpload/digitalUploadErrors.ts
22
22
  const TERMINAL_FAIL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
@@ -1548,7 +1548,7 @@ const startRecordingActor = fromPromise(async ({ input }) => {
1548
1548
  });
1549
1549
  const initializeDeepsightSessionActor = fromPromise(async ({ input }) => {
1550
1550
  if (!input.dependencies) return;
1551
- const { loadDeepsightSession } = await import("./deepsightLoader-BGu6zfoZ.esm.js");
1551
+ const { loadDeepsightSession } = await import("./deepsightLoader-C7HOhX6C.esm.js");
1552
1552
  return loadDeepsightSession({
1553
1553
  ds: input.ds,
1554
1554
  storage: input.dependencies.storage,
@@ -1,2 +1,2 @@
1
- import { c as identityReuseMachine, d as ReusableDocument, f as SubmitResponse, i as createIdentityReuseManagerFromActor, l as FetchDocumentsResponse, n as IdentityReuseState, o as SCAN_NEW_DOCUMENT, r as createIdentityReuseManager, s as SelectedDocumentId, t as IdentityReuseManager, u as IdentityReuseConfig } from "./identityReuseManager-aTyLyYrr.js";
1
+ import { c as identityReuseMachine, d as ReusableDocument, f as SubmitResponse, i as createIdentityReuseManagerFromActor, l as FetchDocumentsResponse, n as IdentityReuseState, o as SCAN_NEW_DOCUMENT, r as createIdentityReuseManager, s as SelectedDocumentId, t as IdentityReuseManager, u as IdentityReuseConfig } from "./identityReuseManager-D6pD4hcZ.js";
2
2
  export { type FetchDocumentsResponse, type IdentityReuseConfig, type IdentityReuseManager, type IdentityReuseState, type ReusableDocument, SCAN_NEW_DOCUMENT, type SelectedDocumentId, type SubmitResponse, createIdentityReuseManager, createIdentityReuseManagerFromActor, identityReuseMachine };
@@ -125,7 +125,7 @@ declare const identityReuseMachine: StateMachine<IdentityReuseContext, {
125
125
  type: "hasSelection";
126
126
  params: unknown;
127
127
  };
128
- }>, never, "error" | "idle" | "finished" | "loading" | "documentsFound" | "submitting", string, IdentityReuseInput, NonReducibleUnknown, EventObject, MetaObject, {
128
+ }>, never, "error" | "idle" | "finished" | "loading" | "submitting" | "documentsFound", string, IdentityReuseInput, NonReducibleUnknown, EventObject, MetaObject, {
129
129
  readonly id: "identityReuse";
130
130
  readonly initial: "idle";
131
131
  readonly context: ({ input }: {
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as isConfigured, c as setup, o as reset, t as SetupOptions } from "./setup-CgBvqGWw.js";
1
+ import { a as isConfigured, c as setup, o as reset, t as SetupOptions } from "./setup-BBfVpTog.js";
2
2
  export { type SetupOptions, isConfigured, reset, setup };
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as reset, o as setup, r as isConfigured } from "./setup-CeQfb7bE.esm.js";
1
+ import { i as reset, o as setup, r as isConfigured } from "./setup-CBijDJ0d.esm.js";
2
2
  export { isConfigured, reset, setup };