idmission-web-sdk 1.0.310 → 1.0.312

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 (54) hide show
  1. package/README.md +122 -46
  2. package/dist/components/CompositeWizard.d.ts +3 -3
  3. package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts +15 -2
  4. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +17 -4
  5. package/dist/components/customer_flows/CustomerIdentification.d.ts +15 -2
  6. package/dist/components/customer_flows/CustomerVerification.d.ts +15 -2
  7. package/dist/components/customer_flows/DocumentCapture.d.ts +15 -6
  8. package/dist/components/customer_flows/FaceValidation.d.ts +17 -2
  9. package/dist/components/customer_flows/IdAndFaceValidation.d.ts +18 -5
  10. package/dist/components/customer_flows/IdValidation.d.ts +18 -5
  11. package/dist/components/customer_flows/SignatureKYC.d.ts +17 -2
  12. package/dist/components/customer_flows/VideoIdValidation.d.ts +17 -2
  13. package/dist/components/document_capture/DocumentCaptureStateProvider.d.ts +1 -1
  14. package/dist/components/submission/AuthUrlNotAllowedOverlay.d.ts +2 -0
  15. package/dist/components/submission/Errors.d.ts +1 -1
  16. package/dist/components/submission/SessionIdMissingOverlay.d.ts +2 -0
  17. package/dist/components/submission/SessionValidationErrorOverlay.d.ts +6 -0
  18. package/dist/components/submission/SessionValidationFailedOverlay.d.ts +2 -0
  19. package/dist/components/submission/SubmissionProvider.d.ts +24 -5
  20. package/dist/components/video_id/IdVideoCaptureGuides.d.ts +166 -163
  21. package/dist/contexts/AuthStateContext.d.ts +33 -0
  22. package/dist/contexts/SubmissionContext.d.ts +9 -3
  23. package/dist/index.d.ts +7 -1
  24. package/dist/lib/utils/dataUrlToBase64.d.ts +2 -0
  25. package/dist/sdk2.cjs.development.js +864 -594
  26. package/dist/sdk2.cjs.development.js.map +1 -1
  27. package/dist/sdk2.cjs.production.js +1 -1
  28. package/dist/sdk2.cjs.production.js.map +1 -1
  29. package/dist/sdk2.esm.js +864 -597
  30. package/dist/sdk2.esm.js.map +1 -1
  31. package/dist/sdk2.umd.development.js +867 -598
  32. package/dist/sdk2.umd.development.js.map +1 -1
  33. package/dist/sdk2.umd.production.js +1 -1
  34. package/dist/sdk2.umd.production.js.map +1 -1
  35. package/dist/stories/Auth.stories.d.ts +8 -0
  36. package/dist/stories/Components/CompositeWizard/FaceLivenessAndIdCapture.stories.d.ts +0 -9
  37. package/dist/stories/CustomerFlows/CustomerBiometricsEnrollment.stories.d.ts +5 -1
  38. package/dist/stories/CustomerFlows/CustomerIdAndBiometricsEnrollment.stories.d.ts +5 -1
  39. package/dist/stories/CustomerFlows/CustomerIdentification.stories.d.ts +5 -1
  40. package/dist/stories/CustomerFlows/CustomerVerification.stories.d.ts +5 -1
  41. package/dist/stories/CustomerFlows/DocumentCapture.stories.d.ts +5 -1
  42. package/dist/stories/CustomerFlows/FaceValidation.stories.d.ts +5 -1
  43. package/dist/stories/CustomerFlows/IdAndFaceValidation.stories.d.ts +5 -1
  44. package/dist/stories/CustomerFlows/IdValidation.stories.d.ts +5 -1
  45. package/dist/stories/CustomerFlows/SignatureKYC.stories.d.ts +5 -1
  46. package/dist/stories/CustomerFlows/VideoIdValidation.stories.d.ts +14 -1
  47. package/dist/stories/utils/sessions.d.ts +13 -0
  48. package/dist/stories/utils/useLocalStorage.d.ts +1 -0
  49. package/dist/themes/index.d.ts +2 -0
  50. package/dist/version.d.ts +1 -1
  51. package/package.json +1 -1
  52. package/dist/components/submission/TokenIssuerNotAllowedErrorOverlay.d.ts +0 -2
  53. package/dist/components/submission/TokenMissingErrorOverlay.d.ts +0 -2
  54. package/dist/components/submission/TokenPublicKeyErrorOverlay.d.ts +0 -5
package/dist/sdk2.esm.js CHANGED
@@ -1,10 +1,11 @@
1
- import { __awaiter, __generator, __makeTemplateObject, __extends, __spreadArray, __assign, __rest } from 'tslib';
1
+ import { __awaiter, __generator, __makeTemplateObject, __extends, __assign, __spreadArray, __rest } from 'tslib';
2
2
  import * as React from 'react';
3
- import React__default, { forwardRef, useState, useEffect, useRef, useContext, createContext, useCallback, useMemo, useReducer, useLayoutEffect } from 'react';
3
+ import React__default, { forwardRef, useState, useEffect, useRef, useContext, createContext, useReducer, useCallback, useMemo, useLayoutEffect } from 'react';
4
4
  import * as ReactDOM from 'react-dom/client';
5
5
  import platform from 'platform';
6
6
  import styled, { useTheme, ThemeProvider as ThemeProvider$1 } from 'styled-components';
7
7
  import { useTranslation, initReactI18next } from 'react-i18next';
8
+ import { Upload } from 'tus-js-client';
8
9
  import useResizeObserver from 'use-resize-observer';
9
10
  import * as tf from '@tensorflow/tfjs';
10
11
  import { FaceDetector, FilesetResolver } from '@mediapipe/tasks-vision';
@@ -14,7 +15,7 @@ import i18n from 'i18next';
14
15
  import { createPortal } from 'react-dom';
15
16
  import SignatureCanvas from 'react-signature-canvas';
16
17
 
17
- var webSdkVersion = '1.0.310';
18
+ var webSdkVersion = '1.0.312';
18
19
 
