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
@@ -8,6 +8,7 @@ var ReactDOM = require('react-dom/client');
8
8
  var platform = require('platform');
9
9
  var styled = require('styled-components');
10
10
  var reactI18next = require('react-i18next');
11
+ var tusJsClient = require('tus-js-client');
11
12
  var useResizeObserver = require('use-resize-observer');
12
13
  var tf = require('@tensorflow/tfjs');
13
14
  var tasksVision = require('@mediapipe/tasks-vision');
@@ -50,7 +51,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
50
51
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
51
52
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
52
53
 
53
- var webSdkVersion = '1.0.310';
54
+ var webSdkVersion = '1.0.312';
54
55
 
55
56
  function getPlatform() {
56
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -76,6 +77,15 @@ function contentDispositionFromDataUrl(url) {
76
77
  var _a, _b;
77
78
  return (_b = (_a = url.match(/^(data:.*;base64),/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
78
79
  }
80
+ function blobToB64(blob) {
81
+ return new Promise(function (resolve) {
82
+ var reader = new FileReader();
83
+ reader.onloadend = function () {
84
+ return resolve(reader.result);
85
+ };
86
+ reader.readAsDataURL(blob);
87
+ });
88
+ }
79
89
 
80
90
  var SubmissionAction;
81
91
  (function (SubmissionAction) {
@@ -117,32 +127,33 @@ function determineSubmissionHost(environment, token) {
117
127
  if (!host) throw new Error("unrecognized SubmissionEnvironment ".concat(environment));
118
128
  return host;
119
129
  }
120
- function determineSubmissionEndpoint(action, hasId, hasSelfie, hasToken) {
121
- var v = hasToken ? 'v4' : 'v3';
130
+ function determineSubmissionEndpoint(action, hasId, hasSelfie) {
122
131
  switch (action) {
123
132
  case SubmissionAction.ENROLL:
124
- return hasId ? "/".concat(v, "/customer/enroll") : "/".concat(v, "/customer/enroll-biometrics");
133
+ return hasId ? "/v4/customer/enroll" : "/v4/customer/enroll-biometrics";
125
134
  case SubmissionAction.IDENTIFY:
126
- return "/".concat(v, "/customer/identify");
135
+ return "/v4/customer/identify";
127
136
  case SubmissionAction.VALIDATE:
128
- return hasSelfie ? "/".concat(v, "/customer/validate-id-match-face") : "/".concat(v, "/customer/validate-id");
137
+ return hasSelfie ? "/v4/customer/validate-id-match-face" : "/v4/customer/validate-id";
129
138
  case SubmissionAction.VERIFY:
130
- return "/".concat(v, "/customer/verify");
139
+ return "/v4/customer/verify";
131
140
  default:
132
141
  throw new Error("unrecognized SubmissionAction ".concat(action));
133
142
  }
134
143
  }
135
- function liveCheckEndpoint(hasToken) {
136
- var v = hasToken ? 'v4' : 'v3';
137
- return "/".concat(v, "/customer/live-check");
144
+ function liveCheckEndpoint(hasDocumentToMatchFace) {
145
+ if (hasDocumentToMatchFace === void 0) {
146
+ hasDocumentToMatchFace = false;
147
+ }
148
+ return hasDocumentToMatchFace ? "/v4/customer/match-id-face" : "/v4/customer/live-check";
138
149
  }
139
- function apiHeaders(token) {
150
+ function apiHeaders(sessionId) {
140
151
  var headers = {
141
152
  'Content-Type': 'application/json',
142
153
  Origin: '*'
143
154
  };
144
- if (token) {
145
- headers['Authorization'] = "Bearer ".concat(token);
155
+ if (sessionId) {
156
+ headers['X-Session-Id'] = sessionId;
146
157
  }
147
158
  return headers;
148
159
  }
@@ -359,15 +370,15 @@ var NetworkError = /** @class */function (_super) {
359
370
  }
360
371
  return NetworkError;
361
372
  }(Error);
362
- var TokenPublicKeyError = /** @class */function (_super) {
363
- tslib.__extends(TokenPublicKeyError, _super);
364
- function TokenPublicKeyError(err, host) {
373
+ var SessionValidationFailedError = /** @class */function (_super) {
374
+ tslib.__extends(SessionValidationFailedError, _super);
375
+ function SessionValidationFailedError(err, host) {
365
376
  var _this = _super.call(this, err.message) || this;
366
377
  _this.err = err;
367
378
  _this.host = host;
368
379
  return _this;
369
380
  }
370
- return TokenPublicKeyError;
381
+ return SessionValidationFailedError;
371
382
  }(Error);
372
383
 
373
384
  var SubmissionErrorOverlay = function SubmissionErrorOverlay(_a) {
@@ -431,7 +442,7 @@ var NetworkErrorContent = function NetworkErrorContent(_a) {
431
442
  }, retryText))));
432
443
  };
433
444
 
434
- var TokenMissingErrorOverlay = function TokenMissingErrorOverlay() {
445
+ var SessionIdMissingOverlay = function SessionIdMissingOverlay() {
435
446
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
436
447
  style: {
437
448
  justifyContent: 'center'
@@ -444,7 +455,7 @@ var TokenMissingErrorOverlay = function TokenMissingErrorOverlay() {
444
455
  style: {
445
456
  marginBottom: 0
446
457
  }
447
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " is missing."), /*#__PURE__*/React__default['default'].createElement("p", {
458
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is missing."), /*#__PURE__*/React__default['default'].createElement("p", {
448
459
  style: {
449
460
  lineHeight: '1.5rem'
450
461
  }
@@ -452,14 +463,10 @@ var TokenMissingErrorOverlay = function TokenMissingErrorOverlay() {
452
463
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
453
464
  target: "_blank",
454
465
  rel: "noreferrer"
455
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
456
- href: "https://jwt.io",
457
- target: "_blank",
458
- rel: "noreferrer"
459
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
466
+ }, "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.")));
460
467
  };
461
468
 
462
- var TokenInvalidFormatErrorOverlay = function TokenInvalidFormatErrorOverlay() {
469
+ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
463
470
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
464
471
  style: {
465
472
  justifyContent: 'center'
@@ -472,16 +479,7 @@ var TokenInvalidFormatErrorOverlay = function TokenInvalidFormatErrorOverlay() {
472
479
  style: {
473
480
  marginBottom: 0
474
481
  }
475
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " is invalid."), /*#__PURE__*/React__default['default'].createElement("p", null, "JSON Web Tokens consist of three parts separated by dots (", /*#__PURE__*/React__default['default'].createElement("code", null, "."), "), which are:"), /*#__PURE__*/React__default['default'].createElement("div", {
476
- style: {
477
- display: 'flex'
478
- }
479
- }, /*#__PURE__*/React__default['default'].createElement("ul", {
480
- style: {
481
- display: 'inline',
482
- margin: '0 auto'
483
- }
484
- }, /*#__PURE__*/React__default['default'].createElement("li", null, "Header"), /*#__PURE__*/React__default['default'].createElement("li", null, "Payload"), /*#__PURE__*/React__default['default'].createElement("li", null, "Signature"))), /*#__PURE__*/React__default['default'].createElement("p", null, "Therefore, a JWT typically looks like the following:", ' ', /*#__PURE__*/React__default['default'].createElement("code", null, "xxxxx.yyyyy.zzzzz")), /*#__PURE__*/React__default['default'].createElement("p", {
482
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is not valid."), /*#__PURE__*/React__default['default'].createElement("p", {
485
483
  style: {
486
484
  lineHeight: '1.5rem'
487
485
  }
@@ -489,14 +487,10 @@ var TokenInvalidFormatErrorOverlay = function TokenInvalidFormatErrorOverlay() {
489
487
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
490
488
  target: "_blank",
491
489
  rel: "noreferrer"
492
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
493
- href: "https://jwt.io",
494
- target: "_blank",
495
- rel: "noreferrer"
496
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
490
+ }, "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.")));
497
491
  };
498
492
 
499
- var TokenInvalidSignatureErrorOverlay = function TokenInvalidSignatureErrorOverlay() {
493
+ var AuthUrlNotAllowedOverlay = function AuthUrlNotAllowedOverlay() {
500
494
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
501
495
  style: {
502
496
  justifyContent: 'center'
@@ -509,40 +503,12 @@ var TokenInvalidSignatureErrorOverlay = function TokenInvalidSignatureErrorOverl
509
503
  style: {
510
504
  marginBottom: 0
511
505
  }
512
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " could not be validated."), /*#__PURE__*/React__default['default'].createElement("p", {
506
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "authUrl"), " comes from an unrecognized issuer."), /*#__PURE__*/React__default['default'].createElement("p", {
513
507
  style: {
514
508
  marginBottom: 0,
515
509
  lineHeight: '1.5rem'
516
510
  }
517
- }, "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['default'].createElement("p", {
518
- style: {
519
- marginBottom: 0,
520
- lineHeight: '1.5rem'
521
- }
522
- }, "If you believe you have reached this page in error, please contact us at ", /*#__PURE__*/React__default['default'].createElement("a", {
523
- href: "mailto:support@idmission.com"
524
- }, "support@idmission.com"), ".")));
525
- };
526
-
527
- var TokenExpiredErrorOverlay = function TokenExpiredErrorOverlay() {
528
- return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
529
- style: {
530
- justifyContent: 'center'
531
- }
532
- }, /*#__PURE__*/React__default['default'].createElement("h3", {
533
- style: {
534
- marginBottom: 8
535
- }
536
- }, "IDmission WebSDK failed to load"), /*#__PURE__*/React__default['default'].createElement("p", {
537
- style: {
538
- marginBottom: 0
539
- }
540
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " is expired."), /*#__PURE__*/React__default['default'].createElement("p", {
541
- style: {
542
- marginBottom: 0,
543
- lineHeight: '1.5rem'
544
- }
545
- }, "Ensure you are generating a fresh token for each request to the IDmission WebSDK."), /*#__PURE__*/React__default['default'].createElement("p", {
511
+ }, "Ensure you are generating a fresh session for each request to the IDmission WebSDK."), /*#__PURE__*/React__default['default'].createElement("p", {
546
512
  style: {
547
513
  lineHeight: '1.5rem'
548
514
  }
@@ -550,15 +516,14 @@ var TokenExpiredErrorOverlay = function TokenExpiredErrorOverlay() {
550
516
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
551
517
  target: "_blank",
552
518
  rel: "noreferrer"
553
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
554
- href: "https://jwt.io",
555
- target: "_blank",
556
- rel: "noreferrer"
557
- }, "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
+ }, "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.")));
558
520
  };
559
521
 
560
- var TokenPublicKeyErrorOverlay = function TokenPublicKeyErrorOverlay(_a) {
561
- var error = _a.error;
522
+ var SessionValidationErrorOverlay = function SessionValidationErrorOverlay(_a) {
523
+ var error = _a.error,
524
+ onRetry = _a.onRetry;
525
+ var t = reactI18next.useTranslation().t;
526
+ var retryText = t('Retry');
562
527
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
563
528
  style: {
564
529
  justifyContent: 'center'
@@ -571,7 +536,7 @@ var TokenPublicKeyErrorOverlay = function TokenPublicKeyErrorOverlay(_a) {
571
536
  style: {
572
537
  marginBottom: 0
573
538
  }
574
- }, (error === null || error === void 0 ? void 0 : error.host) ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "Failed to reach ", /*#__PURE__*/React__default['default'].createElement("code", null, error.host), ".")) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "Failed to obtain public key for ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), "."))), (error === null || error === void 0 ? void 0 : error.message) && ( /*#__PURE__*/React__default['default'].createElement("p", {
539
+ }, (error === null || error === void 0 ? void 0 : error.host) ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "Failed to reach ", /*#__PURE__*/React__default['default'].createElement("code", null, error.host), ".")) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "Failed to validate ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), "."))), (error === null || error === void 0 ? void 0 : error.message) && ( /*#__PURE__*/React__default['default'].createElement("p", {
575
540
  style: {
576
541
  marginBottom: 0,
577
542
  lineHeight: '1.5rem'
@@ -583,43 +548,213 @@ var TokenPublicKeyErrorOverlay = function TokenPublicKeyErrorOverlay(_a) {
583
548
  }
584
549
  }, "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['default'].createElement("a", {
585
550
  href: "mailto:support@idmission.com"
586
- }, "support@idmission.com"), ".")));
587
- };
588
-
589
- var TokenIssuerNotAllowedErrorOverlay = function TokenIssuerNotAllowedErrorOverlay() {
590
- return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
551
+ }, "support@idmission.com"), "."), onRetry && ( /*#__PURE__*/React__default['default'].createElement("div", {
591
552
  style: {
592
- justifyContent: 'center'
593
- }
594
- }, /*#__PURE__*/React__default['default'].createElement("h3", {
595
- style: {
596
- marginBottom: 8
597
- }
598
- }, "IDmission WebSDK failed to load"), /*#__PURE__*/React__default['default'].createElement("p", {
599
- style: {
600
- marginBottom: 0
601
- }
602
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " comes from an unrecognized issuer."), /*#__PURE__*/React__default['default'].createElement("p", {
603
- style: {
604
- marginBottom: 0,
605
- lineHeight: '1.5rem'
606
- }
607
- }, "Ensure you are generating a fresh token for each request to the IDmission WebSDK."), /*#__PURE__*/React__default['default'].createElement("p", {
608
- style: {
609
- lineHeight: '1.5rem'
553
+ marginTop: 32
610
554
  }
611
- }, "Please refer to the", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
612
- href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
613
- target: "_blank",
614
- rel: "noreferrer"
615
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
616
- href: "https://jwt.io",
617
- target: "_blank",
618
- rel: "noreferrer"
619
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
555
+ }, /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
556
+ variant: "warning",
557
+ finished: true,
558
+ onClick: onRetry
559
+ }, retryText)))));
560
+ };
561
+
562
+ var Spinner = styled__default['default'].div(templateObject_1$C || (templateObject_1$C = tslib.__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) {
563
+ var $size = _a.$size;
564
+ return $size !== null && $size !== void 0 ? $size : 80;
565
+ }, function (_a) {
566
+ var $size = _a.$size;
567
+ return $size !== null && $size !== void 0 ? $size : 80;
568
+ }, function (_a) {
569
+ var $size = _a.$size;
570
+ return ($size !== null && $size !== void 0 ? $size : 80) - 16;
571
+ }, function (_a) {
572
+ var $size = _a.$size;
573
+ return ($size !== null && $size !== void 0 ? $size : 80) - 16;
574
+ }, function (_a) {
575
+ var $thickness = _a.$thickness;
576
+ return $thickness !== null && $thickness !== void 0 ? $thickness : 6;
577
+ }, function (_a) {
578
+ var $color = _a.$color;
579
+ return $color !== null && $color !== void 0 ? $color : '#888';
580
+ }, function (_a) {
581
+ var $color = _a.$color;
582
+ return $color !== null && $color !== void 0 ? $color : '#888';
583
+ }, function (_a) {
584
+ var $color = _a.$color;
585
+ return $color !== null && $color !== void 0 ? $color : '#888';
586
+ });
587
+ var templateObject_1$C;
588
+
589
+ var defaultAuthUrl = 'https://portal-api.idmission.com';
590
+ 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'];
591
+ var initialState$5 = {
592
+ authUrl: defaultAuthUrl,
593
+ sessionCheckState: 'READY'
594
+ };
595
+ var AuthStateContext = /*#__PURE__*/React.createContext(initialState$5);
596
+ var AuthDispatchContext = /*#__PURE__*/React.createContext(function () {});
597
+ var reducer$5 = function reducer(state, action) {
598
+ switch (action.type) {
599
+ case 'setSessionId':
600
+ return tslib.__assign(tslib.__assign({}, state), {
601
+ sessionId: action.payload
602
+ });
603
+ case 'setCheckState':
604
+ return tslib.__assign(tslib.__assign({}, state), {
605
+ sessionCheckState: action.payload
606
+ });
607
+ case 'setError':
608
+ return tslib.__assign(tslib.__assign({}, state), {
609
+ sessionCheckState: 'ERROR',
610
+ authError: action.payload
611
+ });
612
+ case 'retry':
613
+ return tslib.__assign(tslib.__assign({}, state), {
614
+ sessionCheckState: 'READY',
615
+ authError: undefined,
616
+ sessionId: undefined
617
+ });
618
+ default:
619
+ return state;
620
+ }
620
621
  };
