@idscan/onboarding 2.10.0 → 2.10.1

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 (41) hide show
  1. package/dist/Wrapper.css +1 -1
  2. package/dist/Wrapper.d.ts +223 -0
  3. package/dist/src/Wrapper.d.ts +2 -1
  4. package/dist/wrapper.es.js +296 -172
  5. package/dist/wrapper.umd.js +1 -2
  6. package/package.json +25 -12
  7. package/readme.md +4 -0
  8. package/dist/custom_types/custom.d.ts +0 -20
  9. package/dist/src/@types/Api/Requests.d.ts +0 -22
  10. package/dist/src/@types/Api/Responses.d.ts +0 -97
  11. package/dist/src/@types/Data.d.ts +0 -110
  12. package/dist/src/@types/IDVCTypes.d.ts +0 -5
  13. package/dist/src/@types/Step.d.ts +0 -26
  14. package/dist/src/@types/enums.d.ts +0 -89
  15. package/dist/src/config.d.ts +0 -35
  16. package/dist/src/entry.d.ts +0 -1
  17. package/dist/src/errors/ConfigError.d.ts +0 -4
  18. package/dist/src/errors/FaceAuthorizationError.d.ts +0 -6
  19. package/dist/src/errors/HttpError.d.ts +0 -4
  20. package/dist/src/errors/NotValidApplicant.d.ts +0 -4
  21. package/dist/src/errors/RequestTimeoutError.d.ts +0 -4
  22. package/dist/src/errors/ValidationError.d.ts +0 -6
  23. package/dist/src/errors/WrapperError.d.ts +0 -5
  24. package/dist/src/helpers/fingerPrint.d.ts +0 -19
  25. package/dist/src/helpers/mobileChecker.d.ts +0 -15
  26. package/dist/src/helpers/requestModelCheckers.d.ts +0 -4
  27. package/dist/src/helpers/typeGuard.d.ts +0 -1
  28. package/dist/src/helpers/utils.d.ts +0 -9
  29. package/dist/src/helpers/validators.d.ts +0 -7
  30. package/dist/src/mocks/defaultValues.d.ts +0 -2
  31. package/dist/src/mocks/validation.json.d.ts +0 -9
  32. package/dist/src/modules/Api.d.ts +0 -21
  33. package/dist/src/modules/ConsentForm.d.ts +0 -19
  34. package/dist/src/modules/Lib.d.ts +0 -24
  35. package/dist/src/modules/Modal.d.ts +0 -26
  36. package/dist/src/modules/QRCodeModal.d.ts +0 -25
  37. package/dist/src/modules/Validation.d.ts +0 -24
  38. package/dist/src/modules/ValidationModal.d.ts +0 -15
  39. package/dist/vite.config.d.ts +0 -2
  40. package/dist/wrapper.es.js.map +0 -1
  41. package/dist/wrapper.umd.js.map +0 -1
@@ -523,7 +523,7 @@ function requireRuntime() {
523
523
  }
524
524
  requireRuntime();
525
525
  const notEmptyString = (val) => !!val;
526
- const isUUID = (str) => !!str.match(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/);
526
+ const isUUID = (str) => !!/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/.test(str);
527
527
  const isPublicKey = (str) => str.toLowerCase().startsWith("pk_") && isUUID(str);
528
528
  const isElExist = (str) => !!document.getElementById(str);
529
529
  const isPackageVersionNumber = (input) => {
@@ -677,10 +677,7 @@ const defaultDocumentTypes = [
677
677
  ]
678
678
  }
679
679
  ];
680
- const createGuid = () => {
681
- const s4 = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
682
- return `${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`;
683
- };
680
+ const createGuid = () => crypto.randomUUID();
684
681
  const getFilteredDocumentTypes = (documentTypes) => {
685
682
  if (!documentTypes) {
686
683
  return [];
@@ -693,15 +690,15 @@ const getFilteredDocumentTypes = (documentTypes) => {
693
690
  steps: document2.steps
694
691
  }));
695
692
  };