19
20
  function getPlatform() {
20
21
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -40,6 +41,15 @@ function contentDispositionFromDataUrl(url) {
40
41
  var _a, _b;
41
42
  return (_b = (_a = url.match(/^(data:.*;base64),/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
42
43
  }
44
+ function blobToB64(blob) {
45
+ return new Promise(function (resolve) {
46
+ var reader = new FileReader();
47
+ reader.onloadend = function () {
48
+ return resolve(reader.result);
49
+ };
50
+ reader.readAsDataURL(blob);
51
+ });
52
+ }
43
53
 
44
54
  var SubmissionAction;
45
55
  (function (SubmissionAction) {
@@ -81,32 +91,33 @@ function determineSubmissionHost(environment, token) {
81
91
  if (!host) throw new Error("unrecognized SubmissionEnvironment ".concat(environment));
82
92
  return host;
83
93
  }
84
- function determineSubmissionEndpoint(action, hasId, hasSelfie, hasToken) {
85
- var v = hasToken ? 'v4' : 'v3';
94
+ function determineSubmissionEndpoint(action, hasId, hasSelfie) {
86
95
  switch (action) {
87
96
  case SubmissionAction.ENROLL:
88
- return hasId ? "/".concat(v, "/customer/enroll") : "/".concat(v, "/customer/enroll-biometrics");
97
+ return hasId ? "/v4/customer/enroll" : "/v4/customer/enroll-biometrics";
89
98
  case SubmissionAction.IDENTIFY:
90
- return "/".concat(v, "/customer/identify");
99
+ return "/v4/customer/identify";
91
100
  case SubmissionAction.VALIDATE:
92
- return hasSelfie ? "/".concat(v, "/customer/validate-id-match-face") : "/".concat(v, "/customer/validate-id");
101
+ return hasSelfie ? "/v4/customer/validate-id-match-face" : "/v4/customer/validate-id";
93
102
  case SubmissionAction.VERIFY:
94
- return "/".concat(v, "/customer/verify");
103
+ return "/v4/customer/verify";
95
104
  default:
96
105
  throw new Error("unrecognized SubmissionAction ".concat(action));
97
106
  }
98
107
  }
99
- function liveCheckEndpoint(hasToken) {
100
- var v = hasToken ? 'v4' : 'v3';
101
- return "/".concat(v, "/customer/live-check");
108
+ function liveCheckEndpoint(hasDocumentToMatchFace) {
109
+ if (hasDocumentToMatchFace === void 0) {
110
+ hasDocumentToMatchFace = false;
111
+ }
112
+ return hasDocumentToMatchFace ? "/v4/customer/match-id-face" : "/v4/customer/live-check";
102
113
  }
103
- function apiHeaders(token) {
114
+ function apiHeaders(sessionId) {
104
115
  var headers = {
105
116
  'Content-Type': 'application/json',
106
117
  Origin: '*'
107
118
  };
108
- if (token) {
109
- headers['Authorization'] = "Bearer ".concat(token);
119
+ if (sessionId) {
120
+ headers['X-Session-Id'] = sessionId;
110
121
  }
111
122
  return headers;
112
123
  }
@@ -323,15 +334,15 @@ var NetworkError = /** @class */function (_super) {
323
334
  }
324
335
  return NetworkError;
325
336
  }(Error);
326
- var TokenPublicKeyError = /** @class */function (_super) {
327
- __extends(TokenPublicKeyError, _super);
328
- function TokenPublicKeyError(err, host) {
337
+ var SessionValidationFailedError = /** @class */function (_super) {
338
+ __extends(SessionValidationFailedError, _super);
339
+ function SessionValidationFailedError(err, host) {
329
340
  var _this = _super.call(this, err.message) || this;
330
341
  _this.err = err;
331
342
  _this.host = host;
332
343
  return _this;
333
344
  }
334
- return TokenPublicKeyError;
345
+ return SessionValidationFailedError;
335
346
  }(Error);
336
347
 
337
348
  var SubmissionErrorOverlay = function SubmissionErrorOverlay(_a) {
@@ -395,7 +406,7 @@ var NetworkErrorContent = function NetworkErrorContent(_a) {
395
406
  }, retryText))));
396
407
  };
397
408
 
398
- var TokenMissingErrorOverlay = function TokenMissingErrorOverlay() {
409
+ var SessionIdMissingOverlay = function SessionIdMissingOverlay() {
399
410
  return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
400
411
  style: {
401
412
  justifyContent: 'center'
@@ -408,7 +419,7 @@ var TokenMissingErrorOverlay = function TokenMissingErrorOverlay() {
408
419
  style: {
409
420
  marginBottom: 0
410
421
  }
411
- }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "submissionToken"), " is missing."), /*#__PURE__*/React__default.createElement("p", {
422
+ }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "sessionId"), " is missing."), /*#__PURE__*/React__default.createElement("p", {
412
423
  style: {
413
424
  lineHeight: '1.5rem'
414
425
  }
@@ -416,14 +427,10 @@ var TokenMissingErrorOverlay = function TokenMissingErrorOverlay() {
416
427
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
417
428
  target: "_blank",
418
429
  rel: "noreferrer"
419
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default.createElement("a", {
420
- href: "https://jwt.io",
421
- target: "_blank",
422
- rel: "noreferrer"
423
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
430
+ }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid session for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid session from IDmission's servers.")));
424
431
  };
425
432
 
426
- var TokenInvalidFormatErrorOverlay = function TokenInvalidFormatErrorOverlay() {
433
+ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
427
434
  return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
428
435
  style: {
429
436
  justifyContent: 'center'
@@ -436,16 +443,7 @@ var TokenInvalidFormatErrorOverlay = function TokenInvalidFormatErrorOverlay() {
436
443
  style: {
437
444
  marginBottom: 0
438
445
  }
439
- }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "submissionToken"), " is invalid."), /*#__PURE__*/React__default.createElement("p", null, "JSON Web Tokens consist of three parts separated by dots (", /*#__PURE__*/React__default.createElement("code", null, "."), "), which are:"), /*#__PURE__*/React__default.createElement("div", {
440
- style: {
441
- display: 'flex'
442
- }
443
- }, /*#__PURE__*/React__default.createElement("ul", {
444
- style: {
445
- display: 'inline',
446
- margin: '0 auto'
447
- }
448
- }, /*#__PURE__*/React__default.createElement("li", null, "Header"), /*#__PURE__*/React__default.createElement("li", null, "Payload"), /*#__PURE__*/React__default.createElement("li", null, "Signature"))), /*#__PURE__*/React__default.createElement("p", null, "Therefore, a JWT typically looks like the following:", ' ', /*#__PURE__*/React__default.createElement("code", null, "xxxxx.yyyyy.zzzzz")), /*#__PURE__*/React__default.createElement("p", {
446
+ }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "sessionId"), " is not valid."), /*#__PURE__*/React__default.createElement("p", {
449
447
  style: {
450
448
  lineHeight: '1.5rem'
451
449
  }
@@ -453,14 +451,10 @@ var TokenInvalidFormatErrorOverlay = function TokenInvalidFormatErrorOverlay() {
453
451
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
454
452
  target: "_blank",
455
453
  rel: "noreferrer"
456
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default.createElement("a", {
457
- href: "https://jwt.io",
458
- target: "_blank",
459
- rel: "noreferrer"
460
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
454
+ }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid session for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid session from IDmission's servers.")));
461
455
  };
462
456
 
463
- var TokenInvalidSignatureErrorOverlay = function TokenInvalidSignatureErrorOverlay() {
457
+ var AuthUrlNotAllowedOverlay = function AuthUrlNotAllowedOverlay() {
464
458
  return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
465
459
  style: {
466
460
  justifyContent: 'center'
@@ -473,40 +467,12 @@ var TokenInvalidSignatureErrorOverlay = function TokenInvalidSignatureErrorOverl
473
467
  style: {
474
468
  marginBottom: 0
475
469
  }
476
- }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "submissionToken"), " could not be validated."), /*#__PURE__*/React__default.createElement("p", {
470
+ }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "authUrl"), " comes from an unrecognized issuer."), /*#__PURE__*/React__default.createElement("p", {
477
471
  style: {
478
472
  marginBottom: 0,
479
473
  lineHeight: '1.5rem'
480
474
  }
481
- }, "The signature of your token could not be validated. Check your token generation routine, it's possible that some malicious behavior is at play. This can also happen if you attempt to manually modify your token before passing it to the IDmission WebSDK."), /*#__PURE__*/React__default.createElement("p", {
482
- style: {
483
- marginBottom: 0,
484
- lineHeight: '1.5rem'
485
- }
486
- }, "If you believe you have reached this page in error, please contact us at ", /*#__PURE__*/React__default.createElement("a", {
487
- href: "mailto:support@idmission.com"
488
- }, "support@idmission.com"), ".")));
489
- };
490
-
491
- var TokenExpiredErrorOverlay = function TokenExpiredErrorOverlay() {
492
- return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
493
- style: {
494
- justifyContent: 'center'
495
- }
496
- }, /*#__PURE__*/React__default.createElement("h3", {
497
- style: {
498
- marginBottom: 8
499
- }
500
- }, "IDmission WebSDK failed to load"), /*#__PURE__*/React__default.createElement("p", {
501
- style: {
502
- marginBottom: 0
503
- }
504
- }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "submissionToken"), " is expired."), /*#__PURE__*/React__default.createElement("p", {
505
- style: {
506
- marginBottom: 0,
507
- lineHeight: '1.5rem'
508
- }
509
- }, "Ensure you are generating a fresh token for each request to the IDmission WebSDK."), /*#__PURE__*/React__default.createElement("p", {
475
+ }, "Ensure you are generating a fresh session for each request to the IDmission WebSDK."), /*#__PURE__*/React__default.createElement("p", {
510
476
  style: {
511
477
  lineHeight: '1.5rem'
512
478
  }
@@ -514,15 +480,14 @@ var TokenExpiredErrorOverlay = function TokenExpiredErrorOverlay() {
514
480
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
515
481
  target: "_blank",
516
482
  rel: "noreferrer"
517
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default.createElement("a", {
518
- href: "https://jwt.io",
519
- target: "_blank",
520
- rel: "noreferrer"
521
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
483
+ }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid session for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid session from IDmission's servers.")));
522
484
  };
523
485
 
524
- var TokenPublicKeyErrorOverlay = function TokenPublicKeyErrorOverlay(_a) {
525
- var error = _a.error;
486
+ var SessionValidationErrorOverlay = function SessionValidationErrorOverlay(_a) {
487
+ var error = _a.error,
488
+ onRetry = _a.onRetry;
489
+ var t = useTranslation().t;
490
+ var retryText = t('Retry');
526
491
  return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
527
492
  style: {
528
493
  justifyContent: 'center'
@@ -535,7 +500,7 @@ var TokenPublicKeyErrorOverlay = function TokenPublicKeyErrorOverlay(_a) {
535
500
  style: {
536
501
  marginBottom: 0
537
502
  }
538
- }, (error === null || error === void 0 ? void 0 : error.host) ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Failed to reach ", /*#__PURE__*/React__default.createElement("code", null, error.host), ".")) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Failed to obtain public key for ", /*#__PURE__*/React__default.createElement("code", null, "submissionToken"), "."))), (error === null || error === void 0 ? void 0 : error.message) && ( /*#__PURE__*/React__default.createElement("p", {
503
+ }, (error === null || error === void 0 ? void 0 : error.host) ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Failed to reach ", /*#__PURE__*/React__default.createElement("code", null, error.host), ".")) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Failed to validate ", /*#__PURE__*/React__default.createElement("code", null, "sessionId"), "."))), (error === null || error === void 0 ? void 0 : error.message) && ( /*#__PURE__*/React__default.createElement("p", {
539
504
  style: {
540
505
  marginBottom: 0,
541
506
  lineHeight: '1.5rem'
@@ -547,43 +512,213 @@ var TokenPublicKeyErrorOverlay = function TokenPublicKeyErrorOverlay(_a) {
547
512
  }
548
513
  }, "Please ensure that IDmission's servers can be reached. If you believe you have reached this page in error, please contact us at", ' ', /*#__PURE__*/React__default.createElement("a", {
549
514
  href: "mailto:support@idmission.com"
550
- }, "support@idmission.com"), ".")));
551
- };
552
-
553
- var TokenIssuerNotAllowedErrorOverlay = function TokenIssuerNotAllowedErrorOverlay() {
554
- return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
515
+ }, "support@idmission.com"), "."), onRetry && ( /*#__PURE__*/React__default.createElement("div", {
555
516
  style: {
556
- justifyContent: 'center'
557
- }
558
- }, /*#__PURE__*/React__default.createElement("h3", {
559
- style: {
560
- marginBottom: 8
561
- }
562
- }, "IDmission WebSDK failed to load"), /*#__PURE__*/React__default.createElement("p", {
563
- style: {
564
- marginBottom: 0
565
- }
566
- }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "submissionToken"), " comes from an unrecognized issuer."), /*#__PURE__*/React__default.createElement("p", {
567
- style: {
568
- marginBottom: 0,
569
- lineHeight: '1.5rem'
570
- }
571
- }, "Ensure you are generating a fresh token for each request to the IDmission WebSDK."), /*#__PURE__*/React__default.createElement("p", {
572
- style: {
573
- lineHeight: '1.5rem'
517
+ marginTop: 32
574
518
  }
575
- }, "Please refer to the", ' ', /*#__PURE__*/React__default.createElement("a", {
576
- href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
577
- target: "_blank",
578
- rel: "noreferrer"
579
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default.createElement("a", {
580
- href: "https://jwt.io",
581
- target: "_blank",
582
- rel: "noreferrer"
583
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
519
+ }, /*#__PURE__*/React__default.createElement(LoaderButton, {
520
+ variant: "warning",
521
+ finished: true,
522
+ onClick: onRetry
523
+ }, retryText)))));
524
+ };
525
+
526
+ var Spinner = styled.div(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])), function (_a) {
527
+ var $size = _a.$size;
528
+ return $size !== null && $size !== void 0 ? $size : 80;
529
+ }, function (_a) {
530
+ var $size = _a.$size;
531
+ return $size !== null && $size !== void 0 ? $size : 80;
532
+ }, function (_a) {
533
+ var $size = _a.$size;
534
+ return ($size !== null && $size !== void 0 ? $size : 80) - 16;
535
+ }, function (_a) {
536
+ var $size = _a.$size;
537
+ return ($size !== null && $size !== void 0 ? $size : 80) - 16;
538
+ }, function (_a) {
539
+ var $thickness = _a.$thickness;
540
+ return $thickness !== null && $thickness !== void 0 ? $thickness : 6;
541
+ }, function (_a) {
542
+ var $color = _a.$color;
543
+ return $color !== null && $color !== void 0 ? $color : '#888';
544
+ }, function (_a) {
545
+ var $color = _a.$color;
546
+ return $color !== null && $color !== void 0 ? $color : '#888';
547
+ }, function (_a) {
548
+ var $color = _a.$color;
549
+ return $color !== null && $color !== void 0 ? $color : '#888';
550
+ });
551
+ var templateObject_1$C;
552
+
553
+ var defaultAuthUrl = 'https://portal-api.idmission.com';
554
+ var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
555
+ var initialState$5 = {
556
+ authUrl: defaultAuthUrl,
557
+ sessionCheckState: 'READY'
558
+ };
559
+ var AuthStateContext = /*#__PURE__*/createContext(initialState$5);
560
+ var AuthDispatchContext = /*#__PURE__*/createContext(function () {});
561
+ var reducer$5 = function reducer(state, action) {
562
+ switch (action.type) {
563
+ case 'setSessionId':
564
+ return __assign(__assign({}, state), {
565
+ sessionId: action.payload
566
+ });
567
+ case 'setCheckState':
568
+ return __assign(__assign({}, state), {
569
+ sessionCheckState: action.payload
570
+ });
571
+ case 'setError':
572
+ return __assign(__assign({}, state), {
573
+ sessionCheckState: 'ERROR',
574
+ authError: action.payload
575
+ });
576
+ case 'retry':
577
+ return __assign(__assign({}, state), {
578
+ sessionCheckState: 'READY',
579
+ authError: undefined,
580
+ sessionId: undefined
581
+ });
582
+ default:
583
+ return state;
584
+ }
584
585
  };
586
+ function useAuthReducer(authUrl, sessionId) {
587
+ var _this = this;
588
+ if (authUrl === void 0) {
589
+ authUrl = defaultAuthUrl;
590
+ }
591
+ var _a = useReducer(reducer$5, __assign(__assign({}, initialState$5), {
592
+ authUrl: authUrl
593
+ })),
594
+ state = _a[0],
595
+ dispatch = _a[1];
596
+ var resolvedSessionId = state.sessionId,
597
+ sessionCheckState = state.sessionCheckState;
598
+ useEffect(function () {
599
+ if (!allowedAuthUrls.includes(authUrl)) return dispatch({
600
+ type: 'setCheckState',
601
+ payload: 'AUTH_URL_NOT_ALLOWED'
602
+ });
603
+ }, [authUrl]);
604
+ useEffect(function () {
605
+ if (sessionCheckState !== 'READY') return;
606
+ if (!resolvedSessionId) {
607
+ if (!sessionId) return dispatch({
608
+ type: 'setCheckState',
609
+ payload: 'MISSING'
610
+ });
611
+ if (typeof sessionId === 'string') return dispatch({
612
+ type: 'setSessionId',
613
+ payload: sessionId
614
+ });
615
+ if (sessionId instanceof Function) {
616
+ sessionId().then(function (sessionId) {
617
+ dispatch({
618
+ type: 'setSessionId',
619
+ payload: sessionId
620
+ });
621
+ })["catch"](function (e) {
622
+ console.error('failed to resolve session id', e);
623
+ dispatch({
624
+ type: 'setError',
625
+ payload: new SessionValidationFailedError(e, authUrl)
626
+ });
627
+ });
628
+ }
629
+ } else {
630
+ dispatch({
631
+ type: 'setCheckState',
632
+ payload: 'RUNNING'
633
+ });
634
+ (function () {
635
+ return __awaiter(_this, void 0, void 0, function () {
636
+ var resp, valid, e_1;
637
+ return __generator(this, function (_a) {
638
+ switch (_a.label) {
639
+ case 0:
640
+ _a.trys.push([0, 3,, 4]);
641
+ return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
642
+ method: 'POST',
643
+ headers: {
644
+ 'Content-Type': 'application/json'
645
+ },
646
+ body: JSON.stringify({
647
+ id: resolvedSessionId
648
+ })
649
+ })];
650
+ case 1:
651
+ resp = _a.sent();
652
+ return [4 /*yield*/, resp.json()];
653
+ case 2:
654
+ valid = _a.sent().valid;
655
+ dispatch({
656
+ type: 'setCheckState',
657
+ payload: valid ? 'PASSED' : 'FAILED'
658
+ });
659
+ return [3 /*break*/, 4];
660
+ case 3:
661
+ e_1 = _a.sent();
662
+ dispatch({
663
+ type: 'setError',
664
+ payload: new SessionValidationFailedError(e_1, authUrl)
665
+ });
666
+ return [3 /*break*/, 4];
667
+ case 4:
668
+ return [2 /*return*/];
669
+ }
670
+ });
671
+ });
672
+ })();
673
+ }
674
+ }, [authUrl, sessionCheckState, resolvedSessionId, sessionId]);
675
+ return [state, dispatch];
676
+ }
677
+ function useAuthContext() {
678
+ var state = useContext(AuthStateContext);
679
+ var dispatch = useContext(AuthDispatchContext);
680
+ if (!state || !dispatch) throw new Error('useAuthContext cannot be used without AuthStateProvider');
681
+ return [state, dispatch];
682
+ }
683
+ function AuthProvider(_a) {
684
+ var _b = _a.authUrl,
685
+ authUrl = _b === void 0 ? defaultAuthUrl : _b,
686
+ sessionId = _a.sessionId,
687
+ children = _a.children;
688
+ var _c = useAuthReducer(authUrl, sessionId),
689
+ state = _c[0],
690
+ dispatch = _c[1];
691
+ if (state.sessionCheckState === 'MISSING') {
692
+ return /*#__PURE__*/React__default.createElement(SessionIdMissingOverlay, null);
693
+ }
694
+ if (state.sessionCheckState === 'FAILED') {
695
+ return /*#__PURE__*/React__default.createElement(SessionValidationFailedOverlay, null);
696
+ }
697
+ if (state.sessionCheckState === 'AUTH_URL_NOT_ALLOWED') {
698
+ return /*#__PURE__*/React__default.createElement(AuthUrlNotAllowedOverlay, null);
699
+ }
700
+ if (state.sessionCheckState === 'ERROR') {
701
+ return /*#__PURE__*/React__default.createElement(SessionValidationErrorOverlay, {
702
+ error: state.authError,
703
+ onRetry: function onRetry() {
704
+ return dispatch({
705
+ type: 'retry'
706
+ });
707
+ }
708
+ });
709
+ }
710
+ if (state.sessionCheckState === 'READY' || state.sessionCheckState === 'RUNNING') return /*#__PURE__*/React__default.createElement(PageContainer, {
711
+ className: "flex"
712
+ }, /*#__PURE__*/React__default.createElement(Spinner, null));
713
+ return /*#__PURE__*/React__default.createElement(AuthStateContext.Provider, {
714
+ value: state
715
+ }, /*#__PURE__*/React__default.createElement(AuthDispatchContext.Provider, {
716
+ value: dispatch
717
+ }, children));
718
+ }
585
719
 