622
+ function useAuthReducer(authUrl, sessionId) {
623
+ var _this = this;
624
+ if (authUrl === void 0) {
625
+ authUrl = defaultAuthUrl;
626
+ }
627
+ var _a = React.useReducer(reducer$5, tslib.__assign(tslib.__assign({}, initialState$5), {
628
+ authUrl: authUrl
629
+ })),
630
+ state = _a[0],
631
+ dispatch = _a[1];
632
+ var resolvedSessionId = state.sessionId,
633
+ sessionCheckState = state.sessionCheckState;
634
+ React.useEffect(function () {
635
+ if (!allowedAuthUrls.includes(authUrl)) return dispatch({
636
+ type: 'setCheckState',
637
+ payload: 'AUTH_URL_NOT_ALLOWED'
638
+ });
639
+ }, [authUrl]);
640
+ React.useEffect(function () {
641
+ if (sessionCheckState !== 'READY') return;
642
+ if (!resolvedSessionId) {
643
+ if (!sessionId) return dispatch({
644
+ type: 'setCheckState',
645
+ payload: 'MISSING'
646
+ });
647
+ if (typeof sessionId === 'string') return dispatch({
648
+ type: 'setSessionId',
649
+ payload: sessionId
650
+ });
651
+ if (sessionId instanceof Function) {
652
+ sessionId().then(function (sessionId) {
653
+ dispatch({
654
+ type: 'setSessionId',
655
+ payload: sessionId
656
+ });
657
+ })["catch"](function (e) {
658
+ console.error('failed to resolve session id', e);
659
+ dispatch({
660
+ type: 'setError',
661
+ payload: new SessionValidationFailedError(e, authUrl)
662
+ });
663
+ });
664
+ }
665
+ } else {
666
+ dispatch({
667
+ type: 'setCheckState',
668
+ payload: 'RUNNING'
669
+ });
670
+ (function () {
671
+ return tslib.__awaiter(_this, void 0, void 0, function () {
672
+ var resp, valid, e_1;
673
+ return tslib.__generator(this, function (_a) {
674
+ switch (_a.label) {
675
+ case 0:
676
+ _a.trys.push([0, 3,, 4]);
677
+ return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
678
+ method: 'POST',
679
+ headers: {
680
+ 'Content-Type': 'application/json'
681
+ },
682
+ body: JSON.stringify({
683
+ id: resolvedSessionId
684
+ })
685
+ })];
686
+ case 1:
687
+ resp = _a.sent();
688
+ return [4 /*yield*/, resp.json()];
689
+ case 2:
690
+ valid = _a.sent().valid;
691
+ dispatch({
692
+ type: 'setCheckState',
693
+ payload: valid ? 'PASSED' : 'FAILED'
694
+ });
695
+ return [3 /*break*/, 4];
696
+ case 3:
697
+ e_1 = _a.sent();
698
+ dispatch({
699
+ type: 'setError',
700
+ payload: new SessionValidationFailedError(e_1, authUrl)
701
+ });
702
+ return [3 /*break*/, 4];
703
+ case 4:
704
+ return [2 /*return*/];
705
+ }
706
+ });
707
+ });
708
+ })();
709
+ }
710
+ }, [authUrl, sessionCheckState, resolvedSessionId, sessionId]);
711
+ return [state, dispatch];
712
+ }
713
+ function useAuthContext() {
714
+ var state = React.useContext(AuthStateContext);
715
+ var dispatch = React.useContext(AuthDispatchContext);
716
+ if (!state || !dispatch) throw new Error('useAuthContext cannot be used without AuthStateProvider');
717
+ return [state, dispatch];
718
+ }
719
+ function AuthProvider(_a) {
720
+ var _b = _a.authUrl,
721
+ authUrl = _b === void 0 ? defaultAuthUrl : _b,
722
+ sessionId = _a.sessionId,
723
+ children = _a.children;
724
+ var _c = useAuthReducer(authUrl, sessionId),
725
+ state = _c[0],
726
+ dispatch = _c[1];
727
+ if (state.sessionCheckState === 'MISSING') {
728
+ return /*#__PURE__*/React__default['default'].createElement(SessionIdMissingOverlay, null);
729
+ }
730
+ if (state.sessionCheckState === 'FAILED') {
731
+ return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, null);
732
+ }
733
+ if (state.sessionCheckState === 'AUTH_URL_NOT_ALLOWED') {
734
+ return /*#__PURE__*/React__default['default'].createElement(AuthUrlNotAllowedOverlay, null);
735
+ }
736
+ if (state.sessionCheckState === 'ERROR') {
737
+ return /*#__PURE__*/React__default['default'].createElement(SessionValidationErrorOverlay, {
738
+ error: state.authError,
739
+ onRetry: function onRetry() {
740
+ return dispatch({
741
+ type: 'retry'
742
+ });
743
+ }
744
+ });
745
+ }
746
+ if (state.sessionCheckState === 'READY' || state.sessionCheckState === 'RUNNING') return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
747
+ className: "flex"
748
+ }, /*#__PURE__*/React__default['default'].createElement(Spinner, null));
749
+ return /*#__PURE__*/React__default['default'].createElement(AuthStateContext.Provider, {
750
+ value: state
751
+ }, /*#__PURE__*/React__default['default'].createElement(AuthDispatchContext.Provider, {
752
+ value: dispatch
753
+ }, children));
754
+ }
621
755
 
