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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('prop-types'), require('react'), require('react-dom/client'), require('platform'), require('styled-components'), require('@tensorflow/tfjs'), require('react-dom')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'prop-types', 'react', 'react-dom/client', 'platform', 'styled-components', '@tensorflow/tfjs', 'react-dom'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.PropTypes, global.React, global.ReactDOM, global.platform, global.styled, global.tf, global.ReactDOM));
5
- }(this, (function (exports, propTypes, React, ReactDOM, platform, styled, tf, reactDom) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('prop-types'), require('react'), require('react-dom/client'), require('platform'), require('styled-components'), require('tus-js-client'), require('@tensorflow/tfjs'), require('react-dom')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'prop-types', 'react', 'react-dom/client', 'platform', 'styled-components', 'tus-js-client', '@tensorflow/tfjs', 'react-dom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.PropTypes, global.React, global.ReactDOM, global.platform, global.styled, global.tusJsClient, global.tf, global.ReactDOM));
5
+ }(this, (function (exports, propTypes, React, ReactDOM, platform, styled, tusJsClient, tf, reactDom) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -141,7 +141,7 @@
141
141
  return cooked;
142
142
  }
143
143
 
144
- var webSdkVersion = '1.0.310';
144
+ var webSdkVersion = '1.0.312';
145
145
 
146
146
  function getPlatform() {
147
147
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -167,6 +167,15 @@
167
167
  var _a, _b;
168
168
  return (_b = (_a = url.match(/^(data:.*;base64),/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
169
169
  }
170
+ function blobToB64(blob) {
171
+ return new Promise(function (resolve) {
172
+ var reader = new FileReader();
173
+ reader.onloadend = function () {
174
+ return resolve(reader.result);
175
+ };
176
+ reader.readAsDataURL(blob);
177
+ });
178
+ }
170
179
 
171
180
  var SubmissionAction;
172
181
  (function (SubmissionAction) {
@@ -208,32 +217,33 @@
208
217
  if (!host) throw new Error("unrecognized SubmissionEnvironment ".concat(environment));
209
218
  return host;
210
219
  }
211
- function determineSubmissionEndpoint(action, hasId, hasSelfie, hasToken) {
212
- var v = hasToken ? 'v4' : 'v3';
220
+ function determineSubmissionEndpoint(action, hasId, hasSelfie) {
213
221
  switch (action) {
214
222
  case SubmissionAction.ENROLL:
215
- return hasId ? "/".concat(v, "/customer/enroll") : "/".concat(v, "/customer/enroll-biometrics");
223
+ return hasId ? "/v4/customer/enroll" : "/v4/customer/enroll-biometrics";
216
224
  case SubmissionAction.IDENTIFY:
217
- return "/".concat(v, "/customer/identify");
225
+ return "/v4/customer/identify";
218
226
  case SubmissionAction.VALIDATE:
219
- return hasSelfie ? "/".concat(v, "/customer/validate-id-match-face") : "/".concat(v, "/customer/validate-id");
227
+ return hasSelfie ? "/v4/customer/validate-id-match-face" : "/v4/customer/validate-id";
220
228
  case SubmissionAction.VERIFY:
221
- return "/".concat(v, "/customer/verify");
229
+ return "/v4/customer/verify";
222
230
  default:
223
231
  throw new Error("unrecognized SubmissionAction ".concat(action));
224
232
  }
225
233
  }
226
- function liveCheckEndpoint(hasToken) {
227
- var v = hasToken ? 'v4' : 'v3';
228
- return "/".concat(v, "/customer/live-check");
234
+ function liveCheckEndpoint(hasDocumentToMatchFace) {
235
+ if (hasDocumentToMatchFace === void 0) {
236
+ hasDocumentToMatchFace = false;
237
+ }
238
+ return hasDocumentToMatchFace ? "/v4/customer/match-id-face" : "/v4/customer/live-check";
229
239
  }
230
- function apiHeaders(token) {
240
+ function apiHeaders(sessionId) {
231
241
  var headers = {
232
242
  'Content-Type': 'application/json',
233
243
  Origin: '*'
234
244
  };
235
- if (token) {
236
- headers['Authorization'] = "Bearer ".concat(token);
245
+ if (sessionId) {
246
+ headers['X-Session-Id'] = sessionId;
237
247
  }
238
248
  return headers;
239
249
  }
@@ -723,15 +733,15 @@
723
733
  }
724
734
  return NetworkError;
725
735
  }(Error);
726
- var TokenPublicKeyError = /** @class */function (_super) {
727
- __extends(TokenPublicKeyError, _super);
728
- function TokenPublicKeyError(err, host) {
736
+ var SessionValidationFailedError = /** @class */function (_super) {
737
+ __extends(SessionValidationFailedError, _super);
738
+ function SessionValidationFailedError(err, host) {
729
739
  var _this = _super.call(this, err.message) || this;
730
740
  _this.err = err;
731
741
  _this.host = host;
732
742
  return _this;
733
743
  }
734
- return TokenPublicKeyError;
744
+ return SessionValidationFailedError;
735
745
  }(Error);
736
746
 
737
747
  var SubmissionErrorOverlay = function SubmissionErrorOverlay(_a) {
@@ -795,7 +805,7 @@
795
805
  }, retryText))));
796
806
  };
797
807
 
798
- var TokenMissingErrorOverlay = function TokenMissingErrorOverlay() {
808
+ var SessionIdMissingOverlay = function SessionIdMissingOverlay() {
799
809
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
800
810
  style: {
801
811
  justifyContent: 'center'
@@ -808,7 +818,7 @@
808
818
  style: {
809
819
  marginBottom: 0
810
820
  }
811
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " is missing."), /*#__PURE__*/React__default['default'].createElement("p", {
821
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is missing."), /*#__PURE__*/React__default['default'].createElement("p", {
812
822
  style: {
813
823
  lineHeight: '1.5rem'
814
824
  }
@@ -816,14 +826,10 @@
816
826
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
817
827
  target: "_blank",
818
828
  rel: "noreferrer"
819
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
820
- href: "https://jwt.io",
821
- target: "_blank",
822
- rel: "noreferrer"
823
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
829
+ }, "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.")));
824
830
  };
825
831
 
826
- var TokenInvalidFormatErrorOverlay = function TokenInvalidFormatErrorOverlay() {
832
+ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
827
833
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
828
834
  style: {
829
835
  justifyContent: 'center'
@@ -836,16 +842,7 @@
836
842
  style: {
837
843
  marginBottom: 0
838
844
  }
839
- }, "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", {
840
- style: {
841
- display: 'flex'
842
- }
843
- }, /*#__PURE__*/React__default['default'].createElement("ul", {
844
- style: {
845
- display: 'inline',
846
- margin: '0 auto'
847
- }
848
- }, /*#__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", {
845
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is not valid."), /*#__PURE__*/React__default['default'].createElement("p", {
849
846
  style: {
850
847
  lineHeight: '1.5rem'
851
848
  }
@@ -853,14 +850,10 @@
853
850
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
854
851
  target: "_blank",
855
852
  rel: "noreferrer"
856
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
857
- href: "https://jwt.io",
858
- target: "_blank",
859
- rel: "noreferrer"
860
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
853
+ }, "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.")));
861
854
  };
862
855
 
863
- var TokenInvalidSignatureErrorOverlay = function TokenInvalidSignatureErrorOverlay() {
856
+ var AuthUrlNotAllowedOverlay = function AuthUrlNotAllowedOverlay() {
864
857
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
865
858
  style: {
866
859
  justifyContent: 'center'
@@ -873,40 +866,12 @@
873
866
  style: {
874
867
  marginBottom: 0
875
868
  }
876
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " could not be validated."), /*#__PURE__*/React__default['default'].createElement("p", {
869
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "authUrl"), " comes from an unrecognized issuer."), /*#__PURE__*/React__default['default'].createElement("p", {
877
870
  style: {
878
871
  marginBottom: 0,
879
872
  lineHeight: '1.5rem'
880
873
  }
881
- }, "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", {
882
- style: {
883
- marginBottom: 0,
884
- lineHeight: '1.5rem'
885
- }
886
- }, "If you believe you have reached this page in error, please contact us at ", /*#__PURE__*/React__default['default'].createElement("a", {
887
- href: "mailto:support@idmission.com"
888
- }, "support@idmission.com"), ".")));
889
- };
890
-
891
- var TokenExpiredErrorOverlay = function TokenExpiredErrorOverlay() {
892
- return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
893
- style: {
894
- justifyContent: 'center'
895
- }
896
- }, /*#__PURE__*/React__default['default'].createElement("h3", {
897
- style: {
898
- marginBottom: 8
899
- }
900
- }, "IDmission WebSDK failed to load"), /*#__PURE__*/React__default['default'].createElement("p", {
901
- style: {
902
- marginBottom: 0
903
- }
904
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " is expired."), /*#__PURE__*/React__default['default'].createElement("p", {
905
- style: {
906
- marginBottom: 0,
907
- lineHeight: '1.5rem'
908
- }
909
- }, "Ensure you are generating a fresh token for each request to the IDmission WebSDK."), /*#__PURE__*/React__default['default'].createElement("p", {
874
+ }, "Ensure you are generating a fresh session for each request to the IDmission WebSDK."), /*#__PURE__*/React__default['default'].createElement("p", {
910
875
  style: {
911
876
  lineHeight: '1.5rem'
912
877
  }
@@ -914,15 +879,14 @@
914
879
  href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
915
880
  target: "_blank",
916
881
  rel: "noreferrer"
917
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
918
- href: "https://jwt.io",
919
- target: "_blank",
920
- rel: "noreferrer"
921
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
882
+ }, "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.")));
922
883
  };
923
884
 
924
- var TokenPublicKeyErrorOverlay = function TokenPublicKeyErrorOverlay(_a) {
925
- var error = _a.error;
885
+ var SessionValidationErrorOverlay = function SessionValidationErrorOverlay(_a) {
886
+ var error = _a.error,
887
+ onRetry = _a.onRetry;
888
+ var t = useTranslation().t;
889
+ var retryText = t('Retry');
926
890
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
927
891
  style: {
928
892
  justifyContent: 'center'
@@ -935,7 +899,7 @@
935
899
  style: {
936
900
  marginBottom: 0
937
901
  }
938
- }, (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", {
902
+ }, (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", {
939
903
  style: {
940
904
  marginBottom: 0,
941
905
  lineHeight: '1.5rem'
@@ -947,43 +911,213 @@
947
911
  }
948
912
  }, "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", {
949
913
  href: "mailto:support@idmission.com"
950
- }, "support@idmission.com"), ".")));
951
- };
952
-
953
- var TokenIssuerNotAllowedErrorOverlay = function TokenIssuerNotAllowedErrorOverlay() {
954
- return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
914
+ }, "support@idmission.com"), "."), onRetry && ( /*#__PURE__*/React__default['default'].createElement("div", {
955
915
  style: {
956
- justifyContent: 'center'
957
- }
958
- }, /*#__PURE__*/React__default['default'].createElement("h3", {
959
- style: {
960
- marginBottom: 8
961
- }
962
- }, "IDmission WebSDK failed to load"), /*#__PURE__*/React__default['default'].createElement("p", {
963
- style: {
964
- marginBottom: 0
965
- }
966
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "submissionToken"), " comes from an unrecognized issuer."), /*#__PURE__*/React__default['default'].createElement("p", {
967
- style: {
968
- marginBottom: 0,
969
- lineHeight: '1.5rem'
970
- }
971
- }, "Ensure you are generating a fresh token for each request to the IDmission WebSDK."), /*#__PURE__*/React__default['default'].createElement("p", {
972
- style: {
973
- lineHeight: '1.5rem'
916
+ marginTop: 32
974
917
  }
975
- }, "Please refer to the", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
976
- href: "https://www.npmjs.com/package/idmission-web-sdk#getting-started",
977
- target: "_blank",
978
- rel: "noreferrer"
979
- }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid", ' ', /*#__PURE__*/React__default['default'].createElement("a", {
980
- href: "https://jwt.io",
981
- target: "_blank",
982
- rel: "noreferrer"
983
- }, "JSON Web Token"), ' ', "for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")));
918
+ }, /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
919
+ variant: "warning",
920
+ finished: true,
921
+ onClick: onRetry
922
+ }, retryText)))));
984
923
  };
985
924
 