586
- var allowedTokenIssuers = ['https://demoauth.idmission.com/', 'https://uatauth.idmission.com/', 'https://auth.idmission.com/'];
720
+ var defaultSubmissionUrl = 'https://portal-api.idmission.com/swagger';
721
+ var defaultDocumentServiceUrl = 'https://portal-api.idmission.com/files/';
587
722
  var SubmissionContext = /*#__PURE__*/createContext({
588
723
  submit: function submit() {
589
724
  return __awaiter(void 0, void 0, void 0, function () {
@@ -662,122 +797,127 @@ var SubmissionContext = /*#__PURE__*/createContext({
662
797
  var SubmissionProvider = function SubmissionProvider(_a) {
663
798
  var action = _a.action,
664
799
  children = _a.children,
665
- url = _a.url,
666
- _b = _a.environment,
667
- environment = _b === void 0 ? 'prod' : _b,
668
- token = _a.token,
800
+ _b = _a.submissionUrl,
801
+ submissionUrl = _b === void 0 ? defaultSubmissionUrl : _b,
802
+ _c = _a.environment,
803
+ environment = _c === void 0 ? 'prod' : _c,
669
804
  companyId = _a.companyId,
670
805
  enrollmentId = _a.enrollmentId,
671
806
  personalData = _a.personalData,
672
807
  cardData = _a.cardData,
673
- _c = _a.bypassAgeValidation,
674
- bypassAgeValidation = _c === void 0 ? false : _c,
675
- _d = _a.bypassNameMatching,
676
- bypassNameMatching = _d === void 0 ? true : _d,
677
- _e = _a.needImmediateResponse,
678
- needImmediateResponse = _e === void 0 ? false : _e,
679
- _f = _a.manualReviewRequired,
680
- manualReviewRequired = _f === void 0 ? false : _f,
681
- _g = _a.idBackImageRequired,
682
- idBackImageRequired = _g === void 0 ? true : _g,
683
- _h = _a.idImageResolutionCheck,
684
- idImageResolutionCheck = _h === void 0 ? true : _h,
685
- _j = _a.verifyIdWithExternalDatabases,
686
- verifyIdWithExternalDatabases = _j === void 0 ? false : _j,
687
- _k = _a.deduplicationEnabled,
688
- deduplicationEnabled = _k === void 0 ? false : _k,
689
- _l = _a.deduplicationSynchronous,
690
- deduplicationSynchronous = _l === void 0 ? false : _l,
691
- _m = _a.geolocationEnabled,
692
- geolocationEnabled = _m === void 0 ? true : _m,
693
- _o = _a.geolocationRequired,
694
- geolocationRequired = _o === void 0 ? false : _o,
695
- _p = _a.webhooksEnabled,
696
- webhooksEnabled = _p === void 0 ? false : _p,
808
+ _d = _a.bypassAgeValidation,
809
+ bypassAgeValidation = _d === void 0 ? false : _d,
810
+ _e = _a.bypassNameMatching,
811
+ bypassNameMatching = _e === void 0 ? true : _e,
812
+ _f = _a.needImmediateResponse,
813
+ needImmediateResponse = _f === void 0 ? false : _f,
814
+ _g = _a.manualReviewRequired,
815
+ manualReviewRequired = _g === void 0 ? false : _g,
816
+ _h = _a.idBackImageRequired,
817
+ idBackImageRequired = _h === void 0 ? true : _h,
818
+ _j = _a.idImageResolutionCheck,
819
+ idImageResolutionCheck = _j === void 0 ? true : _j,
820
+ _k = _a.verifyIdWithExternalDatabases,
821
+ verifyIdWithExternalDatabases = _k === void 0 ? false : _k,
822
+ _l = _a.deduplicationEnabled,
823
+ deduplicationEnabled = _l === void 0 ? false : _l,
824
+ _m = _a.deduplicationSynchronous,
825
+ deduplicationSynchronous = _m === void 0 ? false : _m,
826
+ idCardForFaceMatch = _a.idCardForFaceMatch,
827
+ _o = _a.geolocationEnabled,
828
+ geolocationEnabled = _o === void 0 ? true : _o,
829
+ _p = _a.geolocationRequired,
830
+ geolocationRequired = _p === void 0 ? false : _p,
831
+ _q = _a.webhooksEnabled,
832
+ webhooksEnabled = _q === void 0 ? false : _q,
697
833
  webhooksClientTraceId = _a.webhooksClientTraceId,
698
- _q = _a.webhooksStripSpecialCharacters,
699
- webhooksStripSpecialCharacters = _q === void 0 ? true : _q,
700
- _r = _a.webhooksSendInputImages,
701
- webhooksSendInputImages = _r === void 0 ? false : _r,
702
- _s = _a.webhooksSendProcessedImages,
703
- webhooksSendProcessedImages = _s === void 0 ? false : _s,
704
- _t = _a.webhooksFireOnReview,
705
- webhooksFireOnReview = _t === void 0 ? false : _t,
834
+ _r = _a.webhooksStripSpecialCharacters,
835
+ webhooksStripSpecialCharacters = _r === void 0 ? true : _r,
836
+ _s = _a.webhooksSendInputImages,
837
+ webhooksSendInputImages = _s === void 0 ? false : _s,
838
+ _t = _a.webhooksSendProcessedImages,
839
+ webhooksSendProcessedImages = _t === void 0 ? false : _t,
840
+ _u = _a.webhooksFireOnReview,
841
+ webhooksFireOnReview = _u === void 0 ? false : _u,
706
842
  precapturedDocuments = _a.precapturedDocuments,
707
- _u = _a.documentServiceUrl,
708
- documentServiceUrl = _u === void 0 ? 'https://portal-api-dev.idmission.com/files/' : _u,
709
- // 'http://localhost:10000/files/',
843
+ _v = _a.documentServiceUrl,
844
+ documentServiceUrl = _v === void 0 ? defaultDocumentServiceUrl : _v,
710
845
  onSubmit = _a.onSubmit,
711
846
  onBeforeSubmit = _a.onBeforeSubmit,
712
847
  onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
848
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
849
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
850
+ onDocumentUploaded = _a.onDocumentUploaded,
851
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
713
852
  onResponseReceived = _a.onResponseReceived,
714
853
  onRequestFailure = _a.onRequestFailure;
715
- var _v = useState(SubmissionStatus.READY),
716
- submissionStatus = _v[0],
717
- setSubmissionStatus = _v[1];
718
- var _w = useState(null),
719
- submissionRequest = _w[0],
720
- setSubmissionRequest = _w[1];
854
+ var sessionId = useAuthContext()[0].sessionId;
855
+ var _w = useState(SubmissionStatus.READY),
856
+ submissionStatus = _w[0],
857
+ setSubmissionStatus = _w[1];
721
858
  var _x = useState(null),
722
- submissionResponse = _x[0],
723
- setSubmissionResponse = _x[1];
859
+ submissionRequest = _x[0],
860
+ setSubmissionRequest = _x[1];
724
861
  var _y = useState(null),
725
- submissionError = _y[0],
726
- setSubmissionError = _y[1];
862
+ submissionResponse = _y[0],
863
+ setSubmissionResponse = _y[1];
727
864
  var _z = useState(null),
728
- retrySubmission = _z[0],
729
- setRetrySubmission = _z[1];
865
+ submissionError = _z[0],
866
+ setSubmissionError = _z[1];
730
867
  var _0 = useState(null),
731
- livenessCheckRequest = _0[0],
732
- setLivenessCheckRequest = _0[1];
868
+ retrySubmission = _0[0],
869
+ setRetrySubmission = _0[1];
733
870
  var _1 = useState(null),
734
- idFrontImage = _1[0],
735
- setIdFrontImage = _1[1];
871
+ livenessCheckRequest = _1[0],
872
+ setLivenessCheckRequest = _1[1];
736
873
  var _2 = useState(null),
737
- idBackImage = _2[0],
738
- setIdBackImage = _2[1];
874
+ idFrontImage = _2[0],
875
+ setIdFrontImage = _2[1];
739
876
  var _3 = useState(null),
740
- passportImage = _3[0],
741
- setPassportImage = _3[1];
877
+ idBackImage = _3[0],
878
+ setIdBackImage = _3[1];
742
879
  var _4 = useState(null),
743
- selfieImage = _4[0],
744
- setSelfieImage = _4[1];
880
+ passportImage = _4[0],
881
+ setPassportImage = _4[1];
745
882
  var _5 = useState(null),
746
- signatureData = _5[0],
747
- setSignatureData = _5[1];
883
+ selfieImage = _5[0],
884
+ setSelfieImage = _5[1];
748
885
  var _6 = useState(null),
749
- signatureVideoUrl = _6[0],
750
- setSignatureVideoUrl = _6[1];
886
+ signatureData = _6[0],
887
+ setSignatureData = _6[1];
751
888
  var _7 = useState(null),
752
- idCaptureVideoUrl = _7[0],
753
- setIdCaptureVideoUrl = _7[1];
889
+ signatureVideoUrl = _7[0],
890
+ setSignatureVideoUrl = _7[1];
754
891
  var _8 = useState(null),
755
- idCaptureVideoIdFrontImage = _8[0],
756
- setIdCaptureVideoIdFrontImage = _8[1];
892
+ idCaptureVideoUrl = _8[0],
893
+ setIdCaptureVideoUrl = _8[1];
757
894
  var _9 = useState(null),
758
- idCaptureVideoIdBackImage = _9[0],
759
- setIdCaptureVideoIdBackImage = _9[1];
895
+ idCaptureVideoIdFrontImage = _9[0],
896
+ setIdCaptureVideoIdFrontImage = _9[1];
760
897
  var _10 = useState(null),
761
- additionalDocuments = _10[0],
762
- setAdditionalDocuments = _10[1];
898
+ idCaptureVideoIdBackImage = _10[0],
899
+ setIdCaptureVideoIdBackImage = _10[1];
763
900
  var _11 = useState(null),
764
- geolocationResult = _11[0],
765
- setGeolocationResult = _11[1];
766
- var _12 = useState(0),
767
- geolocationAttempts = _12[0],
768
- setGeolocationAttempts = _12[1];
769
- var _13 = useState(false),
770
- geolocationBlocked = _13[0],
771
- setGeolocationBlocked = _13[1];
772
- var _14 = useState([]),
773
- idFrontCaptureAttempts = _14[0],
774
- setIdFrontCaptureAttempts = _14[1];
901
+ additionalDocuments = _11[0],
902
+ setAdditionalDocuments = _11[1];
903
+ var _12 = useState(null),
904
+ geolocationResult = _12[0],
905
+ setGeolocationResult = _12[1];
906
+ var _13 = useState(0),
907
+ geolocationAttempts = _13[0],
908
+ setGeolocationAttempts = _13[1];
909
+ var _14 = useState(false),
910
+ geolocationBlocked = _14[0],
911
+ setGeolocationBlocked = _14[1];
775
912
  var _15 = useState([]),
776
- idBackCaptureAttempts = _15[0],
777
- setIdBackCaptureAttempts = _15[1];
913
+ idFrontCaptureAttempts = _15[0],
914
+ setIdFrontCaptureAttempts = _15[1];
778
915
  var _16 = useState([]),
779
- selfieCaptureAttempts = _16[0],
780
- setSelfieCaptureAttempts = _16[1];
916
+ idBackCaptureAttempts = _16[0],
917
+ setIdBackCaptureAttempts = _16[1];
918
+ var _17 = useState([]),
919
+ selfieCaptureAttempts = _17[0],
920
+ setSelfieCaptureAttempts = _17[1];
781
921
  var logIdFrontCaptureAttempt = useCallback(function (attempt) {
782
922
  setIdFrontCaptureAttempts(function (attempts) {
783
923
  return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
@@ -798,13 +938,143 @@ var SubmissionProvider = function SubmissionProvider(_a) {
798
938
  setSelfieImage(dataUrlToBase64Sync(precapturedDocuments.selfie.imageData));
799
939
  }
800
940
  }, [precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie]);
941
+ var uploadDocument = useCallback(function (src, metadata) {
942
+ return new Promise(function (resolve, reject) {
943
+ return __awaiter(void 0, void 0, void 0, function () {
944
+ var blob, _a, upload;
945
+ return __generator(this, function (_b) {
946
+ switch (_b.label) {
947
+ case 0:
948
+ blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
949
+ _a = onBeforeDocumentUpload;
950
+ if (!_a) return [3 /*break*/, 2];
951
+ return [4 /*yield*/, onBeforeDocumentUpload === null || onBeforeDocumentUpload === void 0 ? void 0 : onBeforeDocumentUpload(blob, metadata)];
952
+ case 1:
953
+ _a = _b.sent() === false;
954
+ _b.label = 2;
955
+ case 2:
956
+ if (_a) return [2 /*return*/, resolve(blobToB64(blob))];
957
+ upload = createUpload(blob, {
958
+ endpoint: documentServiceUrl,
959
+ retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
960
+ headers: {
961
+ 'X-Session-Id': sessionId
962
+ },
963
+ metadata: metadata || {
964
+ filetype: blob.type
965
+ },
966
+ onProgress: function onProgress(bytesUploaded, bytesTotal) {
967
+ onDocumentUploadProgress === null || onDocumentUploadProgress === void 0 ? void 0 : onDocumentUploadProgress({
968
+ bytesUploaded: bytesUploaded,
969
+ bytesTotal: bytesTotal,
970
+ percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
971
+ metadata: metadata
972
+ });
973
+ },
974
+ onSuccess: function onSuccess() {
975
+ var _a;
976
+ var documentId = 'urn:documentsv1:' + ((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift());
977
+ onDocumentUploaded === null || onDocumentUploaded === void 0 ? void 0 : onDocumentUploaded(documentId, metadata);
978
+ resolve(documentId);
979
+ },
980
+ onError: function onError(error) {
981
+ console.log('Failed because: ' + error);
982
+ onDocumentUploadFailed === null || onDocumentUploadFailed === void 0 ? void 0 : onDocumentUploadFailed(error, metadata);
983
+ reject(error);
984
+ }
985
+ });
986
+ // Check if there are any previous uploads to continue.
987
+ upload.findPreviousUploads().then(function (previousUploads) {
988
+ // Found previous uploads so we select the first one.
989
+ if (previousUploads.length) {
990
+ upload.resumeFromPreviousUpload(previousUploads[0]);
991
+ }
992
+ // Start the upload
993
+ upload.start();
994
+ });
995
+ return [2 /*return*/];
996
+ }
997
+ });
998
+ });
999
+ });
1000
+ }, [onBeforeDocumentUpload, documentServiceUrl, sessionId, onDocumentUploadProgress, onDocumentUploaded, onDocumentUploadFailed]);
801
1001
  var buildSubmissionPayload = useCallback(function () {
802
1002
  return __awaiter(void 0, void 0, void 0, function () {
803
- var submissionRequest, _a, _b, onBeforeSubmitResult;
804
- var _c, _d;
805
- return __generator(this, function (_e) {
806
- switch (_e.label) {
1003
+ function uploadIfPossible(src, filename, filetype) {
1004
+ if (filetype === void 0) {
1005
+ filetype = 'image/jpeg';
1006
+ }
1007
+ return __awaiter(this, void 0, void 0, function () {
1008
+ return __generator(this, function (_a) {
1009
+ switch (_a.label) {
1010
+ case 0:
1011
+ if (!documentServiceUrl) return [2 /*return*/, src];
1012
+ if (!src.startsWith('data:')) src = "data:".concat(filetype, ";base64,").concat(src);
1013
+ return [4 /*yield*/, uploadDocument(src, {
1014
+ filename: filename,
1015
+ filetype: filetype
1016
+ })];
1017
+ case 1:
1018
+ return [2 /*return*/, _a.sent()];
1019
+ }
1020
+ });
1021
+ });
1022
+ }
1023
+ var documents, _a, _b, submissionRequest, onBeforeSubmitResult;
1024
+ var _c;
1025
+ var _d, _e;
1026
+ return __generator(this, function (_f) {
1027
+ switch (_f.label) {
807
1028
  case 0:
1029
+ _c = {
1030
+ idFrontImage: idFrontImage,
1031
+ idBackImage: idBackImage,
1032
+ passportImage: passportImage,
1033
+ selfieImage: selfieImage
1034
+ };
1035
+ _a = signatureVideoUrl;
1036
+ if (!_a) return [3 /*break*/, 2];
1037
+ return [4 /*yield*/, videoDataUrlToB64(signatureVideoUrl)];
1038
+ case 1:
1039
+ _a = _f.sent();
1040
+ _f.label = 2;
1041
+ case 2:
1042
+ _c.signatureVideo = _a;
1043
+ _b = idCaptureVideoUrl;
1044
+ if (!_b) return [3 /*break*/, 4];
1045
+ return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoUrl)];
1046
+ case 3:
1047
+ _b = _f.sent();
1048
+ _f.label = 4;
1049
+ case 4:
1050
+ documents = (_c.idCaptureVideo = _b, _c.idCaptureVideoIdFrontImage = idCaptureVideoIdFrontImage, _c.idCaptureVideoIdBackImage = idCaptureVideoIdBackImage, _c);
1051
+ if (signatureData) {
1052
+ documents.signatureImage = signatureData === null || signatureData === void 0 ? void 0 : signatureData.fileContent;
1053
+ }
1054
+ if (!documentServiceUrl) return [3 /*break*/, 6];
1055
+ return [4 /*yield*/, Promise.all(Object.keys(documents).map(function (k) {
1056
+ return __awaiter(void 0, void 0, void 0, function () {
1057
+ var _a, _b;
1058
+ return __generator(this, function (_c) {
1059
+ switch (_c.label) {
1060
+ case 0:
1061
+ if (!documents[k]) return [3 /*break*/, 2];
1062
+ _a = documents;
1063
+ _b = k;
1064
+ return [4 /*yield*/, uploadIfPossible(documents[k], k)];
1065
+ case 1:
1066
+ _a[_b] = _c.sent();
1067
+ _c.label = 2;
1068
+ case 2:
1069
+ return [2 /*return*/];
1070
+ }
1071
+ });
1072
+ });
1073
+ }))];
1074
+ case 5:
1075
+ _f.sent();
1076
+ _f.label = 6;
1077
+ case 6:
808
1078
  submissionRequest = {
809
1079
  securityData: {
810
1080
  userName: '',
@@ -836,24 +1106,22 @@ var SubmissionProvider = function SubmissionProvider(_a) {
836
1106
  idImageResolutionCheck: idImageResolutionCheck ? 'Y' : 'N'
837
1107
  }
838
1108
  };
839
- if (idFrontImage) {
840
- submissionRequest.customerData.idData.idImageFront = idFrontImage;
1109
+ if (documents.idFrontImage) {
1110
+ submissionRequest.customerData.idData.idImageFront = documents.idFrontImage;
841
1111
  }
842
- if (idBackImage) {
843
- submissionRequest.customerData.idData.idImageBack = idBackImage;
1112
+ if (documents.idBackImage) {
1113
+ submissionRequest.customerData.idData.idImageBack = documents.idBackImage;
844
1114
  }
845
- if (passportImage) {
846
- submissionRequest.customerData.idData.idImageFront = passportImage;
1115
+ if (documents.passportImage) {
1116
+ submissionRequest.customerData.idData.idImageFront = documents.passportImage;
847
1117
  }
848
- if (selfieImage) {
849
- if (action === SubmissionAction.IDENTIFY) {
850
- // TODO: remove once API is fixed
851
- submissionRequest.biometricData = {
852
- selfie: selfieImage
853
- };
854
- }
1118
+ if (documents.selfieImage) {
1119
+ // if (action === SubmissionAction.IDENTIFY) {
1120
+ // // TODO: remove once API is fixed
1121
+ // submissionRequest.biometricData = { selfie: documents.selfieImage }
1122
+ // }
855
1123
  submissionRequest.customerData.biometricData = {
856
- selfie: selfieImage
1124
+ selfie: documents.selfieImage
857
1125
  };
858
1126
  }
859
1127
  if (companyId) {
@@ -868,23 +1136,20 @@ var SubmissionProvider = function SubmissionProvider(_a) {
868
1136
  submissionRequest.customerData.cardData = cardData;
869
1137
  }
870
1138
  if (enrollmentId) {
871
- (_c = submissionRequest.customerData).personalData || (_c.personalData = {});
1139
+ (_d = submissionRequest.customerData).personalData || (_d.personalData = {});
872
1140
  submissionRequest.customerData.personalData.uniqueNumber = enrollmentId;
873
1141
  }
874
1142
  if (webhooksClientTraceId) {
875
1143
  submissionRequest.additionalData.clientTraceId = webhooksClientTraceId;
876
1144
  }
877
- if (!signatureData) return [3 /*break*/, 2];
878
- submissionRequest.customerData.signatureData = {
879
- signatureImage: JSON.stringify(signatureData)
880
- };
881
- if (!signatureVideoUrl) return [3 /*break*/, 2];
882
- _a = submissionRequest.customerData.signatureData;
883
- return [4 /*yield*/, videoDataUrlToB64(signatureVideoUrl)];
884
- case 1:
885
- _a.signatureVideo = _e.sent();
886
- _e.label = 2;
887
- case 2:
1145
+ if (signatureData) {
1146
+ submissionRequest.customerData.signatureData = {
1147
+ signatureImage: JSON.stringify(signatureData)
1148
+ };
1149
+ if (documents.signatureVideo) {
1150
+ submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
1151
+ }
1152
+ }
888
1153
  if (additionalDocuments) {
889
1154
  submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
890
1155
  return __assign(__assign({}, d), {
@@ -894,19 +1159,15 @@ var SubmissionProvider = function SubmissionProvider(_a) {
894
1159
  });
895
1160
  });
896
1161
  }
897
- if (!idCaptureVideoUrl) return [3 /*break*/, 4];
898
- (_d = submissionRequest.customerData).biometricData || (_d.biometricData = {});
899
- _b = submissionRequest.customerData.biometricData;
900
- return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoUrl)];
901
- case 3:
902
- _b.videoData = _e.sent();
903
- _e.label = 4;
904
- case 4:
905
- if (idCaptureVideoIdFrontImage) {
906
- submissionRequest.customerData.idData.videoIdImageFront = dataUrlToBase64Sync(idCaptureVideoIdFrontImage);
1162
+ if (documents.idCaptureVideo) {
1163
+ (_e = submissionRequest.customerData).biometricData || (_e.biometricData = {});
1164
+ submissionRequest.customerData.biometricData.videoData = documents.idCaptureVideo;
1165
+ }
1166
+ if (documents.idCaptureVideoIdFrontImage) {
1167
+ submissionRequest.customerData.idData.videoIdImageFront = documents.idCaptureVideoIdFrontImage;
907
1168
  }
908
- if (idCaptureVideoIdBackImage) {
909
- submissionRequest.customerData.idData.videoIdImageBack = dataUrlToBase64Sync(idCaptureVideoIdBackImage);
1169
+ if (documents.idCaptureVideoIdBackImage) {
1170
+ submissionRequest.customerData.idData.videoIdImageBack = documents.idCaptureVideoIdBackImage;
910
1171
  }
911
1172
  attachMetadataToRequest(submissionRequest, {
912
1173
  selfieCaptureAttempts: selfieCaptureAttempts,
@@ -914,18 +1175,18 @@ var SubmissionProvider = function SubmissionProvider(_a) {
914
1175
  idBackCaptureAttempts: idBackCaptureAttempts,
915
1176
  geolocationResult: geolocationResult
916
1177
  });
917
- if (!onBeforeSubmit) return [3 /*break*/, 6];
1178
+ if (!onBeforeSubmit) return [3 /*break*/, 8];
918
1179
  return [4 /*yield*/, onBeforeSubmit(submissionRequest)];
919
- case 5:
920
- onBeforeSubmitResult = _e.sent();
1180
+ case 7:
1181
+ onBeforeSubmitResult = _f.sent();
921
1182
  if (onBeforeSubmitResult) submissionRequest = onBeforeSubmitResult;
922
- _e.label = 6;
923
- case 6:
1183
+ _f.label = 8;
1184
+ case 8:
924
1185
  return [2 /*return*/, submissionRequest];
925
1186
  }
926
1187
  });
927
1188
  });
928
- }, [action, additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, companyId, deduplicationEnabled, deduplicationSynchronous, enrollmentId, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idFrontCaptureAttempts, idFrontImage, idImageResolutionCheck, manualReviewRequired, needImmediateResponse, onBeforeSubmit, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData, signatureVideoUrl, verifyIdWithExternalDatabases, webhooksClientTraceId, webhooksEnabled, webhooksFireOnReview, webhooksSendInputImages, webhooksSendProcessedImages, webhooksStripSpecialCharacters]);
1189
+ }, [action, additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, companyId, deduplicationEnabled, deduplicationSynchronous, documentServiceUrl, enrollmentId, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idFrontCaptureAttempts, idFrontImage, idImageResolutionCheck, manualReviewRequired, needImmediateResponse, onBeforeSubmit, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData, signatureVideoUrl, uploadDocument, verifyIdWithExternalDatabases, webhooksClientTraceId, webhooksEnabled, webhooksFireOnReview, webhooksSendInputImages, webhooksSendProcessedImages, webhooksStripSpecialCharacters]);
929
1190
  var defaultOnSubmit = useCallback(function () {
930
1191
  return __awaiter(void 0, void 0, void 0, function () {
931
1192
  var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
@@ -951,11 +1212,11 @@ var SubmissionProvider = function SubmissionProvider(_a) {
951
1212
  return [4 /*yield*/, buildSubmissionPayload()];
952
1213
  case 2:
953
1214
  payload = _b.sent();
954
- host = url || determineSubmissionHost(environment, token);
955
- endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage, !!token);
1215
+ host = submissionUrl || determineSubmissionHost(environment);
1216
+ endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage);
956
1217
  return [4 /*yield*/, fetch(host + endpoint, {
957
1218
  method: 'POST',
958
- headers: apiHeaders(token),
1219
+ headers: apiHeaders(sessionId),
959
1220
  body: JSON.stringify(payload)
960
1221
  })["catch"](function (e) {
961
1222
  throw new NetworkError(e.message);
@@ -1003,7 +1264,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1003
1264
  }
1004
1265
  });
1005
1266
  });
1006
- }, [action, buildSubmissionPayload, environment, idBackImage, idFrontImage, onRequestFailure, onResponseReceived, passportImage, selfieImage, token, url]);
1267
+ }, [action, buildSubmissionPayload, submissionUrl, environment, idFrontImage, idBackImage, passportImage, selfieImage, sessionId, onResponseReceived, onRequestFailure]);
1007
1268
  var submit = useCallback(function () {
1008
1269
  return __awaiter(void 0, void 0, void 0, function () {
1009
1270
  var _a;
@@ -1048,6 +1309,15 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1048
1309
  estimateAge: 'N',
1049
1310
  predictGender: 'N'
1050
1311
  }, _a);
1312
+ if (idCardForFaceMatch) {
1313
+ request.customerData.idData = {
1314
+ idImageFront: idCardForFaceMatch
1315
+ };
1316
+ // TODO: remove when fixed
1317
+ request.customerData.additionalData = {
1318
+ uniqueRequestId: request.additionalData.uniqueRequestId
1319
+ };
1320
+ }
1051
1321
  attachMetadataToRequest(request, {
1052
1322
  selfieCaptureAttempts: selfieCaptureAttempts,
1053
1323
  idFrontCaptureAttempts: idFrontCaptureAttempts,
@@ -1062,11 +1332,11 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1062
1332
  if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
1063
1333
  _d.label = 3;
1064
1334
  case 3:
1065
- host = url || determineSubmissionHost(environment, token);
1066
- endpoint = liveCheckEndpoint(!!token);
1335
+ host = submissionUrl || determineSubmissionHost(environment);
1336
+ endpoint = liveCheckEndpoint(!!idCardForFaceMatch);
1067
1337
  return [4 /*yield*/, fetch(host + endpoint, {
1068
1338
  method: 'POST',
1069
- headers: apiHeaders(token),
1339
+ headers: apiHeaders(sessionId),
1070
1340
  body: JSON.stringify(request)
1071
1341
  })["catch"](function (e) {
1072
1342
  throw new NetworkError(e.message);
@@ -1112,7 +1382,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1112
1382
  }
1113
1383
  });
1114
1384
  });
1115
- }, [environment, geolocationResult, idBackCaptureAttempts, idFrontCaptureAttempts, onBeforeLivenessCheck, onRequestFailure, selfieCaptureAttempts, token, url, webhooksStripSpecialCharacters]);
1385
+ }, [webhooksStripSpecialCharacters, idCardForFaceMatch, selfieCaptureAttempts, idFrontCaptureAttempts, idBackCaptureAttempts, geolocationResult, onBeforeLivenessCheck, submissionUrl, environment, sessionId, onRequestFailure]);
1116
1386
  var retryLocationAccess = useCallback(function () {
1117
1387
  setGeolocationAttempts(function (n) {
1118
1388
  return n + 1;
@@ -1138,125 +1408,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1138
1408
  setSubmissionStatus(SubmissionStatus.READY);
1139
1409
  retrySubmission();
1140
1410
  }, [retrySubmission]);
1141
- var _17 = useState('NOT_PARSED'),
1142
- tokenState = _17[0],
1143
- setTokenState = _17[1];
1144
- var _18 = useState(null),
1145
- tokenError = _18[0],
1146
- setTokenError = _18[1];
1147
- useEffect(function () {
1148
- if (typeof window === 'undefined') return;
1149
- (function () {
1150
- return __awaiter(void 0, void 0, void 0, function () {
1151
- var parsed, iss, publicKey, resp, e_3, valid, parts, e_4, exp;
1152
- return __generator(this, function (_a) {
1153
- switch (_a.label) {
1154
- case 0:
1155
- setTokenState('PARSING');
1156
- if (!token) return [2 /*return*/, setTokenState('MISSING')];
1157
- try {
1158
- parsed = parseJwt(token);
1159
- } catch (e) {
1160
- console.error('error parsing token', e);
1161
- return [2 /*return*/, setTokenState('INVALID_FORMAT')];
1162
- }
1163
- iss = parsed.iss;
1164
- if (!allowedTokenIssuers.some(function (allowedIss) {
1165
- return iss.startsWith(allowedIss);
1166
- })) {
1167
- console.error('issuer is not allowed', iss);
1168
- return [2 /*return*/, setTokenState('ISSUER_NOT_ALLOWED')];
1169
- }
1170
- _a.label = 1;
1171
- case 1:
1172
- _a.trys.push([1, 4,, 5]);
1173
- return [4 /*yield*/, fetch(iss).then(function (r) {
1174
- return r.json();
1175
- })];
1176
- case 2:
1177
- resp = _a.sent();
1178
- return [4 /*yield*/, importRsaKey("-----BEGIN PUBLIC KEY-----\n".concat(resp.public_key, "\n-----END PUBLIC KEY-----"))];
1179
- case 3:
1180
- publicKey = _a.sent();
1181
- return [3 /*break*/, 5];
1182
- case 4:
1183
- e_3 = _a.sent();
1184
- console.error('error fetching public key', e_3);
1185
- setTokenError(new TokenPublicKeyError(e_3, iss));
1186
- return [2 /*return*/, setTokenState('PUBLIC_KEY_LOAD_FAILED')];
1187
- case 5:
1188
- valid = false;
1189
- _a.label = 6;
1190
- case 6:
1191
- _a.trys.push([6, 8,, 9]);
1192
- parts = token.split('.');
1193
- return [4 /*yield*/, window.crypto.subtle.verify({
1194
- name: 'RSASSA-PKCS1-v1_5'
1195
- }, publicKey,
1196
- //from generateKey or importKey above
1197
- str2ab(parts[1]),
1198
- //ArrayBuffer of the signature
1199
- str2ab(parts[2]))];
1200
- case 7:
1201
- _a.sent();
1202
- valid = true;
1203
- return [3 /*break*/, 9];
1204
- case 8:
1205
- e_4 = _a.sent();
1206
- console.error('error validating token', e_4);
1207
- return [3 /*break*/, 9];
1208
- case 9:
1209
- if (!valid) return [2 /*return*/, setTokenState('INVALID_SIGNATURE')];
1210
- exp = parsed.exp;
1211
- if (Date.now() >= exp * 1000) {
1212
- return [2 /*return*/, setTokenState('EXPIRED')];
1213
- }
1214
- setTokenState('GOOD');
1215
- return [2 /*return*/];
1216
- }
1217
- });
1218
- });
1219
- })();
1220
- }, [token]);
1221
- var uploadDocument = useCallback(function (blob) {
1222
- return new Promise(function (resolve, reject) {
1223
- import('tus-js-client').then(function (tus) {
1224
- var upload = new tus.Upload(blob, {
1225
- endpoint: documentServiceUrl,
1226
- retryDelays: [0, 3000, 5000, 10000, 20000],
1227
- metadata: {
1228
- filename: 'My File',
1229
- filetype: 'image/jpeg'
1230
- },
1231
- headers: {
1232
- Authorization: "Bearer ".concat(token)
1233
- },
1234
- onProgress: function onProgress(bytesUploaded, bytesTotal) {
1235
- var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2);
1236
- console.log(bytesUploaded, bytesTotal, percentage + '%');
1237
- },
1238
- onSuccess: function onSuccess() {
1239
- var _a;
1240
- console.log('Download from %s', upload.url);
1241
- resolve('urn:documentsv1:' + ((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1242
- },
1243
- onError: function onError(error) {
1244
- console.log('Failed because: ' + error);
1245
- reject(error);
1246
- }
1247
- });
1248
- // Check if there are any previous uploads to continue.
1249
- upload.findPreviousUploads().then(function (previousUploads) {
1250
- // Found previous uploads so we select the first one.
1251
- if (previousUploads.length) {
1252
- upload.resumeFromPreviousUpload(previousUploads[0]);
1253
- }
1254
- // Start the upload
1255
- upload.start();
1256
- });
1257
- });
1258
- });
1259
- }, [documentServiceUrl, token]);
1260
1411
  var value = {
1261
1412
  submit: submit,
1262
1413
  submissionStatus: submissionStatus,
@@ -1292,26 +1443,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1292
1443
  checkLiveness: checkLiveness,
1293
1444
  retryLocationAccess: retryLocationAccess
1294
1445
  };
1295
- if (tokenState === 'MISSING') {
1296
- return /*#__PURE__*/React__default.createElement(TokenMissingErrorOverlay, null);
1297
- }
1298
- if (tokenState === 'INVALID_FORMAT') {
1299
- return /*#__PURE__*/React__default.createElement(TokenInvalidFormatErrorOverlay, null);
1300
- }
1301
- if (tokenState === 'INVALID_SIGNATURE') {
1302
- return /*#__PURE__*/React__default.createElement(TokenInvalidSignatureErrorOverlay, null);
1303
- }
1304
- if (tokenState === 'EXPIRED') {
1305
- return /*#__PURE__*/React__default.createElement(TokenExpiredErrorOverlay, null);
1306
- }
1307
- if (tokenState === 'PUBLIC_KEY_LOAD_FAILED') {
1308
- return /*#__PURE__*/React__default.createElement(TokenPublicKeyErrorOverlay, {
1309
- error: tokenError
1310
- });
1311
- }
1312
- if (tokenState === 'ISSUER_NOT_ALLOWED') {
1313
- return /*#__PURE__*/React__default.createElement(TokenIssuerNotAllowedErrorOverlay, null);
1314
- }
1315
1446
  return /*#__PURE__*/React__default.createElement(SubmissionContext.Provider, {
1316
1447
  value: value
1317
1448
  }, geolocationRequired && geolocationBlocked ? ( /*#__PURE__*/React__default.createElement(GeolocationAccessDeniedOverlay, null)) : children, submissionError && ( /*#__PURE__*/React__default.createElement(SubmissionErrorOverlay, {
@@ -1319,28 +1450,30 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1319
1450
  onRetry: onRetry
1320
1451
  })));
1321
1452
  };
1322
- function str2ab(str) {
1323
- var buf = new ArrayBuffer(str.length);
1324
- var bufView = new Uint8Array(buf);
1325
- for (var i = 0, strLen = str.length; i < strLen; i++) {
1326
- bufView[i] = str.charCodeAt(i);
1327
- }
1328
- return buf;
1453
+ function createUpload(blob, options) {
1454
+ var UploadType =
1455
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1456
+ // @ts-ignore
1457
+ typeof window.tus !== 'undefined' ? window.tus.Upload : Upload;
1458
+ return new UploadType(blob, options);
1329
1459
  }
1330
- function importRsaKey(pem) {
1331
- if (typeof window === 'undefined') throw new Error('window cannot be undefined');
1332
- // fetch the part of the PEM string between header and footer
1333
- var pemHeader = '-----BEGIN PUBLIC KEY-----';
1334
- var pemFooter = '-----END PUBLIC KEY-----';
1335
- var pemContents = pem.substring(pemHeader.length, pem.length - pemFooter.length - 1);
1336
- // base64 decode the string to get the binary data
1337
- var binaryDerString = window.atob(pemContents);
1338
- // convert from a binary string to an ArrayBuffer
1339
- var binaryDer = str2ab(binaryDerString);
1340
- return window.crypto.subtle.importKey('spki', binaryDer, {
1341
- name: 'RSASSA-PKCS1-v1_5',
1342
- hash: 'SHA-256'
1343
- }, true, ['verify']);
1460
+ function convertBase64ToBlob(base64Image) {
1461
+ // Split into two parts
1462
+ var parts = base64Image.split(';base64,');
1463
+ // Hold the content type
1464
+ var imageType = parts[0].split(':')[1];
1465
+ // Decode Base64 string
1466
+ var decodedData = window.atob(parts[1]);
1467
+ // Create UNIT8ARRAY of size same as row data length
1468
+ var uInt8Array = new Uint8Array(decodedData.length);
1469
+ // Insert all character code into uInt8Array
1470
+ for (var i = 0; i < decodedData.length; ++i) {
1471
+ uInt8Array[i] = decodedData.charCodeAt(i);
1472
+ }
1473
+ // Return BLOB image after conversion
1474
+ return new Blob([uInt8Array], {
1475
+ type: imageType
1476
+ });
1344
1477
  }
1345
1478
 
1346
1479
  function getNativeBarcodeReaderResult(image) {
@@ -1476,7 +1609,7 @@ function getFrameDimensions(frame) {
1476
1609
  return [frameWidth, frameHeight];
1477
1610
  }
1478
1611
 
1479
- var InvisibleCanvas = styled.canvas(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
1612
+ var InvisibleCanvas = styled.canvas(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
1480
1613
  function drawToCanvas(canvas, frame, width, height) {
1481
1614
  if (!canvas) return;
1482
1615
  var ctx = canvas.getContext('2d');
@@ -1498,7 +1631,7 @@ function clearCanvas(canvas) {
1498
1631
  if (!ctx) return;
1499
1632
  ctx.clearRect(0, 0, canvas.width, canvas.height);
1500
1633
  }
1501
- var templateObject_1$C;
1634
+ var templateObject_1$B;
1502
1635
 
1503
1636
  function listAvailableCameras(facingMode, requestMicAccess) {
1504
1637
  if (requestMicAccess === void 0) {
@@ -1718,7 +1851,7 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1718
1851
  throw e;
1719
1852
  }
1720
1853
  });
1721
- }, [cameraAccessDenied, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
1854
+ }, [cameraAccessDenied, debugMode, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
1722
1855
  useEffect(function () {
1723
1856
  var _a;
1724
1857
  if (!videoDevice) return;
@@ -10006,7 +10139,7 @@ var useIdCaptureState = function useIdCaptureState() {
10006
10139
  return [state, dispatch];
10007
10140
  };
10008
10141
 
10009
- var DebugStatsPane = styled.span(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"])));
10142
+ var DebugStatsPane = styled.span(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"])));
10010
10143
  var ObjectDetectionDebugOverlayDiv = styled.div(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"])), function (_a) {
10011
10144
  var $flipX = _a.$flipX;
10012
10145
  return $flipX ? 'transform: scaleX(-1);' : '';
@@ -10201,7 +10334,7 @@ function SelfieCaptureFaceKeypoint(_a) {
10201
10334
  }
10202
10335
  });
10203
10336
  }
10204
- var templateObject_1$B, templateObject_2$q, templateObject_3$j, templateObject_4$e;
10337
+ var templateObject_1$A, templateObject_2$q, templateObject_3$j, templateObject_4$e;
10205
10338
 
10206
10339
  var enTranslation = {};
10207
10340
 
@@ -10356,7 +10489,7 @@ function useTranslations(verbiage, fallbacks) {
10356
10489
  }, [fallbacks, i18n.language, t, verbiage]);
10357
10490
  }
10358
10491
 
10359
- var GuidanceMessageContainerDiv = styled.div(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
10492
+ var GuidanceMessageContainerDiv = styled.div(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
10360
10493
  var $top = _a.$top;
10361
10494
  return $top !== null && $top !== void 0 ? $top : '10vh';
10362
10495
  }, function (_a) {
@@ -10376,7 +10509,7 @@ var GuidanceMessage = styled.div(templateObject_2$p || (templateObject_2$p = __m
10376
10509
  var _a, _b, _c, _d, _e, _f;
10377
10510
  return (_f = (_a = props.$textColor) !== null && _a !== void 0 ? _a : (_e = (_c = (_b = props.theme) === null || _b === void 0 ? void 0 : _b.guidanceMessages) === null || _c === void 0 ? void 0 : _c[(_d = props.$variant) !== null && _d !== void 0 ? _d : 'default']) === null || _e === void 0 ? void 0 : _e.textColor) !== null && _f !== void 0 ? _f : 'black';
10378
10511
  });
10379
- var templateObject_1$A, templateObject_2$p;
10512
+ var templateObject_1$z, templateObject_2$p;
10380
10513
 
10381
10514
  var IdCapture = function IdCapture(_a) {
10382
10515
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -10728,13 +10861,13 @@ var CameraAccessDeniedOverlay = function CameraAccessDeniedOverlay(_a) {
10728
10861
  finished: true
10729
10862
  }, verbiage.retryBtnText)));
10730
10863
  };
10731
- var StyledOverlayInner$2 = styled(OverlayInner$2)(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
10864
+ var StyledOverlayInner$2 = styled(OverlayInner$2)(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
10732
10865
  var StyledOverlayImageContainer$2 = styled(OverlayImageContainer)(templateObject_2$o || (templateObject_2$o = __makeTemplateObject(["\n flex-grow: 0;\n"], ["\n flex-grow: 0;\n"])));
10733
10866
  var Description$3 = styled.p(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n line-height: 1.5;\n margin-bottom: 50px;\n"], ["\n line-height: 1.5;\n margin-bottom: 50px;\n"])));
10734
10867
  var RetryButton = styled(LoaderButton)(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\n width: 200px;\n margin: 0 auto;\n"], ["\n width: 200px;\n margin: 0 auto;\n"])));
10735
- var templateObject_1$z, templateObject_2$o, templateObject_3$i, templateObject_4$d;
10868
+ var templateObject_1$y, templateObject_2$o, templateObject_3$i, templateObject_4$d;
10736
10869
 
10737
- var ExitCaptureStyledButton = styled.button(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"], ["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"])));
10870
+ var ExitCaptureStyledButton = styled.button(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"], ["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"])));
10738
10871
  var ExitCaptureButton = function ExitCaptureButton(_a) {
10739
10872
  var onClick = _a.onClick,
10740
10873
  className = _a.className;
@@ -10778,11 +10911,11 @@ var ExitCaptureButton = function ExitCaptureButton(_a) {
10778
10911
  y2: "19.75"
10779
10912
  }))));
10780
10913
  };
10781
- var templateObject_1$y;
10782
-
10783
- var ButtonsRow = styled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"], ["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));
10784
10914
  var templateObject_1$x;
10785
10915
 
10916
+ var ButtonsRow = styled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"], ["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));
10917
+ var templateObject_1$w;
10918
+
10786
10919
  function IdCaptureLoadingGraphic(props) {
10787
10920
  var isMobile = window.innerHeight > window.innerWidth;
10788
10921
  return isMobile ? ( /*#__PURE__*/React__default.createElement(IdCaptureLoadingGraphicMobile, __assign({}, props))) : ( /*#__PURE__*/React__default.createElement(IdCaptureLoadingGraphicDesktop, __assign({}, props)));
@@ -11416,7 +11549,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
11416
11549
  }
11417
11550
  }, verbiage.continueText))))));
11418
11551
  };
11419
- var OverlayInner$1 = styled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
11552
+ var OverlayInner$1 = styled.div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
11420
11553
  var _a, _b, _c, _d;
11421
11554
  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.backgroundColor) !== null && _d !== void 0 ? _d : '#ecedf3';
11422
11555
  }, function (props) {
@@ -11468,9 +11601,9 @@ var ContinueButton$1 = styled(LoaderButton)(templateObject_18 || (templateObject
11468
11601
  var _a, _b, _c, _d, _e, _f;
11469
11602
  return ((_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.continueBtnBorder) ? "border: ".concat((_f = (_e = (_d = props.theme) === null || _d === void 0 ? void 0 : _d.idCapture) === null || _e === void 0 ? void 0 : _e.loadingOverlay) === null || _f === void 0 ? void 0 : _f.continueBtnBorder, ";") : '';
11470
11603
  });
11471
- var templateObject_1$w, templateObject_2$n, templateObject_3$h, templateObject_4$c, templateObject_5$8, templateObject_6$7, templateObject_7$5, templateObject_8$3, templateObject_9$1, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14$1, templateObject_15$1, templateObject_16, templateObject_17, templateObject_18;
11604
+ var templateObject_1$v, templateObject_2$n, templateObject_3$h, templateObject_4$c, templateObject_5$8, templateObject_6$7, templateObject_7$5, templateObject_8$3, templateObject_9$1, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14$1, templateObject_15$1, templateObject_16, templateObject_17, templateObject_18;
11472
11605
 
11473
- var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
11606
+ var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
11474
11607
  var ContinuityCameraCheckbox = styled.input(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
11475
11608
  var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
11476
11609
  var _b, _c, _d, _e;
@@ -11582,7 +11715,7 @@ var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
11582
11715
  }
11583
11716
  }, cameraReady && modelsReady ? verbiage.continueText : modelsReady ? verbiage.cameraInitializingText : modelDownloadProgress >= 100 ? verbiage.modelsWarmingUpText : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)"))));
11584
11717
  };
11585
- var templateObject_1$v, templateObject_2$m;
11718
+ var templateObject_1$u, templateObject_2$m;
11586
11719
 
11587
11720
  var components$1 = {
11588
11721
  "default": IdCaptureLoadingOverlayDefault,
@@ -11625,7 +11758,7 @@ var CapturedDocumentImg = function CapturedDocumentImg(_a) {
11625
11758
  });
11626
11759
  };
11627
11760
 
11628
- var OverlayInstruction = styled.p(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
11761
+ var OverlayInstruction = styled.p(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
11629
11762
  var IdCaptureSuccess = function IdCaptureSuccess(_a) {
11630
11763
  var capturedDocuments = _a.capturedDocuments,
11631
11764
  // barcodeResult,
@@ -11720,7 +11853,7 @@ var CapturedImageWrapper = styled.div(templateObject_7$4 || (templateObject_7$4
11720
11853
  return (_c = (_b = (_a = props.theme.idCapture) === null || _a === void 0 ? void 0 : _a.success) === null || _b === void 0 ? void 0 : _b.imageBorderColor) !== null && _c !== void 0 ? _c : 'var(--idm-color-primary-400)';
11721
11854
  });
11722
11855
  var StyledImage = styled(CapturedDocumentImg)(templateObject_8$2 || (templateObject_8$2 = __makeTemplateObject(["\n width: 100%;\n border-radius: 4px;\n"], ["\n width: 100%;\n border-radius: 4px;\n"])));
11723
- var templateObject_1$u, templateObject_2$l, templateObject_3$g, templateObject_4$b, templateObject_5$7, templateObject_6$6, templateObject_7$4, templateObject_8$2;
11856
+ var templateObject_1$t, templateObject_2$l, templateObject_3$g, templateObject_4$b, templateObject_5$7, templateObject_6$6, templateObject_7$4, templateObject_8$2;
11724
11857
 
11725
11858
  var CameraVideoTag = function CameraVideoTag(_a) {
11726
11859
  var _b;
@@ -11751,10 +11884,10 @@ var CameraVideoTag = function CameraVideoTag(_a) {
11751
11884
  "$isRearFacing": (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing
11752
11885
  });
11753
11886
  };
11754
- var FullscreenVideoTag = styled.video(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
11887
+ var FullscreenVideoTag = styled.video(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
11755
11888
  return props.$isRearFacing ? '' : 'scaleX(-1)';
11756
11889
  });
11757
- var templateObject_1$t;
11890
+ var templateObject_1$s;
11758
11891
 
11759
11892
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
11760
11893
  var _this = this;
@@ -11789,10 +11922,10 @@ function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallb
11789
11922
  return !skipSuccessScreen || skipSuccessScreenResolvedFalse;
11790
11923
  }
11791
11924
 
11792
- var CameraFeedWrapper = styled.div(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
11925
+ var CameraFeedWrapper = styled.div(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
11793
11926
  return props.$mode === 'snapToGuides' ? "display: flex;\n position: absolute;\n left: ".concat(props.$x, "px;\n top: ").concat(props.$y, "px;\n width: ").concat(props.$w, "px;\n height: ").concat(props.$h, "px;") : "";
11794
11927
  });
11795
- var templateObject_1$s;
11928
+ var templateObject_1$r;
11796
11929
 
11797
11930
  function setCanvasDimensions(canvas, width, height) {
11798
11931
  var _a;
@@ -11826,7 +11959,7 @@ var GuideOrientationContext = /*#__PURE__*/createContext({
11826
11959
  }
11827
11960
  });
11828
11961
 
11829
- var StyledPageContainer = styled(PageContainer)(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n z-index: 1000;\n"], ["\n z-index: 1000;\n"])));
11962
+ var StyledPageContainer = styled(PageContainer)(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n z-index: 1000;\n"], ["\n z-index: 1000;\n"])));
11830
11963
  var GuidesContainer = styled.div(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"], ["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"])));
11831
11964
  var GuideCenterRow = styled.div(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"], ["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"])));
11832
11965
  var GuideRegion = styled.div(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"])), function (props) {
@@ -11978,9 +12111,9 @@ var regionClsx$1 = function regionClsx(classNames, which) {
11978
12111
  return v;
11979
12112
  }).join(' ');
11980
12113
  };
11981
- var templateObject_1$r, templateObject_2$k, templateObject_3$f, templateObject_4$a, templateObject_5$6, templateObject_6$5, templateObject_7$3, templateObject_8$1;
12114
+ var templateObject_1$q, templateObject_2$k, templateObject_3$f, templateObject_4$a, templateObject_5$6, templateObject_6$5, templateObject_7$3, templateObject_8$1;
11982
12115
 
11983
- var FlippingImage = styled(GuideImage)(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"], ["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"])), function (props) {
12116
+ var FlippingImage = styled(GuideImage)(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"], ["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"])), function (props) {
11984
12117
  return props.$transitionTime;
11985
12118
  }, function (props) {
11986
12119
  return props.$transforms;
@@ -12126,7 +12259,7 @@ var regionClsx = function regionClsx(classNames, which) {
12126
12259
  return v;
12127
12260
  }).join(' ');
12128
12261
  };
12129
- var templateObject_1$q, templateObject_2$j;
12262
+ var templateObject_1$p, templateObject_2$j;
12130
12263
 
12131
12264
  var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
12132
12265
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
@@ -12262,11 +12395,11 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
12262
12395
  imageVisible: imageVisible
12263
12396
  })));
12264
12397
  };
12265
- var CanvasWrapper$1 = styled.div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"])), function (props) {
12398
+ var CanvasWrapper$1 = styled.div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"])), function (props) {
12266
12399
  return props.$maskColor;
12267
12400
  });
12268
12401
  var Canvas$1 = styled.canvas(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
12269
- var templateObject_1$p, templateObject_2$i;
12402
+ var templateObject_1$o, templateObject_2$i;
12270
12403
 
12271
12404
  function IdCaptureGuides(_a) {
12272
12405
  var _b, _c;
@@ -12324,33 +12457,6 @@ function IdCaptureGuides(_a) {
12324
12457
  })));
12325
12458
  }
