From 92f3aefbd07fb478cd932a11fe55cb789f2cbbce Mon Sep 17 00:00:00 2001 From: Eugenio Bettini Date: Thu, 12 Nov 2026 17:50:34 +0100 Subject: [PATCH 1/3] fix(recognize): default WASM asset URLs so webpack consumers can resolve them --- packages/recognize/src/lib/defs/constants.ts | 8 ++++++++ .../recognize/src/lib/functions/set-attributes.ts | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/recognize/src/lib/defs/constants.ts b/packages/recognize/src/lib/defs/constants.ts index 93af5232b76..6cce9d284f4 100644 --- a/packages/recognize/src/lib/defs/constants.ts +++ b/packages/recognize/src/lib/defs/constants.ts @@ -20,3 +20,11 @@ export const CAMERA_ONLY_DISABLE_STEPS: KeylessComponentsStep[] = [ 'stm-choice', 'stm-qrcode', ]; + +/** @internal */ +// Webpack rewrites import.meta.url in the vendored SDK to a file:// path the browser cannot +// fetch; a literal new URL(..., import.meta.url) here lets webpack resolve the WASM files +// and emit them as assets. +export const DEFAULT_WASM_BINARY_URL = new URL('../recognize-sdk/wasm.wasm', import.meta.url).href; +export const DEFAULT_WASM_DATA_URL = new URL('../recognize-sdk/wasm.data', import.meta.url).href; +export const DEFAULT_WASM_SCRIPT_URL = new URL('../recognize-sdk/wasm.js', import.meta.url).href; diff --git a/packages/recognize/src/lib/functions/set-attributes.ts b/packages/recognize/src/lib/functions/set-attributes.ts index 2f2a48d5c23..e15377d5925 100644 --- a/packages/recognize/src/lib/functions/set-attributes.ts +++ b/packages/recognize/src/lib/functions/set-attributes.ts @@ -7,6 +7,12 @@ * */ +import { + DEFAULT_WASM_BINARY_URL, + DEFAULT_WASM_DATA_URL, + DEFAULT_WASM_SCRIPT_URL, +} from '../defs/constants.js'; + import type { RecognizeWebComponent, RecognizeWebComponentConfiguration, @@ -50,7 +56,7 @@ export function setAttributes( if (config.theme !== undefined) element.theme = config.theme; if (config.themeOptions !== undefined) element.themeOptions = config.themeOptions; if (config.transactionData !== undefined) element.transactionData = config.transactionData; - if (config.wasmBinaryURL !== undefined) element.wasmBinaryURL = config.wasmBinaryURL; - if (config.wasmDataURL !== undefined) element.wasmDataURL = config.wasmDataURL; - if (config.wasmScriptURL !== undefined) element.wasmScriptURL = config.wasmScriptURL; + element.wasmBinaryURL = config.wasmBinaryURL ?? DEFAULT_WASM_BINARY_URL; + element.wasmDataURL = config.wasmDataURL ?? DEFAULT_WASM_DATA_URL; + element.wasmScriptURL = config.wasmScriptURL ?? DEFAULT_WASM_SCRIPT_URL; } From f41917dd072b1e1bb2120694d12732489ddce991 Mon Sep 17 00:00:00 2001 From: Eugenio Bettini Date: Thu, 12 Nov 2026 17:50:46 +0100 Subject: [PATCH 2/3] chore: add changeset for recognize wasm default urls --- .changeset/recognize-wasm-default-urls.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/recognize-wasm-default-urls.md diff --git a/.changeset/recognize-wasm-default-urls.md b/.changeset/recognize-wasm-default-urls.md new file mode 100644 index 00000000000..4cc695da3de --- /dev/null +++ b/.changeset/recognize-wasm-default-urls.md @@ -0,0 +1,5 @@ +--- +'@forgerock/recognize': patch +--- + +Default `wasmBinaryURL`, `wasmDataURL` and `wasmScriptURL` to the vendored SDK files when not provided, so bundlers like webpack can resolve them instead of failing with unfetchable `file://` paths. From 9211b48e086f9dfcc664bf1c19f5fc90f9137c25 Mon Sep 17 00:00:00 2001 From: Eugenio Bettini Date: Fri, 20 Nov 2026 16:15:07 +0100 Subject: [PATCH 3/3] feat(recognize): accept operationId as an alias of operationID The DaVinci server sends the operation ID as operationId in webSDKOptions, but the web component property (and our config option) is operationID, so a server option spread into the config was silently ignored. Accept both spellings in RecognizeWebComponentConfiguration and apply them in setAttributes; operationID wins when both are set. Fold the note into this PR's changeset and raise it from patch to minor, since the release now carries a new accepted option next to the WASM URL defaults. --- .changeset/recognize-wasm-default-urls.md | 4 ++- packages/recognize/README.md | 31 ++++++++++--------- .../src/lib/functions/set-attributes.ts | 3 +- packages/recognize/src/lib/recognize.types.ts | 6 ++++ 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.changeset/recognize-wasm-default-urls.md b/.changeset/recognize-wasm-default-urls.md index 4cc695da3de..b38ffdad43b 100644 --- a/.changeset/recognize-wasm-default-urls.md +++ b/.changeset/recognize-wasm-default-urls.md @@ -1,5 +1,7 @@ --- -'@forgerock/recognize': patch +'@forgerock/recognize': minor --- Default `wasmBinaryURL`, `wasmDataURL` and `wasmScriptURL` to the vendored SDK files when not provided, so bundlers like webpack can resolve them instead of failing with unfetchable `file://` paths. + +Accept `operationId` as an alias of `operationID`, matching the casing the server sends in `webSDKOptions`. `operationID` is unchanged and wins when both are set. diff --git a/packages/recognize/README.md b/packages/recognize/README.md index e5265fe7c96..3b6de9d2041 100644 --- a/packages/recognize/README.md +++ b/packages/recognize/README.md @@ -39,18 +39,19 @@ client.dispose(); ## Configuration -| Option | Type | Required | Description | -| -------------------------- | ---------- | -------- | ------------------------------ | -| `customer` | `string` | Yes | Customer identifier | -| `serviceURL` | `string` | Yes | URL of the recognition service | -| `authorizationToken` | `string` | No | Authorization token | -| `lang` | `string` | No | Language code for the UI | -| `theme` | `unknown` | No | Theme object | -| `disableSteps` | `string[]` | No | Steps to skip in the flow | -| `enableCameraFlash` | `boolean` | No | Enable camera flash | -| `enableCameraInstructions` | `boolean` | No | Show camera instructions | -| `disableLogger` | `boolean` | No | Disable internal logging | -| `disablePoweredBy` | `boolean` | No | Hide the "Powered by" badge | -| `enableWasmPthreads` | `boolean` | No | Enable WASM pthreads | -| `operationID` | `string` | No | Custom operation ID | -| `transactionData` | `string` | No | Transaction data string | +| Option | Type | Required | Description | +| -------------------------- | ---------- | -------- | --------------------------------------------- | +| `customer` | `string` | Yes | Customer identifier | +| `serviceURL` | `string` | Yes | URL of the recognition service | +| `authorizationToken` | `string` | No | Authorization token | +| `lang` | `string` | No | Language code for the UI | +| `theme` | `unknown` | No | Theme object | +| `disableSteps` | `string[]` | No | Steps to skip in the flow | +| `enableCameraFlash` | `boolean` | No | Enable camera flash | +| `enableCameraInstructions` | `boolean` | No | Show camera instructions | +| `disableLogger` | `boolean` | No | Disable internal logging | +| `disablePoweredBy` | `boolean` | No | Hide the "Powered by" badge | +| `enableWasmPthreads` | `boolean` | No | Enable WASM pthreads | +| `operationID` | `string` | No | Custom operation ID | +| `operationId` | `string` | No | Alias of `operationID`, as sent by the server | +| `transactionData` | `string` | No | Transaction data string | diff --git a/packages/recognize/src/lib/functions/set-attributes.ts b/packages/recognize/src/lib/functions/set-attributes.ts index e15377d5925..6eec995da2b 100644 --- a/packages/recognize/src/lib/functions/set-attributes.ts +++ b/packages/recognize/src/lib/functions/set-attributes.ts @@ -48,7 +48,8 @@ export function setAttributes( if (config.localizationVariables !== undefined) element.localizationVariables = config.localizationVariables; if (config.loggerLevel !== undefined) element.loggerLevel = config.loggerLevel; - if (config.operationID !== undefined) element.operationID = config.operationID; + const operationId = config.operationID ?? config.operationId; + if (operationId !== undefined) element.operationID = operationId; if (config.requestRecognitionFrame !== undefined) element.requestRecognitionFrame = config.requestRecognitionFrame; if (config.seedEntropy !== undefined) element.seedEntropy = config.seedEntropy; diff --git a/packages/recognize/src/lib/recognize.types.ts b/packages/recognize/src/lib/recognize.types.ts index bba0504ad19..3c456a301e6 100644 --- a/packages/recognize/src/lib/recognize.types.ts +++ b/packages/recognize/src/lib/recognize.types.ts @@ -99,6 +99,12 @@ export interface RecognizeWebComponentConfiguration { localizationVariables?: LocalizationVariables; loggerLevel?: LoggerLevel; operationID?: string; + /** + * Alias of `operationID`. The DaVinci server sends the operation ID as `operationId` in + * `webSDKOptions`, while the web component property is `operationID`, so both spellings are + * accepted. When both are set, `operationID` wins. + */ + operationId?: string; requestRecognitionFrame?: boolean; seedEntropy?: boolean; serviceURL: string;