986
- var allowedTokenIssuers = ['https://demoauth.idmission.com/', 'https://uatauth.idmission.com/', 'https://auth.idmission.com/'];
925
+ var Spinner$1 = styled__default['default'].div(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])), function (_a) {
926
+ var $size = _a.$size;
927
+ return $size !== null && $size !== void 0 ? $size : 80;
928
+ }, function (_a) {
929
+ var $size = _a.$size;
930
+ return $size !== null && $size !== void 0 ? $size : 80;
931
+ }, function (_a) {
932
+ var $size = _a.$size;
933
+ return ($size !== null && $size !== void 0 ? $size : 80) - 16;
934
+ }, function (_a) {
935
+ var $size = _a.$size;
936
+ return ($size !== null && $size !== void 0 ? $size : 80) - 16;
937
+ }, function (_a) {
938
+ var $thickness = _a.$thickness;
939
+ return $thickness !== null && $thickness !== void 0 ? $thickness : 6;
940
+ }, function (_a) {
941
+ var $color = _a.$color;
942
+ return $color !== null && $color !== void 0 ? $color : '#888';
943
+ }, function (_a) {
944
+ var $color = _a.$color;
945
+ return $color !== null && $color !== void 0 ? $color : '#888';
946
+ }, function (_a) {
947
+ var $color = _a.$color;
948
+ return $color !== null && $color !== void 0 ? $color : '#888';
949
+ });
950
+ var templateObject_1$C;
951
+
952
+ var defaultAuthUrl = 'https://portal-api.idmission.com';
953
+ 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'];
954
+ var initialState$5 = {
955
+ authUrl: defaultAuthUrl,
956
+ sessionCheckState: 'READY'
957
+ };
958
+ var AuthStateContext = /*#__PURE__*/React.createContext(initialState$5);
959
+ var AuthDispatchContext = /*#__PURE__*/React.createContext(function () {});
960
+ var reducer$5 = function reducer(state, action) {
961
+ switch (action.type) {
962
+ case 'setSessionId':
963
+ return __assign$1(__assign$1({}, state), {
964
+ sessionId: action.payload
965
+ });
966
+ case 'setCheckState':
967
+ return __assign$1(__assign$1({}, state), {
968
+ sessionCheckState: action.payload
969
+ });
970
+ case 'setError':
971
+ return __assign$1(__assign$1({}, state), {
972
+ sessionCheckState: 'ERROR',
973
+ authError: action.payload
974
+ });
975
+ case 'retry':
976
+ return __assign$1(__assign$1({}, state), {
977
+ sessionCheckState: 'READY',
978
+ authError: undefined,
979
+ sessionId: undefined
980
+ });
981
+ default:
982
+ return state;
983
+ }
984
+ };
985
+ function useAuthReducer(authUrl, sessionId) {
986
+ var _this = this;
987
+ if (authUrl === void 0) {
988
+ authUrl = defaultAuthUrl;
989
+ }
990
+ var _a = React.useReducer(reducer$5, __assign$1(__assign$1({}, initialState$5), {
991
+ authUrl: authUrl
992
+ })),
993
+ state = _a[0],
994
+ dispatch = _a[1];
995
+ var resolvedSessionId = state.sessionId,
996
+ sessionCheckState = state.sessionCheckState;
997
+ React.useEffect(function () {
998
+ if (!allowedAuthUrls.includes(authUrl)) return dispatch({
999
+ type: 'setCheckState',
1000
+ payload: 'AUTH_URL_NOT_ALLOWED'
1001
+ });
1002
+ }, [authUrl]);
1003
+ React.useEffect(function () {
1004
+ if (sessionCheckState !== 'READY') return;
1005
+ if (!resolvedSessionId) {
1006
+ if (!sessionId) return dispatch({
1007
+ type: 'setCheckState',
1008
+ payload: 'MISSING'
1009
+ });
1010
+ if (typeof sessionId === 'string') return dispatch({
1011
+ type: 'setSessionId',
1012
+ payload: sessionId
1013
+ });
1014
+ if (sessionId instanceof Function) {
1015
+ sessionId().then(function (sessionId) {
1016
+ dispatch({
1017
+ type: 'setSessionId',
1018
+ payload: sessionId
1019
+ });
1020
+ })["catch"](function (e) {
1021
+ console.error('failed to resolve session id', e);
1022
+ dispatch({
1023
+ type: 'setError',
1024
+ payload: new SessionValidationFailedError(e, authUrl)
1025
+ });
1026
+ });
1027
+ }
1028
+ } else {
1029
+ dispatch({
1030
+ type: 'setCheckState',
1031
+ payload: 'RUNNING'
1032
+ });
1033
+ (function () {
1034
+ return __awaiter(_this, void 0, void 0, function () {
1035
+ var resp, valid, e_1;
1036
+ return __generator(this, function (_a) {
1037
+ switch (_a.label) {
1038
+ case 0:
1039
+ _a.trys.push([0, 3,, 4]);
1040
+ return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
1041
+ method: 'POST',
1042
+ headers: {
1043
+ 'Content-Type': 'application/json'
1044
+ },
1045
+ body: JSON.stringify({
1046
+ id: resolvedSessionId
1047
+ })
1048
+ })];
1049
+ case 1:
1050
+ resp = _a.sent();
1051
+ return [4 /*yield*/, resp.json()];
1052
+ case 2:
1053
+ valid = _a.sent().valid;
1054
+ dispatch({
1055
+ type: 'setCheckState',
1056
+ payload: valid ? 'PASSED' : 'FAILED'
1057
+ });
1058
+ return [3 /*break*/, 4];
1059
+ case 3:
1060
+ e_1 = _a.sent();
1061
+ dispatch({
1062
+ type: 'setError',
1063
+ payload: new SessionValidationFailedError(e_1, authUrl)
1064
+ });
1065
+ return [3 /*break*/, 4];
1066
+ case 4:
1067
+ return [2 /*return*/];
1068
+ }
1069
+ });
1070
+ });
1071
+ })();
1072
+ }
1073
+ }, [authUrl, sessionCheckState, resolvedSessionId, sessionId]);
1074
+ return [state, dispatch];
1075
+ }
1076
+ function useAuthContext() {
1077
+ var state = React.useContext(AuthStateContext);
1078
+ var dispatch = React.useContext(AuthDispatchContext);
1079
+ if (!state || !dispatch) throw new Error('useAuthContext cannot be used without AuthStateProvider');
1080
+ return [state, dispatch];
1081
+ }
1082
+ function AuthProvider(_a) {
1083
+ var _b = _a.authUrl,
1084
+ authUrl = _b === void 0 ? defaultAuthUrl : _b,
1085
+ sessionId = _a.sessionId,
1086
+ children = _a.children;
1087
+ var _c = useAuthReducer(authUrl, sessionId),
1088
+ state = _c[0],
1089
+ dispatch = _c[1];
1090
+ if (state.sessionCheckState === 'MISSING') {
1091
+ return /*#__PURE__*/React__default['default'].createElement(SessionIdMissingOverlay, null);
1092
+ }
1093
+ if (state.sessionCheckState === 'FAILED') {
1094
+ return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, null);
1095
+ }
1096
+ if (state.sessionCheckState === 'AUTH_URL_NOT_ALLOWED') {
1097
+ return /*#__PURE__*/React__default['default'].createElement(AuthUrlNotAllowedOverlay, null);
1098
+ }
1099
+ if (state.sessionCheckState === 'ERROR') {
1100
+ return /*#__PURE__*/React__default['default'].createElement(SessionValidationErrorOverlay, {
1101
+ error: state.authError,
1102
+ onRetry: function onRetry() {
1103
+ return dispatch({
1104
+ type: 'retry'
1105
+ });
1106
+ }
1107
+ });
1108
+ }
1109
+ if (state.sessionCheckState === 'READY' || state.sessionCheckState === 'RUNNING') return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
1110
+ className: "flex"
1111
+ }, /*#__PURE__*/React__default['default'].createElement(Spinner$1, null));
1112
+ return /*#__PURE__*/React__default['default'].createElement(AuthStateContext.Provider, {
1113
+ value: state
1114
+ }, /*#__PURE__*/React__default['default'].createElement(AuthDispatchContext.Provider, {
1115
+ value: dispatch
1116
+ }, children));
1117
+ }
1118
+
1119
+ var defaultSubmissionUrl = 'https://portal-api.idmission.com/swagger';
1120
+ var defaultDocumentServiceUrl = 'https://portal-api.idmission.com/files/';
987
1121
  var SubmissionContext = /*#__PURE__*/React.createContext({
988
1122
  submit: function submit() {
989
1123
  return __awaiter(void 0, void 0, void 0, function () {
@@ -1062,122 +1196,127 @@
1062
1196
  var SubmissionProvider = function SubmissionProvider(_a) {
1063
1197
  var action = _a.action,
1064
1198
  children = _a.children,
1065
- url = _a.url,
1066
- _b = _a.environment,
1067
- environment = _b === void 0 ? 'prod' : _b,
1068
- token = _a.token,
1199
+ _b = _a.submissionUrl,
1200
+ submissionUrl = _b === void 0 ? defaultSubmissionUrl : _b,
1201
+ _c = _a.environment,
1202
+ environment = _c === void 0 ? 'prod' : _c,
1069
1203
  companyId = _a.companyId,
1070
1204
  enrollmentId = _a.enrollmentId,
1071
1205
  personalData = _a.personalData,
1072
1206
  cardData = _a.cardData,
1073
- _c = _a.bypassAgeValidation,
1074
- bypassAgeValidation = _c === void 0 ? false : _c,
1075
- _d = _a.bypassNameMatching,
1076
- bypassNameMatching = _d === void 0 ? true : _d,
1077
- _e = _a.needImmediateResponse,
1078
- needImmediateResponse = _e === void 0 ? false : _e,
1079
- _f = _a.manualReviewRequired,
1080
- manualReviewRequired = _f === void 0 ? false : _f,
1081
- _g = _a.idBackImageRequired,
1082
- idBackImageRequired = _g === void 0 ? true : _g,
1083
- _h = _a.idImageResolutionCheck,
1084
- idImageResolutionCheck = _h === void 0 ? true : _h,
1085
- _j = _a.verifyIdWithExternalDatabases,
1086
- verifyIdWithExternalDatabases = _j === void 0 ? false : _j,
1087
- _k = _a.deduplicationEnabled,
1088
- deduplicationEnabled = _k === void 0 ? false : _k,
1089
- _l = _a.deduplicationSynchronous,
1090
- deduplicationSynchronous = _l === void 0 ? false : _l,
1091
- _m = _a.geolocationEnabled,
1092
- geolocationEnabled = _m === void 0 ? true : _m,
1093
- _o = _a.geolocationRequired,
1094
- geolocationRequired = _o === void 0 ? false : _o,
1095
- _p = _a.webhooksEnabled,
1096
- webhooksEnabled = _p === void 0 ? false : _p,
1207
+ _d = _a.bypassAgeValidation,
1208
+ bypassAgeValidation = _d === void 0 ? false : _d,
1209
+ _e = _a.bypassNameMatching,
1210
+ bypassNameMatching = _e === void 0 ? true : _e,
1211
+ _f = _a.needImmediateResponse,
1212
+ needImmediateResponse = _f === void 0 ? false : _f,
1213
+ _g = _a.manualReviewRequired,
1214
+ manualReviewRequired = _g === void 0 ? false : _g,
1215
+ _h = _a.idBackImageRequired,
1216
+ idBackImageRequired = _h === void 0 ? true : _h,
1217
+ _j = _a.idImageResolutionCheck,
1218
+ idImageResolutionCheck = _j === void 0 ? true : _j,
1219
+ _k = _a.verifyIdWithExternalDatabases,
1220
+ verifyIdWithExternalDatabases = _k === void 0 ? false : _k,
1221
+ _l = _a.deduplicationEnabled,
1222
+ deduplicationEnabled = _l === void 0 ? false : _l,
1223
+ _m = _a.deduplicationSynchronous,
1224
+ deduplicationSynchronous = _m === void 0 ? false : _m,
1225
+ idCardForFaceMatch = _a.idCardForFaceMatch,
1226
+ _o = _a.geolocationEnabled,
1227
+ geolocationEnabled = _o === void 0 ? true : _o,
1228
+ _p = _a.geolocationRequired,
1229
+ geolocationRequired = _p === void 0 ? false : _p,
1230
+ _q = _a.webhooksEnabled,
1231
+ webhooksEnabled = _q === void 0 ? false : _q,
1097
1232
  webhooksClientTraceId = _a.webhooksClientTraceId,
1098
- _q = _a.webhooksStripSpecialCharacters,
1099
- webhooksStripSpecialCharacters = _q === void 0 ? true : _q,
1100
- _r = _a.webhooksSendInputImages,
1101
- webhooksSendInputImages = _r === void 0 ? false : _r,
1102
- _s = _a.webhooksSendProcessedImages,
1103
- webhooksSendProcessedImages = _s === void 0 ? false : _s,
1104
- _t = _a.webhooksFireOnReview,
1105
- webhooksFireOnReview = _t === void 0 ? false : _t,
1233
+ _r = _a.webhooksStripSpecialCharacters,
1234
+ webhooksStripSpecialCharacters = _r === void 0 ? true : _r,
1235
+ _s = _a.webhooksSendInputImages,
1236
+ webhooksSendInputImages = _s === void 0 ? false : _s,
1237
+ _t = _a.webhooksSendProcessedImages,
1238
+ webhooksSendProcessedImages = _t === void 0 ? false : _t,
1239
+ _u = _a.webhooksFireOnReview,
1240
+ webhooksFireOnReview = _u === void 0 ? false : _u,
1106
1241
  precapturedDocuments = _a.precapturedDocuments,
1107
- _u = _a.documentServiceUrl,
1108
- documentServiceUrl = _u === void 0 ? 'https://portal-api-dev.idmission.com/files/' : _u,
1109
- // 'http://localhost:10000/files/',
1242
+ _v = _a.documentServiceUrl,
1243
+ documentServiceUrl = _v === void 0 ? defaultDocumentServiceUrl : _v,
1110
1244
  onSubmit = _a.onSubmit,
1111
1245
  onBeforeSubmit = _a.onBeforeSubmit,
1112
1246
  onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
1247
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
1248
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
1249
+ onDocumentUploaded = _a.onDocumentUploaded,
1250
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
1113
1251
  onResponseReceived = _a.onResponseReceived,
1114
1252
  onRequestFailure = _a.onRequestFailure;
1115
- var _v = React.useState(SubmissionStatus.READY),
1116
- submissionStatus = _v[0],
1117
- setSubmissionStatus = _v[1];
1118
- var _w = React.useState(null),
1119
- submissionRequest = _w[0],
1120
- setSubmissionRequest = _w[1];
1253
+ var sessionId = useAuthContext()[0].sessionId;
1254
+ var _w = React.useState(SubmissionStatus.READY),
1255
+ submissionStatus = _w[0],
1256
+ setSubmissionStatus = _w[1];
1121
1257
  var _x = React.useState(null),
1122
- submissionResponse = _x[0],
1123
- setSubmissionResponse = _x[1];
1258
+ submissionRequest = _x[0],
1259
+ setSubmissionRequest = _x[1];
1124
1260
  var _y = React.useState(null),
1125
- submissionError = _y[0],
1126
- setSubmissionError = _y[1];
1261
+ submissionResponse = _y[0],
1262
+ setSubmissionResponse = _y[1];
1127
1263
  var _z = React.useState(null),
1128
- retrySubmission = _z[0],
1129
- setRetrySubmission = _z[1];
1264
+ submissionError = _z[0],
1265
+ setSubmissionError = _z[1];
1130
1266
  var _0 = React.useState(null),
1131
- livenessCheckRequest = _0[0],
1132
- setLivenessCheckRequest = _0[1];
1267
+ retrySubmission = _0[0],
1268
+ setRetrySubmission = _0[1];
1133
1269
  var _1 = React.useState(null),
1134
- idFrontImage = _1[0],
1135
- setIdFrontImage = _1[1];
1270
+ livenessCheckRequest = _1[0],
1271
+ setLivenessCheckRequest = _1[1];
1136
1272
  var _2 = React.useState(null),
1137
- idBackImage = _2[0],
1138
- setIdBackImage = _2[1];
1273
+ idFrontImage = _2[0],
1274
+ setIdFrontImage = _2[1];
1139
1275
  var _3 = React.useState(null),
1140
- passportImage = _3[0],
1141
- setPassportImage = _3[1];
1276
+ idBackImage = _3[0],
1277
+ setIdBackImage = _3[1];
1142
1278
  var _4 = React.useState(null),
1143
- selfieImage = _4[0],
1144
- setSelfieImage = _4[1];
1279
+ passportImage = _4[0],
1280
+ setPassportImage = _4[1];
1145
1281
  var _5 = React.useState(null),
1146
- signatureData = _5[0],
1147
- setSignatureData = _5[1];
1282
+ selfieImage = _5[0],
1283
+ setSelfieImage = _5[1];
1148
1284
  var _6 = React.useState(null),
1149
- signatureVideoUrl = _6[0],
1150
- setSignatureVideoUrl = _6[1];
1285
+ signatureData = _6[0],
1286
+ setSignatureData = _6[1];
1151
1287
  var _7 = React.useState(null),
1152
- idCaptureVideoUrl = _7[0],
1153
- setIdCaptureVideoUrl = _7[1];
1288
+ signatureVideoUrl = _7[0],
1289
+ setSignatureVideoUrl = _7[1];
1154
1290
  var _8 = React.useState(null),
1155
- idCaptureVideoIdFrontImage = _8[0],
1156
- setIdCaptureVideoIdFrontImage = _8[1];
1291
+ idCaptureVideoUrl = _8[0],
1292
+ setIdCaptureVideoUrl = _8[1];
1157
1293
  var _9 = React.useState(null),
1158
- idCaptureVideoIdBackImage = _9[0],
1159
- setIdCaptureVideoIdBackImage = _9[1];
1294
+ idCaptureVideoIdFrontImage = _9[0],
1295
+ setIdCaptureVideoIdFrontImage = _9[1];
1160
1296
  var _10 = React.useState(null),
1161
- additionalDocuments = _10[0],
1162
- setAdditionalDocuments = _10[1];
1297
+ idCaptureVideoIdBackImage = _10[0],
1298
+ setIdCaptureVideoIdBackImage = _10[1];
1163
1299
  var _11 = React.useState(null),
1164
- geolocationResult = _11[0],
1165
- setGeolocationResult = _11[1];
1166
- var _12 = React.useState(0),
1167
- geolocationAttempts = _12[0],
1168
- setGeolocationAttempts = _12[1];
1169
- var _13 = React.useState(false),
1170
- geolocationBlocked = _13[0],
1171
- setGeolocationBlocked = _13[1];
1172
- var _14 = React.useState([]),
1173
- idFrontCaptureAttempts = _14[0],
1174
- setIdFrontCaptureAttempts = _14[1];
1300
+ additionalDocuments = _11[0],
1301
+ setAdditionalDocuments = _11[1];
1302
+ var _12 = React.useState(null),
1303
+ geolocationResult = _12[0],
1304
+ setGeolocationResult = _12[1];
1305
+ var _13 = React.useState(0),
1306
+ geolocationAttempts = _13[0],
1307
+ setGeolocationAttempts = _13[1];
1308
+ var _14 = React.useState(false),
1309
+ geolocationBlocked = _14[0],
1310
+ setGeolocationBlocked = _14[1];
1175
1311
  var _15 = React.useState([]),
1176
- idBackCaptureAttempts = _15[0],
1177
- setIdBackCaptureAttempts = _15[1];
1312
+ idFrontCaptureAttempts = _15[0],
1313
+ setIdFrontCaptureAttempts = _15[1];
1178
1314
  var _16 = React.useState([]),
1179
- selfieCaptureAttempts = _16[0],
1180
- setSelfieCaptureAttempts = _16[1];
1315
+ idBackCaptureAttempts = _16[0],
1316
+ setIdBackCaptureAttempts = _16[1];
1317
+ var _17 = React.useState([]),
1318
+ selfieCaptureAttempts = _17[0],
1319
+ setSelfieCaptureAttempts = _17[1];
1181
1320
  var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
1182
1321
  setIdFrontCaptureAttempts(function (attempts) {
1183
1322
  return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
@@ -1198,13 +1337,143 @@
1198
1337
  setSelfieImage(dataUrlToBase64Sync(precapturedDocuments.selfie.imageData));
1199
1338
  }
1200
1339
  }, [precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie]);
1340
+ var uploadDocument = React.useCallback(function (src, metadata) {
1341
+ return new Promise(function (resolve, reject) {
1342
+ return __awaiter(void 0, void 0, void 0, function () {
1343
+ var blob, _a, upload;
1344
+ return __generator(this, function (_b) {
1345
+ switch (_b.label) {
1346
+ case 0:
1347
+ blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
1348
+ _a = onBeforeDocumentUpload;
1349
+ if (!_a) return [3 /*break*/, 2];
1350
+ return [4 /*yield*/, onBeforeDocumentUpload === null || onBeforeDocumentUpload === void 0 ? void 0 : onBeforeDocumentUpload(blob, metadata)];
1351
+ case 1:
1352
+ _a = _b.sent() === false;
1353
+ _b.label = 2;
1354
+ case 2:
1355
+ if (_a) return [2 /*return*/, resolve(blobToB64(blob))];
1356
+ upload = createUpload(blob, {
1357
+ endpoint: documentServiceUrl,
1358
+ retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
1359
+ headers: {
1360
+ 'X-Session-Id': sessionId
1361
+ },
1362
+ metadata: metadata || {
1363
+ filetype: blob.type
1364
+ },
1365
+ onProgress: function onProgress(bytesUploaded, bytesTotal) {
1366
+ onDocumentUploadProgress === null || onDocumentUploadProgress === void 0 ? void 0 : onDocumentUploadProgress({
1367
+ bytesUploaded: bytesUploaded,
1368
+ bytesTotal: bytesTotal,
1369
+ percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1370
+ metadata: metadata
1371
+ });
1372
+ },
1373
+ onSuccess: function onSuccess() {
1374
+ var _a;
1375
+ var documentId = 'urn:documentsv1:' + ((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift());
1376
+ onDocumentUploaded === null || onDocumentUploaded === void 0 ? void 0 : onDocumentUploaded(documentId, metadata);
1377
+ resolve(documentId);
1378
+ },
1379
+ onError: function onError(error) {
1380
+ console.log('Failed because: ' + error);
1381
+ onDocumentUploadFailed === null || onDocumentUploadFailed === void 0 ? void 0 : onDocumentUploadFailed(error, metadata);
1382
+ reject(error);
1383
+ }
1384
+ });
1385
+ // Check if there are any previous uploads to continue.
1386
+ upload.findPreviousUploads().then(function (previousUploads) {
1387
+ // Found previous uploads so we select the first one.
1388
+ if (previousUploads.length) {
1389
+ upload.resumeFromPreviousUpload(previousUploads[0]);
1390
+ }
1391
+ // Start the upload
1392
+ upload.start();
1393
+ });
1394
+ return [2 /*return*/];
1395
+ }
1396
+ });
1397
+ });
1398
+ });
1399
+ }, [onBeforeDocumentUpload, documentServiceUrl, sessionId, onDocumentUploadProgress, onDocumentUploaded, onDocumentUploadFailed]);
1201
1400
  var buildSubmissionPayload = React.useCallback(function () {
1202
1401
  return __awaiter(void 0, void 0, void 0, function () {
1203
- var submissionRequest, _a, _b, onBeforeSubmitResult;
1204
- var _c, _d;
1205
- return __generator(this, function (_e) {
1206
- switch (_e.label) {
1402
+ function uploadIfPossible(src, filename, filetype) {
1403
+ if (filetype === void 0) {
1404
+ filetype = 'image/jpeg';
1405
+ }
1406
+ return __awaiter(this, void 0, void 0, function () {
1407
+ return __generator(this, function (_a) {
1408
+ switch (_a.label) {
1409
+ case 0:
1410
+ if (!documentServiceUrl) return [2 /*return*/, src];
1411
+ if (!src.startsWith('data:')) src = "data:".concat(filetype, ";base64,").concat(src);
1412
+ return [4 /*yield*/, uploadDocument(src, {
1413
+ filename: filename,
1414
+ filetype: filetype
1415
+ })];
1416
+ case 1:
1417
+ return [2 /*return*/, _a.sent()];
1418
+ }
1419
+ });
1420
+ });
1421
+ }
1422
+ var documents, _a, _b, submissionRequest, onBeforeSubmitResult;
1423
+ var _c;
1424
+ var _d, _e;
1425
+ return __generator(this, function (_f) {
1426
+ switch (_f.label) {
1207
1427
  case 0:
1428
+ _c = {
1429
+ idFrontImage: idFrontImage,
1430
+ idBackImage: idBackImage,
1431
+ passportImage: passportImage,
1432
+ selfieImage: selfieImage
1433
+ };
1434
+ _a = signatureVideoUrl;
1435
+ if (!_a) return [3 /*break*/, 2];
1436
+ return [4 /*yield*/, videoDataUrlToB64(signatureVideoUrl)];
1437
+ case 1:
1438
+ _a = _f.sent();
1439
+ _f.label = 2;
1440
+ case 2:
1441
+ _c.signatureVideo = _a;
1442
+ _b = idCaptureVideoUrl;
1443
+ if (!_b) return [3 /*break*/, 4];
1444
+ return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoUrl)];
1445
+ case 3:
1446
+ _b = _f.sent();
1447
+ _f.label = 4;
1448
+ case 4:
1449
+ documents = (_c.idCaptureVideo = _b, _c.idCaptureVideoIdFrontImage = idCaptureVideoIdFrontImage, _c.idCaptureVideoIdBackImage = idCaptureVideoIdBackImage, _c);
1450
+ if (signatureData) {
1451
+ documents.signatureImage = signatureData === null || signatureData === void 0 ? void 0 : signatureData.fileContent;
1452
+ }
1453
+ if (!documentServiceUrl) return [3 /*break*/, 6];
1454
+ return [4 /*yield*/, Promise.all(Object.keys(documents).map(function (k) {
1455
+ return __awaiter(void 0, void 0, void 0, function () {
1456
+ var _a, _b;
1457
+ return __generator(this, function (_c) {
1458
+ switch (_c.label) {
1459
+ case 0:
1460
+ if (!documents[k]) return [3 /*break*/, 2];
1461
+ _a = documents;
1462
+ _b = k;
1463
+ return [4 /*yield*/, uploadIfPossible(documents[k], k)];
1464
+ case 1:
1465
+ _a[_b] = _c.sent();
1466
+ _c.label = 2;
1467
+ case 2:
1468
+ return [2 /*return*/];
1469
+ }
1470
+ });
1471
+ });
1472
+ }))];
1473
+ case 5:
1474
+ _f.sent();
1475
+ _f.label = 6;
1476
+ case 6:
1208
1477
  submissionRequest = {
1209
1478
  securityData: {
1210
1479
  userName: '',
@@ -1236,24 +1505,22 @@
1236
1505
  idImageResolutionCheck: idImageResolutionCheck ? 'Y' : 'N'
1237
1506
  }
1238
1507
  };
1239
- if (idFrontImage) {
1240
- submissionRequest.customerData.idData.idImageFront = idFrontImage;
1508
+ if (documents.idFrontImage) {
1509
+ submissionRequest.customerData.idData.idImageFront = documents.idFrontImage;
1241
1510
  }
1242
- if (idBackImage) {
1243
- submissionRequest.customerData.idData.idImageBack = idBackImage;
1511
+ if (documents.idBackImage) {
1512
+ submissionRequest.customerData.idData.idImageBack = documents.idBackImage;
1244
1513
  }
1245
- if (passportImage) {
1246
- submissionRequest.customerData.idData.idImageFront = passportImage;
1514
+ if (documents.passportImage) {
1515
+ submissionRequest.customerData.idData.idImageFront = documents.passportImage;
1247
1516
  }
1248
- if (selfieImage) {
1249
- if (action === SubmissionAction.IDENTIFY) {
1250
- // TODO: remove once API is fixed
1251
- submissionRequest.biometricData = {
1252
- selfie: selfieImage
1253
- };
1254
- }
1517
+ if (documents.selfieImage) {
1518
+ // if (action === SubmissionAction.IDENTIFY) {
1519
+ // // TODO: remove once API is fixed
1520
+ // submissionRequest.biometricData = { selfie: documents.selfieImage }
1521
+ // }
1255
1522
  submissionRequest.customerData.biometricData = {
1256
- selfie: selfieImage
1523
+ selfie: documents.selfieImage
1257
1524
  };
1258
1525
  }
1259
1526
  if (companyId) {
@@ -1268,23 +1535,20 @@
1268
1535
  submissionRequest.customerData.cardData = cardData;
1269
1536
  }
1270
1537
  if (enrollmentId) {
1271
- (_c = submissionRequest.customerData).personalData || (_c.personalData = {});
1538
+ (_d = submissionRequest.customerData).personalData || (_d.personalData = {});
1272
1539
  submissionRequest.customerData.personalData.uniqueNumber = enrollmentId;
1273
1540
  }
1274
1541
  if (webhooksClientTraceId) {
1275
1542
  submissionRequest.additionalData.clientTraceId = webhooksClientTraceId;
1276
1543
  }
1277
- if (!signatureData) return [3 /*break*/, 2];
1278
- submissionRequest.customerData.signatureData = {
1279
- signatureImage: JSON.stringify(signatureData)
1280
- };
1281
- if (!signatureVideoUrl) return [3 /*break*/, 2];
1282
- _a = submissionRequest.customerData.signatureData;
1283
- return [4 /*yield*/, videoDataUrlToB64(signatureVideoUrl)];
1284
- case 1:
1285
- _a.signatureVideo = _e.sent();
1286
- _e.label = 2;
1287
- case 2:
1544
+ if (signatureData) {
1545
+ submissionRequest.customerData.signatureData = {
1546
+ signatureImage: JSON.stringify(signatureData)
1547
+ };
1548
+ if (documents.signatureVideo) {
1549
+ submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
1550
+ }
1551
+ }
1288
1552
  if (additionalDocuments) {
1289
1553
  submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
1290
1554
  return __assign$1(__assign$1({}, d), {
@@ -1294,19 +1558,15 @@
1294
1558
  });
1295
1559
  });
1296
1560
  }
1297
- if (!idCaptureVideoUrl) return [3 /*break*/, 4];
1298
- (_d = submissionRequest.customerData).biometricData || (_d.biometricData = {});
1299
- _b = submissionRequest.customerData.biometricData;
1300
- return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoUrl)];
1301
- case 3:
1302
- _b.videoData = _e.sent();
1303
- _e.label = 4;
1304
- case 4:
1305
- if (idCaptureVideoIdFrontImage) {
1306
- submissionRequest.customerData.idData.videoIdImageFront = dataUrlToBase64Sync(idCaptureVideoIdFrontImage);
1561
+ if (documents.idCaptureVideo) {
1562
+ (_e = submissionRequest.customerData).biometricData || (_e.biometricData = {});
1563
+ submissionRequest.customerData.biometricData.videoData = documents.idCaptureVideo;
1564
+ }
1565
+ if (documents.idCaptureVideoIdFrontImage) {
1566
+ submissionRequest.customerData.idData.videoIdImageFront = documents.idCaptureVideoIdFrontImage;
1307
1567
  }
1308
- if (idCaptureVideoIdBackImage) {
1309
- submissionRequest.customerData.idData.videoIdImageBack = dataUrlToBase64Sync(idCaptureVideoIdBackImage);
1568
+ if (documents.idCaptureVideoIdBackImage) {
1569
+ submissionRequest.customerData.idData.videoIdImageBack = documents.idCaptureVideoIdBackImage;
1310
1570
  }
1311
1571
  attachMetadataToRequest(submissionRequest, {
1312
1572
  selfieCaptureAttempts: selfieCaptureAttempts,
@@ -1314,18 +1574,18 @@
1314
1574
  idBackCaptureAttempts: idBackCaptureAttempts,
1315
1575
  geolocationResult: geolocationResult
1316
1576
  });
1317
- if (!onBeforeSubmit) return [3 /*break*/, 6];
1577
+ if (!onBeforeSubmit) return [3 /*break*/, 8];
1318
1578
  return [4 /*yield*/, onBeforeSubmit(submissionRequest)];
1319
- case 5:
1320
- onBeforeSubmitResult = _e.sent();
1579
+ case 7:
1580
+ onBeforeSubmitResult = _f.sent();
1321
1581
  if (onBeforeSubmitResult) submissionRequest = onBeforeSubmitResult;
1322
- _e.label = 6;
1323
- case 6:
1582
+ _f.label = 8;
1583
+ case 8:
1324
1584
  return [2 /*return*/, submissionRequest];
1325
1585
  }
1326
1586
  });
1327
1587
  });
1328
- }, [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]);
1588
+ }, [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]);
1329
1589
  var defaultOnSubmit = React.useCallback(function () {
1330
1590
  return __awaiter(void 0, void 0, void 0, function () {
1331
1591
  var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
@@ -1351,11 +1611,11 @@
1351
1611
  return [4 /*yield*/, buildSubmissionPayload()];
1352
1612
  case 2:
1353
1613
  payload = _b.sent();
1354
- host = url || determineSubmissionHost(environment, token);
1355
- endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage, !!token);
1614
+ host = submissionUrl || determineSubmissionHost(environment);
1615
+ endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage);
1356
1616
  return [4 /*yield*/, fetch(host + endpoint, {
1357
1617
  method: 'POST',
1358
- headers: apiHeaders(token),
1618
+ headers: apiHeaders(sessionId),
1359
1619
  body: JSON.stringify(payload)
1360
1620
  })["catch"](function (e) {
1361
1621
  throw new NetworkError(e.message);
@@ -1403,7 +1663,7 @@
1403
1663
  }
1404
1664
  });
1405
1665
  });
1406
- }, [action, buildSubmissionPayload, environment, idBackImage, idFrontImage, onRequestFailure, onResponseReceived, passportImage, selfieImage, token, url]);
1666
+ }, [action, buildSubmissionPayload, submissionUrl, environment, idFrontImage, idBackImage, passportImage, selfieImage, sessionId, onResponseReceived, onRequestFailure]);
1407
1667
  var submit = React.useCallback(function () {
1408
1668
  return __awaiter(void 0, void 0, void 0, function () {
1409
1669
  var _a;
@@ -1448,6 +1708,15 @@
1448
1708
  estimateAge: 'N',
1449
1709
  predictGender: 'N'
1450
1710
  }, _a);
1711
+ if (idCardForFaceMatch) {
1712
+ request.customerData.idData = {
1713
+ idImageFront: idCardForFaceMatch
1714
+ };
1715
+ // TODO: remove when fixed
1716
+ request.customerData.additionalData = {
1717
+ uniqueRequestId: request.additionalData.uniqueRequestId
1718
+ };
1719
+ }
1451
1720
  attachMetadataToRequest(request, {
1452
1721
  selfieCaptureAttempts: selfieCaptureAttempts,
1453
1722
  idFrontCaptureAttempts: idFrontCaptureAttempts,
@@ -1462,11 +1731,11 @@
1462
1731
  if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
1463
1732
  _d.label = 3;
1464
1733
  case 3:
1465
- host = url || determineSubmissionHost(environment, token);
1466
- endpoint = liveCheckEndpoint(!!token);
1734
+ host = submissionUrl || determineSubmissionHost(environment);
1735
+ endpoint = liveCheckEndpoint(!!idCardForFaceMatch);
1467
1736
  return [4 /*yield*/, fetch(host + endpoint, {
1468
1737
  method: 'POST',
1469
- headers: apiHeaders(token),
1738
+ headers: apiHeaders(sessionId),
1470
1739
  body: JSON.stringify(request)
1471
1740
  })["catch"](function (e) {
1472
1741
  throw new NetworkError(e.message);
@@ -1512,7 +1781,7 @@
1512
1781
  }
1513
1782
  });
1514
1783
  });
1515
- }, [environment, geolocationResult, idBackCaptureAttempts, idFrontCaptureAttempts, onBeforeLivenessCheck, onRequestFailure, selfieCaptureAttempts, token, url, webhooksStripSpecialCharacters]);
1784
+ }, [webhooksStripSpecialCharacters, idCardForFaceMatch, selfieCaptureAttempts, idFrontCaptureAttempts, idBackCaptureAttempts, geolocationResult, onBeforeLivenessCheck, submissionUrl, environment, sessionId, onRequestFailure]);
1516
1785
  var retryLocationAccess = React.useCallback(function () {
1517
1786
  setGeolocationAttempts(function (n) {
1518
1787
  return n + 1;
@@ -1538,125 +1807,6 @@
1538
1807
  setSubmissionStatus(SubmissionStatus.READY);
1539
1808
  retrySubmission();
1540
1809
  }, [retrySubmission]);
1541
- var _17 = React.useState('NOT_PARSED'),
1542
- tokenState = _17[0],
1543
- setTokenState = _17[1];
1544
- var _18 = React.useState(null),
1545
- tokenError = _18[0],
1546
- setTokenError = _18[1];
1547
- React.useEffect(function () {
1548
- if (typeof window === 'undefined') return;
1549
- (function () {
1550
- return __awaiter(void 0, void 0, void 0, function () {
1551
- var parsed, iss, publicKey, resp, e_3, valid, parts, e_4, exp;
1552
- return __generator(this, function (_a) {
1553
- switch (_a.label) {
1554
- case 0:
1555
- setTokenState('PARSING');
1556
- if (!token) return [2 /*return*/, setTokenState('MISSING')];
1557
- try {
1558
- parsed = parseJwt(token);
1559
- } catch (e) {
1560
- console.error('error parsing token', e);
1561
- return [2 /*return*/, setTokenState('INVALID_FORMAT')];
1562
- }
1563
- iss = parsed.iss;
1564
- if (!allowedTokenIssuers.some(function (allowedIss) {
1565
- return iss.startsWith(allowedIss);
1566
- })) {
1567
- console.error('issuer is not allowed', iss);
1568
- return [2 /*return*/, setTokenState('ISSUER_NOT_ALLOWED')];
1569
- }
1570
- _a.label = 1;
1571
- case 1:
1572
- _a.trys.push([1, 4,, 5]);
1573
- return [4 /*yield*/, fetch(iss).then(function (r) {
1574
- return r.json();
1575
- })];
1576
- case 2:
1577
- resp = _a.sent();
1578
- return [4 /*yield*/, importRsaKey("-----BEGIN PUBLIC KEY-----\n".concat(resp.public_key, "\n-----END PUBLIC KEY-----"))];
1579
- case 3:
1580
- publicKey = _a.sent();
1581
- return [3 /*break*/, 5];
1582
- case 4:
1583
- e_3 = _a.sent();
1584
- console.error('error fetching public key', e_3);
1585
- setTokenError(new TokenPublicKeyError(e_3, iss));
1586
- return [2 /*return*/, setTokenState('PUBLIC_KEY_LOAD_FAILED')];
1587
- case 5:
1588
- valid = false;
1589
- _a.label = 6;
1590
- case 6:
1591
- _a.trys.push([6, 8,, 9]);
1592
- parts = token.split('.');
1593
- return [4 /*yield*/, window.crypto.subtle.verify({
1594
- name: 'RSASSA-PKCS1-v1_5'
1595
- }, publicKey,
1596
- //from generateKey or importKey above
1597
- str2ab(parts[1]),
1598
- //ArrayBuffer of the signature
1599
- str2ab(parts[2]))];
1600
- case 7:
1601
- _a.sent();
1602
- valid = true;
1603
- return [3 /*break*/, 9];
1604
- case 8:
1605
- e_4 = _a.sent();
1606
- console.error('error validating token', e_4);
1607
- return [3 /*break*/, 9];
1608
- case 9:
1609
- if (!valid) return [2 /*return*/, setTokenState('INVALID_SIGNATURE')];
1610
- exp = parsed.exp;
1611
- if (Date.now() >= exp * 1000) {
1612
- return [2 /*return*/, setTokenState('EXPIRED')];
1613
- }
1614
- setTokenState('GOOD');
1615
- return [2 /*return*/];
1616
- }
1617
- });
1618
- });
1619
- })();
1620
- }, [token]);
1621
- var uploadDocument = React.useCallback(function (blob) {
1622
- return new Promise(function (resolve, reject) {
1623
- import('tus-js-client').then(function (tus) {
1624
- var upload = new tus.Upload(blob, {
1625
- endpoint: documentServiceUrl,
1626
- retryDelays: [0, 3000, 5000, 10000, 20000],
1627
- metadata: {
1628
- filename: 'My File',
1629
- filetype: 'image/jpeg'
1630
- },
1631
- headers: {
1632
- Authorization: "Bearer ".concat(token)
1633
- },
1634
- onProgress: function onProgress(bytesUploaded, bytesTotal) {
1635
- var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2);
1636
- console.log(bytesUploaded, bytesTotal, percentage + '%');
1637
- },
1638
- onSuccess: function onSuccess() {
1639
- var _a;
1640
- console.log('Download from %s', upload.url);
1641
- resolve('urn:documentsv1:' + ((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1642
- },
1643
- onError: function onError(error) {
1644
- console.log('Failed because: ' + error);
1645
- reject(error);
1646
- }
1647
- });
1648
- // Check if there are any previous uploads to continue.
1649
- upload.findPreviousUploads().then(function (previousUploads) {
1650
- // Found previous uploads so we select the first one.
1651
- if (previousUploads.length) {
1652
- upload.resumeFromPreviousUpload(previousUploads[0]);
1653
- }
1654
- // Start the upload
1655
- upload.start();
1656
- });
1657
- });
1658
- });
1659
- }, [documentServiceUrl, token]);
1660
1810
  var value = {
1661
1811
  submit: submit,
1662
1812
  submissionStatus: submissionStatus,
@@ -1692,26 +1842,6 @@
1692
1842
  checkLiveness: checkLiveness,
1693
1843
  retryLocationAccess: retryLocationAccess
1694
1844
  };
1695
- if (tokenState === 'MISSING') {
1696
- return /*#__PURE__*/React__default['default'].createElement(TokenMissingErrorOverlay, null);
1697
- }
1698
- if (tokenState === 'INVALID_FORMAT') {
1699
- return /*#__PURE__*/React__default['default'].createElement(TokenInvalidFormatErrorOverlay, null);
1700
- }
1701
- if (tokenState === 'INVALID_SIGNATURE') {
1702
- return /*#__PURE__*/React__default['default'].createElement(TokenInvalidSignatureErrorOverlay, null);
1703
- }
1704
- if (tokenState === 'EXPIRED') {
1705
- return /*#__PURE__*/React__default['default'].createElement(TokenExpiredErrorOverlay, null);
1706
- }
1707
- if (tokenState === 'PUBLIC_KEY_LOAD_FAILED') {
1708
- return /*#__PURE__*/React__default['default'].createElement(TokenPublicKeyErrorOverlay, {
1709
- error: tokenError
1710
- });
1711
- }
1712
- if (tokenState === 'ISSUER_NOT_ALLOWED') {
1713
- return /*#__PURE__*/React__default['default'].createElement(TokenIssuerNotAllowedErrorOverlay, null);
1714
- }
1715
1845
  return /*#__PURE__*/React__default['default'].createElement(SubmissionContext.Provider, {
1716
1846
  value: value
1717
1847
  }, geolocationRequired && geolocationBlocked ? ( /*#__PURE__*/React__default['default'].createElement(GeolocationAccessDeniedOverlay, null)) : children, submissionError && ( /*#__PURE__*/React__default['default'].createElement(SubmissionErrorOverlay, {
@@ -1719,28 +1849,30 @@
1719
1849
  onRetry: onRetry
1720
1850
  })));
1721
1851
  };
1722
- function str2ab(str) {
1723
- var buf = new ArrayBuffer(str.length);
1724
- var bufView = new Uint8Array(buf);
1725
- for (var i = 0, strLen = str.length; i < strLen; i++) {
1726
- bufView[i] = str.charCodeAt(i);
1852
+ function createUpload(blob, options) {
1853
+ var UploadType =
1854
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1855
+ // @ts-ignore
1856
+ typeof window.tus !== 'undefined' ? window.tus.Upload : tusJsClient.Upload;
1857
+ return new UploadType(blob, options);
1858
+ }
1859
+ function convertBase64ToBlob(base64Image) {
1860
+ // Split into two parts
1861
+ var parts = base64Image.split(';base64,');
1862
+ // Hold the content type
1863
+ var imageType = parts[0].split(':')[1];
1864
+ // Decode Base64 string
1865
+ var decodedData = window.atob(parts[1]);
1866
+ // Create UNIT8ARRAY of size same as row data length
1867
+ var uInt8Array = new Uint8Array(decodedData.length);
1868
+ // Insert all character code into uInt8Array
1869
+ for (var i = 0; i < decodedData.length; ++i) {
1870
+ uInt8Array[i] = decodedData.charCodeAt(i);
1727
1871
  }
1728
- return buf;
1729
- }
1730
- function importRsaKey(pem) {
1731
- if (typeof window === 'undefined') throw new Error('window cannot be undefined');
1732
- // fetch the part of the PEM string between header and footer
1733
- var pemHeader = '-----BEGIN PUBLIC KEY-----';
1734
- var pemFooter = '-----END PUBLIC KEY-----';
1735
- var pemContents = pem.substring(pemHeader.length, pem.length - pemFooter.length - 1);
1736
- // base64 decode the string to get the binary data
1737
- var binaryDerString = window.atob(pemContents);
1738
- // convert from a binary string to an ArrayBuffer
1739
- var binaryDer = str2ab(binaryDerString);
1740
- return window.crypto.subtle.importKey('spki', binaryDer, {
1741
- name: 'RSASSA-PKCS1-v1_5',
1742
- hash: 'SHA-256'
1743
- }, true, ['verify']);
1872
+ // Return BLOB image after conversion
1873
+ return new Blob([uInt8Array], {
1874
+ type: imageType
1875
+ });
1744
1876
  }
1745
1877
 
1746
1878
  // This could've been more streamlined with internal state instead of abusing
@@ -2063,7 +2195,7 @@
2063
2195
  return [frameWidth, frameHeight];
2064
2196
  }
2065
2197
 
2066
- var InvisibleCanvas = styled__default['default'].canvas(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
2198
+ var InvisibleCanvas = styled__default['default'].canvas(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
2067
2199
  function drawToCanvas(canvas, frame, width, height) {
2068
2200
  if (!canvas) return;
2069
2201
  var ctx = canvas.getContext('2d');
@@ -2085,7 +2217,7 @@
2085
2217
  if (!ctx) return;
2086
2218
  ctx.clearRect(0, 0, canvas.width, canvas.height);
2087
2219
  }
2088
- var templateObject_1$C;
2220
+ var templateObject_1$B;
2089
2221
 
2090
2222
  function listAvailableCameras(facingMode, requestMicAccess) {
2091
2223
  if (requestMicAccess === void 0) {
@@ -2305,7 +2437,7 @@
2305
2437
  throw e;
2306
2438
  }
2307
2439
  });
2308
- }, [cameraAccessDenied, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
2440
+ }, [cameraAccessDenied, debugMode, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
2309
2441
  React.useEffect(function () {
2310
2442
  var _a;
2311
2443
  if (!videoDevice) return;
@@ -10597,7 +10729,7 @@
10597
10729
  return [state, dispatch];
10598
10730
  };
10599
10731
 
10600
- var DebugStatsPane = styled__default['default'].span(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"])));
10732
+ var DebugStatsPane = styled__default['default'].span(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"])));
10601
10733
  var ObjectDetectionDebugOverlayDiv = styled__default['default'].div(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"])), function (_a) {
10602
10734
  var $flipX = _a.$flipX;
10603
10735
  return $flipX ? 'transform: scaleX(-1);' : '';
@@ -10792,7 +10924,7 @@
10792
10924
  }
10793
10925
  });
10794
10926
  }
10795
- var templateObject_1$B, templateObject_2$q, templateObject_3$j, templateObject_4$e;
10927
+ var templateObject_1$A, templateObject_2$q, templateObject_3$j, templateObject_4$e;
10796
10928
 
10797
10929
  var enTranslation = {};
10798
10930
 
@@ -13632,7 +13764,7 @@
13632
13764
  }, [fallbacks, i18n.language, t, verbiage]);
13633
13765
  }
13634
13766
 
13635
- var GuidanceMessageContainerDiv = styled__default['default'].div(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
13767
+ var GuidanceMessageContainerDiv = styled__default['default'].div(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
13636
13768
  var $top = _a.$top;
13637
13769
  return $top !== null && $top !== void 0 ? $top : '10vh';
13638
13770
  }, function (_a) {
@@ -13652,7 +13784,7 @@
13652
13784
  var _a, _b, _c, _d, _e, _f;
13653
13785
  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';
13654
13786
  });
13655
- var templateObject_1$A, templateObject_2$p;
13787
+ var templateObject_1$z, templateObject_2$p;
13656
13788
 
13657
13789
  var IdCapture = function IdCapture(_a) {
13658
13790
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -14004,13 +14136,13 @@
14004
14136
  finished: true
14005
14137
  }, verbiage.retryBtnText)));
