idmission-web-sdk 1.0.291 → 1.0.293
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/components/document_capture/DocumentCaptureStateProvider.d.ts +6 -2
- package/dist/components/id_capture/HighPerformanceObjectDetectionModelsProvider.d.ts +36 -0
- package/dist/sdk2.cjs.development.js +60 -40
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +60 -40
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +60 -40
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/stories/Components/HighPerformanceObjectDetection/Minimal.stories.d.ts +13 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -28,6 +28,9 @@ export type DocumentCaptureState = {
|
|
|
28
28
|
onDocumentUploaded?: OnDocumentUploaded;
|
|
29
29
|
onAllDocumentsUploaded?: OnAllDocumentsUploaded;
|
|
30
30
|
};
|
|
31
|
+
export type DocumentCaptureStateWithActions = DocumentCaptureState & {
|
|
32
|
+
uploadCapturedDocument: (content: Blob) => Promise<void>;
|
|
33
|
+
};
|
|
31
34
|
export declare const documentCaptureInitialState: {
|
|
32
35
|
documents: never[];
|
|
33
36
|
currentDocumentIndex: number;
|
|
@@ -39,8 +42,9 @@ export declare const documentCaptureInitialState: {
|
|
|
39
42
|
rectWidth: number;
|
|
40
43
|
rectHeight: number;
|
|
41
44
|
rectOffsetTop: number;
|
|
45
|
+
uploadCapturedDocument: () => Promise<void>;
|
|
42
46
|
};
|
|
43
|
-
export declare const DocumentCaptureStateContext: React.Context<
|
|
47
|
+
export declare const DocumentCaptureStateContext: React.Context<DocumentCaptureStateWithActions>;
|
|
44
48
|
export type DocumentCaptureAction = {
|
|
45
49
|
type: 'setDocuments';
|
|
46
50
|
payload: CapturedDocument[];
|
|
@@ -96,7 +100,7 @@ export declare const DocumentCaptureStateProvider: ({ documents, aspectRatio, ca
|
|
|
96
100
|
children: ReactNode;
|
|
97
101
|
}) => React.JSX.Element;
|
|
98
102
|
export declare const useDocumentCaptureState: () => [
|
|
99
|
-
|
|
103
|
+
DocumentCaptureStateWithActions,
|
|
100
104
|
DocumentCaptureDispatch
|
|
101
105
|
];
|
|
102
106
|
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { ObjectDetector } from '@mediapipe/tasks-vision';
|
|
4
|
+
export declare const visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm";
|
|
5
|
+
export declare const objectDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/mpobjtest/model_fp16.tflite";
|
|
6
|
+
export type DetectedObject = {
|
|
7
|
+
box: {
|
|
8
|
+
xMin: number;
|
|
9
|
+
xMax: number;
|
|
10
|
+
yMin: number;
|
|
11
|
+
yMax: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function loadHighPerformanceObjectDetector(modelAssetPath: string, delegate?: 'CPU' | 'GPU', scoreThreshold?: number): Promise<ObjectDetector>;
|
|
17
|
+
type PredictionHandler = (prediction: DetectedObject[]) => void;
|
|
18
|
+
type HighPerformanceSelfieGuidanceModelsState = {
|
|
19
|
+
start: () => void;
|
|
20
|
+
stop: () => void;
|
|
21
|
+
onPredictionMade: (handler: PredictionHandler) => void;
|
|
22
|
+
canvasRef: MutableRefObject<HTMLCanvasElement | null>;
|
|
23
|
+
ready: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
modelDownloadProgress: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const HighPerformanceObjectDetectionModelsContext: React.Context<HighPerformanceSelfieGuidanceModelsState>;
|
|
28
|
+
export declare const HighPerformanceObjectDetectionModelsProvider: ({ autoStart, children, throttleMs, modelAssetPath, delegate, scoreThreshold, }: {
|
|
29
|
+
autoStart?: boolean | undefined;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
throttleMs?: number | undefined;
|
|
32
|
+
modelAssetPath?: string | undefined;
|
|
33
|
+
delegate?: "CPU" | "GPU" | undefined;
|
|
34
|
+
scoreThreshold?: number | undefined;
|
|
35
|
+
}) => ReactElement;
|
|
36
|
+
export {};
|
|
@@ -50,7 +50,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
50
50
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
51
51
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
52
52
|
|
|
53
|
-
var webSdkVersion = '1.0.
|
|
53
|
+
var webSdkVersion = '1.0.293';
|
|
54
54
|
|
|
55
55
|
function getPlatform() {
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -12774,7 +12774,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
12774
12774
|
dispatch({
|
|
12775
12775
|
type: 'flipRequestCompleted'
|
|
12776
12776
|
});
|
|
12777
|
-
},
|
|
12777
|
+
}, 6000);
|
|
12778
12778
|
}
|
|
12779
12779
|
}, [dispatch, state.captureState]);
|
|
12780
12780
|
if (modelsError) {
|
|
@@ -14877,13 +14877,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14877
14877
|
}, verbiage.acceptBtnText))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, "Video: ", (_d = cameraRef.current) === null || _d === void 0 ? void 0 : _d.width, "x", (_e = cameraRef.current) === null || _e === void 0 ? void 0 : _e.height)), /*#__PURE__*/React__default['default'].createElement(ExitCaptureButton, {
|
|
14878
14878
|
onClick: onExit,
|
|
14879
14879
|
className: classNames.exitCaptureBtn
|
|
14880
|
-
}), /*#__PURE__*/React__default['default'].createElement(
|
|
14881
|
-
style: {
|
|
14882
|
-
display: 'none'
|
|
14883
|
-
}
|
|
14884
|
-
}, /*#__PURE__*/React__default['default'].createElement("canvas", {
|
|
14880
|
+
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
14885
14881
|
ref: outputCanvas
|
|
14886
|
-
}))
|
|
14882
|
+
}));
|
|
14887
14883
|
};
|
|
14888
14884
|
var AcceptBtn = styled__default['default'](LoaderButton)(templateObject_1$a || (templateObject_1$a = tslib.__makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
14889
14885
|
var templateObject_1$a;
|
|
@@ -18492,7 +18488,10 @@ var documentCaptureInitialState = {
|
|
|
18492
18488
|
rectY: 0,
|
|
18493
18489
|
rectWidth: 0,
|
|
18494
18490
|
rectHeight: 0,
|
|
18495
|
-
rectOffsetTop: 0
|
|
18491
|
+
rectOffsetTop: 0,
|
|
18492
|
+
uploadCapturedDocument: function uploadCapturedDocument() {
|
|
18493
|
+
return Promise.resolve();
|
|
18494
|
+
}
|
|
18496
18495
|
};
|
|
18497
18496
|
var DocumentCaptureStateContext = /*#__PURE__*/React.createContext(documentCaptureInitialState);
|
|
18498
18497
|
var DocumentCaptureDispatchContext = /*#__PURE__*/React.createContext(function () {});
|
|
@@ -18592,13 +18591,49 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
18592
18591
|
onDocumentUploaded = _a.onDocumentUploaded,
|
|
18593
18592
|
onAllDocumentsUploaded = _a.onAllDocumentsUploaded,
|
|
18594
18593
|
children = _a.children;
|
|
18595
|
-
var _c = React.
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
var _d = React.
|
|
18599
|
-
|
|
18600
|
-
|
|
18594
|
+
var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
|
|
18595
|
+
state = _c[0],
|
|
18596
|
+
dispatch = _c[1];
|
|
18597
|
+
var _d = React.useContext(CameraStateContext),
|
|
18598
|
+
cameraRef = _d.cameraRef,
|
|
18599
|
+
videoRef = _d.videoRef;
|
|
18600
|
+
var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
|
|
18601
|
+
var uploadCapturedDocument = React.useCallback(function (content) {
|
|
18602
|
+
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
18603
|
+
var documentId_1;
|
|
18604
|
+
return tslib.__generator(this, function (_a) {
|
|
18605
|
+
switch (_a.label) {
|
|
18606
|
+
case 0:
|
|
18607
|
+
_a.trys.push([0, 2,, 3]);
|
|
18608
|
+
dispatch({
|
|
18609
|
+
type: 'uploadStarted'
|
|
18610
|
+
});
|
|
18611
|
+
return [4 /*yield*/, uploadDocument(content)];
|
|
18612
|
+
case 1:
|
|
18613
|
+
documentId_1 = _a.sent();
|
|
18614
|
+
setTimeout(function () {
|
|
18615
|
+
dispatch({
|
|
18616
|
+
type: 'uploadCompleted',
|
|
18617
|
+
payload: {
|
|
18618
|
+
documentId: documentId_1
|
|
18619
|
+
}
|
|
18620
|
+
});
|
|
18621
|
+
}, 0);
|
|
18622
|
+
return [3 /*break*/, 3];
|
|
18623
|
+
case 2:
|
|
18624
|
+
_a.sent();
|
|
18625
|
+
dispatch({
|
|
18626
|
+
type: 'uploadFailed'
|
|
18627
|
+
});
|
|
18628
|
+
return [3 /*break*/, 3];
|
|
18629
|
+
case 3:
|
|
18630
|
+
return [2 /*return*/];
|
|
18631
|
+
}
|
|
18632
|
+
});
|
|
18633
|
+
});
|
|
18634
|
+
}, [uploadDocument]);
|
|
18601
18635
|
React.useEffect(function () {
|
|
18636
|
+
var _a;
|
|
18602
18637
|
var resolvedDocuments = (documents === null || documents === void 0 ? void 0 : documents.length) ? documents.map(function (d) {
|
|
18603
18638
|
return tslib.__assign(tslib.__assign({
|
|
18604
18639
|
title: 'Document Capture',
|
|
@@ -18619,7 +18654,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
18619
18654
|
type: 'setDocuments',
|
|
18620
18655
|
payload: resolvedDocuments
|
|
18621
18656
|
});
|
|
18622
|
-
|
|
18657
|
+
if ((_a = resolvedDocuments[0]) === null || _a === void 0 ? void 0 : _a.content) uploadCapturedDocument(resolvedDocuments[0].content);
|
|
18658
|
+
}, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
|
|
18623
18659
|
React.useEffect(function () {
|
|
18624
18660
|
dispatch({
|
|
18625
18661
|
type: 'setHooks',
|
|
@@ -18664,8 +18700,13 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
18664
18700
|
canvas.toBlob(onComplete);
|
|
18665
18701
|
}
|
|
18666
18702
|
}, [cameraRef, state.capturing, videoTag]);
|
|
18703
|
+
var stateWithActions = React.useMemo(function () {
|
|
18704
|
+
return tslib.__assign(tslib.__assign({}, state), {
|
|
18705
|
+
uploadCapturedDocument: uploadCapturedDocument
|
|
18706
|
+
});
|
|
18707
|
+
}, [state, uploadCapturedDocument]);
|
|
18667
18708
|
return /*#__PURE__*/React__default['default'].createElement(DocumentCaptureStateContext.Provider, {
|
|
18668
|
-
value:
|
|
18709
|
+
value: stateWithActions
|
|
18669
18710
|
}, /*#__PURE__*/React__default['default'].createElement(DocumentCaptureDispatchContext.Provider, {
|
|
18670
18711
|
value: dispatch
|
|
18671
18712
|
}, children));
|
|
@@ -18786,7 +18827,6 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
|
18786
18827
|
classNames = _g === void 0 ? {} : _g,
|
|
18787
18828
|
_h = _a.verbiage,
|
|
18788
18829
|
rawVerbiage = _h === void 0 ? {} : _h;
|
|
18789
|
-
var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
|
|
18790
18830
|
var _j = useDocumentCaptureState(),
|
|
18791
18831
|
_k = _j[0],
|
|
18792
18832
|
documents = _k.documents,
|
|
@@ -18797,6 +18837,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
|
18797
18837
|
rectHeight = _k.rectHeight,
|
|
18798
18838
|
rectOffsetTop = _k.rectOffsetTop,
|
|
18799
18839
|
capturing = _k.capturing,
|
|
18840
|
+
uploadCapturedDocument = _k.uploadCapturedDocument,
|
|
18800
18841
|
dispatch = _j[1];
|
|
18801
18842
|
var _l = (_b = documents[currentDocumentIndex]) !== null && _b !== void 0 ? _b : {},
|
|
18802
18843
|
title = _l.title,
|
|
@@ -18832,33 +18873,12 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
|
18832
18873
|
}
|
|
18833
18874
|
function onSubmitClick() {
|
|
18834
18875
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
18835
|
-
var documentId_1;
|
|
18836
18876
|
return tslib.__generator(this, function (_a) {
|
|
18837
18877
|
switch (_a.label) {
|
|
18838
18878
|
case 0:
|
|
18839
|
-
|
|
18840
|
-
dispatch({
|
|
18841
|
-
type: 'uploadStarted'
|
|
18842
|
-
});
|
|
18843
|
-
return [4 /*yield*/, uploadDocument(content)];
|
|
18879
|
+
return [4 /*yield*/, uploadCapturedDocument(content)];
|
|
18844
18880
|
case 1:
|
|
18845
|
-
documentId_1 = _a.sent();
|
|
18846
|
-
setTimeout(function () {
|
|
18847
|
-
dispatch({
|
|
18848
|
-
type: 'uploadCompleted',
|
|
18849
|
-
payload: {
|
|
18850
|
-
documentId: documentId_1
|
|
18851
|
-
}
|
|
18852
|
-
});
|
|
18853
|
-
}, 0);
|
|
18854
|
-
return [3 /*break*/, 3];
|
|
18855
|
-
case 2:
|
|
18856
18881
|
_a.sent();
|
|
18857
|
-
dispatch({
|
|
18858
|
-
type: 'uploadFailed'
|
|
18859
|
-
});
|
|
18860
|
-
return [3 /*break*/, 3];
|
|
18861
|
-
case 3:
|
|
18862
18882
|
return [2 /*return*/];
|
|
18863
18883
|
}
|
|
18864
18884
|
});
|