idmission-web-sdk 1.0.31 → 1.0.34

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.
@@ -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.31';
53
+ var webSdkVersion = '1.0.34';
54
54
 
55
55
  function getPlatform() {
56
56
  return window.platform;
@@ -14902,28 +14902,30 @@ var VideoIdValidation = function VideoIdValidation(_a) {
14902
14902
 
14903
14903
  var preloadModels = function preloadModels(_a) {
14904
14904
  var _b = _a.documentDetectionModel,
14905
- documentDetectionModel = _b === void 0 ? "".concat(DEFAULT_CDN_URL, "/models/documentdetection448/model.json") : _b,
14905
+ documentDetectionModel = _b === void 0 ? true : _b,
14906
14906
  _c = _a.focusModel,
14907
- focusModel = _c === void 0 ? "".concat(DEFAULT_CDN_URL, "/models/focus/model.json") : _c,
14908
- _d = _a.skipFaceDetectionModel,
14909
- skipFaceDetectionModel = _d === void 0 ? false : _d;
14907
+ focusModel = _c === void 0 ? true : _c,
14908
+ _d = _a.faceDetectionModel,
14909
+ faceDetectionModel = _d === void 0 ? true : _d;
14910
14910
  return tslib.__awaiter(void 0, void 0, void 0, function () {
14911
14911
  return tslib.__generator(this, function (_e) {
14912
14912
  switch (_e.label) {
14913
14913
  case 0:
14914
14914
  if (!documentDetectionModel) return [3, 2];
14915
+ if (documentDetectionModel === true) documentDetectionModel = "".concat(DEFAULT_CDN_URL, "/models/documentdetection448/model.json");
14915
14916
  return [4, loadDocumentDetectionModel(documentDetectionModel)];
14916
14917
  case 1:
14917
14918
  _e.sent();
14918
14919
  _e.label = 2;
14919
14920
  case 2:
14920
14921
  if (!focusModel) return [3, 4];
14922
+ if (focusModel === true) focusModel = "".concat(DEFAULT_CDN_URL, "/models/focus/model.json");
14921
14923
  return [4, loadFocusModel(focusModel)];
14922
14924
  case 3:
14923
14925
  _e.sent();
14924
14926
  _e.label = 4;
14925
14927
  case 4:
14926
- if (!!skipFaceDetectionModel) return [3, 6];
14928
+ if (!faceDetectionModel) return [3, 6];
14927
14929
  return [4, loadHighPerformanceFaceDetector()];
14928
14930
  case 5:
14929
14931
  _e.sent();