14006
14138
  };
14007
- var StyledOverlayInner$2 = styled__default['default'](OverlayInner$2)(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
14139
+ var StyledOverlayInner$2 = styled__default['default'](OverlayInner$2)(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"], ["\n max-width: 500px;\n height: auto;\n margin: auto;\n"])));
14008
14140
  var StyledOverlayImageContainer$2 = styled__default['default'](OverlayImageContainer)(templateObject_2$o || (templateObject_2$o = __makeTemplateObject(["\n flex-grow: 0;\n"], ["\n flex-grow: 0;\n"])));
14009
14141
  var Description$3 = styled__default['default'].p(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n line-height: 1.5;\n margin-bottom: 50px;\n"], ["\n line-height: 1.5;\n margin-bottom: 50px;\n"])));
14010
14142
  var RetryButton = styled__default['default'](LoaderButton)(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\n width: 200px;\n margin: 0 auto;\n"], ["\n width: 200px;\n margin: 0 auto;\n"])));
14011
- var templateObject_1$z, templateObject_2$o, templateObject_3$i, templateObject_4$d;
14143
+ var templateObject_1$y, templateObject_2$o, templateObject_3$i, templateObject_4$d;
14012
14144
 
14013
- var ExitCaptureStyledButton = styled__default['default'].button(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"], ["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"])));
14145
+ var ExitCaptureStyledButton = styled__default['default'].button(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"], ["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"])));
14014
14146
  var ExitCaptureButton = function ExitCaptureButton(_a) {
14015
14147
  var onClick = _a.onClick,
14016
14148
  className = _a.className;
@@ -14054,11 +14186,11 @@
14054
14186
  y2: "19.75"
14055
14187
  }))));
14056
14188
  };
14057
- var templateObject_1$y;
14058
-
14059
- var ButtonsRow = styled__default['default'].div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"], ["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));
14060
14189
  var templateObject_1$x;