622
- var allowedTokenIssuers = ['https://demoauth.idmission.com/', 'https://uatauth.idmission.com/', 'https://auth.idmission.com/'];
756
+ var defaultSubmissionUrl = 'https://portal-api.idmission.com/swagger';
757
+ var defaultDocumentServiceUrl = 'https://portal-api.idmission.com/files/';
623
758
  var SubmissionContext = /*#__PURE__*/React.createContext({
624
759
  submit: function submit() {
625
760
  return tslib.__awaiter(void 0, void 0, void 0, function () {
@@ -698,122 +833,127 @@ var SubmissionContext = /*#__PURE__*/React.createContext({
698
833
  var SubmissionProvider = function SubmissionProvider(_a) {
699
834
  var action = _a.action,
700
835
  children = _a.children,
701
- url = _a.url,
702
- _b = _a.environment,
703
- environment = _b === void 0 ? 'prod' : _b,
704
- token = _a.token,
836
+ _b = _a.submissionUrl,
837
+ submissionUrl = _b === void 0 ? defaultSubmissionUrl : _b,
838
+ _c = _a.environment,
839
+ environment = _c === void 0 ? 'prod' : _c,
705
840
  companyId = _a.companyId,
706
841
  enrollmentId = _a.enrollmentId,
707
842
  personalData = _a.personalData,
708
843
  cardData = _a.cardData,
709
- _c = _a.bypassAgeValidation,
710
- bypassAgeValidation = _c === void 0 ? false : _c,
711
- _d = _a.bypassNameMatching,
712
- bypassNameMatching = _d === void 0 ? true : _d,
713
- _e = _a.needImmediateResponse,
714
- needImmediateResponse = _e === void 0 ? false : _e,
715
- _f = _a.manualReviewRequired,
716
- manualReviewRequired = _f === void 0 ? false : _f,
717
- _g = _a.idBackImageRequired,
718
- idBackImageRequired = _g === void 0 ? true : _g,
719
- _h = _a.idImageResolutionCheck,
720
- idImageResolutionCheck = _h === void 0 ? true : _h,
721
- _j = _a.verifyIdWithExternalDatabases,
722
- verifyIdWithExternalDatabases = _j === void 0 ? false : _j,
723
- _k = _a.deduplicationEnabled,
724
- deduplicationEnabled = _k === void 0 ? false : _k,
725
- _l = _a.deduplicationSynchronous,
726
- deduplicationSynchronous = _l === void 0 ? false : _l,
727
- _m = _a.geolocationEnabled,
728
- geolocationEnabled = _m === void 0 ? true : _m,
729
- _o = _a.geolocationRequired,
730
- geolocationRequired = _o === void 0 ? false : _o,
731
- _p = _a.webhooksEnabled,
732
- webhooksEnabled = _p === void 0 ? false : _p,
844
+ _d = _a.bypassAgeValidation,
845
+ bypassAgeValidation = _d === void 0 ? false : _d,
846
+ _e = _a.bypassNameMatching,
847
+ bypassNameMatching = _e === void 0 ? true : _e,
848
+ _f = _a.needImmediateResponse,
849
+ needImmediateResponse = _f === void 0 ? false : _f,
850
+ _g = _a.manualReviewRequired,
851
+ manualReviewRequired = _g === void 0 ? false : _g,
852
+ _h = _a.idBackImageRequired,
853
+ idBackImageRequired = _h === void 0 ? true : _h,
854
+ _j = _a.idImageResolutionCheck,
855
+ idImageResolutionCheck = _j === void 0 ? true : _j,
856
+ _k = _a.verifyIdWithExternalDatabases,
857
+ verifyIdWithExternalDatabases = _k === void 0 ? false : _k,
858
+ _l = _a.deduplicationEnabled,
859
+ deduplicationEnabled = _l === void 0 ? false : _l,
860
+ _m = _a.deduplicationSynchronous,
861
+ deduplicationSynchronous = _m === void 0 ? false : _m,
862
+ idCardForFaceMatch = _a.idCardForFaceMatch,
863
+ _o = _a.geolocationEnabled,
864
+ geolocationEnabled = _o === void 0 ? true : _o,
865
+ _p = _a.geolocationRequired,
866
+ geolocationRequired = _p === void 0 ? false : _p,
867
+ _q = _a.webhooksEnabled,
868
+ webhooksEnabled = _q === void 0 ? false : _q,
733
869
  webhooksClientTraceId = _a.webhooksClientTraceId,
734
- _q = _a.webhooksStripSpecialCharacters,
735
- webhooksStripSpecialCharacters = _q === void 0 ? true : _q,
736
- _r = _a.webhooksSendInputImages,
737
- webhooksSendInputImages = _r === void 0 ? false : _r,
738
- _s = _a.webhooksSendProcessedImages,
739
- webhooksSendProcessedImages = _s === void 0 ? false : _s,
740
- _t = _a.webhooksFireOnReview,
741
- webhooksFireOnReview = _t === void 0 ? false : _t,
870
+ _r = _a.webhooksStripSpecialCharacters,
871
+ webhooksStripSpecialCharacters = _r === void 0 ? true : _r,
872
+ _s = _a.webhooksSendInputImages,
873
+ webhooksSendInputImages = _s === void 0 ? false : _s,
874
+ _t = _a.webhooksSendProcessedImages,
875
+ webhooksSendProcessedImages = _t === void 0 ? false : _t,
876
+ _u = _a.webhooksFireOnReview,
877
+ webhooksFireOnReview = _u === void 0 ? false : _u,
742
878
  precapturedDocuments = _a.precapturedDocuments,
743
- _u = _a.documentServiceUrl,
744
- documentServiceUrl = _u === void 0 ? 'https://portal-api-dev.idmission.com/files/' : _u,
745
- // 'http://localhost:10000/files/',
879
+ _v = _a.documentServiceUrl,
880
+ documentServiceUrl = _v === void 0 ? defaultDocumentServiceUrl : _v,
746
881
  onSubmit = _a.onSubmit,
747
882
  onBeforeSubmit = _a.onBeforeSubmit,
748
883
  onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
884
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
885
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
886
+ onDocumentUploaded = _a.onDocumentUploaded,
887
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
749
888
  onResponseReceived = _a.onResponseReceived,
750
889
  onRequestFailure = _a.onRequestFailure;
751
- var _v = React.useState(SubmissionStatus.READY),
752
- submissionStatus = _v[0],
753
- setSubmissionStatus = _v[1];
754
- var _w = React.useState(null),
755
- submissionRequest = _w[0],
756
- setSubmissionRequest = _w[1];
890
+ var sessionId = useAuthContext()[0].sessionId;
891
+ var _w = React.useState(SubmissionStatus.READY),
892
+ submissionStatus = _w[0],
893
+ setSubmissionStatus = _w[1];
757
894
  var _x = React.useState(null),
758
- submissionResponse = _x[0],
759
- setSubmissionResponse = _x[1];
895
+ submissionRequest = _x[0],
896
+ setSubmissionRequest = _x[1];
760
897
  var _y = React.useState(null),
761
- submissionError = _y[0],
762
- setSubmissionError = _y[1];
898
+ submissionResponse = _y[0],
899
+ setSubmissionResponse = _y[1];
763
900
  var _z = React.useState(null),
764
- retrySubmission = _z[0],
765
- setRetrySubmission = _z[1];
901
+ submissionError = _z[0],
902
+ setSubmissionError = _z[1];
766
903
  var _0 = React.useState(null),
767
- livenessCheckRequest = _0[0],
768
- setLivenessCheckRequest = _0[1];
904
+ retrySubmission = _0[0],
905
+ setRetrySubmission = _0[1];
769
906
  var _1 = React.useState(null),
770
- idFrontImage = _1[0],
771
- setIdFrontImage = _1[1];
907
+ livenessCheckRequest = _1[0],
908
+ setLivenessCheckRequest = _1[1];
772
909
  var _2 = React.useState(null),
773
- idBackImage = _2[0],
774
- setIdBackImage = _2[1];
910
+ idFrontImage = _2[0],
911
+ setIdFrontImage = _2[1];
775
912
  var _3 = React.useState(null),
776
- passportImage = _3[0],
777
- setPassportImage = _3[1];
913
+ idBackImage = _3[0],
914
+ setIdBackImage = _3[1];
778
915
  var _4 = React.useState(null),
779
- selfieImage = _4[0],
780
- setSelfieImage = _4[1];
916
+ passportImage = _4[0],
917
+ setPassportImage = _4[1];
781
918
  var _5 = React.useState(null),
782
- signatureData = _5[0],
783
- setSignatureData = _5[1];
919
+ selfieImage = _5[0],
920
+ setSelfieImage = _5[1];
784
921
  var _6 = React.useState(null),
785
- signatureVideoUrl = _6[0],
786
- setSignatureVideoUrl = _6[1];
922
+ signatureData = _6[0],
923
+ setSignatureData = _6[1];
787
924
  var _7 = React.useState(null),
788
- idCaptureVideoUrl = _7[0],
789
- setIdCaptureVideoUrl = _7[1];
925
+ signatureVideoUrl = _7[0],
926
+ setSignatureVideoUrl = _7[1];
790
927
  var _8 = React.useState(null),
791
- idCaptureVideoIdFrontImage = _8[0],
792
- setIdCaptureVideoIdFrontImage = _8[1];
928
+ idCaptureVideoUrl = _8[0],
929
+ setIdCaptureVideoUrl = _8[1];
793
930
  var _9 = React.useState(null),
794
- idCaptureVideoIdBackImage = _9[0],
795
- setIdCaptureVideoIdBackImage = _9[1];
931
+ idCaptureVideoIdFrontImage = _9[0],
932
+ setIdCaptureVideoIdFrontImage = _9[1];
796
933
  var _10 = React.useState(null),
797
- additionalDocuments = _10[0],
798
- setAdditionalDocuments = _10[1];
934
+ idCaptureVideoIdBackImage = _10[0],
935
+ setIdCaptureVideoIdBackImage = _10[1];
799
936
  var _11 = React.useState(null),
800
- geolocationResult = _11[0],
801
- setGeolocationResult = _11[1];
802
- var _12 = React.useState(0),
803
- geolocationAttempts = _12[0],
804
- setGeolocationAttempts = _12[1];
805
- var _13 = React.useState(false),
806
- geolocationBlocked = _13[0],
807
- setGeolocationBlocked = _13[1];
808
- var _14 = React.useState([]),
809
- idFrontCaptureAttempts = _14[0],
810
- setIdFrontCaptureAttempts = _14[1];
937
+ additionalDocuments = _11[0],
938
+ setAdditionalDocuments = _11[1];
939
+ var _12 = React.useState(null),
940
+ geolocationResult = _12[0],
941
+ setGeolocationResult = _12[1];
942
+ var _13 = React.useState(0),
943
+ geolocationAttempts = _13[0],
944
+ setGeolocationAttempts = _13[1];
945
+ var _14 = React.useState(false),
946
+ geolocationBlocked = _14[0],
947
+ setGeolocationBlocked = _14[1];
811
948
  var _15 = React.useState([]),
812
- idBackCaptureAttempts = _15[0],
813
- setIdBackCaptureAttempts = _15[1];
949
+ idFrontCaptureAttempts = _15[0],
950
+ setIdFrontCaptureAttempts = _15[1];
814
951
  var _16 = React.useState([]),
815
- selfieCaptureAttempts = _16[0],
816
- setSelfieCaptureAttempts = _16[1];
952
+ idBackCaptureAttempts = _16[0],
953
+ setIdBackCaptureAttempts = _16[1];
954
+ var _17 = React.useState([]),
955
+ selfieCaptureAttempts = _17[0],
956
+ setSelfieCaptureAttempts = _17[1];
817
957
  var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
818
958
  setIdFrontCaptureAttempts(function (attempts) {
819
959
  return tslib.__spreadArray(tslib.__spreadArray([], attempts, true), [attempt], false);
@@ -834,13 +974,143 @@ var SubmissionProvider = function SubmissionProvider(_a) {
834
974
  setSelfieImage(dataUrlToBase64Sync(precapturedDocuments.selfie.imageData));
835
975
  }
836
976
  }, [precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie]);
977
+ var uploadDocument = React.useCallback(function (src, metadata) {
978
+ return new Promise(function (resolve, reject) {
979
+ return tslib.__awaiter(void 0, void 0, void 0, function () {
980
+ var blob, _a, upload;
981
+ return tslib.__generator(this, function (_b) {
982
+ switch (_b.label) {
983
+ case 0:
984
+ blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
985
+ _a = onBeforeDocumentUpload;
986
+ if (!_a) return [3 /*break*/, 2];
987
+ return [4 /*yield*/, onBeforeDocumentUpload === null || onBeforeDocumentUpload === void 0 ? void 0 : onBeforeDocumentUpload(blob, metadata)];
988
+ case 1:
989
+ _a = _b.sent() === false;
990
+ _b.label = 2;
991
+ case 2:
992
+ if (_a) return [2 /*return*/, resolve(blobToB64(blob))];
993
+ upload = createUpload(blob, {
994
+ endpoint: documentServiceUrl,
995
+ retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
996
+ headers: {
997
+ 'X-Session-Id': sessionId
998
+ },
999
+ metadata: metadata || {
1000
+ filetype: blob.type
1001
+ },
1002
+ onProgress: function onProgress(bytesUploaded, bytesTotal) {
1003
+ onDocumentUploadProgress === null || onDocumentUploadProgress === void 0 ? void 0 : onDocumentUploadProgress({
1004
+ bytesUploaded: bytesUploaded,
1005
+ bytesTotal: bytesTotal,
1006
+ percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1007
+ metadata: metadata
1008
+ });
1009
+ },
1010
+ onSuccess: function onSuccess() {
1011
+ var _a;
1012
+ var documentId = 'urn:documentsv1:' + ((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift());
1013
+ onDocumentUploaded === null || onDocumentUploaded === void 0 ? void 0 : onDocumentUploaded(documentId, metadata);
1014
+ resolve(documentId);
1015
+ },
1016
+ onError: function onError(error) {
1017
+ console.log('Failed because: ' + error);
1018
+ onDocumentUploadFailed === null || onDocumentUploadFailed === void 0 ? void 0 : onDocumentUploadFailed(error, metadata);
1019
+ reject(error);
1020
+ }
1021
+ });
1022
+ // Check if there are any previous uploads to continue.
1023
+ upload.findPreviousUploads().then(function (previousUploads) {
1024
+ // Found previous uploads so we select the first one.
1025
+ if (previousUploads.length) {
1026
+ upload.resumeFromPreviousUpload(previousUploads[0]);
1027
+ }
1028
+ // Start the upload
1029
+ upload.start();
1030
+ });
1031
+ return [2 /*return*/];
1032
+ }
1033
+ });
1034
+ });
1035
+ });
1036
+ }, [onBeforeDocumentUpload, documentServiceUrl, sessionId, onDocumentUploadProgress, onDocumentUploaded, onDocumentUploadFailed]);
837
1037
  var buildSubmissionPayload = React.useCallback(function () {
838
1038
  return tslib.__awaiter(void 0, void 0, void 0, function () {
839
- var submissionRequest, _a, _b, onBeforeSubmitResult;
840
- var _c, _d;
841
- return tslib.__generator(this, function (_e) {
842
- switch (_e.label) {
1039
+ function uploadIfPossible(src, filename, filetype) {
1040
+ if (filetype === void 0) {
1041
+ filetype = 'image/jpeg';
1042
+ }
1043
+ return tslib.__awaiter(this, void 0, void 0, function () {
1044
+ return tslib.__generator(this, function (_a) {
1045
+ switch (_a.label) {
1046
+ case 0:
1047
+ if (!documentServiceUrl) return [2 /*return*/, src];
1048
+ if (!src.startsWith('data:')) src = "data:".concat(filetype, ";base64,").concat(src);
1049
+ return [4 /*yield*/, uploadDocument(src, {
1050
+ filename: filename,
1051
+ filetype: filetype
1052
+ })];
1053
+ case 1:
1054
+ return [2 /*return*/, _a.sent()];
1055
+ }
1056
+ });
1057
+ });
1058
+ }
1059
+ var documents, _a, _b, submissionRequest, onBeforeSubmitResult;
1060
+ var _c;
1061
+ var _d, _e;
1062
+ return tslib.__generator(this, function (_f) {
1063
+ switch (_f.label) {
843
1064
  case 0:
1065
+ _c = {
1066
+ idFrontImage: idFrontImage,
1067
+ idBackImage: idBackImage,
1068
+ passportImage: passportImage,
1069
+ selfieImage: selfieImage
1070
+ };
1071
+ _a = signatureVideoUrl;
1072
+ if (!_a) return [3 /*break*/, 2];
1073
+ return [4 /*yield*/, videoDataUrlToB64(signatureVideoUrl)];
1074
+ case 1:
1075
+ _a = _f.sent();
1076
+ _f.label = 2;
1077
+ case 2:
1078
+ _c.signatureVideo = _a;
1079
+ _b = idCaptureVideoUrl;
1080
+ if (!_b) return [3 /*break*/, 4];
1081
+ return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoUrl)];
1082
+ case 3:
1083
+ _b = _f.sent();
1084
+ _f.label = 4;
1085
+ case 4:
1086
+ documents = (_c.idCaptureVideo = _b, _c.idCaptureVideoIdFrontImage = idCaptureVideoIdFrontImage, _c.idCaptureVideoIdBackImage = idCaptureVideoIdBackImage, _c);
1087
+ if (signatureData) {
1088
+ documents.signatureImage = signatureData === null || signatureData === void 0 ? void 0 : signatureData.fileContent;
1089
+ }
1090
+ if (!documentServiceUrl) return [3 /*break*/, 6];
1091
+ return [4 /*yield*/, Promise.all(Object.keys(documents).map(function (k) {
1092
+ return tslib.__awaiter(void 0, void 0, void 0, function () {
1093
+ var _a, _b;
1094
+ return tslib.__generator(this, function (_c) {
1095
+ switch (_c.label) {
1096
+ case 0:
1097
+ if (!documents[k]) return [3 /*break*/, 2];
1098
+ _a = documents;
1099
+ _b = k;
1100
+ return [4 /*yield*/, uploadIfPossible(documents[k], k)];
1101
+ case 1:
1102
+ _a[_b] = _c.sent();
1103
+ _c.label = 2;
1104
+ case 2:
1105
+ return [2 /*return*/];
1106
+ }
1107
+ });
1108
+ });
1109
+ }))];
1110
+ case 5:
1111
+ _f.sent();
1112
+ _f.label = 6;
1113
+ case 6:
844
1114
  submissionRequest = {
845
1115
  securityData: {
846
1116
  userName: '',
@@ -872,24 +1142,22 @@ var SubmissionProvider = function SubmissionProvider(_a) {
872
1142
  idImageResolutionCheck: idImageResolutionCheck ? 'Y' : 'N'
873
1143
  }
874
1144
  };
875
- if (idFrontImage) {
876
- submissionRequest.customerData.idData.idImageFront = idFrontImage;
1145
+ if (documents.idFrontImage) {
1146
+ submissionRequest.customerData.idData.idImageFront = documents.idFrontImage;
877
1147
  }
878
- if (idBackImage) {
879
- submissionRequest.customerData.idData.idImageBack = idBackImage;
1148
+ if (documents.idBackImage) {
1149
+ submissionRequest.customerData.idData.idImageBack = documents.idBackImage;
880
1150
  }
881
- if (passportImage) {
882
- submissionRequest.customerData.idData.idImageFront = passportImage;
1151
+ if (documents.passportImage) {
1152
+ submissionRequest.customerData.idData.idImageFront = documents.passportImage;
883
1153
  }
884
- if (selfieImage) {
885
- if (action === SubmissionAction.IDENTIFY) {
886
- // TODO: remove once API is fixed
887
- submissionRequest.biometricData = {
888
- selfie: selfieImage
889
- };
890
- }
1154
+ if (documents.selfieImage) {
1155
+ // if (action === SubmissionAction.IDENTIFY) {
1156
+ // // TODO: remove once API is fixed
1157
+ // submissionRequest.biometricData = { selfie: documents.selfieImage }
1158
+ // }
891
1159
  submissionRequest.customerData.biometricData = {
892
- selfie: selfieImage
1160
+ selfie: documents.selfieImage
893
1161
  };
894
1162
  }
895
1163
  if (companyId) {
@@ -904,23 +1172,20 @@ var SubmissionProvider = function SubmissionProvider(_a) {
904
1172
  submissionRequest.customerData.cardData = cardData;
905
1173
  }
906
1174
  if (enrollmentId) {
907
- (_c = submissionRequest.customerData).personalData || (_c.personalData = {});
1175
+ (_d = submissionRequest.customerData).personalData || (_d.personalData = {});
908
1176
  submissionRequest.customerData.personalData.uniqueNumber = enrollmentId;
909
1177
  }
910
1178
  if (webhooksClientTraceId) {
911
1179
  submissionRequest.additionalData.clientTraceId = webhooksClientTraceId;
912
1180
  }
913
- if (!signatureData) return [3 /*break*/, 2];
914
- submissionRequest.customerData.signatureData = {
915
- signatureImage: JSON.stringify(signatureData)
916
- };
917
- if (!signatureVideoUrl) return [3 /*break*/, 2];
918
- _a = submissionRequest.customerData.signatureData;
919
- return [4 /*yield*/, videoDataUrlToB64(signatureVideoUrl)];
920
- case 1:
921
- _a.signatureVideo = _e.sent();
922
- _e.label = 2;
923
- case 2:
1181
+ if (signatureData) {
1182
+ submissionRequest.customerData.signatureData = {
1183
+ signatureImage: JSON.stringify(signatureData)
1184
+ };
1185
+ if (documents.signatureVideo) {
1186
+ submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
1187
+ }
1188
+ }
924
1189
  if (additionalDocuments) {
925
1190
  submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
926
1191
  return tslib.__assign(tslib.__assign({}, d), {
@@ -930,19 +1195,15 @@ var SubmissionProvider = function SubmissionProvider(_a) {
930
1195
  });
931
1196
  });
932
1197
  }
933
- if (!idCaptureVideoUrl) return [3 /*break*/, 4];
934
- (_d = submissionRequest.customerData).biometricData || (_d.biometricData = {});
935
- _b = submissionRequest.customerData.biometricData;
936
- return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoUrl)];
937
- case 3:
938
- _b.videoData = _e.sent();
939
- _e.label = 4;
940
- case 4:
941
- if (idCaptureVideoIdFrontImage) {
942
- submissionRequest.customerData.idData.videoIdImageFront = dataUrlToBase64Sync(idCaptureVideoIdFrontImage);
1198
+ if (documents.idCaptureVideo) {
1199
+ (_e = submissionRequest.customerData).biometricData || (_e.biometricData = {});
1200
+ submissionRequest.customerData.biometricData.videoData = documents.idCaptureVideo;
1201
+ }
1202
+ if (documents.idCaptureVideoIdFrontImage) {
1203
+ submissionRequest.customerData.idData.videoIdImageFront = documents.idCaptureVideoIdFrontImage;
943
1204
  }
944
- if (idCaptureVideoIdBackImage) {
945
- submissionRequest.customerData.idData.videoIdImageBack = dataUrlToBase64Sync(idCaptureVideoIdBackImage);
1205
+ if (documents.idCaptureVideoIdBackImage) {
1206
+ submissionRequest.customerData.idData.videoIdImageBack = documents.idCaptureVideoIdBackImage;
946
1207
  }
947
1208
  attachMetadataToRequest(submissionRequest, {
948
1209
  selfieCaptureAttempts: selfieCaptureAttempts,
@@ -950,18 +1211,18 @@ var SubmissionProvider = function SubmissionProvider(_a) {
950
1211
  idBackCaptureAttempts: idBackCaptureAttempts,
951
1212
  geolocationResult: geolocationResult
952
1213
  });
953
- if (!onBeforeSubmit) return [3 /*break*/, 6];
1214
+ if (!onBeforeSubmit) return [3 /*break*/, 8];
954
1215
  return [4 /*yield*/, onBeforeSubmit(submissionRequest)];
955
- case 5:
956
- onBeforeSubmitResult = _e.sent();
1216
+ case 7:
1217
+ onBeforeSubmitResult = _f.sent();
957
1218
  if (onBeforeSubmitResult) submissionRequest = onBeforeSubmitResult;
958
- _e.label = 6;
959
- case 6:
1219
+ _f.label = 8;
1220
+ case 8:
960
1221
  return [2 /*return*/, submissionRequest];
961
1222
  }
962
1223
  });
963
1224
  });
964
- }, [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]);
1225
+ }, [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]);
965
1226
  var defaultOnSubmit = React.useCallback(function () {
966
1227
  return tslib.__awaiter(void 0, void 0, void 0, function () {
967
1228
  var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
@@ -987,11 +1248,11 @@ var SubmissionProvider = function SubmissionProvider(_a) {
987
1248
  return [4 /*yield*/, buildSubmissionPayload()];
988
1249
  case 2:
989
1250
  payload = _b.sent();
990
- host = url || determineSubmissionHost(environment, token);
991
- endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage, !!token);
1251
+ host = submissionUrl || determineSubmissionHost(environment);
1252
+ endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage);
992
1253
  return [4 /*yield*/, fetch(host + endpoint, {
993
1254
  method: 'POST',
994
- headers: apiHeaders(token),
1255
+ headers: apiHeaders(sessionId),
995
1256
  body: JSON.stringify(payload)
996
1257
  })["catch"](function (e) {
997
1258
  throw new NetworkError(e.message);
@@ -1039,7 +1300,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1039
1300
  }
1040
1301
  });
1041
1302
  });
1042
- }, [action, buildSubmissionPayload, environment, idBackImage, idFrontImage, onRequestFailure, onResponseReceived, passportImage, selfieImage, token, url]);
1303
+ }, [action, buildSubmissionPayload, submissionUrl, environment, idFrontImage, idBackImage, passportImage, selfieImage, sessionId, onResponseReceived, onRequestFailure]);
1043
1304
  var submit = React.useCallback(function () {
1044
1305
  return tslib.__awaiter(void 0, void 0, void 0, function () {
1045
1306
  var _a;
@@ -1084,6 +1345,15 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1084
1345
  estimateAge: 'N',
1085
1346
  predictGender: 'N'
1086
1347
  }, _a);
1348
+ if (idCardForFaceMatch) {
1349
+ request.customerData.idData = {
1350
+ idImageFront: idCardForFaceMatch
1351
+ };
1352
+ // TODO: remove when fixed
1353
+ request.customerData.additionalData = {
1354
+ uniqueRequestId: request.additionalData.uniqueRequestId
1355
+ };
1356
+ }
1087
1357
  attachMetadataToRequest(request, {
1088
1358
  selfieCaptureAttempts: selfieCaptureAttempts,
1089
1359
  idFrontCaptureAttempts: idFrontCaptureAttempts,
@@ -1098,11 +1368,11 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1098
1368
  if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
1099
1369
  _d.label = 3;
1100
1370
  case 3:
1101
- host = url || determineSubmissionHost(environment, token);
1102
- endpoint = liveCheckEndpoint(!!token);
1371
+ host = submissionUrl || determineSubmissionHost(environment);
1372
+ endpoint = liveCheckEndpoint(!!idCardForFaceMatch);
1103
1373
  return [4 /*yield*/, fetch(host + endpoint, {
1104
1374
  method: 'POST',
1105
- headers: apiHeaders(token),
1375
+ headers: apiHeaders(sessionId),
1106
1376
  body: JSON.stringify(request)
1107
1377
  })["catch"](function (e) {
1108
1378
  throw new NetworkError(e.message);
@@ -1148,7 +1418,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1148
1418
  }
1149
1419
  });
1150
1420
  });
1151
- }, [environment, geolocationResult, idBackCaptureAttempts, idFrontCaptureAttempts, onBeforeLivenessCheck, onRequestFailure, selfieCaptureAttempts, token, url, webhooksStripSpecialCharacters]);
1421
+ }, [webhooksStripSpecialCharacters, idCardForFaceMatch, selfieCaptureAttempts, idFrontCaptureAttempts, idBackCaptureAttempts, geolocationResult, onBeforeLivenessCheck, submissionUrl, environment, sessionId, onRequestFailure]);
1152
1422
  var retryLocationAccess = React.useCallback(function () {
1153
1423
  setGeolocationAttempts(function (n) {
1154
1424
  return n + 1;
@@ -1174,125 +1444,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1174
1444
  setSubmissionStatus(SubmissionStatus.READY);
1175
1445
  retrySubmission();
1176
1446
  }, [retrySubmission]);
1177
- var _17 = React.useState('NOT_PARSED'),
1178
- tokenState = _17[0],
1179
- setTokenState = _17[1];
1180
- var _18 = React.useState(null),
1181
- tokenError = _18[0],
1182
- setTokenError = _18[1];
1183
- React.useEffect(function () {
1184
- if (typeof window === 'undefined') return;
1185
- (function () {
1186
- return tslib.__awaiter(void 0, void 0, void 0, function () {
1187
- var parsed, iss, publicKey, resp, e_3, valid, parts, e_4, exp;
1188
- return tslib.__generator(this, function (_a) {
1189
- switch (_a.label) {
1190
- case 0:
1191
- setTokenState('PARSING');
1192
- if (!token) return [2 /*return*/, setTokenState('MISSING')];
1193
- try {
1194
- parsed = parseJwt(token);
1195
- } catch (e) {
1196
- console.error('error parsing token', e);
1197
- return [2 /*return*/, setTokenState('INVALID_FORMAT')];
1198
- }
1199
- iss = parsed.iss;
1200
- if (!allowedTokenIssuers.some(function (allowedIss) {
1201
- return iss.startsWith(allowedIss);
1202
- })) {
1203
- console.error('issuer is not allowed', iss);
1204
- return [2 /*return*/, setTokenState('ISSUER_NOT_ALLOWED')];
1205
- }
1206
- _a.label = 1;
1207
- case 1:
1208
- _a.trys.push([1, 4,, 5]);
1209
- return [4 /*yield*/, fetch(iss).then(function (r) {
1210
- return r.json();
1211
- })];
1212
- case 2:
1213
- resp = _a.sent();
1214
- return [4 /*yield*/, importRsaKey("-----BEGIN PUBLIC KEY-----\n".concat(resp.public_key, "\n-----END PUBLIC KEY-----"))];
1215
- case 3:
1216
- publicKey = _a.sent();
1217
- return [3 /*break*/, 5];
1218
- case 4:
1219
- e_3 = _a.sent();
1220
- console.error('error fetching public key', e_3);
1221
- setTokenError(new TokenPublicKeyError(e_3, iss));
1222
- return [2 /*return*/, setTokenState('PUBLIC_KEY_LOAD_FAILED')];
1223
- case 5:
1224
- valid = false;
1225
- _a.label = 6;
1226
- case 6:
1227
- _a.trys.push([6, 8,, 9]);
1228
- parts = token.split('.');
1229
- return [4 /*yield*/, window.crypto.subtle.verify({
1230
- name: 'RSASSA-PKCS1-v1_5'
1231
- }, publicKey,
1232
- //from generateKey or importKey above
1233
- str2ab(parts[1]),
1234
- //ArrayBuffer of the signature
1235
- str2ab(parts[2]))];
1236
- case 7:
1237
- _a.sent();
1238
- valid = true;
1239
- return [3 /*break*/, 9];
1240
- case 8:
1241
- e_4 = _a.sent();
1242
- console.error('error validating token', e_4);
1243
- return [3 /*break*/, 9];
1244
- case 9:
1245
- if (!valid) return [2 /*return*/, setTokenState('INVALID_SIGNATURE')];
1246
- exp = parsed.exp;
1247
- if (Date.now() >= exp * 1000) {
1248
- return [2 /*return*/, setTokenState('EXPIRED')];
1249
- }
1250
- setTokenState('GOOD');
1251
- return [2 /*return*/];
1252
- }
1253
- });
1254
- });
1255
- })();
1256
- }, [token]);
1257
- var uploadDocument = React.useCallback(function (blob) {
1258
- return new Promise(function (resolve, reject) {
1259
- Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('tus-js-client')); }).then(function (tus) {
1260
- var upload = new tus.Upload(blob, {
1261
- endpoint: documentServiceUrl,
1262
- retryDelays: [0, 3000, 5000, 10000, 20000],
1263
- metadata: {
1264
- filename: 'My File',
1265
- filetype: 'image/jpeg'
1266
- },
1267
- headers: {
1268
- Authorization: "Bearer ".concat(token)
1269
- },
1270
- onProgress: function onProgress(bytesUploaded, bytesTotal) {
1271
- var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2);
1272
- console.log(bytesUploaded, bytesTotal, percentage + '%');
1273
- },
1274
- onSuccess: function onSuccess() {
1275
- var _a;
1276
- console.log('Download from %s', upload.url);
1277
- resolve('urn:documentsv1:' + ((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1278
- },
1279
- onError: function onError(error) {
1280
- console.log('Failed because: ' + error);
1281
- reject(error);
1282
- }
1283
- });
1284
- // Check if there are any previous uploads to continue.
1285
- upload.findPreviousUploads().then(function (previousUploads) {
1286
- // Found previous uploads so we select the first one.
1287
- if (previousUploads.length) {
1288
- upload.resumeFromPreviousUpload(previousUploads[0]);
1289
- }
1290
- // Start the upload
1291
- upload.start();
1292
- });
1293
- });
1294
- });
1295
- }, [documentServiceUrl, token]);
1296
1447
  var value = {
1297
1448
  submit: submit,
1298
1449
  submissionStatus: submissionStatus,
@@ -1328,26 +1479,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1328
1479
  checkLiveness: checkLiveness,
1329
1480
  retryLocationAccess: retryLocationAccess
1330
1481
  };
1331
- if (tokenState === 'MISSING') {
1332
- return /*#__PURE__*/React__default['default'].createElement(TokenMissingErrorOverlay, null);
1333
- }
1334
- if (tokenState === 'INVALID_FORMAT') {
1335
- return /*#__PURE__*/React__default['default'].createElement(TokenInvalidFormatErrorOverlay, null);
1336
- }
1337
- if (tokenState === 'INVALID_SIGNATURE') {
1338
- return /*#__PURE__*/React__default['default'].createElement(TokenInvalidSignatureErrorOverlay, null);
1339
- }
1340
- if (tokenState === 'EXPIRED') {
1341
- return /*#__PURE__*/React__default['default'].createElement(TokenExpiredErrorOverlay, null);
1342
- }
1343
- if (tokenState === 'PUBLIC_KEY_LOAD_FAILED') {
1344
- return /*#__PURE__*/React__default['default'].createElement(TokenPublicKeyErrorOverlay, {
1345
- error: tokenError
1346
- });
1347
- }
1348
- if (tokenState === 'ISSUER_NOT_ALLOWED') {
1349
- return /*#__PURE__*/React__default['default'].createElement(TokenIssuerNotAllowedErrorOverlay, null);
1350
- }
1351
1482
  return /*#__PURE__*/React__default['default'].createElement(SubmissionContext.Provider, {
1352
1483
  value: value
1353
1484
  }, geolocationRequired && geolocationBlocked ? ( /*#__PURE__*/React__default['default'].createElement(GeolocationAccessDeniedOverlay, null)) : children, submissionError && ( /*#__PURE__*/React__default['default'].createElement(SubmissionErrorOverlay, {
@@ -1355,28 +1486,30 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1355
1486
  onRetry: onRetry
1356
1487
  })));
1357
1488
  };
1358
- function str2ab(str) {
1359
- var buf = new ArrayBuffer(str.length);
1360
- var bufView = new Uint8Array(buf);
1361
- for (var i = 0, strLen = str.length; i < strLen; i++) {
1362
- bufView[i] = str.charCodeAt(i);
1363
- }
1364
- return buf;
1489
+ function createUpload(blob, options) {
1490
+ var UploadType =
1491
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1492
+ // @ts-ignore
1493
+ typeof window.tus !== 'undefined' ? window.tus.Upload : tusJsClient.Upload;
1494
+ return new UploadType(blob, options);
1365
1495
  }
1366
- function importRsaKey(pem) {
1367
- if (typeof window === 'undefined') throw new Error('window cannot be undefined');
1368
- // fetch the part of the PEM string between header and footer
1369
- var pemHeader = '-----BEGIN PUBLIC KEY-----';
1370
- var pemFooter = '-----END PUBLIC KEY-----';
1371
- var pemContents = pem.substring(pemHeader.length, pem.length - pemFooter.length - 1);
1372
- // base64 decode the string to get the binary data
1373
- var binaryDerString = window.atob(pemContents);
1374
- // convert from a binary string to an ArrayBuffer
1375
- var binaryDer = str2ab(binaryDerString);
1376
- return window.crypto.subtle.importKey('spki', binaryDer, {
1377
- name: 'RSASSA-PKCS1-v1_5',
1378
- hash: 'SHA-256'
1379
- }, true, ['verify']);
1496
+ function convertBase64ToBlob(base64Image) {
1497
+ // Split into two parts
1498
+ var parts = base64Image.split(';base64,');
1499
+ // Hold the content type
1500
+ var imageType = parts[0].split(':')[1];
1501
+ // Decode Base64 string
1502
+ var decodedData = window.atob(parts[1]);
1503
+ // Create UNIT8ARRAY of size same as row data length
1504
+ var uInt8Array = new Uint8Array(decodedData.length);
1505
+ // Insert all character code into uInt8Array
1506
+ for (var i = 0; i < decodedData.length; ++i) {
1507
+ uInt8Array[i] = decodedData.charCodeAt(i);
1508
+ }
1509
+ // Return BLOB image after conversion
1510
+ return new Blob([uInt8Array], {
1511
+ type: imageType
1512
+ });
1380
1513
  }
1381
1514
 
1382
1515
  function getNativeBarcodeReaderResult(image) {
@@ -1512,7 +1645,7 @@ function getFrameDimensions(frame) {
1512
1645
  return [frameWidth, frameHeight];
1513
1646
  }
1514
1647
 
1515
- var InvisibleCanvas = styled__default['default'].canvas(templateObject_1$C || (templateObject_1$C = tslib.__makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
1648
+ var InvisibleCanvas = styled__default['default'].canvas(templateObject_1$B || (templateObject_1$B = tslib.__makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
1516
1649
  function drawToCanvas(canvas, frame, width, height) {
1517
1650
  if (!canvas) return;
1518
1651
  var ctx = canvas.getContext('2d');
@@ -1534,7 +1667,7 @@ function clearCanvas(canvas) {
1534
1667
  if (!ctx) return;
1535
1668
  ctx.clearRect(0, 0, canvas.width, canvas.height);
1536
1669
  }
1537
- var templateObject_1$C;
1670
+ var templateObject_1$B;
1538
1671
 
1539
1672
  function listAvailableCameras(facingMode, requestMicAccess) {
1540
1673
  if (requestMicAccess === void 0) {
@@ -1754,7 +1887,7 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1754
1887
  throw e;
1755
1888
  }
1756
1889
  });
1757
- }, [cameraAccessDenied, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
1890
+ }, [cameraAccessDenied, debugMode, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
1758
1891
  React.useEffect(function () {
1759
1892
  var _a;
1760
1893
  if (!videoDevice) return;
@@ -10042,7 +10175,7 @@ var useIdCaptureState = function useIdCaptureState() {
10042
10175
  return [state, dispatch];
10043
10176
  };
10044
10177
 
10045
- var DebugStatsPane = styled__default['default'].span(templateObject_1$B || (templateObject_1$B = tslib.__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"])));
10178
+ var DebugStatsPane = styled__default['default'].span(templateObject_1$A || (templateObject_1$A = tslib.__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"])));
10046
10179
  var ObjectDetectionDebugOverlayDiv = styled__default['default'].div(templateObject_2$q || (templateObject_2$q = tslib.__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) {
10047
10180
  var $flipX = _a.$flipX;
10048
10181
  return $flipX ? 'transform: scaleX(-1);' : '';
@@ -10237,7 +10370,7 @@ function SelfieCaptureFaceKeypoint(_a) {
10237
10370
  }
10238
10371
  });
10239
10372
  }
10240
- var templateObject_1$B, templateObject_2$q, templateObject_3$j, templateObject_4$e;
10373
+ var templateObject_1$A, templateObject_2$q, templateObject_3$j, templateObject_4$e;
10241
10374
 
10242
10375
  var enTranslation = {};
10243
10376
 
@@ -10392,7 +10525,7 @@ function useTranslations(verbiage, fallbacks) {
10392
10525
  }, [fallbacks, i18n.language, t, verbiage]);
10393
10526
  }
10394
10527
 
10395
- var GuidanceMessageContainerDiv = styled__default['default'].div(templateObject_1$A || (templateObject_1$A = tslib.__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) {
10528
+ var GuidanceMessageContainerDiv = styled__default['default'].div(templateObject_1$z || (templateObject_1$z = tslib.__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) {
10396
10529
  var $top = _a.$top;
10397
10530
  return $top !== null && $top !== void 0 ? $top : '10vh';
10398
10531
  }, function (_a) {
@@ -10412,7 +10545,7 @@ var GuidanceMessage = styled__default['default'].div(templateObject_2$p || (temp
10412
10545
  var _a, _b, _c, _d, _e, _f;
10413
10546
  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';
10414
10547
  });
10415
- var templateObject_1$A, templateObject_2$p;
10548
+ var templateObject_1$z, templateObject_2$p;
10416
10549
 
10417
10550
  var IdCapture = function IdCapture(_a) {
10418
10551
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -10764,13 +10897,13 @@ var CameraAccessDeniedOverlay = function CameraAccessDeniedOverlay(_a) {
10764
10897
  finished: true
10765
10898
  }, verbiage.retryBtnText)));
10766
10899
  };
10767
- var StyledOverlayInner$2 = styled__default['default'](OverlayInner$2)(templateObject_1$z || (templateObject_1$z = tslib.__makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
10900
+ var StyledOverlayInner$2 = styled__default['default'](OverlayInner$2)(templateObject_1$y || (templateObject_1$y = tslib.__makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
10768
10901
  var StyledOverlayImageContainer$2 = styled__default['default'](OverlayImageContainer)(templateObject_2$o || (templateObject_2$o = tslib.__makeTemplateObject(["\n flex-grow: 0;\n"], ["\n flex-grow: 0;\n"])));
10769
10902
  var Description$3 = styled__default['default'].p(templateObject_3$i || (templateObject_3$i = tslib.__makeTemplateObject(["\n line-height: 1.5;\n margin-bottom: 50px;\n"], ["\n line-height: 1.5;\n margin-bottom: 50px;\n"])));
10770
10903
  var RetryButton = styled__default['default'](LoaderButton)(templateObject_4$d || (templateObject_4$d = tslib.__makeTemplateObject(["\n width: 200px;\n margin: 0 auto;\n"], ["\n width: 200px;\n margin: 0 auto;\n"])));
10771
- var templateObject_1$z, templateObject_2$o, templateObject_3$i, templateObject_4$d;
10904
+ var templateObject_1$y, templateObject_2$o, templateObject_3$i, templateObject_4$d;
10772
10905
 
10773
- var ExitCaptureStyledButton = styled__default['default'].button(templateObject_1$y || (templateObject_1$y = tslib.__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"])));
10906
+ var ExitCaptureStyledButton = styled__default['default'].button(templateObject_1$x || (templateObject_1$x = tslib.__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"])));
10774
10907
  var ExitCaptureButton = function ExitCaptureButton(_a) {
10775
10908
  var onClick = _a.onClick,
10776
10909
  className = _a.className;
@@ -10814,11 +10947,11 @@ var ExitCaptureButton = function ExitCaptureButton(_a) {
10814
10947
  y2: "19.75"
10815
10948
  }))));
10816
10949
  };
10817
- var templateObject_1$y;
10818
-
10819
- var ButtonsRow = styled__default['default'].div(templateObject_1$x || (templateObject_1$x = tslib.__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"])));
10820
10950
  var templateObject_1$x;
10821
10951
 
10952
+ var ButtonsRow = styled__default['default'].div(templateObject_1$w || (templateObject_1$w = tslib.__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"])));
10953
+ var templateObject_1$w;
10954
+
10822
10955
  function IdCaptureLoadingGraphic(props) {
10823
10956
  var isMobile = window.innerHeight > window.innerWidth;
10824
10957
  return isMobile ? ( /*#__PURE__*/React__default['default'].createElement(IdCaptureLoadingGraphicMobile, tslib.__assign({}, props))) : ( /*#__PURE__*/React__default['default'].createElement(IdCaptureLoadingGraphicDesktop, tslib.__assign({}, props)));
@@ -11452,7 +11585,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
11452
11585
  }
11453
11586
  }, verbiage.continueText))))));
11454
11587
  };
11455
- var OverlayInner$1 = styled__default['default'].div(templateObject_1$w || (templateObject_1$w = tslib.__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) {
11588
+ var OverlayInner$1 = styled__default['default'].div(templateObject_1$v || (templateObject_1$v = tslib.__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) {
11456
11589
  var _a, _b, _c, _d;
11457
11590
  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';
11458
11591
  }, function (props) {
@@ -11504,9 +11637,9 @@ var ContinueButton$1 = styled__default['default'](LoaderButton)(templateObject_1
11504
11637
  var _a, _b, _c, _d, _e, _f;
11505
11638
  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, ";") : '';
11506
11639
  });
11507
- 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;
11640
+ 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;
11508
11641
 
11509
- var ContinuityCameraCheckboxContainer = styled__default['default'].div(templateObject_1$v || (templateObject_1$v = tslib.__makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
11642
+ var ContinuityCameraCheckboxContainer = styled__default['default'].div(templateObject_1$u || (templateObject_1$u = tslib.__makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
11510
11643
  var ContinuityCameraCheckbox = styled__default['default'].input(templateObject_2$m || (templateObject_2$m = tslib.__makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
11511
11644
  var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
11512
11645
  var _b, _c, _d, _e;
@@ -11618,7 +11751,7 @@ var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
11618
11751
  }
11619
11752
  }, cameraReady && modelsReady ? verbiage.continueText : modelsReady ? verbiage.cameraInitializingText : modelDownloadProgress >= 100 ? verbiage.modelsWarmingUpText : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)"))));
11620
11753
  };
11621
- var templateObject_1$v, templateObject_2$m;
11754
+ var templateObject_1$u, templateObject_2$m;
11622
11755
 
11623
11756
  var components$1 = {
11624
11757
  "default": IdCaptureLoadingOverlayDefault,
@@ -11661,7 +11794,7 @@ var CapturedDocumentImg = function CapturedDocumentImg(_a) {
11661
11794
  });
11662
11795
  };
11663
11796
 
11664
- var OverlayInstruction = styled__default['default'].p(templateObject_1$u || (templateObject_1$u = tslib.__makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
11797
+ var OverlayInstruction = styled__default['default'].p(templateObject_1$t || (templateObject_1$t = tslib.__makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
11665
11798
  var IdCaptureSuccess = function IdCaptureSuccess(_a) {
11666
11799
  var capturedDocuments = _a.capturedDocuments,
11667
11800
  // barcodeResult,
@@ -11756,7 +11889,7 @@ var CapturedImageWrapper = styled__default['default'].div(templateObject_7$4 ||
11756
11889
  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)';
11757
11890
  });
11758
11891
  var StyledImage = styled__default['default'](CapturedDocumentImg)(templateObject_8$2 || (templateObject_8$2 = tslib.__makeTemplateObject(["\n width: 100%;\n border-radius: 4px;\n"], ["\n width: 100%;\n border-radius: 4px;\n"])));
11759
- 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;
11892
+ 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;
11760
11893
 
11761
11894
  var CameraVideoTag = function CameraVideoTag(_a) {
11762
11895
  var _b;
@@ -11787,10 +11920,10 @@ var CameraVideoTag = function CameraVideoTag(_a) {
11787
11920
  "$isRearFacing": (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing
11788
11921
  });
11789
11922
  };
11790
- var FullscreenVideoTag = styled__default['default'].video(templateObject_1$t || (templateObject_1$t = tslib.__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) {
11923
+ var FullscreenVideoTag = styled__default['default'].video(templateObject_1$s || (templateObject_1$s = tslib.__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) {
11791
11924
  return props.$isRearFacing ? '' : 'scaleX(-1)';
11792
11925
  });
11793
- var templateObject_1$t;
11926
+ var templateObject_1$s;
11794
11927
 
11795
11928
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
11796
11929
  var _this = this;
@@ -11825,10 +11958,10 @@ function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallb
11825
11958
  return !skipSuccessScreen || skipSuccessScreenResolvedFalse;
11826
11959
  }
11827
11960
 
11828
- var CameraFeedWrapper = styled__default['default'].div(templateObject_1$s || (templateObject_1$s = tslib.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
11961
+ var CameraFeedWrapper = styled__default['default'].div(templateObject_1$r || (templateObject_1$r = tslib.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
11829
11962
  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;") : "";
11830
11963
  });
11831
- var templateObject_1$s;
11964
+ var templateObject_1$r;
11832
11965
 
11833
11966
  function setCanvasDimensions(canvas, width, height) {
11834
11967
  var _a;
@@ -11862,7 +11995,7 @@ var GuideOrientationContext = /*#__PURE__*/React.createContext({
11862
11995
  }
11863
11996
  });
11864
11997
 
11865
- var StyledPageContainer = styled__default['default'](PageContainer)(templateObject_1$r || (templateObject_1$r = tslib.__makeTemplateObject(["\n z-index: 1000;\n"], ["\n z-index: 1000;\n"])));
11998
+ var StyledPageContainer = styled__default['default'](PageContainer)(templateObject_1$q || (templateObject_1$q = tslib.__makeTemplateObject(["\n z-index: 1000;\n"], ["\n z-index: 1000;\n"])));
11866
11999
  var GuidesContainer = styled__default['default'].div(templateObject_2$k || (templateObject_2$k = tslib.__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"])));
11867
12000
  var GuideCenterRow = styled__default['default'].div(templateObject_3$f || (templateObject_3$f = tslib.__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"])));
11868
12001
  var GuideRegion = styled__default['default'].div(templateObject_4$a || (templateObject_4$a = tslib.__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) {
@@ -12014,9 +12147,9 @@ var regionClsx$1 = function regionClsx(classNames, which) {
12014
12147
  return v;
12015
12148
  }).join(' ');
12016
12149
  };
12017
- 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;
12150
+ 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;
12018
12151
 
12019
- var FlippingImage = styled__default['default'](GuideImage)(templateObject_1$q || (templateObject_1$q = tslib.__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) {
12152
+ var FlippingImage = styled__default['default'](GuideImage)(templateObject_1$p || (templateObject_1$p = tslib.__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) {
12020
12153
  return props.$transitionTime;
12021
12154
  }, function (props) {
12022
12155
  return props.$transforms;
@@ -12162,7 +12295,7 @@ var regionClsx = function regionClsx(classNames, which) {
12162
12295
  return v;
12163
12296
  }).join(' ');
12164
12297
  };
12165
- var templateObject_1$q, templateObject_2$j;
12298
+ var templateObject_1$p, templateObject_2$j;
12166
12299
 
12167
12300
  var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
12168
12301
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
@@ -12298,11 +12431,11 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
12298
12431
  imageVisible: imageVisible
12299
12432
  })));
12300
12433
  };
12301
- var CanvasWrapper$1 = styled__default['default'].div(templateObject_1$p || (templateObject_1$p = tslib.__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) {
12434
+ var CanvasWrapper$1 = styled__default['default'].div(templateObject_1$o || (templateObject_1$o = tslib.__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) {
12302
12435
  return props.$maskColor;
12303
12436
  });
12304
12437
  var Canvas$1 = styled__default['default'].canvas(templateObject_2$i || (templateObject_2$i = tslib.__makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
12305
- var templateObject_1$p, templateObject_2$i;
12438
+ var templateObject_1$o, templateObject_2$i;
12306
12439
 
12307
12440
  function IdCaptureGuides(_a) {
12308
12441
  var _b, _c;
@@ -12360,33 +12493,6 @@ function IdCaptureGuides(_a) {
12360
12493
  })));
12361
12494
  }
12362
12495
 
12363
- var Spinner = styled__default['default'].div(templateObject_1$o || (templateObject_1$o = tslib.__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) {
12364
- var $size = _a.$size;
12365
- return $size !== null && $size !== void 0 ? $size : 80;
12366
- }, function (_a) {
12367
- var $size = _a.$size;
12368
- return $size !== null && $size !== void 0 ? $size : 80;
12369
- }, function (_a) {
12370
- var $size = _a.$size;
12371
- return ($size !== null && $size !== void 0 ? $size : 80) - 16;
12372
- }, function (_a) {
12373
- var $size = _a.$size;
12374
- return ($size !== null && $size !== void 0 ? $size : 80) - 16;
12375
- }, function (_a) {
12376
- var $thickness = _a.$thickness;
12377
- return $thickness !== null && $thickness !== void 0 ? $thickness : 6;
12378
- }, function (_a) {
12379
- var $color = _a.$color;
12380
- return $color !== null && $color !== void 0 ? $color : '#888';
12381
- }, function (_a) {
12382
- var $color = _a.$color;
12383
- return $color !== null && $color !== void 0 ? $color : '#888';
12384
- }, function (_a) {
12385
- var $color = _a.$color;
12386
- return $color !== null && $color !== void 0 ? $color : '#888';
12387
- });
12388
- var templateObject_1$o;
12389
-
12390
12496
  var IdCaptureImagePreview = function IdCaptureImagePreview(_a) {
12391
12497
  var _b = _a.classNames,
12392
12498
  classNames = _b === void 0 ? {} : _b,
@@ -12598,7 +12704,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
12598
12704
  cameraRef = _d.cameraRef,
12599
12705
  videoRef = _d.videoRef;
12600
12706
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
12601
- var uploadCapturedDocument = React.useCallback(function (content) {
12707
+ var uploadCapturedDocument = React.useCallback(function (content, filetype) {
12602
12708
  return tslib.__awaiter(void 0, void 0, void 0, function () {
12603
12709
  var documentId_1;
12604
12710
  return tslib.__generator(this, function (_a) {
@@ -12608,7 +12714,9 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
12608
12714
  dispatch({
12609
12715
  type: 'uploadStarted'
12610
12716
  });
12611
- return [4 /*yield*/, uploadDocument(content)];
12717
+ return [4 /*yield*/, uploadDocument(content, {
12718
+ filetype: filetype
12719
+ })];
12612
12720
  case 1:
12613
12721
  documentId_1 = _a.sent();
12614
12722
  setTimeout(function () {
@@ -12654,7 +12762,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
12654
12762
  type: 'setDocuments',
12655
12763
  payload: resolvedDocuments
12656
12764
  });
12657
- if ((_a = resolvedDocuments[0]) === null || _a === void 0 ? void 0 : _a.content) uploadCapturedDocument(resolvedDocuments[0].content);
12765
+ var firstDocumentContent = (_a = resolvedDocuments[0]) === null || _a === void 0 ? void 0 : _a.content;
12766
+ if (firstDocumentContent) uploadCapturedDocument(firstDocumentContent, firstDocumentContent.type);
12658
12767
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
12659
12768
  React.useEffect(function () {
12660
12769
  dispatch({
@@ -12877,7 +12986,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
12877
12986
  return tslib.__generator(this, function (_a) {
12878
12987
  switch (_a.label) {
12879
12988
  case 0:
12880
- return [4 /*yield*/, uploadCapturedDocument(content)];
12989
+ return [4 /*yield*/, uploadCapturedDocument(content, 'image/jpeg')];
12881
12990
  case 1:
12882
12991
  _a.sent();
12883
12992
  return [2 /*return*/];
@@ -13909,7 +14018,7 @@ var reducer$2 = function reducer(state, action) {
13909
14018
  requestError: new Error("".concat(statusMessage, ": ").concat(errorData))
13910
14019
  });
13911
14020
  }
13912
- var faceLive = resultData.verificationResult === 'Live Face Detected';
14021
+ var faceLive = ['Live Face Detected', 'Approved'].includes(resultData.verificationResult);
13913
14022
  var eyeCoveringDetected = resultData.eyeCovering === 'true';
13914
14023
  var maskDetected = resultData.faceMask === 'true';
13915
14024
  var headCoveringDetected = resultData.headCovering === 'true';
@@ -15288,8 +15397,7 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
15288
15397
  var _m = useVideoRecorder(cameraRef.current),
15289
15398
  isRecording = _m.isRecording,
15290
15399
  startRecording = _m.startRecording,
15291
- stopRecording = _m.stopRecording,
15292
- videoUrl = _m.videoUrl;
15400
+ stopRecording = _m.stopRecording;
15293
15401
  var _o = React.useState(null),
15294
15402
  signatureData = _o[0],
15295
15403
  setSignatureData = _o[1];
@@ -15307,32 +15415,54 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
15307
15415
  clearBtnText: 'Clear'
15308
15416
  });
15309
15417
  var outputCanvas = React.useRef(null);
15418
+ var recordingLock = React.useRef(false);
15310
15419
  React.useEffect(function () {
15311
- // delay 100ms to make sure outputCanvas has rendered.
15312
- setTimeout(function () {
15313
- if (!isRecording && !videoUrl && !!outputCanvas.current) {
15314
- startRecording();
15315
- var stream = outputCanvas.current.captureStream(25 /* fps */);
15316
- signatureRecorder.current = new MediaRecorder(stream, {
15317
- videoBitsPerSecond: 270000
15318
- });
15319
- signatureRecorder.current.start();
15320
- signatureRecorder.current.ondataavailable = function (event) {
15321
- var _a;
15322
- recordedChunks.current.push(event.data);
15323
- if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
15324
- signatureRecorder.current.stop();
15420
+ if (recordingLock.current) return;
15421
+ recordingLock.current = true;
15422
+ (function () {
15423
+ return tslib.__awaiter(void 0, void 0, void 0, function () {
15424
+ var stream;
15425
+ return tslib.__generator(this, function (_a) {
15426
+ switch (_a.label) {
15427
+ case 0:
15428
+ if (!!outputCanvas.current) return [3 /*break*/, 2];
15429
+ return [4 /*yield*/, new Promise(function (resolve) {
15430
+ var interval = setInterval(function () {
15431
+ if (outputCanvas.current) {
15432
+ clearInterval(interval);
15433
+ resolve(null);
15434
+ }
15435
+ }, 10);
15436
+ })];
15437
+ case 1:
15438
+ _a.sent();
15439
+ _a.label = 2;
15440
+ case 2:
15441
+ startRecording();
15442
+ stream = outputCanvas.current.captureStream(24 /* fps */);
15443
+ signatureRecorder.current = new MediaRecorder(stream, {
15444
+ videoBitsPerSecond: 270000
15445
+ });
15446
+ signatureRecorder.current.start();
15447
+ signatureRecorder.current.ondataavailable = function (event) {
15448
+ var _a;
15449
+ recordedChunks.current.push(event.data);
15450
+ if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
15451
+ signatureRecorder.current.stop();
15452
+ }
15453
+ };
15454
+ signatureRecorder.current.onstop = function () {
15455
+ var blob = new Blob(recordedChunks.current, {
15456
+ type: 'video/mp4'
15457
+ });
15458
+ setSignatureVideoData(blob);
15459
+ };
15460
+ return [2 /*return*/];
15325
15461
  }
15326
- };
15327
- signatureRecorder.current.onstop = function () {
15328
- var blob = new Blob(recordedChunks.current, {
15329
- type: 'video/mp4'
15330
- });
15331
- setSignatureVideoData(blob);
15332
- };
15333
- }
15334
- }, 100);
15335
- }, [isRecording, startRecording, videoUrl]);
15462
+ });
15463
+ });
15464
+ })();
15465
+ }, [startRecording]);
15336
15466
  React.useEffect(function () {
15337
15467
  if (signatureVideoData && signatureData && signatureDataUrl) {
15338
15468
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
@@ -15596,7 +15726,6 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
15596
15726
  onRetryClicked === null || onRetryClicked === void 0 ? void 0 : onRetryClicked();
15597
15727
  onExit();
15598
15728
  }, [onExit, onRetryClicked]);
15599
- var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onComplete);
15600
15729
  var onDoneClick = React.useCallback(function () {
15601
15730
  return tslib.__awaiter(void 0, void 0, void 0, function () {
15602
15731
  return tslib.__generator(this, function (_a) {
@@ -15611,6 +15740,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
15611
15740
  });
15612
15741
  });
15613
15742
  }, [onComplete, submit]);
15743
+ var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onDoneClick);
15614
15744
  return /*#__PURE__*/React__default['default'].createElement(HighPerformanceSelfieGuidanceModelsProvider, {
15615
15745
  throttleMs: captureState === 'CAPTURING_SIGNATURE' ? 250 : 0,
15616
15746
  onModelError: onModelError,
@@ -15742,29 +15872,29 @@ var FlipImage = styled__default['default'].img(templateObject_1$8 || (templateOb
15742
15872
  var templateObject_1$8;
15743
15873
 
15744
15874
  var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15745
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
15746
- var _u = _a.requestedAction,
15747
- requestedAction = _u === void 0 ? 'SHOW_ID_FRONT' : _u,
15748
- _v = _a.satisfied,
15749
- satisfied = _v === void 0 ? false : _v,
15875
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
15876
+ var _y = _a.requestedAction,
15877
+ requestedAction = _y === void 0 ? 'SHOW_ID_FRONT' : _y,
15878
+ _z = _a.satisfied,
15879
+ satisfied = _z === void 0 ? false : _z,
15750
15880
  faceGuideBorderWidth = _a.faceGuideBorderWidth,
15751
15881
  faceGuideBorderColor = _a.faceGuideBorderColor,
15752
15882
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
15753
15883
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
15754
- _w = _a.assets,
15755
- assets = _w === void 0 ? {} : _w,
15756
- _x = _a.classNames,
15757
- classNames = _x === void 0 ? {} : _x,
15758
- _y = _a.verbiage,
15759
- rawVerbiage = _y === void 0 ? {} : _y;
15884
+ _0 = _a.assets,
15885
+ assets = _0 === void 0 ? {} : _0,
15886
+ _1 = _a.classNames,
15887
+ classNames = _1 === void 0 ? {} : _1,
15888
+ _2 = _a.verbiage,
15889
+ rawVerbiage = _2 === void 0 ? {} : _2;
15760
15890
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
15761
15891
  var imageRef = React.useRef(null);
15762
- var _z = React.useState(0),
15763
- imageWidth = _z[0],
15764
- setImageWidth = _z[1];
15765
- var _0 = React.useState(0),
15766
- imageHeight = _0[0],
15767
- setImageHeight = _0[1];
15892
+ var _3 = React.useState(0),
15893
+ imageWidth = _3[0],
15894
+ setImageWidth = _3[1];
15895
+ var _4 = React.useState(0),
15896
+ imageHeight = _4[0],
15897
+ setImageHeight = _4[1];
15768
15898
  assets.frontImageUrl || (assets.frontImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
15769
15899
  assets.backImageUrl || (assets.backImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
15770
15900
  var verbiage = useTranslations(rawVerbiage, {
@@ -15773,12 +15903,16 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15773
15903
  flipIdInstructionText: 'Please flip your ID card...'
15774
15904
  });
15775
15905
  var instructionText = requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
15776
- var idGuideWidth = typeof window !== 'undefined' && window.innerWidth > window.innerHeight ? '30%' : '75%';
15777
15906
  var theme = styled.useTheme();
15778
15907
  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;
15779
15908
  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';
15780
15909
  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;
15781
15910
  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';
15911
+ var captureImageSize = function captureImageSize() {
15912
+ var _a, _b, _c, _d;
15913
+ if (!imageWidth) setImageWidth((_b = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0);
15914
+ if (!imageHeight) setImageHeight((_d = (_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0);
15915
+ };
15782
15916
  return /*#__PURE__*/React__default['default'].createElement(Container, {
15783
15917
  className: classNames.container
15784
15918
  }, /*#__PURE__*/React__default['default'].createElement(FaceGuide, {
@@ -15786,12 +15920,13 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15786
15920
  "$borderWidth": faceGuideBorderWidth,
15787
15921
  "$borderColor": faceGuideBorderColor
15788
15922
  }), /*#__PURE__*/React__default['default'].createElement(IdCardGuideContainer, {
15789
- "$width": idGuideWidth,
15790
15923
  className: classNames.idCardGuideContainer
15791
15924
  }, /*#__PURE__*/React__default['default'].createElement(IdCardGuideInstructionsContainer, {
15792
15925
  className: classNames.idCardGuideInstructionsContainer
15793
15926
  }, /*#__PURE__*/React__default['default'].createElement(IdCardGuideInstructions, {
15794
- className: classNames.idCardGuideInstructions
15927
+ className: classNames.idCardGuideInstructions,
15928
+ "$textColor": (_u = (_t = theme.idVideoCapture) === null || _t === void 0 ? void 0 : _t.idCardGuides) === null || _u === void 0 ? void 0 : _u.instructionsTextColor,
15929
+ "$background": (_w = (_v = theme.idVideoCapture) === null || _v === void 0 ? void 0 : _v.idCardGuides) === null || _w === void 0 ? void 0 : _w.instructionsBackgroundColor
15795
15930
  }, instructionText)), /*#__PURE__*/React__default['default'].createElement(IdCardGuideImageContainer, {
15796
15931
  "$borderWidth": idCardGuideBorderWidth,
15797
15932
  "$borderColor": idCardGuideBorderColor,
@@ -15807,30 +15942,25 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
15807
15942
  src: requestedAction === 'SHOW_ID_BACK' ? assets.backImageUrl : assets.frontImageUrl,
15808
15943
  alt: "",
15809
15944
  className: classNames.idCardGuideImage,
15810
- "$isMirrored": !((_t = cameraRef.current) === null || _t === void 0 ? void 0 : _t.isRearFacing),
15811
- onLoad: function onLoad() {
15812
- var _a, _b, _c, _d;
15813
- if (!imageWidth) setImageWidth((_b = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0);
15814
- if (!imageHeight) setImageHeight((_d = (_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0);
15815
- }
15945
+ "$isMirrored": !((_x = cameraRef.current) === null || _x === void 0 ? void 0 : _x.isRearFacing),
15946
+ onLoad: captureImageSize,
15947
+ onResize: captureImageSize
15816
15948
  })))));
15817
15949
  };
15818
15950
  var Container = styled__default['default'].div(templateObject_1$7 || (templateObject_1$7 = tslib.__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) {
15819
15951
  var _a;
15820
15952
  return (_a = props.theme) === null || _a === void 0 ? void 0 : _a.fontFamily;
15821
15953
  });
15822
- var FaceGuide = styled__default['default'].div(templateObject_2$7 || (templateObject_2$7 = tslib.__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) {
15954
+ var FaceGuide = styled__default['default'].div(templateObject_2$7 || (templateObject_2$7 = tslib.__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) {
15823
15955
  var _a;
15824
15956
  return (_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 0;
15825
15957
  }, function (props) {
15826
15958
  var _a;
15827
15959
  return (_a = props.$borderColor) !== null && _a !== void 0 ? _a : 'white';
15828
15960
  });
15829
- var IdCardGuideContainer = styled__default['default'].div(templateObject_3$7 || (templateObject_3$7 = tslib.__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) {
15830
- return props.$width;
15831
- });
15832
- var IdCardGuideInstructionsContainer = styled__default['default'].div(templateObject_4$2 || (templateObject_4$2 = tslib.__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"])));
15833
- var IdCardGuideInstructions = styled__default['default'].span(templateObject_5$1 || (templateObject_5$1 = tslib.__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"])));
15961
+ var IdCardGuideContainer = styled__default['default'].div(templateObject_3$7 || (templateObject_3$7 = tslib.__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"])));
15962
+ var IdCardGuideInstructionsContainer = styled__default['default'].div(templateObject_4$2 || (templateObject_4$2 = tslib.__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"])));
15963
+ var IdCardGuideInstructions = styled__default['default'](GuidanceMessage)(templateObject_5$1 || (templateObject_5$1 = tslib.__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"])));
15834
15964
  var IdCardGuideImageContainer = styled__default['default'].div(templateObject_6$1 || (templateObject_6$1 = tslib.__makeTemplateObject(["\n position: relative;\n border: ", "px solid\n ", ";\n"], ["\n position: relative;\n border: ", "px solid\n ", ";\n"])), function (props) {
15835
15965
  return props.$borderWidth;
15836
15966
  }, function (props) {
@@ -17006,8 +17136,10 @@ var ThemeProvider = function ThemeProvider(_a) {
17006
17136
  var IdValidation = function IdValidation(_a) {
17007
17137
  var _b = _a.lang,
17008
17138
  lang = _b === void 0 ? 'auto' : _b,
17009
- submissionToken = _a.submissionToken,
17139
+ sessionId = _a.sessionId,
17010
17140
  submissionUrl = _a.submissionUrl,
17141
+ authUrl = _a.authUrl,
17142
+ documentServiceUrl = _a.documentServiceUrl,
17011
17143
  companyId = _a.companyId,
17012
17144
  needImmediateResponse = _a.needImmediateResponse,
17013
17145
  manualReviewRequired = _a.manualReviewRequired,
@@ -17050,6 +17182,10 @@ var IdValidation = function IdValidation(_a) {
17050
17182
  _p = _a.modelLoadTimeoutMs,
17051
17183
  modelLoadTimeoutMs = _p === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _p,
17052
17184
  onBeforeSubmit = _a.onBeforeSubmit,
17185
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17186
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17187
+ onDocumentUploaded = _a.onDocumentUploaded,
17188
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17053
17189
  onSubmit = _a.onSubmit,
17054
17190
  onComplete = _a.onComplete,
17055
17191
  onApproved = _a.onApproved,
@@ -17140,12 +17276,15 @@ var IdValidation = function IdValidation(_a) {
17140
17276
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
17141
17277
  }
17142
17278
  }, [onApproved, onComplete, onDenied]);
17143
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17279
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
17280
+ sessionId: sessionId,
17281
+ authUrl: authUrl
17282
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17144
17283
  theme: theme
17145
17284
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
17146
17285
  action: SubmissionAction.VALIDATE,
17147
- url: submissionUrl,
17148
- token: submissionToken,
17286
+ submissionUrl: submissionUrl,
17287
+ documentServiceUrl: documentServiceUrl,
17149
17288
  companyId: companyId,
17150
17289
  needImmediateResponse: needImmediateResponse,
17151
17290
  manualReviewRequired: manualReviewRequired,
@@ -17161,6 +17300,10 @@ var IdValidation = function IdValidation(_a) {
17161
17300
  webhooksSendInputImages: webhooksSendInputImages,
17162
17301
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17163
17302
  webhooksFireOnReview: webhooksFireOnReview,
17303
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17304
+ onDocumentUploadProgress: onDocumentUploadProgress,
17305
+ onDocumentUploaded: onDocumentUploaded,
17306
+ onDocumentUploadFailed: onDocumentUploadFailed,
17164
17307
  onBeforeSubmit: onBeforeSubmit,
17165
17308
  onSubmit: onSubmit,
17166
17309
  onResponseReceived: onResponseReceived,
@@ -17177,15 +17320,17 @@ var IdValidation = function IdValidation(_a) {
17177
17320
  captureSignature: captureSignature,
17178
17321
  captureSignatureVideo: captureSignatureVideo,
17179
17322
  debugMode: debugMode
17180
- })));
17323
+ }))));
17181
17324
  };
17182
17325
 
17183
17326
  /** Render a fullscreen capture component that analyzes frames from the user's front-facing camera to determine whether a live human face is present. */
17184
17327
  var FaceValidation = function FaceValidation(_a) {
17185
17328
  var _b = _a.lang,
17186
17329
  lang = _b === void 0 ? 'auto' : _b,
17187
- submissionToken = _a.submissionToken,
17330
+ sessionId = _a.sessionId,
17331
+ authUrl = _a.authUrl,
17188
17332
  submissionUrl = _a.submissionUrl,
17333
+ documentServiceUrl = _a.documentServiceUrl,
17189
17334
  companyId = _a.companyId,
17190
17335
  needImmediateResponse = _a.needImmediateResponse,
17191
17336
  webhooksEnabled = _a.webhooksEnabled,
@@ -17201,6 +17346,11 @@ var FaceValidation = function FaceValidation(_a) {
17201
17346
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
17202
17347
  _f = _a.skipSuccessScreen,
17203
17348
  skipSuccessScreen = _f === void 0 ? false : _f,
17349
+ idCardForFaceMatch = _a.idCardForFaceMatch,
17350
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17351
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17352
+ onDocumentUploaded = _a.onDocumentUploaded,
17353
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17204
17354
  onBeforeSubmit = _a.onBeforeSubmit,
17205
17355
  onComplete = _a.onComplete,
17206
17356
  onApproved = _a.onApproved,
@@ -17242,12 +17392,15 @@ var FaceValidation = function FaceValidation(_a) {
17242
17392
  debugMode: debugMode
17243
17393
  };
17244
17394
  }, [assets, classNames, colors, debugMode, loadingOverlayMode, modelLoadTimeoutMs, onApproved, onComplete, onDenied, onExitAfterFailure, onExitCapture, onModelError, onUserCancel, skipSuccessScreen, timeoutDurationMs, verbiage]);
17245
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17395
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
17396
+ sessionId: sessionId,
17397
+ authUrl: authUrl
17398
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17246
17399
  theme: theme
17247
17400
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
17248
17401
  action: SubmissionAction.NONE,
17249
- url: submissionUrl,
17250
- token: submissionToken,
17402
+ submissionUrl: submissionUrl,
17403
+ documentServiceUrl: documentServiceUrl,
17251
17404
  companyId: companyId,
17252
17405
  needImmediateResponse: needImmediateResponse,
17253
17406
  webhooksEnabled: webhooksEnabled,
@@ -17255,6 +17408,11 @@ var FaceValidation = function FaceValidation(_a) {
17255
17408
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
17256
17409
  webhooksSendInputImages: webhooksSendInputImages,
17257
17410
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17411
+ idCardForFaceMatch: idCardForFaceMatch,
17412
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17413
+ onDocumentUploadProgress: onDocumentUploadProgress,
17414
+ onDocumentUploaded: onDocumentUploaded,
17415
+ onDocumentUploadFailed: onDocumentUploadFailed,
17258
17416
  onBeforeLivenessCheck: onBeforeSubmit,
17259
17417
  geolocationEnabled: geolocationEnabled,
17260
17418
  geolocationRequired: geolocationRequired
@@ -17264,7 +17422,7 @@ var FaceValidation = function FaceValidation(_a) {
17264
17422
  }, []),
17265
17423
  faceLivenessProps: faceLivenessProps,
17266
17424
  debugMode: debugMode
17267
- })));
17425
+ }))));
17268
17426
  };
17269
17427
 
17270
17428
  /**
@@ -17273,8 +17431,10 @@ var FaceValidation = function FaceValidation(_a) {
17273
17431
  var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17274
17432
  var _b = _a.lang,
17275
17433
  lang = _b === void 0 ? 'auto' : _b,
17276
- submissionToken = _a.submissionToken,
17434
+ sessionId = _a.sessionId,
17435
+ authUrl = _a.authUrl,
17277
17436
  submissionUrl = _a.submissionUrl,
17437
+ documentServiceUrl = _a.documentServiceUrl,
17278
17438
  companyId = _a.companyId,
17279
17439
  needImmediateResponse = _a.needImmediateResponse,
17280
17440
  manualReviewRequired = _a.manualReviewRequired,
@@ -17324,6 +17484,10 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17324
17484
  idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _s,
17325
17485
  _t = _a.selfieCaptureModelLoadTimeoutMs,
17326
17486
  selfieCaptureModelLoadTimeoutMs = _t === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _t,
17487
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17488
+ onDocumentUploaded = _a.onDocumentUploaded,
17489
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17490
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17327
17491
  onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
17328
17492
  onBeforeSubmit = _a.onBeforeSubmit,
17329
17493
  onSubmit = _a.onSubmit,
@@ -17438,12 +17602,15 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17438
17602
  var checks = React.useMemo(function () {
17439
17603
  return (precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie) ? ['IdCapture'] : ['IdCapture', 'FaceLiveness'];
17440
17604
  }, [precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie]);
17441
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17605
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
17606
+ sessionId: sessionId,
17607
+ authUrl: authUrl
17608
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17442
17609
  theme: theme
17443
17610
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
17444
17611
  action: SubmissionAction.VALIDATE,
17445
- url: submissionUrl,
17446
- token: submissionToken,
17612
+ submissionUrl: submissionUrl,
17613
+ documentServiceUrl: documentServiceUrl,
17447
17614
  companyId: companyId,
17448
17615
  needImmediateResponse: needImmediateResponse,
17449
17616
  manualReviewRequired: manualReviewRequired,
@@ -17460,6 +17627,10 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17460
17627
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17461
17628
  webhooksFireOnReview: webhooksFireOnReview,
17462
17629
  precapturedDocuments: precapturedDocuments,
17630
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17631
+ onDocumentUploadProgress: onDocumentUploadProgress,
17632
+ onDocumentUploaded: onDocumentUploaded,
17633
+ onDocumentUploadFailed: onDocumentUploadFailed,
17463
17634
  onBeforeSubmit: onBeforeSubmit,
17464
17635
  onBeforeLivenessCheck: onBeforeLivenessCheck,
17465
17636
  onSubmit: onSubmit,
@@ -17476,7 +17647,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
17476
17647
  captureSignature: captureSignature,
17477
17648
  captureSignatureVideo: captureSignatureVideo,
17478
17649
  debugMode: debugMode
17479
- })));
17650
+ }))));
17480
17651
  };
17481
17652
 
17482
17653
  /**
@@ -17486,8 +17657,10 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17486
17657
  var enrollmentId = _a.enrollmentId,
17487
17658
  _b = _a.lang,
17488
17659
  lang = _b === void 0 ? 'auto' : _b,
17489
- submissionToken = _a.submissionToken,
17660
+ sessionId = _a.sessionId,
17661
+ authUrl = _a.authUrl,
17490
17662
  submissionUrl = _a.submissionUrl,
17663
+ documentServiceUrl = _a.documentServiceUrl,
17491
17664
  companyId = _a.companyId,
17492
17665
  needImmediateResponse = _a.needImmediateResponse,
17493
17666
  manualReviewRequired = _a.manualReviewRequired,
@@ -17539,6 +17712,10 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17539
17712
  idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _s,
17540
17713
  _t = _a.selfieCaptureModelLoadTimeoutMs,
17541
17714
  selfieCaptureModelLoadTimeoutMs = _t === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _t,
17715
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
17716
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
17717
+ onDocumentUploaded = _a.onDocumentUploaded,
17718
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
17542
17719
  onBeforeSubmit = _a.onBeforeSubmit,
17543
17720
  onSubmit = _a.onSubmit,
17544
17721
  onComplete = _a.onComplete,
@@ -17647,12 +17824,15 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17647
17824
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
17648
17825
  }
17649
17826
  }, [onEnrolled, onComplete, onDenied]);
17650
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17827
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
17828
+ sessionId: sessionId,
17829
+ authUrl: authUrl
17830
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17651
17831
  theme: theme
17652
17832
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
17653
17833
  action: SubmissionAction.ENROLL,
17654
- url: submissionUrl,
17655
- token: submissionToken,
17834
+ submissionUrl: submissionUrl,
17835
+ documentServiceUrl: documentServiceUrl,
17656
17836
  companyId: companyId,
17657
17837
  enrollmentId: enrollmentId,
17658
17838
  needImmediateResponse: needImmediateResponse,
@@ -17672,6 +17852,10 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17672
17852
  webhooksSendInputImages: webhooksSendInputImages,
17673
17853
  webhooksSendProcessedImages: webhooksSendProcessedImages,
17674
17854
  webhooksFireOnReview: webhooksFireOnReview,
17855
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
17856
+ onDocumentUploadProgress: onDocumentUploadProgress,
17857
+ onDocumentUploaded: onDocumentUploaded,
17858
+ onDocumentUploadFailed: onDocumentUploadFailed,
17675
17859
  onBeforeSubmit: onBeforeSubmit,
17676
17860
  onSubmit: onSubmit,
17677
17861
  onResponseReceived: onResponseReceived,
@@ -17689,7 +17873,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
17689
17873
  captureSignature: captureSignature,
17690
17874
  captureSignatureVideo: captureSignatureVideo,
17691
17875
  debugMode: debugMode
17692
- })));
17876
+ }))));
17693
17877
  };
17694
17878
 
17695
17879
  var ALLOWED_RETRIES$3 = 0;
@@ -18129,8 +18313,10 @@ var CustomerVerification = function CustomerVerification(_a) {
18129
18313
  var _b = _a.lang,
18130
18314
  lang = _b === void 0 ? 'auto' : _b,
18131
18315
  enrollmentId = _a.enrollmentId,
18132
- submissionToken = _a.submissionToken,
18316
+ sessionId = _a.sessionId,
18317
+ authUrl = _a.authUrl,
18133
18318
  submissionUrl = _a.submissionUrl,
18319
+ documentServiceUrl = _a.documentServiceUrl,
18134
18320
  companyId = _a.companyId,
18135
18321
  needImmediateResponse = _a.needImmediateResponse,
18136
18322
  webhooksEnabled = _a.webhooksEnabled,
@@ -18152,6 +18338,10 @@ var CustomerVerification = function CustomerVerification(_a) {
18152
18338
  classNames = _a.classNames,
18153
18339
  colors = _a.colors,
18154
18340
  verbiage = _a.verbiage,
18341
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
18342
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
18343
+ onDocumentUploaded = _a.onDocumentUploaded,
18344
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18155
18345
  onBeforeSubmit = _a.onBeforeSubmit,
18156
18346
  onSubmit = _a.onSubmit,
18157
18347
  onComplete = _a.onComplete,
@@ -18168,12 +18358,15 @@ var CustomerVerification = function CustomerVerification(_a) {
18168
18358
  _k = _a.debugMode,
18169
18359
  debugMode = _k === void 0 ? false : _k;
18170
18360
  useLanguage(lang);
18171
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
18361
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
18362
+ sessionId: sessionId,
18363
+ authUrl: authUrl
18364
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
18172
18365
  theme: theme
18173
18366
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
18174
18367
  action: SubmissionAction.VERIFY,
18175
- url: submissionUrl,
18176
- token: submissionToken,
18368
+ submissionUrl: submissionUrl,
18369
+ documentServiceUrl: documentServiceUrl,
18177
18370
  companyId: companyId,
18178
18371
  enrollmentId: enrollmentId,
18179
18372
  needImmediateResponse: needImmediateResponse,
@@ -18182,6 +18375,10 @@ var CustomerVerification = function CustomerVerification(_a) {
18182
18375
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
18183
18376
  webhooksSendInputImages: webhooksSendInputImages,
18184
18377
  webhooksSendProcessedImages: webhooksSendProcessedImages,
18378
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
18379
+ onDocumentUploadProgress: onDocumentUploadProgress,
18380
+ onDocumentUploaded: onDocumentUploaded,
18381
+ onDocumentUploadFailed: onDocumentUploadFailed,
18185
18382
  onBeforeSubmit: onBeforeSubmit,
18186
18383
  onSubmit: onSubmit,
18187
18384
  geolocationEnabled: geolocationEnabled,
@@ -18207,7 +18404,7 @@ var CustomerVerification = function CustomerVerification(_a) {
18207
18404
  colors: colors,
18208
18405
  verbiage: verbiage,
18209
18406
  debugMode: debugMode
18210
- })))));
18407
+ }))))));
18211
18408
  };
18212
18409
 
18213
18410
  var ALLOWED_RETRIES$1 = 0;
@@ -18644,8 +18841,10 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
18644
18841
  var CustomerIdentification = function CustomerIdentification(_a) {
18645
18842
  var _b = _a.lang,
18646
18843
  lang = _b === void 0 ? 'auto' : _b,
18647
- submissionToken = _a.submissionToken,
18844
+ sessionId = _a.sessionId,
18845
+ authUrl = _a.authUrl,
18648
18846
  submissionUrl = _a.submissionUrl,
18847
+ documentServiceUrl = _a.documentServiceUrl,
18649
18848
  companyId = _a.companyId,
18650
18849
  needImmediateResponse = _a.needImmediateResponse,
18651
18850
  webhooksEnabled = _a.webhooksEnabled,
@@ -18661,6 +18860,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18661
18860
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
18662
18861
  _f = _a.skipSuccessScreen,
18663
18862
  skipSuccessScreen = _f === void 0 ? false : _f,
18863
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
18864
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
18865
+ onDocumentUploaded = _a.onDocumentUploaded,
18866
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18664
18867
  onBeforeSubmit = _a.onBeforeSubmit,
18665
18868
  onSubmit = _a.onSubmit,
18666
18869
  onComplete = _a.onComplete,
@@ -18683,12 +18886,15 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18683
18886
  _j = _a.debugMode,
18684
18887
  debugMode = _j === void 0 ? false : _j;
18685
18888
  useLanguage(lang);
18686
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
18889
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
18890
+ sessionId: sessionId,
18891
+ authUrl: authUrl
18892
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
18687
18893
  theme: theme
18688
18894
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
18689
18895
  action: SubmissionAction.IDENTIFY,
18690
- url: submissionUrl,
18691
- token: submissionToken,
18896
+ submissionUrl: submissionUrl,
18897
+ documentServiceUrl: documentServiceUrl,
18692
18898
  companyId: companyId,
18693
18899
  needImmediateResponse: needImmediateResponse,
18694
18900
  webhooksEnabled: webhooksEnabled,
@@ -18696,6 +18902,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18696
18902
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
18697
18903
  webhooksSendInputImages: webhooksSendInputImages,
18698
18904
  webhooksSendProcessedImages: webhooksSendProcessedImages,
18905
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
18906
+ onDocumentUploadProgress: onDocumentUploadProgress,
18907
+ onDocumentUploaded: onDocumentUploaded,
18908
+ onDocumentUploadFailed: onDocumentUploadFailed,
18699
18909
  onBeforeSubmit: onBeforeSubmit,
18700
18910
  onSubmit: onSubmit,
18701
18911
  geolocationEnabled: geolocationEnabled,
@@ -18722,15 +18932,21 @@ var CustomerIdentification = function CustomerIdentification(_a) {
18722
18932
  colors: colors,
18723
18933
  verbiage: verbiage,
18724
18934
  debugMode: debugMode
18725
- })))));
18935
+ }))))));
18726
18936
  };
18727
18937
 
18728
18938
  /** Render a fullscreen capture component that captures a video of the user signing the screen. */
18729
18939
  var SignatureKYC = function SignatureKYC(_a) {
18730
18940
  var _b = _a.lang,
18731
18941
  lang = _b === void 0 ? 'auto' : _b,
18732
- submissionToken = _a.submissionToken,
18942
+ sessionId = _a.sessionId,
18943
+ authUrl = _a.authUrl,
18733
18944
  submissionUrl = _a.submissionUrl,
18945
+ documentServiceUrl = _a.documentServiceUrl,
18946
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
18947
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
18948
+ onDocumentUploaded = _a.onDocumentUploaded,
18949
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18734
18950
  onBeforeSubmit = _a.onBeforeSubmit,
18735
18951
  onSubmit = _a.onSubmit,
18736
18952
  onComplete = _a.onComplete,
@@ -18740,6 +18956,7 @@ var SignatureKYC = function SignatureKYC(_a) {
18740
18956
  loadingOverlayMode = _c === void 0 ? 'default' : _c,
18741
18957
  _d = _a.skipSuccessScreen,
18742
18958
  skipSuccessScreen = _d === void 0 ? false : _d,
18959
+ idCardForFaceMatch = _a.idCardForFaceMatch,
18743
18960
  _e = _a.modelLoadTimeoutMs,
18744
18961
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
18745
18962
  _f = _a.theme,
@@ -18754,12 +18971,25 @@ var SignatureKYC = function SignatureKYC(_a) {
18754
18971
  var _g = React.useState(0),
18755
18972
  attempt = _g[0],
18756
18973
  setAttempt = _g[1];
18757
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
18974
+ var onRetryClicked = React.useCallback(function () {
18975
+ setAttempt(function (n) {
18976
+ return n + 1;
18977
+ });
18978
+ }, []);
18979
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
18980
+ sessionId: sessionId,
18981
+ authUrl: authUrl
18982
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
18758
18983
  theme: theme
18759
18984
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
18760
18985
  action: SubmissionAction.NONE,
18761
- url: submissionUrl,
18762
- token: submissionToken,
18986
+ submissionUrl: submissionUrl,
18987
+ documentServiceUrl: documentServiceUrl,
18988
+ idCardForFaceMatch: idCardForFaceMatch,
18989
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
18990
+ onDocumentUploadProgress: onDocumentUploadProgress,
18991
+ onDocumentUploaded: onDocumentUploaded,
18992
+ onDocumentUploadFailed: onDocumentUploadFailed,
18763
18993
  onBeforeSubmit: onBeforeSubmit,
18764
18994
  onSubmit: onSubmit,
18765
18995
  onResponseReceived: onComplete,
@@ -18780,12 +19010,8 @@ var SignatureKYC = function SignatureKYC(_a) {
18780
19010
  verbiage: verbiage,
18781
19011
  onModelError: onModelError,
18782
19012
  onUserCancel: onUserCancel,
18783
- onRetryClicked: function onRetryClicked() {
18784
- setAttempt(function (n) {
18785
- return n + 1;
18786
- });
18787
- }
18788
- }))));
19013
+ onRetryClicked: onRetryClicked
19014
+ })))));
18789
19015
  };
18790
19016
 
18791
19017
  /**
@@ -18794,8 +19020,10 @@ var SignatureKYC = function SignatureKYC(_a) {
18794
19020
  var VideoIdValidation = function VideoIdValidation(_a) {
18795
19021
  var _b = _a.lang,
18796
19022
  lang = _b === void 0 ? 'auto' : _b,
18797
- submissionToken = _a.submissionToken,
19023
+ sessionId = _a.sessionId,
19024
+ authUrl = _a.authUrl,
18798
19025
  submissionUrl = _a.submissionUrl,
19026
+ documentServiceUrl = _a.documentServiceUrl,
18799
19027
  companyId = _a.companyId,
18800
19028
  needImmediateResponse = _a.needImmediateResponse,
18801
19029
  manualReviewRequired = _a.manualReviewRequired,
@@ -18811,6 +19039,10 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18811
19039
  webhooksSendInputImages = _a.webhooksSendInputImages,
18812
19040
  webhooksSendProcessedImages = _a.webhooksSendProcessedImages,
18813
19041
  webhooksFireOnReview = _a.webhooksFireOnReview,
19042
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
19043
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
19044
+ onDocumentUploaded = _a.onDocumentUploaded,
19045
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18814
19046
  onSubmit = _a.onSubmit,
18815
19047
  onBeforeSubmit = _a.onBeforeSubmit,
18816
19048
  onComplete = _a.onComplete,
@@ -18850,6 +19082,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18850
19082
  idCapturePortraitGuidesOnMobile = _r === void 0 ? false : _r,
18851
19083
  _s = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
18852
19084
  idCaptureRotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
19085
+ idCardForFaceMatch = _a.idCardForFaceMatch,
18853
19086
  _t = _a.faceLivenessLoadingOverlayMode,
18854
19087
  faceLivenessLoadingOverlayMode = _t === void 0 ? 'default' : _t,
18855
19088
  _u = _a.theme,
@@ -18930,12 +19163,15 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18930
19163
  debugMode: debugMode
18931
19164
  };
18932
19165
  }, [classNames.videoSignatureCapture, colors.videoSignatureCapture, debugMode, onExitCapture, onUserCancel, skipSuccessScreen, verbiage.videoSignatureCapture]);
18933
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
19166
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
19167
+ sessionId: sessionId,
19168
+ authUrl: authUrl
19169
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
18934
19170
  theme: theme
18935
19171
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
18936
19172
  action: skipIdCapture ? SubmissionAction.NONE : SubmissionAction.VALIDATE,
18937
- url: submissionUrl,
18938
- token: submissionToken,
19173
+ submissionUrl: submissionUrl,
19174
+ documentServiceUrl: documentServiceUrl,
18939
19175
  companyId: companyId,
18940
19176
  needImmediateResponse: needImmediateResponse,
18941
19177
  manualReviewRequired: manualReviewRequired,
@@ -18951,6 +19187,11 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18951
19187
  webhooksSendInputImages: webhooksSendInputImages,
18952
19188
  webhooksSendProcessedImages: webhooksSendProcessedImages,
18953
19189
  webhooksFireOnReview: webhooksFireOnReview,
19190
+ idCardForFaceMatch: idCardForFaceMatch,
19191
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
19192
+ onDocumentUploadProgress: onDocumentUploadProgress,
19193
+ onDocumentUploaded: onDocumentUploaded,
19194
+ onDocumentUploadFailed: onDocumentUploadFailed,
18954
19195
  onSubmit: onSubmit,
18955
19196
  onBeforeSubmit: onBeforeSubmit,
18956
19197
  onResponseReceived: onComplete,
@@ -18967,7 +19208,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
18967
19208
  captureSignature: captureSignature,
18968
19209
  captureSignatureVideo: captureSignatureVideo,
18969
19210
  debugMode: debugMode
18970
- })));
19211
+ }))));
18971
19212
  };
18972
19213
 
18973
19214
  /** 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. */
@@ -18975,8 +19216,10 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
18975
19216
  var enrollmentId = _a.enrollmentId,
18976
19217
  _b = _a.lang,
18977
19218
  lang = _b === void 0 ? 'auto' : _b,
18978
- submissionToken = _a.submissionToken,
19219
+ sessionId = _a.sessionId,
19220
+ authUrl = _a.authUrl,
18979
19221
  submissionUrl = _a.submissionUrl,
19222
+ documentServiceUrl = _a.documentServiceUrl,
18980
19223
  companyId = _a.companyId,
18981
19224
  needImmediateResponse = _a.needImmediateResponse,
18982
19225
  deduplicationEnabled = _a.deduplicationEnabled,
@@ -18994,6 +19237,10 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
18994
19237
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
18995
19238
  _f = _a.skipSuccessScreen,
18996
19239
  skipSuccessScreen = _f === void 0 ? false : _f,
19240
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
19241
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
19242
+ onDocumentUploaded = _a.onDocumentUploaded,
19243
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
18997
19244
  onBeforeSubmit = _a.onBeforeSubmit,
18998
19245
  onSubmit = _a.onSubmit,
18999
19246
  onComplete = _a.onComplete,
@@ -19075,12 +19322,15 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19075
19322
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
19076
19323
  }
19077
19324
  }, [onEnrolled, onComplete, onDenied]);
19078
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
19325
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
19326
+ sessionId: sessionId,
19327
+ authUrl: authUrl
19328
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
19079
19329
  theme: theme
19080
19330
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
19081
19331
  action: SubmissionAction.ENROLL,
19082
- url: submissionUrl,
19083
- token: submissionToken,
19332
+ submissionUrl: submissionUrl,
19333
+ documentServiceUrl: documentServiceUrl,
19084
19334
  companyId: companyId,
19085
19335
  enrollmentId: enrollmentId,
19086
19336
  needImmediateResponse: needImmediateResponse,
@@ -19091,6 +19341,10 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19091
19341
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
19092
19342
  webhooksSendInputImages: webhooksSendInputImages,
19093
19343
  webhooksSendProcessedImages: webhooksSendProcessedImages,
19344
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
19345
+ onDocumentUploadProgress: onDocumentUploadProgress,
19346
+ onDocumentUploaded: onDocumentUploaded,
19347
+ onDocumentUploadFailed: onDocumentUploadFailed,
19094
19348
  onBeforeSubmit: onBeforeSubmit,
19095
19349
  onSubmit: onSubmit,
19096
19350
  onResponseReceived: onResponseReceived,
@@ -19107,7 +19361,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19107
19361
  captureSignature: captureSignature,
19108
19362
  captureSignatureVideo: captureSignatureVideo,
19109
19363
  debugMode: debugMode
19110
- })));
19364
+ }))));
19111
19365
  };
19112
19366
 
19113
19367
  /**
@@ -19116,11 +19370,15 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
19116
19370
  var DocumentCapture = function DocumentCapture(_a) {
19117
19371
  var _b = _a.lang,
19118
19372
  lang = _b === void 0 ? 'auto' : _b,
19119
- submissionToken = _a.submissionToken,
19373
+ sessionId = _a.sessionId,
19374
+ authUrl = _a.authUrl,
19120
19375
  submissionUrl = _a.submissionUrl,
19121
19376
  documentServiceUrl = _a.documentServiceUrl,
19122
- onComplete = _a.onComplete,
19377
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
19378
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
19123
19379
  onDocumentUploaded = _a.onDocumentUploaded,
19380
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
19381
+ onComplete = _a.onComplete,
19124
19382
  onExitCapture = _a.onExitCapture,
19125
19383
  onUserCancel = _a.onUserCancel,
19126
19384
  _c = _a.documents,
@@ -19141,13 +19399,19 @@ var DocumentCapture = function DocumentCapture(_a) {
19141
19399
  _j = _a.debugMode,
19142
19400
  debugMode = _j === void 0 ? false : _j;
19143
19401
  useLanguage(lang);
19144
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
19402
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
19403
+ sessionId: sessionId,
19404
+ authUrl: authUrl
19405
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
19145
19406
  theme: theme
19146
19407
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
19147
19408
  action: SubmissionAction.NONE,
19148
- url: submissionUrl,
19149
- token: submissionToken,
19409
+ submissionUrl: submissionUrl,
19150
19410
  documentServiceUrl: documentServiceUrl,
19411
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
19412
+ onDocumentUploadProgress: onDocumentUploadProgress,
19413
+ onDocumentUploaded: onDocumentUploaded,
19414
+ onDocumentUploadFailed: onDocumentUploadFailed,
19151
19415
  geolocationEnabled: geolocationEnabled,
19152
19416
  geolocationRequired: geolocationRequired
19153
19417
  }, /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
@@ -19155,7 +19419,6 @@ var DocumentCapture = function DocumentCapture(_a) {
19155
19419
  debugMode: debugMode
19156
19420
  }, /*#__PURE__*/React__default['default'].createElement(DocumentCaptureWizard, {
19157
19421
  onSuccess: onComplete,
19158
- onDocumentUploaded: onDocumentUploaded,
19159
19422
  onExitCapture: onExitCapture,
19160
19423
  onUserCancel: onUserCancel,
19161
19424
  documents: documents,
@@ -19164,7 +19427,7 @@ var DocumentCapture = function DocumentCapture(_a) {
19164
19427
  instructions: instructions,
19165
19428
  classNames: classNames,
19166
19429
  verbiage: verbiage
19167
- }))));
19430
+ })))));
19168
19431
  };
19169
19432
 
19170
19433
  initializeI18n();
@@ -19241,7 +19504,11 @@ globalThis.IDmissionSDK = {
19241
19504
  preloadModels: preloadModels,
19242
19505
  themes: themes,
19243
19506
  version: webSdkVersion,
19244
- ready: true
19507
+ ready: true,
19508
+ authMode: 'session',
19509
+ allowedAuthUrls: allowedAuthUrls,
19510
+ defaultAuthUrl: defaultAuthUrl,
19511
+ defaultSubmissionUrl: defaultSubmissionUrl
19245
19512
  };
19246
19513
 
19247
19514
  exports.CapturedDocumentImg = CapturedDocumentImg;
@@ -19255,6 +19522,9 @@ exports.IdAndFaceValidation = IdAndFaceValidation;
19255
19522
  exports.IdValidation = IdValidation;
19256
19523
  exports.SignatureKYC = SignatureKYC;
19257
19524
  exports.VideoIdValidation = VideoIdValidation;
19525
+ exports.allowedAuthUrls = allowedAuthUrls;
19526
+ exports.defaultAuthUrl = defaultAuthUrl;
19527
+ exports.defaultSubmissionUrl = defaultSubmissionUrl;
19258
19528
  exports.preloadModels = preloadModels;
19259
19529
  exports.renderCustomerBiometricsEnrollment = renderCustomerBiometricsEnrollment;
19260
19530
  exports.renderCustomerIdAndBiometricsEnrollment = renderCustomerIdAndBiometricsEnrollment;