@incodetech/web 0.0.0-dev-20260817-941e76d2 → 0.0.0-dev-20260817-ec13a90c

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.
@@ -1,145 +1,16 @@
1
1
  import { DeepPartial } from '@incodetech/core/flow';
2
2
  import { FC } from 'preact/compat';
3
- import { FunctionComponent } from 'preact';
4
- import { SVGProps } from 'preact/compat';
5
3
  import { VideoSelfieConfig } from '@incodetech/core/video-selfie';
6
4
 
7
- /**
8
- * Allowlisted keys for overridable Lottie animations
9
- */
10
- declare type AnimationKey = 'id.tutorial.front' | 'id.tutorial.back' | 'id.tutorial.passport' | 'id.flip' | 'id.processing' | 'selfie.tutorial' | 'loader.spinner';
11
-
12
- /**
13
- * A customer-supplied replacement for a built-in Lottie animation.
14
- *
15
- * - `LottieAnimationData` — a parsed Lottie JSON object.
16
- * - `{ url }` — fetched and cached at runtime.
17
- * - `{ animationData }` — explicit object form.
18
- */
19
- declare type AnimationOverride = LottieAnimationData | {
20
- url: string;
21
- } | {
22
- animationData: LottieAnimationData;
23
- };
24
-
25
- declare type AnimationOverrides = Partial<Record<AnimationKey, AnimationOverride>>;
26
-
27
- /**
28
- * Allowlisted keys for overridable branded SVG illustrations
29
- */
30
- declare type AssetKey = 'faceMatch.success' | 'faceMatch.fail' | 'documentCapture.tutorial' | 'id.uploadScreen' | 'id.ageVerification.dob' | 'id.ageVerification.scan' | 'id.ageVerification.privacy' | 'videoSelfie.success' | 'videoSelfie.fail' | 'videoSelfie.tutorial.permission' | 'videoSelfie.tutorial.selfie' | 'videoSelfie.tutorial.frontId' | 'videoSelfie.tutorial.backId' | 'videoSelfie.tutorial.poa' | 'videoSelfie.tutorial.questions' | 'videoSelfie.tutorial.speech' | 'loader.spinner';
31
-
32
- /**
33
- * A customer-supplied replacement for a built-in SVG illustration.
34
- *
35
- * - `string` — a URL, or raw `<svg …>` markup (detected by a leading `<`).
36
- * - `{ url }` — fetched and rendered via `<img>`; no script execution.
37
- * - `{ raw }` — inline markup; sanitized before injection.
38
- * - `{ svg }` — a precompiled component, for build-time integrations.
39
- */
40
- declare type AssetOverride = string | {
41
- url: string;
42
- } | {
43
- raw: string;
44
- } | {
45
- svg: SvgComponent;
46
- };
47
-
48
- declare type AssetOverrides = Partial<Record<AssetKey, AssetOverride>>;
49
-
50
- /**
51
- * A module `config` intersected with the per-instance override maps. Typed at
52
- * the UI boundary so core config types (e.g. `IdCaptureConfig`) stay untouched;
53
- * `FlowConfig` also declares the maps directly.
54
- */
55
- declare type ConfigWithOverrides<TConfig> = TConfig & InstanceOverrides;
56
-
57
- /**
58
- * Extra context passed to `onFinish` alongside the result. Lets a host decide
59
- * how to react to the terminal state without inspecting the DOM. Only the
60
- * workflow module sets these fields today.
61
- */
62
- declare type IncodeFinishMeta = {
63
- /**
64
- * True when the SDK owns the terminal screen — it has already rendered its
65
- * own finish UI (today, the workflow's `showFinishScreenBySessionStatus`
66
- * screen), so the host should not render its own completion screen on top.
67
- * `onFinish` still fires so the host can run side effects (e.g. notify an
68
- * OAuth parent).
69
- *
70
- * Advisory only: the SDK cannot stop a host from rendering. This works solely
71
- * because the host reads this flag — a host that ignores it will still
72
- * replace the SDK screen. Not a guarantee.
73
- */
74
- sdkOwnsTerminalScreen?: boolean;
75
- };
76
-
77
- declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown, TConfigInput = ConfigWithOverrides<TConfig>> = {
78
- /**
79
- * Module configuration required to render the flow.
80
- * For Web Components, this is typically assigned via `element.config = ...`.
81
- *
82
- * Also carries optional per-instance `assets`/`animations` override maps;
83
- * they override the global `setup({ uiConfig })` values for this
84
- * element only and are ignored by the core manager.
85
- */
86
- config?: TConfigInput;
87
- /**
88
- * Optional pre-built manager. When provided, the module does not create or manage the manager lifecycle.
89
- */
90
- manager?: TManager;
91
- /**
92
- * Callback invoked when the module completes successfully.
93
- * @param result - Optional result data from the module completion
94
- * @param meta - Optional context about how the module resolved (e.g. whether
95
- * the SDK rendered its own terminal finish screen). See {@link IncodeFinishMeta}.
96
- */
97
- onFinish?: (result?: TResult, meta?: IncodeFinishMeta) => void;
98
- /**
99
- * Callback invoked when a fatal module error occurs.
100
- *
101
- * @param error - Human-readable error message.
102
- * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
103
- * the workflow and flow modules on QR validation failures —
104
- * `4026` (`expiredUUID`), `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
105
- * @param moduleErrorCode - Optional machine-readable error code (e.g. a
106
- * `FaceErrorCode` such as `NONEXISTENT_CUSTOMER`). Lets an orchestrator
107
- * branch on the specific terminal error without parsing the message string.
108
- */
5
+ export declare const VideoSelfie: FC<Omit<{
6
+ config?: VideoSelfieConfig | undefined;
7
+ manager?: unknown;
8
+ onFinish?: ((result?: void | undefined) => void) | undefined;
109
9
  onError?: (error: string | undefined, errorCode?: number, moduleErrorCode?: string) => void;
110
- };
111
-
112
- /**
113
- * Per-instance asset/animation overrides for a single mounted SDK module.
114
- *
115
- * These ride on the module's `config` prop and are published once at the
116
- * module root by `registerIncodeModuleElement`, so a deep `<Asset>`/`<AnimatedAsset>`
117
- * reads them via {@link useInstanceOverrides} without any prop drilling.
118
- */
119
- declare type InstanceOverrides = {
120
- assets?: AssetOverrides;
121
- animations?: AnimationOverrides;
122
- };
123
-
124
- declare type LottieAnimationData = {
125
- fr: number;
126
- v: string;
127
- ip: number;
128
- op: number;
129
- w: number;
130
- h: number;
131
- };
132
-
133
- /** An SVG imported as a Preact component (the `?react` import shape). */
134
- declare type SvgComponent = FunctionComponent<SVGProps<SVGSVGElement>>;
135
-
136
- export declare const VideoSelfie: FC<Omit<VideoSelfieProps, "config"> & {
137
- config?: (Omit<unknown, never> & DeepPartial<Pick<unknown, never>>) | undefined;
10
+ }, "config"> & {
11
+ config?: (Omit<VideoSelfieConfig, "validateClosedEyes" | "validateFaceMask" | "validateHeadCover" | "validateLenses" | "speechToTextCheck" | "numberOfTries" | "useAsSelfie" | "showTutorials" | "companyName" | "checkLiveness" | "checkIdScan" | "checkDocumentScan" | "compareIdEnabled" | "compareOcrEnabled" | "compareBackIdEnabled" | "compareBackOcrEnabled" | "checkVoiceConsent" | "voiceConsentQuestions" | "selfieQualityAffectsScore" | "maxWaitingVideoSelfieFile" | "lastSecondsVideoQualityCheck" | "lastSecondsVideoQualityCheckDuration"> & DeepPartial<Pick<VideoSelfieConfig, "validateClosedEyes" | "validateFaceMask" | "validateHeadCover" | "validateLenses" | "speechToTextCheck" | "numberOfTries" | "useAsSelfie" | "showTutorials" | "companyName" | "checkLiveness" | "checkIdScan" | "checkDocumentScan" | "compareIdEnabled" | "compareOcrEnabled" | "compareBackIdEnabled" | "compareBackOcrEnabled" | "checkVoiceConsent" | "voiceConsentQuestions" | "selfieQualityAffectsScore" | "maxWaitingVideoSelfieFile" | "lastSecondsVideoQualityCheck" | "lastSecondsVideoQualityCheckDuration">>) | undefined;
138
12
  }>;
139
13
 
140
- /** Props for the {@link VideoSelfie} component. */
141
- declare type VideoSelfieProps = IncodeModuleProps<VideoSelfieConfig>;
142
-
143
14
  export { }
144
15
 
145
16
  declare global {
@@ -428,9 +428,11 @@ var getSelfieVariant = (detectionStatus) => {
428
428
  };
429
429
  var VideoSelfieContent = ({ config, onFinish, onError }) => {
430
430
  const { t } = useTranslation();
431
- const cameraWarmer = T(() => config ? createVideoSelfieCameraWarmer(config) : null, [config]);
431
+ const steps = T(() => config ? resolveVideoSelfieSteps(config) : [], [config]);
432
+ const cameraWarmer = T(() => config ? createVideoSelfieCameraWarmer(config, steps) : null, [config, steps]);
432
433
  const [state, manager] = useManager(() => createVideoSelfieRecordingManager({
433
434
  config,
435
+ steps,
434
436
  dependencies: cameraWarmer ? { acquireCamera: cameraWarmer.acquireCamera } : void 0
435
437
  }), { autoLoad: false });
436
438
  const [phase, setPhase] = d(config?.showTutorials ? "tutorial" : "permissions");
@@ -441,8 +443,8 @@ var VideoSelfieContent = ({ config, onFinish, onError }) => {
441
443
  });
442
444
  y(() => {
443
445
  if ((phase === "tutorial" || phase === "permissions") && config) {
444
- warmupVideoSelfieWasm(config);
445
- if (config.checkIdScan) {
446
+ warmupVideoSelfieWasm(config, steps);
447
+ if (steps.some((step) => step === "frontId" || step === "backId")) {
446
448
  preloadCaptureAnimations();
447
449
  preloadIdFlipAnimation();
448
450
  }
@@ -451,6 +453,7 @@ var VideoSelfieContent = ({ config, onFinish, onError }) => {
451
453
  }, [
452
454
  phase,
453
455
  config,
456
+ steps,
454
457
  cameraWarmer
455
458
  ]);
456
459
  y(() => () => cameraWarmer?.dispose(), [cameraWarmer]);
@@ -462,10 +465,9 @@ var VideoSelfieContent = ({ config, onFinish, onError }) => {
462
465
  status: state.status,
463
466
  onFinish
464
467
  });
465
- const steps = T(() => config ? resolveVideoSelfieSteps(config) : [], [config]);
466
468
  const step = state.step ?? "selfie";
467
469
  if (phase === "tutorial" && config) return /* @__PURE__ */ u(VideoSelfieTutorial, {
468
- config,
470
+ steps,
469
471
  onStart: () => setPhase("permissions")
470
472
  });
471
473
  if (phase === "permissions") return /* @__PURE__ */ u(Permissions, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260817-941e76d2",
3
+ "version": "0.0.0-dev-20260817-ec13a90c",
4
4
  "license": "ISC",
5
5
  "repository": {
6
6
  "type": "git",
@@ -292,7 +292,7 @@
292
292
  "qrcode": "^1.5.4",
293
293
  "signature_pad": "^5.1.3",
294
294
  "tailwindcss": "^4.1.17",
295
- "@incodetech/core": "0.0.0-dev-20260817-941e76d2"
295
+ "@incodetech/core": "0.0.0-dev-20260817-ec13a90c"
296
296
  },
297
297
  "devDependencies": {
298
298
  "@microsoft/api-extractor": "^7.53.3",