14061
14190
 
14191
+ var ButtonsRow = styled__default['default'].div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"], ["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));
14192
+ var templateObject_1$w;
14193
+
14062
14194
  function IdCaptureLoadingGraphic(props) {
14063
14195
  var isMobile = window.innerHeight > window.innerWidth;
14064
14196
  return isMobile ? ( /*#__PURE__*/React__default['default'].createElement(IdCaptureLoadingGraphicMobile, __assign$1({}, props))) : ( /*#__PURE__*/React__default['default'].createElement(IdCaptureLoadingGraphicDesktop, __assign$1({}, props)));
@@ -14692,7 +14824,7 @@
14692
14824
  }
14693
14825
  }, verbiage.continueText))))));
14694
14826
  };
14695
- var OverlayInner$1 = styled__default['default'].div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
14827
+ var OverlayInner$1 = styled__default['default'].div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"], ["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n"])), function (props) {
14696
14828
  var _a, _b, _c, _d;
14697
14829
  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';
14698
14830
  }, function (props) {
@@ -14744,9 +14876,9 @@
14744
14876
  var _a, _b, _c, _d, _e, _f;
14745
14877
  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, ";") : '';
14746
14878
  });
14747
- 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;
14879
+ 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;
14748
14880
 
14749
- var ContinuityCameraCheckboxContainer = styled__default['default'].div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
14881
+ var ContinuityCameraCheckboxContainer = styled__default['default'].div(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
14750
14882
  var ContinuityCameraCheckbox = styled__default['default'].input(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
14751
14883
  var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
14752
14884
  var _b, _c, _d, _e;
@@ -14858,7 +14990,7 @@
14858
14990
  }
14859
14991
  }, cameraReady && modelsReady ? verbiage.continueText : modelsReady ? verbiage.cameraInitializingText : modelDownloadProgress >= 100 ? verbiage.modelsWarmingUpText : "".concat(verbiage.downloadingText, " (").concat(modelDownloadProgress, "%)"))));
