idmission-web-sdk 2.3.6 → 2.3.7

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.
Files changed (38) hide show
  1. package/dist/components/common/overlay.d.ts +10 -4
  2. package/dist/components/common/overlay.d.ts.map +1 -1
  3. package/dist/components/customer_flows/IdValidation.d.ts +6 -0
  4. package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
  5. package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts +3 -1
  6. package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts.map +1 -1
  7. package/dist/components/id_capture/FocusModelProvider.d.ts +3 -1
  8. package/dist/components/id_capture/FocusModelProvider.d.ts.map +1 -1
  9. package/dist/components/id_capture/IdCaptureLoadingOverlay.d.ts +3 -0
  10. package/dist/components/id_capture/IdCaptureLoadingOverlay.d.ts.map +1 -1
  11. package/dist/components/id_capture/IdCaptureLoadingOverlayDefault.d.ts +2 -2
  12. package/dist/components/id_capture/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
  13. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +3 -0
  14. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
  15. package/dist/components/id_capture/IdCaptureWizard.d.ts +4 -1
  16. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  17. package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts +3 -0
  18. package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts.map +1 -1
  19. package/dist/lib/models/DocumentDetection.d.ts +3 -0
  20. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  21. package/dist/lib/models/FaceDetection.d.ts +3 -0
  22. package/dist/lib/models/FaceDetection.d.ts.map +1 -1
  23. package/dist/lib/models/Focus.d.ts +3 -0
  24. package/dist/lib/models/Focus.d.ts.map +1 -1
  25. package/dist/lib/models/helpers.d.ts +1 -0
  26. package/dist/lib/models/helpers.d.ts.map +1 -1
  27. package/dist/sdk2.cjs.development.js +181 -68
  28. package/dist/sdk2.cjs.development.js.map +1 -1
  29. package/dist/sdk2.cjs.production.js +1 -1
  30. package/dist/sdk2.cjs.production.js.map +1 -1
  31. package/dist/sdk2.esm.js +181 -68
  32. package/dist/sdk2.esm.js.map +1 -1
  33. package/dist/sdk2.umd.development.js +181 -68
  34. package/dist/sdk2.umd.development.js.map +1 -1
  35. package/dist/sdk2.umd.production.js +1 -1
  36. package/dist/sdk2.umd.production.js.map +1 -1
  37. package/dist/version.d.ts +1 -1
  38. package/package.json +1 -1
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.3.6';
214
+ var webSdkVersion = '2.3.7';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -503,11 +503,17 @@
503
503
  });
504
504
  var LoadingOverlayGuidanceMessage = styled(GuidanceMessage)(templateObject_11$1 || (templateObject_11$1 = __makeTemplateObject(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"], ["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])));
505
505
  var LoadingOverlayImageContainer = styled(OverlayImageContainer)(templateObject_12$1 || (templateObject_12$1 = __makeTemplateObject(["\n padding: 0;\n max-height: 100%;\n pointer-events: none;\n"], ["\n padding: 0;\n max-height: 100%;\n pointer-events: none;\n"])));
