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
@@ -235,7 +235,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
235
235
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
236
236
  };
237
237
 
238
- var webSdkVersion = '2.3.6';
238
+ var webSdkVersion = '2.3.7';
239
239
 
240
240
  function getPlatform() {
241
241
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -527,11 +527,17 @@ var LoadingOverlayHeader = styled__default.default.div(templateObject_10$2 || (t
527
527
  });
528
528
  var LoadingOverlayGuidanceMessage = styled__default.default(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"])));
529
529
  var LoadingOverlayImageContainer = styled__default.default(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"])));
530
- var LoadingOverlayProgressBarBackground = styled__default.default.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"])));
531
- var LoadingOverlayProgressBar = styled__default.default.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) {
530
+ var LoadingOverlayProgressBarBackground = styled__default.default.div.attrs({
531
+ className: 'loading-overlay-progress-bar-background'
532
+ })(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"])));
533
+ var LoadingOverlayProgressBar = styled__default.default.span.attrs({
534
+ className: 'loading-overlay-progress-bar'
535
+ })(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) {
532
536
  return props.$progress;
533
537
  });
534
- var LoadingOverlayProgressIndicator = styled__default.default.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);
538
+ var LoadingOverlayProgressIndicator = styled__default.default.span.attrs({
539
+ className: 'loading-overlay-progress-indicator'
540
+ })(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);
535
541
  var LoadingOverlayButtonsRow = styled__default.default(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"])));
536
542
  var LoadingOverlayLoadingListContainer = styled__default.default.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"])));
537
543
  var LoadingOverlayLoadingList = styled__default.default.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"])));
@@ -2503,19 +2509,23 @@ function useLoadFocusModel(_a) {
2503
2509
  videoRef = _a.videoRef,
2504
2510
  _d = _a.shouldLoadModels,
2505
2511
  shouldLoadModels = _d === void 0 ? true : _d;
2506
- var _e = React.useState(false),
2507
- ready = _e[0],
2508
- setReady = _e[1];
2512
+ var _e = React.useState('not-started'),
2513
+ modelLoadState = _e[0],
2514
+ setModelLoadState = _e[1];
2509
2515
  var _f = React.useState(0),
2510
2516
  modelDownloadProgress = _f[0],
2511
2517
  setModelDownloadProgress = _f[1];
2512
2518
  var _g = React.useState(null),
2513
- modelError = _g[0],
2514
- setModelError = _g[1];
2519
+ modelWarmingStartedAt = _g[0],
2520
+ setModelWarmingStartedAt = _g[1];
2521
+ var _h = React.useState(null),
2522
+ modelError = _h[0],
2523
+ setModelError = _h[1];
2515
2524
  React.useEffect(function loadModel() {
2516
2525
  var _this = this;
2517
2526
  if (!shouldLoadModels) return;
2518
- setReady(false);
2527
+ setModelLoadState('downloading');
2528
+ setModelWarmingStartedAt(null);
2519
2529
  function handleDownloadProgress(event) {
2520
2530
  setModelDownloadProgress(progressToPercentage(event.detail));
2521
2531
  }
@@ -2532,6 +2542,8 @@ function useLoadFocusModel(_a) {
2532
2542
  case 0:
2533
2543
  setModelDownloadProgress(100);
2534
2544
  clearTimeout(modelLoadTimeout);
2545
+ setModelLoadState('warming');
2546
+ setModelWarmingStartedAt(new Date().getTime());
2535
2547
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
2536
2548
  cancelled = false;
2537
2549
  cancelVideoReady = function cancelVideoReady() {
@@ -2544,7 +2556,7 @@ function useLoadFocusModel(_a) {
2544
2556
  setTimeout(function () {
2545
2557
  if (cancelled) return;
2546
2558
  loadedModel.classifyForVideo(videoRef.current, performance.now());
2547
- setReady(true);
2559
+ setModelLoadState('ready');
2548
2560
  }, 500);
2549
2561
  return [2 /*return*/];
2550
2562
  }
@@ -2552,6 +2564,7 @@ function useLoadFocusModel(_a) {
2552
2564
  });
2553
2565
  })["catch"](function (e) {
2554
2566
  setModelError(e);
2567
+ setModelLoadState('error');
2555
2568
  })["finally"](function () {
2556
2569
  clearTimeout(modelLoadTimeout);
2557
2570
  });
@@ -2566,11 +2579,15 @@ function useLoadFocusModel(_a) {
2566
2579
  React.useEffect(function handleModelError() {
2567
2580
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2568
2581
  }, [modelError, onModelError]);
2569
- return {
2570
- ready: ready,
2571
- modelDownloadProgress: modelDownloadProgress,
2572
- modelError: modelError
2573
- };
2582
+ return React.useMemo(function () {
2583
+ return {
2584
+ ready: modelLoadState === 'ready',
2585
+ modelLoadState: modelLoadState,
2586
+ modelDownloadProgress: modelDownloadProgress,
2587
+ modelWarmingStartedAt: modelWarmingStartedAt,
2588
+ modelError: modelError
2589
+ };
2590
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
2574
2591
  }
2575
2592
  var lastFocusPredictionAt = 0;
2576
2593
  var lastFocusPredictionTime = 0;
@@ -2662,18 +2679,22 @@ function useLoadFaceDetector(_a) {
2662
2679
  _b = _a.modelLoadTimeoutMs,
2663
2680
  modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
2664
2681
  videoRef = _a.videoRef;
2665
- var _c = React.useState(false),
2666
- ready = _c[0],
2667
- setReady = _c[1];
2682
+ var _c = React.useState('not-started'),
2683
+ modelLoadState = _c[0],
2684
+ setModelLoadState = _c[1];
2668
2685
  var _d = React.useState(0),
2669
2686
  modelDownloadProgress = _d[0],
2670
2687
  setModelDownloadProgress = _d[1];
2671
2688
  var _e = React.useState(null),
2672
- modelError = _e[0],
2673
- setModelError = _e[1];
2689
+ modelWarmingStartedAt = _e[0],
2690
+ setModelWarmingStartedAt = _e[1];
2691
+ var _f = React.useState(null),
2692
+ modelError = _f[0],
2693
+ setModelError = _f[1];
2674
2694
  React.useEffect(function loadModel() {
2675
2695
  var _this = this;
2676
- setReady(false);
2696
+ setModelLoadState('downloading');
2697
+ setModelWarmingStartedAt(null);
2677
2698
  var modelLoadTimeout = setTimeout(function () {
2678
2699
  setModelError(new Error('Model loading time limit exceeded.'));
2679
2700
  }, modelLoadTimeoutMs);
@@ -2690,6 +2711,8 @@ function useLoadFaceDetector(_a) {
2690
2711
  case 0:
2691
2712
  setModelDownloadProgress(100);
2692
2713
  clearTimeout(modelLoadTimeout);
2714
+ setModelLoadState('warming');
2715
+ setModelWarmingStartedAt(new Date().getTime());
2693
2716
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
2694
2717
  cancelled = false;
2695
2718
  cancelVideoReady = function cancelVideoReady() {
@@ -2701,13 +2724,14 @@ function useLoadFaceDetector(_a) {
2701
2724
  _b.sent();
2702
2725
  if (cancelled) return [2 /*return*/];
2703
2726
  model.detectForVideo(videoRef.current, performance.now());
2704
- setReady(true);
2727
+ setModelLoadState('ready');
2705
2728
  return [2 /*return*/];
2706
2729
  }
2707
2730
  });
2708
2731
  });
2709
2732
  })["catch"](function (e) {
2710
2733
  setModelError(e);
2734
+ setModelLoadState('error');
2711
2735
  })["finally"](function () {
2712
2736
  clearTimeout(modelLoadTimeout);
2713
2737
  });
@@ -2722,11 +2746,15 @@ function useLoadFaceDetector(_a) {
2722
2746
  React.useEffect(function handleModelError() {
2723
2747
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2724
2748
  }, [modelError, onModelError]);
2725
- return {
2726
- ready: ready,
2727
- modelDownloadProgress: modelDownloadProgress,
2728
- modelError: modelError
2729
- };
2749
+ return React.useMemo(function () {
2750
+ return {
2751
+ ready: modelLoadState === 'ready',
2752
+ modelLoadState: modelLoadState,
2753
+ modelDownloadProgress: modelDownloadProgress,
2754
+ modelWarmingStartedAt: modelWarmingStartedAt,
2755
+ modelError: modelError
2756
+ };
2757
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
2730
2758
  }
2731
2759
  var lastFaceDetectionAt = 0;
2732
2760
  var lastFaceDetectionTime = 0;
@@ -3168,19 +3196,23 @@ function useLoadDocumentDetector(_a) {
3168
3196
  scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
3169
3197
  onModelError = _a.onModelError,
3170
3198
  videoRef = _a.videoRef;
3171
- var _f = React.useState(false),
3172
- ready = _f[0],
3173
- setReady = _f[1];
3174
- var _g = React.useState(0),
3175
- modelDownloadProgress = _g[0],
3176
- setModelDownloadProgress = _g[1];
3177
- var _h = React.useState(null),
3178
- modelError = _h[0],
3179
- setModelError = _h[1];
3199
+ var _f = React.useState('not-started'),
3200
+ modelLoadState = _f[0],
3201
+ setModelLoadState = _f[1];
3202
+ var _g = React.useState(null),
3203
+ modelWarmingStartedAt = _g[0],
3204
+ setModelWarmingStartedAt = _g[1];
3205
+ var _h = React.useState(0),
3206
+ modelDownloadProgress = _h[0],
3207
+ setModelDownloadProgress = _h[1];
3208
+ var _j = React.useState(null),
3209
+ modelError = _j[0],
3210
+ setModelError = _j[1];
3180
3211
  React.useEffect(function loadModel() {
3181
3212
  var _this = this;
3182
3213
  if (!shouldLoadModels) return;
3183
- setReady(false);
3214
+ setModelLoadState('downloading');
3215
+ setModelWarmingStartedAt(null);
3184
3216
  function handleDownloadProgress(event) {
3185
3217
  setModelDownloadProgress(progressToPercentage(event.detail));
3186
3218
  }
@@ -3196,6 +3228,8 @@ function useLoadDocumentDetector(_a) {
3196
3228
  switch (_b.label) {
3197
3229
  case 0:
3198
3230
  setModelDownloadProgress(100);
3231
+ setModelLoadState('warming');
3232
+ setModelWarmingStartedAt(new Date().getTime());
3199
3233
  clearTimeout(modelLoadTimeout);
3200
3234
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
3201
3235
  cancelled = false;
@@ -3209,7 +3243,7 @@ function useLoadDocumentDetector(_a) {
3209
3243
  setTimeout(function () {
3210
3244
  if (cancelled) return;
3211
3245
  model.detectForVideo(videoRef.current, performance.now());
3212
- setReady(true);
3246
+ setModelLoadState('ready');
3213
3247
  }, 500);
3214
3248
  return [2 /*return*/];
3215
3249
  }
@@ -3217,6 +3251,7 @@ function useLoadDocumentDetector(_a) {
3217
3251
  });
3218
3252
  })["catch"](function (e) {
3219
3253
  setModelError(e);
3254
+ setModelLoadState('error');
3220
3255
  })["finally"](function () {
3221
3256
  clearTimeout(modelLoadTimeout);
3222
3257
  });
@@ -3231,12 +3266,16 @@ function useLoadDocumentDetector(_a) {
3231
3266
  React.useEffect(function handleModelError() {
3232
3267
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
3233
3268
  }, [modelError, onModelError]);
3234
- return {
3235
- ready: ready,
3236
- modelDownloadProgress: modelDownloadProgress,
3237
- modelError: modelError,
3238
- setModelError: setModelError
3239
- };
3269
+ return React.useMemo(function () {
3270
+ return {
3271
+ ready: modelLoadState === 'ready',
3272
+ modelLoadState: modelLoadState,
3273
+ modelDownloadProgress: modelDownloadProgress,
3274
+ modelWarmingStartedAt: modelWarmingStartedAt,
3275
+ modelError: modelError,
3276
+ setModelError: setModelError
3277
+ };
3278
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
3240
3279
  }
3241
3280
  function makeDocumentDetectorPrediction(frame) {
3242
3281
  return __awaiter(this, void 0, void 0, function () {
@@ -5200,8 +5239,9 @@ var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
5200
5239
  loadDocumentDetectionModel: function loadDocumentDetectionModel() {
5201
5240
  return null;
5202
5241
  },
5203
- documentDetectionModelReady: false,
5242
+ documentDetectionModelState: 'not-started',
5204
5243
  documentDetectionModelDownloadProgress: 0,
5244
+ documentDetectionModelWarmingStartedAt: null,
5205
5245
  documentDetectionModelError: null,
5206
5246
  onDocumentDetected: function onDocumentDetected() {
5207
5247
  return null;
@@ -5274,7 +5314,9 @@ function DocumentDetectionModelProvider(_a) {
5274
5314
  shouldLoadModels: shouldLoadModels
5275
5315
  }),
5276
5316
  ready = _q.ready,
5317
+ modelLoadState = _q.modelLoadState,
5277
5318
  modelDownloadProgress = _q.modelDownloadProgress,
5319
+ modelWarmingStartedAt = _q.modelWarmingStartedAt,
5278
5320
  modelError = _q.modelError,
5279
5321
  setModelError = _q.setModelError;
5280
5322
  var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
@@ -5341,7 +5383,8 @@ function DocumentDetectionModelProvider(_a) {
5341
5383
  startDocumentDetection: start,
5342
5384
  stopDocumentDetection: stop,
5343
5385
  loadDocumentDetectionModel: load,
5344
- documentDetectionModelReady: ready,
5386
+ documentDetectionModelState: modelLoadState,
5387
+ documentDetectionModelWarmingStartedAt: modelWarmingStartedAt,
5345
5388
  documentDetectionModelError: modelError,
5346
5389
  documentDetectionModelDownloadProgress: modelDownloadProgress,
5347
5390
  onDocumentDetected: onDocumentDetected,
@@ -5353,7 +5396,7 @@ function DocumentDetectionModelProvider(_a) {
5353
5396
  documentDetectionLastPredictionCanvas: lastPredictionCanvas,
5354
5397
  clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
5355
5398
  };
5356
- }, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
5399
+ }, [start, stop, load, modelLoadState, modelWarmingStartedAt, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
5357
5400
  return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
5358
5401
  value: value
5359
5402
  }, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
@@ -5366,8 +5409,9 @@ var FocusModelContext = /*#__PURE__*/React.createContext({
5366
5409
  loadFocusModel: function loadFocusModel() {
5367
5410
  return null;
5368
5411
  },
5369
- focusModelReady: false,
5412
+ focusModelState: 'not-started',
5370
5413
  focusModelDownloadProgress: 0,
5414
+ focusModelWarmingStartedAt: null,
5371
5415
  focusModelError: null,
5372
5416
  focusThresholds: {},
5373
5417
  setFocusThresholds: function setFocusThresholds() {
@@ -5409,7 +5453,9 @@ function FocusModelProvider(_a) {
5409
5453
  shouldLoadModels: shouldLoadModels
5410
5454
  }),
5411
5455
  ready = _h.ready,
5456
+ modelLoadState = _h.modelLoadState,
5412
5457
  modelDownloadProgress = _h.modelDownloadProgress,
5458
+ modelWarmingStartedAt = _h.modelWarmingStartedAt,
5413
5459
  modelError = _h.modelError;
5414
5460
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
5415
5461
  if (!ready) return null;
@@ -5421,15 +5467,16 @@ function FocusModelProvider(_a) {
5421
5467
  var value = React.useMemo(function () {
5422
5468
  return {
5423
5469
  loadFocusModel: load,
5424
- focusModelReady: ready,
5470
+ focusModelState: modelLoadState,
5425
5471
  focusModelDownloadProgress: modelDownloadProgress,
5472
+ focusModelWarmingStartedAt: modelWarmingStartedAt,
5426
5473
  focusModelError: modelError,
5427
5474
  makeFocusPrediction: makeFocusPrediction,
5428
5475
  focusPredictionTime: lastFocusPredictionTime,
5429
5476
  focusThresholds: focusThresholds,
5430
5477
  setFocusThresholds: setFocusThresholds
5431
5478
  };
5432
- }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
5479
+ }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, modelLoadState, modelWarmingStartedAt]);
5433
5480
  return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
5434
5481
  value: value
5435
5482
  }, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
@@ -5494,6 +5541,8 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
5494
5541
  return null;
5495
5542
  },
5496
5543
  modelDownloadProgress: 0,
5544
+ modelLoadState: 'not-started',
5545
+ modelWarmingStartedAt: null,
5497
5546
  modelError: null,
5498
5547
  thresholds: defaultIdCaptureThresholds,
5499
5548
  setThresholds: function setThresholds() {
@@ -5528,8 +5577,9 @@ function IdCaptureModelsProviderInner(_a) {
5528
5577
  _b = _a.allowSinglePageIdCapture,
5529
5578
  allowSinglePageIdCapture = _b === void 0 ? false : _b;
5530
5579
  var _c = React.useContext(DocumentDetectionModelContext),
5531
- documentDetectionModelReady = _c.documentDetectionModelReady,
5580
+ documentDetectionModelState = _c.documentDetectionModelState,
5532
5581
  documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
5582
+ documentDetectionModelWarmingStartedAt = _c.documentDetectionModelWarmingStartedAt,
5533
5583
  startDocumentDetection = _c.startDocumentDetection,
5534
5584
  stopDocumentDetection = _c.stopDocumentDetection,
5535
5585
  loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
@@ -5544,8 +5594,9 @@ function IdCaptureModelsProviderInner(_a) {
5544
5594
  documentDetectionModelError = _c.documentDetectionModelError;
5545
5595
  var _d = React.useContext(FocusModelContext),
5546
5596
  loadFocusModel = _d.loadFocusModel,
5547
- focusModelReady = _d.focusModelReady,
5597
+ focusModelState = _d.focusModelState,
5548
5598
  focusModelDownloadProgress = _d.focusModelDownloadProgress,
5599
+ focusModelWarmingStartedAt = _d.focusModelWarmingStartedAt,
5549
5600
  makeFocusPrediction = _d.makeFocusPrediction,
5550
5601
  focusThresholds = _d.focusThresholds,
5551
5602
  setFocusThresholds = _d.setFocusThresholds,
@@ -5653,10 +5704,17 @@ function IdCaptureModelsProviderInner(_a) {
5653
5704
  loadDocumentDetectionModel();
5654
5705
  loadFocusModel();
5655
5706
  }, [loadDocumentDetectionModel, loadFocusModel]);
5707
+ var ready = documentDetectionModelState === 'ready' && focusModelState === 'ready';
5708
+ var modelLoadState = ready ? 'ready' : documentDetectionModelState === 'warming' || focusModelState === 'warming' ? 'warming' : focusModelState === 'downloading' || documentDetectionModelState === 'downloading' ? 'downloading' : 'not-started';
5709
+ var modelWarmingStartedAt = !documentDetectionModelWarmingStartedAt && !focusModelWarmingStartedAt ? null : Math.min.apply(Math, [documentDetectionModelWarmingStartedAt, focusModelWarmingStartedAt].filter(function (v) {
5710
+ return v !== null;
5711
+ }));
5656
5712
  var value = React.useMemo(function () {
5657
5713
  return {
5658
- ready: documentDetectionModelReady && focusModelReady,
5714
+ ready: ready,
5659
5715
  modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
5716
+ modelLoadState: modelLoadState,
5717
+ modelWarmingStartedAt: modelWarmingStartedAt,
5660
5718
  modelError: modelError,
5661
5719
  start: startDocumentDetection,
5662
5720
  stop: stopDocumentDetection,
@@ -5674,7 +5732,7 @@ function IdCaptureModelsProviderInner(_a) {
5674
5732
  requiredDocumentType: requiredDocumentType,
5675
5733
  setRequiredDocumentType: setRequiredDocumentType
5676
5734
  };
5677
- }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
5735
+ }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, focusModelDownloadProgress, focusPredictionTime, getBestFrame, load, modelLoadState, modelError, modelWarmingStartedAt, onPredictionMade, ready, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
5678
5736
  return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
5679
5737
  value: value
5680
5738
  }, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
@@ -7317,7 +7375,10 @@ function LoadingListItemIndicator(_a) {
7317
7375
  var legacyInstructionImageUrl$1 = "".concat(DEFAULT_CDN_URL, "/WebSDK-Instruction-DL-Capture-3-Portrait.png");
7318
7376
  var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a) {
7319
7377
  var _b, _c, _d, _e, _f, _g;
7320
- var onDismissed = _a.onDismissed,
7378
+ var onLoadingStarted = _a.onLoadingStarted,
7379
+ onLoadingProgress = _a.onLoadingProgress,
7380
+ onLoadingCompleted = _a.onLoadingCompleted,
7381
+ onDismissed = _a.onDismissed,
7321
7382
  onUserCancel = _a.onUserCancel,
7322
7383
  instructions = _a.instructions,
7323
7384
  _h = _a.rotateImage,
@@ -7335,7 +7396,9 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7335
7396
  var sessionReady = sessionCheckState === 'PASSED';
7336
7397
  var _o = useIdCaptureModelsContext(),
7337
7398
  modelsReady = _o.ready,
7338
- modelDownloadProgress = _o.modelDownloadProgress;
7399
+ modelLoadState = _o.modelLoadState,
7400
+ modelDownloadProgress = _o.modelDownloadProgress,
7401
+ modelWarmingStartedAt = _o.modelWarmingStartedAt;
7339
7402
  var _p = useCameraStore(),
7340
7403
  cameraReady = _p.cameraReady,
7341
7404
  cameraAccessDenied = _p.cameraAccessDenied,
@@ -7358,11 +7421,27 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7358
7421
  pleaseWaitText: 'Please wait...',
7359
7422
  sessionCheckingText: 'Authenticating...'
7360
7423
  });
7424
+ var onLoadingStartedRef = React.useRef(onLoadingStarted);
7425
+ React.useEffect(function () {
7426
+ onLoadingStartedRef.current = onLoadingStarted;
7427
+ }, [onLoadingStarted]);
7428
+ var onLoadingProgressRef = React.useRef(onLoadingProgress);
7429
+ React.useEffect(function () {
7430
+ onLoadingProgressRef.current = onLoadingProgress;
7431
+ }, [onLoadingProgress]);
7432
+ var onLoadingCompletedRef = React.useRef(onLoadingCompleted);
7433
+ React.useEffect(function () {
7434
+ onLoadingCompletedRef.current = onLoadingCompleted;
7435
+ }, [onLoadingCompleted]);
7361
7436
  var ready = sessionReady && modelsReady && cameraReady;
7362
7437
  React.useEffect(function () {
7363
- if (ready) return function () {
7364
- return null;
7365
- };
7438
+ var _a;
7439
+ if (ready) {
7440
+ (_a = onLoadingCompletedRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingCompletedRef);
7441
+ return function () {
7442
+ return null;
7443
+ };
7444
+ }
7366
7445
  var t = setTimeout(function () {
7367
7446
  return setDismissed(false);
7368
7447
  }, 500);
@@ -7371,6 +7450,19 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7371
7450
  };
7372
7451
  }, [ready]);
7373
7452
  var imageRef = React.useRef(null);
7453
+ var timeSinceWarmingStarted = modelWarmingStartedAt ? new Date().getTime() - modelWarmingStartedAt : 0;
7454
+ var warmingProgress = timeSinceWarmingStarted / 5000.0;
7455
+ var modelLoadProgress = modelsReady ? 100 : modelDownloadProgress * 0.5 + warmingProgress * 49.0;
7456
+ React.useEffect(function () {
7457
+ var _a;
7458
+ (_a = onLoadingStartedRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingStartedRef);
7459
+ }, []);
7460
+ React.useEffect(function () {
7461
+ var _a;
7462
+ if (modelLoadProgress > 0) {
7463
+ (_a = onLoadingProgressRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadingProgressRef, modelLoadProgress);
7464
+ }
7465
+ }, [modelLoadProgress]);
7374
7466
  if (dismissed) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
7375
7467
  if (cameraAccessDenied) {
7376
7468
  return /*#__PURE__*/React__namespace.default.createElement(CameraAccessDeniedOverlay, {
@@ -7430,7 +7522,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7430
7522
  }, /*#__PURE__*/React__namespace.default.createElement(ProgressBarBackground$1, {
7431
7523
  className: classNames.progressBackground
7432
7524
  }), /*#__PURE__*/React__namespace.default.createElement(LoadingOverlayProgressBar, {
7433
- "$progress": modelDownloadProgress,
7525
+ "$progress": modelLoadProgress,
7434
7526
  className: classNames.progressBar
7435
7527
  }, /*#__PURE__*/React__namespace.default.createElement(ProgressIndicator$1, {
7436
7528
  className: classNames.progressIndicator
@@ -7448,7 +7540,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
7448
7540
  }, /*#__PURE__*/React__namespace.default.createElement(LoadingListItemIndicator, {
7449
7541
  className: classNames.loadingListItemIndicator,
7450
7542
  state: sessionReady && modelsReady ? 'done' : 'running'
7451
- }), !sessionReady ? verbiage.sessionCheckingText : modelsReady ? verbiage.modelsReadyText : modelDownloadProgress >= 100 ? verbiage.modelsWarmingUpText : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)")))), /*#__PURE__*/React__namespace.default.createElement(ContinueButtonContainer$1, {
7543
+ }), !sessionReady ? verbiage.sessionCheckingText : modelsReady ? verbiage.modelsReadyText : modelLoadState === 'downloading' ? "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)") : modelLoadState === 'warming' ? verbiage.modelsWarmingUpText : verbiage.modelsReadyText))), /*#__PURE__*/React__namespace.default.createElement(ContinueButtonContainer$1, {
7452
7544
  className: classNames.continueBtnContainer
7453
7545
  }, (ready || ((_g = (_f = theme.idCapture) === null || _f === void 0 ? void 0 : _f.loadingOverlay) === null || _g === void 0 ? void 0 : _g.displayDisabledContinueBtn)) && ( /*#__PURE__*/React__namespace.default.createElement(ContinueButton$1, {
7454
7546
  autoFocus: true,
@@ -7487,7 +7579,10 @@ var ProgressBarBackground$1 = styled__default.default(LoadingOverlayProgressBarB
7487
7579
  var _a, _b, _c, _d;
7488
7580
  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;
7489
7581
  });
7490
- var ProgressIndicator$1 = styled__default.default(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);
7582
+ var ProgressIndicator$1 = styled__default.default(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) {
7583
+ var _a, _b, _c, _d;
7584
+ 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)';
7585
+ });
7491
7586
  var CustomLoadingGraphic$1 = styled__default.default.img(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
7492
7587
  var ContinueButtonContainer$1 = styled__default.default.div(templateObject_9$3 || (templateObject_9$3 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
7493
7588
  var ContinueButton$1 = styled__default.default(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) {
@@ -10261,13 +10356,16 @@ var templateObject_1$p, templateObject_2$l, templateObject_3$f, templateObject_4
10261
10356
 
10262
10357
  var IdCaptureWizard = function IdCaptureWizard(_a) {
10263
10358
  var _b, _c, _d, _e, _f;
10264
- var onSuccess = _a.onSuccess,
10359
+ var onLoadingStarted = _a.onLoadingStarted,
10360
+ onLoadingProgress = _a.onLoadingProgress,
10361
+ onLoadingCompleted = _a.onLoadingCompleted,
10362
+ onSuccess = _a.onSuccess,
10265
10363
  onExitCapture = _a.onExitCapture,
10266
10364
  onUserCancel = _a.onUserCancel,
10365
+ onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
10267
10366
  _g = _a.loadingOverlayMode,
10268
10367
  loadingOverlayMode = _g === void 0 ? 'default' : _g,
10269
10368
  customOverlayContent = _a.customOverlayContent,
10270
- onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
10271
10369
  precapturedDocuments = _a.precapturedDocuments,
10272
10370
  _h = _a.captureRequirement,
10273
10371
  captureRequirement = _h === void 0 ? 'idCardOrPassport' : _h,
@@ -10613,6 +10711,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
10613
10711
  colors: colors.loadingOverlay,
10614
10712
  verbiage: verbiage.loadingOverlay,
10615
10713
  onUserCancel: onUserCancel,
10714
+ onLoadingStarted: onLoadingStarted,
10715
+ onLoadingProgress: onLoadingProgress,
10716
+ onLoadingCompleted: onLoadingCompleted,
10616
10717
  onDismissed: function onDismissed() {
10617
10718
  setOverlayDismissed(true);
10618
10719
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
@@ -11270,6 +11371,8 @@ var SelfieGuidanceModelsContext = /*#__PURE__*/React.createContext({
11270
11371
  },
11271
11372
  ready: false,
11272
11373
  error: null,
11374
+ modelLoadState: 'not-started',
11375
+ modelWarmingStartedAt: null,
11273
11376
  modelDownloadProgress: 0
11274
11377
  });
11275
11378
  function SelfieGuidanceModelsProvider(_a) {
@@ -11301,7 +11404,9 @@ function SelfieGuidanceModelsProvider(_a) {
11301
11404
  videoRef: videoRef
11302
11405
  }),
11303
11406
  ready = _f.ready,
11407
+ modelLoadState = _f.modelLoadState,
11304
11408
  modelDownloadProgress = _f.modelDownloadProgress,
11409
+ modelWarmingStartedAt = _f.modelWarmingStartedAt,
11305
11410
  modelError = _f.modelError;
11306
11411
  var _g = useFrameLoop(React.useCallback(function () {
11307
11412
  return __awaiter(_this, void 0, void 0, function () {
@@ -11363,9 +11468,11 @@ function SelfieGuidanceModelsProvider(_a) {
11363
11468
  canvasRef: canvasRef,
11364
11469
  onPredictionMade: onPredictionMade,
11365
11470
  error: modelError,
11366
- modelDownloadProgress: modelDownloadProgress
11471
+ modelDownloadProgress: modelDownloadProgress,
11472
+ modelLoadState: modelLoadState,
11473
+ modelWarmingStartedAt: modelWarmingStartedAt
11367
11474
  };
11368
- }, [start, stop, ready, onPredictionMade, modelError, modelDownloadProgress]);
11475
+ }, [start, stop, ready, onPredictionMade, modelError, modelDownloadProgress, modelLoadState, modelWarmingStartedAt]);
11369
11476
  return /*#__PURE__*/React__namespace.createElement(SelfieGuidanceModelsContext.Provider, {
11370
11477
  value: value
11371
11478
  }, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
@@ -15761,6 +15868,9 @@ var IdValidation = function IdValidation(_a) {
15761
15868
  allowOverrideWrongDocumentTypeAfterMs = _t === void 0 ? 8000 : _t,
15762
15869
  _u = _a.allowUploadingDocumentsFromStorage,
15763
15870
  allowUploadingDocumentsFromStorage = _u === void 0 ? false : _u,
15871
+ onLoadingStarted = _a.onLoadingStarted,
15872
+ onLoadingProgress = _a.onLoadingProgress,
15873
+ onLoadingCompleted = _a.onLoadingCompleted,
15764
15874
  onBeforeSubmit = _a.onBeforeSubmit,
15765
15875
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
15766
15876
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -15802,6 +15912,9 @@ var IdValidation = function IdValidation(_a) {
15802
15912
  useDebugLogging(debugMode);
15803
15913
  var idCaptureProps = React.useMemo(function () {
15804
15914
  return {
15915
+ onLoadingStarted: onLoadingStarted,
15916
+ onLoadingProgress: onLoadingProgress,
15917
+ onLoadingCompleted: onLoadingCompleted,
15805
15918
  onExitCapture: onExitCapture,
15806
15919
  onUserCancel: onUserCancel,
15807
15920
  onModelError: onModelError,
@@ -15831,7 +15944,7 @@ var IdValidation = function IdValidation(_a) {
15831
15944
  verbiage: verbiage,
15832
15945
  debugMode: debugMode
15833
15946
  };
15834
- }, [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]);
15947
+ }, [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]);
15835
15948
  var additionalDocumentCaptureProps = React.useMemo(function () {
15836
15949
  return {
15837
15950
  documents: captureAdditionalDocuments,