14860
14992
  };
14861
- var templateObject_1$v, templateObject_2$m;
14993
+ var templateObject_1$u, templateObject_2$m;
14862
14994
 
14863
14995
  var components$1 = {
14864
14996
  "default": IdCaptureLoadingOverlayDefault,
@@ -14901,7 +15033,7 @@
14901
15033
  });
14902
15034
  };
14903
15035
 
14904
- var OverlayInstruction = styled__default['default'].p(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
15036
+ var OverlayInstruction = styled__default['default'].p(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
14905
15037
  var IdCaptureSuccess = function IdCaptureSuccess(_a) {
14906
15038
  var capturedDocuments = _a.capturedDocuments,
14907
15039
  // barcodeResult,
@@ -14996,7 +15128,7 @@
14996
15128
  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)';
14997
15129
  });
14998
15130
  var StyledImage = styled__default['default'](CapturedDocumentImg)(templateObject_8$2 || (templateObject_8$2 = __makeTemplateObject(["\n width: 100%;\n border-radius: 4px;\n"], ["\n width: 100%;\n border-radius: 4px;\n"])));
14999
- 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;
15131
+ 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;
15000
15132
 
15001
15133
  var CameraVideoTag = function CameraVideoTag(_a) {
15002
15134
  var _b;
@@ -15027,10 +15159,10 @@
15027
15159
  "$isRearFacing": (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing
15028
15160
  });
15029
15161
  };
15030
- var FullscreenVideoTag = styled__default['default'].video(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
15162
+ var FullscreenVideoTag = styled__default['default'].video(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
15031
15163
  return props.$isRearFacing ? '' : 'scaleX(-1)';
15032
15164
  });
15033
- var templateObject_1$t;
15165
+ var templateObject_1$s;
15034
15166
 
15035
15167
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
15036
15168
  var _this = this;
@@ -15065,10 +15197,10 @@
15065
15197
  return !skipSuccessScreen || skipSuccessScreenResolvedFalse;
15066
15198
  }
15067
15199
 
15068
- var CameraFeedWrapper = styled__default['default'].div(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
15200
+ var CameraFeedWrapper = styled__default['default'].div(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
15069
15201
  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;") : "";
15070
15202
  });
15071
- var templateObject_1$s;
15203
+ var templateObject_1$r;
15072
15204
 
15073
15205
  function setCanvasDimensions(canvas, width, height) {
15074
15206
  var _a;
@@ -15102,7 +15234,7 @@
15102
15234
  }
15103
15235
  });
15104
15236
 
15105
- var StyledPageContainer = styled__default['default'](PageContainer)(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n z-index: 1000;\n"], ["\n z-index: 1000;\n"])));
15237
+ var StyledPageContainer = styled__default['default'](PageContainer)(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n z-index: 1000;\n"], ["\n z-index: 1000;\n"])));
15106
15238
  var GuidesContainer = styled__default['default'].div(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"], ["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"])));
15107
15239
  var GuideCenterRow = styled__default['default'].div(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"], ["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"])));
15108
15240
  var GuideRegion = styled__default['default'].div(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ", ";\n color: ", ";\n text-align: center;\n ", "\n ", "\n"])), function (props) {
@@ -15254,9 +15386,9 @@
15254
15386
  return v;
15255
15387
  }).join(' ');
15256
15388
  };
15257
- 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;
15389
+ 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;
15258
15390
 
15259
- var FlippingImage = styled__default['default'](GuideImage)(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"], ["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"])), function (props) {
15391
+ var FlippingImage = styled__default['default'](GuideImage)(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"], ["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ", "s;\n transform: ", ";\n"])), function (props) {
15260
15392
  return props.$transitionTime;
15261
15393
  }, function (props) {
15262
15394
  return props.$transforms;
@@ -15402,7 +15534,7 @@
15402
15534
  return v;
15403
15535
  }).join(' ');
15404
15536
  };
15405
- var templateObject_1$q, templateObject_2$j;
15537
+ var templateObject_1$p, templateObject_2$j;
15406
15538
 
15407
15539
  var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
15408
15540
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
@@ -15538,11 +15670,11 @@
15538
15670
  imageVisible: imageVisible
15539
15671
  })));
15540
15672
  };
15541
- var CanvasWrapper$1 = styled__default['default'].div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"])), function (props) {
15673
+ var CanvasWrapper$1 = styled__default['default'].div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n z-index: -1;\n"])), function (props) {
15542
15674
  return props.$maskColor;
15543
15675
  });
15544
15676
  var Canvas$1 = styled__default['default'].canvas(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
15545
- var templateObject_1$p, templateObject_2$i;
15677
+ var templateObject_1$o, templateObject_2$i;
15546
15678
 
15547
15679
  function IdCaptureGuides(_a) {
15548
15680
  var _b, _c;
@@ -15600,33 +15732,6 @@
15600
15732
  })));
15601
15733
  }
15602
15734
 