696
- const prepareDocumentTypes = (config) => {
693
+ const prepareDocumentTypes = (settings) => {
697
694
  let result;
698
- const filteredDocuments = getFilteredDocumentTypes(config.documentTypes);
699
- const passportDocument = filteredDocuments.find((document2) => document2.type === "Passport");
700
- if (passportDocument) {
695
+ const filteredDocuments = getFilteredDocumentTypes(settings.documentTypes);
696
+ const passportDocument2 = filteredDocuments.find((document2) => document2.type === "Passport");
697
+ if (passportDocument2) {
701
698
  const mrzPassport = { type: "mrz", name: "Passport MRZ", mode: { uploader: true, video: true } };
702
- const frontStepIndex = passportDocument.steps.findIndex((step) => step.type === "front");
699
+ const frontStepIndex = passportDocument2.steps.findIndex((step) => step.type === "front");
703
700
  if (frontStepIndex !== -1) {
704
- passportDocument.steps.splice(frontStepIndex, 1, mrzPassport);
701
+ passportDocument2.steps.splice(frontStepIndex, 1, mrzPassport);
705
702
  }
706
703
  }
707
704
  if (filteredDocuments.length === 0) {
@@ -780,19 +777,19 @@ class Configs {
780
777
  }
781
778
  }
782
779
  parseFromWeb(options) {
783
- const parsedIDVCConfig = JSON.parse(options == null ? void 0 : options.jsonSettings);
780
+ const settings = JSON.parse(options == null ? void 0 : options.jsonSettings);
784
781
  if (this.isAuth || this.faceOnly) {
785
- this.libConfig = this.faceAuthorizationConfig(parsedIDVCConfig);
782
+ this.libConfig = this.faceAuthorizationConfig(settings);
786
783
  } else {
787
- parsedIDVCConfig.documentTypes = prepareDocumentTypes(parsedIDVCConfig);
788
- this.libConfig = parsedIDVCConfig;
784
+ settings.documentTypes = prepareDocumentTypes(settings);
785
+ this.libConfig = settings;
789
786
  }
790
787
  this.cssStyles = options == null ? void 0 : options.cssStyles;
791
788
  this.cssVariables = options == null ? void 0 : options.cssVariables;
792
789
  }
793
- faceAuthorizationConfig(jsonSettings) {
794
- jsonSettings.isShowDocumentTypeSelect = false;
795
- jsonSettings.documentTypes = [
790
+ faceAuthorizationConfig(settings) {
791
+ settings.isShowDocumentTypeSelect = false;
792
+ settings.documentTypes = [
796
793
  {
797
794
  type: "DL",
798
795
  steps: [
@@ -800,7 +797,7 @@ class Configs {
800
797
  ]
801
798
  }
802
799
  ];
803
- return jsonSettings;
800
+ return settings;
804
801
  }
805
802
  getFirstStepModeState() {
806
803
  const firstStepMode = structuredClone(this.firstStepMode);
@@ -980,10 +977,131 @@ class RequestTimeoutError extends WrapperError {
980
977
  this.content = "This application is closed";
981
978
  }
982
979
  }
983
- const success = { "validationResponseId": 6223, "validationRequestId": "8151f48d-bab1-4491-037d-08d9b3c5cfec", "documentType": 1, "document": { "abbr3Country": "USA", "abbrCountry": "US", "address": "25805 VAN LEUVEN ST 136", "city": "LOMA LINDA", "class": "C", "country": "United States of America", "dob": "1961-01-07", "expires": "2024-01-07", "eyes": "Brown", "familyName": "GILMER", "firstName": "DARIENNE", "fullName": "DARIENNE ELIZABETH GILMER", "gender": "Female", "hair": "Black", "height": "064 IN", "id": "C3568758", "idType": "DL", "issued": "2019-01-07", "middleName": "ELIZABETH", "postalBox": null, "privateName": "ELIZABETH", "state": "CA", "template": "09", "weight": "77", "zip": "92354-0000" }, "attemptsLeft": 0, "status": 0, "validationStatus": { "expired": false, "documentIsValid": true, "faceIsValid": true }, "invalidDataErrors": null, "faceSuccess": null, "documentSuccess": null, "documentHasNotExpired": null, "documentValidationTests": [{ "displayName": "DMV", "name": "DMVValidation", "status": 0, "statusString": "Failed", "reason": "Internal Server Error" }, { "displayName": "IdentiFraud", "name": "IdentiFraudValidation", "status": -1, "statusString": "Disabled", "reason": "Integration was turned off" }] };
984
- const json$4 = {
985
- success
980
+ const dlDocument = {
981
+ abbr3Country: "USA",
982
+ abbrCountry: "US",
983
+ address: "25805 VAN LEUVEN ST 136",
984
+ city: "LOMA LINDA",
985
+ class: "C",
986
+ country: "United States of America",
987
+ dob: "1961-01-07",
988
+ expires: "2024-01-07",
989
+ eyes: "Brown",
990
+ familyName: "GILMER",
991
+ firstName: "DARIENNE",
992
+ fullName: "DARIENNE ELIZABETH GILMER",
993
+ gender: "Female",
994
+ hair: "Black",
995
+ height: "064 IN",
996
+ id: "C3568758",
997
+ idType: "DL",
998
+ issued: "2019-01-07",
999
+ middleName: "ELIZABETH",
1000
+ postalBox: null,
1001
+ privateName: "ELIZABETH",
1002
+ state: "CA",
1003
+ template: "09",
1004
+ weight: "77",
1005
+ zip: "92354-0000"
1006
+ };
1007
+ const passportDocument = {
1008
+ abbr3Country: "USA",
1009
+ abbrCountry: "US",
1010
+ address: null,
1011
+ city: null,
1012
+ class: null,
1013
+ country: "United States of America",
1014
+ dob: "1986-07-24",
1015
+ expires: "2030-07-13",
1016
+ eyes: null,
1017
+ familyName: "LEVELS",
1018
+ firstName: "DAVID HARRISON",
1019
+ fullName: "LEVELS DAVID HARRISON",
1020
+ gender: "M",
1021
+ hair: null,
1022
+ height: null,
1023
+ id: "659328258",
1024
+ idType: "PASSPORT",
1025
+ issued: null,
1026
+ middleName: null,
1027
+ postalBox: null,
1028
+ privateName: null,
1029
+ state: null,
1030
+ template: null,
1031
+ weight: null,
1032
+ zip: null
1033
+ };
1034
+ const base = {
1035
+ validationResponseId: 0,
1036
+ validationRequestId: "",
1037
+ documentType: 0,
1038
+ document: null,
1039
+ attemptsLeft: 0,
1040
+ attemptsCount: 0,
1041
+ status: 0,
1042
+ validationStatus: {
1043
+ expired: false,
1044
+ documentIsValid: false,
1045
+ faceIsValid: false
1046
+ },
1047
+ invalidDataErrors: null,
1048
+ faceSuccess: null,
1049
+ documentSuccess: null,
1050
+ documentHasNotExpired: null,
1051
+ documentValidationTests: null,
1052
+ callBackUrl: null,
1053
+ notificationType: 0,
1054
+ isCompleted: false
986
1055
  };
1056
+ const createValidationResponse = (overrides = {}) => ({ ...base, ...overrides });
1057
+ const success = createValidationResponse({
1058
+ validationResponseId: 6223,
1059
+ validationRequestId: "8151f48d-bab1-4491-037d-08d9b3c5cfec",
1060
+ documentType: 1,
1061
+ document: dlDocument,
1062
+ validationStatus: { expired: false, documentIsValid: true, faceIsValid: true },
1063
+ documentValidationTests: [
1064
+ { displayName: "DMV", name: "DMVValidation", status: 0, statusString: "Failed", reason: "Internal Server Error" },
1065
+ { displayName: "IdentiFraud", name: "IdentiFraudValidation", status: -1, statusString: "Disabled", reason: "Integration was turned off" }
1066
+ ]
1067
+ });
1068
+ createValidationResponse({
1069
+ validationResponseId: 6224,
1070
+ validationRequestId: "fa33df4c-7d5c-4485-037e-08d9b3c5cfec",
1071
+ attemptsLeft: 19,
1072
+ status: 2,
1073
+ invalidDataErrors: [
1074
+ { code: "FaceDocNotDetectError", message: "The face has not been found on the document" },
1075
+ { code: "PDF417Error", message: "Unable to capture data from the back of the document" },
1076
+ { code: "OCRError", message: "Unable to capture data from the front of the document" }
1077
+ ]
1078
+ });
1079
+ createValidationResponse({
1080
+ validationResponseId: 6230,
1081
+ validationRequestId: "eae11ae1-1c8f-40bd-0381-08d9b3c5cfec",
1082
+ documentType: 2,
1083
+ document: passportDocument,
1084
+ attemptsLeft: 18,
1085
+ status: 1,
1086
+ validationStatus: { expired: false, documentIsValid: true, faceIsValid: false }
1087
+ });
1088
+ createValidationResponse({
1089
+ applicantId: "bb165b57-e8b1-412a-b848-2e4669da58e0",
1090
+ attemptId: 71441,
1091
+ documentType: 1,
1092
+ attemptsCount: 5,
1093
+ attemptsLeft: 5,
1094
+ status: 2,
1095
+ validationStatus: {
1096
+ expired: null,
1097
+ documentIsValid: null,
1098
+ faceIsValid: true,
1099
+ antiSpoofingIsValid: null
1100
+ },
1101
+ invalidDataErrors: [{ code: "QualityWarning", message: null }],
1102
+ hasRiskEvents: true,
1103
+ documentValidationTests: []
1104
+ });
987
1105
  class FaceAuthorizationError extends WrapperError {
988
1106
  constructor(error) {
989
1107
  super("FaceAuthorizationError");
@@ -1050,11 +1168,8 @@ var DocumentTypeIDs = /* @__PURE__ */ ((DocumentTypeIDs2) => {
1050
1168
  DocumentTypeIDs2[DocumentTypeIDs2["DL"] = 1] = "DL";
1051
1169
  DocumentTypeIDs2[DocumentTypeIDs2["Passport"] = 2] = "Passport";
1052
1170
  DocumentTypeIDs2[DocumentTypeIDs2["PassportCard"] = 3] = "PassportCard";
1053
- DocumentTypeIDs2[DocumentTypeIDs2["CommonAccessCardOld"] = 4] = "CommonAccessCardOld";
1054
- DocumentTypeIDs2[DocumentTypeIDs2["CommonAccessCard"] = 5] = "CommonAccessCard";
1055
1171
  DocumentTypeIDs2[DocumentTypeIDs2["GreenCard"] = 6] = "GreenCard";
1056
1172
  DocumentTypeIDs2[DocumentTypeIDs2["InternationalId"] = 7] = "InternationalId";
1057
- DocumentTypeIDs2[DocumentTypeIDs2["VIN"] = 8] = "VIN";
1058
1173
  DocumentTypeIDs2[DocumentTypeIDs2["Barcode"] = 11] = "Barcode";
1059
1174
  DocumentTypeIDs2[DocumentTypeIDs2["FaceAuthorization"] = 10] = "FaceAuthorization";
1060
1175
  DocumentTypeIDs2[DocumentTypeIDs2["EmploymentAuthorization"] = 9] = "EmploymentAuthorization";
@@ -1077,12 +1192,10 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
1077
1192
  HttpStatus2[HttpStatus2["PreconditionFailed"] = 412] = "PreconditionFailed";
1078
1193
  HttpStatus2[HttpStatus2["LengthRequired"] = 411] = "LengthRequired";
1079
1194
  HttpStatus2[HttpStatus2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
1080
- HttpStatus2[HttpStatus2["RequestEntityTooLarge"] = 413] = "RequestEntityTooLarge";
1081
1195
  HttpStatus2[HttpStatus2["RequestURITooLong"] = 414] = "RequestURITooLong";
1082
1196
  HttpStatus2[HttpStatus2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
1083
1197
  HttpStatus2[HttpStatus2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
1084
1198
  HttpStatus2[HttpStatus2["ExpectationFailed"] = 417] = "ExpectationFailed";
1085
- HttpStatus2[HttpStatus2["ImATextDocument"] = 423] = "ImATextDocument";
1086
1199
  HttpStatus2[HttpStatus2["Locked"] = 423] = "Locked";
1087
1200
  HttpStatus2[HttpStatus2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
1088
1201
  HttpStatus2[HttpStatus2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
@@ -1172,7 +1285,7 @@ class Api {
1172
1285
  }
1173
1286
  async validateApplicant(data, demoMode = false, isFaceAuth = false) {
1174
1287
  if (demoMode) {
1175
- return json$4.success;
1288
+ return success;
1176
1289
  }
1177
1290
  const url = `${this.baseUrl}Validation`;
1178
1291
  const response = await fetch(url, {
@@ -1220,10 +1333,10 @@ class Api {
1220
1333
  method: "POST",
1221
1334
  headers: this.HEADERS
1222
1335
  });
1223
- if (!response.ok) {
1224
- throw new Error(`Request Error: ${response.status}`);
1225
- } else {
1336
+ if (response.ok) {
1226
1337
  callback();
1338
+ } else {
1339
+ throw new Error(`Request Error: ${response.status}`);
1227
1340
  }
1228
1341
  } catch (e) {
1229
1342
  if (e instanceof HttpError) {
@@ -1269,11 +1382,11 @@ const checkBackOrSecondImageProcessing = (documentType, steps) => {
1269
1382
  if (!backStep) {
1270
1383
  return false;
1271
1384
  }
1272
- const allowedDocumentTypeIDs = (_a = processingCheckMap[backStep.type]) == null ? void 0 : _a.includes(documentType);
1385
+ const allowedDocumentTypeIDs = (_a = processingCheckMap[backStep.type]) == null ? void 0 : _a.some((id) => id === documentType);
1273
1386
  return allowedDocumentTypeIDs ?? false;
1274
1387
  };
1275
1388
  const checkOcrEnabled = (documentType, steps) => {
1276
- const isPassportFront = !!steps.find((step) => step.type === "mrz");
1389
+ const isPassportFront = steps.some((step) => step.type === "mrz");
1277
1390
  if (documentType === DocumentTypeIDs.Passport && isPassportFront) {
1278
1391
  return true;
1279
1392
  }
@@ -1286,8 +1399,8 @@ class Lib {
1286
1399
  if (!base64EncodedImage || !isString(base64EncodedImage)) return "";
1287
1400
  const splitPattern = /:image\/\w+;base64,/;
1288
1401
  const parts = base64EncodedImage.split(splitPattern);
1289
- if (parts.length) {
1290
- return parts[parts.length - 1];
1402
+ if (parts.length > 0) {
1403
+ return parts.at(-1) ?? "";
1291
1404
  }
1292
1405
  return "";
1293
1406
  };
@@ -1325,9 +1438,9 @@ class Lib {
1325
1438
  faceImageBase64: this.cleanBase64((_a = data.steps.find((item) => item.type === "face")) == null ? void 0 : _a.img),
1326
1439
  trackString: back.trackString,
1327
1440
  ssn: "",
1328
- verifyFace: !!data.steps.find((item) => item.type === "face"),
1441
+ verifyFace: data.steps.some((item) => item.type === "face"),
1329
1442
  documentType: data.documentType,
1330
- captureMethod: data.steps.reduce((acc, step) => `${acc}${+step.isAuto}`, ""),
1443
+ captureMethod: data.steps.reduce((acc, step) => `${acc}${Number(step.isAuto ?? false)}`, ""),
1331
1444
  userAgent: window.navigator.userAgent,
1332
1445
  frontEndMetadata: data.metaData,
1333
1446
  isBackOrSecondImageProcessingEnabled: checkBackOrSecondImageProcessing(
@@ -1342,8 +1455,10 @@ class Lib {
1342
1455
  if (!this.library) {
1343
1456
  if (loadIDVCFromCDN) {
1344
1457
  await this.loadFromCDN(idvcVersion);
1345
- } else {
1458
+ } else if (IDVCModule) {
1346
1459
  this.loadFromNodeModules(IDVCModule);
1460
+ } else {
1461
+ throw new Error("IDVCModule must be provided when not loading from CDN");
1347
1462
  }
1348
1463
  this.postInitialize();
1349
1464
  }
@@ -1356,9 +1471,9 @@ class Lib {
1356
1471
  const script = document.createElement("script");
1357
1472
  script.src = `https://neurons.cdn.idscan.net/${idvcVersion}-next/idvc.js`;
1358
1473
  script.async = true;
1359
- script.onload = () => resolve(window.IDVC);
1360
- script.onerror = reject;
1361
- document.body.appendChild(script);
1474
+ script.addEventListener("load", () => resolve(window.IDVC));
1475
+ script.addEventListener("error", reject);
1476
+ document.body.append(script);
1362
1477
  }).then((IDVCFromCDN) => {
1363
1478
  this.library = new IDVCFromCDN(this.IdvcConfig);
1364
1479
  }).catch((err) => {
@@ -1383,8 +1498,8 @@ class Lib {
1383
1498
  }
1384
1499
  postInitialize() {
1385
1500
  document.head.insertAdjacentHTML("beforeend", `
1386
- <style id="onboarding-css-variables">${this.CSSVariablesConfig ? this.CSSVariablesConfig : ""}</style>
1387
- <style id="onboarding-css-config">${this.CSSStylesConfig ? this.CSSStylesConfig : ""}</style>
1501
+ <style id="onboarding-css-variables">${this.CSSVariablesConfig ?? ""}</style>
1502
+ <style id="onboarding-css-config">${this.CSSStylesConfig ?? ""}</style>
1388
1503
  `);
1389
1504
  }
1390
1505
  reloadComponent(newConfig) {
@@ -1415,8 +1530,10 @@ class Lib {
1415
1530
  };
1416
1531
  }
1417
1532
  }
1418
- const validationModalHTML = '<div class="idvc-modal-background" id="idvc-modal-background">\n <div class="el-loading-spinner" id="idvc-loading-spinner">\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n </div>\n</div>\n<div class="idvc-modal idvc-modal_validation d-none" id="idvc-modal">\n <div class="idvc-modal__header">\n <svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8 1C9.97933 1.052 11.6278 1.73683 12.9455 3.0545C14.2632 4.37217 14.948 6.02067 15 8C14.948 9.97933 14.2632 11.6278 12.9455 12.9455C11.6278 14.2632 9.97933 14.948 8 15C6.02067 14.948 4.37217 14.2632 3.0545 12.9455C1.73683 11.6278 1.052 9.97933 1 8C1.052 6.02067 1.73683 4.37217 3.0545 3.0545C4.37217 1.73683 6.02067 1.052 8 1ZM8 4C7.729 4 7.505 4.099 7.328 4.297C7.151 4.495 7.07283 4.72933 7.0935 5L7.453 9C7.474 9.146 7.53383 9.26317 7.6325 9.3515C7.73117 9.43983 7.8535 9.48417 7.9995 9.4845C8.1455 9.48483 8.26783 9.4405 8.3665 9.3515C8.46517 9.2625 8.525 9.14533 8.546 9L8.9055 5C8.9265 4.729 8.84833 4.49467 8.671 4.297C8.49367 4.09933 8.27067 4.00033 8 4ZM8 12C8.22933 11.9897 8.4195 11.9115 8.5705 11.7655C8.7215 11.6195 8.797 11.432 8.797 11.203C8.797 10.974 8.7215 10.7838 8.5705 10.6325C8.4195 10.4812 8.22933 10.4057 8 10.406C7.77067 10.4063 7.5805 10.4818 7.4295 10.6325C7.2785 10.7832 7.203 10.9733 7.203 11.203C7.203 11.4327 7.2785 11.6202 7.4295 11.7655C7.5805 11.9108 7.77067 11.989 8 12Z" fill="#1C1C1C"/>\n </svg>\n <h2 class="idvc-modal__header__content">\n Header\n </h2>\n <div class="idvc-modal__close-btn" id="idvc-close-modal-btn">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg>\n </div>\n </div>\n <div class="idvc-modal__body">\n Please try again\n </div>\n <div class="idvc-modal__footer">\n <button type="button" class="btn btn--primary" id="idvc-modal-try-again-btn"><span>Try again</span></button>\n <button type="button" class="btn btn--default" id="idvc-modal-complete-btn"><span>Complete </span></button>\n </div>\n</div>\n';
1419
- const modalHTML = '<div class="idvc-modal d-none" id="idvc-modal">\n <div class="idvc-modal__close-btn" id="idvc-close-modal-btn"></div>\n <div class="idvc-modal__header">\n <h2 class="idvc-modal__header__content"></h2>\n </div>\n <div class="idvc-modal__body"></div>\n <div class="idvc-modal__footer"></div>\n</div>\n<div class="idvc-modal-background" id="idvc-modal-background">\n <div class="el-loading-spinner" id="idvc-loading-spinner">\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n </div>\n</div>\n';
1533
+ const validationModalHTML = '<div class="idvc-modal-background" id="idvc-modal-background">\n</div>\n<div class="idvc-modal idvc-modal_validation d-none" id="idvc-modal">\n <div class="el-loading-spinner d-none" id="idvc-loading-spinner">\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n </div>\n <div class="idvc-modal__header">\n <div class="idvc-modal__header__body">\n <div class="idvc-modal__header__sign">\n <div id="idvc-modal-header-sign-info"></div>\n <div id="idvc-modal-header-sign-check" class="d-none"></div>\n </div>\n <h2 class="idvc-modal__header__content">\n Header\n </h2>\n </div>\n <div class="idvc-modal__close-btn" id="idvc-close-modal-btn">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg>\n </div>\n </div>\n <div class="idvc-modal__body">\n Please try again\n </div>\n <div class="idvc-modal__footer">\n <button type="button" class="btn btn--primary" id="idvc-modal-try-again-btn"><span>Try again</span></button>\n <button type="button" class="btn btn--default" id="idvc-modal-complete-btn"><span>Complete </span></button>\n </div>\n</div>\n';
1534
+ const infoCircleSVG = '<svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8 1C9.97933 1.052 11.6278 1.73683 12.9455 3.0545C14.2632 4.37217 14.948 6.02067 15 8C14.948 9.97933 14.2632 11.6278 12.9455 12.9455C11.6278 14.2632 9.97933 14.948 8 15C6.02067 14.948 4.37217 14.2632 3.0545 12.9455C1.73683 11.6278 1.052 9.97933 1 8C1.052 6.02067 1.73683 4.37217 3.0545 3.0545C4.37217 1.73683 6.02067 1.052 8 1ZM8 4C7.729 4 7.505 4.099 7.328 4.297C7.151 4.495 7.07283 4.72933 7.0935 5L7.453 9C7.474 9.146 7.53383 9.26317 7.6325 9.3515C7.73117 9.43983 7.8535 9.48417 7.9995 9.4845C8.1455 9.48483 8.26783 9.4405 8.3665 9.3515C8.46517 9.2625 8.525 9.14533 8.546 9L8.9055 5C8.9265 4.729 8.84833 4.49467 8.671 4.297C8.49367 4.09933 8.27067 4.00033 8 4ZM8 12C8.22933 11.9897 8.4195 11.9115 8.5705 11.7655C8.7215 11.6195 8.797 11.432 8.797 11.203C8.797 10.974 8.7215 10.7838 8.5705 10.6325C8.4195 10.4812 8.22933 10.4057 8 10.406C7.77067 10.4063 7.5805 10.4818 7.4295 10.6325C7.2785 10.7832 7.203 10.9733 7.203 11.203C7.203 11.4327 7.2785 11.6202 7.4295 11.7655C7.5805 11.9108 7.77067 11.989 8 12Z"/>\n</svg>\n';
1535
+ const checkCircleSVG = '<svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path class="color-success" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>\n</svg>\n';
1536
+ const modalHTML = '<div class="idvc-modal d-none" id="idvc-modal">\n <div class="el-loading-spinner d-none" id="idvc-loading-spinner">\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n </div>\n <div class="idvc-modal__close-btn" id="idvc-close-modal-btn"></div>\n <div class="idvc-modal__header">\n <h2 class="idvc-modal__header__content"></h2>\n </div>\n <div class="idvc-modal__body"></div>\n <div class="idvc-modal__footer"></div>\n</div>\n<div class="idvc-modal-background" id="idvc-modal-background">\n</div>\n';
1420
1537
  class Modal {
1421
1538
  constructor(mountEl) {
1422
1539
  this._closable = true;
@@ -1498,16 +1615,20 @@ class Modal {
1498
1615
  this.background.classList.remove("idvc-preload-element");
1499
1616
  }
1500
1617
  show() {
1501
- const circular = this.modalContainer.querySelector(".circular");
1502
- circular.classList.add("d-none");
1503
1618
  this.showBackground = true;
1504
1619
  this.container.classList.remove("d-none");
1505
1620
  }
1506
1621
  showSpinner(val) {
1507
1622
  if (val) {
1508
1623
  this.spinner.classList.remove("d-none");
1624
+ this.headerContainer.classList.add("d-none");
1625
+ this.body.classList.add("d-none");
1626
+ this.footer.classList.add("d-none");
1509
1627
  } else {
1510
1628
  this.spinner.classList.add("d-none");
1629
+ this.headerContainer.classList.remove("d-none");
1630
+ this.body.classList.remove("d-none");
1631
+ this.footer.classList.remove("d-none");
1511
1632
  }
1512
1633
  }
1513
1634
  prepareBackgroundStyles() {
@@ -1518,61 +1639,64 @@ class Modal {
1518
1639
  class ValidationModal extends Modal {
1519
1640
  init(html2 = validationModalHTML) {
1520
1641
  super.init(html2);
1521
- this.headerSign = this.headerContainer.querySelector("path");
1642
+ this.headerInfoContainer = this.headerContainer.querySelector("#idvc-modal-header-sign-info");
1643
+ this.headerCheckContainer = this.headerContainer.querySelector("#idvc-modal-header-sign-check");
1644
+ this.headerInfoContainer.innerHTML = infoCircleSVG;
1645
+ this.headerCheckContainer.innerHTML = checkCircleSVG;
1646
+ this.headerInfoSvg = this.headerInfoContainer.querySelector("svg");
1522
1647
  this.tryAgainBtn = this.container.querySelector("#idvc-modal-try-again-btn");
1523
1648
  this.completeBtn = this.container.querySelector("#idvc-modal-complete-btn");
1524
- this.addTryAgainHandler();
1649
+ this.tryAgainBtn.addEventListener("click", () => this.hide());
1525
1650
  this.addCompleteHandler();
1526
1651
  }
1527
- set type(rawType) {
1528
- if (rawType === ValidationStatus.SUCCESS) {
1529
- this.applySuccessValidationStyles();
1652
+ set type(status) {
1653
+ if (status === ValidationStatus.SUCCESS) {
1654
+ this.applySuccessStyles();
1655
+ } else {
1656
+ this.applyFailureStyles(status);
1530
1657
  }
1531
- this.headerSign.setAttribute("class", `color-${rawType}`);
1532
1658
  }
1533
1659
  set buttons({ tryAgain = false, complete = false }) {
1534
- const width = 100 / (+tryAgain + +complete);
1535
- const btnWidth = Number.isFinite(width) ? width : 0;
1536
- const widthClassName = `w-${btnWidth === 50 ? 45 : btnWidth}`;
1537
- this.setBtnVisible("tryAgain", tryAgain);
1538
- this.setBtnVisible("complete", complete);
1539
- if (!tryAgain && !complete) {
1660
+ const buttonsCount = +tryAgain + +complete;
1661
+ const hasButtons = buttonsCount > 0;
1662
+ const isSingleButton = buttonsCount === 1;
1663
+ this.setVisible(this.tryAgainBtn, tryAgain);
1664
+ this.setVisible(this.completeBtn, complete);
1665
+ if (hasButtons) {
1666
+ this.footer.classList.remove("d-none");
1667
+ } else {
1540
1668
  this.footer.classList.add("d-none");
1541
- this.footer.classList.remove("d-flex");
1669
+ }
1670
+ if (isSingleButton) {
1671
+ this.footer.classList.add("is-single-button");
1542
1672
  } else {
1543
- this.footer.classList.remove("d-none");
1544
- this.footer.classList.add("d-flex");
1673
+ this.footer.classList.remove("is-single-button");
1545
1674
  }
1546
- [this.tryAgainBtn, this.completeBtn].forEach((btn) => {
1547
- Array.from(btn.classList).forEach((className) => {
1548
- if (className.startsWith("w-")) {
1549
- btn.classList.remove(className);
1550
- }
1551
- });
1552
- btn.classList.add(widthClassName);
1553
- });
1554
1675
  }
1555
- applySuccessValidationStyles() {
1676
+ applySuccessStyles() {
1556
1677
  this.container.classList.add("center");
1557
1678
  this.headerContainer.classList.add("center");
1679
+ this.headerInfoContainer.classList.add("d-none");
1680
+ this.headerCheckContainer.classList.remove("d-none");
1558
1681
  }
1559
- setBtnVisible(btnName, visible) {
1560
- const btn = btnName === "tryAgain" ? this.tryAgainBtn : this.completeBtn;
1682
+ applyFailureStyles(status) {
1683
+ this.headerCheckContainer.classList.add("d-none");
1684
+ this.headerInfoContainer.classList.remove("d-none");
1685
+ this.headerInfoSvg.setAttribute("class", `color-${status}`);
1686
+ }
1687
+ setVisible(el, visible) {
1561
1688
  if (visible) {
1562
- btn.classList.remove("d-none");
1689
+ el.classList.remove("d-none");
1563
1690
  } else {
1564
- btn.classList.add("d-none");
1691
+ el.classList.add("d-none");
1565
1692
  }
1566
1693
  }
1567
- addTryAgainHandler() {
1568
- this.tryAgainBtn.onclick = () => this.hide();
1569
- }
1570
1694
  addCompleteHandler(handler = () => {
1571
1695
  }) {
1572
- this.completeBtn.onclick = () => {
1696
+ this.completeBtn.addEventListener("click", () => {
1573
1697
  this.hide();
1574
1698
  handler();
1575
- };
1699
+ });
1576
1700
  }
1577
1701
  }
1578
1702
  const html$1 = '<div class="idvc-consent-form" id="idvc-consent-form">\n <div class="idvc-consent-form__header">\n <h2 class="idvc-consent-form__header__content">\n Consent Agreement\n </h2>\n </div>\n <div class="idvc-consent-form__body" id="idvc-consent-form-body">\n <p id="idvc-consent-form-text">\n </p>\n <div class="input-wrapper">\n <label for="idvc-full-name-input">\n <span>\n <sup class="color-red">*</sup>\n Full Name\n </span>\n </label>\n <input\n type="text"\n name="fullName"\n id="idvc-full-name-input"\n >\n </div>\n <div class="checkbox-wrapper">\n <label class="checkbox-wrapper__star" for="idvc-consent">\n <span>\n <sup class="color-red">*</sup>\n </span>\n </label>\n <input type="checkbox" id="idvc-consent">\n <span class="checkbox-wrapper__text" id="checkbox-wrapper__text"></span>\n </div>\n </div>\n <div class="idvc-consent-form__footer">\n <button type="button" class="btn btn--info" id="idvc-consent-form-cancel-btn">\n <span>Cancel</span>\n </button>\n <button type="button" class="btn btn--primary btn--disabled" id="idvc-consent-form-proceed-btn">\n <span>Proceed</span>\n </button>\n </div>\n</div>\n\n';
@@ -1600,16 +1724,15 @@ class ConsentForm {
1600
1724
  this.cancelBtn = document.getElementById("idvc-consent-form-cancel-btn");
1601
1725
  this.inputEl = document.getElementById("idvc-full-name-input");
1602
1726
  this.checkboxEl = document.getElementById("idvc-consent");
1603
- const self = this;
1604
1727
  const handler = {
1605
- set(obj, prop, value, receiver) {
1728
+ set: (obj, prop, value, receiver) => {
1606
1729
  Reflect.set(obj, prop, value, receiver);
1607
- if (self.isValidInput() && self.target.checkboxState) {
1608
- self.proceedBtn.disabled = false;
1609
- self.proceedBtn.classList.remove("btn--disabled");
1730
+ if (this.isValidInput() && this.target.checkboxState) {
1731
+ this.proceedBtn.disabled = false;
1732
+ this.proceedBtn.classList.remove("btn--disabled");
1610
1733
  } else {
1611
- self.proceedBtn.disabled = true;
1612
- self.proceedBtn.classList.add("btn--disabled");
1734
+ this.proceedBtn.disabled = true;
1735
+ this.proceedBtn.classList.add("btn--disabled");
1613
1736
  }
1614
1737
  return true;
1615
1738
  },
@@ -1706,7 +1829,9 @@ class Validation {
1706
1829
  }
1707
1830
  if (this.status === ResponseStatus.INVALID_DATA) {
1708
1831
  const ocrMessage = "Image may be blurry. Please try taking photo again in a different room or with different lighting.";
1709
- const errorList = this.invalidDataErrors.reduce((acc, { code, message }) => `${acc}<li class="idvc-modal__body__list__item">${code === "OCRError" ? ocrMessage : message}</li>`, "");
1832
+ const errorList = this.invalidDataErrors.reduce((acc, { code, message }) => {
1833
+ return `${acc}<li class="idvc-modal__body__list__item">${code === "OCRError" ? ocrMessage : message ?? ""}</li>`;
1834
+ }, "");
1710
1835
  const noNumbersClass = this.invalidDataErrors.length === 1 ? "idvc-modal__body__list--no-numbers" : "";
1711
1836
  this.result.content = `<ol class="idvc-modal__body__list ${noNumbersClass}">${errorList}</ol>`;
1712
1837
  }
@@ -2246,28 +2371,19 @@ const Fingerprint = {
2246
2371
  sha256: decrypt
2247
2372
  }
2248
2373
  };
2374
+ const allSettledValues = async (promises) => {
2375
+ const results = await Promise.allSettled(promises);
2376
+ return results.map((r) => r.status === "fulfilled" ? r.value : void 0);
2377
+ };
2249
2378
  const getBrowserMetadata = async () => {
2250
- const [
2251
- { value: browserInfo },
2252
- { value: screenInfo },
2253
- // @ts-ignore
2254
- { value: batteryInfo },
2255
- { value: connectionInfo }
2256
- ] = await Promise.allSettled([
2379
+ const [browserInfo, screenInfo, batteryInfo, connectionInfo] = await allSettledValues([
2257
2380
  Fingerprint.browserInfo(),
2258
2381
  Fingerprint.screenInfo(),
2259
2382
  Fingerprint.batteryInfo(),
2260
2383
  Fingerprint.connectionInfo()
2261
2384
  ]);
2262
2385
  const { sha256 } = Fingerprint.utils;
2263
- const [
2264
- { value: browserInfoSHA },
2265
- { value: canvasInfo },
2266
- { value: fontsInfo },
2267
- // @ts-ignore
2268
- { value: html5Info },
2269
- { value: webGlInfo }
2270
- ] = await Promise.allSettled([
2386
+ const [browserInfoSHA, canvasInfo, fontsInfo, html5Info, webGlInfo] = await allSettledValues([
2271
2387
  sha256(JSON.stringify(browserInfo)),
2272
2388
  sha256(JSON.stringify(await Fingerprint.canvasInfo())),
2273
2389
  sha256(JSON.stringify(await Fingerprint.fontsInfo())),
@@ -2275,7 +2391,7 @@ const getBrowserMetadata = async () => {
2275
2391
  sha256(JSON.stringify(await Fingerprint.webGLInfo()))
2276
2392
  ]);
2277
2393
  return {
2278
- navigatorInfo: browserInfo.navigatorInfo,
2394
+ navigatorInfo: browserInfo == null ? void 0 : browserInfo.navigatorInfo,
2279
2395
  screenInfo,
2280
2396
  batteryInfo,
2281
2397
  connectionInfo,
@@ -4429,7 +4545,7 @@ function requireBrowser() {
4429
4545
  }
4430
4546
  var browserExports = requireBrowser();
4431
4547
  const QRCode = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
4432
- const qrCodeModalHTML = '<div class="idvc-modal-background" id="idvc-modal-background">\n <div class="el-loading-spinner" id="idvc-loading-spinner">\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n </div>\n</div>\n<div class="idvc-modal idvc-modal_qr-code" id="idvc-modal">\n <div class="idvc-modal__header-wrap qr-code__header">\n <div class="idvc-modal__close-btn" id="idvc-close-modal-btn"></div>\n <div class="idvc-modal__header">\n <h2 class="idvc-modal__header__content idvc-modal__header__content_qr-code">\n Verify Documents by Phone\n </h2>\n </div>\n </div>\n <div class="idvc-modal__body idvc-modal__body_qr-code">\n <div class="idvc-modal__body_process_ready" id="idvc-modal__body_process_ready">\n <h3 class="idvc-modal__body_process_ready-header">Scan the QR Сode below to continue on your mobile device</h3>\n <div class="idvc-modal__body_process_ready__canvas-container">\n <canvas class="idvc-modal__body_process_ready-canvas" id="idvc-modal__body_process_ready-canvas"></canvas>\n </div>\n <div class="idvc-modal__body_process_ready-info qr-code__header">\n <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7 0C8.97933 0.052 10.6278 0.736833 11.9455 2.0545C13.2632 3.37217 13.948 5.02067 14 7C13.948 8.97933 13.2632 10.6278 11.9455 11.9455C10.6278 13.2632 8.97933 13.948 7 14C5.02067 13.948 3.37217 13.2632 2.0545 11.9455C0.736833 10.6278 0.052 8.97933 0 7C0.052 5.02067 0.736833 3.37217 2.0545 2.0545C3.37217 0.736833 5.02067 0.052 7 0ZM7 3C6.729 3 6.505 3.099 6.328 3.297C6.151 3.495 6.07283 3.72933 6.0935 4L6.453 8C6.474 8.146 6.53383 8.26317 6.6325 8.3515C6.73117 8.43983 6.8535 8.48417 6.9995 8.4845C7.1455 8.48483 7.26783 8.4405 7.3665 8.3515C7.46517 8.2625 7.525 8.14533 7.546 8L7.9055 4C7.9265 3.729 7.84833 3.49467 7.671 3.297C7.49367 3.09933 7.26967 3.00033 6.999 3H7ZM7 11C7.22933 10.9897 7.4195 10.9115 7.5705 10.7655C7.7215 10.6195 7.797 10.432 7.797 10.203C7.797 9.974 7.7215 9.78383 7.5705 9.6325C7.4195 9.48117 7.22933 9.40567 7 9.406C6.77067 9.40633 6.5805 9.48183 6.4295 9.6325C6.2785 9.78317 6.203 9.97333 6.203 10.203C6.203 10.4327 6.2785 10.6202 6.4295 10.7655C6.5805 10.9108 6.77067 10.989 7 11Z" fill="#F7BA2A"/>\n </svg>\n <span class="idvc-modal__body_process_ready-info__text">Any images you have uploaded will be lost if you scan the QR code and continue the process on your mobile device</span>\n </div>\n </div>\n\n <div class="idvc-modal__body_process_validating d-none" id="idvc-modal__body_process_validating">\n <div class="el-loading-spinner el-loading-spinner_qr-code" id="idvc-validating-spinner">\n <svg viewBox="25 25 50 50" class="circular circular__background">\n <circle cx="50" cy="50" r="20" fill="none" class="path path__background"></circle>\n </svg>\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n <span class="idvc-modal__body_process_validating-info__text">The verification process is currently being completed using a mobile device ...</span>\n </div>\n </div>\n\n <div class="idvc-modal__body_process_done d-none" id="result-success">\n <div class="idvc-modal__body_process_done-container">\n <svg\n width="64"\n height="64"\n viewBox="0 0 64 64"\n fill="none"\n xmlns="http://www.w3.org/2000/svg">\n <path d="M31.5 0.5C40.407 0.734 47.8253 3.81575 53.7548 9.74525C59.6842 15.6748 62.766 23.093 63 32C62.766 40.907 59.6842 48.3253 53.7548 54.2548C47.8253 60.1842 40.407 63.266 31.5 63.5C22.593 63.266 15.1748 60.1842 9.24525 54.2548C3.31575 48.3253 0.234 40.907 0 32C0.234 23.093 3.31575 15.6748 9.24525 9.74525C15.1748 3.81575 22.593 0.734 31.5 0.5ZM27.5625 38.1875L20.601 31.226C20.0385 30.71 19.3942 30.452 18.6682 30.452C17.9422 30.452 17.3092 30.7212 16.7693 31.2597C16.2292 31.7982 15.96 32.4193 15.9615 33.1227C15.963 33.8263 16.221 34.4593 16.7355 35.0218L25.6657 43.952C26.1817 44.468 26.8148 44.726 27.5648 44.726C28.3148 44.726 28.9478 44.468 29.4638 43.952L47.9565 25.4593C48.66 24.7558 48.8828 23.9 48.6247 22.892C48.3667 21.884 47.7337 21.251 46.7257 20.993C45.7178 20.735 44.862 20.9578 44.1585 21.6612L27.5625 38.1875Z" fill="#5FCA71"/>\n </svg>\n <div class="idvc-modal__body_process_done__text" id="result__text-success">\n Success\n </div>\n </div>\n </div>\n\n <div class="idvc-modal__body_process_done d-none" id="result-error">\n <div class="idvc-modal__body_process_done-container">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="64"\n height="64"\n fill="#ff0000"\n viewBox="0 0 512 512">\n <path d="M502.876 379.713l-189.486-316.329c-6.088-9.895-14.349-17.903-24.154-23.52l-0.329-0.174c-20.048-11.267-45.677-11.292-65.788 0.022-10.123 5.785-18.372 13.786-24.282 23.381l-0.167 0.291c-0.022 0.045-0.042 0.066-0.064 0.109l-189.619 316.546c-18.512 32.098-7.501 73.127 24.596 91.642 9.476 5.56 20.852 8.88 32.997 8.972h379.12c37.046-0.406 66.736-30.765 66.347-67.804-0.137-12.231-3.526-23.642-9.34-33.446l0.171 0.31zM233.656 189.931c0.138-12.246 10.097-22.12 22.363-22.12s22.225 9.874 22.363 22.107v89.466c0 0.002 0 0.003 0 0.005 0 12.347-10.010 22.356-22.356 22.356-0.002 0-0.004 0-0.005 0h0c-0.002 0-0.005 0-0.008 0-12.345 0-22.352-10.005-22.357-22.348v-0zM278.413 368.985c0 12.368-10.026 22.394-22.394 22.394s-22.394-10.026-22.394-22.394c0-12.367 10.024-22.392 22.391-22.394v0c0.001 0 0.002 0 0.002 0 12.368 0 22.394 10.026 22.394 22.394v0z"/>\n </svg>\n <div class="idvc-modal__body_process_done__text" id="result__text-error">\n Validation Failed\n </div>\n </div>\n </div>\n <div class="idvc-modal__footer_qr-code">\n <button type="button" class="btn btn--primary" id="idvc-qr-code-terminate-process-btn">\n <span>Done</span>\n </button>\n </div>\n </div>\n</div>\n';
4548
+ const qrCodeModalHTML = '<div class="idvc-modal-background" id="idvc-modal-background">\n <div class="el-loading-spinner" id="idvc-loading-spinner">\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n </div>\n</div>\n<div class="idvc-modal idvc-modal_qr-code" id="idvc-modal">\n <div class="idvc-modal__header-wrap qr-code__header">\n <div class="idvc-modal__close-btn" id="idvc-close-modal-btn"></div>\n <div class="idvc-modal__header">\n <h2 class="idvc-modal__header__content idvc-modal__header__content_qr-code">\n Verify Documents by Phone\n </h2>\n </div>\n </div>\n <div class="idvc-modal__body idvc-modal__body_qr-code">\n <div class="idvc-modal__body_process_ready" id="idvc-modal__body_process_ready">\n <h3 class="idvc-modal__body_process_ready-header">Scan the QR Сode below to continue on your mobile device</h3>\n <div class="idvc-modal__body_process_ready__canvas-container">\n <canvas class="idvc-modal__body_process_ready-canvas" id="idvc-modal__body_process_ready-canvas"></canvas>\n </div>\n <div class="idvc-modal__body_process_ready-info qr-code__header">\n <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7 0C8.97933 0.052 10.6278 0.736833 11.9455 2.0545C13.2632 3.37217 13.948 5.02067 14 7C13.948 8.97933 13.2632 10.6278 11.9455 11.9455C10.6278 13.2632 8.97933 13.948 7 14C5.02067 13.948 3.37217 13.2632 2.0545 11.9455C0.736833 10.6278 0.052 8.97933 0 7C0.052 5.02067 0.736833 3.37217 2.0545 2.0545C3.37217 0.736833 5.02067 0.052 7 0ZM7 3C6.729 3 6.505 3.099 6.328 3.297C6.151 3.495 6.07283 3.72933 6.0935 4L6.453 8C6.474 8.146 6.53383 8.26317 6.6325 8.3515C6.73117 8.43983 6.8535 8.48417 6.9995 8.4845C7.1455 8.48483 7.26783 8.4405 7.3665 8.3515C7.46517 8.2625 7.525 8.14533 7.546 8L7.9055 4C7.9265 3.729 7.84833 3.49467 7.671 3.297C7.49367 3.09933 7.26967 3.00033 6.999 3H7ZM7 11C7.22933 10.9897 7.4195 10.9115 7.5705 10.7655C7.7215 10.6195 7.797 10.432 7.797 10.203C7.797 9.974 7.7215 9.78383 7.5705 9.6325C7.4195 9.48117 7.22933 9.40567 7 9.406C6.77067 9.40633 6.5805 9.48183 6.4295 9.6325C6.2785 9.78317 6.203 9.97333 6.203 10.203C6.203 10.4327 6.2785 10.6202 6.4295 10.7655C6.5805 10.9108 6.77067 10.989 7 11Z" fill="#F7BA2A"/>\n </svg>\n <span class="idvc-modal__body_process_ready-info__text">Any images you have uploaded will be lost if you scan the QR code and continue the process on your mobile device</span>\n </div>\n </div>\n\n <div class="idvc-modal__body_process_validating d-none" id="idvc-modal__body_process_validating">\n <div class="el-loading-spinner el-loading-spinner_qr-code" id="idvc-validating-spinner">\n <svg viewBox="25 25 50 50" class="circular">\n <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>\n </svg>\n <span class="idvc-modal__body_process_validating-info__text">The verification process is currently being completed using a mobile device ...</span>\n </div>\n </div>\n\n <div class="idvc-modal__body_process_done d-none" id="result-success">\n <div class="idvc-modal__body_process_done-container">\n <svg\n width="64"\n height="64"\n viewBox="0 0 64 64"\n fill="none"\n xmlns="http://www.w3.org/2000/svg">\n <path d="M31.5 0.5C40.407 0.734 47.8253 3.81575 53.7548 9.74525C59.6842 15.6748 62.766 23.093 63 32C62.766 40.907 59.6842 48.3253 53.7548 54.2548C47.8253 60.1842 40.407 63.266 31.5 63.5C22.593 63.266 15.1748 60.1842 9.24525 54.2548C3.31575 48.3253 0.234 40.907 0 32C0.234 23.093 3.31575 15.6748 9.24525 9.74525C15.1748 3.81575 22.593 0.734 31.5 0.5ZM27.5625 38.1875L20.601 31.226C20.0385 30.71 19.3942 30.452 18.6682 30.452C17.9422 30.452 17.3092 30.7212 16.7693 31.2597C16.2292 31.7982 15.96 32.4193 15.9615 33.1227C15.963 33.8263 16.221 34.4593 16.7355 35.0218L25.6657 43.952C26.1817 44.468 26.8148 44.726 27.5648 44.726C28.3148 44.726 28.9478 44.468 29.4638 43.952L47.9565 25.4593C48.66 24.7558 48.8828 23.9 48.6247 22.892C48.3667 21.884 47.7337 21.251 46.7257 20.993C45.7178 20.735 44.862 20.9578 44.1585 21.6612L27.5625 38.1875Z" fill="#5FCA71"/>\n </svg>\n <div class="idvc-modal__body_process_done__text" id="result__text-success">\n Success\n </div>\n </div>\n </div>\n\n <div class="idvc-modal__body_process_done d-none" id="result-error">\n <div class="idvc-modal__body_process_done-container">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="64"\n height="64"\n fill="#ff0000"\n viewBox="0 0 512 512">\n <path d="M502.876 379.713l-189.486-316.329c-6.088-9.895-14.349-17.903-24.154-23.52l-0.329-0.174c-20.048-11.267-45.677-11.292-65.788 0.022-10.123 5.785-18.372 13.786-24.282 23.381l-0.167 0.291c-0.022 0.045-0.042 0.066-0.064 0.109l-189.619 316.546c-18.512 32.098-7.501 73.127 24.596 91.642 9.476 5.56 20.852 8.88 32.997 8.972h379.12c37.046-0.406 66.736-30.765 66.347-67.804-0.137-12.231-3.526-23.642-9.34-33.446l0.171 0.31zM233.656 189.931c0.138-12.246 10.097-22.12 22.363-22.12s22.225 9.874 22.363 22.107v89.466c0 0.002 0 0.003 0 0.005 0 12.347-10.010 22.356-22.356 22.356-0.002 0-0.004 0-0.005 0h0c-0.002 0-0.005 0-0.008 0-12.345 0-22.352-10.005-22.357-22.348v-0zM278.413 368.985c0 12.368-10.026 22.394-22.394 22.394s-22.394-10.026-22.394-22.394c0-12.367 10.024-22.392 22.391-22.394v0c0.001 0 0.002 0 0.002 0 12.368 0 22.394 10.026 22.394 22.394v0z"/>\n </svg>\n <div class="idvc-modal__body_process_done__text" id="result__text-error">\n Validation Failed\n </div>\n </div>\n </div>\n </div>\n <div class="idvc-modal__footer_qr-code">\n <button type="button" class="btn btn--primary" id="idvc-qr-code-terminate-process-btn">\n <span>Stop the mobile validation process</span>\n </button>\n </div>\n</div>\n';
4433
4549
  class QRCodeModal extends Modal {
4434
4550
  constructor(mountEl, applicantId, domainApi, embeddedAppConnectionId, qrCodeLinkOrigin, state = QRCodeModalState.READY) {
4435
4551
  super(mountEl);
@@ -4508,31 +4624,11 @@ const isiOS = () => [
4508
4624
  "iPad",
4509
4625
  "iPhone"
4510
4626
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
4511
- const checkTouchPoints = () => navigator.maxTouchPoints > 0;
4512
- const isMobile = () => {
4513
- const { userAgent } = navigator;
4514
- const mediaQueryCoarse = window.matchMedia("(any-pointer: coarse)");
4515
- const hasTouches = checkTouchPoints();
4516
- const isMobileUserAgent = () => browserRE.test(userAgent) || browserREAlt.test(userAgent.substring(0, 4)) || isiOS();
4517
- const isTouchable = () => window.PointerEvent && hasTouches;
4518
- const isTouchScreen = () => mediaQueryCoarse.matches;
4519
- const isSurface = () => userAgent.indexOf("Windows") !== -1 && isTouchable();
4520
- return {
4521
- isMobileUserAgent,
4522
- isTouchable,
4523
- isTouchScreen,
4524
- isSurface
4525
- };
4526
- };
4527
4627
  const checkIfMobile = () => {
4528
- const mc = isMobile();
4529
- const isMobileUserAgent = mc.isMobileUserAgent();
4530
- const isTouchable = mc.isTouchable();
4531
- const isTouchScreen = mc.isTouchScreen();
4532
- const isSurface = mc.isSurface();
4533
- return isMobileUserAgent && isTouchable && isTouchScreen || isSurface;
4628
+ const { userAgent } = navigator;
4629
+ return browserRE.test(userAgent) || browserREAlt.test(userAgent.slice(0, 4)) || isiOS();
4534
4630
  };
4535
- const version = "2.10.0";
4631
+ const version = "2.10.1";
4536
4632
  const packageJson = {
4537
4633
  version
4538
4634
  };
@@ -4572,7 +4668,7 @@ class Wrapper {
4572
4668
  this.lib.loading = false;
4573
4669
  } else {
4574
4670
  this.lib.loading = false;
4575
- throw new Error();
4671
+ throw new Error("Applicant validation failed");
4576
4672
  }
4577
4673
  } catch (e) {
4578
4674
  this.lib.loading = false;
@@ -4627,7 +4723,7 @@ class Wrapper {
4627
4723
  const keys = Object.keys(wrapperSettings);
4628
4724
  keys.forEach((key) => {
4629
4725
  const value = wrapperSettings[key];
4630
- if (typeof value !== "undefined") {
4726
+ if (value !== void 0) {
4631
4727
  copy[key] = value;
4632
4728
  }
4633
4729
  });
@@ -4683,7 +4779,7 @@ class Wrapper {
4683
4779
  );
4684
4780
  }
4685
4781
  } else {
4686
- throw new Error();
4782
+ throw new Error("Applicant validation failed");
4687
4783
  }
4688
4784
  } catch (e) {
4689
4785
  this.onError(e);
@@ -4702,9 +4798,9 @@ class Wrapper {
4702
4798
  });
4703
4799
  }
4704
4800
  prepareConfig(options) {
4705
- const libSettings = JSON.parse(options);
4706
- libSettings.documentTypes = prepareDocumentTypes(libSettings);
4707
- return libSettings;
4801
+ const settings = JSON.parse(options);
4802
+ settings.documentTypes = prepareDocumentTypes(settings);
4803
+ return settings;
4708
4804
  }
4709
4805
  showSpinner() {
4710
4806
  this.validationModal.hideSpinner();
@@ -4750,7 +4846,7 @@ class Wrapper {
4750
4846
  return {
4751
4847
  applicantId: this.configs.applicantId,
4752
4848
  ...model,
4753
- ...{ documentType: isFaceAuth ? 10 : model.documentType },
4849
+ documentType: isFaceAuth ? 10 : model.documentType,
4754
4850
  ...fingerPrintResult,
4755
4851
  clientVersion: this.lib.version,
4756
4852
  clientType: ClientType.WebLibStandalone
@@ -4767,7 +4863,7 @@ class Wrapper {
4767
4863
  if (this.configs.IDVCDownloadVersion === "latest" && this.configs.libConfig.useCDN) {
4768
4864
  const currentProductionIdvcVersion = await this.api.getCurrentIdvcVersion();
4769
4865
  await this.lib.initializeLibrary(
4770
- !!this.configs.libConfig.useCDN,
4866
+ this.configs.libConfig.useCDN,
4771
4867
  currentProductionIdvcVersion
4772
4868
  );
4773
4869
  } else {
@@ -4798,7 +4894,7 @@ class Wrapper {
4798
4894
  this.validationOutput.status = ResponseStatus.COMPLETE;
4799
4895
  this.showValidationSuccess();
4800
4896
  } else {
4801
- throw new Error();
4897
+ throw new Error("Force close failed");
4802
4898
  }
4803
4899
  } catch (e) {
4804
4900
  this.onError(e);
@@ -4846,46 +4942,75 @@ class Wrapper {
4846
4942
  }
4847
4943
  processEmbeddedAppStart(status) {
4848
4944
  const getFirstStepModeState = this.configs.getFirstStepModeState();
4849
- if (status === EmbeddedStatus.OPEN) {
4850
- this.QRCodeModal.state = QRCodeModalState.VALIDATING;
4851
- this.QRCodeModal.closable = false;
4852
- this.QRCodeModal.show();
4853
- this.api.longPollingRequest(
4854
- `ValidationResponse/${this.configs.applicantId}/${this.embeddedAppConnectionId}`,
4855
- { method: "GET" },
4856
- (data) => {
4857
- this.processEmbeddedAppEnd(data);
4945
+ switch (status) {
4946
+ case EmbeddedStatus.NEVER_OPEN: {
4947
+ const firstStepMode = getFirstStepModeState();
4948
+ if (firstStepMode && this.configs.firstStepMode) {
4949
+ [this.configs.firstStepMode.video, this.configs.firstStepMode.uploader] = [
4950
+ firstStepMode.video,
4951
+ firstStepMode.uploader
4952
+ ];
4858
4953
  }
4859
- );
4860
- if (this.configs.firstStepMode) {
4861
- this.configs.firstStepMode.video = false;
4862
- this.configs.firstStepMode.uploader = true;
4863
- }
4864
- this.lib.updateDocumentTypes(this.configs.libConfig.documentTypes);
4865
- } else if (status === EmbeddedStatus.CLOSED || status === EmbeddedStatus.NEVER_OPEN) {
4866
- const firstStepMode = getFirstStepModeState();
4867
- if (firstStepMode && this.configs.firstStepMode) {
4868
- [this.configs.firstStepMode.video, this.configs.firstStepMode.uploader] = [
4869
- firstStepMode.video,
4870
- firstStepMode.uploader
4871
- ];
4954
+ this.QRCodeModal.state = QRCodeModalState.READY;
4955
+ this.QRCodeModal.closable = true;
4956
+ this.QRCodeModal.show();
4957
+ this.api.longPollingRequest(
4958
+ `IsOpen/${this.configs.applicantId}`,
4959
+ { method: "GET" },
4960
+ (isOpen) => {
4961
+ if (isOpen) {
4962
+ this.processEmbeddedAppStart(EmbeddedStatus.OPEN);
4963
+ }
4964
+ }
4965
+ );
4966
+ break;
4872
4967
  }
4873
- this.QRCodeModal.state = QRCodeModalState.READY;
4874
- this.QRCodeModal.closable = true;
4875
- this.api.longPollingRequest(
4876
- `IsOpen/${this.configs.applicantId}`,
4877
- { method: "GET" },
4878
- (isOpen) => {
4879
- if (isOpen) {
4880
- this.processEmbeddedAppStart(EmbeddedStatus.OPEN);
4968
+ case EmbeddedStatus.OPEN:
4969
+ this.QRCodeModal.state = QRCodeModalState.VALIDATING;
4970
+ this.QRCodeModal.closable = false;
4971
+ this.QRCodeModal.show();
4972
+ this.api.longPollingRequest(
4973
+ `ValidationResponse/${this.configs.applicantId}/${this.embeddedAppConnectionId}`,
4974
+ { method: "GET" },
4975
+ (data) => {
4976
+ this.processEmbeddedAppEnd(data);
4881
4977
  }
4978
+ );
4979
+ if (this.configs.firstStepMode) {
4980
+ this.configs.firstStepMode.video = false;
4981
+ this.configs.firstStepMode.uploader = true;
4882
4982
  }
4883
- );
4884
- } else if (status === EmbeddedStatus.CLOSED_FOREVER) {
4885
- this.QRCodeModal.state = QRCodeModalState.DONE_WITH_ERROR;
4886
- this.QRCodeModal.closable = false;
4983
+ this.lib.updateDocumentTypes(this.configs.libConfig.documentTypes);
4984
+ break;
4985
+ case EmbeddedStatus.CLOSED: {
4986
+ const firstStepMode = getFirstStepModeState();
4987
+ if (firstStepMode && this.configs.firstStepMode) {
4988
+ [this.configs.firstStepMode.video, this.configs.firstStepMode.uploader] = [
4989
+ firstStepMode.video,
4990
+ firstStepMode.uploader
4991
+ ];
4992
+ }
4993
+ this.api.longPollingRequest(
4994
+ `IsOpen/${this.configs.applicantId}`,
4995
+ { method: "GET" },
4996
+ (isOpen) => {
4997
+ if (isOpen) {
4998
+ this.processEmbeddedAppStart(EmbeddedStatus.OPEN);
4999
+ }
5000
+ }
5001
+ );
5002
+ break;
5003
+ }
5004
+ case EmbeddedStatus.CLOSED_FOREVER:
5005
+ this.QRCodeModal.state = QRCodeModalState.DONE_WITH_ERROR;
5006
+ this.QRCodeModal.closable = false;
5007
+ break;
4887
5008
  }
4888
5009
  }
5010
+ // eslint-disable-next-line
5011
+ // eslint-disable-next-line sonarjs/todo-tag
5012
+ // TODO: ValidationApplicant is currently an intersection (&) of SuccessApplicantValidation and FailedApplicantValidationResult,
5013
+ // but semantically it should be a union (|). Refactor to use a union type with proper type narrowing.
4889
5014
  processEmbeddedAppEnd(data) {
4890
5015
  if ((data == null ? void 0 : data.status) === ResponseStatus.SUCCESS) {
4891
5016
  this.QRCodeModal.state = QRCodeModalState.DONE_WITH_SUCCESS;
@@ -4931,4 +5056,3 @@ class Wrapper {
4931
5056
  export {
4932
5057
  Wrapper as default
4933
5058
  };
4934
- //# sourceMappingURL=wrapper.es.js.map