506
- var LoadingOverlayProgressBarBackground = styled.div(templateObject_13$1 || (templateObject_13$1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
507
- var LoadingOverlayProgressBar = styled.span(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n display: block;\n width: ", "%;\n height: 100%;\n left: 0;\n position: absolute;\n"], ["\n display: block;\n width: ", "%;\n height: 100%;\n left: 0;\n position: absolute;\n"])), function (props) {
506
+ var LoadingOverlayProgressBarBackground = styled.div.attrs({
507
+ className: 'loading-overlay-progress-bar-background'
508
+ })(templateObject_13$1 || (templateObject_13$1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
509
+ var LoadingOverlayProgressBar = styled.span.attrs({
510
+ className: 'loading-overlay-progress-bar'
511
+ })(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n display: block;\n width: ", "%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n"], ["\n display: block;\n width: ", "%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n"])), function (props) {
508
512
  return props.$progress;
509
513
  });
510
- var LoadingOverlayProgressIndicator = styled.span(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: block;\n height: 100%;\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"], ["\n display: block;\n height: 100%;\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"])), progressBarAnimation);
514
+ var LoadingOverlayProgressIndicator = styled.span.attrs({
515
+ className: 'loading-overlay-progress-indicator'
516
+ })(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: block;\n height: 100%;\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"], ["\n display: block;\n height: 100%;\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"])), progressBarAnimation);
511
517
  var LoadingOverlayButtonsRow = styled(ButtonsRow$2)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n min-height: 100px;\n width: 100%;\n box-sizing: border-box;\n position: relative;\n"], ["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n min-height: 100px;\n width: 100%;\n box-sizing: border-box;\n position: relative;\n"])));
512
518
  var LoadingOverlayLoadingListContainer = styled.div(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n display: flex;\n position: relative;\n z-index: 2;\n"], ["\n display: flex;\n position: relative;\n z-index: 2;\n"])));
513
519
  var LoadingOverlayLoadingList = styled.ul(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"], ["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"])));
@@ -8377,19 +8383,23 @@
8377
8383
  videoRef = _a.videoRef,
8378
8384
  _d = _a.shouldLoadModels,
8379
8385
  shouldLoadModels = _d === void 0 ? true : _d;
8380
- var _e = React.useState(false),
8381
- ready = _e[0],
8382
- setReady = _e[1];
8386
+ var _e = React.useState('not-started'),
8387
+ modelLoadState = _e[0],
8388
+ setModelLoadState = _e[1];
8383
8389
  var _f = React.useState(0),
8384
8390
  modelDownloadProgress = _f[0],
8385
8391
  setModelDownloadProgress = _f[1];
8386
8392
  var _g = React.useState(null),
8387
- modelError = _g[0],
8388
- setModelError = _g[1];
8393
+ modelWarmingStartedAt = _g[0],
8394
+ setModelWarmingStartedAt = _g[1];
8395
+ var _h = React.useState(null),
8396
+ modelError = _h[0],
8397
+ setModelError = _h[1];
8389
8398
  React.useEffect(function loadModel() {
8390
8399
  var _this = this;
8391
8400
  if (!shouldLoadModels) return;
8392
- setReady(false);
8401
+ setModelLoadState('downloading');
8402
+ setModelWarmingStartedAt(null);
8393
8403
  function handleDownloadProgress(event) {
8394
8404
  setModelDownloadProgress(progressToPercentage(event.detail));
8395
8405
  }
@@ -8406,6 +8416,8 @@
8406
8416
  case 0:
8407
8417
  setModelDownloadProgress(100);
8408
8418
  clearTimeout(modelLoadTimeout);
8419
+ setModelLoadState('warming');
8420
+ setModelWarmingStartedAt(new Date().getTime());
8409
8421
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
8410
8422
  cancelled = false;
8411
8423
  cancelVideoReady = function cancelVideoReady() {
@@ -8418,7 +8430,7 @@
8418
8430
  setTimeout(function () {
8419
8431
  if (cancelled) return;
8420
8432
  loadedModel.classifyForVideo(videoRef.current, performance.now());
8421
- setReady(true);
8433
+ setModelLoadState('ready');
8422
8434
  }, 500);
8423
8435
  return [2 /*return*/];
8424
8436
  }
@@ -8426,6 +8438,7 @@
8426
8438
  });
8427
8439
  })["catch"](function (e) {
8428
8440
  setModelError(e);
8441
+ setModelLoadState('error');
8429
8442
  })["finally"](function () {
8430
8443
  clearTimeout(modelLoadTimeout);
8431
8444
  });
@@ -8440,11 +8453,15 @@
8440
8453
  React.useEffect(function handleModelError() {
8441
8454
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
8442
8455
  }, [modelError, onModelError]);
8443
- return {
8444
- ready: ready,
8445
- modelDownloadProgress: modelDownloadProgress,
8446
- modelError: modelError
8447
- };
8456
+ return React.useMemo(function () {
8457
+ return {
8458
+ ready: modelLoadState === 'ready',
8459
+ modelLoadState: modelLoadState,
8460
+ modelDownloadProgress: modelDownloadProgress,
8461
+ modelWarmingStartedAt: modelWarmingStartedAt,
8462
+ modelError: modelError
8463
+ };
8464
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
8448
8465
  }
8449
8466
  var lastFocusPredictionAt = 0;
8450
8467
  var lastFocusPredictionTime = 0;
@@ -8536,18 +8553,22 @@
8536
8553
  _b = _a.modelLoadTimeoutMs,
8537
8554
  modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
8538
8555
  videoRef = _a.videoRef;
8539
- var _c = React.useState(false),
8540
- ready = _c[0],
8541
- setReady = _c[1];
8556
+ var _c = React.useState('not-started'),
8557
+ modelLoadState = _c[0],
8558
+ setModelLoadState = _c[1];
8542
8559
  var _d = React.useState(0),
8543
8560
  modelDownloadProgress = _d[0],
8544
8561
  setModelDownloadProgress = _d[1];
8545
8562
  var _e = React.useState(null),
8546
- modelError = _e[0],
8547
- setModelError = _e[1];
8563
+ modelWarmingStartedAt = _e[0],
8564
+ setModelWarmingStartedAt = _e[1];
8565
+ var _f = React.useState(null),
8566
+ modelError = _f[0],
8567
+ setModelError = _f[1];
8548
8568
  React.useEffect(function loadModel() {
8549
8569
  var _this = this;
8550
- setReady(false);
8570
+ setModelLoadState('downloading');
8571
+ setModelWarmingStartedAt(null);
8551
8572
  var modelLoadTimeout = setTimeout(function () {
8552
8573
  setModelError(new Error('Model loading time limit exceeded.'));
8553
8574
  }, modelLoadTimeoutMs);
@@ -8564,6 +8585,8 @@
8564
8585
  case 0:
8565
8586
  setModelDownloadProgress(100);
8566
8587
  clearTimeout(modelLoadTimeout);
8588
+ setModelLoadState('warming');
8589
+ setModelWarmingStartedAt(new Date().getTime());
8567
8590
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
8568
8591
  cancelled = false;
8569
8592
  cancelVideoReady = function cancelVideoReady() {
@@ -8575,13 +8598,14 @@
8575
8598
  _b.sent();
8576
8599
  if (cancelled) return [2 /*return*/];
8577
8600
  model.detectForVideo(videoRef.current, performance.now());
8578
- setReady(true);
8601
+ setModelLoadState('ready');
8579
8602
  return [2 /*return*/];
8580
8603
  }
8581
8604
  });
8582
8605
  });
8583
8606
  })["catch"](function (e) {
8584
8607
  setModelError(e);
8608
+ setModelLoadState('error');
8585
8609
  })["finally"](function () {
8586
8610
  clearTimeout(modelLoadTimeout);
8587
8611
  });
@@ -8596,11 +8620,15 @@
8596
8620
  React.useEffect(function handleModelError() {
8597
8621
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
8598
8622
  }, [modelError, onModelError]);
8599
- return {
8600
- ready: ready,
8601
- modelDownloadProgress: modelDownloadProgress,
8602
- modelError: modelError
8603
- };
8623
+ return React.useMemo(function () {
8624
+ return {
8625
+ ready: modelLoadState === 'ready',
8626
+ modelLoadState: modelLoadState,
8627
+ modelDownloadProgress: modelDownloadProgress,
8628
+ modelWarmingStartedAt: modelWarmingStartedAt,
8629
+ modelError: modelError
8630
+ };
8631
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
8604
8632
  }
8605
8633
  var lastFaceDetectionAt = 0;
8606
8634
  var lastFaceDetectionTime = 0;
@@ -9042,19 +9070,23 @@
9042
9070
  scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
9043
9071
  onModelError = _a.onModelError,
9044
9072
  videoRef = _a.videoRef;
9045
- var _f = React.useState(false),
9046
- ready = _f[0],
9047
- setReady = _f[1];
9048
- var _g = React.useState(0),
9049
- modelDownloadProgress = _g[0],
9050
- setModelDownloadProgress = _g[1];
9051
- var _h = React.useState(null),
9052
- modelError = _h[0],
9053
- setModelError = _h[1];
9073
+ var _f = React.useState('not-started'),
9074
+ modelLoadState = _f[0],
9075
+ setModelLoadState = _f[1];
9076
+ var _g = React.useState(null),
9077
+ modelWarmingStartedAt = _g[0],
9078
+ setModelWarmingStartedAt = _g[1];
9079
+ var _h = React.useState(0),
9080
+ modelDownloadProgress = _h[0],
9081
+ setModelDownloadProgress = _h[1];
9082
+ var _j = React.useState(null),
9083
+ modelError = _j[0],
9084
+ setModelError = _j[1];
9054
9085
  React.useEffect(function loadModel() {
9055
9086
  var _this = this;
9056
9087
  if (!shouldLoadModels) return;
9057
- setReady(false);
9088
+ setModelLoadState('downloading');
9089
+ setModelWarmingStartedAt(null);
9058
9090
  function handleDownloadProgress(event) {
9059
9091
  setModelDownloadProgress(progressToPercentage(event.detail));
9060
9092
  }
@@ -9070,6 +9102,8 @@
9070
9102
  switch (_b.label) {
9071
9103
  case 0:
9072
9104
  setModelDownloadProgress(100);
9105
+ setModelLoadState('warming');
9106
+ setModelWarmingStartedAt(new Date().getTime());
9073
9107
  clearTimeout(modelLoadTimeout);
9074
9108
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
9075
9109
  cancelled = false;
@@ -9083,7 +9117,7 @@
9083
9117
  setTimeout(function () {
9084
9118
  if (cancelled) return;
9085
9119
  model.detectForVideo(videoRef.current, performance.now());
9086
- setReady(true);
9120
+ setModelLoadState('ready');
9087
9121
  }, 500);
9088
9122
  return [2 /*return*/];
9089
9123
  }
@@ -9091,6 +9125,7 @@
9091
9125
  });
9092
9126
  })["catch"](function (e) {
9093
9127
  setModelError(e);
9128
+ setModelLoadState('error');
9094
9129
  })["finally"](function () {
9095
9130
  clearTimeout(modelLoadTimeout);
9096
9131
  });
@@ -9105,12 +9140,16 @@
9105
9140
  React.useEffect(function handleModelError() {
9106
9141
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
9107
9142
  }, [modelError, onModelError]);
9108
- return {
9109
- ready: ready,
9110
- modelDownloadProgress: modelDownloadProgress,
9111
- modelError: modelError,
9112
- setModelError: setModelError
9113
- };
9143
+ return React.useMemo(function () {
9144
+ return {
9145
+ ready: modelLoadState === 'ready',
9146
+ modelLoadState: modelLoadState,
9147
+ modelDownloadProgress: modelDownloadProgress,
9148
+ modelWarmingStartedAt: modelWarmingStartedAt,
9149
+ modelError: modelError,
9150
+ setModelError: setModelError
9151
+ };
9152
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
9114
9153
  }
9115
9154
  function makeDocumentDetectorPrediction(frame) {
9116
9155
  return __awaiter(this, void 0, void 0, function () {
@@ -13929,8 +13968,9 @@
13929
13968
  loadDocumentDetectionModel: function loadDocumentDetectionModel() {
13930
13969
  return null;
13931
13970
  },
13932
- documentDetectionModelReady: false,
13971
+ documentDetectionModelState: 'not-started',
13933
13972
  documentDetectionModelDownloadProgress: 0,
13973
+ documentDetectionModelWarmingStartedAt: null,
13934
13974
  documentDetectionModelError: null,
13935
13975
  onDocumentDetected: function onDocumentDetected() {
13936
13976
  return null;
@@ -14003,7 +14043,9 @@
14003
14043
  shouldLoadModels: shouldLoadModels
14004
14044
  }),
14005
14045
  ready = _q.ready,
14046
+ modelLoadState = _q.modelLoadState,
14006
14047
  modelDownloadProgress = _q.modelDownloadProgress,
14048
+ modelWarmingStartedAt = _q.modelWarmingStartedAt,
14007
14049
  modelError = _q.modelError,
14008
14050
  setModelError = _q.setModelError;
14009
14051
  var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
@@ -14070,7 +14112,8 @@
14070
14112
  startDocumentDetection: start,
14071
14113
  stopDocumentDetection: stop,
14072
14114
  loadDocumentDetectionModel: load,
14073
- documentDetectionModelReady: ready,
14115
+ documentDetectionModelState: modelLoadState,
14116
+ documentDetectionModelWarmingStartedAt: modelWarmingStartedAt,
14074
14117
  documentDetectionModelError: modelError,
14075
14118
  documentDetectionModelDownloadProgress: modelDownloadProgress,
14076
14119
  onDocumentDetected: onDocumentDetected,
@@ -14082,7 +14125,7 @@
14082
14125
  documentDetectionLastPredictionCanvas: lastPredictionCanvas,
14083
14126
  clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
14084
14127
  };
14085
- }, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
14128
+ }, [start, stop, load, modelLoadState, modelWarmingStartedAt, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
14086
14129
  return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
14087
14130
  value: value
14088
14131
  }, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
@@ -14095,8 +14138,9 @@
14095
14138
  loadFocusModel: function loadFocusModel() {
14096
14139
  return null;
14097
14140
  },
14098
- focusModelReady: false,
14141
+ focusModelState: 'not-started',
14099
14142
  focusModelDownloadProgress: 0,
14143
+ focusModelWarmingStartedAt: null,
14100
14144
  focusModelError: null,
14101
14145
  focusThresholds: {},
14102
14146
  setFocusThresholds: function setFocusThresholds() {
@@ -14138,7 +14182,9 @@
14138
14182
  shouldLoadModels: shouldLoadModels
14139
14183
  }),
14140
14184
  ready = _h.ready,
14185
+ modelLoadState = _h.modelLoadState,
14141
14186
  modelDownloadProgress = _h.modelDownloadProgress,
14187
+ modelWarmingStartedAt = _h.modelWarmingStartedAt,
14142
14188
  modelError = _h.modelError;
14143
14189
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
14144
14190
  if (!ready) return null;
@@ -14150,15 +14196,16 @@
14150
14196
  var value = React.useMemo(function () {
14151
14197
  return {
14152
14198
  loadFocusModel: load,
14153
- focusModelReady: ready,
14199
+ focusModelState: modelLoadState,
14154
14200
  focusModelDownloadProgress: modelDownloadProgress,
14201
+ focusModelWarmingStartedAt: modelWarmingStartedAt,
14155
14202
  focusModelError: modelError,
14156
14203
  makeFocusPrediction: makeFocusPrediction,
14157
14204
  focusPredictionTime: lastFocusPredictionTime,
14158
14205
  focusThresholds: focusThresholds,
14159
14206
  setFocusThresholds: setFocusThresholds
14160
14207
  };
14161
- }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
14208
+ }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, modelLoadState, modelWarmingStartedAt]);
14162
14209
  return /*#__PURE__*/React.createElement(FocusModelContext.Provider, {
14163
14210
  value: value
14164
14211
  }, /*#__PURE__*/React.createElement(InvisibleCanvas, {
@@ -14223,6 +14270,8 @@
14223
14270
  return null;
14224
14271
  },
14225
14272
  modelDownloadProgress: 0,
14273
+ modelLoadState: 'not-started',
14274
+ modelWarmingStartedAt: null,
14226
14275
  modelError: null,
14227
14276
  thresholds: defaultIdCaptureThresholds,
14228
14277
  setThresholds: function setThresholds() {
@@ -14257,8 +14306,9 @@
14257
14306
  _b = _a.allowSinglePageIdCapture,
14258
14307
  allowSinglePageIdCapture = _b === void 0 ? false : _b;
14259
14308
  var _c = React.useContext(DocumentDetectionModelContext),
14260
- documentDetectionModelReady = _c.documentDetectionModelReady,
14309
+ documentDetectionModelState = _c.documentDetectionModelState,
14261
14310
  documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
14311
+ documentDetectionModelWarmingStartedAt = _c.documentDetectionModelWarmingStartedAt,
14262
14312
  startDocumentDetection = _c.startDocumentDetection,
14263
14313
  stopDocumentDetection = _c.stopDocumentDetection,
14264
14314
  loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
@@ -14273,8 +14323,9 @@
14273
14323
  documentDetectionModelError = _c.documentDetectionModelError;
14274
14324
  var _d = React.useContext(FocusModelContext),
14275
14325
  loadFocusModel = _d.loadFocusModel,
14276
- focusModelReady = _d.focusModelReady,
14326
+ focusModelState = _d.focusModelState,
14277
14327
  focusModelDownloadProgress = _d.focusModelDownloadProgress,
14328
+ focusModelWarmingStartedAt = _d.focusModelWarmingStartedAt,
14278
14329
  makeFocusPrediction = _d.makeFocusPrediction,
14279
14330
  focusThresholds = _d.focusThresholds,
14280
14331
  setFocusThresholds = _d.setFocusThresholds,
@@ -14382,10 +14433,17 @@
14382
14433
  loadDocumentDetectionModel();
14383
14434
  loadFocusModel();
14384
14435
  }, [loadDocumentDetectionModel, loadFocusModel]);
14436
+ var ready = documentDetectionModelState === 'ready' && focusModelState === 'ready';
14437
+ var modelLoadState = ready ? 'ready' : documentDetectionModelState === 'warming' || focusModelState === 'warming' ? 'warming' : focusModelState === 'downloading' || documentDetectionModelState === 'downloading' ? 'downloading' : 'not-started';
14438
+ var modelWarmingStartedAt = !documentDetectionModelWarmingStartedAt && !focusModelWarmingStartedAt ? null : Math.min.apply(Math, [documentDetectionModelWarmingStartedAt, focusModelWarmingStartedAt].filter(function (v) {
14439
+ return v !== null;
14440
+ }));
14385
14441
  var value = React.useMemo(function () {
14386
14442
  return {
14387
- ready: documentDetectionModelReady && focusModelReady,
14443
+ ready: ready,
14388
14444
  modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
14445
+ modelLoadState: modelLoadState,
14446
+ modelWarmingStartedAt: modelWarmingStartedAt,
14389
14447
  modelError: modelError,
14390
14448
  start: startDocumentDetection,
14391
14449
  stop: stopDocumentDetection,
@@ -14403,7 +14461,7 @@
14403
14461
  requiredDocumentType: requiredDocumentType,
14404
14462
  setRequiredDocumentType: setRequiredDocumentType
14405
14463
  };
14406
- }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
14464
+ }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, focusModelDownloadProgress, focusPredictionTime, getBestFrame, load, modelLoadState, modelError, modelWarmingStartedAt, onPredictionMade, ready, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
14407
14465
  return /*#__PURE__*/React.createElement(IdCaptureModelsContext.Provider, {
14408
14466
  value: value
14409
14467
  }, /*#__PURE__*/React.createElement(InvisibleCanvas, {
@@ -16424,7 +16482,10 @@
16424
16482
  var legacyInstructionImageUrl$1 = "".concat(DEFAULT_CDN_URL, "/WebSDK-Instruction-DL-Capture-3-Portrait.png");
16425
16483
  var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a) {
16426
16484
  var _b, _c, _d, _e, _f, _g;
16427
- var onDismissed = _a.onDismissed,
16485
+ var onLoadingStarted = _a.onLoadingStarted,
16486
+ onLoadingProgress = _a.onLoadingProgress,
16487
+ onLoadingCompleted = _a.onLoadingCompleted,
16488
+ onDismissed = _a.onDismissed,
16428
16489
  onUserCancel = _a.onUserCancel,
16429
16490
  instructions = _a.instructions,
16430
16491
  _h = _a.rotateImage,
@@ -16442,7 +16503,9 @@
16442
16503
  var sessionReady = sessionCheckState === 'PASSED';
16443
16504
  var _o = useIdCaptureModelsContext(),
16444
16505
  modelsReady = _o.ready,
16445
- modelDownloadProgress = _o.modelDownloadProgress;
16506
+ modelLoadState = _o.modelLoadState,
16507
+ modelDownloadProgress = _o.modelDownloadProgress,
16508
+ modelWarmingStartedAt = _o.modelWarmingStartedAt;
16446
16509
  var _p = useCameraStore(),
16447
16510
  cameraReady = _p.cameraReady,
16448
16511
  cameraAccessDenied = _p.cameraAccessDenied,
@@ -16465,11 +16528,27 @@
16465
16528
  pleaseWaitText: 'Please wait...',
16466
16529
  sessionCheckingText: 'Authenticating...'
16467
16530
  });
16531
+ var onLoadingStartedRef = React.useRef(onLoadingStarted);
16532
+ React.useEffect(function () {
16533
+ onLoadingStartedRef.current = onLoadingStarted;
16534
+ }, [onLoadingStarted]);
16535
+ var onLoadingProgressRef = React.useRef(onLoadingProgress);
16536
+ React.useEffect(function () {
16537
+ onLoadingProgressRef.current = onLoadingProgress;
16538
+ }, [onLoadingProgress]);
16539
+ var onLoadingCompletedRef = React.useRef(onLoadingCompleted);
16540
+ React.useEffect(function () {
16541
+ onLoadingCompletedRef.current = onLoadingCompleted;
16542
+ }, [onLoadingCompleted]);
16468
16543
  var ready = sessionReady && modelsReady && cameraReady;
16469
16544
  React.useEffect(function () {
16470
- if (ready) return function () {
16471
- return null;
16472
- };
16545
+ var _a;
16546
+ if (ready) {
16547
+ (_a = onLoadingCompletedRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingCompletedRef);
16548
+ return function () {
16549
+ return null;
16550
+ };
16551
+ }
16473
16552
  var t = setTimeout(function () {
16474
16553
  return setDismissed(false);
16475
16554
  }, 500);
@@ -16478,6 +16557,19 @@
16478
16557
  };
16479
16558
  }, [ready]);
16480
16559
  var imageRef = React.useRef(null);
16560
+ var timeSinceWarmingStarted = modelWarmingStartedAt ? new Date().getTime() - modelWarmingStartedAt : 0;
16561
+ var warmingProgress = timeSinceWarmingStarted / 5000.0;
16562
+ var modelLoadProgress = modelsReady ? 100 : modelDownloadProgress * 0.5 + warmingProgress * 49.0;
16563
+ React.useEffect(function () {
16564
+ var _a;
16565
+ (_a = onLoadingStartedRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingStartedRef);
16566
+ }, []);
16567
+ React.useEffect(function () {
16568
+ var _a;
16569
+ if (modelLoadProgress > 0) {
16570
+ (_a = onLoadingProgressRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingProgressRef, modelLoadProgress);
16571
+ }
16572
+ }, [modelLoadProgress]);
16481
16573
  if (dismissed) return /*#__PURE__*/React.createElement(React.Fragment, null);
16482
16574
  if (cameraAccessDenied) {
16483
16575
  return /*#__PURE__*/React.createElement(CameraAccessDeniedOverlay, {
@@ -16537,7 +16629,7 @@
16537
16629
  }, /*#__PURE__*/React.createElement(ProgressBarBackground$1, {
16538
16630
  className: classNames.progressBackground
16539
16631
  }), /*#__PURE__*/React.createElement(LoadingOverlayProgressBar, {
16540
- "$progress": modelDownloadProgress,
16632
+ "$progress": modelLoadProgress,
16541
16633
  className: classNames.progressBar
16542
16634
  }, /*#__PURE__*/React.createElement(ProgressIndicator$1, {
16543
16635
  className: classNames.progressIndicator
@@ -16555,7 +16647,7 @@
16555
16647
  }, /*#__PURE__*/React.createElement(LoadingListItemIndicator, {
16556
16648
  className: classNames.loadingListItemIndicator,
16557
16649
  state: sessionReady && modelsReady ? 'done' : 'running'
16558
- }), !sessionReady ? verbiage.sessionCheckingText : modelsReady ? verbiage.modelsReadyText : modelDownloadProgress >= 100 ? verbiage.modelsWarmingUpText : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)")))), /*#__PURE__*/React.createElement(ContinueButtonContainer$1, {
16650
+ }), !sessionReady ? verbiage.sessionCheckingText : modelsReady ? verbiage.modelsReadyText : modelLoadState === 'downloading' ? "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)") : modelLoadState === 'warming' ? verbiage.modelsWarmingUpText : verbiage.modelsReadyText))), /*#__PURE__*/React.createElement(ContinueButtonContainer$1, {
16559
16651
  className: classNames.continueBtnContainer
16560
16652
  }, (ready || ((_g = (_f = theme.idCapture) === null || _f === void 0 ? void 0 : _f.loadingOverlay) === null || _g === void 0 ? void 0 : _g.displayDisabledContinueBtn)) && ( /*#__PURE__*/React.createElement(ContinueButton$1, {
16561
16653
  autoFocus: true,
@@ -16594,7 +16686,10 @@
16594
16686
  var _a, _b, _c, _d;
16595
16687
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarBackgroundOpacity) !== null && _d !== void 0 ? _d : 0.75;
16596
16688
  });
16597
- var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"], ["\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"])), progressBarAnimation);
16689
+ var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n background: ", ";\n"], ["\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n background: ", ";\n"])), progressBarAnimation, function (props) {
16690
+ var _a, _b, _c, _d;
16691
+ return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarIndicatorColor) !== null && _d !== void 0 ? _d : 'var(--idm-color-primary-500)';
16692
+ });
16598
16693
  var CustomLoadingGraphic$1 = styled.img(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
16599
16694
  var ContinueButtonContainer$1 = styled.div(templateObject_9$3 || (templateObject_9$3 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
16600
16695
  var ContinueButton$1 = styled(LoaderButton)(templateObject_10$1 || (templateObject_10$1 = __makeTemplateObject(["\n margin: auto;\n white-space: nowrap;\n ", "\n ", "\n \n &:focus-visible {\n ", "\n box-shadow: none;\n }\n\n &.disabled {\n background: ", ";\n color: ", ";\n border: ", ";\n }\n"], ["\n margin: auto;\n white-space: nowrap;\n ", "\n ", "\n \n &:focus-visible {\n ", "\n box-shadow: none;\n }\n\n &.disabled {\n background: ", ";\n color: ", ";\n border: ", ";\n }\n"])), function (props) {
@@ -19368,13 +19463,16 @@
19368
19463
 
19369
19464
  var IdCaptureWizard = function IdCaptureWizard(_a) {
19370
19465
  var _b, _c, _d, _e, _f;
19371
- var onSuccess = _a.onSuccess,
19466
+ var onLoadingStarted = _a.onLoadingStarted,
19467
+ onLoadingProgress = _a.onLoadingProgress,
19468
+ onLoadingCompleted = _a.onLoadingCompleted,
19469
+ onSuccess = _a.onSuccess,
19372
19470
  onExitCapture = _a.onExitCapture,
19373
19471
  onUserCancel = _a.onUserCancel,
19472
+ onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
19374
19473
  _g = _a.loadingOverlayMode,
19375
19474
  loadingOverlayMode = _g === void 0 ? 'default' : _g,
19376
19475
  customOverlayContent = _a.customOverlayContent,
19377
- onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
19378
19476
  precapturedDocuments = _a.precapturedDocuments,
19379
19477
  _h = _a.captureRequirement,
19380
19478
  captureRequirement = _h === void 0 ? 'idCardOrPassport' : _h,
@@ -19720,6 +19818,9 @@
19720
19818
  colors: colors.loadingOverlay,
19721
19819
  verbiage: verbiage.loadingOverlay,
19722
19820
  onUserCancel: onUserCancel,
19821
+ onLoadingStarted: onLoadingStarted,
19822
+ onLoadingProgress: onLoadingProgress,
19823
+ onLoadingCompleted: onLoadingCompleted,
19723
19824
  onDismissed: function onDismissed() {
19724
19825
  setOverlayDismissed(true);
19725
19826
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
@@ -20377,6 +20478,8 @@
20377
20478
  },
20378
20479
  ready: false,
20379
20480
  error: null,
20481
+ modelLoadState: 'not-started',
20482
+ modelWarmingStartedAt: null,
20380
20483
  modelDownloadProgress: 0
20381
20484
  });
20382
20485
  function SelfieGuidanceModelsProvider(_a) {
@@ -20408,7 +20511,9 @@
20408
20511
  videoRef: videoRef
20409
20512
  }),
20410
20513
  ready = _f.ready,
20514
+ modelLoadState = _f.modelLoadState,
20411
20515
  modelDownloadProgress = _f.modelDownloadProgress,
20516
+ modelWarmingStartedAt = _f.modelWarmingStartedAt,
20412
20517
  modelError = _f.modelError;
20413
20518
  var _g = useFrameLoop(React.useCallback(function () {
20414
20519
  return __awaiter(_this, void 0, void 0, function () {
@@ -20470,9 +20575,11 @@
20470
20575
  canvasRef: canvasRef,
20471
20576
  onPredictionMade: onPredictionMade,
20472
20577
  error: modelError,
20473
- modelDownloadProgress: modelDownloadProgress
20578
+ modelDownloadProgress: modelDownloadProgress,
20579
+ modelLoadState: modelLoadState,
20580
+ modelWarmingStartedAt: modelWarmingStartedAt
20474
20581
  };
20475
- }, [start, stop, ready, onPredictionMade, modelError, modelDownloadProgress]);
20582
+ }, [start, stop, ready, onPredictionMade, modelError, modelDownloadProgress, modelLoadState, modelWarmingStartedAt]);
20476
20583
  return /*#__PURE__*/React__namespace.createElement(SelfieGuidanceModelsContext.Provider, {
20477
20584
  value: value
20478
20585
  }, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
@@ -25636,6 +25743,9 @@
25636
25743
  allowOverrideWrongDocumentTypeAfterMs = _t === void 0 ? 8000 : _t,
25637
25744
  _u = _a.allowUploadingDocumentsFromStorage,
25638
25745
  allowUploadingDocumentsFromStorage = _u === void 0 ? false : _u,
25746
+ onLoadingStarted = _a.onLoadingStarted,
25747
+ onLoadingProgress = _a.onLoadingProgress,
25748
+ onLoadingCompleted = _a.onLoadingCompleted,
25639
25749
  onBeforeSubmit = _a.onBeforeSubmit,
25640
25750
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
25641
25751
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -25677,6 +25787,9 @@
25677
25787
  useDebugLogging(debugMode);
25678
25788
  var idCaptureProps = React.useMemo(function () {
25679
25789
  return {
25790
+ onLoadingStarted: onLoadingStarted,
25791
+ onLoadingProgress: onLoadingProgress,
25792
+ onLoadingCompleted: onLoadingCompleted,
25680
25793
  onExitCapture: onExitCapture,
25681
25794
  onUserCancel: onUserCancel,
25682
25795
  onModelError: onModelError,
@@ -25706,7 +25819,7 @@
25706
25819
  verbiage: verbiage,
25707
25820
  debugMode: debugMode
25708
25821
  };
25709
- }, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, allowSinglePageIdCapture, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, allowIdCardBackToFrontCapture, allowUploadingDocumentsFromStorage, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
25822
+ }, [onLoadingStarted, onLoadingProgress, onLoadingCompleted, onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, allowSinglePageIdCapture, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, allowIdCardBackToFrontCapture, allowUploadingDocumentsFromStorage, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
25710
25823
  var additionalDocumentCaptureProps = React.useMemo(function () {
25711
25824
  return {
25712
25825
  documents: captureAdditionalDocuments,