15603
- var Spinner$1 = styled__default['default'].div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])), function (_a) {
15604
- var $size = _a.$size;
15605
- return $size !== null && $size !== void 0 ? $size : 80;
15606
- }, function (_a) {
15607
- var $size = _a.$size;
15608
- return $size !== null && $size !== void 0 ? $size : 80;
15609
- }, function (_a) {
15610
- var $size = _a.$size;
15611
- return ($size !== null && $size !== void 0 ? $size : 80) - 16;
15612
- }, function (_a) {
15613
- var $size = _a.$size;
15614
- return ($size !== null && $size !== void 0 ? $size : 80) - 16;
15615
- }, function (_a) {
15616
- var $thickness = _a.$thickness;
15617
- return $thickness !== null && $thickness !== void 0 ? $thickness : 6;
15618
- }, function (_a) {
15619
- var $color = _a.$color;
15620
- return $color !== null && $color !== void 0 ? $color : '#888';
15621
- }, function (_a) {
15622
- var $color = _a.$color;
15623
- return $color !== null && $color !== void 0 ? $color : '#888';
15624
- }, function (_a) {
15625
- var $color = _a.$color;
15626
- return $color !== null && $color !== void 0 ? $color : '#888';
15627
- });
15628
- var templateObject_1$o;
15629
-
15630
15735
  var IdCaptureImagePreview = function IdCaptureImagePreview(_a) {
15631
15736
  var _b = _a.classNames,
15632
15737
  classNames = _b === void 0 ? {} : _b,
@@ -15838,7 +15943,7 @@
15838
15943
  cameraRef = _d.cameraRef,
15839
15944
  videoRef = _d.videoRef;
15840
15945
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
15841
- var uploadCapturedDocument = React.useCallback(function (content) {
15946
+ var uploadCapturedDocument = React.useCallback(function (content, filetype) {
15842
15947
  return __awaiter(void 0, void 0, void 0, function () {
15843
15948
  var documentId_1;
15844
15949
  return __generator(this, function (_a) {
@@ -15848,7 +15953,9 @@
15848
15953
  dispatch({
15849
15954
  type: 'uploadStarted'
15850
15955
  });
15851
- return [4 /*yield*/, uploadDocument(content)];
15956
+ return [4 /*yield*/, uploadDocument(content, {
15957
+ filetype: filetype
15958
+ })];
15852
15959
  case 1:
15853
15960
  documentId_1 = _a.sent();
15854
15961
  setTimeout(function () {
@@ -15894,7 +16001,8 @@
15894
16001
  type: 'setDocuments',
15895
16002
  payload: resolvedDocuments
15896
16003
  });
15897
- if ((_a = resolvedDocuments[0]) === null || _a === void 0 ? void 0 : _a.content) uploadCapturedDocument(resolvedDocuments[0].content);
16004
+ var firstDocumentContent = (_a = resolvedDocuments[0]) === null || _a === void 0 ? void 0 : _a.content;
16005
+ if (firstDocumentContent) uploadCapturedDocument(firstDocumentContent, firstDocumentContent.type);
15898
16006
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
15899
16007
  React.useEffect(function () {
15900
16008
  dispatch({
@@ -16117,7 +16225,7 @@
16117
16225
  return __generator(this, function (_a) {
16118
16226
  switch (_a.label) {
16119
16227
  case 0:
16120
- return [4 /*yield*/, uploadCapturedDocument(content)];
16228
+ return [4 /*yield*/, uploadCapturedDocument(content, 'image/jpeg')];
16121
16229
  case 1:
16122
16230
  _a.sent();
16123
16231
  return [2 /*return*/];
@@ -17149,7 +17257,7 @@
17149
17257
  requestError: new Error("".concat(statusMessage, ": ").concat(errorData))
17150
17258
  });
17151
17259
  }
17152
- var faceLive = resultData.verificationResult === 'Live Face Detected';
17260
+ var faceLive = ['Live Face Detected', 'Approved'].includes(resultData.verificationResult);
17153
17261
  var eyeCoveringDetected = resultData.eyeCovering === 'true';
17154
17262
  var maskDetected = resultData.faceMask === 'true';
17155
17263
  var headCoveringDetected = resultData.headCovering === 'true';
@@ -19148,8 +19256,7 @@
19148
19256
  var _m = useVideoRecorder(cameraRef.current),
19149
19257
  isRecording = _m.isRecording,
19150
19258
  startRecording = _m.startRecording,
19151
- stopRecording = _m.stopRecording,
19152
- videoUrl = _m.videoUrl;
19259
+ stopRecording = _m.stopRecording;
19153
19260
  var _o = React.useState(null),
19154
19261
  signatureData = _o[0],
19155
19262
  setSignatureData = _o[1];
@@ -19167,32 +19274,54 @@
19167
19274
  clearBtnText: 'Clear'
19168
19275
  });
19169
19276
  var outputCanvas = React.useRef(null);
19277
+ var recordingLock = React.useRef(false);
19170
19278
  React.useEffect(function () {
19171
- // delay 100ms to make sure outputCanvas has rendered.
19172
- setTimeout(function () {
19173
- if (!isRecording && !videoUrl && !!outputCanvas.current) {
19174
- startRecording();
19175
- var stream = outputCanvas.current.captureStream(25 /* fps */);
19176
- signatureRecorder.current = new MediaRecorder(stream, {
19177
- videoBitsPerSecond: 270000
19178
- });
19179
- signatureRecorder.current.start();
19180
- signatureRecorder.current.ondataavailable = function (event) {
19181
- var _a;
19182
- recordedChunks.current.push(event.data);
19183
- if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
19184
- signatureRecorder.current.stop();
19279
+ if (recordingLock.current) return;
19280
+ recordingLock.current = true;
19281
+ (function () {
19282
+ return __awaiter(void 0, void 0, void 0, function () {
19283
+ var stream;
19284
+ return __generator(this, function (_a) {
19285
+ switch (_a.label) {
19286
+ case 0:
19287
+ if (!!outputCanvas.current) return [3 /*break*/, 2];
19288
+ return [4 /*yield*/, new Promise(function (resolve) {
19289
+ var interval = setInterval(function () {
19290
+ if (outputCanvas.current) {
19291
+ clearInterval(interval);
19292
+ resolve(null);
19293
+ }
19294
+ }, 10);
19295
+ })];
19296
+ case 1:
19297
+ _a.sent();
19298
+ _a.label = 2;
19299
+ case 2:
19300
+ startRecording();
19301
+ stream = outputCanvas.current.captureStream(24 /* fps */);
19302
+ signatureRecorder.current = new MediaRecorder(stream, {
19303
+ videoBitsPerSecond: 270000
19304
+ });
19305
+ signatureRecorder.current.start();
19306
+ signatureRecorder.current.ondataavailable = function (event) {
19307
+ var _a;
19308
+ recordedChunks.current.push(event.data);
19309
+ if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
19310
+ signatureRecorder.current.stop();
19311
+ }
19312
+ };
19313
+ signatureRecorder.current.onstop = function () {
19314
+ var blob = new Blob(recordedChunks.current, {
19315
+ type: 'video/mp4'
19316
+ });
19317
+ setSignatureVideoData(blob);
19318
+ };
19319
+ return [2 /*return*/];
19185
19320
  }
19186
- };
19187
- signatureRecorder.current.onstop = function () {
19188
- var blob = new Blob(recordedChunks.current, {
19189
- type: 'video/mp4'
19190
- });
19191
- setSignatureVideoData(blob);
19192
- };
19193
- }
19194
- }, 100);
19195
- }, [isRecording, startRecording, videoUrl]);
19321
+ });
19322
+ });
19323
+ })();
19324
+ }, [startRecording]);
19196
19325
  React.useEffect(function () {
19197
19326
  if (signatureVideoData && signatureData && signatureDataUrl) {
19198
19327
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
@@ -19456,7 +19585,6 @@
19456
19585
  onRetryClicked === null || onRetryClicked === void 0 ? void 0 : onRetryClicked();
19457
19586
  onExit();
19458
19587
  }, [onExit, onRetryClicked]);
19459
- var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onComplete);
19460
19588
  var onDoneClick = React.useCallback(function () {
19461
19589
  return __awaiter(void 0, void 0, void 0, function () {
19462
19590
  return __generator(this, function (_a) {
@@ -19471,6 +19599,7 @@
19471
19599
  });
19472
19600
  });
19473
19601
  }, [onComplete, submit]);
19602
+ var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onDoneClick);
19474
19603
  return /*#__PURE__*/React__default['default'].createElement(HighPerformanceSelfieGuidanceModelsProvider, {
19475
19604
  throttleMs: captureState === 'CAPTURING_SIGNATURE' ? 250 : 0,
19476
19605
  onModelError: onModelError,
@@ -19602,29 +19731,29 @@
19602
19731
  var templateObject_1$8;
19603
19732
 
19604
19733
  var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
19605
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
19606
- var _u = _a.requestedAction,
19607
- requestedAction = _u === void 0 ? 'SHOW_ID_FRONT' : _u,
19608
- _v = _a.satisfied,
19609
- satisfied = _v === void 0 ? false : _v,
19734
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
19735
+ var _y = _a.requestedAction,
19736
+ requestedAction = _y === void 0 ? 'SHOW_ID_FRONT' : _y,
19737
+ _z = _a.satisfied,
19738
+ satisfied = _z === void 0 ? false : _z,
19610
19739
  faceGuideBorderWidth = _a.faceGuideBorderWidth,
19611
19740
  faceGuideBorderColor = _a.faceGuideBorderColor,
19612
19741
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
19613
19742
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
19614
- _w = _a.assets,
19615
- assets = _w === void 0 ? {} : _w,
19616
- _x = _a.classNames,
19617
- classNames = _x === void 0 ? {} : _x,
19618
- _y = _a.verbiage,
19619
- rawVerbiage = _y === void 0 ? {} : _y;
19743
+ _0 = _a.assets,
19744
+ assets = _0 === void 0 ? {} : _0,
19745
+ _1 = _a.classNames,
19746
+ classNames = _1 === void 0 ? {} : _1,
19747
+ _2 = _a.verbiage,
19748
+ rawVerbiage = _2 === void 0 ? {} : _2;
19620
19749
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
19621
19750
  var imageRef = React.useRef(null);
19622
- var _z = React.useState(0),
19623
- imageWidth = _z[0],
19624
- setImageWidth = _z[1];
19625
- var _0 = React.useState(0),
19626
- imageHeight = _0[0],
19627
- setImageHeight = _0[1];
19751
+ var _3 = React.useState(0),
19752
+ imageWidth = _3[0],
19753
+ setImageWidth = _3[1];
19754
+ var _4 = React.useState(0),
19755
+ imageHeight = _4[0],
19756
+ setImageHeight = _4[1];
19628
19757
  assets.frontImageUrl || (assets.frontImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
19629
19758
  assets.backImageUrl || (assets.backImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
19630
19759
  var verbiage = useTranslations(rawVerbiage, {
@@ -19633,12 +19762,16 @@
19633
19762
  flipIdInstructionText: 'Please flip your ID card...'
19634
19763
  });
19635
19764
  var instructionText = requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
19636
- var idGuideWidth = typeof window !== 'undefined' && window.innerWidth > window.innerHeight ? '30%' : '75%';
19637
19765
  var theme = styled.useTheme();
19638
19766
  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;
19639
19767
  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';
19640
19768
  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;
19641
19769
  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';
19770
+ var captureImageSize = function captureImageSize() {
19771
+ var _a, _b, _c, _d;
19772
+ if (!imageWidth) setImageWidth((_b = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0);
19773
+ if (!imageHeight) setImageHeight((_d = (_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0);
19774
+ };
19642
19775
  return /*#__PURE__*/React__default['default'].createElement(Container, {
19643
19776
  className: classNames.container
19644
19777
  }, /*#__PURE__*/React__default['default'].createElement(FaceGuide, {
@@ -19646,12 +19779,13 @@
19646
19779
  "$borderWidth": faceGuideBorderWidth,
19647
19780
  "$borderColor": faceGuideBorderColor
19648
19781
  }), /*#__PURE__*/React__default['default'].createElement(IdCardGuideContainer, {
19649
- "$width": idGuideWidth,
19650
19782
  className: classNames.idCardGuideContainer
19651
19783
  }, /*#__PURE__*/React__default['default'].createElement(IdCardGuideInstructionsContainer, {
19652
19784
  className: classNames.idCardGuideInstructionsContainer
19653
19785
  }, /*#__PURE__*/React__default['default'].createElement(IdCardGuideInstructions, {
19654
- className: classNames.idCardGuideInstructions
19786
+ className: classNames.idCardGuideInstructions,
19787
+ "$textColor": (_u = (_t = theme.idVideoCapture) === null || _t === void 0 ? void 0 : _t.idCardGuides) === null || _u === void 0 ? void 0 : _u.instructionsTextColor,
19788
+ "$background": (_w = (_v = theme.idVideoCapture) === null || _v === void 0 ? void 0 : _v.idCardGuides) === null || _w === void 0 ? void 0 : _w.instructionsBackgroundColor
19655
19789
  }, instructionText)), /*#__PURE__*/React__default['default'].createElement(IdCardGuideImageContainer, {
19656
19790
  "$borderWidth": idCardGuideBorderWidth,
19657
19791
  "$borderColor": idCardGuideBorderColor,
@@ -19667,30 +19801,25 @@
19667
19801
  src: requestedAction === 'SHOW_ID_BACK' ? assets.backImageUrl : assets.frontImageUrl,
19668
19802
  alt: "",
19669
19803
  className: classNames.idCardGuideImage,
19670
- "$isMirrored": !((_t = cameraRef.current) === null || _t === void 0 ? void 0 : _t.isRearFacing),
19671
- onLoad: function onLoad() {
19672
- var _a, _b, _c, _d;
19673
- if (!imageWidth) setImageWidth((_b = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0);
19674
- if (!imageHeight) setImageHeight((_d = (_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0);
19675
- }
19804
+ "$isMirrored": !((_x = cameraRef.current) === null || _x === void 0 ? void 0 : _x.isRearFacing),
19805
+ onLoad: captureImageSize,
19806
+ onResize: captureImageSize
19676
19807
  })))));
19677
19808
  };
19678
19809
  var Container = styled__default['default'].div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n font-family: ", ";\n"], ["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n font-family: ", ";\n"])), function (props) {
19679
19810
  var _a;
19680
19811
  return (_a = props.theme) === null || _a === void 0 ? void 0 : _a.fontFamily;
19681
19812
  });
19682
- var FaceGuide = styled__default['default'].div(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"], ["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"])), function (props) {
19813
+ var FaceGuide = styled__default['default'].div(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"], ["\n border-width: ", "px;\n border-color: ", ";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"])), function (props) {
19683
19814
  var _a;
19684
19815
  return (_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 0;
19685
19816
  }, function (props) {
19686
19817
  var _a;
19687
19818
  return (_a = props.$borderColor) !== null && _a !== void 0 ? _a : 'white';
19688
19819
  });
19689
- var IdCardGuideContainer = styled__default['default'].div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n width: ", ";\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"], ["\n width: ", ";\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"])), function (props) {
19690
- return props.$width;
19691
- });
19692
- var IdCardGuideInstructionsContainer = styled__default['default'].div(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n width: 100%;\n flex-grow: 1;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"], ["\n width: 100%;\n flex-grow: 1;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"])));
19693
- var IdCardGuideInstructions = styled__default['default'].span(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"], ["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"])));
19820
+ var IdCardGuideContainer = styled__default['default'].div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n height: 50%;\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"], ["\n height: 50%;\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"])));
19821
+ var IdCardGuideInstructionsContainer = styled__default['default'].div(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n width: 100%;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"], ["\n width: 100%;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"])));
19822
+ var IdCardGuideInstructions = styled__default['default'](GuidanceMessage)(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n padding: 8px 12px;\n font-weight: bold;\n"], ["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n padding: 8px 12px;\n font-weight: bold;\n"])));
19694
19823
  var IdCardGuideImageContainer = styled__default['default'].div(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["\n position: relative;\n border: ", "px solid\n ", ";\n"], ["\n position: relative;\n border: ", "px solid\n ", ";\n"])), function (props) {
19695
19824
  return props.$borderWidth;
19696
19825
  }, function (props) {
@@ -20866,8 +20995,10 @@
20866
20995
  var IdValidation = function IdValidation(_a) {
20867
20996
  var _b = _a.lang,
20868
20997
  lang = _b === void 0 ? 'auto' : _b,
20869
- submissionToken = _a.submissionToken,
20998
+ sessionId = _a.sessionId,
20870
20999
  submissionUrl = _a.submissionUrl,
21000
+ authUrl = _a.authUrl,
21001
+ documentServiceUrl = _a.documentServiceUrl,
20871
21002
  companyId = _a.companyId,
20872
21003
  needImmediateResponse = _a.needImmediateResponse,
20873
21004
  manualReviewRequired = _a.manualReviewRequired,
@@ -20910,6 +21041,10 @@
20910
21041
  _p = _a.modelLoadTimeoutMs,
20911
21042
  modelLoadTimeoutMs = _p === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _p,
20912
21043
  onBeforeSubmit = _a.onBeforeSubmit,
21044
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
21045
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
21046
+ onDocumentUploaded = _a.onDocumentUploaded,
21047
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
20913
21048
  onSubmit = _a.onSubmit,
20914
21049
  onComplete = _a.onComplete,
20915
21050
  onApproved = _a.onApproved,
@@ -21000,12 +21135,15 @@
21000
21135
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
21001
21136
  }
21002
21137
  }, [onApproved, onComplete, onDenied]);
21003
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21138
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
21139
+ sessionId: sessionId,
21140
+ authUrl: authUrl
21141
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21004
21142
  theme: theme
21005
21143
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
21006
21144
  action: SubmissionAction.VALIDATE,
21007
- url: submissionUrl,
21008
- token: submissionToken,
21145
+ submissionUrl: submissionUrl,
21146
+ documentServiceUrl: documentServiceUrl,
21009
21147
  companyId: companyId,
21010
21148
  needImmediateResponse: needImmediateResponse,
21011
21149
  manualReviewRequired: manualReviewRequired,
@@ -21021,6 +21159,10 @@
21021
21159
  webhooksSendInputImages: webhooksSendInputImages,
21022
21160
  webhooksSendProcessedImages: webhooksSendProcessedImages,
21023
21161
  webhooksFireOnReview: webhooksFireOnReview,
21162
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
21163
+ onDocumentUploadProgress: onDocumentUploadProgress,
21164
+ onDocumentUploaded: onDocumentUploaded,
21165
+ onDocumentUploadFailed: onDocumentUploadFailed,
21024
21166
  onBeforeSubmit: onBeforeSubmit,
21025
21167
  onSubmit: onSubmit,
21026
21168
  onResponseReceived: onResponseReceived,
@@ -21037,15 +21179,17 @@
21037
21179
  captureSignature: captureSignature,
21038
21180
  captureSignatureVideo: captureSignatureVideo,
21039
21181
  debugMode: debugMode
21040
- })));
21182
+ }))));
21041
21183
  };
21042
21184
 
21043
21185
  /** Render a fullscreen capture component that analyzes frames from the user's front-facing camera to determine whether a live human face is present. */
21044
21186
  var FaceValidation = function FaceValidation(_a) {
21045
21187
  var _b = _a.lang,
21046
21188
  lang = _b === void 0 ? 'auto' : _b,
21047
- submissionToken = _a.submissionToken,
21189
+ sessionId = _a.sessionId,
21190
+ authUrl = _a.authUrl,
21048
21191
  submissionUrl = _a.submissionUrl,
21192
+ documentServiceUrl = _a.documentServiceUrl,
21049
21193
  companyId = _a.companyId,
21050
21194
  needImmediateResponse = _a.needImmediateResponse,
21051
21195
  webhooksEnabled = _a.webhooksEnabled,
@@ -21061,6 +21205,11 @@
21061
21205
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
21062
21206
  _f = _a.skipSuccessScreen,
21063
21207
  skipSuccessScreen = _f === void 0 ? false : _f,
21208
+ idCardForFaceMatch = _a.idCardForFaceMatch,
21209
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
21210
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
21211
+ onDocumentUploaded = _a.onDocumentUploaded,
21212
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
21064
21213
  onBeforeSubmit = _a.onBeforeSubmit,
21065
21214
  onComplete = _a.onComplete,
21066
21215
  onApproved = _a.onApproved,
@@ -21102,12 +21251,15 @@
21102
21251
  debugMode: debugMode
21103
21252
  };
21104
21253
  }, [assets, classNames, colors, debugMode, loadingOverlayMode, modelLoadTimeoutMs, onApproved, onComplete, onDenied, onExitAfterFailure, onExitCapture, onModelError, onUserCancel, skipSuccessScreen, timeoutDurationMs, verbiage]);
21105
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21254
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
21255
+ sessionId: sessionId,
21256
+ authUrl: authUrl
21257
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21106
21258
  theme: theme
21107
21259
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
21108
21260
  action: SubmissionAction.NONE,
21109
- url: submissionUrl,
21110
- token: submissionToken,
21261
+ submissionUrl: submissionUrl,
21262
+ documentServiceUrl: documentServiceUrl,
21111
21263
  companyId: companyId,
21112
21264
  needImmediateResponse: needImmediateResponse,
21113
21265
  webhooksEnabled: webhooksEnabled,
@@ -21115,6 +21267,11 @@
21115
21267
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
21116
21268
  webhooksSendInputImages: webhooksSendInputImages,
21117
21269
  webhooksSendProcessedImages: webhooksSendProcessedImages,
21270
+ idCardForFaceMatch: idCardForFaceMatch,
21271
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
21272
+ onDocumentUploadProgress: onDocumentUploadProgress,
21273
+ onDocumentUploaded: onDocumentUploaded,
21274
+ onDocumentUploadFailed: onDocumentUploadFailed,
21118
21275
  onBeforeLivenessCheck: onBeforeSubmit,
21119
21276
  geolocationEnabled: geolocationEnabled,
21120
21277
  geolocationRequired: geolocationRequired
@@ -21124,7 +21281,7 @@
21124
21281
  }, []),