12326
12459
 
12327
- var Spinner = styled.div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])), function (_a) {
12328
- var $size = _a.$size;
12329
- return $size !== null && $size !== void 0 ? $size : 80;
12330
- }, function (_a) {
12331
- var $size = _a.$size;
12332
- return $size !== null && $size !== void 0 ? $size : 80;
12333
- }, function (_a) {
12334
- var $size = _a.$size;
12335
- return ($size !== null && $size !== void 0 ? $size : 80) - 16;
12336
- }, function (_a) {
12337
- var $size = _a.$size;
12338
- return ($size !== null && $size !== void 0 ? $size : 80) - 16;
12339
- }, function (_a) {
12340
- var $thickness = _a.$thickness;
12341
- return $thickness !== null && $thickness !== void 0 ? $thickness : 6;
12342
- }, function (_a) {
12343
- var $color = _a.$color;
12344
- return $color !== null && $color !== void 0 ? $color : '#888';
12345
- }, function (_a) {
12346
- var $color = _a.$color;
12347
- return $color !== null && $color !== void 0 ? $color : '#888';
12348
- }, function (_a) {
12349
- var $color = _a.$color;
12350
- return $color !== null && $color !== void 0 ? $color : '#888';
12351
- });
12352
- var templateObject_1$o;
12353
-
12354
12460
  var IdCaptureImagePreview = function IdCaptureImagePreview(_a) {
12355
12461
  var _b = _a.classNames,
12356
12462
  classNames = _b === void 0 ? {} : _b,
@@ -12562,7 +12668,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
12562
12668
  cameraRef = _d.cameraRef,
12563
12669
  videoRef = _d.videoRef;
12564
12670
  var uploadDocument = useContext(SubmissionContext).uploadDocument;
12565
- var uploadCapturedDocument = useCallback(function (content) {
12671
+ var uploadCapturedDocument = useCallback(function (content, filetype) {
12566
12672
  return __awaiter(void 0, void 0, void 0, function () {
12567
12673
  var documentId_1;
12568
12674
  return __generator(this, function (_a) {
@@ -12572,7 +12678,9 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
12572
12678
  dispatch({
12573
12679
  type: 'uploadStarted'
12574
12680
  });
12575
- return [4 /*yield*/, uploadDocument(content)];
12681
+ return [4 /*yield*/, uploadDocument(content, {
12682
+ filetype: filetype
12683
+ })];
12576
12684
  case 1:
12577
12685
  documentId_1 = _a.sent();
12578
12686
  setTimeout(function () {
@@ -12618,7 +12726,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
12618
12726
  type: 'setDocuments',
12619
12727
  payload: resolvedDocuments
12620
12728
  });
12621
- if ((_a = resolvedDocuments[0]) === null || _a === void 0 ? void 0 : _a.content) uploadCapturedDocument(resolvedDocuments[0].content);
12729
+ var firstDocumentContent = (_a = resolvedDocuments[0]) === null || _a === void 0 ? void 0 : _a.content;
12730
+ if (firstDocumentContent) uploadCapturedDocument(firstDocumentContent, firstDocumentContent.type);
12622
12731
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
12623
12732
  useEffect(function () {
12624
12733
  dispatch({
@@ -12841,7 +12950,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
12841
12950
  return __generator(this, function (_a) {
12842
12951
  switch (_a.label) {
12843
12952
  case 0:
12844
- return [4 /*yield*/, uploadCapturedDocument(content)];
12953
+ return [4 /*yield*/, uploadCapturedDocument(content, 'image/jpeg')];
12845
12954
  case 1:
12846
12955
  _a.sent();
12847
12956
  return [2 /*return*/];
@@ -13873,7 +13982,7 @@ var reducer$2 = function reducer(state, action) {
13873
13982
  requestError: new Error("".concat(statusMessage, ": ").concat(errorData))
13874
13983
  });
13875
13984
  }
13876
- var faceLive = resultData.verificationResult === 'Live Face Detected';
13985
+ var faceLive = ['Live Face Detected', 'Approved'].includes(resultData.verificationResult);
13877
13986
  var eyeCoveringDetected = resultData.eyeCovering === 'true';
13878
13987
  var maskDetected = resultData.faceMask === 'true';
13879
13988
  var headCoveringDetected = resultData.headCovering === 'true';
@@ -15252,8 +15361,7 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
15252
15361
  var _m = useVideoRecorder(cameraRef.current),
15253
15362
  isRecording = _m.isRecording,
15254
15363
  startRecording = _m.startRecording,
15255
- stopRecording = _m.stopRecording,
15256
- videoUrl = _m.videoUrl;
15364
+ stopRecording = _m.stopRecording;
15257
15365
  var _o = useState(null),
15258
15366
  signatureData = _o[0],
15259
15367
  setSignatureData = _o[1];
@@ -15271,32 +15379,54 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
15271
15379
  clearBtnText: 'Clear'
15272
15380
  });
15273
15381
  var outputCanvas = useRef(null);
15382
+ var recordingLock = useRef(false);
15274
15383
  useEffect(function () {
15275
- // delay 100ms to make sure outputCanvas has rendered.
15276
- setTimeout(function () {
15277
- if (!isRecording && !videoUrl && !!outputCanvas.current) {
15278
- startRecording();
15279
- var stream = outputCanvas.current.captureStream(25 /* fps */);
15280
- signatureRecorder.current = new MediaRecorder(stream, {
15281
- videoBitsPerSecond: 270000
15282
- });
15283
- signatureRecorder.current.start();
15284
- signatureRecorder.current.ondataavailable = function (event) {
15285
- var _a;
15286
- recordedChunks.current.push(event.data);
15287
- if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
15288
- signatureRecorder.current.stop();
15384
+ if (recordingLock.current) return;
15385
+ recordingLock.current = true;
15386
+ (function () {
15387
+ return __awaiter(void 0, void 0, void 0, function () {
15388
+ var stream;
15389
+ return __generator(this, function (_a) {
15390
+ switch (_a.label) {
15391
+ case 0:
15392
+ if (!!outputCanvas.current) return [3 /*break*/, 2];
15393
+ return [4 /*yield*/, new Promise(function (resolve) {
15394
+ var interval = setInterval(function () {
15395
+ if (outputCanvas.current) {
15396
+ clearInterval(interval);
15397
+ resolve(null);
15398
+ }
15399
+ }, 10);
15400
+ })];
15401
+ case 1:
15402
+ _a.sent();
15403
+ _a.label = 2;
15404
+ case 2:
15405
+ startRecording();
15406
+ stream = outputCanvas.current.captureStream(24 /* fps */);
15407
+ signatureRecorder.current = new MediaRecorder(stream, {
15408
+ videoBitsPerSecond: 270000
15409
+ });
15410
+ signatureRecorder.current.start();
15411
+ signatureRecorder.current.ondataavailable = function (event) {
15412
+ var _a;
15413
+ recordedChunks.current.push(event.data);
15414
+ if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
15415
+ signatureRecorder.current.stop();
15416
+ }
15417
+ };
15418
+ signatureRecorder.current.onstop = function () {
15419
+ var blob = new Blob(recordedChunks.current, {
15420
+ type: 'video/mp4'
15421
+ });
15422
+ setSignatureVideoData(blob);
15423
+ };
15424
+ return [2 /*return*/];
15289
15425
  }
15290
- };
15291
- signatureRecorder.current.onstop = function () {
15292
- var blob = new Blob(recordedChunks.current, {
15293
- type: 'video/mp4'
15294
- });
15295
- setSignatureVideoData(blob);
15296
- };
15297
- }
15298
- }, 100);
15299
- }, [isRecording, startRecording, videoUrl]);
15426
+ });
15427
+ });
15428
+ })();
15429
+ }, [startRecording]);
15300
15430
  useEffect(function () {
15301
15431
  if (signatureVideoData && signatureData && signatureDataUrl) {
15302
15432
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
@@ -15560,7 +15690,6 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
15560
15690
  onRetryClicked === null || onRetryClicked === void 0 ? void 0 : onRetryClicked();
15561
15691
  onExit();
15562
15692
  }, [onExit, onRetryClicked]);
15563
- var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onComplete);
15564
15693
  var onDoneClick = useCallback(function () {
15565
15694
  return __awaiter(void 0, void 0, void 0, function () {
15566
15695
  return __generator(this, function (_a) {
@@ -15575,6 +15704,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
15575
15704
  });
15576
15705
  });
15577
15706
  }, [onComplete, submit]);
15707
+ var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onDoneClick);
15578
15708
  return /*#__PURE__*/React__default.createElement(HighPerformanceSelfieGuidanceModelsProvider, {
15579
15709
  throttleMs: captureState === 'CAPTURING_SIGNATURE' ? 250 : 0,
15580
15710
  onModelError: onModelError,
@@ -15706,29 +15836,29 @@ var FlipImage = styled.img(templateObject_1$8 || (templateObject_1$8 = __makeTem
15706
15836
  var templateObject_1$8;
15707
15837
 
15708
15838
  var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15709
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
15710
- var _u = _a.requestedAction,
15711
- requestedAction = _u === void 0 ? 'SHOW_ID_FRONT' : _u,
15712
- _v = _a.satisfied,
15713
- satisfied = _v === void 0 ? false : _v,
15839
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
15840
+ var _y = _a.requestedAction,
15841
+ requestedAction = _y === void 0 ? 'SHOW_ID_FRONT' : _y,
15842
+ _z = _a.satisfied,
15843
+ satisfied = _z === void 0 ? false : _z,
15714
15844
  faceGuideBorderWidth = _a.faceGuideBorderWidth,
15715
15845
  faceGuideBorderColor = _a.faceGuideBorderColor,
15716
15846
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
15717
15847
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
15718
- _w = _a.assets,
15719
- assets = _w === void 0 ? {} : _w,
15720
- _x = _a.classNames,
15721
- classNames = _x === void 0 ? {} : _x,
15722
- _y = _a.verbiage,
15723
- rawVerbiage = _y === void 0 ? {} : _y;
15848
+ _0 = _a.assets,
15849
+ assets = _0 === void 0 ? {} : _0,
15850
+ _1 = _a.classNames,
15851
+ classNames = _1 === void 0 ? {} : _1,
15852
+ _2 = _a.verbiage,
15853
+ rawVerbiage = _2 === void 0 ? {} : _2;
15724
15854
  var cameraRef = useContext(CameraStateContext).cameraRef;
15725
15855
  var imageRef = useRef(null);
15726
- var _z = useState(0),
15727
- imageWidth = _z[0],
15728
- setImageWidth = _z[1];
15729
- var _0 = useState(0),
15730
- imageHeight = _0[0],
15731
- setImageHeight = _0[1];
15856
+ var _3 = useState(0),
15857
+ imageWidth = _3[0],
15858
+ setImageWidth = _3[1];
15859
+ var _4 = useState(0),
15860
+ imageHeight = _4[0],
15861
+ setImageHeight = _4[1];
15732
15862
  assets.frontImageUrl || (assets.frontImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
15733
15863
  assets.backImageUrl || (assets.backImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
15734
15864
  var verbiage = useTranslations(rawVerbiage, {
@@ -15737,12 +15867,16 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15737
15867
  flipIdInstructionText: 'Please flip your ID card...'
15738
15868
  });
15739
15869
  var instructionText = requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
15740
- var idGuideWidth = typeof window !== 'undefined' && window.innerWidth > window.innerHeight ? '30%' : '75%';
15741
15870
  var theme = useTheme();
15742
15871
  if (faceGuideBorderWidth === undefined) faceGuideBorderWidth = (_d = (_c = (_b = theme.idVideoCapture) === null || _b === void 0 ? void 0 : _b.faceGuides) === null || _c === void 0 ? void 0 : _c.borderWidth) !== null && _d !== void 0 ? _d : 4;
15743
15872
  if (faceGuideBorderColor === undefined) faceGuideBorderColor = (_j = satisfied ? (_f = (_e = theme.idVideoCapture) === null || _e === void 0 ? void 0 : _e.faceGuides) === null || _f === void 0 ? void 0 : _f.satisfiedColor : (_h = (_g = theme.idVideoCapture) === null || _g === void 0 ? void 0 : _g.faceGuides) === null || _h === void 0 ? void 0 : _h.unsatisfiedColor) !== null && _j !== void 0 ? _j : 'white';
15744
15873
  if (idCardGuideBorderWidth === undefined) idCardGuideBorderWidth = (_m = (_l = (_k = theme.idVideoCapture) === null || _k === void 0 ? void 0 : _k.idCardGuides) === null || _l === void 0 ? void 0 : _l.borderWidth) !== null && _m !== void 0 ? _m : 4;
15745
15874
  if (idCardGuideBorderColor === undefined) idCardGuideBorderColor = (_s = satisfied ? (_p = (_o = theme.idVideoCapture) === null || _o === void 0 ? void 0 : _o.idCardGuides) === null || _p === void 0 ? void 0 : _p.satisfiedColor : (_r = (_q = theme.idVideoCapture) === null || _q === void 0 ? void 0 : _q.idCardGuides) === null || _r === void 0 ? void 0 : _r.unsatisfiedColor) !== null && _s !== void 0 ? _s : 'white';
15875
+ var captureImageSize = function captureImageSize() {
15876
+ var _a, _b, _c, _d;
15877
+ if (!imageWidth) setImageWidth((_b = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0);
15878
+ if (!imageHeight) setImageHeight((_d = (_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0);
15879
+ };
15746
15880
  return /*#__PURE__*/React__default.createElement(Container, {
15747
15881
  className: classNames.container
15748
15882
  }, /*#__PURE__*/React__default.createElement(FaceGuide, {
@@ -15750,12 +15884,13 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15750
15884
  "$borderWidth": faceGuideBorderWidth,
15751
15885
  "$borderColor": faceGuideBorderColor
15752
15886
  }), /*#__PURE__*/React__default.createElement(IdCardGuideContainer, {
15753
- "$width": idGuideWidth,
15754
15887
  className: classNames.idCardGuideContainer
15755
15888
  }, /*#__PURE__*/React__default.createElement(IdCardGuideInstructionsContainer, {
15756
15889
  className: classNames.idCardGuideInstructionsContainer
15757
15890
  }, /*#__PURE__*/React__default.createElement(IdCardGuideInstructions, {
15758
- className: classNames.idCardGuideInstructions
15891
+ className: classNames.idCardGuideInstructions,
15892
+ "$textColor": (_u = (_t = theme.idVideoCapture) === null || _t === void 0 ? void 0 : _t.idCardGuides) === null || _u === void 0 ? void 0 : _u.instructionsTextColor,
15893
+ "$background": (_w = (_v = theme.idVideoCapture) === null || _v === void 0 ? void 0 : _v.idCardGuides) === null || _w === void 0 ? void 0 : _w.instructionsBackgroundColor
15759
15894
  }, instructionText)), /*#__PURE__*/React__default.createElement(IdCardGuideImageContainer, {
15760
15895
  "$borderWidth": idCardGuideBorderWidth,
15761
15896
  "$borderColor": idCardGuideBorderColor,
@@ -15771,30 +15906,25 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15771
15906
  src: requestedAction === 'SHOW_ID_BACK' ? assets.backImageUrl : assets.frontImageUrl,
15772
15907
  alt: "",
15773
15908
  className: classNames.idCardGuideImage,
15774
- "$isMirrored": !((_t = cameraRef.current) === null || _t === void 0 ? void 0 : _t.isRearFacing),
15775
- onLoad: function onLoad() {
15776
- var _a, _b, _c, _d;
15777
- if (!imageWidth) setImageWidth((_b = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0);
15778
- if (!imageHeight) setImageHeight((_d = (_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0);
15779
- }
15909
+ "$isMirrored": !((_x = cameraRef.current) === null || _x === void 0 ? void 0 : _x.isRearFacing),
15910
+ onLoad: captureImageSize,
15911
+ onResize: captureImageSize
15780
15912
  })))));
15781
15913
  };
15782
15914
  var Container = styled.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n font-family: ", ";\n"], ["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n font-family: ", ";\n"])), function (props) {
15783
15915
  var _a;
15784
15916
  return (_a = props.theme) === null || _a === void 0 ? void 0 : _a.fontFamily;
15785
15917
  });
15786
- var FaceGuide = styled.div(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"], ["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"])), function (props) {
15918
+ var FaceGuide = styled.div(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"], ["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"])), function (props) {
15787
15919
  var _a;
15788
15920
  return (_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 0;
15789
15921
  }, function (props) {
15790
15922
  var _a;
15791
15923
  return (_a = props.$borderColor) !== null && _a !== void 0 ? _a : 'white';
15792
15924
  });
15793
- var IdCardGuideContainer = styled.div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n width: ", ";\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"], ["\n width: ", ";\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"])), function (props) {
15794
- return props.$width;
15795
- });
15796
- var IdCardGuideInstructionsContainer = styled.div(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n width: 100%;\n flex-grow: 1;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"], ["\n width: 100%;\n flex-grow: 1;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"])));
15797
- var IdCardGuideInstructions = styled.span(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"], ["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"])));
15925
+ var IdCardGuideContainer = styled.div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n height: 50%;\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"], ["\n height: 50%;\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"])));
15926
+ var IdCardGuideInstructionsContainer = styled.div(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n width: 100%;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"], ["\n width: 100%;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"])));
15927
+ var IdCardGuideInstructions = styled(GuidanceMessage)(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n padding: 8px 12px;\n font-weight: bold;\n"], ["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n padding: 8px 12px;\n font-weight: bold;\n"])));
15798
15928
  var IdCardGuideImageContainer = styled.div(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["\n position: relative;\n border: ", "px solid\n ", ";\n"], ["\n position: relative;\n border: ", "px solid\n ", ";\n"])), function (props) {
15799
15929
  return props.$borderWidth;
15800
15930
  }, function (props) {
@@ -16970,8 +17100,10 @@ var ThemeProvider = function ThemeProvider(_a) {
16970
17100
  var IdValidation = function IdValidation(_a) {
16971
17101
  var _b = _a.lang,
16972
17102
  lang = _b === void 0 ? 'auto' : _b,
16973
- submissionToken = _a.submissionToken,
17103
+ sessionId = _a.sessionId,
16974
17104
  submissionUrl = _a.submissionUrl,
17105
+ authUrl = _a.authUrl,
17106
+ documentServiceUrl = _a.documentServiceUrl,
16975
17107
  companyId = _a.companyId,
16976
17108
  needImmediateResponse = _a.needImmediateResponse,
16977
17109
  manualReviewRequired = _a.manualReviewRequired,
@@ -17014,6 +17146,10 @@ var IdValidation = function IdValidation(_a) {
17014
17146
  _p = _a.modelLoadTimeoutMs,
17015
17147
  modelLoadTimeoutMs = _p === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _p,
17016
17148
  onBeforeSubmit = _a.onBeforeSubmit,
17149
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17150
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17151
+ onDocumentUploaded = _a.onDocumentUploaded,
17152
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17017
17153
  onSubmit = _a.onSubmit,
17018
17154
  onComplete = _a.onComplete,
17019
17155
  onApproved = _a.onApproved,
@@ -17104,12 +17240,15 @@ var IdValidation = function IdValidation(_a) {
17104
17240
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
17105
17241
  }
17106
17242
  }, [onApproved, onComplete, onDenied]);
17107
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
17243
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
17244
+ sessionId: sessionId,
17245
+ authUrl: authUrl
17246
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
17108
17247
  theme: theme
17109
17248
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
17110
17249
  action: SubmissionAction.VALIDATE,
17111
- url: submissionUrl,
17112
- token: submissionToken,
17250
+ submissionUrl: submissionUrl,
17251
+ documentServiceUrl: documentServiceUrl,
17113
17252
  companyId: companyId,
17114
17253
  needImmediateResponse: needImmediateResponse,
17115
17254
  manualReviewRequired: manualReviewRequired,
@@ -17125,6 +17264,10 @@ var IdValidation = function IdValidation(_a) {
17125
17264
  webhooksSendInputImages: webhooksSendInputImages,
17126
17265
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17127
17266
  webhooksFireOnReview: webhooksFireOnReview,
17267
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17268
+ onDocumentUploadProgress: onDocumentUploadProgress,
17269
+ onDocumentUploaded: onDocumentUploaded,
17270
+ onDocumentUploadFailed: onDocumentUploadFailed,
17128
17271
  onBeforeSubmit: onBeforeSubmit,
17129
17272
  onSubmit: onSubmit,
17130
17273
  onResponseReceived: onResponseReceived,
@@ -17141,15 +17284,17 @@ var IdValidation = function IdValidation(_a) {
17141
17284
  captureSignature: captureSignature,
17142
17285
  captureSignatureVideo: captureSignatureVideo,
17143
17286
  debugMode: debugMode
17144
- })));
17287
+ }))));
17145
17288
  };
17146
17289
 
17147
17290
  /** Render a fullscreen capture component that analyzes frames from the user's front-facing camera to determine whether a live human face is present. */
17148
17291
  var FaceValidation = function FaceValidation(_a) {
17149
17292
  var _b = _a.lang,
17150
17293
  lang = _b === void 0 ? 'auto' : _b,
17151
- submissionToken = _a.submissionToken,
17294
+ sessionId = _a.sessionId,
17295
+ authUrl = _a.authUrl,
17152
17296
  submissionUrl = _a.submissionUrl,
17297
+ documentServiceUrl = _a.documentServiceUrl,
17153
17298
  companyId = _a.companyId,
17154
17299
  needImmediateResponse = _a.needImmediateResponse,
17155
17300
  webhooksEnabled = _a.webhooksEnabled,
@@ -17165,6 +17310,11 @@ var FaceValidation = function FaceValidation(_a) {
17165
17310
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
17166
17311
  _f = _a.skipSuccessScreen,
17167
17312
  skipSuccessScreen = _f === void 0 ? false : _f,
17313
+ idCardForFaceMatch = _a.idCardForFaceMatch,
17314
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17315
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17316
+ onDocumentUploaded = _a.onDocumentUploaded,
17317
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17168
17318
  onBeforeSubmit = _a.onBeforeSubmit,
17169
17319
  onComplete = _a.onComplete,
17170
17320
  onApproved = _a.onApproved,
@@ -17206,12 +17356,15 @@ var FaceValidation = function FaceValidation(_a) {
17206
17356
  debugMode: debugMode
17207
17357
  };
17208
17358
  }, [assets, classNames, colors, debugMode, loadingOverlayMode, modelLoadTimeoutMs, onApproved, onComplete, onDenied, onExitAfterFailure, onExitCapture, onModelError, onUserCancel, skipSuccessScreen, timeoutDurationMs, verbiage]);
17209
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
17359
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
17360
+ sessionId: sessionId,
17361
+ authUrl: authUrl
17362
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
17210
17363
  theme: theme
17211
17364
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
17212
17365
  action: SubmissionAction.NONE,
17213
- url: submissionUrl,
17214
- token: submissionToken,
17366
+ submissionUrl: submissionUrl,
17367
+ documentServiceUrl: documentServiceUrl,
17215
17368
  companyId: companyId,
17216
17369
  needImmediateResponse: needImmediateResponse,
17217
17370
  webhooksEnabled: webhooksEnabled,
@@ -17219,6 +17372,11 @@ var FaceValidation = function FaceValidation(_a) {
17219
17372
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
17220
17373
  webhooksSendInputImages: webhooksSendInputImages,
17221
17374
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17375
+ idCardForFaceMatch: idCardForFaceMatch,
17376
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17377
+ onDocumentUploadProgress: onDocumentUploadProgress,
17378
+ onDocumentUploaded: onDocumentUploaded,
17379
+ onDocumentUploadFailed: onDocumentUploadFailed,
17222
17380
  onBeforeLivenessCheck: onBeforeSubmit,
17223
17381
  geolocationEnabled: geolocationEnabled,
17224
17382
  geolocationRequired: geolocationRequired
@@ -17228,7 +17386,7 @@ var FaceValidation = function FaceValidation(_a) {
17228
17386
  }, []),
17229
17387
  faceLivenessProps: faceLivenessProps,
17230
17388
  debugMode: debugMode
17231
- })));
17389
+ }))));
17232
17390
  };
17233
17391
 
17234
17392
  /**
@@ -17237,8 +17395,10 @@ var FaceValidation = function FaceValidation(_a) {
17237
17395
  var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17238
17396
  var _b = _a.lang,
17239
17397
  lang = _b === void 0 ? 'auto' : _b,
17240
- submissionToken = _a.submissionToken,
17398
+ sessionId = _a.sessionId,
17399
+ authUrl = _a.authUrl,
17241
17400
  submissionUrl = _a.submissionUrl,
17401
+ documentServiceUrl = _a.documentServiceUrl,
17242
17402
  companyId = _a.companyId,
17243
17403
  needImmediateResponse = _a.needImmediateResponse,
17244
17404
  manualReviewRequired = _a.manualReviewRequired,
@@ -17288,6 +17448,10 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17288
17448
  idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _s,
17289
17449
  _t = _a.selfieCaptureModelLoadTimeoutMs,
17290
17450
  selfieCaptureModelLoadTimeoutMs = _t === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _t,
17451
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17452
+ onDocumentUploaded = _a.onDocumentUploaded,
17453
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17454
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17291
17455
  onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
17292
17456
  onBeforeSubmit = _a.onBeforeSubmit,
17293
17457
  onSubmit = _a.onSubmit,
@@ -17402,12 +17566,15 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17402
17566
  var checks = useMemo(function () {
17403
17567
  return (precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie) ? ['IdCapture'] : ['IdCapture', 'FaceLiveness'];
17404
17568
  }, [precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie]);
17405
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
17569
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
17570
+ sessionId: sessionId,
17571
+ authUrl: authUrl
17572
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
17406
17573
  theme: theme
17407
17574
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
17408
17575
  action: SubmissionAction.VALIDATE,
17409
- url: submissionUrl,
17410
- token: submissionToken,
17576
+ submissionUrl: submissionUrl,
17577
+ documentServiceUrl: documentServiceUrl,
17411
17578
  companyId: companyId,
17412
17579
  needImmediateResponse: needImmediateResponse,
17413
17580
  manualReviewRequired: manualReviewRequired,
@@ -17424,6 +17591,10 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17424
17591
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17425
17592
  webhooksFireOnReview: webhooksFireOnReview,
17426
17593
  precapturedDocuments: precapturedDocuments,
17594
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17595
+ onDocumentUploadProgress: onDocumentUploadProgress,
17596
+ onDocumentUploaded: onDocumentUploaded,
17597
+ onDocumentUploadFailed: onDocumentUploadFailed,
17427
17598
  onBeforeSubmit: onBeforeSubmit,
17428
17599
  onBeforeLivenessCheck: onBeforeLivenessCheck,
17429
17600
  onSubmit: onSubmit,
@@ -17440,7 +17611,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17440
17611
  captureSignature: captureSignature,
17441
17612
  captureSignatureVideo: captureSignatureVideo,
17442
17613
  debugMode: debugMode
17443
- })));
17614
+ }))));
17444
17615
  };
17445
17616
 
17446
17617
  /**
@@ -17450,8 +17621,10 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17450
17621
  var enrollmentId = _a.enrollmentId,
17451
17622
  _b = _a.lang,
17452
17623
  lang = _b === void 0 ? 'auto' : _b,
17453
- submissionToken = _a.submissionToken,
17624
+ sessionId = _a.sessionId,
17625
+ authUrl = _a.authUrl,
17454
17626
  submissionUrl = _a.submissionUrl,
17627
+ documentServiceUrl = _a.documentServiceUrl,
17455
17628
  companyId = _a.companyId,
17456
17629
  needImmediateResponse = _a.needImmediateResponse,
17457
17630
  manualReviewRequired = _a.manualReviewRequired,
@@ -17503,6 +17676,10 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17503
17676
  idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _s,
17504
17677
  _t = _a.selfieCaptureModelLoadTimeoutMs,
17505
17678
  selfieCaptureModelLoadTimeoutMs = _t === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _t,
17679
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17680
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17681
+ onDocumentUploaded = _a.onDocumentUploaded,
17682
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17506
17683
  onBeforeSubmit = _a.onBeforeSubmit,
17507
17684
  onSubmit = _a.onSubmit,
17508
17685
  onComplete = _a.onComplete,
@@ -17611,12 +17788,15 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17611
17788
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
17612
17789
  }
17613
17790
  }, [onEnrolled, onComplete, onDenied]);
17614
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
17791
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
17792
+ sessionId: sessionId,
17793
+ authUrl: authUrl
17794
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
17615
17795
  theme: theme
17616
17796
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
17617
17797
  action: SubmissionAction.ENROLL,
17618
- url: submissionUrl,
17619
- token: submissionToken,
17798
+ submissionUrl: submissionUrl,
17799
+ documentServiceUrl: documentServiceUrl,
17620
17800
  companyId: companyId,
17621
17801
  enrollmentId: enrollmentId,
17622
17802
  needImmediateResponse: needImmediateResponse,
@@ -17636,6 +17816,10 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17636
17816
  webhooksSendInputImages: webhooksSendInputImages,
17637
17817
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17638
17818
  webhooksFireOnReview: webhooksFireOnReview,
17819
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17820
+ onDocumentUploadProgress: onDocumentUploadProgress,
17821
+ onDocumentUploaded: onDocumentUploaded,
17822
+ onDocumentUploadFailed: onDocumentUploadFailed,
17639
17823
  onBeforeSubmit: onBeforeSubmit,
17640
17824
  onSubmit: onSubmit,
17641
17825
  onResponseReceived: onResponseReceived,
@@ -17653,7 +17837,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17653
17837
  captureSignature: captureSignature,
17654
17838
  captureSignatureVideo: captureSignatureVideo,
17655
17839
  debugMode: debugMode
17656
- })));
17840
+ }))));
17657
17841
  };
17658
17842
 
17659
17843
  var ALLOWED_RETRIES$3 = 0;
@@ -18093,8 +18277,10 @@ var CustomerVerification = function CustomerVerification(_a) {
18093
18277
  var _b = _a.lang,
18094
18278
  lang = _b === void 0 ? 'auto' : _b,
18095
18279
  enrollmentId = _a.enrollmentId,
18096
- submissionToken = _a.submissionToken,
18280
+ sessionId = _a.sessionId,
18281
+ authUrl = _a.authUrl,
18097
18282
  submissionUrl = _a.submissionUrl,
18283
+ documentServiceUrl = _a.documentServiceUrl,
18098
18284
  companyId = _a.companyId,
18099
18285
  needImmediateResponse = _a.needImmediateResponse,
18100
18286
  webhooksEnabled = _a.webhooksEnabled,
@@ -18116,6 +18302,10 @@ var CustomerVerification = function CustomerVerification(_a) {
18116
18302
  classNames = _a.classNames,
18117
18303
  colors = _a.colors,
18118
18304
  verbiage = _a.verbiage,
18305
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
18306
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
18307
+ onDocumentUploaded = _a.onDocumentUploaded,
18308
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18119
18309
  onBeforeSubmit = _a.onBeforeSubmit,
18120
18310
  onSubmit = _a.onSubmit,
18121
18311
  onComplete = _a.onComplete,
@@ -18132,12 +18322,15 @@ var CustomerVerification = function CustomerVerification(_a) {
18132
18322
  _k = _a.debugMode,
18133
18323
  debugMode = _k === void 0 ? false : _k;
18134
18324
  useLanguage(lang);
18135
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
18325
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
18326
+ sessionId: sessionId,
18327
+ authUrl: authUrl
18328
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
18136
18329
  theme: theme
18137
18330
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
18138
18331
  action: SubmissionAction.VERIFY,
18139
- url: submissionUrl,
18140
- token: submissionToken,
18332
+ submissionUrl: submissionUrl,
18333
+ documentServiceUrl: documentServiceUrl,
18141
18334
  companyId: companyId,
18142
18335
  enrollmentId: enrollmentId,
18143
18336
  needImmediateResponse: needImmediateResponse,
@@ -18146,6 +18339,10 @@ var CustomerVerification = function CustomerVerification(_a) {
18146
18339
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
18147
18340
  webhooksSendInputImages: webhooksSendInputImages,
18148
18341
  webhooksSendProcessedImages: webhooksSendProcessedImages,
18342
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
18343
+ onDocumentUploadProgress: onDocumentUploadProgress,
18344
+ onDocumentUploaded: onDocumentUploaded,
18345
+ onDocumentUploadFailed: onDocumentUploadFailed,
18149
18346
  onBeforeSubmit: onBeforeSubmit,
18150
18347
  onSubmit: onSubmit,
18151
18348
  geolocationEnabled: geolocationEnabled,
@@ -18171,7 +18368,7 @@ var CustomerVerification = function CustomerVerification(_a) {
18171
18368
  colors: colors,
18172
18369
  verbiage: verbiage,
18173
18370
  debugMode: debugMode
18174
- })))));
18371
+ }))))));
18175
18372
  };
18176
18373
 
18177
18374
  var ALLOWED_RETRIES$1 = 0;
@@ -18608,8 +18805,10 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
18608
18805
  var CustomerIdentification = function CustomerIdentification(_a) {
18609
18806
  var _b = _a.lang,
18610
18807
  lang = _b === void 0 ? 'auto' : _b,
18611
- submissionToken = _a.submissionToken,
18808
+ sessionId = _a.sessionId,
18809
+ authUrl = _a.authUrl,
18612
18810
  submissionUrl = _a.submissionUrl,
18811
+ documentServiceUrl = _a.documentServiceUrl,
18613
18812
  companyId = _a.companyId,
18614
18813
  needImmediateResponse = _a.needImmediateResponse,
18615
18814
  webhooksEnabled = _a.webhooksEnabled,
@@ -18625,6 +18824,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18625
18824
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
18626
18825
  _f = _a.skipSuccessScreen,
18627
18826
  skipSuccessScreen = _f === void 0 ? false : _f,
18827
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
18828
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
18829
+ onDocumentUploaded = _a.onDocumentUploaded,
18830
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18628
18831
  onBeforeSubmit = _a.onBeforeSubmit,
18629
18832
  onSubmit = _a.onSubmit,
18630
18833
  onComplete = _a.onComplete,
@@ -18647,12 +18850,15 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18647
18850
  _j = _a.debugMode,
18648
18851
  debugMode = _j === void 0 ? false : _j;
18649
18852
  useLanguage(lang);
18650
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
18853
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
18854
+ sessionId: sessionId,
18855
+ authUrl: authUrl
18856
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
18651
18857
  theme: theme
18652
18858
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
18653
18859
  action: SubmissionAction.IDENTIFY,
18654
- url: submissionUrl,
18655
- token: submissionToken,
18860
+ submissionUrl: submissionUrl,
18861
+ documentServiceUrl: documentServiceUrl,
18656
18862
  companyId: companyId,
18657
18863
  needImmediateResponse: needImmediateResponse,
18658
18864
  webhooksEnabled: webhooksEnabled,
@@ -18660,6 +18866,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18660
18866
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
18661
18867
  webhooksSendInputImages: webhooksSendInputImages,
18662
18868
  webhooksSendProcessedImages: webhooksSendProcessedImages,
18869
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
18870
+ onDocumentUploadProgress: onDocumentUploadProgress,
18871
+ onDocumentUploaded: onDocumentUploaded,
18872
+ onDocumentUploadFailed: onDocumentUploadFailed,
18663
18873
  onBeforeSubmit: onBeforeSubmit,
18664
18874
  onSubmit: onSubmit,
18665
18875
  geolocationEnabled: geolocationEnabled,
@@ -18686,15 +18896,21 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18686
18896
  colors: colors,
18687
18897
  verbiage: verbiage,
18688
18898
  debugMode: debugMode
18689
- })))));
18899
+ }))))));
18690
18900
  };
18691
18901
 
18692
18902
  /** Render a fullscreen capture component that captures a video of the user signing the screen. */
18693
18903
  var SignatureKYC = function SignatureKYC(_a) {
18694
18904
  var _b = _a.lang,
18695
18905
  lang = _b === void 0 ? 'auto' : _b,
18696
- submissionToken = _a.submissionToken,
18906
+ sessionId = _a.sessionId,
18907
+ authUrl = _a.authUrl,
18697
18908
  submissionUrl = _a.submissionUrl,
18909
+ documentServiceUrl = _a.documentServiceUrl,
18910
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
18911
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
18912
+ onDocumentUploaded = _a.onDocumentUploaded,
18913
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18698
18914
  onBeforeSubmit = _a.onBeforeSubmit,
18699
18915
  onSubmit = _a.onSubmit,
18700
18916
  onComplete = _a.onComplete,
@@ -18704,6 +18920,7 @@ var SignatureKYC = function SignatureKYC(_a) {
18704
18920
  loadingOverlayMode = _c === void 0 ? 'default' : _c,
18705
18921
  _d = _a.skipSuccessScreen,
18706
18922
  skipSuccessScreen = _d === void 0 ? false : _d,
18923
+ idCardForFaceMatch = _a.idCardForFaceMatch,
18707
18924
  _e = _a.modelLoadTimeoutMs,
18708
18925
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
18709
18926
  _f = _a.theme,
@@ -18718,12 +18935,25 @@ var SignatureKYC = function SignatureKYC(_a) {
18718
18935
  var _g = useState(0),
18719
18936
  attempt = _g[0],
18720
18937
  setAttempt = _g[1];
18721
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
18938
+ var onRetryClicked = useCallback(function () {
18939
+ setAttempt(function (n) {
18940
+ return n + 1;
18941
+ });
18942
+ }, []);
18943
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
18944
+ sessionId: sessionId,
18945
+ authUrl: authUrl
18946
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
18722
18947
  theme: theme
18723
18948
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
18724
18949
  action: SubmissionAction.NONE,
18725
- url: submissionUrl,
18726
- token: submissionToken,
18950
+ submissionUrl: submissionUrl,
18951
+ documentServiceUrl: documentServiceUrl,
18952
+ idCardForFaceMatch: idCardForFaceMatch,
18953
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
18954
+ onDocumentUploadProgress: onDocumentUploadProgress,
18955
+ onDocumentUploaded: onDocumentUploaded,
18956
+ onDocumentUploadFailed: onDocumentUploadFailed,
18727
18957
  onBeforeSubmit: onBeforeSubmit,
18728
18958
  onSubmit: onSubmit,
18729
18959
  onResponseReceived: onComplete,
@@ -18744,12 +18974,8 @@ var SignatureKYC = function SignatureKYC(_a) {
18744
18974
  verbiage: verbiage,
18745
18975
  onModelError: onModelError,
18746
18976
  onUserCancel: onUserCancel,
18747
- onRetryClicked: function onRetryClicked() {
18748
- setAttempt(function (n) {
18749
- return n + 1;
18750
- });
18751
- }
18752
- }))));
18977
+ onRetryClicked: onRetryClicked
18978
+ })))));
18753
18979
  };
