idmission-web-sdk 1.0.30 → 1.0.32

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/README.md CHANGED
@@ -597,6 +597,28 @@ You can also capture this information from the event fired at load time via `e.d
597
597
  </script>
598
598
  ```
599
599
 
600
+ ### Preloading the models
601
+
602
+ If you would like to programmatically issue a command to begin downloading and preparing the models on the client's browser *before* they enter a customer flow, the following method is available:
603
+ ```html
604
+ <script type="module">
605
+ document.addEventListener('idmission-web-sdk.ready', (e) => {
606
+ IDmissionSDK.preloadModels()
607
+ })
608
+ </script>
609
+ ```
610
+
611
+ You may specify which models should be loaded and which should be skipped by supplying an object argument, like so:
612
+ ```js
613
+ IDmissionSDK.preloadModels({
614
+ documentDetectionModel: true,
615
+ focusModel: true,
616
+ faceDetectionModel: false,
617
+ })
618
+ ```
619
+
620
+ This can be useful if, for example, you know you won't need any flows that depend on face detection.
621
+
600
622
  ### Intercepting (and modifying) API calls to IDmission's backend with `onBeforeSubmit`
601
623
 
602
624
  Each customer flow documented above includes an optional `onBeforeSubmit` prop, which bears the type signature `(request: SubmissionRequest) => Promise<SubmissionRequest>`. This can be useful if you would like to include some custom functionality that interrupts the WebSDK's outgoing request to IDmission's servers, allowing you a chance to modify the request before it is dispatched.
