@idscan/onboarding 2.10.0 → 2.10.2

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 (45) hide show
  1. package/dist/Wrapper.css +1 -1
  2. package/dist/Wrapper.d.ts +223 -0
  3. package/dist/networks/Face-chunk.js +1 -1
  4. package/dist/networks/MRZ-chunk.js +1 -1
  5. package/dist/networks/PDF-chunk.js +1 -1
  6. package/dist/networks/ZXing-chunk.js +1 -1
  7. package/dist/src/Wrapper.d.ts +2 -1
  8. package/dist/wrapper.es.js +305 -175
  9. package/dist/wrapper.umd.js +1 -2
  10. package/package.json +26 -13
  11. package/readme.md +7 -0
  12. package/dist/custom_types/custom.d.ts +0 -20
  13. package/dist/src/@types/Api/Requests.d.ts +0 -22
  14. package/dist/src/@types/Api/Responses.d.ts +0 -97
  15. package/dist/src/@types/Data.d.ts +0 -110
  16. package/dist/src/@types/IDVCTypes.d.ts +0 -5
  17. package/dist/src/@types/Step.d.ts +0 -26
  18. package/dist/src/@types/enums.d.ts +0 -89
  19. package/dist/src/config.d.ts +0 -35
  20. package/dist/src/entry.d.ts +0 -1
  21. package/dist/src/errors/ConfigError.d.ts +0 -4
  22. package/dist/src/errors/FaceAuthorizationError.d.ts +0 -6
  23. package/dist/src/errors/HttpError.d.ts +0 -4
  24. package/dist/src/errors/NotValidApplicant.d.ts +0 -4
  25. package/dist/src/errors/RequestTimeoutError.d.ts +0 -4
  26. package/dist/src/errors/ValidationError.d.ts +0 -6
  27. package/dist/src/errors/WrapperError.d.ts +0 -5
  28. package/dist/src/helpers/fingerPrint.d.ts +0 -19
  29. package/dist/src/helpers/mobileChecker.d.ts +0 -15
  30. package/dist/src/helpers/requestModelCheckers.d.ts +0 -4
  31. package/dist/src/helpers/typeGuard.d.ts +0 -1
  32. package/dist/src/helpers/utils.d.ts +0 -9
  33. package/dist/src/helpers/validators.d.ts +0 -7
  34. package/dist/src/mocks/defaultValues.d.ts +0 -2
  35. package/dist/src/mocks/validation.json.d.ts +0 -9
  36. package/dist/src/modules/Api.d.ts +0 -21
  37. package/dist/src/modules/ConsentForm.d.ts +0 -19
  38. package/dist/src/modules/Lib.d.ts +0 -24
  39. package/dist/src/modules/Modal.d.ts +0 -26
  40. package/dist/src/modules/QRCodeModal.d.ts +0 -25
  41. package/dist/src/modules/Validation.d.ts +0 -24
  42. package/dist/src/modules/ValidationModal.d.ts +0 -15
  43. package/dist/vite.config.d.ts +0 -2
  44. package/dist/wrapper.es.js.map +0 -1
  45. 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,20 @@ 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;
789
+ this.showQrCode = this.wrapper.preferApiConfig ? settings.showQrCode ?? true : options.showQrCode;
792
790
  }