18754
18980
 
18755
18981
  /**
@@ -18758,8 +18984,10 @@ var SignatureKYC = function SignatureKYC(_a) {
18758
18984
  var VideoIdValidation = function VideoIdValidation(_a) {
18759
18985
  var _b = _a.lang,
18760
18986
  lang = _b === void 0 ? 'auto' : _b,
18761
- submissionToken = _a.submissionToken,
18987
+ sessionId = _a.sessionId,
18988
+ authUrl = _a.authUrl,
18762
18989
  submissionUrl = _a.submissionUrl,
18990
+ documentServiceUrl = _a.documentServiceUrl,
18763
18991
  companyId = _a.companyId,
18764
18992
  needImmediateResponse = _a.needImmediateResponse,
18765
18993
  manualReviewRequired = _a.manualReviewRequired,
@@ -18775,6 +19003,10 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18775
19003
  webhooksSendInputImages = _a.webhooksSendInputImages,
18776
19004
  webhooksSendProcessedImages = _a.webhooksSendProcessedImages,
18777
19005
  webhooksFireOnReview = _a.webhooksFireOnReview,
19006
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
19007
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
19008
+ onDocumentUploaded = _a.onDocumentUploaded,
19009
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18778
19010
  onSubmit = _a.onSubmit,
18779
19011
  onBeforeSubmit = _a.onBeforeSubmit,
18780
19012
  onComplete = _a.onComplete,
@@ -18814,6 +19046,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18814
19046
  idCapturePortraitGuidesOnMobile = _r === void 0 ? false : _r,
18815
19047
  _s = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
18816
19048
  idCaptureRotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
19049
+ idCardForFaceMatch = _a.idCardForFaceMatch,
18817
19050
  _t = _a.faceLivenessLoadingOverlayMode,
18818
19051
  faceLivenessLoadingOverlayMode = _t === void 0 ? 'default' : _t,
18819
19052
  _u = _a.theme,
@@ -18894,12 +19127,15 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18894
19127
  debugMode: debugMode
18895
19128
  };
18896
19129
  }, [classNames.videoSignatureCapture, colors.videoSignatureCapture, debugMode, onExitCapture, onUserCancel, skipSuccessScreen, verbiage.videoSignatureCapture]);
18897
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
19130
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
19131
+ sessionId: sessionId,
19132
+ authUrl: authUrl
19133
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
18898
19134
  theme: theme
18899
19135
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
18900
19136
  action: skipIdCapture ? SubmissionAction.NONE : SubmissionAction.VALIDATE,
18901
- url: submissionUrl,
18902
- token: submissionToken,
19137
+ submissionUrl: submissionUrl,
19138
+ documentServiceUrl: documentServiceUrl,
18903
19139
  companyId: companyId,
18904
19140
  needImmediateResponse: needImmediateResponse,
18905
19141
  manualReviewRequired: manualReviewRequired,
@@ -18915,6 +19151,11 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18915
19151
  webhooksSendInputImages: webhooksSendInputImages,
18916
19152
  webhooksSendProcessedImages: webhooksSendProcessedImages,
18917
19153
  webhooksFireOnReview: webhooksFireOnReview,
19154
+ idCardForFaceMatch: idCardForFaceMatch,
19155
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
19156
+ onDocumentUploadProgress: onDocumentUploadProgress,
19157
+ onDocumentUploaded: onDocumentUploaded,
19158
+ onDocumentUploadFailed: onDocumentUploadFailed,
18918
19159
  onSubmit: onSubmit,
18919
19160
  onBeforeSubmit: onBeforeSubmit,
18920
19161
  onResponseReceived: onComplete,
@@ -18931,7 +19172,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18931
19172
  captureSignature: captureSignature,
18932
19173
  captureSignatureVideo: captureSignatureVideo,
18933
19174
  debugMode: debugMode
18934
- })));
19175
+ }))));
18935
19176
  };
18936
19177
 
18937
19178
  /** Render a fullscreen capture component that performs FaceValidation, and then stores the results in IDmission's customer database using the supplied `enrollmentId` for later verification or 1:N matching. */