21125
21282
  faceLivenessProps: faceLivenessProps,
21126
21283
  debugMode: debugMode
21127
- })));
21284
+ }))));
21128
21285
  };
21129
21286
 
21130
21287
  /**
@@ -21133,8 +21290,10 @@
21133
21290
  var IdAndFaceValidation = function IdAndFaceValidation(_a) {
21134
21291
  var _b = _a.lang,
21135
21292
  lang = _b === void 0 ? 'auto' : _b,
21136
- submissionToken = _a.submissionToken,
21293
+ sessionId = _a.sessionId,
21294
+ authUrl = _a.authUrl,
21137
21295
  submissionUrl = _a.submissionUrl,
21296
+ documentServiceUrl = _a.documentServiceUrl,
21138
21297
  companyId = _a.companyId,
21139
21298
  needImmediateResponse = _a.needImmediateResponse,
21140
21299
  manualReviewRequired = _a.manualReviewRequired,
@@ -21184,6 +21343,10 @@
21184
21343
  idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _s,
21185
21344
  _t = _a.selfieCaptureModelLoadTimeoutMs,
21186
21345
  selfieCaptureModelLoadTimeoutMs = _t === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _t,
21346
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
21347
+ onDocumentUploaded = _a.onDocumentUploaded,
21348
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
21349
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
21187
21350
  onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
21188
21351
  onBeforeSubmit = _a.onBeforeSubmit,
21189
21352
  onSubmit = _a.onSubmit,
@@ -21298,12 +21461,15 @@
21298
21461
  var checks = React.useMemo(function () {
21299
21462
  return (precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie) ? ['IdCapture'] : ['IdCapture', 'FaceLiveness'];
21300
21463
  }, [precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie]);
21301
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21464
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
21465
+ sessionId: sessionId,
21466
+ authUrl: authUrl
21467
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21302
21468
  theme: theme
21303
21469
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
21304
21470
  action: SubmissionAction.VALIDATE,
21305
- url: submissionUrl,
21306
- token: submissionToken,
21471
+ submissionUrl: submissionUrl,
21472
+ documentServiceUrl: documentServiceUrl,
21307
21473
  companyId: companyId,
21308
21474
  needImmediateResponse: needImmediateResponse,
21309
21475
  manualReviewRequired: manualReviewRequired,
@@ -21320,6 +21486,10 @@
21320
21486
  webhooksSendProcessedImages: webhooksSendProcessedImages,
21321
21487
  webhooksFireOnReview: webhooksFireOnReview,
21322
21488
  precapturedDocuments: precapturedDocuments,
21489
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
21490
+ onDocumentUploadProgress: onDocumentUploadProgress,
21491
+ onDocumentUploaded: onDocumentUploaded,
21492
+ onDocumentUploadFailed: onDocumentUploadFailed,
21323
21493
  onBeforeSubmit: onBeforeSubmit,
21324
21494
  onBeforeLivenessCheck: onBeforeLivenessCheck,
21325
21495
  onSubmit: onSubmit,
@@ -21336,7 +21506,7 @@
21336
21506
  captureSignature: captureSignature,
21337
21507
  captureSignatureVideo: captureSignatureVideo,
21338
21508
  debugMode: debugMode
21339
- })));
21509
+ }))));
21340
21510
  };
21341
21511
 
21342
21512
  /**
@@ -21346,8 +21516,10 @@
21346
21516
  var enrollmentId = _a.enrollmentId,
21347
21517
  _b = _a.lang,
21348
21518
  lang = _b === void 0 ? 'auto' : _b,
21349
- submissionToken = _a.submissionToken,
21519
+ sessionId = _a.sessionId,
21520
+ authUrl = _a.authUrl,
21350
21521
  submissionUrl = _a.submissionUrl,
21522
+ documentServiceUrl = _a.documentServiceUrl,
21351
21523
  companyId = _a.companyId,
21352
21524
  needImmediateResponse = _a.needImmediateResponse,
21353
21525
  manualReviewRequired = _a.manualReviewRequired,
@@ -21399,6 +21571,10 @@
21399
21571
  idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultIdCaptureModelLoadTimeoutMs : _s,
21400
21572
  _t = _a.selfieCaptureModelLoadTimeoutMs,
21401
21573
  selfieCaptureModelLoadTimeoutMs = _t === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _t,
21574
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
21575
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
21576
+ onDocumentUploaded = _a.onDocumentUploaded,
21577
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
21402
21578
  onBeforeSubmit = _a.onBeforeSubmit,
21403
21579
  onSubmit = _a.onSubmit,
21404
21580
  onComplete = _a.onComplete,
@@ -21507,12 +21683,15 @@
21507
21683
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
21508
21684
  }
21509
21685
  }, [onEnrolled, onComplete, onDenied]);
21510
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21686
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
21687
+ sessionId: sessionId,
21688
+ authUrl: authUrl
21689
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
21511
21690
  theme: theme
21512
21691
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
21513
21692
  action: SubmissionAction.ENROLL,
21514
- url: submissionUrl,
21515
- token: submissionToken,
21693
+ submissionUrl: submissionUrl,
21694
+ documentServiceUrl: documentServiceUrl,
21516
21695
  companyId: companyId,
21517
21696
  enrollmentId: enrollmentId,
21518
21697
  needImmediateResponse: needImmediateResponse,
@@ -21532,6 +21711,10 @@
21532
21711
  webhooksSendInputImages: webhooksSendInputImages,
21533
21712
  webhooksSendProcessedImages: webhooksSendProcessedImages,
21534
21713
  webhooksFireOnReview: webhooksFireOnReview,
21714
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
21715
+ onDocumentUploadProgress: onDocumentUploadProgress,
21716
+ onDocumentUploaded: onDocumentUploaded,
21717
+ onDocumentUploadFailed: onDocumentUploadFailed,
21535
21718
  onBeforeSubmit: onBeforeSubmit,
21536
21719
  onSubmit: onSubmit,
21537
21720
  onResponseReceived: onResponseReceived,
@@ -21549,7 +21732,7 @@
21549
21732
  captureSignature: captureSignature,
21550
21733
  captureSignatureVideo: captureSignatureVideo,
21551
21734
  debugMode: debugMode
21552
- })));
21735
+ }))));
21553
21736
  };
21554
21737
 
21555
21738
  var ALLOWED_RETRIES$3 = 0;
@@ -21989,8 +22172,10 @@
21989
22172
  var _b = _a.lang,
21990
22173
  lang = _b === void 0 ? 'auto' : _b,
21991
22174
  enrollmentId = _a.enrollmentId,
21992
- submissionToken = _a.submissionToken,
22175
+ sessionId = _a.sessionId,
22176
+ authUrl = _a.authUrl,
21993
22177
  submissionUrl = _a.submissionUrl,
22178
+ documentServiceUrl = _a.documentServiceUrl,
21994
22179
  companyId = _a.companyId,
21995
22180
  needImmediateResponse = _a.needImmediateResponse,
21996
22181
  webhooksEnabled = _a.webhooksEnabled,
@@ -22012,6 +22197,10 @@
22012
22197
  classNames = _a.classNames,
22013
22198
  colors = _a.colors,
22014
22199
  verbiage = _a.verbiage,
22200
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
22201
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
22202
+ onDocumentUploaded = _a.onDocumentUploaded,
22203
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
22015
22204
  onBeforeSubmit = _a.onBeforeSubmit,
22016
22205
  onSubmit = _a.onSubmit,
22017
22206
  onComplete = _a.onComplete,
@@ -22028,12 +22217,15 @@
22028
22217
  _k = _a.debugMode,
22029
22218
  debugMode = _k === void 0 ? false : _k;
22030
22219
  useLanguage(lang);
22031
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22220
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
22221
+ sessionId: sessionId,
22222
+ authUrl: authUrl
22223
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22032
22224
  theme: theme
22033
22225
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
22034
22226
  action: SubmissionAction.VERIFY,
22035
- url: submissionUrl,
22036
- token: submissionToken,
22227
+ submissionUrl: submissionUrl,
22228
+ documentServiceUrl: documentServiceUrl,
22037
22229
  companyId: companyId,
22038
22230
  enrollmentId: enrollmentId,
22039
22231
  needImmediateResponse: needImmediateResponse,
@@ -22042,6 +22234,10 @@
22042
22234
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
22043
22235
  webhooksSendInputImages: webhooksSendInputImages,
22044
22236
  webhooksSendProcessedImages: webhooksSendProcessedImages,
22237
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
22238
+ onDocumentUploadProgress: onDocumentUploadProgress,
22239
+ onDocumentUploaded: onDocumentUploaded,
22240
+ onDocumentUploadFailed: onDocumentUploadFailed,
22045
22241
  onBeforeSubmit: onBeforeSubmit,
22046
22242
  onSubmit: onSubmit,
22047
22243
  geolocationEnabled: geolocationEnabled,
@@ -22067,7 +22263,7 @@
22067
22263
  colors: colors,
22068
22264
  verbiage: verbiage,
22069
22265
  debugMode: debugMode
22070
- })))));
22266
+ }))))));
22071
22267
  };
22072
22268
 
22073
22269
  var ALLOWED_RETRIES$1 = 0;
@@ -22504,8 +22700,10 @@
22504
22700
  var CustomerIdentification = function CustomerIdentification(_a) {
22505
22701
  var _b = _a.lang,
22506
22702
  lang = _b === void 0 ? 'auto' : _b,
22507
- submissionToken = _a.submissionToken,
22703
+ sessionId = _a.sessionId,
22704
+ authUrl = _a.authUrl,
22508
22705
  submissionUrl = _a.submissionUrl,
22706
+ documentServiceUrl = _a.documentServiceUrl,
22509
22707
  companyId = _a.companyId,
22510
22708
  needImmediateResponse = _a.needImmediateResponse,
22511
22709
  webhooksEnabled = _a.webhooksEnabled,
@@ -22521,6 +22719,10 @@
22521
22719
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
22522
22720
  _f = _a.skipSuccessScreen,
22523
22721
  skipSuccessScreen = _f === void 0 ? false : _f,
22722
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
22723
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
22724
+ onDocumentUploaded = _a.onDocumentUploaded,
22725
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
22524
22726
  onBeforeSubmit = _a.onBeforeSubmit,
22525
22727
  onSubmit = _a.onSubmit,
22526
22728
  onComplete = _a.onComplete,
@@ -22543,12 +22745,15 @@
22543
22745
  _j = _a.debugMode,
22544
22746
  debugMode = _j === void 0 ? false : _j;
22545
22747
  useLanguage(lang);
22546
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22748
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
22749
+ sessionId: sessionId,
22750
+ authUrl: authUrl
22751
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22547
22752
  theme: theme
22548
22753
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
22549
22754
  action: SubmissionAction.IDENTIFY,
22550
- url: submissionUrl,
22551
- token: submissionToken,
22755
+ submissionUrl: submissionUrl,
22756
+ documentServiceUrl: documentServiceUrl,
22552
22757
  companyId: companyId,
22553
22758
  needImmediateResponse: needImmediateResponse,
22554
22759
  webhooksEnabled: webhooksEnabled,
@@ -22556,6 +22761,10 @@
22556
22761
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
22557
22762
  webhooksSendInputImages: webhooksSendInputImages,
22558
22763
  webhooksSendProcessedImages: webhooksSendProcessedImages,
22764
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
22765
+ onDocumentUploadProgress: onDocumentUploadProgress,
22766
+ onDocumentUploaded: onDocumentUploaded,
22767
+ onDocumentUploadFailed: onDocumentUploadFailed,
22559
22768
  onBeforeSubmit: onBeforeSubmit,
22560
22769
  onSubmit: onSubmit,
22561
22770
  geolocationEnabled: geolocationEnabled,
@@ -22582,15 +22791,21 @@
22582
22791
  colors: colors,
22583
22792
  verbiage: verbiage,
22584
22793
  debugMode: debugMode
22585
- })))));
22794
+ }))))));
22586
22795
  };
22587
22796
 
22588
22797
  /** Render a fullscreen capture component that captures a video of the user signing the screen. */
