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
package/dist/sdk2.esm.js CHANGED
@@ -204,7 +204,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
204
204
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
205
205
  };
206
206
 
207
- var webSdkVersion = '2.3.6';
207
+ var webSdkVersion = '2.3.7';
208
208
 
209
209
  function getPlatform() {
210
210
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -496,11 +496,17 @@ var LoadingOverlayHeader = styled.div(templateObject_10$2 || (templateObject_10$
496
496
  });
497
497
  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"])));
498
498
  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"])));
499
- 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"])));
500
- 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) {
499
+ var LoadingOverlayProgressBarBackground = styled.div.attrs({
500
+ className: 'loading-overlay-progress-bar-background'
501
+ })(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"])));
502
+ var LoadingOverlayProgressBar = styled.span.attrs({
503
+ className: 'loading-overlay-progress-bar'
504
+ })(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) {
501
505
  return props.$progress;
502
506
  });
503
- 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);
507
+ var LoadingOverlayProgressIndicator = styled.span.attrs({
508
+ className: 'loading-overlay-progress-indicator'
509
+ })(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);
504
510
  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"])));
505
511
  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"])));
506
512
  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"])));
@@ -2472,19 +2478,23 @@ function useLoadFocusModel(_a) {
2472
2478
  videoRef = _a.videoRef,
2473
2479
  _d = _a.shouldLoadModels,
2474
2480
  shouldLoadModels = _d === void 0 ? true : _d;
2475
- var _e = useState(false),
2476
- ready = _e[0],
2477
- setReady = _e[1];
2481
+ var _e = useState('not-started'),
2482
+ modelLoadState = _e[0],
2483
+ setModelLoadState = _e[1];
2478
2484
  var _f = useState(0),
2479
2485
  modelDownloadProgress = _f[0],
2480
2486
  setModelDownloadProgress = _f[1];
2481
2487
  var _g = useState(null),
2482
- modelError = _g[0],
2483
- setModelError = _g[1];
2488
+ modelWarmingStartedAt = _g[0],
2489
+ setModelWarmingStartedAt = _g[1];
2490
+ var _h = useState(null),
2491
+ modelError = _h[0],
2492
+ setModelError = _h[1];
2484
2493
  useEffect(function loadModel() {
2485
2494
  var _this = this;
2486
2495
  if (!shouldLoadModels) return;
2487
- setReady(false);
2496
+ setModelLoadState('downloading');
2497
+ setModelWarmingStartedAt(null);
2488
2498
  function handleDownloadProgress(event) {
2489
2499
  setModelDownloadProgress(progressToPercentage(event.detail));
2490
2500
  }
@@ -2501,6 +2511,8 @@ function useLoadFocusModel(_a) {
2501
2511
  case 0:
2502
2512
  setModelDownloadProgress(100);
2503
2513
  clearTimeout(modelLoadTimeout);
2514
+ setModelLoadState('warming');
2515
+ setModelWarmingStartedAt(new Date().getTime());
2504
2516
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
2505
2517
  cancelled = false;
2506
2518
  cancelVideoReady = function cancelVideoReady() {
@@ -2513,7 +2525,7 @@ function useLoadFocusModel(_a) {
2513
2525
  setTimeout(function () {
2514
2526
  if (cancelled) return;
2515
2527
  loadedModel.classifyForVideo(videoRef.current, performance.now());
2516
- setReady(true);
2528
+ setModelLoadState('ready');
2517
2529
  }, 500);
2518
2530
  return [2 /*return*/];
2519
2531
  }
@@ -2521,6 +2533,7 @@ function useLoadFocusModel(_a) {
2521
2533
  });
2522
2534
  })["catch"](function (e) {
2523
2535
  setModelError(e);
2536
+ setModelLoadState('error');
2524
2537
  })["finally"](function () {
2525
2538
  clearTimeout(modelLoadTimeout);
2526
2539
  });
@@ -2535,11 +2548,15 @@ function useLoadFocusModel(_a) {
2535
2548
  useEffect(function handleModelError() {
2536
2549
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2537
2550
  }, [modelError, onModelError]);
2538
- return {
2539
- ready: ready,
2540
- modelDownloadProgress: modelDownloadProgress,
2541
- modelError: modelError
2542
- };
2551
+ return useMemo(function () {
2552
+ return {
2553
+ ready: modelLoadState === 'ready',
2554
+ modelLoadState: modelLoadState,
2555
+ modelDownloadProgress: modelDownloadProgress,
2556
+ modelWarmingStartedAt: modelWarmingStartedAt,
2557
+ modelError: modelError
2558
+ };
2559
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
2543
2560
  }
2544
2561
  var lastFocusPredictionAt = 0;
2545
2562
  var lastFocusPredictionTime = 0;
@@ -2631,18 +2648,22 @@ function useLoadFaceDetector(_a) {
2631
2648
  _b = _a.modelLoadTimeoutMs,
2632
2649
  modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
2633
2650
  videoRef = _a.videoRef;
2634
- var _c = useState(false),
2635
- ready = _c[0],
2636
- setReady = _c[1];
2651
+ var _c = useState('not-started'),
2652
+ modelLoadState = _c[0],
2653
+ setModelLoadState = _c[1];
2637
2654
  var _d = useState(0),
2638
2655
  modelDownloadProgress = _d[0],
2639
2656
  setModelDownloadProgress = _d[1];
2640
2657
  var _e = useState(null),
2641
- modelError = _e[0],
2642
- setModelError = _e[1];
2658
+ modelWarmingStartedAt = _e[0],
2659
+ setModelWarmingStartedAt = _e[1];
2660
+ var _f = useState(null),
2661
+ modelError = _f[0],
2662
+ setModelError = _f[1];
2643
2663
  useEffect(function loadModel() {
2644
2664
  var _this = this;
2645
- setReady(false);
2665
+ setModelLoadState('downloading');
2666
+ setModelWarmingStartedAt(null);
2646
2667
  var modelLoadTimeout = setTimeout(function () {
2647
2668
  setModelError(new Error('Model loading time limit exceeded.'));
2648
2669
  }, modelLoadTimeoutMs);
@@ -2659,6 +2680,8 @@ function useLoadFaceDetector(_a) {
2659
2680
  case 0:
2660
2681
  setModelDownloadProgress(100);
2661
2682
  clearTimeout(modelLoadTimeout);
2683
+ setModelLoadState('warming');
2684
+ setModelWarmingStartedAt(new Date().getTime());
2662
2685
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
2663
2686
  cancelled = false;
2664
2687
  cancelVideoReady = function cancelVideoReady() {
@@ -2670,13 +2693,14 @@ function useLoadFaceDetector(_a) {
2670
2693
  _b.sent();
2671
2694
  if (cancelled) return [2 /*return*/];
2672
2695
  model.detectForVideo(videoRef.current, performance.now());
2673
- setReady(true);
2696
+ setModelLoadState('ready');
2674
2697
  return [2 /*return*/];
2675
2698
  }
2676
2699
  });
2677
2700
  });
2678
2701
  })["catch"](function (e) {
2679
2702
  setModelError(e);
2703
+ setModelLoadState('error');
2680
2704
  })["finally"](function () {
2681
2705
  clearTimeout(modelLoadTimeout);
2682
2706
  });
@@ -2691,11 +2715,15 @@ function useLoadFaceDetector(_a) {
2691
2715
  useEffect(function handleModelError() {
2692
2716
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2693
2717
  }, [modelError, onModelError]);
2694
- return {
2695
- ready: ready,
2696
- modelDownloadProgress: modelDownloadProgress,
2697
- modelError: modelError
2698
- };
2718
+ return useMemo(function () {
2719
+ return {
2720
+ ready: modelLoadState === 'ready',
2721
+ modelLoadState: modelLoadState,
2722
+ modelDownloadProgress: modelDownloadProgress,
2723
+ modelWarmingStartedAt: modelWarmingStartedAt,
2724
+ modelError: modelError
2725
+ };
2726
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
2699
2727
  }
2700
2728
  var lastFaceDetectionAt = 0;
2701
2729
  var lastFaceDetectionTime = 0;
@@ -3137,19 +3165,23 @@ function useLoadDocumentDetector(_a) {
3137
3165
  scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
3138
3166
  onModelError = _a.onModelError,
3139
3167
  videoRef = _a.videoRef;
3140
- var _f = useState(false),
3141
- ready = _f[0],
3142
- setReady = _f[1];
3143
- var _g = useState(0),
3144
- modelDownloadProgress = _g[0],
3145
- setModelDownloadProgress = _g[1];
3146
- var _h = useState(null),
3147
- modelError = _h[0],
3148
- setModelError = _h[1];
3168
+ var _f = useState('not-started'),
3169
+ modelLoadState = _f[0],
3170
+ setModelLoadState = _f[1];
3171
+ var _g = useState(null),
3172
+ modelWarmingStartedAt = _g[0],
3173
+ setModelWarmingStartedAt = _g[1];
3174
+ var _h = useState(0),
3175
+ modelDownloadProgress = _h[0],
3176
+ setModelDownloadProgress = _h[1];
3177
+ var _j = useState(null),
3178
+ modelError = _j[0],
3179
+ setModelError = _j[1];
3149
3180
  useEffect(function loadModel() {
3150
3181
  var _this = this;
3151
3182
  if (!shouldLoadModels) return;
3152
- setReady(false);
3183
+ setModelLoadState('downloading');
3184
+ setModelWarmingStartedAt(null);
3153
3185
  function handleDownloadProgress(event) {
3154
3186
  setModelDownloadProgress(progressToPercentage(event.detail));
3155
3187
  }
@@ -3165,6 +3197,8 @@ function useLoadDocumentDetector(_a) {
3165
3197
  switch (_b.label) {
3166
3198
  case 0:
3167
3199
  setModelDownloadProgress(100);
3200
+ setModelLoadState('warming');
3201
+ setModelWarmingStartedAt(new Date().getTime());
3168
3202
  clearTimeout(modelLoadTimeout);
3169
3203
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
3170
3204
  cancelled = false;
@@ -3178,7 +3212,7 @@ function useLoadDocumentDetector(_a) {
3178
3212
  setTimeout(function () {
3179
3213
  if (cancelled) return;
3180
3214
  model.detectForVideo(videoRef.current, performance.now());
3181
- setReady(true);
3215
+ setModelLoadState('ready');
3182
3216
  }, 500);
3183
3217
  return [2 /*return*/];
3184
3218
  }
@@ -3186,6 +3220,7 @@ function useLoadDocumentDetector(_a) {
3186
3220
  });
3187
3221
  })["catch"](function (e) {
3188
3222
  setModelError(e);
3223
+ setModelLoadState('error');
3189
3224
  })["finally"](function () {
3190
3225
  clearTimeout(modelLoadTimeout);
3191
3226
  });
@@ -3200,12 +3235,16 @@ function useLoadDocumentDetector(_a) {
3200
3235
  useEffect(function handleModelError() {
3201
3236
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
3202
3237
  }, [modelError, onModelError]);
3203
- return {
3204
- ready: ready,
3205
- modelDownloadProgress: modelDownloadProgress,
3206
- modelError: modelError,
3207
- setModelError: setModelError
3208
- };
3238
+ return useMemo(function () {
3239
+ return {
3240
+ ready: modelLoadState === 'ready',
3241
+ modelLoadState: modelLoadState,
3242
+ modelDownloadProgress: modelDownloadProgress,
3243
+ modelWarmingStartedAt: modelWarmingStartedAt,
3244
+ modelError: modelError,
3245
+ setModelError: setModelError
3246
+ };
3247
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
3209
3248
  }
3210
3249
  function makeDocumentDetectorPrediction(frame) {
3211
3250
  return __awaiter(this, void 0, void 0, function () {
@@ -5169,8 +5208,9 @@ var DocumentDetectionModelContext = /*#__PURE__*/createContext({
5169
5208
  loadDocumentDetectionModel: function loadDocumentDetectionModel() {
5170
5209
  return null;
5171
5210
  },
5172
- documentDetectionModelReady: false,
5211
+ documentDetectionModelState: 'not-started',
5173
5212
  documentDetectionModelDownloadProgress: 0,
5213
+ documentDetectionModelWarmingStartedAt: null,
5174
5214
  documentDetectionModelError: null,
5175
5215
  onDocumentDetected: function onDocumentDetected() {
5176
5216
  return null;
@@ -5243,7 +5283,9 @@ function DocumentDetectionModelProvider(_a) {
5243
5283
  shouldLoadModels: shouldLoadModels
5244
5284
  }),
5245
5285
  ready = _q.ready,
5286
+ modelLoadState = _q.modelLoadState,
5246
5287
  modelDownloadProgress = _q.modelDownloadProgress,
5288
+ modelWarmingStartedAt = _q.modelWarmingStartedAt,
5247
5289
  modelError = _q.modelError,
5248
5290
  setModelError = _q.setModelError;
5249
5291
  var _r = useFrameLoop(useCallback(function (frameId, timeRunning) {
@@ -5310,7 +5352,8 @@ function DocumentDetectionModelProvider(_a) {
5310
5352
  startDocumentDetection: start,
5311
5353
  stopDocumentDetection: stop,
5312
5354
  loadDocumentDetectionModel: load,
5313
- documentDetectionModelReady: ready,
5355
+ documentDetectionModelState: modelLoadState,
5356
+ documentDetectionModelWarmingStartedAt: modelWarmingStartedAt,
5314
5357
  documentDetectionModelError: modelError,
5315
5358
  documentDetectionModelDownloadProgress: modelDownloadProgress,
5316
5359
  onDocumentDetected: onDocumentDetected,
@@ -5322,7 +5365,7 @@ function DocumentDetectionModelProvider(_a) {
5322
5365
  documentDetectionLastPredictionCanvas: lastPredictionCanvas,
5323
5366
  clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
5324
5367
  };
5325
- }, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
5368
+ }, [start, stop, load, modelLoadState, modelWarmingStartedAt, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
5326
5369
  return /*#__PURE__*/React.createElement(DocumentDetectionModelContext.Provider, {
5327
5370
  value: value
5328
5371
  }, /*#__PURE__*/React.createElement(InvisibleCanvas, {
@@ -5335,8 +5378,9 @@ var FocusModelContext = /*#__PURE__*/createContext({
5335
5378
  loadFocusModel: function loadFocusModel() {
5336
5379
  return null;
5337
5380
  },
5338
- focusModelReady: false,
5381
+ focusModelState: 'not-started',
5339
5382
  focusModelDownloadProgress: 0,
5383
+ focusModelWarmingStartedAt: null,
5340
5384
  focusModelError: null,
5341
5385
  focusThresholds: {},
5342
5386
  setFocusThresholds: function setFocusThresholds() {
@@ -5378,7 +5422,9 @@ function FocusModelProvider(_a) {
5378
5422
  shouldLoadModels: shouldLoadModels
5379
5423
  }),
5380
5424
  ready = _h.ready,
5425
+ modelLoadState = _h.modelLoadState,
5381
5426
  modelDownloadProgress = _h.modelDownloadProgress,
5427
+ modelWarmingStartedAt = _h.modelWarmingStartedAt,
5382
5428
  modelError = _h.modelError;
5383
5429
  var makeFocusPrediction = useCallback(function (imageData, box) {
5384
5430
  if (!ready) return null;
@@ -5390,15 +5436,16 @@ function FocusModelProvider(_a) {
5390
5436
  var value = useMemo(function () {
5391
5437
  return {
5392
5438
  loadFocusModel: load,
5393
- focusModelReady: ready,
5439
+ focusModelState: modelLoadState,
5394
5440
  focusModelDownloadProgress: modelDownloadProgress,
5441
+ focusModelWarmingStartedAt: modelWarmingStartedAt,
5395
5442
  focusModelError: modelError,
5396
5443
  makeFocusPrediction: makeFocusPrediction,
5397
5444
  focusPredictionTime: lastFocusPredictionTime,
5398
5445
  focusThresholds: focusThresholds,
5399
5446
  setFocusThresholds: setFocusThresholds
5400
5447
  };
5401
- }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
5448
+ }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, modelLoadState, modelWarmingStartedAt]);
5402
5449
  return /*#__PURE__*/React__default.createElement(FocusModelContext.Provider, {
5403
5450
  value: value
5404
5451
  }, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
@@ -5463,6 +5510,8 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
5463
5510
  return null;
5464
5511
  },
5465
5512
  modelDownloadProgress: 0,
5513
+ modelLoadState: 'not-started',
5514
+ modelWarmingStartedAt: null,
5466
5515
  modelError: null,
5467
5516
  thresholds: defaultIdCaptureThresholds,
5468
5517
  setThresholds: function setThresholds() {
@@ -5497,8 +5546,9 @@ function IdCaptureModelsProviderInner(_a) {
5497
5546
  _b = _a.allowSinglePageIdCapture,
5498
5547
  allowSinglePageIdCapture = _b === void 0 ? false : _b;
5499
5548
  var _c = useContext(DocumentDetectionModelContext),
5500
- documentDetectionModelReady = _c.documentDetectionModelReady,
5549
+ documentDetectionModelState = _c.documentDetectionModelState,
5501
5550
  documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
5551
+ documentDetectionModelWarmingStartedAt = _c.documentDetectionModelWarmingStartedAt,
5502
5552
  startDocumentDetection = _c.startDocumentDetection,
5503
5553
  stopDocumentDetection = _c.stopDocumentDetection,
5504
5554
  loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
@@ -5513,8 +5563,9 @@ function IdCaptureModelsProviderInner(_a) {
5513
5563
  documentDetectionModelError = _c.documentDetectionModelError;
5514
5564
  var _d = useContext(FocusModelContext),
5515
5565
  loadFocusModel = _d.loadFocusModel,
5516
- focusModelReady = _d.focusModelReady,
5566
+ focusModelState = _d.focusModelState,
5517
5567
  focusModelDownloadProgress = _d.focusModelDownloadProgress,
5568
+ focusModelWarmingStartedAt = _d.focusModelWarmingStartedAt,
5518
5569
  makeFocusPrediction = _d.makeFocusPrediction,
5519
5570
  focusThresholds = _d.focusThresholds,
5520
5571
  setFocusThresholds = _d.setFocusThresholds,
@@ -5622,10 +5673,17 @@ function IdCaptureModelsProviderInner(_a) {
5622
5673
  loadDocumentDetectionModel();
5623
5674
  loadFocusModel();
5624
5675
  }, [loadDocumentDetectionModel, loadFocusModel]);
5676
+ var ready = documentDetectionModelState === 'ready' && focusModelState === 'ready';
5677
+ var modelLoadState = ready ? 'ready' : documentDetectionModelState === 'warming' || focusModelState === 'warming' ? 'warming' : focusModelState === 'downloading' || documentDetectionModelState === 'downloading' ? 'downloading' : 'not-started';
5678
+ var modelWarmingStartedAt = !documentDetectionModelWarmingStartedAt && !focusModelWarmingStartedAt ? null : Math.min.apply(Math, [documentDetectionModelWarmingStartedAt, focusModelWarmingStartedAt].filter(function (v) {
5679
+ return v !== null;
5680
+ }));
5625
5681
  var value = useMemo(function () {
5626
5682
  return {
5627
- ready: documentDetectionModelReady && focusModelReady,
5683
+ ready: ready,
5628
5684
  modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
5685
+ modelLoadState: modelLoadState,
5686
+ modelWarmingStartedAt: modelWarmingStartedAt,
5629
5687
  modelError: modelError,
5630
5688
  start: startDocumentDetection,
5631
5689
  stop: stopDocumentDetection,
@@ -5643,7 +5701,7 @@ function IdCaptureModelsProviderInner(_a) {
5643
5701
  requiredDocumentType: requiredDocumentType,
5644
5702
  setRequiredDocumentType: setRequiredDocumentType
5645
5703
  };
5646
- }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
5704
+ }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, focusModelDownloadProgress, focusPredictionTime, getBestFrame, load, modelLoadState, modelError, modelWarmingStartedAt, onPredictionMade, ready, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
5647
5705
  return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
5648
5706
  value: value
5649
5707
  }, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
@@ -7286,7 +7344,10 @@ function LoadingListItemIndicator(_a) {
7286
7344
  var legacyInstructionImageUrl$1 = "".concat(DEFAULT_CDN_URL, "/WebSDK-Instruction-DL-Capture-3-Portrait.png");
7287
7345
  var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a) {
7288
7346
  var _b, _c, _d, _e, _f, _g;
7289
- var onDismissed = _a.onDismissed,
7347
+ var onLoadingStarted = _a.onLoadingStarted,
7348
+ onLoadingProgress = _a.onLoadingProgress,
7349
+ onLoadingCompleted = _a.onLoadingCompleted,
7350
+ onDismissed = _a.onDismissed,
7290
7351
  onUserCancel = _a.onUserCancel,
7291
7352
  instructions = _a.instructions,
7292
7353
  _h = _a.rotateImage,
@@ -7304,7 +7365,9 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7304
7365
  var sessionReady = sessionCheckState === 'PASSED';
7305
7366
  var _o = useIdCaptureModelsContext(),
7306
7367
  modelsReady = _o.ready,
7307
- modelDownloadProgress = _o.modelDownloadProgress;
7368
+ modelLoadState = _o.modelLoadState,
7369
+ modelDownloadProgress = _o.modelDownloadProgress,
7370
+ modelWarmingStartedAt = _o.modelWarmingStartedAt;
7308
7371
  var _p = useCameraStore(),
7309
7372
  cameraReady = _p.cameraReady,
7310
7373
  cameraAccessDenied = _p.cameraAccessDenied,
@@ -7327,11 +7390,27 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7327
7390
  pleaseWaitText: 'Please wait...',
7328
7391
  sessionCheckingText: 'Authenticating...'
7329
7392
  });
7393
+ var onLoadingStartedRef = useRef(onLoadingStarted);
7394
+ useEffect(function () {
7395
+ onLoadingStartedRef.current = onLoadingStarted;
7396
+ }, [onLoadingStarted]);
7397
+ var onLoadingProgressRef = useRef(onLoadingProgress);
7398
+ useEffect(function () {
7399
+ onLoadingProgressRef.current = onLoadingProgress;
7400
+ }, [onLoadingProgress]);
7401
+ var onLoadingCompletedRef = useRef(onLoadingCompleted);
7402
+ useEffect(function () {
7403
+ onLoadingCompletedRef.current = onLoadingCompleted;
7404
+ }, [onLoadingCompleted]);
7330
7405
  var ready = sessionReady && modelsReady && cameraReady;
7331
7406
  useEffect(function () {
7332
- if (ready) return function () {
7333
- return null;
7334
- };
7407
+ var _a;
7408
+ if (ready) {
7409
+ (_a = onLoadingCompletedRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingCompletedRef);
7410
+ return function () {
7411
+ return null;
7412
+ };
7413
+ }
7335
7414
  var t = setTimeout(function () {
7336
7415
  return setDismissed(false);
7337
7416
  }, 500);
@@ -7340,6 +7419,19 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7340
7419
  };
7341
7420
  }, [ready]);
7342
7421
  var imageRef = useRef(null);
7422
+ var timeSinceWarmingStarted = modelWarmingStartedAt ? new Date().getTime() - modelWarmingStartedAt : 0;
7423
+ var warmingProgress = timeSinceWarmingStarted / 5000.0;
7424
+ var modelLoadProgress = modelsReady ? 100 : modelDownloadProgress * 0.5 + warmingProgress * 49.0;
7425
+ useEffect(function () {
7426
+ var _a;
7427
+ (_a = onLoadingStartedRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingStartedRef);
7428
+ }, []);
7429
+ useEffect(function () {
7430
+ var _a;
7431
+ if (modelLoadProgress > 0) {
7432
+ (_a = onLoadingProgressRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingProgressRef, modelLoadProgress);
7433
+ }
7434
+ }, [modelLoadProgress]);
7343
7435
  if (dismissed) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
7344
7436
  if (cameraAccessDenied) {
7345
7437
  return /*#__PURE__*/React__default.createElement(CameraAccessDeniedOverlay, {
@@ -7399,7 +7491,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7399
7491
  }, /*#__PURE__*/React__default.createElement(ProgressBarBackground$1, {
7400
7492
  className: classNames.progressBackground
7401
7493
  }), /*#__PURE__*/React__default.createElement(LoadingOverlayProgressBar, {
7402
- "$progress": modelDownloadProgress,
7494
+ "$progress": modelLoadProgress,
7403
7495
  className: classNames.progressBar
7404
7496
  }, /*#__PURE__*/React__default.createElement(ProgressIndicator$1, {
7405
7497
  className: classNames.progressIndicator
@@ -7417,7 +7509,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7417
7509
  }, /*#__PURE__*/React__default.createElement(LoadingListItemIndicator, {
7418
7510
  className: classNames.loadingListItemIndicator,
7419
7511
  state: sessionReady && modelsReady ? 'done' : 'running'
7420
- }), !sessionReady ? verbiage.sessionCheckingText : modelsReady ? verbiage.modelsReadyText : modelDownloadProgress >= 100 ? verbiage.modelsWarmingUpText : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)")))), /*#__PURE__*/React__default.createElement(ContinueButtonContainer$1, {
7512
+ }), !sessionReady ? verbiage.sessionCheckingText : modelsReady ? verbiage.modelsReadyText : modelLoadState === 'downloading' ? "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)") : modelLoadState === 'warming' ? verbiage.modelsWarmingUpText : verbiage.modelsReadyText))), /*#__PURE__*/React__default.createElement(ContinueButtonContainer$1, {
7421
7513
  className: classNames.continueBtnContainer
7422
7514
  }, (ready || ((_g = (_f = theme.idCapture) === null || _f === void 0 ? void 0 : _f.loadingOverlay) === null || _g === void 0 ? void 0 : _g.displayDisabledContinueBtn)) && ( /*#__PURE__*/React__default.createElement(ContinueButton$1, {
7423
7515
  autoFocus: true,
@@ -7456,7 +7548,10 @@ var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templa
7456
7548
  var _a, _b, _c, _d;
7457
7549
  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;
7458
7550
  });
7459
- 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);
7551
+ 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) {
7552
+ var _a, _b, _c, _d;
7553
+ 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)';
7554
+ });
7460
7555
  var CustomLoadingGraphic$1 = styled.img(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
7461
7556
  var ContinueButtonContainer$1 = styled.div(templateObject_9$3 || (templateObject_9$3 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
7462
7557
  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) {
@@ -10230,13 +10325,16 @@ var templateObject_1$p, templateObject_2$l, templateObject_3$f, templateObject_4
10230
10325
 
10231
10326
  var IdCaptureWizard = function IdCaptureWizard(_a) {
10232
10327
  var _b, _c, _d, _e, _f;
10233
- var onSuccess = _a.onSuccess,
10328
+ var onLoadingStarted = _a.onLoadingStarted,
10329
+ onLoadingProgress = _a.onLoadingProgress,
10330
+ onLoadingCompleted = _a.onLoadingCompleted,
10331
+ onSuccess = _a.onSuccess,
10234
10332
  onExitCapture = _a.onExitCapture,
10235
10333
  onUserCancel = _a.onUserCancel,
10334
+ onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
10236
10335
  _g = _a.loadingOverlayMode,
10237
10336
  loadingOverlayMode = _g === void 0 ? 'default' : _g,
10238
10337
  customOverlayContent = _a.customOverlayContent,
10239
- onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
10240
10338
  precapturedDocuments = _a.precapturedDocuments,
10241
10339
  _h = _a.captureRequirement,
10242
10340
  captureRequirement = _h === void 0 ? 'idCardOrPassport' : _h,
@@ -10582,6 +10680,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
10582
10680
  colors: colors.loadingOverlay,
10583
10681
  verbiage: verbiage.loadingOverlay,
10584
10682
  onUserCancel: onUserCancel,
10683
+ onLoadingStarted: onLoadingStarted,
10684
+ onLoadingProgress: onLoadingProgress,
10685
+ onLoadingCompleted: onLoadingCompleted,
10585
10686
  onDismissed: function onDismissed() {
10586
10687
  setOverlayDismissed(true);
10587
10688
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
@@ -11239,6 +11340,8 @@ var SelfieGuidanceModelsContext = /*#__PURE__*/createContext({
11239
11340
  },
11240
11341
  ready: false,
11241
11342
  error: null,
11343
+ modelLoadState: 'not-started',
11344
+ modelWarmingStartedAt: null,
11242
11345
  modelDownloadProgress: 0
11243
11346
  });
11244
11347
  function SelfieGuidanceModelsProvider(_a) {
@@ -11270,7 +11373,9 @@ function SelfieGuidanceModelsProvider(_a) {
11270
11373
  videoRef: videoRef
11271
11374
  }),
11272
11375
  ready = _f.ready,
11376
+ modelLoadState = _f.modelLoadState,
11273
11377
  modelDownloadProgress = _f.modelDownloadProgress,
11378
+ modelWarmingStartedAt = _f.modelWarmingStartedAt,
11274
11379
  modelError = _f.modelError;
11275
11380
  var _g = useFrameLoop(useCallback(function () {
11276
11381
  return __awaiter(_this, void 0, void 0, function () {
@@ -11332,9 +11437,11 @@ function SelfieGuidanceModelsProvider(_a) {
11332
11437
  canvasRef: canvasRef,
11333
11438
  onPredictionMade: onPredictionMade,
11334
11439
  error: modelError,
11335
- modelDownloadProgress: modelDownloadProgress
11440
+ modelDownloadProgress: modelDownloadProgress,
11441
+ modelLoadState: modelLoadState,
11442
+ modelWarmingStartedAt: modelWarmingStartedAt
11336
11443
  };
11337
- }, [start, stop, ready, onPredictionMade, modelError, modelDownloadProgress]);
11444
+ }, [start, stop, ready, onPredictionMade, modelError, modelDownloadProgress, modelLoadState, modelWarmingStartedAt]);
11338
11445
  return /*#__PURE__*/React.createElement(SelfieGuidanceModelsContext.Provider, {
11339
11446
  value: value
11340
11447
  }, /*#__PURE__*/React.createElement(InvisibleCanvas, {
@@ -15730,6 +15837,9 @@ var IdValidation = function IdValidation(_a) {
15730
15837
  allowOverrideWrongDocumentTypeAfterMs = _t === void 0 ? 8000 : _t,
15731
15838
  _u = _a.allowUploadingDocumentsFromStorage,
15732
15839
  allowUploadingDocumentsFromStorage = _u === void 0 ? false : _u,
15840
+ onLoadingStarted = _a.onLoadingStarted,
15841
+ onLoadingProgress = _a.onLoadingProgress,
15842
+ onLoadingCompleted = _a.onLoadingCompleted,
15733
15843
  onBeforeSubmit = _a.onBeforeSubmit,
15734
15844
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
15735
15845
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -15771,6 +15881,9 @@ var IdValidation = function IdValidation(_a) {
15771
15881
  useDebugLogging(debugMode);
15772
15882
  var idCaptureProps = useMemo(function () {
15773
15883
  return {
15884
+ onLoadingStarted: onLoadingStarted,
15885
+ onLoadingProgress: onLoadingProgress,
15886
+ onLoadingCompleted: onLoadingCompleted,
15774
15887
  onExitCapture: onExitCapture,
15775
15888
  onUserCancel: onUserCancel,
15776
15889
  onModelError: onModelError,
@@ -15800,7 +15913,7 @@ var IdValidation = function IdValidation(_a) {
15800
15913
  verbiage: verbiage,
15801
15914
  debugMode: debugMode
15802
15915
  };
15803
- }, [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]);
15916
+ }, [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]);
15804
15917
  var additionalDocumentCaptureProps = useMemo(function () {
15805
15918
  return {
15806
15919
  documents: captureAdditionalDocuments,