@@ -18939,8 +19180,10 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
18939
19180
  var enrollmentId = _a.enrollmentId,
18940
19181
  _b = _a.lang,
18941
19182
  lang = _b === void 0 ? 'auto' : _b,
18942
- submissionToken = _a.submissionToken,
19183
+ sessionId = _a.sessionId,
19184
+ authUrl = _a.authUrl,
18943
19185
  submissionUrl = _a.submissionUrl,
19186
+ documentServiceUrl = _a.documentServiceUrl,
18944
19187
  companyId = _a.companyId,
18945
19188
  needImmediateResponse = _a.needImmediateResponse,
18946
19189
  deduplicationEnabled = _a.deduplicationEnabled,
@@ -18958,6 +19201,10 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
18958
19201
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
18959
19202
  _f = _a.skipSuccessScreen,
18960
19203
  skipSuccessScreen = _f === void 0 ? false : _f,
19204
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
19205
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
19206
+ onDocumentUploaded = _a.onDocumentUploaded,
19207
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18961
19208
  onBeforeSubmit = _a.onBeforeSubmit,
18962
19209
  onSubmit = _a.onSubmit,
18963
19210
  onComplete = _a.onComplete,
@@ -19039,12 +19286,15 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19039
19286
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
19040
19287
  }
19041
19288
  }, [onEnrolled, onComplete, onDenied]);
