@idscan/onboarding 2.9.3 → 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.
- package/dist/Wrapper.css +1 -1
- package/dist/Wrapper.d.ts +223 -0
- package/dist/src/Wrapper.d.ts +3 -1
- package/dist/wrapper.es.js +842 -156
- package/dist/wrapper.umd.js +1 -2
- package/package.json +25 -12
- package/readme.md +8 -0
- package/dist/custom_types/custom.d.ts +0 -20
- package/dist/src/@types/Api/Requests.d.ts +0 -22
- package/dist/src/@types/Api/Responses.d.ts +0 -97
- package/dist/src/@types/Data.d.ts +0 -110
- package/dist/src/@types/IDVCTypes.d.ts +0 -5
- package/dist/src/@types/Step.d.ts +0 -26
- package/dist/src/@types/enums.d.ts +0 -89
- package/dist/src/config.d.ts +0 -35
- package/dist/src/entry.d.ts +0 -1
- package/dist/src/errors/ConfigError.d.ts +0 -4
- package/dist/src/errors/FaceAuthorizationError.d.ts +0 -6
- package/dist/src/errors/HttpError.d.ts +0 -4
- package/dist/src/errors/NotValidApplicant.d.ts +0 -4
- package/dist/src/errors/RequestTimeoutError.d.ts +0 -4
- package/dist/src/errors/ValidationError.d.ts +0 -6
- package/dist/src/errors/WrapperError.d.ts +0 -5
- package/dist/src/helpers/fingerPrint.d.ts +0 -20
- package/dist/src/helpers/mobileChecker.d.ts +0 -15
- package/dist/src/helpers/requestModelCheckers.d.ts +0 -4
- package/dist/src/helpers/typeGuard.d.ts +0 -1
- package/dist/src/helpers/utils.d.ts +0 -9
- package/dist/src/helpers/validators.d.ts +0 -7
- package/dist/src/mocks/defaultValues.d.ts +0 -2
- package/dist/src/mocks/validation.json.d.ts +0 -9
- package/dist/src/modules/Api.d.ts +0 -21
- package/dist/src/modules/ConsentForm.d.ts +0 -19
- package/dist/src/modules/Lib.d.ts +0 -24
- package/dist/src/modules/Modal.d.ts +0 -26
- package/dist/src/modules/QRCodeModal.d.ts +0 -25
- package/dist/src/modules/Validation.d.ts +0 -24
- package/dist/src/modules/ValidationModal.d.ts +0 -15
- package/dist/vite.config.d.ts +0 -2
- package/dist/wrapper.es.js.map +0 -1
- package/dist/wrapper.umd.js.map +0 -1
package/dist/wrapper.es.js
CHANGED
|
@@ -523,7 +523,7 @@ function requireRuntime() {
|
|
|
523
523
|
}
|
|
524
524
|
requireRuntime();
|
|
525
525
|
const notEmptyString = (val) => !!val;
|
|
526
|
-
const isUUID = (str) =>
|
|
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 = (
|
|
693
|
+
const prepareDocumentTypes = (settings) => {
|
|
697
694
|
let result;
|
|
698
|
-
const filteredDocuments = getFilteredDocumentTypes(
|
|
699
|
-
const
|
|
700
|
-
if (
|
|
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 =
|
|
699
|
+
const frontStepIndex = passportDocument2.steps.findIndex((step) => step.type === "front");
|
|
703
700
|
if (frontStepIndex !== -1) {
|
|
704
|
-
|
|
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
|
|
780
|
+
const settings = JSON.parse(options == null ? void 0 : options.jsonSettings);
|
|
784
781
|
if (this.isAuth || this.faceOnly) {
|
|
785
|
-
this.libConfig = this.faceAuthorizationConfig(
|
|
782
|
+
this.libConfig = this.faceAuthorizationConfig(settings);
|
|
786
783
|
} else {
|
|
787
|
-
|
|
788
|
-
this.libConfig =
|
|
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(
|
|
794
|
-
|
|
795
|
-
|
|
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
|
|
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
|
|
984
|
-
|
|
985
|
-
|
|
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
|
|
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 (
|
|
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.
|
|
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 =
|
|
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
|
|
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:
|
|
1441
|
+
verifyFace: data.steps.some((item) => item.type === "face"),
|
|
1329
1442
|
documentType: data.documentType,
|
|
1330
|
-
captureMethod: data.steps.reduce((acc, step) => `${acc}${
|
|
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.
|
|
1360
|
-
script.
|
|
1361
|
-
document.body.
|
|
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
|
|
1387
|
-
<style id="onboarding-css-config">${this.CSSStylesConfig
|
|
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
|
|
1419
|
-
const
|
|
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.
|
|
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.
|
|
1649
|
+
this.tryAgainBtn.addEventListener("click", () => this.hide());
|
|
1525
1650
|
this.addCompleteHandler();
|
|
1526
1651
|
}
|
|
1527
|
-
set type(
|
|
1528
|
-
if (
|
|
1529
|
-
this.
|
|
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
|
|
1535
|
-
const
|
|
1536
|
-
const
|
|
1537
|
-
this.
|
|
1538
|
-
this.
|
|
1539
|
-
if (
|
|
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
|
-
|
|
1669
|
+
}
|
|
1670
|
+
if (isSingleButton) {
|
|
1671
|
+
this.footer.classList.add("is-single-button");
|
|
1542
1672
|
} else {
|
|
1543
|
-
this.footer.classList.remove("
|
|
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
|
-
|
|
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
|
-
|
|
1560
|
-
|
|
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
|
-
|
|
1689
|
+
el.classList.remove("d-none");
|
|
1563
1690
|
} else {
|
|
1564
|
-
|
|
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.
|
|
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 (
|
|
1608
|
-
|
|
1609
|
-
|
|
1730
|
+
if (this.isValidInput() && this.target.checkboxState) {
|
|
1731
|
+
this.proceedBtn.disabled = false;
|
|
1732
|
+
this.proceedBtn.classList.remove("btn--disabled");
|
|
1610
1733
|
} else {
|
|
1611
|
-
|
|
1612
|
-
|
|
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 }) =>
|
|
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
|
}
|
|
@@ -1743,6 +1868,556 @@ class Validation {
|
|
|
1743
1868
|
this.modal.hide();
|
|
1744
1869
|
}
|
|
1745
1870
|
}
|
|
1871
|
+
const apiKeys$1 = ["scheduling", "userActivation", "geolocation", "webkitTemporaryStorage", "webkitPersistentStorage", "getGamepads", "javaEnabled", "sendBeacon", "vibrate", "clipboard", "credentials", "keyboard", "managed", "mediaDevices", "storage", "serviceWorker", "virtualKeyboard", "wakeLock", "ink", "hid", "locks", "mediaCapabilities", "mediaSession", "presentation", "serial", "usb", "windowControlsOverlay", "xr", "userAgentData", "canShare", "share", "clearAppBadge", "getBattery", "getUserMedia", "requestMIDIAccess", "requestMediaKeySystemAccess", "setAppBadge", "webkitGetUserMedia", "getInstalledRelatedApps", "registerProtocolHandler", "unregisterProtocolHandler"];
|
|
1872
|
+
const json$3 = {
|
|
1873
|
+
apiKeys: apiKeys$1
|
|
1874
|
+
};
|
|
1875
|
+
function getIntlInfo() {
|
|
1876
|
+
const locale = navigator.language;
|
|
1877
|
+
if (locale && window.Intl) {
|
|
1878
|
+
const localeDate = new Intl.DateTimeFormat(locale, { dateStyle: "full", timeStyle: "long" });
|
|
1879
|
+
const {
|
|
1880
|
+
calendar,
|
|
1881
|
+
numberingSystem
|
|
1882
|
+
} = localeDate.resolvedOptions();
|
|
1883
|
+
const { weekInfo, collations } = new Intl.Locale(locale);
|
|
1884
|
+
return {
|
|
1885
|
+
locale,
|
|
1886
|
+
calendar,
|
|
1887
|
+
numberingSystem,
|
|
1888
|
+
weekInfo,
|
|
1889
|
+
collations
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
return {};
|
|
1893
|
+
}
|
|
1894
|
+
function getNavigatorInfo() {
|
|
1895
|
+
const {
|
|
1896
|
+
userAgent,
|
|
1897
|
+
cookieEnabled,
|
|
1898
|
+
platform,
|
|
1899
|
+
hardwareConcurrency,
|
|
1900
|
+
languages
|
|
1901
|
+
} = navigator;
|
|
1902
|
+
return {
|
|
1903
|
+
userAgent,
|
|
1904
|
+
cookieEnabled,
|
|
1905
|
+
platform,
|
|
1906
|
+
hardwareConcurrency,
|
|
1907
|
+
languages
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
function getAvailableNavigatorApiInfo() {
|
|
1911
|
+
return json$3.apiKeys.reduce((res, key) => {
|
|
1912
|
+
res[key] = !!window.navigator[key];
|
|
1913
|
+
return res;
|
|
1914
|
+
}, {});
|
|
1915
|
+
}
|
|
1916
|
+
function getAdditionalApiInfo() {
|
|
1917
|
+
const additionalApiKeys = [
|
|
1918
|
+
"BatteryManager",
|
|
1919
|
+
"NetworkInformation"
|
|
1920
|
+
];
|
|
1921
|
+
return additionalApiKeys.reduce((res, key) => {
|
|
1922
|
+
res[key] = !!window.navigator[key];
|
|
1923
|
+
return res;
|
|
1924
|
+
}, {});
|
|
1925
|
+
}
|
|
1926
|
+
async function getBrowserInfo() {
|
|
1927
|
+
return {
|
|
1928
|
+
internationalizationInfo: getIntlInfo(),
|
|
1929
|
+
navigatorInfo: getNavigatorInfo(),
|
|
1930
|
+
availableNavigatorApiInfo: getAvailableNavigatorApiInfo(),
|
|
1931
|
+
additionalApiInfo: getAdditionalApiInfo()
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
async function getScreenResolutionInfo() {
|
|
1935
|
+
const {
|
|
1936
|
+
width,
|
|
1937
|
+
height,
|
|
1938
|
+
availWidth,
|
|
1939
|
+
availHeight,
|
|
1940
|
+
colorDepth,
|
|
1941
|
+
pixelDepth,
|
|
1942
|
+
orientation
|
|
1943
|
+
} = window.screen;
|
|
1944
|
+
const {
|
|
1945
|
+
innerWidth,
|
|
1946
|
+
innerHeight,
|
|
1947
|
+
outerWidth,
|
|
1948
|
+
outerHeight
|
|
1949
|
+
} = window;
|
|
1950
|
+
return {
|
|
1951
|
+
width,
|
|
1952
|
+
height,
|
|
1953
|
+
availWidth,
|
|
1954
|
+
availHeight,
|
|
1955
|
+
colorDepth,
|
|
1956
|
+
pixelDepth,
|
|
1957
|
+
orientationAngle: orientation.angle,
|
|
1958
|
+
orientationType: orientation.type,
|
|
1959
|
+
innerWidth,
|
|
1960
|
+
innerHeight,
|
|
1961
|
+
outerWidth,
|
|
1962
|
+
outerHeight
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
async function getBatteryInfo() {
|
|
1966
|
+
if (navigator == null ? void 0 : navigator.getBattery) {
|
|
1967
|
+
const { charging, chargingTime, dischargingTime, level } = await navigator.getBattery();
|
|
1968
|
+
return {
|
|
1969
|
+
charging,
|
|
1970
|
+
chargingTime,
|
|
1971
|
+
dischargingTime,
|
|
1972
|
+
level
|
|
1973
|
+
};
|
|
1974
|
+
}
|
|
1975
|
+
return {};
|
|
1976
|
+
}
|
|
1977
|
+
async function getConnectionInfo() {
|
|
1978
|
+
if (navigator.connection) {
|
|
1979
|
+
const { effectiveType, downlink, rtt, saveData, type, downlinkMax } = navigator.connection;
|
|
1980
|
+
return {
|
|
1981
|
+
effectiveType,
|
|
1982
|
+
downlink,
|
|
1983
|
+
rtt,
|
|
1984
|
+
saveData,
|
|
1985
|
+
type,
|
|
1986
|
+
downlinkMax
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
return {};
|
|
1990
|
+
}
|
|
1991
|
+
async function decrypt(text = "") {
|
|
1992
|
+
if (window.crypto) {
|
|
1993
|
+
const textUint8 = new TextEncoder().encode(text);
|
|
1994
|
+
const subtle = crypto.subtle || crypto.webkitSubtle;
|
|
1995
|
+
const hashBuffer = await subtle.digest("SHA-256", textUint8);
|
|
1996
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
1997
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1998
|
+
return hashHex;
|
|
1999
|
+
}
|
|
2000
|
+
return text;
|
|
2001
|
+
}
|
|
2002
|
+
async function getCanvasInfo() {
|
|
2003
|
+
const canvas2 = document.createElement("canvas");
|
|
2004
|
+
const ctx = canvas2.getContext("2d");
|
|
2005
|
+
ctx.canvas.width = 500;
|
|
2006
|
+
ctx.fillStyle = "rgb(255,0,255)";
|
|
2007
|
+
ctx.beginPath();
|
|
2008
|
+
ctx.rect(20, 20, 150, 100);
|
|
2009
|
+
ctx.fill();
|
|
2010
|
+
ctx.stroke();
|
|
2011
|
+
ctx.closePath();
|
|
2012
|
+
ctx.beginPath();
|
|
2013
|
+
ctx.fillStyle = "rgb(0,255,255)";
|
|
2014
|
+
ctx.arc(50, 50, 50, 0, Math.PI * 2, true);
|
|
2015
|
+
ctx.fill();
|
|
2016
|
+
ctx.stroke();
|
|
2017
|
+
ctx.closePath();
|
|
2018
|
+
const txt = "i9as..$#po((^@KbXrw!~cz#$%^@£éúöüà情報çõ能的Fr<🍏🍎🍐🍊🍋";
|
|
2019
|
+
ctx.textBaseline = "top";
|
|
2020
|
+
ctx.font = "14px 'Arial'";
|
|
2021
|
+
ctx.textBaseline = "alphabetic";
|
|
2022
|
+
ctx.fillStyle = "rgb(255,5,5)";
|
|
2023
|
+
ctx.rotate(0.03);
|
|
2024
|
+
ctx.fillText(txt, 4, 17);
|
|
2025
|
+
ctx.fillStyle = "#069";
|
|
2026
|
+
ctx.fillText(txt, 2, 15);
|
|
2027
|
+
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
|
|
2028
|
+
ctx.fillText(txt, 4, 17);
|
|
2029
|
+
ctx.shadowBlur = 8;
|
|
2030
|
+
ctx.shadowColor = "red";
|
|
2031
|
+
ctx.fillRect(20, 12, 100, 5);
|
|
2032
|
+
ctx.globalCompositeOperation = "multiply";
|
|
2033
|
+
ctx.fillStyle = "rgb(255,0,255)";
|
|
2034
|
+
ctx.beginPath();
|
|
2035
|
+
ctx.arc(50, 50, 50, 0, Math.PI * 2, true);
|
|
2036
|
+
ctx.closePath();
|
|
2037
|
+
ctx.fill();
|
|
2038
|
+
ctx.fillStyle = "rgb(0,255,255)";
|
|
2039
|
+
ctx.beginPath();
|
|
2040
|
+
ctx.arc(100, 50, 50, 0, Math.PI * 2, true);
|
|
2041
|
+
ctx.closePath();
|
|
2042
|
+
ctx.fill();
|
|
2043
|
+
ctx.fillStyle = "rgb(255,255,0)";
|
|
2044
|
+
ctx.beginPath();
|
|
2045
|
+
ctx.arc(75, 100, 50, 0, Math.PI * 2, true);
|
|
2046
|
+
ctx.closePath();
|
|
2047
|
+
ctx.fill();
|
|
2048
|
+
ctx.fillStyle = "rgb(255,0,255)";
|
|
2049
|
+
ctx.arc(75, 75, 75, 0, Math.PI * 2, true);
|
|
2050
|
+
ctx.arc(75, 75, 25, 0, Math.PI * 2, true);
|
|
2051
|
+
ctx.fill("evenodd");
|
|
2052
|
+
const base64Data = canvas2.toDataURL();
|
|
2053
|
+
return decrypt(base64Data);
|
|
2054
|
+
}
|
|
2055
|
+
const fonts = /* @__PURE__ */ JSON.parse('[".Aqua Kana",".Helvetica LT MM",".Times LT MM","18thCentury","8514oem","AR BERKLEY","AR JULIAN","AR PL UKai CN","AR PL UMing CN","AR PL UMing HK","AR PL UMing TW","AR PL UMing TW MBE","Aakar","Abadi MT Condensed Extra Bold","Abadi MT Condensed Light","Abyssinica SIL","AcmeFont","Adobe Arabic","Agency FB","Aharoni","Aharoni Bold","Al Bayan","Al Bayan Bold","Al Bayan Plain","Al Nile","Al Tarikh","Aldhabi","Alfredo","Algerian","Alien Encounters","Almonte Snow","American Typewriter","American Typewriter Bold","American Typewriter Condensed","American Typewriter Light","Amethyst","Andale Mono","Andale Mono Version","Andalus","Angsana New","AngsanaUPC","Ani","AnjaliOldLipi","Aparajita","Apple Braille","Apple Braille Outline 6 Dot","Apple Braille Outline 8 Dot","Apple Braille Pinpoint 6 Dot","Apple Braille Pinpoint 8 Dot","Apple Chancery","Apple Color Emoji","Apple LiGothic Medium","Apple LiSung Light","Apple SD Gothic Neo","Apple SD Gothic Neo Regular","Apple SD GothicNeo ExtraBold","Apple Symbols","AppleGothic","AppleGothic Regular","AppleMyungjo","AppleMyungjo Regular","AquaKana","Arabic Transparent","Arabic Typesetting","Arial","Arial Baltic","Arial Black","Arial Bold","Arial Bold Italic","Arial CE","Arial CYR","Arial Greek","Arial Hebrew","Arial Hebrew Bold","Arial Italic","Arial Narrow","Arial Narrow Bold","Arial Narrow Bold Italic","Arial Narrow Italic","Arial Rounded Bold","Arial Rounded MT Bold","Arial TUR","Arial Unicode MS","ArialHB","Arimo","Asimov","Autumn","Avenir","Avenir Black","Avenir Book","Avenir Next","Avenir Next Bold","Avenir Next Condensed","Avenir Next Condensed Bold","Avenir Next Demi Bold","Avenir Next Heavy","Avenir Next Regular","Avenir Roman","Ayuthaya","BN Jinx","BN Machine","BOUTON International Symbols","Baby Kruffy","Baghdad","Bahnschrift","Balthazar","Bangla MN","Bangla MN Bold","Bangla Sangam MN","Bangla Sangam MN Bold","Baskerville","Baskerville Bold","Baskerville Bold Italic","Baskerville Old Face","Baskerville SemiBold","Baskerville SemiBold Italic","Bastion","Batang","BatangChe","Bauhaus 93","Beirut","Bell MT","Bell MT Bold","Bell MT Italic","Bellerose","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BiauKai","Big Caslon","Big Caslon Medium","Birch Std","Bitstream Charter","Bitstream Vera Sans","Blackadder ITC","Blackoak Std","Bobcat","Bodoni 72","Bodoni MT","Bodoni MT Black","Bodoni MT Poster Compressed","Bodoni Ornaments","BolsterBold","Book Antiqua","Book Antiqua Bold","Bookman Old Style","Bookman Old Style Bold","Bookshelf Symbol 7","Borealis","Bradley Hand","Bradley Hand ITC","Braggadocio","Brandish","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script","Brush Script MT","Brush Script MT Italic","Brush Script Std","Brussels","Calibri","Calibri Bold","Calibri Light","Californian FB","Calisto MT","Calisto MT Bold","Calligraphic","Calvin","Cambria","Cambria Bold","Cambria Math","Candara","Candara Bold","Candles","Carrois Gothic SC","Castellar","Centaur","Century","Century Gothic","Century Gothic Bold","Century Schoolbook","Century Schoolbook Bold","Century Schoolbook L","Chalkboard","Chalkboard Bold","Chalkboard SE","Chalkboard SE Bold","ChalkboardBold","Chalkduster","Chandas","Chaparral Pro","Chaparral Pro Light","Charlemagne Std","Charter","Chilanka","Chiller","Chinyen","Clarendon","Cochin","Cochin Bold","Colbert","Colonna MT","Comic Sans MS","Comic Sans MS Bold","Commons","Consolas","Consolas Bold","Constantia","Constantia Bold","Coolsville","Cooper Black","Cooper Std Black","Copperplate","Copperplate Bold","Copperplate Gothic Bold","Copperplate Light","Corbel","Corbel Bold","Cordia New","CordiaUPC","Corporate","Corsiva","Corsiva Hebrew","Corsiva Hebrew Bold","Courier","Courier 10 Pitch","Courier Bold","Courier New","Courier New Baltic","Courier New Bold","Courier New CE","Courier New Italic","Courier Oblique","Cracked Johnnie","Creepygirl","Curlz MT","Cursor","Cutive Mono","DFKai-SB","DIN Alternate","DIN Condensed","Damascus","Damascus Bold","Dancing Script","DaunPenh","David","Dayton","DecoType Naskh","Deja Vu","DejaVu LGC Sans","DejaVu Sans","DejaVu Sans Mono","DejaVu Serif","Deneane","Desdemona","Detente","Devanagari MT","Devanagari MT Bold","Devanagari Sangam MN","Didot","Didot Bold","Digifit","DilleniaUPC","Dingbats","Distant Galaxy","Diwan Kufi","Diwan Kufi Regular","Diwan Thuluth","Diwan Thuluth Regular","DokChampa","Dominican","Dotum","DotumChe","Droid Sans","Droid Sans Fallback","Droid Sans Mono","Dyuthi","Ebrima","Edwardian Script ITC","Elephant","Emmett","Engravers MT","Engravers MT Bold","Enliven","Eras Bold ITC","Estrangelo Edessa","Ethnocentric","EucrosiaUPC","Euphemia","Euphemia UCAS","Euphemia UCAS Bold","Eurostile","Eurostile Bold","Expressway Rg","FangSong","Farah","Farisi","Felix Titling","Fingerpop","Fixedsys","Flubber","Footlight MT Light","Forte","FrankRuehl","Frankfurter Venetian TT","Franklin Gothic Book","Franklin Gothic Book Italic","Franklin Gothic Medium","Franklin Gothic Medium Cond","Franklin Gothic Medium Italic","FreeMono","FreeSans","FreeSerif","FreesiaUPC","Freestyle Script","French Script MT","Futura","Futura Condensed ExtraBold","Futura Medium","GB18030 Bitmap","Gabriola","Gadugi","Garamond","Garamond Bold","Gargi","Garuda","Gautami","Gazzarelli","Geeza Pro","Geeza Pro Bold","Geneva","GenevaCY","Gentium","Gentium Basic","Gentium Book Basic","GentiumAlt","Georgia","Georgia Bold","Geotype TT","Giddyup Std","Gigi","Gill","Gill Sans","Gill Sans Bold","Gill Sans MT","Gill Sans MT Bold","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans MT Italic","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Glockenspiel","Gloucester MT Extra Condensed","Good Times","Goudy","Goudy Old Style","Goudy Old Style Bold","Goudy Stout","Greek Diner Inline TT","Gubbi","Gujarati MT","Gujarati MT Bold","Gujarati Sangam MN","Gujarati Sangam MN Bold","Gulim","GulimChe","GungSeo Regular","Gungseouche","Gungsuh","GungsuhChe","Gurmukhi","Gurmukhi MN","Gurmukhi MN Bold","Gurmukhi MT","Gurmukhi Sangam MN","Gurmukhi Sangam MN Bold","Haettenschweiler","Hand Me Down S (BRK)","Hansen","Harlow Solid Italic","Harrington","Harvest","HarvestItal","Haxton Logos TT","HeadLineA Regular","HeadlineA","Heavy Heap","Hei","Hei Regular","Heiti SC","Heiti SC Light","Heiti SC Medium","Heiti TC","Heiti TC Light","Heiti TC Medium","Helvetica","Helvetica Bold","Helvetica CY Bold","Helvetica CY Plain","Helvetica LT Std","Helvetica Light","Helvetica Neue","Helvetica Neue Bold","Helvetica Neue Medium","Helvetica Oblique","HelveticaCY","HelveticaNeueLT Com 107 XBlkCn","Herculanum","High Tower Text","Highboot","Hiragino Kaku Gothic Pro W3","Hiragino Kaku Gothic Pro W6","Hiragino Kaku Gothic ProN W3","Hiragino Kaku Gothic ProN W6","Hiragino Kaku Gothic Std W8","Hiragino Kaku Gothic StdN W8","Hiragino Maru Gothic Pro W4","Hiragino Maru Gothic ProN W4","Hiragino Mincho Pro W3","Hiragino Mincho Pro W6","Hiragino Mincho ProN W3","Hiragino Mincho ProN W6","Hiragino Sans GB W3","Hiragino Sans GB W6","Hiragino Sans W0","Hiragino Sans W1","Hiragino Sans W2","Hiragino Sans W3","Hiragino Sans W4","Hiragino Sans W5","Hiragino Sans W6","Hiragino Sans W7","Hiragino Sans W8","Hiragino Sans W9","Hobo Std","Hoefler Text","Hoefler Text Black","Hoefler Text Ornaments","Hollywood Hills","Hombre","Huxley Titling","ITC Stone Serif","ITF Devanagari","ITF Devanagari Marathi","ITF Devanagari Medium","Impact","Imprint MT Shadow","InaiMathi","Induction","Informal Roman","Ink Free","IrisUPC","Iskoola Pota","Italianate","Jamrul","JasmineUPC","Javanese Text","Jokerman","Juice ITC","KacstArt","KacstBook","KacstDecorative","KacstDigital","KacstFarsi","KacstLetter","KacstNaskh","KacstOffice","KacstOne","KacstPen","KacstPoster","KacstQurn","KacstScreen","KacstTitle","KacstTitleL","Kai","Kai Regular","KaiTi","Kailasa","Kailasa Regular","Kaiti SC","Kaiti SC Black","Kalapi","Kalimati","Kalinga","Kannada MN","Kannada MN Bold","Kannada Sangam MN","Kannada Sangam MN Bold","Kartika","Karumbi","Kedage","Kefa","Kefa Bold","Keraleeyam","Keyboard","Khmer MN","Khmer MN Bold","Khmer OS","Khmer OS System","Khmer Sangam MN","Khmer UI","Kinnari","Kino MT","KodchiangUPC","Kohinoor Bangla","Kohinoor Devanagari","Kohinoor Telugu","Kokila","Kokonor","Kokonor Regular","Kozuka Gothic Pr6N B","Kristen ITC","Krungthep","KufiStandardGK","KufiStandardGK Regular","Kunstler Script","Laksaman","Lao MN","Lao Sangam MN","Lao UI","LastResort","Latha","Leelawadee","Letter Gothic Std","LetterOMatic!","Levenim MT","LiHei Pro","LiSong Pro","Liberation Mono","Liberation Sans","Liberation Sans Narrow","Liberation Serif","Likhan","LilyUPC","Limousine","Lithos Pro Regular","LittleLordFontleroy","Lohit Assamese","Lohit Bengali","Lohit Devanagari","Lohit Gujarati","Lohit Gurmukhi","Lohit Hindi","Lohit Kannada","Lohit Malayalam","Lohit Odia","Lohit Punjabi","Lohit Tamil","Lohit Tamil Classical","Lohit Telugu","Loma","Lucida Blackletter","Lucida Bright","Lucida Bright Demibold","Lucida Bright Demibold Italic","Lucida Bright Italic","Lucida Calligraphy","Lucida Calligraphy Italic","Lucida Console","Lucida Fax","Lucida Fax Demibold","Lucida Fax Regular","Lucida Grande","Lucida Grande Bold","Lucida Handwriting","Lucida Handwriting Italic","Lucida Sans","Lucida Sans Demibold Italic","Lucida Sans Typewriter","Lucida Sans Typewriter Bold","Lucida Sans Unicode","Luminari","Luxi Mono","MS Gothic","MS Mincho","MS Outlook","MS PGothic","MS PMincho","MS Reference Sans Serif","MS Reference Specialty","MS Sans Serif","MS Serif","MS UI Gothic","MT Extra","MV Boli","Mael","Magneto","Maiandra GD","Malayalam MN","Malayalam MN Bold","Malayalam Sangam MN","Malayalam Sangam MN Bold","Malgun Gothic","Mallige","Mangal","Manorly","Marion","Marion Bold","Marker Felt","Marker Felt Thin","Marlett","Martina","Matura MT Script Capitals","Meera","Meiryo","Meiryo Bold","Meiryo UI","MelodBold","Menlo","Menlo Bold","Mesquite Std","Microsoft","Microsoft Himalaya","Microsoft JhengHei","Microsoft JhengHei UI","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Sans Serif","Microsoft Tai Le","Microsoft Tai Le Bold","Microsoft Uighur","Microsoft YaHei","Microsoft YaHei UI","Microsoft Yi Baiti","Minerva","MingLiU","MingLiU-ExtB","MingLiU_HKSCS","Minion Pro","Miriam","Mishafi","Mishafi Gold","Mistral","Modern","Modern No. 20","Monaco","Mongolian Baiti","Monospace","Monotype Corsiva","Monotype Sorts","MoolBoran","Moonbeam","MotoyaLMaru","Mshtakan","Mshtakan Bold","Mukti Narrow","Muna","Myanmar MN","Myanmar MN Bold","Myanmar Sangam MN","Myanmar Text","Mycalc","Myriad Arabic","Myriad Hebrew","Myriad Pro","NISC18030","NSimSun","Nadeem","Nadeem Regular","Nakula","Nanum Barun Gothic","Nanum Gothic","Nanum Myeongjo","NanumBarunGothic","NanumGothic","NanumGothic Bold","NanumGothicCoding","NanumMyeongjo","NanumMyeongjo Bold","Narkisim","Nasalization","Navilu","Neon Lights","New Peninim MT","New Peninim MT Bold","News Gothic MT","News Gothic MT Bold","Niagara Engraved","Niagara Solid","Nimbus Mono L","Nimbus Roman No9 L","Nimbus Sans L","Nimbus Sans L Condensed","Nina","Nirmala UI","Nirmala.ttf","Norasi","Noteworthy","Noteworthy Bold","Noto Color Emoji","Noto Emoji","Noto Mono","Noto Naskh Arabic","Noto Nastaliq Urdu","Noto Sans","Noto Sans Armenian","Noto Sans Bengali","Noto Sans CJK","Noto Sans Canadian Aboriginal","Noto Sans Cherokee","Noto Sans Devanagari","Noto Sans Ethiopic","Noto Sans Georgian","Noto Sans Gujarati","Noto Sans Gurmukhi","Noto Sans Hebrew","Noto Sans JP","Noto Sans KR","Noto Sans Kannada","Noto Sans Khmer","Noto Sans Lao","Noto Sans Malayalam","Noto Sans Myanmar","Noto Sans Oriya","Noto Sans SC","Noto Sans Sinhala","Noto Sans Symbols","Noto Sans TC","Noto Sans Tamil","Noto Sans Telugu","Noto Sans Thai","Noto Sans Yi","Noto Serif","Notram","November","Nueva Std","Nueva Std Cond","Nyala","OCR A Extended","OCR A Std","Old English Text MT","OldeEnglish","Onyx","OpenSymbol","OpineHeavy","Optima","Optima Bold","Optima Regular","Orator Std","Oriya MN","Oriya MN Bold","Oriya Sangam MN","Oriya Sangam MN Bold","Osaka","Osaka-Mono","OsakaMono","PCMyungjo Regular","PCmyoungjo","PMingLiU","PMingLiU-ExtB","PR Celtic Narrow","PT Mono","PT Sans","PT Sans Bold","PT Sans Caption Bold","PT Sans Narrow Bold","PT Serif","Padauk","Padauk Book","Padmaa","Pagul","Palace Script MT","Palatino","Palatino Bold","Palatino Linotype","Palatino Linotype Bold","Papyrus","Papyrus Condensed","Parchment","Parry Hotter","PenultimateLight","Perpetua","Perpetua Bold","Perpetua Titling MT","Perpetua Titling MT Bold","Phetsarath OT","Phosphate","Phosphate Inline","Phosphate Solid","PhrasticMedium","PilGi Regular","Pilgiche","PingFang HK","PingFang SC","PingFang TC","Pirate","Plantagenet Cherokee","Playbill","Poor Richard","Poplar Std","Pothana2000","Prestige Elite Std","Pristina","Purisa","QuiverItal","Raanana","Raanana Bold","Raavi","Rachana","Rage Italic","RaghuMalayalam","Ravie","Rekha","Roboto","Rockwell","Rockwell Bold","Rockwell Condensed","Rockwell Extra Bold","Rockwell Italic","Rod","Roland","Rondalo","Rosewood Std Regular","RowdyHeavy","Russel Write TT","SF Movie Poster","STFangsong","STHeiti","STIXGeneral","STIXGeneral-Bold","STIXGeneral-Regular","STIXIntegralsD","STIXIntegralsD-Bold","STIXIntegralsSm","STIXIntegralsSm-Bold","STIXIntegralsUp","STIXIntegralsUp-Bold","STIXIntegralsUp-Regular","STIXIntegralsUpD","STIXIntegralsUpD-Bold","STIXIntegralsUpD-Regular","STIXIntegralsUpSm","STIXIntegralsUpSm-Bold","STIXNonUnicode","STIXNonUnicode-Bold","STIXSizeFiveSym","STIXSizeFiveSym-Regular","STIXSizeFourSym","STIXSizeFourSym-Bold","STIXSizeOneSym","STIXSizeOneSym-Bold","STIXSizeThreeSym","STIXSizeThreeSym-Bold","STIXSizeTwoSym","STIXSizeTwoSym-Bold","STIXVariants","STIXVariants-Bold","STKaiti","STSong","STXihei","SWGamekeys MT","Saab","Sahadeva","Sakkal Majalla","Salina","Samanata","Samyak Devanagari","Samyak Gujarati","Samyak Malayalam","Samyak Tamil","Sana","Sana Regular","Sans","Sarai","Sathu","Savoye LET Plain:1.0","Sawasdee","Script","Script MT Bold","Segoe MDL2 Assets","Segoe Print","Segoe Pseudo","Segoe Script","Segoe UI","Segoe UI Emoji","Segoe UI Historic","Segoe UI Semilight","Segoe UI Symbol","Serif","Shonar Bangla","Showcard Gothic","Shree Devanagari 714","Shruti","SignPainter-HouseScript","Silom","SimHei","SimSun","SimSun-ExtB","Simplified Arabic","Simplified Arabic Fixed","Sinhala MN","Sinhala MN Bold","Sinhala Sangam MN","Sinhala Sangam MN Bold","Sitka","Skia","Skia Regular","Skinny","Small Fonts","Snap ITC","Snell Roundhand","Snowdrift","Songti SC","Songti SC Black","Songti TC","Source Code Pro","Splash","Standard Symbols L","Stencil","Stencil Std","Stephen","Sukhumvit Set","Suruma","Sylfaen","Symbol","Symbole","System","System Font","TAMu_Kadambri","TAMu_Kalyani","TAMu_Maduram","TSCu_Comic","TSCu_Paranar","TSCu_Times","Tahoma","Tahoma Negreta","TakaoExGothic","TakaoExMincho","TakaoGothic","TakaoMincho","TakaoPGothic","TakaoPMincho","Tamil MN","Tamil MN Bold","Tamil Sangam MN","Tamil Sangam MN Bold","Tarzan","Tekton Pro","Tekton Pro Cond","Tekton Pro Ext","Telugu MN","Telugu MN Bold","Telugu Sangam MN","Telugu Sangam MN Bold","Tempus Sans ITC","Terminal","Terminator Two","Thonburi","Thonburi Bold","Tibetan Machine Uni","Times","Times Bold","Times New Roman","Times New Roman Baltic","Times New Roman Bold","Times New Roman Italic","Times Roman","Tlwg Mono","Tlwg Typewriter","Tlwg Typist","Tlwg Typo","TlwgMono","TlwgTypewriter","Toledo","Traditional Arabic","Trajan Pro","Trattatello","Trebuchet MS","Trebuchet MS Bold","Tunga","Tw Cen MT","Tw Cen MT Bold","Tw Cen MT Italic","URW Bookman L","URW Chancery L","URW Gothic L","URW Palladio L","Ubuntu","Ubuntu Condensed","Ubuntu Mono","Ukai","Ume Gothic","Ume Mincho","Ume P Gothic","Ume P Mincho","Ume UI Gothic","Uming","Umpush","UnBatang","UnDinaru","UnDotum","UnGraphic","UnGungseo","UnPilgi","Untitled1","Urdu Typesetting","Uroob","Utkal","Utopia","Utsaah","Valken","Vani","Vemana2000","Verdana","Verdana Bold","Vijaya","Viner Hand ITC","Vivaldi","Vivian","Vladimir Script","Vrinda","Waree","Waseem","Waverly","Webdings","WenQuanYi Bitmap Song","WenQuanYi Micro Hei","WenQuanYi Micro Hei Mono","WenQuanYi Zen Hei","Whimsy TT","Wide Latin","Wingdings","Wingdings 2","Wingdings 3","Woodcut","X-Files","Year supply of fairy cakes","Yu Gothic","Yu Mincho","Yuppy SC","Yuppy SC Regular","Yuppy TC","Yuppy TC Regular","Zapf Dingbats","Zapfino","Zawgyi-One","gargi","lklug","mry_KacstQurn","ori1Uni"]');
|
|
2056
|
+
const json$2 = {
|
|
2057
|
+
fonts
|
|
2058
|
+
};
|
|
2059
|
+
const FONT_SIZE = "40px";
|
|
2060
|
+
const TEST_STRING = "IDScan2023";
|
|
2061
|
+
const BASE_FONT = "sans-serif";
|
|
2062
|
+
const BODY_ELEM = document.body;
|
|
2063
|
+
const fontOffsetSizes = {};
|
|
2064
|
+
function initializeDefaultSpan() {
|
|
2065
|
+
const spanElement = document.createElement("span");
|
|
2066
|
+
spanElement.style.fontSize = FONT_SIZE;
|
|
2067
|
+
spanElement.textContent = TEST_STRING;
|
|
2068
|
+
spanElement.style.fontFamily = BASE_FONT;
|
|
2069
|
+
BODY_ELEM.appendChild(spanElement);
|
|
2070
|
+
fontOffsetSizes[BASE_FONT] = { width: spanElement.offsetWidth, height: spanElement.offsetHeight };
|
|
2071
|
+
BODY_ELEM.removeChild(spanElement);
|
|
2072
|
+
}
|
|
2073
|
+
async function getAvailableFontsInfo() {
|
|
2074
|
+
initializeDefaultSpan();
|
|
2075
|
+
const detectedFonts = new Array(json$2.fonts.length).fill(false);
|
|
2076
|
+
const fragment = new DocumentFragment();
|
|
2077
|
+
const fontEls = json$2.fonts.map(async (font) => {
|
|
2078
|
+
const span = document.createElement("span");
|
|
2079
|
+
span.style.fontSize = FONT_SIZE;
|
|
2080
|
+
span.textContent = TEST_STRING;
|
|
2081
|
+
span.style.fontFamily = `"${font}",${BASE_FONT}`;
|
|
2082
|
+
return span;
|
|
2083
|
+
});
|
|
2084
|
+
await Promise.all(fontEls).then((res) => {
|
|
2085
|
+
res.forEach((el) => fragment.appendChild(el));
|
|
2086
|
+
const fragmentContainer = document.createElement("div");
|
|
2087
|
+
BODY_ELEM.appendChild(fragmentContainer);
|
|
2088
|
+
fragmentContainer.append(fragment);
|
|
2089
|
+
Array.from(fragmentContainer.children).forEach((spanElem, index) => {
|
|
2090
|
+
const match = spanElem.offsetWidth !== fontOffsetSizes[BASE_FONT].width || spanElem.offsetHeight !== fontOffsetSizes[BASE_FONT].height;
|
|
2091
|
+
detectedFonts[index] = match;
|
|
2092
|
+
});
|
|
2093
|
+
fragmentContainer.remove();
|
|
2094
|
+
});
|
|
2095
|
+
return detectedFonts;
|
|
2096
|
+
}
|
|
2097
|
+
async function getFontsInfo() {
|
|
2098
|
+
return {
|
|
2099
|
+
availableFontsInfo: await getAvailableFontsInfo()
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2102
|
+
const videoCodecs = ["video/mp4; codecs=avc1.42E01E", "video/mp4; codecs=mp4a.40.2", "video/webm; codecs=vorbis", "video/webm; codecs=vp8", "video/webm; codecs=vp9", "video/ogg; codecs=vorbis", "video/ogg; codecs=theora", "video/mp4; codecs=hev1", "application/vnd.apple.mpegurl; codecs=avc1.42E01E, mp4a.40.2"];
|
|
2103
|
+
const audioCodecs = ["audio/mpeg", "audio/aac", "audio/alac", "audio/flac", "audio/ogg; codecs=vorbis", "audio/ogg; codecs=opus", "audio/flac", "audio/webm; codecs=vorbis", "audio/webm; codecs=opus", "audio/mp4"];
|
|
2104
|
+
const apiKeys = ["history", "speechSynthesis", "webkitSpeechRecognition", "IntersectionObserver", "ResizeObserver", "PushManager", "TextTrack", "postMessage", "structuredClone", "worker", "SharedWorker", "ServiceWorker"];
|
|
2105
|
+
const inputTypes = ["color", "date", "datetime-local", "datetime", "email", "month", "number", "password", "search", "tel", "text", "time", "url", "week", "file", "range"];
|
|
2106
|
+
const inputAvailableAttributes = ["accept", "alt", "autocomplete", "autofocus", "checked", "dirname", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "minlength", "multiple", "name", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "value", "width"];
|
|
2107
|
+
const json$1 = {
|
|
2108
|
+
videoCodecs,
|
|
2109
|
+
audioCodecs,
|
|
2110
|
+
apiKeys,
|
|
2111
|
+
inputTypes,
|
|
2112
|
+
inputAvailableAttributes
|
|
2113
|
+
};
|
|
2114
|
+
function HTML5AudioInfo() {
|
|
2115
|
+
const audio = document.createElement("audio");
|
|
2116
|
+
return json$1.audioCodecs.reduce((res, codec) => {
|
|
2117
|
+
res[codec] = !!audio.canPlayType(codec);
|
|
2118
|
+
return res;
|
|
2119
|
+
}, {});
|
|
2120
|
+
}
|
|
2121
|
+
function HTML5AvailableAPIInfo() {
|
|
2122
|
+
return json$1.apiKeys.reduce((res, key) => {
|
|
2123
|
+
res[key] = !!window[key];
|
|
2124
|
+
return res;
|
|
2125
|
+
}, {});
|
|
2126
|
+
}
|
|
2127
|
+
function HTML5InputInfo() {
|
|
2128
|
+
const input = document.createElement("input");
|
|
2129
|
+
return {
|
|
2130
|
+
inputTypes: json$1.inputTypes.reduce((res, type) => {
|
|
2131
|
+
input.setAttribute("type", type);
|
|
2132
|
+
res[type] = input.type === type;
|
|
2133
|
+
return res;
|
|
2134
|
+
}, {}),
|
|
2135
|
+
inputAvailableAttributes: json$1.inputAvailableAttributes.reduce((res, attribute) => {
|
|
2136
|
+
res[attribute] = attribute in input;
|
|
2137
|
+
return res;
|
|
2138
|
+
}, {})
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
async function getHTML5Info() {
|
|
2142
|
+
return {
|
|
2143
|
+
audioInfo: HTML5AudioInfo(),
|
|
2144
|
+
availableAPIInfo: HTML5AvailableAPIInfo(),
|
|
2145
|
+
inputInfo: HTML5InputInfo()
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
async function getVideoCodecsInfo() {
|
|
2149
|
+
const video = document.createElement("video");
|
|
2150
|
+
return json$1.videoCodecs.reduce((acc, codec) => {
|
|
2151
|
+
acc[codec] = video.canPlayType(codec);
|
|
2152
|
+
return acc;
|
|
2153
|
+
}, {});
|
|
2154
|
+
}
|
|
2155
|
+
async function getTimeZoneInfo() {
|
|
2156
|
+
var _a, _b;
|
|
2157
|
+
if (window.Intl) {
|
|
2158
|
+
return (_b = (_a = Intl.DateTimeFormat()) == null ? void 0 : _a.resolvedOptions()) == null ? void 0 : _b.timeZone;
|
|
2159
|
+
}
|
|
2160
|
+
return "";
|
|
2161
|
+
}
|
|
2162
|
+
const WebGLConstants = ["ALIASED_LINE_WIDTH_RANGE", "ALIASED_POINT_SIZE_RANGE", "ALPHA_BITS", "BLUE_BITS", "DEPTH_BITS", "GREEN_BITS", "MAX_COMBINED_TEXTURE_IMAGE_UNITS", "MAX_CUBE_MAP_TEXTURE_SIZE", "MAX_FRAGMENT_UNIFORM_VECTORS", "MAX_RENDERBUFFER_SIZE", "MAX_TEXTURE_IMAGE_UNITS", "MAX_TEXTURE_SIZE", "MAX_VARYING_VECTORS", "MAX_VERTEX_ATTRIBS", "MAX_VERTEX_TEXTURE_IMAGE_UNITS", "MAX_VERTEX_UNIFORM_VECTORS", "MAX_VIEWPORT_DIMS", "RED_BITS", "RENDERER", "SHADING_LANGUAGE_VERSION", "STENCIL_BITS", "VERSION"];
|
|
2163
|
+
const WebGL2Constants = ["MAX_VARYING_COMPONENTS", "MAX_VERTEX_UNIFORM_COMPONENTS", "MAX_VERTEX_UNIFORM_BLOCKS", "MAX_VERTEX_OUTPUT_COMPONENTS", "MAX_PROGRAM_TEXEL_OFFSET", "MAX_3D_TEXTURE_SIZE", "MAX_ARRAY_TEXTURE_LAYERS", "MAX_COLOR_ATTACHMENTS", "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "MAX_COMBINED_UNIFORM_BLOCKS", "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "MAX_DRAW_BUFFERS", "MAX_ELEMENT_INDEX", "MAX_FRAGMENT_INPUT_COMPONENTS", "MAX_FRAGMENT_UNIFORM_COMPONENTS", "MAX_FRAGMENT_UNIFORM_BLOCKS", "MAX_SAMPLES", "MAX_SERVER_WAIT_TIMEOUT", "MAX_TEXTURE_LOD_BIAS", "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", "MAX_UNIFORM_BLOCK_SIZE", "MAX_UNIFORM_BUFFER_BINDINGS", "MIN_PROGRAM_TEXEL_OFFSET", "UNIFORM_BUFFER_OFFSET_ALIGNMENT"];
|
|
2164
|
+
const Categories = { "uniformBuffers": ["MAX_UNIFORM_BUFFER_BINDINGS", "MAX_UNIFORM_BLOCK_SIZE", "UNIFORM_BUFFER_OFFSET_ALIGNMENT", "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "MAX_COMBINED_UNIFORM_BLOCKS", "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS"], "debugRendererInfo": ["UNMASKED_VENDOR_WEBGL", "UNMASKED_RENDERER_WEBGL"], "fragmentShader": ["MAX_FRAGMENT_UNIFORM_VECTORS", "MAX_TEXTURE_IMAGE_UNITS", "MAX_FRAGMENT_INPUT_COMPONENTS", "MAX_FRAGMENT_UNIFORM_COMPONENTS", "MAX_FRAGMENT_UNIFORM_BLOCKS", "FRAGMENT_SHADER_BEST_FLOAT_PRECISION", "MIN_PROGRAM_TEXEL_OFFSET", "MAX_PROGRAM_TEXEL_OFFSET"], "frameBuffer": ["MAX_DRAW_BUFFERS", "MAX_COLOR_ATTACHMENTS", "MAX_SAMPLES", "RGBA_BITS", "DEPTH_STENCIL_BITS", "MAX_RENDERBUFFER_SIZE", "MAX_VIEWPORT_DIMS"], "rasterizer": ["ALIASED_LINE_WIDTH_RANGE", "ALIASED_POINT_SIZE_RANGE"], "textures": ["MAX_TEXTURE_SIZE", "MAX_CUBE_MAP_TEXTURE_SIZE", "MAX_COMBINED_TEXTURE_IMAGE_UNITS", "MAX_TEXTURE_MAX_ANISOTROPY_EXT", "MAX_3D_TEXTURE_SIZE", "MAX_ARRAY_TEXTURE_LAYERS", "MAX_TEXTURE_LOD_BIAS"], "transformFeedback": ["MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS"], "vertexShader": ["MAX_VARYING_VECTORS", "MAX_VERTEX_ATTRIBS", "MAX_VERTEX_TEXTURE_IMAGE_UNITS", "MAX_VERTEX_UNIFORM_VECTORS", "MAX_VERTEX_UNIFORM_COMPONENTS", "MAX_VERTEX_UNIFORM_BLOCKS", "MAX_VERTEX_OUTPUT_COMPONENTS", "MAX_VARYING_COMPONENTS", "VERTEX_SHADER_BEST_FLOAT_PRECISION"], "webGLContextInfo": ["CONTEXT", "ANTIALIAS", "DIRECT_3D", "MAJOR_PERFORMANCE_CAVEAT", "RENDERER", "SHADING_LANGUAGE_VERSION", "VERSION"] };
|
|
2165
|
+
const json = {
|
|
2166
|
+
WebGLConstants,
|
|
2167
|
+
WebGL2Constants,
|
|
2168
|
+
Categories
|
|
2169
|
+
};
|
|
2170
|
+
function getMaxAnisotropy(context) {
|
|
2171
|
+
try {
|
|
2172
|
+
const extension = context.getExtension("EXT_texture_filter_anisotropic") || context.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || context.getExtension("MOZ_EXT_texture_filter_anisotropic");
|
|
2173
|
+
return context.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
|
|
2174
|
+
} catch (error) {
|
|
2175
|
+
console.error(error);
|
|
2176
|
+
return void 0;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
function getMaxDrawBuffers(context) {
|
|
2180
|
+
try {
|
|
2181
|
+
const extension = context.getExtension("WEBGL_draw_buffers") || context.getExtension("WEBKIT_WEBGL_draw_buffers") || context.getExtension("MOZ_WEBGL_draw_buffers");
|
|
2182
|
+
return context.getParameter(extension.MAX_DRAW_BUFFERS_WEBGL);
|
|
2183
|
+
} catch (error) {
|
|
2184
|
+
return void 0;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
function getShaderData(precisionFormat) {
|
|
2188
|
+
const shaderData = {};
|
|
2189
|
+
try {
|
|
2190
|
+
Object.keys(precisionFormat).forEach((key) => {
|
|
2191
|
+
const shaderPrecisionFormat = precisionFormat[key];
|
|
2192
|
+
shaderData[key] = {
|
|
2193
|
+
precision: shaderPrecisionFormat.precision,
|
|
2194
|
+
rangeMax: shaderPrecisionFormat.rangeMax,
|
|
2195
|
+
rangeMin: shaderPrecisionFormat.rangeMin
|
|
2196
|
+
};
|
|
2197
|
+
});
|
|
2198
|
+
return shaderData;
|
|
2199
|
+
} catch (error) {
|
|
2200
|
+
return void 0;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
function getShaderPrecisionFormat(context, shaderType) {
|
|
2204
|
+
const precisionTypes = ["LOW_FLOAT", "MEDIUM_FLOAT", "HIGH_FLOAT"];
|
|
2205
|
+
const precisionFormat = {};
|
|
2206
|
+
try {
|
|
2207
|
+
precisionTypes.forEach((prop) => {
|
|
2208
|
+
precisionFormat[prop] = context.getShaderPrecisionFormat(context[shaderType], context[prop]);
|
|
2209
|
+
});
|
|
2210
|
+
return precisionFormat;
|
|
2211
|
+
} catch (error) {
|
|
2212
|
+
return void 0;
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
function getUnmasked(context, constant) {
|
|
2216
|
+
try {
|
|
2217
|
+
const extension = context.getExtension("WEBGL_debug_renderer_info");
|
|
2218
|
+
return context.getParameter(extension[constant]);
|
|
2219
|
+
} catch (error) {
|
|
2220
|
+
return void 0;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
function getNumericValues(parameters) {
|
|
2224
|
+
if (!parameters) return [];
|
|
2225
|
+
return [
|
|
2226
|
+
...new Set(Object.values(parameters).filter((val) => val && typeof val !== "string").flat().map((val) => Number(val) || 0))
|
|
2227
|
+
].sort((a, b) => a - b);
|
|
2228
|
+
}
|
|
2229
|
+
function getGpuBrand(gpu) {
|
|
2230
|
+
if (!gpu) return "";
|
|
2231
|
+
const gpuBrandMatcher = /(adreno|amd|apple|intel|llvm|mali|microsoft|nvidia|parallels|powervr|samsung|swiftshader|virtualbox|vmware)/i;
|
|
2232
|
+
let brand;
|
|
2233
|
+
if (/radeon/i.test(gpu)) {
|
|
2234
|
+
brand = "AMD";
|
|
2235
|
+
} else if (/geforce/i.test(gpu)) {
|
|
2236
|
+
brand = "NVIDIA";
|
|
2237
|
+
} else {
|
|
2238
|
+
brand = (gpuBrandMatcher.exec(gpu) || [])[0] || "Other";
|
|
2239
|
+
}
|
|
2240
|
+
return brand;
|
|
2241
|
+
}
|
|
2242
|
+
function getWebGL(contextType) {
|
|
2243
|
+
var _a;
|
|
2244
|
+
const errors = [];
|
|
2245
|
+
let data = {};
|
|
2246
|
+
const isWebGL = /^webgl$/;
|
|
2247
|
+
const isWebGL2 = /^webgl2$/;
|
|
2248
|
+
const supportsWebGL = isWebGL.test(contextType) && "WebGLRenderingContext" in window;
|
|
2249
|
+
const supportsWebGL2 = isWebGL2.test(contextType) && "WebGLRenderingContext" in window;
|
|
2250
|
+
if (!supportsWebGL && !supportsWebGL2) {
|
|
2251
|
+
errors.push("not supported");
|
|
2252
|
+
return [data, errors];
|
|
2253
|
+
}
|
|
2254
|
+
let canvas2;
|
|
2255
|
+
let context;
|
|
2256
|
+
let hasMajorPerformanceCaveat;
|
|
2257
|
+
try {
|
|
2258
|
+
canvas2 = document.createElement("canvas");
|
|
2259
|
+
context = canvas2.getContext(contextType, { failIfMajorPerformanceCaveat: true });
|
|
2260
|
+
if (!context) {
|
|
2261
|
+
hasMajorPerformanceCaveat = true;
|
|
2262
|
+
context = canvas2.getContext(contextType);
|
|
2263
|
+
if (!context) {
|
|
2264
|
+
throw new Error(`context of type ${typeof context}`);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
} catch (err) {
|
|
2268
|
+
console.error(err);
|
|
2269
|
+
errors.push("context blocked");
|
|
2270
|
+
return [data, errors];
|
|
2271
|
+
}
|
|
2272
|
+
let webGLExtensions;
|
|
2273
|
+
try {
|
|
2274
|
+
webGLExtensions = context.getSupportedExtensions();
|
|
2275
|
+
} catch (error) {
|
|
2276
|
+
console.error(error);
|
|
2277
|
+
errors.push("extensions blocked");
|
|
2278
|
+
}
|
|
2279
|
+
let parameters = {};
|
|
2280
|
+
try {
|
|
2281
|
+
const VERTEX_SHADER = getShaderData(getShaderPrecisionFormat(context, "VERTEX_SHADER"));
|
|
2282
|
+
const FRAGMENT_SHADER = getShaderData(getShaderPrecisionFormat(context, "FRAGMENT_SHADER"));
|
|
2283
|
+
parameters = {
|
|
2284
|
+
ANTIALIAS: (_a = context == null ? void 0 : context.getContextAttributes()) == null ? void 0 : _a.antialias,
|
|
2285
|
+
CONTEXT: contextType,
|
|
2286
|
+
MAJOR_PERFORMANCE_CAVEAT: hasMajorPerformanceCaveat,
|
|
2287
|
+
MAX_TEXTURE_MAX_ANISOTROPY_EXT: getMaxAnisotropy(context),
|
|
2288
|
+
MAX_DRAW_BUFFERS_WEBGL: getMaxDrawBuffers(context),
|
|
2289
|
+
VERTEX_SHADER,
|
|
2290
|
+
VERTEX_SHADER_BEST_FLOAT_PRECISION: Object.values(VERTEX_SHADER == null ? void 0 : VERTEX_SHADER.HIGH_FLOAT),
|
|
2291
|
+
FRAGMENT_SHADER,
|
|
2292
|
+
FRAGMENT_SHADER_BEST_FLOAT_PRECISION: Object.values(FRAGMENT_SHADER == null ? void 0 : FRAGMENT_SHADER.HIGH_FLOAT),
|
|
2293
|
+
UNMASKED_VENDOR_WEBGL: getUnmasked(context, "UNMASKED_VENDOR_WEBGL"),
|
|
2294
|
+
UNMASKED_RENDERER_WEBGL: getUnmasked(context, "UNMASKED_RENDERER_WEBGL")
|
|
2295
|
+
};
|
|
2296
|
+
const glConstants = [...json.WebGLConstants, ...supportsWebGL2 ? json.WebGL2Constants : []];
|
|
2297
|
+
glConstants.forEach((key) => {
|
|
2298
|
+
const result = context == null ? void 0 : context.getParameter(context[key]);
|
|
2299
|
+
const typedArray = result && (result.constructor === Float32Array || result.constructor === Int32Array);
|
|
2300
|
+
parameters[key] = typedArray ? [...result] : result;
|
|
2301
|
+
});
|
|
2302
|
+
parameters.RGBA_BITS = [
|
|
2303
|
+
parameters.RED_BITS,
|
|
2304
|
+
parameters.GREEN_BITS,
|
|
2305
|
+
parameters.BLUE_BITS,
|
|
2306
|
+
parameters.ALPHA_BITS
|
|
2307
|
+
];
|
|
2308
|
+
parameters.DEPTH_STENCIL_BITS = [
|
|
2309
|
+
parameters.DEPTH_BITS,
|
|
2310
|
+
parameters.STENCIL_BITS
|
|
2311
|
+
];
|
|
2312
|
+
parameters.DIRECT_3D = /Direct3D|D3D(\d+)/.test(parameters.UNMASKED_RENDERER_WEBGL);
|
|
2313
|
+
} catch (error) {
|
|
2314
|
+
console.error(error);
|
|
2315
|
+
errors.push("parameters blocked");
|
|
2316
|
+
}
|
|
2317
|
+
const gpu = String([parameters.UNMASKED_VENDOR_WEBGL, parameters.UNMASKED_RENDERER_WEBGL]);
|
|
2318
|
+
const gpuBrand = getGpuBrand(gpu);
|
|
2319
|
+
const components = {};
|
|
2320
|
+
if (parameters) {
|
|
2321
|
+
Object.keys(json.Categories).forEach((name) => {
|
|
2322
|
+
const componentData = json.Categories[name].reduce((acc, key) => {
|
|
2323
|
+
if (parameters[key] !== void 0) {
|
|
2324
|
+
acc[key] = parameters[key];
|
|
2325
|
+
}
|
|
2326
|
+
return acc;
|
|
2327
|
+
}, {});
|
|
2328
|
+
if (Object.keys(componentData).length) {
|
|
2329
|
+
components[name] = componentData;
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
data = {
|
|
2334
|
+
gpuHash: !parameters ? void 0 : [gpuBrand, ...getNumericValues(parameters)].join(":"),
|
|
2335
|
+
gpu,
|
|
2336
|
+
gpuBrand,
|
|
2337
|
+
...components,
|
|
2338
|
+
webGLExtensions
|
|
2339
|
+
};
|
|
2340
|
+
return [data, errors];
|
|
2341
|
+
}
|
|
2342
|
+
async function getWebGLInfo() {
|
|
2343
|
+
const result = await Promise.allSettled([
|
|
2344
|
+
getWebGL("webgl"),
|
|
2345
|
+
getWebGL("webgl2")
|
|
2346
|
+
]);
|
|
2347
|
+
const [webGL, webGL2] = result;
|
|
2348
|
+
return {
|
|
2349
|
+
webGL: {
|
|
2350
|
+
result: webGL.status !== "rejected" ? webGL.value[0] : {},
|
|
2351
|
+
errors: webGL.status !== "rejected" ? webGL.value[1] : []
|
|
2352
|
+
},
|
|
2353
|
+
webGL2: {
|
|
2354
|
+
result: webGL2.status !== "rejected" ? webGL2.value[0] : {},
|
|
2355
|
+
errors: webGL2.status !== "rejected" ? webGL2.value[1] : []
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
const Fingerprint = {
|
|
2360
|
+
browserInfo: getBrowserInfo,
|
|
2361
|
+
screenInfo: getScreenResolutionInfo,
|
|
2362
|
+
batteryInfo: getBatteryInfo,
|
|
2363
|
+
connectionInfo: getConnectionInfo,
|
|
2364
|
+
canvasInfo: getCanvasInfo,
|
|
2365
|
+
fontsInfo: getFontsInfo,
|
|
2366
|
+
HTML5Info: getHTML5Info,
|
|
2367
|
+
videoCodecsInfo: getVideoCodecsInfo,
|
|
2368
|
+
timeZoneInfo: getTimeZoneInfo,
|
|
2369
|
+
webGLInfo: getWebGLInfo,
|
|
2370
|
+
utils: {
|
|
2371
|
+
sha256: decrypt
|
|
2372
|
+
}
|
|
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
|
+
};
|
|
2378
|
+
const getBrowserMetadata = async () => {
|
|
2379
|
+
const [browserInfo, screenInfo, batteryInfo, connectionInfo] = await allSettledValues([
|
|
2380
|
+
Fingerprint.browserInfo(),
|
|
2381
|
+
Fingerprint.screenInfo(),
|
|
2382
|
+
Fingerprint.batteryInfo(),
|
|
2383
|
+
Fingerprint.connectionInfo()
|
|
2384
|
+
]);
|
|
2385
|
+
const { sha256 } = Fingerprint.utils;
|
|
2386
|
+
const [browserInfoSHA, canvasInfo, fontsInfo, html5Info, webGlInfo] = await allSettledValues([
|
|
2387
|
+
sha256(JSON.stringify(browserInfo)),
|
|
2388
|
+
sha256(JSON.stringify(await Fingerprint.canvasInfo())),
|
|
2389
|
+
sha256(JSON.stringify(await Fingerprint.fontsInfo())),
|
|
2390
|
+
sha256(JSON.stringify(await Fingerprint.HTML5Info())),
|
|
2391
|
+
sha256(JSON.stringify(await Fingerprint.webGLInfo()))
|
|
2392
|
+
]);
|
|
2393
|
+
return {
|
|
2394
|
+
navigatorInfo: browserInfo == null ? void 0 : browserInfo.navigatorInfo,
|
|
2395
|
+
screenInfo,
|
|
2396
|
+
batteryInfo,
|
|
2397
|
+
connectionInfo,
|
|
2398
|
+
browserInfo: browserInfoSHA,
|
|
2399
|
+
canvasInfo,
|
|
2400
|
+
fontsInfo,
|
|
2401
|
+
html5Info,
|
|
2402
|
+
webGlInfo
|
|
2403
|
+
};
|
|
2404
|
+
};
|
|
2405
|
+
const getDeviceMetadata = async () => {
|
|
2406
|
+
const timeZone = await Fingerprint.timeZoneInfo();
|
|
2407
|
+
const userLanguage = navigator.language;
|
|
2408
|
+
return {
|
|
2409
|
+
timeZone,
|
|
2410
|
+
userLanguage
|
|
2411
|
+
};
|
|
2412
|
+
};
|
|
2413
|
+
const createFingerPrintModel = async () => {
|
|
2414
|
+
const browserMetadata = await getBrowserMetadata();
|
|
2415
|
+
const deviceMetadata = await getDeviceMetadata();
|
|
2416
|
+
return {
|
|
2417
|
+
browserMetadata,
|
|
2418
|
+
deviceMetadata
|
|
2419
|
+
};
|
|
2420
|
+
};
|
|
1746
2421
|
const html = '<div class="qr-code-wrap">\n <button class="qr-code-wrap__button" id="qr-code-wrap__button"><span class="qr-code-wrap__content">Verify Documents by Phone<svg class="qr-code-svg" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0 8V0H8V8H0ZM2 6H6V2H2V6ZM0 18V10H8V18H0ZM2 16H6V12H2V16ZM10 8V0H18V8H10ZM12 6H16V2H12V6ZM16 18V16H18V18H16ZM10 12V10H12V12H10ZM12 14V12H14V14H12ZM10 16V14H12V16H10ZM12 18V16H14V18H12ZM14 16V14H16V16H14ZM14 12V10H16V12H14ZM16 14V12H18V14H16Z" fill="white"/>\n </svg></span></button>\n</div>\n';
|
|
1747
2422
|
var browser = {};
|
|
1748
2423
|
var canPromise;
|
|
@@ -3870,7 +4545,7 @@ function requireBrowser() {
|
|
|
3870
4545
|
}
|
|
3871
4546
|
var browserExports = requireBrowser();
|
|
3872
4547
|
const QRCode = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
|
|
3873
|
-
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
|
|
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';
|
|
3874
4549
|
class QRCodeModal extends Modal {
|
|
3875
4550
|
constructor(mountEl, applicantId, domainApi, embeddedAppConnectionId, qrCodeLinkOrigin, state = QRCodeModalState.READY) {
|
|
3876
4551
|
super(mountEl);
|
|
@@ -3949,31 +4624,11 @@ const isiOS = () => [
|
|
|
3949
4624
|
"iPad",
|
|
3950
4625
|
"iPhone"
|
|
3951
4626
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
3952
|
-
const checkTouchPoints = () => navigator.maxTouchPoints > 0;
|
|
3953
|
-
const isMobile = () => {
|
|
3954
|
-
const { userAgent } = navigator;
|
|
3955
|
-
const mediaQueryCoarse = window.matchMedia("(any-pointer: coarse)");
|
|
3956
|
-
const hasTouches = checkTouchPoints();
|
|
3957
|
-
const isMobileUserAgent = () => browserRE.test(userAgent) || browserREAlt.test(userAgent.substring(0, 4)) || isiOS();
|
|
3958
|
-
const isTouchable = () => window.PointerEvent && hasTouches;
|
|
3959
|
-
const isTouchScreen = () => mediaQueryCoarse.matches;
|
|
3960
|
-
const isSurface = () => userAgent.indexOf("Windows") !== -1 && isTouchable();
|
|
3961
|
-
return {
|
|
3962
|
-
isMobileUserAgent,
|
|
3963
|
-
isTouchable,
|
|
3964
|
-
isTouchScreen,
|
|
3965
|
-
isSurface
|
|
3966
|
-
};
|
|
3967
|
-
};
|
|
3968
4627
|
const checkIfMobile = () => {
|
|
3969
|
-
const
|
|
3970
|
-
|
|
3971
|
-
const isTouchable = mc.isTouchable();
|
|
3972
|
-
const isTouchScreen = mc.isTouchScreen();
|
|
3973
|
-
const isSurface = mc.isSurface();
|
|
3974
|
-
return isMobileUserAgent && isTouchable && isTouchScreen || isSurface;
|
|
4628
|
+
const { userAgent } = navigator;
|
|
4629
|
+
return browserRE.test(userAgent) || browserREAlt.test(userAgent.slice(0, 4)) || isiOS();
|
|
3975
4630
|
};
|
|
3976
|
-
const version = "2.
|
|
4631
|
+
const version = "2.10.1";
|
|
3977
4632
|
const packageJson = {
|
|
3978
4633
|
version
|
|
3979
4634
|
};
|
|
@@ -3987,6 +4642,7 @@ class Wrapper {
|
|
|
3987
4642
|
this.config = config;
|
|
3988
4643
|
this.IDVCModule = IDVCModule;
|
|
3989
4644
|
this.beforeMount(config);
|
|
4645
|
+
this.fingerPrintData = createFingerPrintModel();
|
|
3990
4646
|
}
|
|
3991
4647
|
get isEmbeddedFromQR() {
|
|
3992
4648
|
return getQueryParam("qrCode") === "true";
|
|
@@ -4012,7 +4668,7 @@ class Wrapper {
|
|
|
4012
4668
|
this.lib.loading = false;
|
|
4013
4669
|
} else {
|
|
4014
4670
|
this.lib.loading = false;
|
|
4015
|
-
throw new Error();
|
|
4671
|
+
throw new Error("Applicant validation failed");
|
|
4016
4672
|
}
|
|
4017
4673
|
} catch (e) {
|
|
4018
4674
|
this.lib.loading = false;
|
|
@@ -4067,7 +4723,7 @@ class Wrapper {
|
|
|
4067
4723
|
const keys = Object.keys(wrapperSettings);
|
|
4068
4724
|
keys.forEach((key) => {
|
|
4069
4725
|
const value = wrapperSettings[key];
|
|
4070
|
-
if (
|
|
4726
|
+
if (value !== void 0) {
|
|
4071
4727
|
copy[key] = value;
|
|
4072
4728
|
}
|
|
4073
4729
|
});
|
|
@@ -4123,7 +4779,7 @@ class Wrapper {
|
|
|
4123
4779
|
);
|
|
4124
4780
|
}
|
|
4125
4781
|
} else {
|
|
4126
|
-
throw new Error();
|
|
4782
|
+
throw new Error("Applicant validation failed");
|
|
4127
4783
|
}
|
|
4128
4784
|
} catch (e) {
|
|
4129
4785
|
this.onError(e);
|
|
@@ -4142,9 +4798,9 @@ class Wrapper {
|
|
|
4142
4798
|
});
|
|
4143
4799
|
}
|
|
4144
4800
|
prepareConfig(options) {
|
|
4145
|
-
const
|
|
4146
|
-
|
|
4147
|
-
return
|
|
4801
|
+
const settings = JSON.parse(options);
|
|
4802
|
+
settings.documentTypes = prepareDocumentTypes(settings);
|
|
4803
|
+
return settings;
|
|
4148
4804
|
}
|
|
4149
4805
|
showSpinner() {
|
|
4150
4806
|
this.validationModal.hideSpinner();
|
|
@@ -4186,10 +4842,12 @@ class Wrapper {
|
|
|
4186
4842
|
validation.showModal();
|
|
4187
4843
|
}
|
|
4188
4844
|
async createPostModel(model, isFaceAuth) {
|
|
4845
|
+
const fingerPrintResult = await this.fingerPrintData;
|
|
4189
4846
|
return {
|
|
4190
4847
|
applicantId: this.configs.applicantId,
|
|
4191
4848
|
...model,
|
|
4192
|
-
|
|
4849
|
+
documentType: isFaceAuth ? 10 : model.documentType,
|
|
4850
|
+
...fingerPrintResult,
|
|
4193
4851
|
clientVersion: this.lib.version,
|
|
4194
4852
|
clientType: ClientType.WebLibStandalone
|
|
4195
4853
|
};
|
|
@@ -4205,7 +4863,7 @@ class Wrapper {
|
|
|
4205
4863
|
if (this.configs.IDVCDownloadVersion === "latest" && this.configs.libConfig.useCDN) {
|
|
4206
4864
|
const currentProductionIdvcVersion = await this.api.getCurrentIdvcVersion();
|
|
4207
4865
|
await this.lib.initializeLibrary(
|
|
4208
|
-
|
|
4866
|
+
this.configs.libConfig.useCDN,
|
|
4209
4867
|
currentProductionIdvcVersion
|
|
4210
4868
|
);
|
|
4211
4869
|
} else {
|
|
@@ -4236,7 +4894,7 @@ class Wrapper {
|
|
|
4236
4894
|
this.validationOutput.status = ResponseStatus.COMPLETE;
|
|
4237
4895
|
this.showValidationSuccess();
|
|
4238
4896
|
} else {
|
|
4239
|
-
throw new Error();
|
|
4897
|
+
throw new Error("Force close failed");
|
|
4240
4898
|
}
|
|
4241
4899
|
} catch (e) {
|
|
4242
4900
|
this.onError(e);
|
|
@@ -4284,46 +4942,75 @@ class Wrapper {
|
|
|
4284
4942
|
}
|
|
4285
4943
|
processEmbeddedAppStart(status) {
|
|
4286
4944
|
const getFirstStepModeState = this.configs.getFirstStepModeState();
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
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
|
+
];
|
|
4296
4953
|
}
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
this.
|
|
4300
|
-
this.
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
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;
|
|
4310
4967
|
}
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
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);
|
|
4319
4977
|
}
|
|
4978
|
+
);
|
|
4979
|
+
if (this.configs.firstStepMode) {
|
|
4980
|
+
this.configs.firstStepMode.video = false;
|
|
4981
|
+
this.configs.firstStepMode.uploader = true;
|
|
4320
4982
|
}
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
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;
|
|
4325
5008
|
}
|
|
4326
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.
|
|
4327
5014
|
processEmbeddedAppEnd(data) {
|
|
4328
5015
|
if ((data == null ? void 0 : data.status) === ResponseStatus.SUCCESS) {
|
|
4329
5016
|
this.QRCodeModal.state = QRCodeModalState.DONE_WITH_SUCCESS;
|
|
@@ -4369,4 +5056,3 @@ class Wrapper {
|
|
|
4369
5056
|
export {
|
|
4370
5057
|
Wrapper as default
|
|
4371
5058
|
};
|
|
4372
|
-
//# sourceMappingURL=wrapper.es.js.map
|