22589
22798
  var SignatureKYC = function SignatureKYC(_a) {
22590
22799
  var _b = _a.lang,
22591
22800
  lang = _b === void 0 ? 'auto' : _b,
22592
- submissionToken = _a.submissionToken,
22801
+ sessionId = _a.sessionId,
22802
+ authUrl = _a.authUrl,
22593
22803
  submissionUrl = _a.submissionUrl,
22804
+ documentServiceUrl = _a.documentServiceUrl,
22805
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
22806
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
22807
+ onDocumentUploaded = _a.onDocumentUploaded,
22808
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
22594
22809
  onBeforeSubmit = _a.onBeforeSubmit,
22595
22810
  onSubmit = _a.onSubmit,
22596
22811
  onComplete = _a.onComplete,
@@ -22600,6 +22815,7 @@
22600
22815
  loadingOverlayMode = _c === void 0 ? 'default' : _c,
22601
22816
  _d = _a.skipSuccessScreen,
22602
22817
  skipSuccessScreen = _d === void 0 ? false : _d,
22818
+ idCardForFaceMatch = _a.idCardForFaceMatch,
22603
22819
  _e = _a.modelLoadTimeoutMs,
22604
22820
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
22605
22821
  _f = _a.theme,
@@ -22614,12 +22830,25 @@
22614
22830
  var _g = React.useState(0),
22615
22831
  attempt = _g[0],
22616
22832
  setAttempt = _g[1];
22617
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22833
+ var onRetryClicked = React.useCallback(function () {
22834
+ setAttempt(function (n) {
22835
+ return n + 1;
22836
+ });
22837
+ }, []);
22838
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
22839
+ sessionId: sessionId,
22840
+ authUrl: authUrl
22841
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22618
22842
  theme: theme
22619
22843
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
22620
22844
  action: SubmissionAction.NONE,
22621
- url: submissionUrl,
22622
- token: submissionToken,
22845
+ submissionUrl: submissionUrl,
22846
+ documentServiceUrl: documentServiceUrl,
22847
+ idCardForFaceMatch: idCardForFaceMatch,
22848
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
22849
+ onDocumentUploadProgress: onDocumentUploadProgress,
22850
+ onDocumentUploaded: onDocumentUploaded,
22851
+ onDocumentUploadFailed: onDocumentUploadFailed,
22623
22852
  onBeforeSubmit: onBeforeSubmit,
22624
22853
  onSubmit: onSubmit,
22625
22854
  onResponseReceived: onComplete,
@@ -22640,12 +22869,8 @@
22640
22869
  verbiage: verbiage,
22641
22870
  onModelError: onModelError,
22642
22871
  onUserCancel: onUserCancel,
22643
- onRetryClicked: function onRetryClicked() {
22644
- setAttempt(function (n) {
22645
- return n + 1;
22646
- });
22647
- }
22648
- }))));
22872
+ onRetryClicked: onRetryClicked
22873
+ })))));
22649
22874
  };
22650
22875
 
22651
22876
  /**
@@ -22654,8 +22879,10 @@
22654
22879
  var VideoIdValidation = function VideoIdValidation(_a) {
22655
22880
  var _b = _a.lang,
22656
22881
  lang = _b === void 0 ? 'auto' : _b,
22657
- submissionToken = _a.submissionToken,
22882
+ sessionId = _a.sessionId,
22883
+ authUrl = _a.authUrl,
22658
22884
  submissionUrl = _a.submissionUrl,
22885
+ documentServiceUrl = _a.documentServiceUrl,
22659
22886
  companyId = _a.companyId,
22660
22887
  needImmediateResponse = _a.needImmediateResponse,
22661
22888
  manualReviewRequired = _a.manualReviewRequired,
@@ -22671,6 +22898,10 @@
22671
22898
  webhooksSendInputImages = _a.webhooksSendInputImages,
22672
22899
  webhooksSendProcessedImages = _a.webhooksSendProcessedImages,
22673
22900
  webhooksFireOnReview = _a.webhooksFireOnReview,
22901
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
22902
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
22903
+ onDocumentUploaded = _a.onDocumentUploaded,
22904
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
22674
22905
  onSubmit = _a.onSubmit,
22675
22906
  onBeforeSubmit = _a.onBeforeSubmit,
22676
22907
  onComplete = _a.onComplete,
@@ -22710,6 +22941,7 @@
22710
22941
  idCapturePortraitGuidesOnMobile = _r === void 0 ? false : _r,
22711
22942
  _s = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
22712
22943
  idCaptureRotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
22944
+ idCardForFaceMatch = _a.idCardForFaceMatch,
22713
22945
  _t = _a.faceLivenessLoadingOverlayMode,
22714
22946
  faceLivenessLoadingOverlayMode = _t === void 0 ? 'default' : _t,
22715
22947
  _u = _a.theme,
@@ -22790,12 +23022,15 @@
22790
23022
  debugMode: debugMode
22791
23023
  };
22792
23024
  }, [classNames.videoSignatureCapture, colors.videoSignatureCapture, debugMode, onExitCapture, onUserCancel, skipSuccessScreen, verbiage.videoSignatureCapture]);
22793
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
23025
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
23026
+ sessionId: sessionId,
23027
+ authUrl: authUrl
23028
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22794
23029
  theme: theme
22795
23030
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
22796
23031
  action: skipIdCapture ? SubmissionAction.NONE : SubmissionAction.VALIDATE,
22797
- url: submissionUrl,
22798
- token: submissionToken,
23032
+ submissionUrl: submissionUrl,
23033
+ documentServiceUrl: documentServiceUrl,
22799
23034
  companyId: companyId,
22800
23035
  needImmediateResponse: needImmediateResponse,
22801
23036
  manualReviewRequired: manualReviewRequired,
@@ -22811,6 +23046,11 @@
22811
23046
  webhooksSendInputImages: webhooksSendInputImages,
22812
23047
  webhooksSendProcessedImages: webhooksSendProcessedImages,
22813
23048
  webhooksFireOnReview: webhooksFireOnReview,
23049
+ idCardForFaceMatch: idCardForFaceMatch,
23050
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
23051
+ onDocumentUploadProgress: onDocumentUploadProgress,
23052
+ onDocumentUploaded: onDocumentUploaded,
23053
+ onDocumentUploadFailed: onDocumentUploadFailed,
22814
23054
  onSubmit: onSubmit,
22815
23055
  onBeforeSubmit: onBeforeSubmit,
22816
23056
  onResponseReceived: onComplete,
@@ -22827,7 +23067,7 @@
22827
23067
  captureSignature: captureSignature,
22828
23068
  captureSignatureVideo: captureSignatureVideo,
22829
23069
  debugMode: debugMode
22830
- })));
23070
+ }))));
22831
23071
  };
22832
23072
 
22833
23073
  /** 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. */
@@ -22835,8 +23075,10 @@
22835
23075
  var enrollmentId = _a.enrollmentId,
22836
23076
  _b = _a.lang,
22837
23077
  lang = _b === void 0 ? 'auto' : _b,
22838
- submissionToken = _a.submissionToken,
23078
+ sessionId = _a.sessionId,
23079
+ authUrl = _a.authUrl,
22839
23080
  submissionUrl = _a.submissionUrl,
23081
+ documentServiceUrl = _a.documentServiceUrl,
22840
23082
  companyId = _a.companyId,
22841
23083
  needImmediateResponse = _a.needImmediateResponse,
22842
23084
  deduplicationEnabled = _a.deduplicationEnabled,
@@ -22854,6 +23096,10 @@
22854
23096
  modelLoadTimeoutMs = _e === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _e,
22855
23097
  _f = _a.skipSuccessScreen,
22856
23098
  skipSuccessScreen = _f === void 0 ? false : _f,
23099
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
23100
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
23101
+ onDocumentUploaded = _a.onDocumentUploaded,
23102
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
22857
23103
  onBeforeSubmit = _a.onBeforeSubmit,
22858
23104
  onSubmit = _a.onSubmit,
22859
23105
  onComplete = _a.onComplete,
@@ -22935,12 +23181,15 @@
22935
23181
  onDenied === null || onDenied === void 0 ? void 0 : onDenied(resp, req);
22936
23182
  }
22937
23183
  }, [onEnrolled, onComplete, onDenied]);
22938
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
23184
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
23185
+ sessionId: sessionId,
23186
+ authUrl: authUrl
23187
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
22939
23188
  theme: theme
22940
23189
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
22941
23190
  action: SubmissionAction.ENROLL,
22942
- url: submissionUrl,
22943
- token: submissionToken,
23191
+ submissionUrl: submissionUrl,
23192
+ documentServiceUrl: documentServiceUrl,
22944
23193
  companyId: companyId,
22945
23194
  enrollmentId: enrollmentId,
22946
23195
  needImmediateResponse: needImmediateResponse,
@@ -22951,6 +23200,10 @@
22951
23200
  webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
22952
23201
  webhooksSendInputImages: webhooksSendInputImages,
22953
23202
  webhooksSendProcessedImages: webhooksSendProcessedImages,
23203
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
23204
+ onDocumentUploadProgress: onDocumentUploadProgress,
23205
+ onDocumentUploaded: onDocumentUploaded,
23206
+ onDocumentUploadFailed: onDocumentUploadFailed,
22954
23207
  onBeforeSubmit: onBeforeSubmit,
22955
23208
  onSubmit: onSubmit,
22956
23209
  onResponseReceived: onResponseReceived,
@@ -22967,7 +23220,7 @@
22967
23220
  captureSignature: captureSignature,
22968
23221
  captureSignatureVideo: captureSignatureVideo,
22969
23222
  debugMode: debugMode
22970
- })));
23223
+ }))));
22971
23224
  };
22972
23225
 
22973
23226
  /**
@@ -22976,11 +23229,15 @@
22976
23229
  var DocumentCapture = function DocumentCapture(_a) {
22977
23230
  var _b = _a.lang,
22978
23231
  lang = _b === void 0 ? 'auto' : _b,
22979
- submissionToken = _a.submissionToken,
23232
+ sessionId = _a.sessionId,
23233
+ authUrl = _a.authUrl,
22980
23234
  submissionUrl = _a.submissionUrl,
22981
23235
  documentServiceUrl = _a.documentServiceUrl,
22982
- onComplete = _a.onComplete,
23236
+ onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
23237
+ onDocumentUploadProgress = _a.onDocumentUploadProgress,
22983
23238
  onDocumentUploaded = _a.onDocumentUploaded,
23239
+ onDocumentUploadFailed = _a.onDocumentUploadFailed,
23240
+ onComplete = _a.onComplete,
22984
23241
  onExitCapture = _a.onExitCapture,
22985
23242
  onUserCancel = _a.onUserCancel,
22986
23243
  _c = _a.documents,
@@ -23001,13 +23258,19 @@
23001
23258
  _j = _a.debugMode,
23002
23259
  debugMode = _j === void 0 ? false : _j;
23003
23260
  useLanguage(lang);
23004
- return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
23261
+ return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
23262
+ sessionId: sessionId,
23263
+ authUrl: authUrl
23264
+ }, /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
23005
23265
  theme: theme
23006
23266
  }, /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
23007
23267
  action: SubmissionAction.NONE,
23008
- url: submissionUrl,
23009
- token: submissionToken,
23268
+ submissionUrl: submissionUrl,
23010
23269
  documentServiceUrl: documentServiceUrl,
23270
+ onBeforeDocumentUpload: onBeforeDocumentUpload,
23271
+ onDocumentUploadProgress: onDocumentUploadProgress,
23272
+ onDocumentUploaded: onDocumentUploaded,
23273
+ onDocumentUploadFailed: onDocumentUploadFailed,
23011
23274
  geolocationEnabled: geolocationEnabled,
23012
23275
  geolocationRequired: geolocationRequired
23013
23276
  }, /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
@@ -23015,7 +23278,6 @@
23015
23278
  debugMode: debugMode
23016
23279
  }, /*#__PURE__*/React__default['default'].createElement(DocumentCaptureWizard, {
23017
23280
  onSuccess: onComplete,
23018
- onDocumentUploaded: onDocumentUploaded,
23019
23281
  onExitCapture: onExitCapture,
23020
23282
  onUserCancel: onUserCancel,
23021
23283
  documents: documents,
@@ -23024,7 +23286,7 @@
23024
23286
  instructions: instructions,
23025
23287
  classNames: classNames,
23026
23288
  verbiage: verbiage
23027
- }))));
23289
+ })))));
23028
23290
  };
23029
23291
 
23030
23292
  initializeI18n();
@@ -23101,7 +23363,11 @@
23101
23363
  preloadModels: preloadModels,
23102
23364
  themes: themes,
23103
23365
  version: webSdkVersion,
23104
- ready: true
23366
+ ready: true,
23367
+ authMode: 'session',
23368
+ allowedAuthUrls: allowedAuthUrls,
23369
+ defaultAuthUrl: defaultAuthUrl,
23370
+ defaultSubmissionUrl: defaultSubmissionUrl
23105
23371
  };
23106
23372
 
23107
23373
  var __assign = (undefined && undefined.__assign) || function () {
@@ -23628,6 +23894,9 @@
23628
23894
  exports.IdValidation = IdValidation;
23629
23895
  exports.SignatureKYC = SignatureKYC;
23630
23896
  exports.VideoIdValidation = VideoIdValidation;
23897
+ exports.allowedAuthUrls = allowedAuthUrls;
23898
+ exports.defaultAuthUrl = defaultAuthUrl;
23899
+ exports.defaultSubmissionUrl = defaultSubmissionUrl;
23631
23900
  exports.preloadModels = preloadModels;
23632
23901
  exports.renderCustomerBiometricsEnrollment = renderCustomerBiometricsEnrollment;
23633
23902
  exports.renderCustomerIdAndBiometricsEnrollment = renderCustomerIdAndBiometricsEnrollment;