19042
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
19289
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
19290
+ sessionId: sessionId,
19291
+ authUrl: authUrl
19292
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
19043
19293
  theme: theme
19044
19294
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
19045
19295
  action: SubmissionAction.ENROLL,
19046
- url: submissionUrl,
19047
- token: submissionToken,
19296
+ submissionUrl: submissionUrl,
19297
+ documentServiceUrl: documentServiceUrl,
19048
19298
  companyId: companyId,
19049
19299
  enrollmentId: enrollmentId,
19050
19300
  needImmediateResponse: needImmediateResponse,
@@ -19055,6 +19305,10 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19055
19305
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
19056
19306
  webhooksSendInputImages: webhooksSendInputImages,
19057
19307
  webhooksSendProcessedImages: webhooksSendProcessedImages,
19308
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
19309
+ onDocumentUploadProgress: onDocumentUploadProgress,
19310
+ onDocumentUploaded: onDocumentUploaded,
19311
+ onDocumentUploadFailed: onDocumentUploadFailed,
19058
19312
  onBeforeSubmit: onBeforeSubmit,
19059
19313
  onSubmit: onSubmit,
19060
19314
  onResponseReceived: onResponseReceived,
@@ -19071,7 +19325,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19071
19325
  captureSignature: captureSignature,
19072
19326
  captureSignatureVideo: captureSignatureVideo,