793
- faceAuthorizationConfig(jsonSettings) {
794
- jsonSettings.isShowDocumentTypeSelect = false;
795
- jsonSettings.documentTypes = [
791
+ faceAuthorizationConfig(settings) {
792
+ settings.isShowDocumentTypeSelect = false;
793
+ settings.documentTypes = [
796
794
  {
797
795
  type: "DL",
798
796
  steps: [
@@ -800,7 +798,7 @@ class Configs {
800
798
  ]
801
799
  }
802
800
  ];
803
- return jsonSettings;
801
+ return settings;
804
802
  }
805
803
  getFirstStepModeState() {
806
804
  const firstStepMode = structuredClone(this.firstStepMode);
@@ -888,6 +886,9 @@ class Configs {
888
886
  get cssVariablesConfig() {
889
887
  return this.cssVariables;
890
888
  }
889
+ get showQrCodeConfig() {
890
+ return this.showQrCode;
891
+ }
891
892
  get mountElement() {
892
893
  return this.wrapper.el || "videoCapturingEl";
893
894
  }
@@ -980,10 +981,131 @@ class RequestTimeoutError extends WrapperError {
980
981
  this.content = "This application is closed";
981
982
  }
982
983
  }
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
984
+ const dlDocument = {
985
+ abbr3Country: "USA",
986
+ abbrCountry: "US",
987
+ address: "25805 VAN LEUVEN ST 136",
988
+ city: "LOMA LINDA",
989
+ class: "C",
990
+ country: "United States of America",
991
+ dob: "1961-01-07",
992
+ expires: "2024-01-07",
993
+ eyes: "Brown",
994
+ familyName: "GILMER",
995
+ firstName: "DARIENNE",
996
+ fullName: "DARIENNE ELIZABETH GILMER",
997
+ gender: "Female",
998
+ hair: "Black",
999
+ height: "064 IN",
1000
+ id: "C3568758",
1001
+ idType: "DL",
1002
+ issued: "2019-01-07",
1003
+ middleName: "ELIZABETH",
1004
+ postalBox: null,
1005
+ privateName: "ELIZABETH",
1006
+ state: "CA",
1007
+ template: "09",
1008
+ weight: "77",
1009
+ zip: "92354-0000"
1010
+ };
1011
+ const passportDocument = {
1012
+ abbr3Country: "USA",
1013
+ abbrCountry: "US",
1014
+ address: null,
1015
+ city: null,
1016
+ class: null,
1017
+ country: "United States of America",
1018
+ dob: "1986-07-24",
1019
+ expires: "2030-07-13",
1020
+ eyes: null,
1021
+ familyName: "LEVELS",
1022
+ firstName: "DAVID HARRISON",
1023
+ fullName: "LEVELS DAVID HARRISON",
1024
+ gender: "M",
1025
+ hair: null,
1026
+ height: null,
1027
+ id: "659328258",
1028
+ idType: "PASSPORT",
1029
+ issued: null,
1030
+ middleName: null,
1031
+ postalBox: null,
1032
+ privateName: null,
1033
+ state: null,
1034
+ template: null,
1035
+ weight: null,
1036
+ zip: null
1037
+ };
1038
+ const base = {
1039
+ validationResponseId: 0,
1040
+ validationRequestId: "",
1041
+ documentType: 0,
1042
+ document: null,
1043
+ attemptsLeft: 0,
1044
+ attemptsCount: 0,
1045
+ status: 0,
1046
+ validationStatus: {
1047
+ expired: false,
1048
+ documentIsValid: false,
1049
+ faceIsValid: false
1050
+ },
1051
+ invalidDataErrors: null,
1052
+ faceSuccess: null,
1053
+ documentSuccess: null,
1054
+ documentHasNotExpired: null,
1055
+ documentValidationTests: null,
1056
+ callBackUrl: null,
1057
+ notificationType: 0,
1058
+ isCompleted: false
986
1059
  };
1060
+ const createValidationResponse = (overrides = {}) => ({ ...base, ...overrides });
1061
+ const success = createValidationResponse({
1062
+ validationResponseId: 6223,
1063
+ validationRequestId: "8151f48d-bab1-4491-037d-08d9b3c5cfec",
1064
+ documentType: 1,
1065
+ document: dlDocument,
1066
+ validationStatus: { expired: false, documentIsValid: true, faceIsValid: true },
1067
+ documentValidationTests: [
1068
+ { displayName: "DMV", name: "DMVValidation", status: 0, statusString: "Failed", reason: "Internal Server Error" },
1069
+ { displayName: "IdentiFraud", name: "IdentiFraudValidation", status: -1, statusString: "Disabled", reason: "Integration was turned off" }
1070
+ ]
1071
+ });
1072
+ createValidationResponse({
1073
+ validationResponseId: 6224,
1074
+ validationRequestId: "fa33df4c-7d5c-4485-037e-08d9b3c5cfec",
1075
+ attemptsLeft: 19,
1076
+ status: 2,
1077
+ invalidDataErrors: [
1078
+ { code: "FaceDocNotDetectError", message: "The face has not been found on the document" },
1079
+ { code: "PDF417Error", message: "Unable to capture data from the back of the document" },
1080
+ { code: "OCRError", message: "Unable to capture data from the front of the document" }
1081
+ ]
1082
+ });
1083
+ createValidationResponse({
1084
+ validationResponseId: 6230,
1085
+ validationRequestId: "eae11ae1-1c8f-40bd-0381-08d9b3c5cfec",
1086
+ documentType: 2,
1087
+ document: passportDocument,
1088
+ attemptsLeft: 18,
1089
+ status: 1,
1090
+ validationStatus: { expired: false, documentIsValid: true, faceIsValid: false }
1091
+ });
1092
+ createValidationResponse({
1093
+ applicantId: "bb165b57-e8b1-412a-b848-2e4669da58e0",
1094
+ attemptId: 71441,
1095
+ documentType: 1,
1096
+ attemptsCount: 5,
1097
+ attemptsLeft: 5,
1098
+ status: 2,
1099
+ validationStatus: {
1100
+ expired: null,
1101
+ documentIsValid: null,
1102
+ faceIsValid: true,
1103
+ antiSpoofingIsValid: null
1104
+ },
1105
+ invalidDataErrors: [{ code: "QualityWarning", message: null }],
1106
+ hasRiskEvents: true,
1107
+ documentValidationTests: []
1108
+ });
987
1109
  class FaceAuthorizationError extends WrapperError {
988
1110
  constructor(error) {
989
1111
  super("FaceAuthorizationError");
@@ -1050,11 +1172,8 @@ var DocumentTypeIDs = /* @__PURE__ */ ((DocumentTypeIDs2) => {
1050
1172
  DocumentTypeIDs2[DocumentTypeIDs2["DL"] = 1] = "DL";
1051
1173
  DocumentTypeIDs2[DocumentTypeIDs2["Passport"] = 2] = "Passport";
1052
1174
  DocumentTypeIDs2[DocumentTypeIDs2["PassportCard"] = 3] = "PassportCard";
1053
- DocumentTypeIDs2[DocumentTypeIDs2["CommonAccessCardOld"] = 4] = "CommonAccessCardOld";
1054
- DocumentTypeIDs2[DocumentTypeIDs2["CommonAccessCard"] = 5] = "CommonAccessCard";
1055
1175
  DocumentTypeIDs2[DocumentTypeIDs2["GreenCard"] = 6] = "GreenCard";
1056
1176
  DocumentTypeIDs2[DocumentTypeIDs2["InternationalId"] = 7] = "InternationalId";
1057
- DocumentTypeIDs2[DocumentTypeIDs2["VIN"] = 8] = "VIN";
1058
1177
  DocumentTypeIDs2[DocumentTypeIDs2["Barcode"] = 11] = "Barcode";
1059
1178
  DocumentTypeIDs2[DocumentTypeIDs2["FaceAuthorization"] = 10] = "FaceAuthorization";
1060
1179
  DocumentTypeIDs2[DocumentTypeIDs2["EmploymentAuthorization"] = 9] = "EmploymentAuthorization";
@@ -1077,12 +1196,10 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
1077
1196
  HttpStatus2[HttpStatus2["PreconditionFailed"] = 412] = "PreconditionFailed";
1078
1197
  HttpStatus2[HttpStatus2["LengthRequired"] = 411] = "LengthRequired";
1079
1198
  HttpStatus2[HttpStatus2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
1080
- HttpStatus2[HttpStatus2["RequestEntityTooLarge"] = 413] = "RequestEntityTooLarge";
1081
1199
  HttpStatus2[HttpStatus2["RequestURITooLong"] = 414] = "RequestURITooLong";
1082
1200
  HttpStatus2[HttpStatus2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
1083
1201
  HttpStatus2[HttpStatus2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
1084
1202
  HttpStatus2[HttpStatus2["ExpectationFailed"] = 417] = "ExpectationFailed";
1085
- HttpStatus2[HttpStatus2["ImATextDocument"] = 423] = "ImATextDocument";
1086
1203
  HttpStatus2[HttpStatus2["Locked"] = 423] = "Locked";
1087
1204
  HttpStatus2[HttpStatus2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
1088
1205
  HttpStatus2[HttpStatus2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
@@ -1159,7 +1276,8 @@ class Api {
1159
1276
  headers: this.HEADERS
1160
1277
  });
1161
1278
  if (response.ok) {
1162
- return await response.json();
1279
+ const { showQrCode: _, ...result } = await response.json();
1280
+ return result;
1163
1281
  }
1164
1282
  throw new HttpError(response);
1165
1283
  } catch (e) {
@@ -1172,7 +1290,7 @@ class Api {
1172
1290
  }
1173
1291
  async validateApplicant(data, demoMode = false, isFaceAuth = false) {
1174
1292
  if (demoMode) {
1175
- return json$4.success;
1293
+ return success;
1176
1294
  }
1177
1295
  const url = `${this.baseUrl}Validation`;
1178
1296
  const response = await fetch(url, {
@@ -1220,10 +1338,10 @@ class Api {
1220
1338
  method: "POST",
1221
1339
  headers: this.HEADERS
1222
1340
  });
1223
- if (!response.ok) {
1224
- throw new Error(`Request Error: ${response.status}`);
1225
- } else {
1341
+ if (response.ok) {
1226
1342
  callback();
1343
+ } else {
1344
+ throw new Error(`Request Error: ${response.status}`);
1227
1345
  }
1228
1346
  } catch (e) {
1229
1347
  if (e instanceof HttpError) {
@@ -1269,11 +1387,11 @@ const checkBackOrSecondImageProcessing = (documentType, steps) => {
1269
1387
  if (!backStep) {
1270
1388
  return false;
1271
1389
  }
1272
- const allowedDocumentTypeIDs = (_a = processingCheckMap[backStep.type]) == null ? void 0 : _a.includes(documentType);
1390
+ const allowedDocumentTypeIDs = (_a = processingCheckMap[backStep.type]) == null ? void 0 : _a.some((id) => id === documentType);
1273
1391
  return allowedDocumentTypeIDs ?? false;
1274
1392
  };
1275
1393
  const checkOcrEnabled = (documentType, steps) => {
1276
- const isPassportFront = !!steps.find((step) => step.type === "mrz");
1394
+ const isPassportFront = steps.some((step) => step.type === "mrz");
1277
1395
  if (documentType === DocumentTypeIDs.Passport && isPassportFront) {
1278
1396
  return true;
1279
1397
  }
@@ -1286,8 +1404,8 @@ class Lib {
1286
1404
  if (!base64EncodedImage || !isString(base64EncodedImage)) return "";
1287
1405
  const splitPattern = /:image\/\w+;base64,/;
1288
1406
  const parts = base64EncodedImage.split(splitPattern);
1289
- if (parts.length) {
1290
- return parts[parts.length - 1];
1407
+ if (parts.length > 0) {
1408
+ return parts.at(-1) ?? "";
1291
1409
  }
1292
1410
  return "";
1293
1411
  };
@@ -1325,9 +1443,9 @@ class Lib {
1325
1443
  faceImageBase64: this.cleanBase64((_a = data.steps.find((item) => item.type === "face")) == null ? void 0 : _a.img),
1326
1444
  trackString: back.trackString,
1327
1445
  ssn: "",
1328
- verifyFace: !!data.steps.find((item) => item.type === "face"),
1446
+ verifyFace: data.steps.some((item) => item.type === "face"),
1329
1447
  documentType: data.documentType,
1330
- captureMethod: data.steps.reduce((acc, step) => `${acc}${+step.isAuto}`, ""),
1448
+ captureMethod: data.steps.reduce((acc, step) => `${acc}${Number(step.isAuto ?? false)}`, ""),
1331
1449
  userAgent: window.navigator.userAgent,
1332
1450
  frontEndMetadata: data.metaData,
1333
1451
  isBackOrSecondImageProcessingEnabled: checkBackOrSecondImageProcessing(
@@ -1342,8 +1460,10 @@ class Lib {
1342
1460
  if (!this.library) {
1343
1461
  if (loadIDVCFromCDN) {
1344
1462
  await this.loadFromCDN(idvcVersion);
1345
- } else {
1463
+ } else if (IDVCModule) {
1346
1464
  this.loadFromNodeModules(IDVCModule);
1465
+ } else {
1466
+ throw new Error("IDVCModule must be provided when not loading from CDN");
1347
1467
  }
1348
1468
  this.postInitialize();
1349
1469
  }
@@ -1356,9 +1476,9 @@ class Lib {
1356
1476
  const script = document.createElement("script");
1357
1477
  script.src = `https://neurons.cdn.idscan.net/${idvcVersion}-next/idvc.js`;
1358
1478
  script.async = true;
1359
- script.onload = () => resolve(window.IDVC);
1360
- script.onerror = reject;
1361
- document.body.appendChild(script);
1479
+ script.addEventListener("load", () => resolve(window.IDVC));
1480
+ script.addEventListener("error", reject);
1481
+ document.body.append(script);
1362
1482
  }).then((IDVCFromCDN) => {
1363
1483
  this.library = new IDVCFromCDN(this.IdvcConfig);
1364
1484
  }).catch((err) => {
@@ -1383,8 +1503,8 @@ class Lib {
1383
1503
  }
1384
1504
  postInitialize() {
1385
1505
  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>
1506
+ <style id="onboarding-css-variables">${this.CSSVariablesConfig ?? ""}</style>
1507
+ <style id="onboarding-css-config">${this.CSSStylesConfig ?? ""}</style>
1388
1508
  `);
1389
1509
  }
1390
1510
  reloadComponent(newConfig) {
@@ -1415,8 +1535,10 @@ class Lib {
1415
1535
  };
1416
1536
  }
1417
1537
  }
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';
1538
+ const validationModalHTML = '<div class="idvc-modal-background d-none" id="idvc-modal-background">\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</div>\n';
1539
+ 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';
1540
+ 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';
1541
+ const modalHTML = '<div class="idvc-modal-background d-none" id="idvc-modal-background">\n <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>\n';
1420
1542
  class Modal {
1421
1543
  constructor(mountEl) {
1422
1544
  this._closable = true;
@@ -1498,16 +1620,20 @@ class Modal {
1498
1620
  this.background.classList.remove("idvc-preload-element");
1499
1621
  }
1500
1622
  show() {
1501
- const circular = this.modalContainer.querySelector(".circular");
1502
- circular.classList.add("d-none");
1503
1623
  this.showBackground = true;
1504
1624
  this.container.classList.remove("d-none");
1505
1625
  }
1506
1626
  showSpinner(val) {
1507
1627
  if (val) {
1508
1628
  this.spinner.classList.remove("d-none");
1629
+ this.headerContainer.classList.add("d-none");
1630
+ this.body.classList.add("d-none");
1631
+ this.footer.classList.add("d-none");
1509
1632
  } else {
1510
1633
  this.spinner.classList.add("d-none");
1634
+ this.headerContainer.classList.remove("d-none");
1635
+ this.body.classList.remove("d-none");
1636
+ this.footer.classList.remove("d-none");
1511
1637
  }
1512
1638
  }
1513
1639
  prepareBackgroundStyles() {
@@ -1518,61 +1644,64 @@ class Modal {
1518
1644
  class ValidationModal extends Modal {
1519
1645
  init(html2 = validationModalHTML) {
1520
1646
  super.init(html2);
1521
- this.headerSign = this.headerContainer.querySelector("path");
1647
+ this.headerInfoContainer = this.headerContainer.querySelector("#idvc-modal-header-sign-info");
1648
+ this.headerCheckContainer = this.headerContainer.querySelector("#idvc-modal-header-sign-check");
1649
+ this.headerInfoContainer.innerHTML = infoCircleSVG;
1650
+ this.headerCheckContainer.innerHTML = checkCircleSVG;
1651
+ this.headerInfoSvg = this.headerInfoContainer.querySelector("svg");
1522
1652
  this.tryAgainBtn = this.container.querySelector("#idvc-modal-try-again-btn");
1523
1653
  this.completeBtn = this.container.querySelector("#idvc-modal-complete-btn");
1524
- this.addTryAgainHandler();
1654
+ this.tryAgainBtn.addEventListener("click", () => this.hide());
1525
1655
  this.addCompleteHandler();
1526
1656
  }
1527
- set type(rawType) {
1528
- if (rawType === ValidationStatus.SUCCESS) {
1529
- this.applySuccessValidationStyles();
1657
+ set type(status) {
1658
+ if (status === ValidationStatus.SUCCESS) {
1659
+ this.applySuccessStyles();
1660
+ } else {
1661
+ this.applyFailureStyles(status);
1530
1662
  }
1531
- this.headerSign.setAttribute("class", `color-${rawType}`);
1532
1663
  }
1533
1664
  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) {
1665
+ const buttonsCount = +tryAgain + +complete;
1666
+ const hasButtons = buttonsCount > 0;
1667
+ const isSingleButton = buttonsCount === 1;
1668
+ this.setVisible(this.tryAgainBtn, tryAgain);
1669
+ this.setVisible(this.completeBtn, complete);
1670
+ if (hasButtons) {
1671
+ this.footer.classList.remove("d-none");
1672
+ } else {
1540
1673
  this.footer.classList.add("d-none");
1541
- this.footer.classList.remove("d-flex");
1674
+ }
1675
+ if (isSingleButton) {
1676
+ this.footer.classList.add("is-single-button");
1542
1677
  } else {
1543
- this.footer.classList.remove("d-none");
1544
- this.footer.classList.add("d-flex");
1678
+ this.footer.classList.remove("is-single-button");
1545
1679
  }
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
1680
  }
1555
- applySuccessValidationStyles() {
1681
+ applySuccessStyles() {
1556
1682
  this.container.classList.add("center");
1557
1683
  this.headerContainer.classList.add("center");
1684
+ this.headerInfoContainer.classList.add("d-none");
1685
+ this.headerCheckContainer.classList.remove("d-none");
1558
1686
  }
1559
- setBtnVisible(btnName, visible) {
1560
- const btn = btnName === "tryAgain" ? this.tryAgainBtn : this.completeBtn;
1687
+ applyFailureStyles(status) {
1688
+ this.headerCheckContainer.classList.add("d-none");
1689
+ this.headerInfoContainer.classList.remove("d-none");
1690
+ this.headerInfoSvg.setAttribute("class", `color-${status}`);
1691
+ }
1692
+ setVisible(el, visible) {
1561
1693
  if (visible) {
1562
- btn.classList.remove("d-none");
1694
+ el.classList.remove("d-none");
1563
1695
  } else {
1564
- btn.classList.add("d-none");
1696
+ el.classList.add("d-none");
1565
1697
  }
1566
1698
  }
1567
- addTryAgainHandler() {
1568
- this.tryAgainBtn.onclick = () => this.hide();
1569
- }
1570
1699
  addCompleteHandler(handler = () => {
1571
1700
  }) {
1572
- this.completeBtn.onclick = () => {
1701
+ this.completeBtn.addEventListener("click", () => {
1573
1702
  this.hide();
1574
1703
  handler();
1575
- };
1704
+ });
1576
1705
  }
1577
1706
  }
1578
1707
  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 +1729,15 @@ class ConsentForm {
1600
1729
  this.cancelBtn = document.getElementById("idvc-consent-form-cancel-btn");
1601
1730
  this.inputEl = document.getElementById("idvc-full-name-input");
1602
1731
  this.checkboxEl = document.getElementById("idvc-consent");
1603
- const self = this;
1604
1732
  const handler = {
1605
- set(obj, prop, value, receiver) {
1733
+ set: (obj, prop, value, receiver) => {
1606
1734
  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");
1735
+ if (this.isValidInput() && this.target.checkboxState) {
1736
+ this.proceedBtn.disabled = false;
1737
+ this.proceedBtn.classList.remove("btn--disabled");
1610
1738
  } else {
1611
- self.proceedBtn.disabled = true;
1612
- self.proceedBtn.classList.add("btn--disabled");
1739
+ this.proceedBtn.disabled = true;
1740
+ this.proceedBtn.classList.add("btn--disabled");
1613
1741
  }
1614
1742
  return true;
1615
1743
  },
@@ -1706,7 +1834,9 @@ class Validation {
1706
1834
  }
1707
1835
  if (this.status === ResponseStatus.INVALID_DATA) {
1708
1836
  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>`, "");
1837
+ const errorList = this.invalidDataErrors.reduce((acc, { code, message }) => {
1838
+ return `${acc}<li class="idvc-modal__body__list__item">${code === "OCRError" ? ocrMessage : message ?? ""}</li>`;
1839
+ }, "");
1710
1840
  const noNumbersClass = this.invalidDataErrors.length === 1 ? "idvc-modal__body__list--no-numbers" : "";
1711
1841
  this.result.content = `<ol class="idvc-modal__body__list ${noNumbersClass}">${errorList}</ol>`;
1712
1842
  }
@@ -2246,28 +2376,19 @@ const Fingerprint = {
2246
2376
  sha256: decrypt
2247
2377
  }
2248
2378
  };
2379
+ const allSettledValues = async (promises) => {
2380
+ const results = await Promise.allSettled(promises);
2381
+ return results.map((r) => r.status === "fulfilled" ? r.value : void 0);
2382
+ };
2249
2383
  const getBrowserMetadata = async () => {
2250
- const [
2251
- { value: browserInfo },
2252
- { value: screenInfo },
2253
- // @ts-ignore
2254
- { value: batteryInfo },
2255
- { value: connectionInfo }
2256
- ] = await Promise.allSettled([
2384
+ const [browserInfo, screenInfo, batteryInfo, connectionInfo] = await allSettledValues([
2257
2385
  Fingerprint.browserInfo(),
2258
2386
  Fingerprint.screenInfo(),
2259
2387
  Fingerprint.batteryInfo(),
2260
2388
  Fingerprint.connectionInfo()
2261
2389
  ]);
2262
2390
  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([
2391
+ const [browserInfoSHA, canvasInfo, fontsInfo, html5Info, webGlInfo] = await allSettledValues([
2271
2392
  sha256(JSON.stringify(browserInfo)),
2272
2393
  sha256(JSON.stringify(await Fingerprint.canvasInfo())),
2273
2394
  sha256(JSON.stringify(await Fingerprint.fontsInfo())),
@@ -2275,7 +2396,7 @@ const getBrowserMetadata = async () => {
2275
2396
  sha256(JSON.stringify(await Fingerprint.webGLInfo()))
2276
2397
  ]);
2277
2398
  return {
2278
- navigatorInfo: browserInfo.navigatorInfo,
2399
+ navigatorInfo: browserInfo == null ? void 0 : browserInfo.navigatorInfo,
2279
2400
  screenInfo,
2280
2401
  batteryInfo,
2281
2402
  connectionInfo,
@@ -4429,7 +4550,7 @@ function requireBrowser() {
4429
4550
  }
4430
4551
  var browserExports = requireBrowser();
4431
4552
  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';
4553
+ const qrCodeModalHTML = '<div class="idvc-modal-background d-none" id="idvc-modal-background">\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 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">\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 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</div>\n';
4433
4554
  class QRCodeModal extends Modal {
4434
4555
  constructor(mountEl, applicantId, domainApi, embeddedAppConnectionId, qrCodeLinkOrigin, state = QRCodeModalState.READY) {
4435
4556
  super(mountEl);
@@ -4489,7 +4610,7 @@ class QRCodeModal extends Modal {
4489
4610
  async generateQR(url) {
4490
4611
  try {
4491
4612
  await QRCode.toCanvas(this.qrCodeCanvas, url, {
4492
- width: this.qrCodeCanvas.width
4613
+ width: 180
4493
4614
  });
4494
4615
  } catch (e) {
4495
4616
  throw new Error(`generate qr code error: ${e}`);
@@ -4508,31 +4629,11 @@ const isiOS = () => [
4508
4629
  "iPad",
4509
4630
  "iPhone"
4510
4631
  ].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
4632
  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;
4633
+ const { userAgent } = navigator;
4634
+ return browserRE.test(userAgent) || browserREAlt.test(userAgent.slice(0, 4)) || isiOS();
4534
4635
  };
4535
- const version = "2.10.0";
4636
+ const version = "2.10.2";
4536
4637
  const packageJson = {
4537
4638
  version
4538
4639
  };
@@ -4552,7 +4653,7 @@ class Wrapper {
4552
4653
  return getQueryParam("qrCode") === "true";
4553
4654
  }
4554
4655
  get QRCodeIsAvailable() {
4555
- return !this.isEmbeddedFromQR && !this.config.demoMode && this.options.showQrCode && !checkIfMobile();
4656
+ return !this.isEmbeddedFromQR && !this.config.demoMode && this.configs.showQrCodeConfig && !checkIfMobile();
4556
4657
  }
4557
4658
  updateConfig(newConfig) {
4558
4659
  this.configs.libConfig = this.prepareConfig(newConfig);
@@ -4572,7 +4673,7 @@ class Wrapper {
4572
4673
  this.lib.loading = false;
4573
4674
  } else {
4574
4675
  this.lib.loading = false;
4575
- throw new Error();
4676
+ throw new Error("Applicant validation failed");
4576
4677
  }
4577
4678
  } catch (e) {
4578
4679
  this.lib.loading = false;
@@ -4627,7 +4728,7 @@ class Wrapper {
4627
4728
  const keys = Object.keys(wrapperSettings);
4628
4729
  keys.forEach((key) => {
4629
4730
  const value = wrapperSettings[key];
4630
- if (typeof value !== "undefined") {
4731
+ if (value !== void 0) {
4631
4732
  copy[key] = value;
4632
4733
  }
4633
4734
  });
@@ -4683,7 +4784,7 @@ class Wrapper {
4683
4784
  );
4684
4785
  }
4685
4786
  } else {
4686
- throw new Error();
4787
+ throw new Error("Applicant validation failed");
4687
4788
  }
4688
4789
  } catch (e) {
4689
4790
  this.onError(e);
@@ -4702,9 +4803,9 @@ class Wrapper {
4702
4803
  });
4703
4804
  }
4704
4805
  prepareConfig(options) {
4705
- const libSettings = JSON.parse(options);
4706
- libSettings.documentTypes = prepareDocumentTypes(libSettings);
4707
- return libSettings;
4806
+ const settings = JSON.parse(options);
4807
+ settings.documentTypes = prepareDocumentTypes(settings);
4808
+ return settings;
4708
4809
  }
4709
4810
  showSpinner() {
4710
4811
  this.validationModal.hideSpinner();
@@ -4750,7 +4851,7 @@ class Wrapper {
4750
4851
  return {
4751
4852
  applicantId: this.configs.applicantId,
4752
4853
  ...model,
4753
- ...{ documentType: isFaceAuth ? 10 : model.documentType },
4854
+ documentType: isFaceAuth ? 10 : model.documentType,
4754
4855
  ...fingerPrintResult,
4755
4856
  clientVersion: this.lib.version,
4756
4857
  clientType: ClientType.WebLibStandalone
@@ -4767,7 +4868,7 @@ class Wrapper {
4767
4868
  if (this.configs.IDVCDownloadVersion === "latest" && this.configs.libConfig.useCDN) {
4768
4869
  const currentProductionIdvcVersion = await this.api.getCurrentIdvcVersion();
4769
4870
  await this.lib.initializeLibrary(
4770
- !!this.configs.libConfig.useCDN,
4871
+ this.configs.libConfig.useCDN,
4771
4872
  currentProductionIdvcVersion
4772
4873
  );
4773
4874
  } else {
@@ -4798,7 +4899,7 @@ class Wrapper {
4798
4899
  this.validationOutput.status = ResponseStatus.COMPLETE;
4799
4900
  this.showValidationSuccess();
4800
4901
  } else {
4801
- throw new Error();
4902
+ throw new Error("Force close failed");
4802
4903
  }
4803
4904
  } catch (e) {
4804
4905
  this.onError(e);
@@ -4846,46 +4947,75 @@ class Wrapper {
4846
4947
  }
4847
4948
  processEmbeddedAppStart(status) {
4848
4949
  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);
4950
+ switch (status) {
4951
+ case EmbeddedStatus.NEVER_OPEN: {
4952
+ const firstStepMode = getFirstStepModeState();
4953
+ if (firstStepMode && this.configs.firstStepMode) {
4954
+ [this.configs.firstStepMode.video, this.configs.firstStepMode.uploader] = [
4955
+ firstStepMode.video,
4956
+ firstStepMode.uploader
4957
+ ];
4858
4958
  }
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
- ];
4959
+ this.QRCodeModal.state = QRCodeModalState.READY;
4960
+ this.QRCodeModal.closable = true;
4961
+ this.QRCodeModal.show();
4962
+ this.api.longPollingRequest(
4963
+ `IsOpen/${this.configs.applicantId}`,
4964
+ { method: "GET" },
4965
+ (isOpen) => {
4966
+ if (isOpen) {
4967
+ this.processEmbeddedAppStart(EmbeddedStatus.OPEN);
4968
+ }
4969
+ }
4970
+ );
4971
+ break;
4872
4972
  }
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);
4973
+ case EmbeddedStatus.OPEN:
4974
+ this.QRCodeModal.state = QRCodeModalState.VALIDATING;
4975
+ this.QRCodeModal.closable = false;
4976
+ this.QRCodeModal.show();
4977
+ this.api.longPollingRequest(
4978
+ `ValidationResponse/${this.configs.applicantId}/${this.embeddedAppConnectionId}`,
4979
+ { method: "GET" },
4980
+ (data) => {
4981
+ this.processEmbeddedAppEnd(data);
4881
4982
  }
4983
+ );
4984
+ if (this.configs.firstStepMode) {
4985
+ this.configs.firstStepMode.video = false;
4986
+ this.configs.firstStepMode.uploader = true;
4882
4987
  }
4883
- );
4884
- } else if (status === EmbeddedStatus.CLOSED_FOREVER) {
4885
- this.QRCodeModal.state = QRCodeModalState.DONE_WITH_ERROR;
4886
- this.QRCodeModal.closable = false;
4988
+ this.lib.updateDocumentTypes(this.configs.libConfig.documentTypes);
4989
+ break;
4990
+ case EmbeddedStatus.CLOSED: {
4991
+ const firstStepMode = getFirstStepModeState();
4992
+ if (firstStepMode && this.configs.firstStepMode) {
4993
+ [this.configs.firstStepMode.video, this.configs.firstStepMode.uploader] = [
4994
+ firstStepMode.video,
4995
+ firstStepMode.uploader
4996
+ ];
4997
+ }
4998
+ this.api.longPollingRequest(
4999
+ `IsOpen/${this.configs.applicantId}`,
5000
+ { method: "GET" },
5001
+ (isOpen) => {
5002
+ if (isOpen) {
5003
+ this.processEmbeddedAppStart(EmbeddedStatus.OPEN);
5004
+ }
5005
+ }
5006
+ );
5007
+ break;
5008
+ }
5009
+ case EmbeddedStatus.CLOSED_FOREVER:
5010
+ this.QRCodeModal.state = QRCodeModalState.DONE_WITH_ERROR;
5011
+ this.QRCodeModal.closable = false;
5012
+ break;
4887
5013
  }
4888
5014
  }
5015
+ // eslint-disable-next-line
5016
+ // eslint-disable-next-line sonarjs/todo-tag
5017
+ // TODO: ValidationApplicant is currently an intersection (&) of SuccessApplicantValidation and FailedApplicantValidationResult,
5018
+ // but semantically it should be a union (|). Refactor to use a union type with proper type narrowing.
4889
5019
  processEmbeddedAppEnd(data) {
4890
5020
  if ((data == null ? void 0 : data.status) === ResponseStatus.SUCCESS) {
4891
5021
  this.QRCodeModal.state = QRCodeModalState.DONE_WITH_SUCCESS;
@@ -4923,6 +5053,7 @@ class Wrapper {
4923
5053
  this.form.form.remove();
4924
5054
  }
4925
5055
  (_b = document.getElementById(this.configs.mountElement)) == null ? void 0 : _b.classList.remove("hidden-element");
5056
+ this.validationModal.prepareBackgroundStyles();
4926
5057
  this.validationModal.show();
4927
5058
  }
4928
5059
  return e;
@@ -4931,4 +5062,3 @@ class Wrapper {
4931
5062
  export {
4932
5063
  Wrapper as default
4933
5064
  };
4934
- //# sourceMappingURL=wrapper.es.js.map