@incodetech/web 0.0.0-dev-20260910-30fb659a → 0.0.0-dev-20260911-d4e8be9f

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.
@@ -4,8 +4,8 @@ import { C as useManager, c as TerminalErrorPage, f as TransitionSpinner, o as R
4
4
  import { x as ErrorIcon } from "../icons-BTQAPX7h.js";
5
5
  import { t as StatusPage } from "../statusPage-BSf9rrbK.js";
6
6
  import { t as registerIncodeModuleElement } from "../incodeModule-DQfs4RF7.js";
7
- import { _ as warmupWasmIfNeeded, a as resolveApiKey, c as HEADLESS_FLOW_MODULE_KEYS, d as fetchTheme, f as initializeFlowManager, h as preloadRedirectToMobile, l as LAZY_UI_MODULES, m as preloadHomeScreen, n as useModulePreloader, o as extractIncodeStatus, p as preloadFirstModule, r as usePrefetchNextModule, s as UnsupportedModule, t as useModuleLoader, u as createFlowManager, v as isDesktopOrEmulated, y as resolveSessionLanguage } from "../useModuleLoader-BN3raWWz.js";
8
- import { getRequiredWasmPipelines } from "@incodetech/core/flow";
7
+ import { _ as warmupWasmIfNeeded, a as resolveApiKey, c as HEADLESS_FLOW_MODULE_KEYS, d as fetchTheme, f as initializeFlowManager, h as preloadRedirectToMobile, l as LAZY_UI_MODULES, m as preloadHomeScreen, n as useModulePreloader, o as extractIncodeStatus, p as preloadFirstModule, r as usePrefetchNextModule, s as UnsupportedModule, t as useModuleLoader, u as createFlowManager, v as isDesktopOrEmulated, y as resolveSessionLanguage } from "../useModuleLoader-CgGe0OtT.js";
8
+ import { getNextRequiredWasmPipelines } from "@incodetech/core/flow";
9
9
  import { bootstrapSession, refreshQrUrlUuid } from "@incodetech/core/session";
10
10
  //#region src/shared/processing/useDelayedFlag.ts
11
11
  /**
@@ -145,9 +145,7 @@ function preloadIncodeFlow(config) {
145
145
  });
146
146
  const onManagerState = (managerState) => {
147
147
  if (managerState.status === "ready") {
148
- const readyState = managerState;
149
- warmupWasmIfNeeded(readyState, config.wasmConfig);
150
- preloadFirstModule(readyState);
148
+ preloadFirstModule(managerState);
151
149
  state.unsubscribe?.();
152
150
  state.unsubscribe = void 0;
153
151
  state.status = "ready";
@@ -400,16 +398,30 @@ var IncodeFlowContent = ({ config, onFinish, onError }) => {
400
398
  if (readStoredLanguage()) return;
401
399
  if (config.lang && i18n.language !== config.lang) i18n.changeLanguage(config.lang);
402
400
  }, [config.lang, i18n]);
401
+ const showHome = flowState.homeScreen.visible || showHomeLoadingScreen;
402
+ const canWarmup = !flowState.homeScreen.visible || flowState.homeScreen.isContinueLoading;
403
+ const [, refreshWasmStatus] = d(0);
404
+ const pipelineKey = flowState.status === "ready" ? getNextRequiredWasmPipelines(flowState).join(",") : "";
405
+ const onWasmWarmup = A(config.onWasmWarmup);
406
+ onWasmWarmup.current = config.onWasmWarmup;
403
407
  y(() => {
404
- if (flowState?.status !== "ready") return;
405
- if (flowState.currentStep === "REDIRECT_TO_MOBILE") return;
406
- const readyState = flowState;
407
- const requiredPipelines = getRequiredWasmPipelines(readyState.flow);
408
- if (requiredPipelines.length > 0) {
409
- config.onWasmWarmup?.(requiredPipelines);
410
- warmupWasmIfNeeded(readyState, config.wasmConfig);
411
- }
412
- }, [flowState, config]);
408
+ if (!canWarmup || !pipelineKey) return;
409
+ let cancelled = false;
410
+ const pipelines = pipelineKey.split(",");
411
+ onWasmWarmup.current?.(pipelines);
412
+ warmupWasmIfNeeded(pipelines, config.wasmConfig).then(() => {
413
+ if (!cancelled) refreshWasmStatus((version) => version + 1);
414
+ }).catch((error) => {
415
+ console.error("WASM warmup failed:", error);
416
+ });
417
+ return () => {
418
+ cancelled = true;
419
+ };
420
+ }, [
421
+ pipelineKey,
422
+ canWarmup,
423
+ config.wasmConfig
424
+ ]);
413
425
  const terminalFiredRef = A(false);
414
426
  y(() => {
415
427
  if (terminalFiredRef.current) return;
@@ -442,7 +454,7 @@ var IncodeFlowContent = ({ config, onFinish, onError }) => {
442
454
  class: "IncodeFlow",
443
455
  children: /* @__PURE__ */ u(TerminalErrorPage, { message: initState.error })
444
456
  });