@@ -17,6 +17,10 @@ export interface VideoIdValidationProps extends PropsWithChildren {
17
17
  onExitAfterFailure?: (submissionResponse: SubmissionResponse | null) => void;
18
18
  idCaptureProps?: IdCaptureWizardProps;
19
19
  faceLivenessProps?: FaceLivenessWizardProps;
20
+ idCardFrontDetectionThreshold?: number;
21
+ idCardFrontFocusThreshold?: number;
22
+ goodIdCardFrontFramesThreshold?: number;
23
+ showIdCardBackDurationMs?: number;
20
24
  readTextPrompt?: CustomerSuppliedVerbiage;
21
25
  readTextTimeoutDurationMs?: number;
22
26
  skipSuccessScreen?: boolean | (() => Promise<boolean>);
@@ -26,6 +26,10 @@ export type VideoIdWizardProps = {
26
26
  idCaptureProps?: IdCaptureWizardProps;
27
27
  faceLivenessProps?: FaceLivenessWizardProps;
28
28
  onExitAfterFailure?: (submissionResponse: SubmissionResponse | null) => void;
29
+ idCardFrontDetectionThreshold?: number;
30
+ idCardFrontFocusThreshold?: number;
31
+ goodIdCardFrontFramesThreshold?: number;
32
+ showIdCardBackDurationMs?: number;
29
33
  readTextPrompt?: CustomerSuppliedVerbiage;
30
34
  readTextTimeoutDurationMs?: number;
31
35
  skipSuccessScreen?: boolean | (() => Promise<boolean>);
@@ -34,4 +38,4 @@ export type VideoIdWizardProps = {
34
38
  verbiage?: VideoIdWizardVerbiage;
35
39
  debugMode?: boolean;
36
40
  };
37
- export declare const VideoIdWizard: ({ idCaptureProps, faceLivenessProps, onExitAfterFailure, readTextPrompt, readTextTimeoutDurationMs, assets, colors, verbiage, debugMode, }: VideoIdWizardProps) => ReactElement;
41
+ export declare const VideoIdWizard: ({ idCaptureProps, faceLivenessProps, onExitAfterFailure, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, showIdCardBackDurationMs, readTextPrompt, readTextTimeoutDurationMs, assets, colors, verbiage, debugMode, }: VideoIdWizardProps) => ReactElement;
@@ -1,5 +1,5 @@
1
- export declare const preloadModels: ({ documentDetectionModel, focusModel, skipFaceDetectionModel, }: {
2
- documentDetectionModel?: string | false | undefined;
3
- focusModel?: string | false | undefined;
4
- skipFaceDetectionModel?: boolean | undefined;
1
+ export declare const preloadModels: ({ documentDetectionModel, focusModel, faceDetectionModel, }: {
2
+ documentDetectionModel?: string | boolean | undefined;
3
+ focusModel?: string | boolean | undefined;
4
+ faceDetectionModel?: boolean | undefined;
5
5
  }) => Promise<void>;
@@ -50,7 +50,7 @@ var tf__namespace = /*#__PURE__*/_interopNamespace(tf);
50
50
  var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver);
51
51
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
52
52
 
53
- var webSdkVersion = '1.0.30';
53
+ var webSdkVersion = '1.0.32';
54
54
 
55
55
  function getPlatform() {
56
56
  return window.platform;
@@ -14434,7 +14434,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14434
14434
  _k = _a.goodIdCardFrontFramesThreshold,
14435
14435
  goodIdCardFrontFramesThreshold = _k === void 0 ? 3 : _k,
14436
14436
  _l = _a.showIdCardBackDurationMs,
14437
- showIdCardBackDurationMs = _l === void 0 ? 3000 : _l,
14437
+ showIdCardBackDurationMs = _l === void 0 ? 5000 : _l,
14438
14438
  readTextPrompt = _a.readTextPrompt,
14439
14439
  _m = _a.readTextTimeoutDurationMs,
14440
14440
  readTextTimeoutDurationMs = _m === void 0 ? 15000 : _m,
@@ -14713,6 +14713,10 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14713
14713
  _g = _a.faceLivenessProps,
14714
14714
  faceLivenessProps = _g === void 0 ? {} : _g,
14715
14715
  onExitAfterFailure = _a.onExitAfterFailure,
14716
+ idCardFrontDetectionThreshold = _a.idCardFrontDetectionThreshold,
14717
+ idCardFrontFocusThreshold = _a.idCardFrontFocusThreshold,
14718
+ goodIdCardFrontFramesThreshold = _a.goodIdCardFrontFramesThreshold,
14719
+ showIdCardBackDurationMs = _a.showIdCardBackDurationMs,
14716
14720
  readTextPrompt = _a.readTextPrompt,
14717
14721
  readTextTimeoutDurationMs = _a.readTextTimeoutDurationMs,
14718
14722
  _h = _a.assets,
@@ -14823,6 +14827,10 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14823
14827
  key: "id-video-capture-".concat(attempt),
14824
14828
  onComplete: onVideoCaptureComplete,
14825
14829
  onFaceNotDetected: onVideoCaptureFaceNotDetected,
14830
+ idCardFrontDetectionThreshold: idCardFrontDetectionThreshold,
14831
+ idCardFrontFocusThreshold: idCardFrontFocusThreshold,
14832
+ goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
14833
+ showIdCardBackDurationMs: showIdCardBackDurationMs,
14826
14834
  readTextPrompt: readTextPrompt,
14827
14835
  readTextTimeoutDurationMs: readTextTimeoutDurationMs,
14828
14836
  assets: assets.idVideoCapture,
@@ -14855,6 +14863,10 @@ var VideoIdValidation = function VideoIdValidation(_a) {
14855
14863
  onExitAfterFailure = _a.onExitAfterFailure,
14856
14864
  idCaptureProps = _a.idCaptureProps,
14857
14865
  faceLivenessProps = _a.faceLivenessProps,
14866
+ idCardFrontDetectionThreshold = _a.idCardFrontDetectionThreshold,
14867
+ idCardFrontFocusThreshold = _a.idCardFrontFocusThreshold,
14868
+ goodIdCardFrontFramesThreshold = _a.goodIdCardFrontFramesThreshold,
14869
+ showIdCardBackDurationMs = _a.showIdCardBackDurationMs,
14858
14870
  readTextPrompt = _a.readTextPrompt,
14859
14871
  readTextTimeoutDurationMs = _a.readTextTimeoutDurationMs,
14860
14872
  _c = _a.skipSuccessScreen,
@@ -14876,6 +14888,10 @@ var VideoIdValidation = function VideoIdValidation(_a) {
14876
14888
  }, /*#__PURE__*/React__default['default'].createElement(VideoIdWizard, {
14877
14889
  idCaptureProps: idCaptureProps,
14878
14890
  faceLivenessProps: faceLivenessProps,
14891
+ idCardFrontDetectionThreshold: idCardFrontDetectionThreshold,
14892
+ idCardFrontFocusThreshold: idCardFrontFocusThreshold,
14893
+ goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
14894
+ showIdCardBackDurationMs: showIdCardBackDurationMs,
14879
14895
  readTextPrompt: readTextPrompt,
14880
14896
  readTextTimeoutDurationMs: readTextTimeoutDurationMs,
14881
14897
  onExitAfterFailure: onExitAfterFailure,
@@ -14886,28 +14902,30 @@ var VideoIdValidation = function VideoIdValidation(_a) {
14886
14902
 
14887
14903
  var preloadModels = function preloadModels(_a) {
14888
14904
  var _b = _a.documentDetectionModel,
14889
- documentDetectionModel = _b === void 0 ? "".concat(DEFAULT_CDN_URL, "/models/documentdetection448/model.json") : _b,
14905
+ documentDetectionModel = _b === void 0 ? true : _b,
14890
14906
  _c = _a.focusModel,
14891
- focusModel = _c === void 0 ? "".concat(DEFAULT_CDN_URL, "/models/focus/model.json") : _c,
14892
- _d = _a.skipFaceDetectionModel,
14893
- skipFaceDetectionModel = _d === void 0 ? false : _d;
14907
+ focusModel = _c === void 0 ? true : _c,
14908
+ _d = _a.faceDetectionModel,
14909
+ faceDetectionModel = _d === void 0 ? true : _d;
14894
14910
  return tslib.__awaiter(void 0, void 0, void 0, function () {
14895
14911
  return tslib.__generator(this, function (_e) {
14896
14912
  switch (_e.label) {
14897
14913
  case 0:
14898
14914
  if (!documentDetectionModel) return [3, 2];
14915
+ if (documentDetectionModel === true) documentDetectionModel = "".concat(DEFAULT_CDN_URL, "/models/documentdetection448/model.json");
14899
14916
  return [4, loadDocumentDetectionModel(documentDetectionModel)];
14900
14917
  case 1:
14901
14918
  _e.sent();
14902
14919
  _e.label = 2;
14903
14920
  case 2:
14904
14921
  if (!focusModel) return [3, 4];
14922
+ if (focusModel === true) focusModel = "".concat(DEFAULT_CDN_URL, "/models/focus/model.json");
14905
14923
  return [4, loadFocusModel(focusModel)];
14906
14924
  case 3:
14907
14925
  _e.sent();
14908
14926
  _e.label = 4;
14909
14927
  case 4:
14910
- if (!!skipFaceDetectionModel) return [3, 6];
14928
+ if (!faceDetectionModel) return [3, 6];
14911
14929
  return [4, loadHighPerformanceFaceDetector()];
14912
14930
  case 5:
14913
14931
  _e.sent();