datakeen-session-react 1.1.202-dev.17 → 1.1.202-dev.19
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/cjs/components/DatakeenSession.js +17 -16
- package/dist/cjs/components/card-capture-guide/CardCaptureGuide.js +139 -0
- package/dist/cjs/components/card-capture-guide/captureTelemetry.js +81 -0
- package/dist/cjs/components/card-capture-guide/guidance.js +48 -0
- package/dist/cjs/components/card-capture-guide/guideCore.js +389 -0
- package/dist/cjs/components/card-capture-guide/guideRuntime.js +118 -0
- package/dist/cjs/components/card-capture-guide/modelLoader.js +46 -0
- package/dist/cjs/components/card-capture-guide/useCaptureGuideThresholds.js +33 -0
- package/dist/cjs/components/card-capture-guide/useCardCaptureGuide.js +117 -0
- package/dist/cjs/components/card-capture-guide/useMinDisplay.js +30 -0
- package/dist/cjs/components/id-check/Photo.js +230 -122
- package/dist/cjs/components/id-check/card-capture/CardCapture.js +270 -0
- package/dist/cjs/components/id-check/card-capture/DynamicCardMask.js +85 -0
- package/dist/cjs/components/id-check/card-capture/geometry.js +119 -0
- package/dist/cjs/components/id-check/card-capture/guideTone.js +15 -0
- package/dist/cjs/components/jdi/JDIDocumentSelection.js +9 -0
- package/dist/cjs/components/session/DocumentCheck.js +19 -2
- package/dist/cjs/components/start-flow/Start.js +4 -0
- package/dist/cjs/context/CardCaptureGuideContext.js +16 -0
- package/dist/cjs/i18n/en.json.js +29 -0
- package/dist/cjs/i18n/es.json.js +29 -0
- package/dist/cjs/i18n/fr.json.js +29 -0
- package/dist/cjs/index.css.js +1 -1
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/services/sessionService.js +43 -0
- package/dist/esm/components/DatakeenSession.js +17 -16
- package/dist/esm/components/card-capture-guide/CardCaptureGuide.js +135 -0
- package/dist/esm/components/card-capture-guide/captureTelemetry.js +78 -0
- package/dist/esm/components/card-capture-guide/guidance.js +44 -0
- package/dist/esm/components/card-capture-guide/guideCore.js +372 -0
- package/dist/esm/components/card-capture-guide/guideRuntime.js +115 -0
- package/dist/esm/components/card-capture-guide/modelLoader.js +42 -0
- package/dist/esm/components/card-capture-guide/useCaptureGuideThresholds.js +31 -0
- package/dist/esm/components/card-capture-guide/useCardCaptureGuide.js +115 -0
- package/dist/esm/components/card-capture-guide/useMinDisplay.js +28 -0
- package/dist/esm/components/id-check/Photo.js +232 -124
- package/dist/esm/components/id-check/card-capture/CardCapture.js +266 -0
- package/dist/esm/components/id-check/card-capture/DynamicCardMask.js +81 -0
- package/dist/esm/components/id-check/card-capture/geometry.js +110 -0
- package/dist/esm/components/id-check/card-capture/guideTone.js +13 -0
- package/dist/esm/components/jdi/JDIDocumentSelection.js +9 -0
- package/dist/esm/components/session/DocumentCheck.js +19 -2
- package/dist/esm/components/start-flow/Start.js +4 -0
- package/dist/esm/context/CardCaptureGuideContext.js +13 -0
- package/dist/esm/i18n/en.json.js +28 -1
- package/dist/esm/i18n/es.json.js +28 -1
- package/dist/esm/i18n/fr.json.js +28 -1
- package/dist/esm/index.css.js +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/services/sessionService.js +42 -1
- package/dist/types/components/card-capture-guide/CardCaptureGuide.d.ts +46 -0
- package/dist/types/components/card-capture-guide/guidance.d.ts +45 -0
- package/dist/types/components/card-capture-guide/guideCore.d.ts +96 -0
- package/dist/types/components/card-capture-guide/guideRuntime.d.ts +13 -0
- package/dist/types/components/card-capture-guide/modelLoader.d.ts +13 -0
- package/dist/types/components/card-capture-guide/useCardCaptureGuide.d.ts +38 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/types/camera.d.ts +3 -0
- package/dist/types/types/session.d.ts +15 -1
- package/package.json +2 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model download for the card guide, kept apart from the ONNX runtime so a screen can preload the weights
|
|
3
|
+
* (13.5 MB, the main wait on mobile) without pulling onnxruntime-web or the guide logic.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* card-guide-v2b-20261006-weights.onnx (SHA-256 5eae0785…f48b), public Datakeen bucket, CORS `*`.
|
|
7
|
+
* Temporary location for testing: APP3-2118 moves it to the Datakeen CDN with a versioned name and a long cache.
|
|
8
|
+
*/
|
|
9
|
+
declare const DEFAULT_MODEL_URL = "https://datakeen-public.s3.eu-west-3.amazonaws.com/FmyFye6vkg8rrzrtQkW3QADx6eyner1q2WAEVUSB/xyG08fbEmVzYFwezy8zzJvHRbfgWpA8spA0TNeJQ.onnx";
|
|
10
|
+
/** Starts the download ahead of the capture screen. Never throws: the capture screen retries or falls back. */
|
|
11
|
+
declare function preloadCardGuideModel(url?: string): void;
|
|
12
|
+
|
|
13
|
+
export { DEFAULT_MODEL_URL, preloadCardGuideModel };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { GuideOptions, GuideUpdate } from './guideCore.js';
|
|
3
|
+
import { GuidanceCode, GuidanceEvent } from './guidance.js';
|
|
4
|
+
import { GuideRuntimeOptions } from './guideRuntime.js';
|
|
5
|
+
|
|
6
|
+
interface UseCardCaptureGuideOptions extends GuideRuntimeOptions {
|
|
7
|
+
/** Load the model at all. False = the hook stays idle (no download, no loop). Default: true. */
|
|
8
|
+
active?: boolean;
|
|
9
|
+
/** Run the loop only when true (e.g. once the camera is started and no capture is in progress). */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Override tracker thresholds (minBlur, minCardBrightness, maxGlareBlob, holdMs, ...). */
|
|
12
|
+
tracker?: GuideOptions;
|
|
13
|
+
/** Text for a code (i18n or your own copy). Default: the built-in English message. */
|
|
14
|
+
resolveMessage?: (code: GuidanceCode) => string;
|
|
15
|
+
/** Pushed each time the guidance CODE changes (too_blurry, too_dark, bright_spot, ready, ...). */
|
|
16
|
+
onGuidance?: (event: GuidanceEvent) => void;
|
|
17
|
+
/** Pushed after every inference (~8/s) with the live metrics - for meters, debug overlays, analytics. */
|
|
18
|
+
onFrame?: (event: GuidanceEvent) => void;
|
|
19
|
+
/** Model load time, then each inference time (ms) - for telemetry. */
|
|
20
|
+
onTiming?: (timing: {
|
|
21
|
+
kind: "load" | "inference";
|
|
22
|
+
ms: number;
|
|
23
|
+
}) => void;
|
|
24
|
+
/** Fires ONCE per card presence when the card has been steady, sharp, lit and glare-free long enough. */
|
|
25
|
+
onReady?: (guide: GuideUpdate) => void;
|
|
26
|
+
}
|
|
27
|
+
interface CardCaptureGuideState {
|
|
28
|
+
modelReady: boolean;
|
|
29
|
+
guide: GuideUpdate | null;
|
|
30
|
+
/** latest guidance event (same object pushed to onFrame) */
|
|
31
|
+
event: GuidanceEvent | null;
|
|
32
|
+
error: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** Drives the card guide on a <video>: model load, throttled inference loop, temporal tracking, guidance events. */
|
|
35
|
+
declare function useCardCaptureGuide(videoRef: RefObject<HTMLVideoElement>, { modelUrl, wasmPaths, active, enabled, tracker, resolveMessage, onGuidance, onFrame, onReady, onTiming }?: UseCardCaptureGuideOptions): CardCaptureGuideState;
|
|
36
|
+
|
|
37
|
+
export { useCardCaptureGuide };
|
|
38
|
+
export type { CardCaptureGuideState, UseCardCaptureGuideOptions };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export { I18nProvider, useI18nContext } from './providers/I18nProvider.js';
|
|
|
8
8
|
export { AnalysisResult, Prediction, extractRootCauses, getPrimaryRootCause, hasAnalysisFailed } from './utils/apiAnalysis.js';
|
|
9
9
|
export { default as DatakeenSession } from './components/DatakeenSession.js';
|
|
10
10
|
export { ConfigProvider } from './context/ConfigContext.js';
|
|
11
|
+
export { CardCaptureGuideConfig, SessionConfig } from './types/session.js';
|
|
12
|
+
export { default as CardCaptureGuide, CardCaptureGuideProps, CardCaptureMeta } from './components/card-capture-guide/CardCaptureGuide.js';
|
|
13
|
+
export { UseCardCaptureGuideOptions, useCardCaptureGuide } from './components/card-capture-guide/useCardCaptureGuide.js';
|
|
14
|
+
export { GuideOptions as CardGuideOptions, Quality as CardGuideQuality, State as CardGuideState, GuideUpdate as CardGuideUpdate, GuideTracker } from './components/card-capture-guide/guideCore.js';
|
|
15
|
+
export { GUIDANCE_CODES, GUIDANCE_SEVERITY, GuidanceCode, GuidanceEvent, GuidanceMessages, GuidanceMetrics, GuidanceSeverity } from './components/card-capture-guide/guidance.js';
|
|
16
|
+
export { DEFAULT_MODEL_URL as CARD_GUIDE_DEFAULT_MODEL_URL, preloadCardGuideModel } from './components/card-capture-guide/modelLoader.js';
|
|
11
17
|
export { default as DatakeenJourneyPreview } from './preview/DatakeenJourneyPreview.js';
|
|
12
18
|
export { DatakeenJourneyPreviewProps, PreviewBranch, PreviewDevice, PreviewEndResult, PreviewEndScreenConfig, PreviewJourney, PreviewJourneyNode, PreviewScreen } from './preview/types.js';
|
|
13
19
|
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* On-device ID card capture guide (`controle-jdi`). Every field is optional: without it the guide
|
|
5
|
+
* loads the default model and the WASM runtime from jsDelivr.
|
|
6
|
+
*/
|
|
7
|
+
interface CardCaptureGuideConfig {
|
|
8
|
+
/** `false` keeps the historical capture aid. Default: true. */
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
/** URL of the .onnx weights (same origin recommended, CSP `connect-src`). */
|
|
11
|
+
modelUrl?: string;
|
|
12
|
+
/** Base URL of the onnxruntime-web .wasm files, same version as the installed package. */
|
|
13
|
+
wasmPaths?: string;
|
|
14
|
+
}
|
|
3
15
|
interface SessionConfig {
|
|
4
16
|
sessionToken?: string;
|
|
5
17
|
selfie?: boolean;
|
|
@@ -9,6 +21,8 @@ interface SessionConfig {
|
|
|
9
21
|
* défaut ; `false` pour revenir au comportement antérieur (étape lue au chargement seulement).
|
|
10
22
|
*/
|
|
11
23
|
realtimeSync?: boolean;
|
|
24
|
+
/** Hosting and activation of the on-device capture guide. */
|
|
25
|
+
cardCaptureGuide?: CardCaptureGuideConfig;
|
|
12
26
|
}
|
|
13
27
|
interface DatakeenSessionProps {
|
|
14
28
|
/** Session credential returned by server-side session creation. Required by secured backends. */
|
|
@@ -274,4 +288,4 @@ interface EndScreenCase {
|
|
|
274
288
|
items: EndScreenItem[];
|
|
275
289
|
}
|
|
276
290
|
|
|
277
|
-
export type { AcceptedCountry, ConditionToken, ConditionTokenType, CustomField, CustomFieldValueType, DatakeenSessionProps, DateDisplayFormat, EndScreenCase, EndScreenIcon, EndScreenItem, ListColumn, ListColumnRegexCase, ListColumnRegexRules, PlatformInfo, SessionConfig, SessionTemplateEdge, SessionTemplateNode, UseSessionReturn };
|
|
291
|
+
export type { AcceptedCountry, CardCaptureGuideConfig, ConditionToken, ConditionTokenType, CustomField, CustomFieldValueType, DatakeenSessionProps, DateDisplayFormat, EndScreenCase, EndScreenIcon, EndScreenItem, ListColumn, ListColumnRegexCase, ListColumnRegexRules, PlatformInfo, SessionConfig, SessionTemplateEdge, SessionTemplateNode, UseSessionReturn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datakeen-session-react",
|
|
3
|
-
"version": "1.1.202-dev.
|
|
3
|
+
"version": "1.1.202-dev.19",
|
|
4
4
|
"description": "React SDK component to manage and render Datakeen session experiences easily.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
"heic2any": "^0.0.4",
|
|
116
116
|
"i18next": "^25.4.2",
|
|
117
117
|
"lucide-react": "^0.511.0",
|
|
118
|
+
"onnxruntime-web": "^1.30.0",
|
|
118
119
|
"pdfjs-dist": "5.4.149",
|
|
119
120
|
"qrcode": "^1.5.4",
|
|
120
121
|
"react-circle-flags": "^0.0.23",
|