445
- if (flowState.homeScreen.visible || showHomeLoadingScreen) return /* @__PURE__ */ u("div", {
457
+ if (showHome) return /* @__PURE__ */ u("div", {
446
458
  class: "IncodeFlow",
447
459
  children: /* @__PURE__ */ u(P, {
448
460
  fallback: null,
@@ -118,6 +118,12 @@ declare type FlowUiConfig = {
118
118
  * `@incodetech/core/events`.
119
119
  */
120
120
  onFlowEvent?: (event: FlowEvent) => void;
121
+ /**
122
+ * Called for each background warmup request with only its missing pipelines.
123
+ * Home flows wait for Start; flows without Home warm after mounting.
124
+ * May fire multiple times as the flow advances (e.g. ID, then selfie).
125
+ * Already-ready pipelines and repeated state updates do not fire it again.
126
+ */
121
127
  onWasmWarmup?: (pipelines: string[]) => void;
122
128
  onUrlUuidRefreshed?: (urlUuid: string) => void;
123
129
  spinnerConfig?: SpinnerConfig;
@@ -5,7 +5,7 @@ import "./incodeComponent-OpYmmHuG.js";
5
5
  import { S as Button } from "./icons-BTQAPX7h.js";
6
6
  import { initializeWasmUtil, resolveWasmConfigForPipelines, setWasmConfig, upgradeToWasmHttpClient, warmupWasm } from "@incodetech/core/wasm";
7
7
  import { isDesktopOrEmulated } from "@incodetech/core/device";
8
- import { createOrchestratedFlowManager, getFlow, getRequiredWasmPipelines } from "@incodetech/core/flow";
8
+ import { createOrchestratedFlowManager, getFlow } from "@incodetech/core/flow";
9
9
  import { getFinishStatus, initializeSession } from "@incodetech/core/session";
10
10
  //#region src/shared/selfLoading/resolveSessionLanguage.ts
11
11
  function normalizeSessionLanguage(language) {
@@ -228,20 +228,17 @@ async function fetchTheme(token) {
228
228
  return {};
229
229
  }
230
230
  }
231
- function warmupWasmIfNeeded(managerState, wasmConfig) {
232
- if (managerState.currentStep === "REDIRECT_TO_MOBILE") return;
233
- const requiredPipelines = getRequiredWasmPipelines(managerState.flow);
234
- if (requiredPipelines.length > 0) {
235
- const resolved = resolveWasmConfigForPipelines(requiredPipelines, wasmConfig);
236
- const configToStore = {
237
- ...resolved,
238
- pipelines: resolved.pipelines ? [...resolved.pipelines] : void 0
239
- };
240
- setWasmConfig(configToStore);
241
- warmupWasm(resolved).then(() => initializeWasmUtil(configToStore)).then(() => upgradeToWasmHttpClient(configToStore)).catch((error) => {
242
- console.error("WASM warmup failed:", error);
243
- });
244
- }
231
+ async function warmupWasmIfNeeded(pipelines, wasmConfig) {
232
+ if (pipelines.length === 0) return;
233
+ const resolved = resolveWasmConfigForPipelines(pipelines, wasmConfig);
234
+ const configToStore = {
235
+ ...resolved,
236
+ pipelines: resolved.pipelines ? [...resolved.pipelines] : void 0
237
+ };
238
+ setWasmConfig(configToStore);
239
+ await warmupWasm(resolved);
240
+ await initializeWasmUtil(configToStore);
241
+ await upgradeToWasmHttpClient(configToStore);
245
242
  }
246
243
  function preloadFirstModule(managerState) {
247
244
  const firstStep = managerState.currentStep;
@@ -3,7 +3,7 @@ import { _ as y, a as P, c as A, f as d, s as z, v as u } from "../vendor-preact
3
3
  import { i as fetchAndApplyTheme } from "../dashboardTheme-DBTW5Y2p.js";
4
4
  import { C as useManager, c as TerminalErrorPage, f as TransitionSpinner, l as Page, o as ResolvedConfigProvider, r as AutoFocusTitle, t as IncodeComponent } from "../incodeComponent-OpYmmHuG.js";
5
5
  import { t as registerIncodeModuleElement } from "../incodeModule-DQfs4RF7.js";
6
- import { a as resolveApiKey, g as setupSDK, i as HEADLESS_WORKFLOW_MODULE_KEYS, l as LAZY_UI_MODULES, o as extractIncodeStatus, s as UnsupportedModule, t as useModuleLoader, v as isDesktopOrEmulated, y as resolveSessionLanguage } from "../useModuleLoader-BN3raWWz.js";
6
+ import { a as resolveApiKey, g as setupSDK, i as HEADLESS_WORKFLOW_MODULE_KEYS, l as LAZY_UI_MODULES, o as extractIncodeStatus, s as UnsupportedModule, t as useModuleLoader, v as isDesktopOrEmulated, y as resolveSessionLanguage } from "../useModuleLoader-CgGe0OtT.js";
7
7
  import { resolveWasmConfigForPipelines, setWasmConfig, upgradeToWasmHttpClient, warmupWasm } from "@incodetech/core/wasm";
8
8
  import { classifyScoreStatus } from "@incodetech/core/flow";
9
9
  import { bootstrapSession, refreshQrUrlUuid } from "@incodetech/core/session";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260910-30fb659a",
3
+ "version": "0.0.0-dev-20260911-d4e8be9f",
4
4
  "license": "ISC",
5
5
  "repository": {
6
6
  "type": "git",
@@ -287,7 +287,7 @@
287
287
  ],
288
288
  "dependencies": {
289
289
  "preact": "^10.27.2",
290
- "@incodetech/core": "0.0.0-dev-20260910-30fb659a"
290
+ "@incodetech/core": "0.0.0-dev-20260911-d4e8be9f"
291
291
  },
292
292
  "devDependencies": {
293
293
  "@fontsource/dm-sans": "^5.2.8",