19073
19327
  debugMode: debugMode
19074
- })));
19328
+ }))));
19075
19329
  };
19076
19330
 
19077
19331
  /**
@@ -19080,11 +19334,15 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19080
19334
  var DocumentCapture = function DocumentCapture(_a) {
19081
19335
  var _b = _a.lang,
19082
19336
  lang = _b === void 0 ? 'auto' : _b,
19083
- submissionToken = _a.submissionToken,
19337
+ sessionId = _a.sessionId,
19338
+ authUrl = _a.authUrl,
19084
19339
  submissionUrl = _a.submissionUrl,
19085
19340
  documentServiceUrl = _a.documentServiceUrl,
19086
- onComplete = _a.onComplete,
19341
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
19342
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
19087
19343
  onDocumentUploaded = _a.onDocumentUploaded,
19344
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
19345
+ onComplete = _a.onComplete,
19088
19346
  onExitCapture = _a.onExitCapture,
19089
19347
  onUserCancel = _a.onUserCancel,
19090
19348
  _c = _a.documents,
@@ -19105,13 +19363,19 @@ var DocumentCapture = function DocumentCapture(_a) {
19105
19363
  _j = _a.debugMode,
19106
19364
  debugMode = _j === void 0 ? false : _j;
19107
19365
  useLanguage(lang);
19108
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
19366
+ return /*#__PURE__*/React__default.createElement(AuthProvider, {
19367
+ sessionId: sessionId,
19368
+ authUrl: authUrl
19369
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
19109
19370
  theme: theme
19110
19371
  }, /*#__PURE__*/React__default.createElement(SubmissionProvider, {
19111
19372
  action: SubmissionAction.NONE,
19112
- url: submissionUrl,
19113
- token: submissionToken,
19373
+ submissionUrl: submissionUrl,
19114
19374
  documentServiceUrl: documentServiceUrl,
19375
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
19376
+ onDocumentUploadProgress: onDocumentUploadProgress,
19377
+ onDocumentUploaded: onDocumentUploaded,
19378
+ onDocumentUploadFailed: onDocumentUploadFailed,
19115
19379
  geolocationEnabled: geolocationEnabled,
19116
19380
  geolocationRequired: geolocationRequired
19117
19381
  }, /*#__PURE__*/React__default.createElement(CameraProvider, {
@@ -19119,7 +19383,6 @@ var DocumentCapture = function DocumentCapture(_a) {
19119
19383
  debugMode: debugMode
19120
19384
  }, /*#__PURE__*/React__default.createElement(DocumentCaptureWizard, {
19121
19385
  onSuccess: onComplete,
19122
- onDocumentUploaded: onDocumentUploaded,
19123
19386
  onExitCapture: onExitCapture,
19124
19387
  onUserCancel: onUserCancel,
19125
19388
  documents: documents,
@@ -19128,7 +19391,7 @@ var DocumentCapture = function DocumentCapture(_a) {
19128
19391
  instructions: instructions,
19129
19392
  classNames: classNames,
19130
19393
  verbiage: verbiage
19131
- }))));
19394
+ })))));
19132
19395
  };
19133
19396
 
19134
19397
  initializeI18n();
@@ -19205,8 +19468,12 @@ globalThis.IDmissionSDK = {
19205
19468
  preloadModels: preloadModels,
19206
19469
  themes: themes,
19207
19470
  version: webSdkVersion,
19208
- ready: true
19471
+ ready: true,
19472
+ authMode: 'session',
19473
+ allowedAuthUrls: allowedAuthUrls,
19474
+ defaultAuthUrl: defaultAuthUrl,
19475
+ defaultSubmissionUrl: defaultSubmissionUrl
19209
19476
  };
19210
19477
 
19211
- export { CapturedDocumentImg, CustomerBiometricsEnrollment, CustomerIdAndBiometricsEnrollment, CustomerIdentification, CustomerVerification, DocumentCapture, FaceValidation, IdAndFaceValidation, IdValidation, SignatureKYC, VideoIdValidation, preloadModels, renderCustomerBiometricsEnrollment, renderCustomerIdAndBiometricsEnrollment, renderCustomerIdentification, renderCustomerVerification, renderDocumentCapture, renderFaceValidation, renderIdAndFaceValidation, renderIdValidation, renderSignatureKYC, renderVideoIdValidation, themes };
19478
+ export { CapturedDocumentImg, CustomerBiometricsEnrollment, CustomerIdAndBiometricsEnrollment, CustomerIdentification, CustomerVerification, DocumentCapture, FaceValidation, IdAndFaceValidation, IdValidation, SignatureKYC, VideoIdValidation, allowedAuthUrls, defaultAuthUrl, defaultSubmissionUrl, preloadModels, renderCustomerBiometricsEnrollment, renderCustomerIdAndBiometricsEnrollment, renderCustomerIdentification, renderCustomerVerification, renderDocumentCapture, renderFaceValidation, renderIdAndFaceValidation, renderIdValidation, renderSignatureKYC, renderVideoIdValidation, themes };
19212
19479
  //# sourceMappingURL=sdk2.esm.js.map