@realeyes/verifeye-sdk 1.0.1 → 1.1.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.
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as Z, useState as D, lazy as
|
|
3
|
-
import { useMediaQuery as
|
|
1
|
+
import { jsx as s, jsxs as S, Fragment as pt } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as Z, useState as D, lazy as gt, useRef as C, Suspense as vt } from "react";
|
|
3
|
+
import { useMediaQuery as yt, Box as Se, Link as St, CircularProgress as Ee, createTheme as Et, ThemeProvider as wt, ScopedCssBaseline as bt, Container as Ct, Dialog as Ve, DialogTitle as Pe, DialogContent as ze, DialogContentText as Fe, DialogActions as Rt, Button as Dt } from "@mui/material";
|
|
4
4
|
import $ from "@mui/material/DialogContent";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import It from "@mui/material/IconButton";
|
|
6
|
+
import xt from "@mui/material/SvgIcon";
|
|
7
|
+
import U from "@mui/material/Stack";
|
|
8
|
+
import R from "@mui/material/Typography";
|
|
9
9
|
import { useTheme as W, responsiveFontSizes as Q } from "@mui/material/styles";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { KinesisClient as
|
|
13
|
-
import './index.css';class
|
|
10
|
+
import At from "@mui/material/Dialog";
|
|
11
|
+
import Tt from "@mui/icons-material/InfoOutlined";
|
|
12
|
+
import { KinesisClient as kt, PutRecordCommand as Mt } from "@aws-sdk/client-kinesis";
|
|
13
|
+
import './index.css';class Ot {
|
|
14
14
|
sessionId;
|
|
15
15
|
accessToken;
|
|
16
16
|
onCompleted;
|
|
17
17
|
headless;
|
|
18
|
-
constructor(e, t,
|
|
19
|
-
this.sessionId = e, this.accessToken = t, this.onCompleted =
|
|
18
|
+
constructor(e, t, r, i = !1) {
|
|
19
|
+
this.sessionId = e, this.accessToken = t, this.onCompleted = r, this.headless = i;
|
|
20
20
|
}
|
|
21
21
|
async initSession(e) {
|
|
22
22
|
return e.initCoreSession(this.sessionId, this.accessToken, this.headless);
|
|
23
23
|
}
|
|
24
|
-
async fetchResult(e, t,
|
|
25
|
-
return await t.callVerify(e,
|
|
24
|
+
async fetchResult(e, t, r, i) {
|
|
25
|
+
return await t.callVerify(e, r, i), { sessionId: e };
|
|
26
26
|
}
|
|
27
27
|
complete(e, t) {
|
|
28
28
|
this.onCompleted(e.sessionId);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
function
|
|
33
|
-
return typeof
|
|
31
|
+
const Ge = ["eu", "us"];
|
|
32
|
+
function Lt(o) {
|
|
33
|
+
return typeof o == "string" && Ge.includes(o);
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class Nt {
|
|
36
36
|
region;
|
|
37
37
|
constructor(e) {
|
|
38
38
|
this.region = e;
|
|
@@ -51,11 +51,11 @@ class kt {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
] }) }), ee = ({ uniqueId:
|
|
58
|
-
|
|
54
|
+
const Ut = ({ size: o = 16, color: e }) => /* @__PURE__ */ s(xt, { children: /* @__PURE__ */ S("svg", { xmlns: "http://www.w3.org/2000/svg", style: { height: o, width: o }, viewBox: "0 0 24 24", fill: e || "currentColor", children: [
|
|
55
|
+
/* @__PURE__ */ s("path", { d: "M0 0h24v24H0V0z", fill: "none" }),
|
|
56
|
+
/* @__PURE__ */ s("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" })
|
|
57
|
+
] }) }), ee = ({ uniqueId: o, visible: e = !1 }) => e ? /* @__PURE__ */ s(pt, { children: o && /* @__PURE__ */ s(
|
|
58
|
+
R,
|
|
59
59
|
{
|
|
60
60
|
variant: "body2",
|
|
61
61
|
component: "div",
|
|
@@ -68,26 +68,26 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
68
68
|
},
|
|
69
69
|
children: /* @__PURE__ */ S("span", { style: { color: "#b0b0b0" }, children: [
|
|
70
70
|
"Session ID: ",
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
71
|
+
/* @__PURE__ */ s("br", {}),
|
|
72
|
+
o
|
|
73
73
|
] })
|
|
74
74
|
}
|
|
75
|
-
) }) : null, q = ({ open:
|
|
76
|
-
if (!
|
|
77
|
-
const t = W(),
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
|
|
75
|
+
) }) : null, q = ({ open: o, children: e }) => {
|
|
76
|
+
if (!o) return;
|
|
77
|
+
const t = W(), i = !yt(t.breakpoints.up("md"));
|
|
78
|
+
return /* @__PURE__ */ s(
|
|
79
|
+
At,
|
|
80
80
|
{
|
|
81
|
-
fullScreen:
|
|
81
|
+
fullScreen: i,
|
|
82
82
|
fullWidth: !0,
|
|
83
83
|
maxWidth: !1,
|
|
84
|
-
open:
|
|
84
|
+
open: o,
|
|
85
85
|
disableAutoFocus: !0,
|
|
86
86
|
"aria-labelledby": "responsive-dialog-title",
|
|
87
87
|
slotProps: {
|
|
88
88
|
paper: {
|
|
89
|
-
sx: (
|
|
90
|
-
[
|
|
89
|
+
sx: (d) => ({
|
|
90
|
+
[d.breakpoints.up("md")]: {
|
|
91
91
|
maxWidth: 420,
|
|
92
92
|
minHeight: 520
|
|
93
93
|
},
|
|
@@ -98,17 +98,17 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
98
98
|
children: e
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
|
-
}, se = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20147%20147'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.2.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%20105)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23263235;%20}%20.st1%20{%20fill:%20%2327eabf;%20}%20%3c/style%3e%3c/defs%3e%3ccircle%20class='st1'%20cx='73.2500001'%20cy='73.7499999'%20r='59.9414062'/%3e%3cpath%20class='st0'%20d='M73,73.5c-2.55,0-4.6875001-.8625-6.4125001-2.5875s-2.5875-3.8625001-2.5875-6.4125001c0-2.4999985.8625-4.6250016,2.5875-6.3750001s3.8625001-2.625,6.4125001-2.625c2.4999985,0,4.6250016.8750015,6.3750001,2.625s2.625,3.8750016,2.625,6.3750001c0,2.55-.8750015,4.6875001-2.625,6.4125001s-3.8750016,2.5875-6.3750001,2.5875ZM54.9999997,88.5000002v-2.7c0-1.05.2625-2.0374993.7875-2.9625s1.2375-1.6624993,2.1375-2.2125c2.2999993-1.35,4.7125008-2.3749993,7.2375001-3.075s5.1375001-1.05,7.8375001-1.05,5.3124986.3499992,7.8375001,1.05,4.9374985,1.725,7.2375001,3.075c.9.5500008,1.6125,1.2874993,2.1375,2.2125s.7875,1.9125.7875,2.9625v2.7c0,.8500008-.2874985,1.5625008-.8625,2.1375-.5750015.5750004-1.2875015.8625-2.1375.8625h-30.0000004c-.8500008,0-1.5625008-.2874996-2.1375-.8625-.5750004-.5749992-.8625-1.2874993-.8625-2.1375ZM48.9999996,103.5000004c-1.65,0-3.0625002-.5875002-4.2375001-1.7625s-1.7625-2.5875-1.7625-4.2375001v-9.0000001c0-.8500008.2875002-1.5625008.8625-2.1375s1.2874998-.8625,2.1375-.8625c.8499996,0,1.5624996.2875008,2.1375.8625s.8625,1.2874993.8625,2.1375v9.0000001h9.0000001c.8500008,0,1.5625008.2874996,2.1375.8625s.8625,1.2875004.8625,2.1375c0,.8500002-.2875008,1.5625002-.8625,2.1375s-1.2874993.8625-2.1375.8625h-9.0000001ZM42.9999996,58.4999998v-9.0000001c0-1.65.5875002-3.0624985,1.7625-4.2375001s2.5875-1.7625,4.2375001-1.7625h9.0000001c.8500008,0,1.5625008.2874985,2.1375.8625s.8625,1.2875015.8625,2.1375-.2875008,1.5624985-.8625,2.1375-1.2874993.8625-2.1375.8625h-9.0000001v9.0000001c0,.8499985-.2874996,1.5624985-.8625,2.1375s-1.2875004.8625-2.1375.8625c-.8500002,0-1.5625002-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375ZM97.0000004,103.5000004h-9.0000001c-.8499985,0-1.5624985-.2875002-2.1375-.8625s-.8625-1.2874998-.8625-2.1375c0-.8499996.2874985-1.5624996.8625-2.1375s1.2875015-.8625,2.1375-.8625h9.0000001v-9.0000001c0-.8500008.2874985-1.5625008.8625-2.1375s1.2875015-.8625,2.1375-.8625,1.5624985.2875008,2.1375.8625.8625,1.2874993.8625,2.1375v9.0000001c0,1.65-.5874985,3.0625002-1.7625,4.2375001s-2.5875,1.7625-4.2375001,1.7625ZM97.0000004,58.4999998v-9.0000001h-9.0000001c-.8499985,0-1.5624985-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375.2874985-1.5624985.8625-2.1375,1.2875015-.8625,2.1375-.8625h9.0000001c1.65,0,3.0624985.5874985,4.2375001,1.7625s1.7625,2.5875,1.7625,4.2375001v9.0000001c0,.8499985-.2874985,1.5624985-.8625,2.1375s-1.2875015.8625-2.1375.8625-1.5624985-.2874985-2.1375-.8625-.8625-1.2875015-.8625-2.1375Z'/%3e%3c/svg%3e",
|
|
102
|
-
isOpen:
|
|
101
|
+
}, se = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20147%20147'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.2.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%20105)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23263235;%20}%20.st1%20{%20fill:%20%2327eabf;%20}%20%3c/style%3e%3c/defs%3e%3ccircle%20class='st1'%20cx='73.2500001'%20cy='73.7499999'%20r='59.9414062'/%3e%3cpath%20class='st0'%20d='M73,73.5c-2.55,0-4.6875001-.8625-6.4125001-2.5875s-2.5875-3.8625001-2.5875-6.4125001c0-2.4999985.8625-4.6250016,2.5875-6.3750001s3.8625001-2.625,6.4125001-2.625c2.4999985,0,4.6250016.8750015,6.3750001,2.625s2.625,3.8750016,2.625,6.3750001c0,2.55-.8750015,4.6875001-2.625,6.4125001s-3.8750016,2.5875-6.3750001,2.5875ZM54.9999997,88.5000002v-2.7c0-1.05.2625-2.0374993.7875-2.9625s1.2375-1.6624993,2.1375-2.2125c2.2999993-1.35,4.7125008-2.3749993,7.2375001-3.075s5.1375001-1.05,7.8375001-1.05,5.3124986.3499992,7.8375001,1.05,4.9374985,1.725,7.2375001,3.075c.9.5500008,1.6125,1.2874993,2.1375,2.2125s.7875,1.9125.7875,2.9625v2.7c0,.8500008-.2874985,1.5625008-.8625,2.1375-.5750015.5750004-1.2875015.8625-2.1375.8625h-30.0000004c-.8500008,0-1.5625008-.2874996-2.1375-.8625-.5750004-.5749992-.8625-1.2874993-.8625-2.1375ZM48.9999996,103.5000004c-1.65,0-3.0625002-.5875002-4.2375001-1.7625s-1.7625-2.5875-1.7625-4.2375001v-9.0000001c0-.8500008.2875002-1.5625008.8625-2.1375s1.2874998-.8625,2.1375-.8625c.8499996,0,1.5624996.2875008,2.1375.8625s.8625,1.2874993.8625,2.1375v9.0000001h9.0000001c.8500008,0,1.5625008.2874996,2.1375.8625s.8625,1.2875004.8625,2.1375c0,.8500002-.2875008,1.5625002-.8625,2.1375s-1.2874993.8625-2.1375.8625h-9.0000001ZM42.9999996,58.4999998v-9.0000001c0-1.65.5875002-3.0624985,1.7625-4.2375001s2.5875-1.7625,4.2375001-1.7625h9.0000001c.8500008,0,1.5625008.2874985,2.1375.8625s.8625,1.2875015.8625,2.1375-.2875008,1.5624985-.8625,2.1375-1.2874993.8625-2.1375.8625h-9.0000001v9.0000001c0,.8499985-.2874996,1.5624985-.8625,2.1375s-1.2875004.8625-2.1375.8625c-.8500002,0-1.5625002-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375ZM97.0000004,103.5000004h-9.0000001c-.8499985,0-1.5624985-.2875002-2.1375-.8625s-.8625-1.2874998-.8625-2.1375c0-.8499996.2874985-1.5624996.8625-2.1375s1.2875015-.8625,2.1375-.8625h9.0000001v-9.0000001c0-.8500008.2874985-1.5625008.8625-2.1375s1.2875015-.8625,2.1375-.8625,1.5624985.2875008,2.1375.8625.8625,1.2874993.8625,2.1375v9.0000001c0,1.65-.5874985,3.0625002-1.7625,4.2375001s-2.5875,1.7625-4.2375001,1.7625ZM97.0000004,58.4999998v-9.0000001h-9.0000001c-.8499985,0-1.5624985-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375.2874985-1.5624985.8625-2.1375,1.2875015-.8625,2.1375-.8625h9.0000001c1.65,0,3.0624985.5874985,4.2375001,1.7625s1.7625,2.5875,1.7625,4.2375001v9.0000001c0,.8499985-.2874985,1.5624985-.8625,2.1375s-1.2875015.8625-2.1375.8625-1.5624985-.2874985-2.1375-.8625-.8625-1.2875015-.8625-2.1375Z'/%3e%3c/svg%3e", Vt = ({
|
|
102
|
+
isOpen: o,
|
|
103
103
|
onAccept: e,
|
|
104
104
|
onClose: t,
|
|
105
|
-
uniqueId:
|
|
106
|
-
isConsentButtonLoading:
|
|
107
|
-
showVerificationSessionId:
|
|
105
|
+
uniqueId: r,
|
|
106
|
+
isConsentButtonLoading: i,
|
|
107
|
+
showVerificationSessionId: d
|
|
108
108
|
}) => {
|
|
109
|
-
if (!
|
|
110
|
-
const
|
|
111
|
-
return /* @__PURE__ */
|
|
109
|
+
if (!o) return;
|
|
110
|
+
const h = W(), c = Q(h).typography;
|
|
111
|
+
return /* @__PURE__ */ s(q, { open: o, children: /* @__PURE__ */ S(
|
|
112
112
|
$,
|
|
113
113
|
{
|
|
114
114
|
sx: {
|
|
@@ -118,8 +118,8 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
118
118
|
alignItems: "center !important"
|
|
119
119
|
},
|
|
120
120
|
children: [
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
|
|
121
|
+
/* @__PURE__ */ s(
|
|
122
|
+
It,
|
|
123
123
|
{
|
|
124
124
|
sx: {
|
|
125
125
|
position: "absolute",
|
|
@@ -131,11 +131,11 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
onClick: t,
|
|
134
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ s(Ut, { size: 30 })
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
137
|
/* @__PURE__ */ S(
|
|
138
|
-
|
|
138
|
+
U,
|
|
139
139
|
{
|
|
140
140
|
direction: "column",
|
|
141
141
|
sx: {
|
|
@@ -145,7 +145,7 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
145
145
|
width: "100%"
|
|
146
146
|
},
|
|
147
147
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ s(
|
|
149
149
|
"img",
|
|
150
150
|
{
|
|
151
151
|
src: se,
|
|
@@ -153,13 +153,13 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
153
153
|
style: { width: 90, height: 90, marginBottom: 8 }
|
|
154
154
|
}
|
|
155
155
|
),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
|
|
156
|
+
/* @__PURE__ */ s(
|
|
157
|
+
R,
|
|
158
158
|
{
|
|
159
159
|
variant: "h2",
|
|
160
160
|
component: "div",
|
|
161
161
|
sx: {
|
|
162
|
-
fontSize:
|
|
162
|
+
fontSize: c.h2.fontSize,
|
|
163
163
|
fontWeight: "700",
|
|
164
164
|
color: "#263235"
|
|
165
165
|
},
|
|
@@ -167,26 +167,26 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
167
167
|
}
|
|
168
168
|
),
|
|
169
169
|
/* @__PURE__ */ S(
|
|
170
|
-
|
|
170
|
+
R,
|
|
171
171
|
{
|
|
172
172
|
variant: "body2",
|
|
173
173
|
component: "div",
|
|
174
174
|
sx: {
|
|
175
|
-
fontSize:
|
|
175
|
+
fontSize: c.body2.fontSize,
|
|
176
176
|
lineHeight: 1.6,
|
|
177
177
|
color: "#263235",
|
|
178
178
|
mt: "10px"
|
|
179
179
|
},
|
|
180
180
|
children: [
|
|
181
181
|
"Use your camera to verify in seconds.",
|
|
182
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ s("br", {}),
|
|
183
183
|
"Fast, secure and ",
|
|
184
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ s("b", { children: "no images are stored." })
|
|
185
185
|
]
|
|
186
186
|
}
|
|
187
187
|
),
|
|
188
188
|
/* @__PURE__ */ S(
|
|
189
|
-
|
|
189
|
+
Se,
|
|
190
190
|
{
|
|
191
191
|
sx: {
|
|
192
192
|
backgroundColor: "#F5F5F5",
|
|
@@ -201,17 +201,17 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
201
201
|
width: "100%"
|
|
202
202
|
},
|
|
203
203
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ s(Tt, { sx: { fontSize: 20, color: "#666666", flexShrink: 0, mt: "1px" } }),
|
|
205
205
|
/* @__PURE__ */ S(
|
|
206
|
-
|
|
206
|
+
R,
|
|
207
207
|
{
|
|
208
208
|
variant: "body2",
|
|
209
209
|
sx: { fontSize: "0.8rem", color: "#666666", lineHeight: 1.5 },
|
|
210
210
|
children: [
|
|
211
211
|
"By continuing, you give consent to the use of your camera and image for the verification process. Read our",
|
|
212
212
|
" ",
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
|
|
213
|
+
/* @__PURE__ */ s(
|
|
214
|
+
St,
|
|
215
215
|
{
|
|
216
216
|
href: "https://realeyes.ai/privacy-policy/",
|
|
217
217
|
target: "_blank",
|
|
@@ -232,12 +232,12 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
232
232
|
{
|
|
233
233
|
className: "realeyes-btn realeyes-btn--rounded",
|
|
234
234
|
onClick: e,
|
|
235
|
-
disabled:
|
|
235
|
+
disabled: i,
|
|
236
236
|
style: { width: "100%", justifyContent: "center" },
|
|
237
237
|
children: [
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
/* @__PURE__ */ s("span", { children: "Continue" }),
|
|
239
|
+
i && /* @__PURE__ */ s(
|
|
240
|
+
Ee,
|
|
241
241
|
{
|
|
242
242
|
size: 20,
|
|
243
243
|
sx: { color: "white" }
|
|
@@ -246,7 +246,7 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
246
246
|
]
|
|
247
247
|
}
|
|
248
248
|
),
|
|
249
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ s(ee, { uniqueId: r, visible: d })
|
|
250
250
|
]
|
|
251
251
|
}
|
|
252
252
|
)
|
|
@@ -254,7 +254,7 @@ const Ot = ({ size: a = 16, color: e }) => /* @__PURE__ */ o(Rt, { children: /*
|
|
|
254
254
|
}
|
|
255
255
|
) });
|
|
256
256
|
};
|
|
257
|
-
class
|
|
257
|
+
class ye extends Error {
|
|
258
258
|
status;
|
|
259
259
|
constructor(e, t) {
|
|
260
260
|
super(e), this.name = "PermanentSessionError", this.status = t, Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -272,6 +272,10 @@ class M {
|
|
|
272
272
|
isReady;
|
|
273
273
|
adjustLoop;
|
|
274
274
|
cameraReadinessLoop;
|
|
275
|
+
// Host-supplied stream reused by startVideo instead of getUserMedia. The host owns its
|
|
276
|
+
// lifecycle, so stopVideo must not stop its tracks (ownership is derived from whether
|
|
277
|
+
// mediaStream is this same object — see stopVideo).
|
|
278
|
+
externalStream;
|
|
275
279
|
// Video capture settings
|
|
276
280
|
static VIDEO_WIDTH = 1280;
|
|
277
281
|
static VIDEO_HEIGHT = 720;
|
|
@@ -279,7 +283,20 @@ class M {
|
|
|
279
283
|
constructor() {
|
|
280
284
|
this.isReady = !1;
|
|
281
285
|
}
|
|
286
|
+
setExternalStream(e) {
|
|
287
|
+
this.externalStream = e;
|
|
288
|
+
}
|
|
282
289
|
async startVideo(e = void 0, t = void 0) {
|
|
290
|
+
const r = this.externalStream?.getVideoTracks().some((i) => i.readyState === "live");
|
|
291
|
+
if (this.externalStream && r)
|
|
292
|
+
try {
|
|
293
|
+
return this.mediaStream = this.externalStream, this.setupVideoElement(), { status: !0, error: null };
|
|
294
|
+
} catch (i) {
|
|
295
|
+
return console.error(i), { status: !1, error: i?.name || "UnknownError" };
|
|
296
|
+
}
|
|
297
|
+
else this.externalStream && console.warn(
|
|
298
|
+
"CameraManager: external stream has no live video track; falling back to getUserMedia."
|
|
299
|
+
);
|
|
283
300
|
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia)
|
|
284
301
|
try {
|
|
285
302
|
const i = {
|
|
@@ -301,34 +318,37 @@ class M {
|
|
|
301
318
|
facingMode: t ?? { ideal: "user" }
|
|
302
319
|
},
|
|
303
320
|
audio: !1
|
|
304
|
-
},
|
|
321
|
+
}, d = await navigator.mediaDevices.getUserMedia(
|
|
305
322
|
e ? { video: { deviceId: e } } : i
|
|
306
323
|
);
|
|
307
|
-
this.mediaStream =
|
|
308
|
-
try {
|
|
309
|
-
this.videoElement.srcObject = this.mediaStream;
|
|
310
|
-
} catch (f) {
|
|
311
|
-
console.error(f), this.videoElement.src = window.URL.createObjectURL(
|
|
312
|
-
this.mediaStream
|
|
313
|
-
);
|
|
314
|
-
} finally {
|
|
315
|
-
this.videoElement.play();
|
|
316
|
-
}
|
|
317
|
-
const n = this;
|
|
318
|
-
return n.videoElement.addEventListener("loadedmetadata", () => {
|
|
319
|
-
n.cameraReadinessLoop = setInterval(() => {
|
|
320
|
-
n.videoElement && !n.videoElement.paused && !n.videoElement.ended && (n.videoElement.currentTime || 0) > 0 && (n.isReady = !0, clearInterval(n.cameraReadinessLoop), n.adjustLoop = setInterval(() => {
|
|
321
|
-
if (n.mediaStream == null) return;
|
|
322
|
-
const f = n.mediaStream.getVideoTracks()[0].getSettings().width, l = n.mediaStream.getVideoTracks()[0].getSettings().height;
|
|
323
|
-
n.videoElement.width !== f && (n.videoElement.width = n.mediaStream.getVideoTracks()[0].getSettings().width, n.canvasElement.width = n.videoElement.width), n.videoElement.height !== l && (n.videoElement.height = n.mediaStream.getVideoTracks()[0].getSettings().height, n.canvasElement.height = n.videoElement.height);
|
|
324
|
-
}, 150));
|
|
325
|
-
}, 100);
|
|
326
|
-
}), { status: !0, error: null };
|
|
324
|
+
return this.mediaStream = d, this.setupVideoElement(), { status: !0, error: null };
|
|
327
325
|
} catch (i) {
|
|
328
326
|
return console.error(i), { status: !1, error: i?.name || "UnknownError" };
|
|
329
327
|
}
|
|
330
328
|
return { status: !1, error: "NoMediaDevices" };
|
|
331
329
|
}
|
|
330
|
+
setupVideoElement() {
|
|
331
|
+
this.videoElement = document.createElement("video"), this.videoElement.id = "videoExperienceSdk", this.canvasElement = document.createElement("canvas"), this.canvasElement.width = M.VIDEO_WIDTH, this.canvasElement.height = M.VIDEO_HEIGHT, document.body.appendChild(this.videoElement), this.videoElement.pause(), this.videoElement.setAttribute("playsinline", ""), this.videoElement.playsInline = !0, this.videoElement.setAttribute("muted", ""), this.videoElement.controls = !0, this.videoElement.muted = !0, this.videoElement.autoplay = !0, this.videoElement.src = "", this.videoElement.style.width = "1px", this.videoElement.style.height = "1px";
|
|
332
|
+
try {
|
|
333
|
+
this.videoElement.srcObject = this.mediaStream;
|
|
334
|
+
} catch (t) {
|
|
335
|
+
console.error(t), this.videoElement.src = window.URL.createObjectURL(
|
|
336
|
+
this.mediaStream
|
|
337
|
+
);
|
|
338
|
+
} finally {
|
|
339
|
+
this.videoElement.play();
|
|
340
|
+
}
|
|
341
|
+
const e = this;
|
|
342
|
+
e.videoElement.addEventListener("loadedmetadata", () => {
|
|
343
|
+
e.cameraReadinessLoop = setInterval(() => {
|
|
344
|
+
e.videoElement && !e.videoElement.paused && !e.videoElement.ended && (e.videoElement.currentTime || 0) > 0 && (e.isReady = !0, clearInterval(e.cameraReadinessLoop), e.adjustLoop = setInterval(() => {
|
|
345
|
+
if (e.mediaStream == null) return;
|
|
346
|
+
const t = e.mediaStream.getVideoTracks()[0].getSettings().width, r = e.mediaStream.getVideoTracks()[0].getSettings().height;
|
|
347
|
+
e.videoElement.width !== t && (e.videoElement.width = e.mediaStream.getVideoTracks()[0].getSettings().width, e.canvasElement.width = e.videoElement.width), e.videoElement.height !== r && (e.videoElement.height = e.mediaStream.getVideoTracks()[0].getSettings().height, e.canvasElement.height = e.videoElement.height);
|
|
348
|
+
}, 150));
|
|
349
|
+
}, 100);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
332
352
|
/**
|
|
333
353
|
* Returns a promise with the image data from the camera.
|
|
334
354
|
* @async
|
|
@@ -343,11 +363,11 @@ class M {
|
|
|
343
363
|
const e = this;
|
|
344
364
|
return e.mediaStream == null ? Promise.reject(
|
|
345
365
|
"Error: No media stream. Call startVideo to initialize the camera."
|
|
346
|
-
) : new Promise((t,
|
|
347
|
-
let
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
|
|
366
|
+
) : new Promise((t, r) => {
|
|
367
|
+
let i = 0;
|
|
368
|
+
const d = () => {
|
|
369
|
+
if (i > 10) {
|
|
370
|
+
r("Error: Could not get image from camera.");
|
|
351
371
|
return;
|
|
352
372
|
}
|
|
353
373
|
if (e.isReady && e.videoElement && e.canvasElement?.width && e.canvasElement?.height) {
|
|
@@ -358,13 +378,13 @@ class M {
|
|
|
358
378
|
e.canvasElement.width,
|
|
359
379
|
e.canvasElement.height
|
|
360
380
|
);
|
|
361
|
-
const
|
|
362
|
-
t(
|
|
381
|
+
const h = e.canvasElement.toDataURL("image/png");
|
|
382
|
+
t(h);
|
|
363
383
|
return;
|
|
364
384
|
}
|
|
365
|
-
|
|
385
|
+
i++, setTimeout(d, 150);
|
|
366
386
|
};
|
|
367
|
-
|
|
387
|
+
d();
|
|
368
388
|
});
|
|
369
389
|
}
|
|
370
390
|
/**
|
|
@@ -376,18 +396,18 @@ class M {
|
|
|
376
396
|
*/
|
|
377
397
|
stopVideo() {
|
|
378
398
|
if (this.mediaStream) {
|
|
379
|
-
clearInterval(this.adjustLoop), this.isReady = !1
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
this.mediaStream = void 0, this.videoElement.srcObject = null, this.videoElement.removeAttribute("src"), document.body.removeChild(this.videoElement), this.videoElement = void 0, this.canvasElement = void 0, this.adjustLoop = void 0;
|
|
399
|
+
if (clearInterval(this.adjustLoop), clearInterval(this.cameraReadinessLoop), this.isReady = !1, this.mediaStream !== this.externalStream)
|
|
400
|
+
try {
|
|
401
|
+
this.mediaStream.getVideoTracks().forEach(function(e) {
|
|
402
|
+
e.stop();
|
|
403
|
+
});
|
|
404
|
+
} catch {
|
|
405
|
+
}
|
|
406
|
+
this.mediaStream = void 0, this.videoElement.srcObject = null, this.videoElement.removeAttribute("src"), document.body.removeChild(this.videoElement), this.videoElement = void 0, this.canvasElement = void 0, this.adjustLoop = void 0, this.cameraReadinessLoop = void 0;
|
|
387
407
|
}
|
|
388
408
|
}
|
|
389
409
|
}
|
|
390
|
-
class
|
|
410
|
+
class Pt {
|
|
391
411
|
browser;
|
|
392
412
|
version;
|
|
393
413
|
constructor() {
|
|
@@ -395,140 +415,140 @@ class Lt {
|
|
|
395
415
|
}
|
|
396
416
|
}
|
|
397
417
|
class N {
|
|
398
|
-
static extractVersion(e, t,
|
|
399
|
-
const
|
|
400
|
-
return
|
|
418
|
+
static extractVersion(e, t, r) {
|
|
419
|
+
const i = e.match(t);
|
|
420
|
+
return i && i.length >= r ? parseInt(i[r], 10) : null;
|
|
401
421
|
}
|
|
402
422
|
static detectBrowser(e) {
|
|
403
|
-
const t = e && e.navigator,
|
|
404
|
-
return typeof e > "u" || !e.navigator ? (
|
|
423
|
+
const t = e && e.navigator, r = new Pt();
|
|
424
|
+
return typeof e > "u" || !e.navigator ? (r.browser = "Not a browser", r) : (t.mozGetUserMedia && t.userAgent.match(/Firefox\/(\d+)\./) ? (r.browser = "firefox", r.version = N.extractVersion(
|
|
405
425
|
t.userAgent,
|
|
406
426
|
/Firefox\/(\d+)\./,
|
|
407
427
|
1
|
|
408
|
-
)) : t.webkitGetUserMedia && t.userAgent.match(/Chrom(e|ium)\/(\d+)\./) ? (
|
|
428
|
+
)) : t.webkitGetUserMedia && t.userAgent.match(/Chrom(e|ium)\/(\d+)\./) ? (r.browser = "chrome", r.version = N.extractVersion(
|
|
409
429
|
t.userAgent,
|
|
410
430
|
/Chrom(e|ium)\/(\d+)\./,
|
|
411
431
|
2
|
|
412
|
-
)) : t.mediaDevices && t.userAgent.match(/Edge\/(\d+).(\d+)$/) ? (
|
|
432
|
+
)) : t.mediaDevices && t.userAgent.match(/Edge\/(\d+).(\d+)$/) ? (r.browser = "edge", r.version = N.extractVersion(
|
|
413
433
|
t.userAgent,
|
|
414
434
|
/Edge\/(\d+).(\d+)$/,
|
|
415
435
|
2
|
|
416
|
-
)) : e.RTCPeerConnection && t.userAgent.match(/AppleWebKit\/(\d+)\./) ? (
|
|
436
|
+
)) : e.RTCPeerConnection && t.userAgent.match(/AppleWebKit\/(\d+)\./) ? (r.browser = "safari", r.version = N.extractVersion(
|
|
417
437
|
t.userAgent,
|
|
418
438
|
/AppleWebKit\/(\d+)\./,
|
|
419
439
|
1
|
|
420
|
-
)) :
|
|
440
|
+
)) : r.browser = "Not supported", r);
|
|
421
441
|
}
|
|
422
442
|
}
|
|
423
|
-
class
|
|
443
|
+
class zt {
|
|
424
444
|
shimCreateObjectURL(e) {
|
|
425
445
|
const t = e && e.URL;
|
|
426
446
|
if (typeof e == "object" && e.HTMLMediaElement && "srcObject" in e.HTMLMediaElement.prototype && t.createObjectURL && t.revokeObjectURL) {
|
|
427
|
-
const
|
|
428
|
-
let
|
|
429
|
-
t.createObjectURL = function(
|
|
430
|
-
if ("getTracks" in
|
|
431
|
-
const
|
|
432
|
-
return
|
|
447
|
+
const r = t.createObjectURL.bind(t), i = t.revokeObjectURL.bind(t), d = /* @__PURE__ */ new Map();
|
|
448
|
+
let h = 0;
|
|
449
|
+
t.createObjectURL = function(a) {
|
|
450
|
+
if ("getTracks" in a) {
|
|
451
|
+
const l = "polyblob:" + ++h;
|
|
452
|
+
return d.set(l, a), l;
|
|
433
453
|
}
|
|
434
|
-
return
|
|
435
|
-
}, t.revokeObjectURL = function(
|
|
436
|
-
|
|
454
|
+
return r(a);
|
|
455
|
+
}, t.revokeObjectURL = function(a) {
|
|
456
|
+
i(a), d.delete(a);
|
|
437
457
|
};
|
|
438
|
-
const
|
|
458
|
+
const c = Object.getOwnPropertyDescriptor(
|
|
439
459
|
e.HTMLMediaElement.prototype,
|
|
440
460
|
"src"
|
|
441
461
|
);
|
|
442
462
|
Object.defineProperty(e.HTMLMediaElement.prototype, "src", {
|
|
443
463
|
get: function() {
|
|
444
|
-
if (
|
|
445
|
-
return
|
|
464
|
+
if (c && typeof c.get == "function")
|
|
465
|
+
return c.get.call(this);
|
|
446
466
|
},
|
|
447
|
-
set: function(
|
|
448
|
-
if (this.srcObject =
|
|
449
|
-
return
|
|
467
|
+
set: function(a) {
|
|
468
|
+
if (this.srcObject = d.get(a) || null, c && typeof c.set == "function")
|
|
469
|
+
return c.set.call(this, a);
|
|
450
470
|
}
|
|
451
471
|
});
|
|
452
|
-
const
|
|
472
|
+
const n = e.HTMLMediaElement.prototype.setAttribute;
|
|
453
473
|
e.HTMLMediaElement.prototype.setAttribute = function() {
|
|
454
|
-
return arguments.length === 2 && ("" + arguments[0]).toLowerCase() === "src" && (this.srcObject =
|
|
474
|
+
return arguments.length === 2 && ("" + arguments[0]).toLowerCase() === "src" && (this.srcObject = d.get(arguments[1]) || null), n.apply(this, arguments);
|
|
455
475
|
};
|
|
456
476
|
}
|
|
457
477
|
}
|
|
458
478
|
}
|
|
459
|
-
class
|
|
479
|
+
class Ft {
|
|
460
480
|
init(e) {
|
|
461
|
-
const t = N.detectBrowser(e),
|
|
462
|
-
if (typeof
|
|
463
|
-
const
|
|
464
|
-
return Object.keys(
|
|
465
|
-
if (
|
|
466
|
-
const u = typeof
|
|
467
|
-
ideal:
|
|
481
|
+
const t = N.detectBrowser(e), r = e && e.navigator, i = function(n) {
|
|
482
|
+
if (typeof n != "object" || n.mandatory || n.optional) return n;
|
|
483
|
+
const a = {};
|
|
484
|
+
return Object.keys(n).forEach(function(l) {
|
|
485
|
+
if (l !== "require" && l !== "advanced" && l !== "mediaSource") {
|
|
486
|
+
const u = typeof n[l] == "object" ? n[l] : {
|
|
487
|
+
ideal: n[l]
|
|
468
488
|
};
|
|
469
489
|
u.exact !== void 0 && typeof u.exact == "number" && (u.min = u.max = u.exact);
|
|
470
|
-
const
|
|
471
|
-
return
|
|
490
|
+
const p = function(f, v) {
|
|
491
|
+
return f ? f + v.charAt(0).toUpperCase() + v.slice(1) : v === "deviceId" ? "sourceId" : v;
|
|
472
492
|
};
|
|
473
493
|
if (u.ideal !== void 0) {
|
|
474
|
-
|
|
475
|
-
let
|
|
476
|
-
typeof u.ideal == "number" ? (p
|
|
494
|
+
a.optional = a.optional || [];
|
|
495
|
+
let f = {};
|
|
496
|
+
typeof u.ideal == "number" ? (f[p("min", l)] = u.ideal, a.optional.push(f), f = {}, f[p("max", l)] = u.ideal) : f[p("", l)] = u.ideal, a.optional.push(f);
|
|
477
497
|
}
|
|
478
|
-
u.exact !== void 0 && typeof u.exact != "number" ? (
|
|
479
|
-
u[
|
|
498
|
+
u.exact !== void 0 && typeof u.exact != "number" ? (a.mandatory = a.mandatory || {}, a.mandatory[p("", l)] = u.exact) : ["min", "max"].forEach(function(f) {
|
|
499
|
+
u[f] !== void 0 && (a.mandatory = a.mandatory || {}, a.mandatory[p(f, l)] = u[f]);
|
|
480
500
|
});
|
|
481
501
|
}
|
|
482
|
-
}),
|
|
483
|
-
},
|
|
502
|
+
}), n.advanced && (a.optional = (a.optional || []).concat(n.advanced)), a;
|
|
503
|
+
}, d = function(n, a) {
|
|
484
504
|
if (t.version && 61 <= t.version)
|
|
485
|
-
return
|
|
486
|
-
if ((
|
|
487
|
-
const
|
|
488
|
-
|
|
505
|
+
return a(n);
|
|
506
|
+
if ((n = JSON.parse(JSON.stringify(n))) && typeof n.audio == "object") {
|
|
507
|
+
const l = function(u, p, f) {
|
|
508
|
+
p in u && !(f in u) && (u[f] = u[p], delete u[p]);
|
|
489
509
|
};
|
|
490
|
-
|
|
491
|
-
|
|
510
|
+
n = JSON.parse(JSON.stringify(n)), l(
|
|
511
|
+
n.audio,
|
|
492
512
|
"autoGainControl",
|
|
493
513
|
"googAutoGainControl"
|
|
494
|
-
),
|
|
495
|
-
|
|
514
|
+
), l(
|
|
515
|
+
n.audio,
|
|
496
516
|
"noiseSuppression",
|
|
497
517
|
"googNoiseSuppression"
|
|
498
|
-
),
|
|
518
|
+
), n.audio = i(n.audio);
|
|
499
519
|
}
|
|
500
|
-
if (
|
|
501
|
-
let
|
|
502
|
-
|
|
503
|
-
ideal:
|
|
520
|
+
if (n && typeof n.video == "object") {
|
|
521
|
+
let l = n.video.facingMode;
|
|
522
|
+
l = l && (typeof l == "object" ? l : {
|
|
523
|
+
ideal: l
|
|
504
524
|
});
|
|
505
525
|
const u = t.version && 66 > t.version;
|
|
506
|
-
if (!(!
|
|
507
|
-
delete
|
|
508
|
-
let
|
|
509
|
-
if (
|
|
510
|
-
return
|
|
511
|
-
|
|
512
|
-
return
|
|
526
|
+
if (!(!l || l.exact !== "user" && l.exact !== "environment" && l.ideal !== "user" && l.ideal !== "environment" || r.mediaDevices.getSupportedConstraints && r.mediaDevices.getSupportedConstraints().facingMode && !u)) {
|
|
527
|
+
delete n.video.facingMode;
|
|
528
|
+
let p = null;
|
|
529
|
+
if (l.exact === "environment" || l.ideal === "environment" ? p = ["back", "rear"] : (l.exact === "user" || l.ideal === "user") && (p = ["front"]), p)
|
|
530
|
+
return r.mediaDevices.enumerateDevices().then(function(f) {
|
|
531
|
+
f = f.filter(function(T) {
|
|
532
|
+
return T.kind === "videoinput";
|
|
513
533
|
});
|
|
514
|
-
let v =
|
|
515
|
-
function(
|
|
516
|
-
return
|
|
517
|
-
return
|
|
534
|
+
let v = f.find(
|
|
535
|
+
function(T) {
|
|
536
|
+
return p.some(function(oe) {
|
|
537
|
+
return T.label.toLowerCase().indexOf(oe) !== -1;
|
|
518
538
|
});
|
|
519
539
|
}
|
|
520
540
|
);
|
|
521
|
-
return !v &&
|
|
541
|
+
return !v && f.length && p.indexOf("back") !== -1 && (v = f[f.length - 1]), v && (n.video.deviceId = l.exact ? {
|
|
522
542
|
exact: v.deviceId
|
|
523
543
|
} : {
|
|
524
544
|
ideal: v.deviceId
|
|
525
|
-
}),
|
|
545
|
+
}), n.video = i(n.video), a(n);
|
|
526
546
|
});
|
|
527
547
|
}
|
|
528
|
-
|
|
548
|
+
n.video = i(n.video);
|
|
529
549
|
}
|
|
530
|
-
return
|
|
531
|
-
},
|
|
550
|
+
return a(n);
|
|
551
|
+
}, h = function(n) {
|
|
532
552
|
return {
|
|
533
553
|
name: {
|
|
534
554
|
PermissionDeniedError: "NotAllowedError",
|
|
@@ -542,48 +562,48 @@ class Pt {
|
|
|
542
562
|
TabCaptureError: "AbortError",
|
|
543
563
|
ScreenCaptureError: "AbortError",
|
|
544
564
|
DeviceCaptureError: "AbortError"
|
|
545
|
-
}[
|
|
546
|
-
message:
|
|
547
|
-
constraint:
|
|
565
|
+
}[n.name] || n.name,
|
|
566
|
+
message: n.message,
|
|
567
|
+
constraint: n.constraint || n.constraintName,
|
|
548
568
|
toString: function() {
|
|
549
569
|
return this.name + (this.message && ": ") + this.message;
|
|
550
570
|
}
|
|
551
571
|
};
|
|
552
572
|
};
|
|
553
|
-
|
|
554
|
-
n
|
|
555
|
-
|
|
573
|
+
r.getUserMedia = function(n, a, l) {
|
|
574
|
+
d(n, function(u) {
|
|
575
|
+
r.webkitGetUserMedia(
|
|
556
576
|
u,
|
|
557
|
-
|
|
558
|
-
function(
|
|
559
|
-
|
|
577
|
+
a,
|
|
578
|
+
function(p) {
|
|
579
|
+
l && l(h(p));
|
|
560
580
|
}
|
|
561
581
|
);
|
|
562
582
|
});
|
|
563
583
|
};
|
|
564
|
-
const
|
|
565
|
-
return new Promise(function(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
584
|
+
const c = function(n) {
|
|
585
|
+
return new Promise(function(a, l) {
|
|
586
|
+
r.getUserMedia(
|
|
587
|
+
n,
|
|
588
|
+
a,
|
|
589
|
+
l
|
|
570
590
|
);
|
|
571
591
|
});
|
|
572
592
|
};
|
|
573
|
-
if (
|
|
574
|
-
getUserMedia:
|
|
593
|
+
if (r.mediaDevices || (r.mediaDevices = {
|
|
594
|
+
getUserMedia: c,
|
|
575
595
|
enumerateDevices: function() {
|
|
576
|
-
return new Promise(function(
|
|
577
|
-
const
|
|
596
|
+
return new Promise(function(n) {
|
|
597
|
+
const a = {
|
|
578
598
|
audio: "audioinput",
|
|
579
599
|
video: "videoinput"
|
|
580
600
|
};
|
|
581
|
-
return e.MediaStreamTrack.getSources(function(
|
|
582
|
-
|
|
583
|
-
|
|
601
|
+
return e.MediaStreamTrack.getSources(function(l) {
|
|
602
|
+
n(
|
|
603
|
+
l.map(function(u) {
|
|
584
604
|
return {
|
|
585
605
|
label: u.label,
|
|
586
|
-
kind:
|
|
606
|
+
kind: a[u.kind],
|
|
587
607
|
deviceId: u.id,
|
|
588
608
|
groupId: ""
|
|
589
609
|
};
|
|
@@ -602,41 +622,41 @@ class Pt {
|
|
|
602
622
|
width: !0
|
|
603
623
|
};
|
|
604
624
|
}
|
|
605
|
-
}),
|
|
606
|
-
const
|
|
607
|
-
|
|
625
|
+
}), r.mediaDevices.getUserMedia) {
|
|
626
|
+
const n = r.mediaDevices.getUserMedia.bind(
|
|
627
|
+
r.mediaDevices
|
|
608
628
|
);
|
|
609
|
-
|
|
610
|
-
return
|
|
611
|
-
|
|
612
|
-
function(
|
|
613
|
-
return
|
|
629
|
+
r.mediaDevices.getUserMedia = function(a) {
|
|
630
|
+
return d(
|
|
631
|
+
a,
|
|
632
|
+
function(l) {
|
|
633
|
+
return n(l).then(
|
|
614
634
|
function(u) {
|
|
615
|
-
if (
|
|
616
|
-
throw u.getTracks().forEach(function(
|
|
617
|
-
|
|
635
|
+
if (l.audio && !u.getAudioTracks().length || l.video && !u.getVideoTracks().length)
|
|
636
|
+
throw u.getTracks().forEach(function(p) {
|
|
637
|
+
p.stop();
|
|
618
638
|
}), new DOMException("", "NotFoundError");
|
|
619
639
|
return u;
|
|
620
640
|
},
|
|
621
641
|
function(u) {
|
|
622
|
-
return Promise.reject(
|
|
642
|
+
return Promise.reject(h(u));
|
|
623
643
|
}
|
|
624
644
|
);
|
|
625
645
|
}
|
|
626
646
|
);
|
|
627
647
|
};
|
|
628
648
|
} else
|
|
629
|
-
|
|
630
|
-
return
|
|
649
|
+
r.mediaDevices.getUserMedia = function(n) {
|
|
650
|
+
return c(n);
|
|
631
651
|
};
|
|
632
|
-
typeof
|
|
633
|
-
}), typeof
|
|
652
|
+
typeof r.mediaDevices.addEventListener > "u" && (r.mediaDevices.addEventListener = function() {
|
|
653
|
+
}), typeof r.mediaDevices.removeEventListener > "u" && (r.mediaDevices.removeEventListener = function() {
|
|
634
654
|
});
|
|
635
655
|
}
|
|
636
656
|
}
|
|
637
|
-
class
|
|
657
|
+
class _t {
|
|
638
658
|
shimGetUserMedia(e) {
|
|
639
|
-
return new
|
|
659
|
+
return new Ft().init(e);
|
|
640
660
|
}
|
|
641
661
|
shimMediaStream(e) {
|
|
642
662
|
e.MediaStream = e.MediaStream || e.webkitMediaStream;
|
|
@@ -650,108 +670,108 @@ class Vt {
|
|
|
650
670
|
get: function() {
|
|
651
671
|
return this._srcObject;
|
|
652
672
|
},
|
|
653
|
-
set: function(
|
|
654
|
-
const
|
|
655
|
-
this._srcObject =
|
|
656
|
-
|
|
657
|
-
}),
|
|
658
|
-
|
|
673
|
+
set: function(r) {
|
|
674
|
+
const i = this;
|
|
675
|
+
this._srcObject = r, this.src && t.revokeObjectURL(this.src), r ? (this.src = t.createObjectURL(r), r.addEventListener("addtrack", function() {
|
|
676
|
+
i.src && t.revokeObjectURL(i.src), i.src = t.createObjectURL(r);
|
|
677
|
+
}), r.addEventListener("removetrack", function() {
|
|
678
|
+
i.src && t.revokeObjectURL(i.src), i.src = t.createObjectURL(r);
|
|
659
679
|
})) : this.src = "";
|
|
660
680
|
}
|
|
661
681
|
}
|
|
662
682
|
));
|
|
663
683
|
}
|
|
664
684
|
}
|
|
665
|
-
class
|
|
685
|
+
class Gt {
|
|
666
686
|
init(e) {
|
|
667
687
|
e = e && e.navigator;
|
|
668
|
-
const t = function(
|
|
688
|
+
const t = function(i) {
|
|
669
689
|
return {
|
|
670
690
|
name: {
|
|
671
691
|
PermissionDeniedError: "NotAllowedError"
|
|
672
|
-
}[
|
|
673
|
-
message:
|
|
674
|
-
constraint:
|
|
692
|
+
}[i.name] || i.name,
|
|
693
|
+
message: i.message,
|
|
694
|
+
constraint: i.constraint,
|
|
675
695
|
toString: function() {
|
|
676
696
|
return this.name;
|
|
677
697
|
}
|
|
678
698
|
};
|
|
679
|
-
},
|
|
699
|
+
}, r = e.mediaDevices.getUserMedia.bind(
|
|
680
700
|
e.mediaDevices
|
|
681
701
|
);
|
|
682
|
-
e.mediaDevices.getUserMedia = function(
|
|
683
|
-
return i
|
|
684
|
-
return Promise.reject(t(
|
|
702
|
+
e.mediaDevices.getUserMedia = function(i) {
|
|
703
|
+
return r(i).catch(function(d) {
|
|
704
|
+
return Promise.reject(t(d));
|
|
685
705
|
});
|
|
686
706
|
};
|
|
687
707
|
}
|
|
688
708
|
}
|
|
689
|
-
class
|
|
709
|
+
class Bt {
|
|
690
710
|
shimGetUserMedia(e) {
|
|
691
|
-
return new
|
|
711
|
+
return new Gt().init(e);
|
|
692
712
|
}
|
|
693
713
|
}
|
|
694
|
-
class
|
|
714
|
+
class jt {
|
|
695
715
|
init(e) {
|
|
696
|
-
const t = N.detectBrowser(e),
|
|
716
|
+
const t = N.detectBrowser(e), r = e && e.navigator;
|
|
697
717
|
e = e && e.MediaStreamTrack;
|
|
698
|
-
const
|
|
718
|
+
const i = function(c) {
|
|
699
719
|
return {
|
|
700
720
|
name: {
|
|
701
721
|
InternalError: "NotReadableError",
|
|
702
722
|
NotSupportedError: "TypeError",
|
|
703
723
|
PermissionDeniedError: "NotAllowedError",
|
|
704
724
|
SecurityError: "NotAllowedError"
|
|
705
|
-
}[
|
|
725
|
+
}[c.name] || c.name,
|
|
706
726
|
message: {
|
|
707
727
|
"The operation is insecure.": "The request is not allowed by the user agent or the platform in the current context."
|
|
708
|
-
}[
|
|
709
|
-
constraint:
|
|
728
|
+
}[c.message] || c.message,
|
|
729
|
+
constraint: c.constraint,
|
|
710
730
|
toString: function() {
|
|
711
731
|
return this.name + (this.message && ": ") + this.message;
|
|
712
732
|
}
|
|
713
733
|
};
|
|
714
|
-
},
|
|
715
|
-
const
|
|
734
|
+
}, d = function(c, n, a) {
|
|
735
|
+
const l = function(u) {
|
|
716
736
|
if (typeof u != "object" || u.require) return u;
|
|
717
|
-
const
|
|
718
|
-
return Object.keys(u).forEach(function(
|
|
719
|
-
if (
|
|
720
|
-
const v = u[
|
|
721
|
-
ideal: u[
|
|
737
|
+
const p = [];
|
|
738
|
+
return Object.keys(u).forEach(function(f) {
|
|
739
|
+
if (f !== "require" && f !== "advanced" && f !== "mediaSource") {
|
|
740
|
+
const v = u[f] = typeof u[f] == "object" ? u[f] : {
|
|
741
|
+
ideal: u[f]
|
|
722
742
|
};
|
|
723
|
-
if (v.min === void 0 && v.max === void 0 && v.exact === void 0 ||
|
|
743
|
+
if (v.min === void 0 && v.max === void 0 && v.exact === void 0 || p.push(f), v.exact !== void 0 && (typeof v.exact == "number" ? v.min = v.max = v.exact : u[f] = v.exact, delete v.exact), v.ideal !== void 0) {
|
|
724
744
|
u.advanced = u.advanced || [];
|
|
725
|
-
const
|
|
726
|
-
|
|
745
|
+
const T = {};
|
|
746
|
+
T[f] = typeof v.ideal == "number" ? {
|
|
727
747
|
min: v.ideal,
|
|
728
748
|
max: v.ideal
|
|
729
|
-
} : v.ideal, u.advanced.push(
|
|
749
|
+
} : v.ideal, u.advanced.push(T), delete v.ideal, Object.keys(v).length || delete u[f];
|
|
730
750
|
}
|
|
731
751
|
}
|
|
732
|
-
}),
|
|
752
|
+
}), p.length && (u.require = p), u;
|
|
733
753
|
};
|
|
734
|
-
return
|
|
735
|
-
|
|
736
|
-
|
|
754
|
+
return c = JSON.parse(JSON.stringify(c)), t.version && 38 > t.version && (c.audio && (c.audio = l(c.audio)), c.video && (c.video = l(c.video))), r.mozGetUserMedia(
|
|
755
|
+
c,
|
|
756
|
+
n,
|
|
737
757
|
function(u) {
|
|
738
|
-
|
|
758
|
+
a(i(u));
|
|
739
759
|
}
|
|
740
760
|
);
|
|
741
|
-
},
|
|
742
|
-
return new Promise(function(
|
|
743
|
-
|
|
761
|
+
}, h = function(c) {
|
|
762
|
+
return new Promise(function(n, a) {
|
|
763
|
+
d(c, n, a);
|
|
744
764
|
});
|
|
745
765
|
};
|
|
746
|
-
if (
|
|
747
|
-
getUserMedia:
|
|
766
|
+
if (r.mediaDevices || (r.mediaDevices = {
|
|
767
|
+
getUserMedia: h,
|
|
748
768
|
addEventListener: function() {
|
|
749
769
|
},
|
|
750
770
|
removeEventListener: function() {
|
|
751
771
|
}
|
|
752
|
-
}),
|
|
753
|
-
return new Promise(function(
|
|
754
|
-
|
|
772
|
+
}), r.mediaDevices.enumerateDevices = r.mediaDevices.enumerateDevices || function() {
|
|
773
|
+
return new Promise(function(c) {
|
|
774
|
+
c([
|
|
755
775
|
{
|
|
756
776
|
kind: "audioinput",
|
|
757
777
|
deviceId: "default",
|
|
@@ -767,77 +787,77 @@ class _t {
|
|
|
767
787
|
]);
|
|
768
788
|
});
|
|
769
789
|
}, t.version && 41 > t.version) {
|
|
770
|
-
const
|
|
771
|
-
|
|
790
|
+
const c = r.mediaDevices.enumerateDevices.bind(
|
|
791
|
+
r.mediaDevices
|
|
772
792
|
);
|
|
773
|
-
|
|
774
|
-
return
|
|
775
|
-
if (
|
|
776
|
-
throw
|
|
793
|
+
r.mediaDevices.enumerateDevices = function() {
|
|
794
|
+
return c().then(void 0, function(n) {
|
|
795
|
+
if (n.name === "NotFoundError") return [];
|
|
796
|
+
throw n;
|
|
777
797
|
});
|
|
778
798
|
};
|
|
779
799
|
}
|
|
780
800
|
if (t.version && 49 > t.version) {
|
|
781
|
-
const
|
|
782
|
-
|
|
801
|
+
const c = r.mediaDevices.getUserMedia.bind(
|
|
802
|
+
r.mediaDevices
|
|
783
803
|
);
|
|
784
|
-
|
|
785
|
-
return
|
|
786
|
-
function(
|
|
787
|
-
if (
|
|
788
|
-
throw
|
|
789
|
-
|
|
804
|
+
r.mediaDevices.getUserMedia = function(n) {
|
|
805
|
+
return c(n).then(
|
|
806
|
+
function(a) {
|
|
807
|
+
if (n.audio && !a.getAudioTracks().length || n.video && !a.getVideoTracks().length)
|
|
808
|
+
throw a.getTracks().forEach(function(l) {
|
|
809
|
+
l.stop();
|
|
790
810
|
}), new DOMException(
|
|
791
811
|
"The object can not be found here.",
|
|
792
812
|
"NotFoundError"
|
|
793
813
|
);
|
|
794
|
-
return
|
|
814
|
+
return a;
|
|
795
815
|
},
|
|
796
|
-
function(
|
|
797
|
-
return Promise.reject(
|
|
816
|
+
function(a) {
|
|
817
|
+
return Promise.reject(i(a));
|
|
798
818
|
}
|
|
799
819
|
);
|
|
800
820
|
};
|
|
801
821
|
}
|
|
802
|
-
if (!(t.version && 55 < t.version && "autoGainControl" in
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
},
|
|
806
|
-
|
|
822
|
+
if (!(t.version && 55 < t.version && "autoGainControl" in r.mediaDevices.getSupportedConstraints())) {
|
|
823
|
+
const c = function(a, l, u) {
|
|
824
|
+
l in a && !(u in a) && (a[u] = a[l], delete a[l]);
|
|
825
|
+
}, n = r.mediaDevices.getUserMedia.bind(
|
|
826
|
+
r.mediaDevices
|
|
807
827
|
);
|
|
808
|
-
if (
|
|
809
|
-
return typeof
|
|
828
|
+
if (r.mediaDevices.getUserMedia = function(a) {
|
|
829
|
+
return typeof a == "object" && typeof a.audio == "object" && (a = JSON.parse(JSON.stringify(a)), c(a.audio, "autoGainControl", "mozAutoGainControl"), c(a.audio, "noiseSuppression", "mozNoiseSuppression")), n(a);
|
|
810
830
|
}, e && e.prototype.getSettings) {
|
|
811
|
-
const
|
|
831
|
+
const a = e.prototype.getSettings;
|
|
812
832
|
e.prototype.getSettings = function() {
|
|
813
|
-
const
|
|
814
|
-
return l
|
|
833
|
+
const l = a.apply(this, arguments);
|
|
834
|
+
return c(l, "mozAutoGainControl", "autoGainControl"), c(l, "mozNoiseSuppression", "noiseSuppression"), l;
|
|
815
835
|
};
|
|
816
836
|
}
|
|
817
837
|
if (e && e.prototype.applyConstraints) {
|
|
818
|
-
const
|
|
819
|
-
e.prototype.applyConstraints = function(
|
|
820
|
-
return this.kind === "audio" && typeof
|
|
838
|
+
const a = e.prototype.applyConstraints;
|
|
839
|
+
e.prototype.applyConstraints = function(l) {
|
|
840
|
+
return this.kind === "audio" && typeof l == "object" && (l = JSON.parse(JSON.stringify(l)), c(l, "autoGainControl", "mozAutoGainControl"), c(l, "noiseSuppression", "mozNoiseSuppression")), a.apply(this, [l]);
|
|
821
841
|
};
|
|
822
842
|
}
|
|
823
843
|
}
|
|
824
|
-
|
|
844
|
+
r.getUserMedia = function(c, n, a) {
|
|
825
845
|
if (t.version && 44 > t.version)
|
|
826
|
-
return
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
846
|
+
return d(
|
|
847
|
+
c,
|
|
848
|
+
n,
|
|
849
|
+
a
|
|
830
850
|
);
|
|
831
851
|
console.warn(
|
|
832
852
|
"navigator.getUserMedia",
|
|
833
853
|
"navigator.mediaDevices.getUserMedia"
|
|
834
|
-
),
|
|
854
|
+
), r.mediaDevices.getUserMedia(c).then(n, a);
|
|
835
855
|
};
|
|
836
856
|
}
|
|
837
857
|
}
|
|
838
|
-
class
|
|
858
|
+
class Ht {
|
|
839
859
|
shimGetUserMedia(e) {
|
|
840
|
-
return new
|
|
860
|
+
return new jt().init(e);
|
|
841
861
|
}
|
|
842
862
|
shimSourceObject(e) {
|
|
843
863
|
typeof e == "object" && (!e.HTMLMediaElement || "srcObject" in e.HTMLMediaElement.prototype || Object.defineProperty(
|
|
@@ -854,55 +874,55 @@ class Gt {
|
|
|
854
874
|
));
|
|
855
875
|
}
|
|
856
876
|
}
|
|
857
|
-
class
|
|
877
|
+
class $t {
|
|
858
878
|
shimGetUserMedia(e) {
|
|
859
879
|
const t = e && e.navigator;
|
|
860
|
-
t.getUserMedia || (t.webkitGetUserMedia ? t.getUserMedia = t.webkitGetUserMedia.bind(t) : t.mediaDevices && t.mediaDevices.getUserMedia && (t.getUserMedia = (function(
|
|
861
|
-
t.mediaDevices.getUserMedia(
|
|
880
|
+
t.getUserMedia || (t.webkitGetUserMedia ? t.getUserMedia = t.webkitGetUserMedia.bind(t) : t.mediaDevices && t.mediaDevices.getUserMedia && (t.getUserMedia = (function(r, i, d) {
|
|
881
|
+
t.mediaDevices.getUserMedia(r).then(i, d);
|
|
862
882
|
}).bind(t)));
|
|
863
883
|
}
|
|
864
884
|
}
|
|
865
|
-
class
|
|
885
|
+
class Wt {
|
|
866
886
|
browserDetails;
|
|
867
887
|
browserAdapter;
|
|
868
888
|
commonAdapter;
|
|
869
889
|
extractVersion;
|
|
870
|
-
constructor(e, t,
|
|
871
|
-
this.browserDetails = e, this.browserAdapter = t, this.commonAdapter =
|
|
890
|
+
constructor(e, t, r, i) {
|
|
891
|
+
this.browserDetails = e, this.browserAdapter = t, this.commonAdapter = r, this.extractVersion = i;
|
|
872
892
|
}
|
|
873
893
|
}
|
|
874
|
-
class
|
|
894
|
+
class qt {
|
|
875
895
|
init() {
|
|
876
|
-
const e = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : {}, t = e && e.window,
|
|
877
|
-
|
|
896
|
+
const e = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : {}, t = e && e.window, r = N.detectBrowser(t), i = new _t(), d = new Bt(), h = new Ht(), c = new $t(), n = new zt(), a = new Wt(
|
|
897
|
+
r,
|
|
878
898
|
null,
|
|
879
|
-
|
|
899
|
+
n,
|
|
880
900
|
N.extractVersion
|
|
881
901
|
);
|
|
882
|
-
switch (
|
|
902
|
+
switch (r.browser) {
|
|
883
903
|
case "chrome":
|
|
884
|
-
|
|
904
|
+
a.browserAdapter = i, n.shimCreateObjectURL(t), i.shimGetUserMedia(t), i.shimMediaStream(t), i.shimSourceObject(t);
|
|
885
905
|
break;
|
|
886
906
|
case "firefox":
|
|
887
|
-
|
|
907
|
+
a.browserAdapter = h, n.shimCreateObjectURL(t), h.shimGetUserMedia(t), h.shimSourceObject(t);
|
|
888
908
|
break;
|
|
889
909
|
case "edge":
|
|
890
|
-
|
|
910
|
+
a.browserAdapter = d, n.shimCreateObjectURL(t), d.shimGetUserMedia(t);
|
|
891
911
|
break;
|
|
892
912
|
case "safari":
|
|
893
|
-
|
|
913
|
+
a.browserAdapter = c, n.shimCreateObjectURL(t), c.shimGetUserMedia(t);
|
|
894
914
|
break;
|
|
895
915
|
}
|
|
896
|
-
return
|
|
916
|
+
return a;
|
|
897
917
|
}
|
|
898
918
|
}
|
|
899
|
-
class
|
|
919
|
+
class Kt {
|
|
900
920
|
cameraManager;
|
|
901
921
|
constructor() {
|
|
902
922
|
this.cameraManager = new M();
|
|
903
923
|
}
|
|
904
924
|
async init() {
|
|
905
|
-
return new
|
|
925
|
+
return new qt().init();
|
|
906
926
|
}
|
|
907
927
|
async startVideo(e) {
|
|
908
928
|
const t = await this.cameraManager.startVideo(
|
|
@@ -917,6 +937,9 @@ class $t {
|
|
|
917
937
|
stopVideo() {
|
|
918
938
|
return this.cameraManager.stopVideo();
|
|
919
939
|
}
|
|
940
|
+
setExternalStream(e) {
|
|
941
|
+
this.cameraManager.setExternalStream(e);
|
|
942
|
+
}
|
|
920
943
|
getCameraManager() {
|
|
921
944
|
return this.cameraManager;
|
|
922
945
|
}
|
|
@@ -926,49 +949,49 @@ class $t {
|
|
|
926
949
|
translateMediaError(e) {
|
|
927
950
|
if (e.status)
|
|
928
951
|
return new F(
|
|
929
|
-
|
|
952
|
+
L.GRANTED,
|
|
930
953
|
z.GRANTED
|
|
931
954
|
);
|
|
932
955
|
switch (e.error) {
|
|
933
956
|
case "AbortError":
|
|
934
957
|
return new F(
|
|
935
|
-
|
|
958
|
+
L.CAMERA_ERROR,
|
|
936
959
|
z.ABORT_ERROR
|
|
937
960
|
);
|
|
938
961
|
case "NotAllowedError":
|
|
939
962
|
return new F(
|
|
940
|
-
|
|
963
|
+
L.DENIED,
|
|
941
964
|
z.NOT_ALLOWED_ERROR
|
|
942
965
|
);
|
|
943
966
|
case "NotFoundError":
|
|
944
967
|
return new F(
|
|
945
|
-
|
|
968
|
+
L.NO_CAMERA,
|
|
946
969
|
z.NOT_FOUND_ERROR
|
|
947
970
|
);
|
|
948
971
|
case "NotReadableError":
|
|
949
972
|
return new F(
|
|
950
|
-
|
|
973
|
+
L.CAMERA_ERROR,
|
|
951
974
|
z.NOT_READABLE_ERROR
|
|
952
975
|
);
|
|
953
976
|
case "OverconstrainedError":
|
|
954
977
|
return new F(
|
|
955
|
-
|
|
978
|
+
L.NO_CAMERA,
|
|
956
979
|
z.OVERCONSTRAINED_ERROR
|
|
957
980
|
);
|
|
958
981
|
case "SecurityError":
|
|
959
982
|
return new F(
|
|
960
|
-
|
|
983
|
+
L.DENIED,
|
|
961
984
|
z.SECURITY_ERROR
|
|
962
985
|
);
|
|
963
986
|
default:
|
|
964
987
|
return new F(
|
|
965
|
-
|
|
988
|
+
L.CAMERA_ERROR,
|
|
966
989
|
z.UNKNOWN_ERROR
|
|
967
990
|
);
|
|
968
991
|
}
|
|
969
992
|
}
|
|
970
993
|
}
|
|
971
|
-
const
|
|
994
|
+
const L = {
|
|
972
995
|
GRANTED: "granted",
|
|
973
996
|
NO_CAMERA: "no-camera",
|
|
974
997
|
CAMERA_ERROR: "camera-error",
|
|
@@ -988,32 +1011,32 @@ class F {
|
|
|
988
1011
|
detailedCameraAccessResult;
|
|
989
1012
|
isGranted;
|
|
990
1013
|
constructor(e, t) {
|
|
991
|
-
this.cameraAccessResult = e, this.isGranted = e ===
|
|
1014
|
+
this.cameraAccessResult = e, this.isGranted = e === L.GRANTED, this.detailedCameraAccessResult = t;
|
|
992
1015
|
}
|
|
993
1016
|
}
|
|
994
|
-
function
|
|
1017
|
+
function Be() {
|
|
995
1018
|
return crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
996
1019
|
}
|
|
997
1020
|
function X() {
|
|
998
|
-
const
|
|
999
|
-
let e = sessionStorage.getItem(
|
|
1000
|
-
return e || (e =
|
|
1021
|
+
const o = "verify-correlation-id";
|
|
1022
|
+
let e = sessionStorage.getItem(o);
|
|
1023
|
+
return e || (e = Be(), e = e.replaceAll("-", ""), sessionStorage.setItem(o, e)), e;
|
|
1001
1024
|
}
|
|
1002
|
-
function
|
|
1003
|
-
sessionStorage.setItem("verify-event-info-account-hash",
|
|
1025
|
+
function Jt(o) {
|
|
1026
|
+
sessionStorage.setItem("verify-event-info-account-hash", o.accountHash), sessionStorage.setItem("verify-event-info-verification-session-id", o.verificationSessionId);
|
|
1004
1027
|
}
|
|
1005
1028
|
function j() {
|
|
1006
|
-
const
|
|
1029
|
+
const o = sessionStorage.getItem("verify-event-info-account-hash") || "", e = sessionStorage.getItem("verify-event-info-verification-session-id") || "";
|
|
1007
1030
|
return {
|
|
1008
|
-
accountHash:
|
|
1031
|
+
accountHash: o,
|
|
1009
1032
|
verificationSessionId: e
|
|
1010
1033
|
};
|
|
1011
1034
|
}
|
|
1012
|
-
function
|
|
1013
|
-
const e =
|
|
1014
|
-
return `${e}-${t}-${
|
|
1035
|
+
function Yt(o) {
|
|
1036
|
+
const e = o.getFullYear(), t = (o.getMonth() + 1).toString().padStart(2, "0"), r = o.getDate().toString().padStart(2, "0"), i = o.getHours().toString().padStart(2, "0"), d = o.getMinutes().toString().padStart(2, "0"), h = o.getSeconds().toString().padStart(2, "0"), c = o.getMilliseconds().toString().padStart(3, "0"), n = -o.getTimezoneOffset(), a = n >= 0 ? "+" : "-", l = Math.abs(n), u = Math.floor(l / 60).toString().padStart(2, "0"), p = (l % 60).toString().padStart(2, "0");
|
|
1037
|
+
return `${e}-${t}-${r}T${i}:${d}:${h}.${c}${a}${u}:${p}`;
|
|
1015
1038
|
}
|
|
1016
|
-
class
|
|
1039
|
+
class Zt {
|
|
1017
1040
|
kinesisClient = null;
|
|
1018
1041
|
kinesisConfig = null;
|
|
1019
1042
|
sequenceNumber = 1;
|
|
@@ -1029,8 +1052,8 @@ class Kt {
|
|
|
1029
1052
|
return;
|
|
1030
1053
|
}
|
|
1031
1054
|
this.kinesisConfig = e;
|
|
1032
|
-
const t = Date.now(),
|
|
1033
|
-
this.serverTimeOffset =
|
|
1055
|
+
const t = Date.now(), r = new Date(e.serverTime).getTime();
|
|
1056
|
+
this.serverTimeOffset = r - t, this.logMessage("log", `Server time offset: ${this.serverTimeOffset}ms`), this.kinesisClient = new kt({
|
|
1034
1057
|
region: e.region,
|
|
1035
1058
|
credentials: {
|
|
1036
1059
|
accessKeyId: e.accessKeyId,
|
|
@@ -1041,44 +1064,44 @@ class Kt {
|
|
|
1041
1064
|
maxAttempts: 3
|
|
1042
1065
|
}), this.logMessage("log", `Kinesis client initialized for stream: ${e.streamName}`);
|
|
1043
1066
|
}
|
|
1044
|
-
async sendEvent(e, t,
|
|
1045
|
-
const
|
|
1067
|
+
async sendEvent(e, t, r, i) {
|
|
1068
|
+
const d = i ?? Date.now(), h = new Date(d + this.serverTimeOffset), c = h.toISOString(), n = Yt(h), a = {
|
|
1046
1069
|
type: e,
|
|
1047
|
-
absolute_utc_time:
|
|
1048
|
-
absolute_local_time:
|
|
1070
|
+
absolute_utc_time: c,
|
|
1071
|
+
absolute_local_time: n,
|
|
1049
1072
|
sequence_number: this.sequenceNumber++,
|
|
1050
|
-
args:
|
|
1073
|
+
args: r
|
|
1051
1074
|
};
|
|
1052
|
-
if (this.eventQueue.push(
|
|
1075
|
+
if (this.eventQueue.push(a), !t)
|
|
1053
1076
|
return !0;
|
|
1054
1077
|
if (!this.kinesisClient || !this.kinesisConfig)
|
|
1055
1078
|
return this.logMessage("warn", `Kinesis not configured - event '${e}' queued but not sent`), !1;
|
|
1056
|
-
const
|
|
1079
|
+
const l = j();
|
|
1057
1080
|
let u = !0;
|
|
1058
1081
|
for (; this.eventQueue.length > 0; ) {
|
|
1059
|
-
const
|
|
1060
|
-
|
|
1082
|
+
const p = this.eventQueue.shift();
|
|
1083
|
+
p.source_id = t, p.account_hash = l.accountHash, p.region = this.kinesisConfig.logicalRegion, p.host = this.kinesisConfig.domain, p.pid = X();
|
|
1061
1084
|
try {
|
|
1062
|
-
const
|
|
1085
|
+
const f = new Mt({
|
|
1063
1086
|
StreamName: this.kinesisConfig.streamName,
|
|
1064
|
-
PartitionKey:
|
|
1065
|
-
Data: new TextEncoder().encode(JSON.stringify(
|
|
1066
|
-
}), v = await this.kinesisClient.send(
|
|
1067
|
-
this.logMessage("log", `Event '${
|
|
1087
|
+
PartitionKey: p.source_id,
|
|
1088
|
+
Data: new TextEncoder().encode(JSON.stringify(p))
|
|
1089
|
+
}), v = await this.kinesisClient.send(f);
|
|
1090
|
+
this.logMessage("log", `Event '${p.type}' sent to Kinesis:`, {
|
|
1068
1091
|
sequenceNumber: v.SequenceNumber,
|
|
1069
1092
|
shardId: v.ShardId
|
|
1070
1093
|
});
|
|
1071
|
-
} catch (
|
|
1072
|
-
this.logMessage("warn", `Failed to send event '${
|
|
1094
|
+
} catch (f) {
|
|
1095
|
+
this.logMessage("warn", `Failed to send event '${p.type}' to Kinesis:`, f), u = !1;
|
|
1073
1096
|
}
|
|
1074
1097
|
}
|
|
1075
1098
|
return u;
|
|
1076
1099
|
}
|
|
1077
|
-
logMessage(e, t,
|
|
1078
|
-
this.environment !== "production" && console[e](`[KinesisService] ${t}`,
|
|
1100
|
+
logMessage(e, t, r) {
|
|
1101
|
+
this.environment !== "production" && console[e](`[KinesisService] ${t}`, r || "");
|
|
1079
1102
|
}
|
|
1080
1103
|
}
|
|
1081
|
-
class
|
|
1104
|
+
class Qt {
|
|
1082
1105
|
timers = /* @__PURE__ */ new Map();
|
|
1083
1106
|
stats = [];
|
|
1084
1107
|
kinesisService;
|
|
@@ -1094,17 +1117,17 @@ class Jt {
|
|
|
1094
1117
|
Object.keys(e).length > 0 && this.kinesisService.sendEvent("StatsCollected", this.sessionIdRef.current, e);
|
|
1095
1118
|
}
|
|
1096
1119
|
stopTimer(e, t = !0) {
|
|
1097
|
-
const
|
|
1098
|
-
if (
|
|
1120
|
+
const r = this.timers.get(e);
|
|
1121
|
+
if (r === void 0)
|
|
1099
1122
|
return this.stats.push({ type: e, duration: 0 }), t && this.sendStatsCheckpoint(), 0;
|
|
1100
|
-
const
|
|
1101
|
-
return this.stats.push({ type: e, duration:
|
|
1123
|
+
const i = Math.round(performance.now() - r);
|
|
1124
|
+
return this.stats.push({ type: e, duration: i }), this.timers.delete(e), t && this.sendStatsCheckpoint(), i;
|
|
1102
1125
|
}
|
|
1103
|
-
addStat(e, t,
|
|
1104
|
-
this.stats.push({ type: e, duration: Math.round(t) }),
|
|
1126
|
+
addStat(e, t, r = !0) {
|
|
1127
|
+
this.stats.push({ type: e, duration: Math.round(t) }), r && this.sendStatsCheckpoint();
|
|
1105
1128
|
}
|
|
1106
|
-
addStatIfMissing(e, t,
|
|
1107
|
-
this.stats.some((
|
|
1129
|
+
addStatIfMissing(e, t, r = !0) {
|
|
1130
|
+
this.stats.some((i) => i.type === e) || this.addStat(e, t, r);
|
|
1108
1131
|
}
|
|
1109
1132
|
async forceSendStats() {
|
|
1110
1133
|
const e = this.getAllStatsAsObject();
|
|
@@ -1123,7 +1146,7 @@ class Jt {
|
|
|
1123
1146
|
this.timers.clear(), this.stats.length = 0;
|
|
1124
1147
|
}
|
|
1125
1148
|
}
|
|
1126
|
-
class
|
|
1149
|
+
class Xt {
|
|
1127
1150
|
cameraSdk;
|
|
1128
1151
|
kinesisService;
|
|
1129
1152
|
statsService = null;
|
|
@@ -1139,7 +1162,7 @@ class Yt {
|
|
|
1139
1162
|
abortSignal = void 0;
|
|
1140
1163
|
accessToken = void 0;
|
|
1141
1164
|
constructor(e, t) {
|
|
1142
|
-
this.cameraSdk = new
|
|
1165
|
+
this.cameraSdk = new Kt(), this.apiBaseUrl = t.getApiBaseUrl(), this.kinesisService = e;
|
|
1143
1166
|
}
|
|
1144
1167
|
setAbortSignal(e) {
|
|
1145
1168
|
this.abortSignal = e;
|
|
@@ -1158,16 +1181,16 @@ class Yt {
|
|
|
1158
1181
|
async ensureMediaPipeInitialized() {
|
|
1159
1182
|
this.mediaPipeInitPromise || this.preloadMediaPipe(), await this.mediaPipeInitPromise;
|
|
1160
1183
|
}
|
|
1161
|
-
async initCoreSession(e, t,
|
|
1184
|
+
async initCoreSession(e, t, r = !1) {
|
|
1162
1185
|
sessionStorage.clear();
|
|
1163
|
-
const
|
|
1164
|
-
return
|
|
1186
|
+
const i = performance.now(), d = await this.callInitCoreSession(e, t, r);
|
|
1187
|
+
return d.sessionToken = t, this.applyInitSessionResponse(d, i);
|
|
1165
1188
|
}
|
|
1166
1189
|
// Called by RedirectStrategy after it fetches /init-redirect-session itself,
|
|
1167
1190
|
// to apply the side effects that belong to the core service (liveness type,
|
|
1168
1191
|
// camera init, kinesis bootstrap).
|
|
1169
1192
|
async applyInitSessionResponse(e, t) {
|
|
1170
|
-
return e.sessionToken && (this.accessToken = e.sessionToken), this.livenessCheckType = e.livenessCheckType?.toLowerCase(), console.log(`Liveness check type: ${this.livenessCheckType}`), (this.livenessCheckType === "disabled" || this.livenessCheckType === "basic") && await this.cameraSdk.init(),
|
|
1193
|
+
return e.sessionToken && (this.accessToken = e.sessionToken), this.livenessCheckType = e.livenessCheckType?.toLowerCase(), console.log(`Liveness check type: ${this.livenessCheckType}`), (this.livenessCheckType === "disabled" || this.livenessCheckType === "basic") && await this.cameraSdk.init(), Jt({ accountHash: e.accountHash ?? "", verificationSessionId: e.verificationSessionId }), this.kinesisService.initialize(e.kinesisConfig), this.kinesisService.sendEvent("SessionInitialized", e.verificationSessionId, {
|
|
1171
1194
|
duration: performance.now() - t
|
|
1172
1195
|
}), e;
|
|
1173
1196
|
}
|
|
@@ -1186,78 +1209,81 @@ class Yt {
|
|
|
1186
1209
|
async stopCamera() {
|
|
1187
1210
|
this.cameraSdk.stopVideo();
|
|
1188
1211
|
}
|
|
1212
|
+
setExternalStream(e) {
|
|
1213
|
+
this.cameraSdk.setExternalStream(e);
|
|
1214
|
+
}
|
|
1189
1215
|
async detectFace(e, t = void 0) {
|
|
1190
|
-
let
|
|
1191
|
-
const
|
|
1216
|
+
let r = 2;
|
|
1217
|
+
const i = await this.cameraSdk.startVideo(
|
|
1192
1218
|
t
|
|
1193
1219
|
);
|
|
1194
|
-
let
|
|
1195
|
-
if (
|
|
1220
|
+
let d = new _(!1);
|
|
1221
|
+
if (i.isGranted) {
|
|
1196
1222
|
if (await this.ensureMediaPipeInitialized(), !this.faceDetectionServiceModule)
|
|
1197
1223
|
throw new Error("MediaPipe not initialized");
|
|
1198
|
-
const
|
|
1199
|
-
return
|
|
1224
|
+
const h = this.cameraSdk.getVideoElement();
|
|
1225
|
+
return h ? (await this.retryInCaseOfError(
|
|
1200
1226
|
async () => {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1227
|
+
const c = await this.faceDetectionServiceModule.faceDetectionService.findBestFaceFrame(
|
|
1228
|
+
h,
|
|
1203
1229
|
2e3,
|
|
1204
1230
|
0.9
|
|
1205
1231
|
);
|
|
1206
|
-
if (!
|
|
1207
|
-
return
|
|
1232
|
+
if (!c.hasFace || !c.base64Image)
|
|
1233
|
+
return d.base64Image = c.base64Image, new _(!1);
|
|
1208
1234
|
if (this.livenessCheckType === "basic") {
|
|
1209
1235
|
if (!this.videoRecorderServiceModule)
|
|
1210
1236
|
throw new Error("Video recorder not initialized");
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1237
|
+
const n = await this.videoRecorderServiceModule.videoRecorderService.recordVideo(
|
|
1238
|
+
h,
|
|
1213
1239
|
500
|
|
1214
1240
|
);
|
|
1215
|
-
if (!
|
|
1216
|
-
return
|
|
1217
|
-
this.statsService?.startTimer("callCaptureVideoDuration"),
|
|
1218
|
-
new
|
|
1241
|
+
if (!n.hasFaceDetected)
|
|
1242
|
+
return d.base64Image = c.base64Image, new _(!1);
|
|
1243
|
+
this.statsService?.startTimer("callCaptureVideoDuration"), d = await this.callCaptureVideo(
|
|
1244
|
+
new tr(
|
|
1219
1245
|
e,
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1246
|
+
n.videoBlob,
|
|
1247
|
+
n.cryptoChain,
|
|
1248
|
+
n.mimeType
|
|
1223
1249
|
)
|
|
1224
1250
|
), this.statsService?.stopTimer("callCaptureVideoDuration");
|
|
1225
1251
|
} else
|
|
1226
|
-
this.statsService?.startTimer("callCaptureImageDuration"),
|
|
1227
|
-
new
|
|
1252
|
+
this.statsService?.startTimer("callCaptureImageDuration"), d = await this.callCaptureImage(
|
|
1253
|
+
new er(e, c.base64Image)
|
|
1228
1254
|
), this.statsService?.stopTimer("callCaptureImageDuration");
|
|
1229
|
-
return
|
|
1255
|
+
return d.faceDetected || (d.base64Image = c.base64Image), d;
|
|
1230
1256
|
},
|
|
1231
|
-
async (
|
|
1257
|
+
async (c) => c && c.faceDetected ? { shouldRetry: !1 } : (r--, { shouldRetry: r >= 0 }),
|
|
1232
1258
|
() => Promise.resolve({ shouldRetry: !0 })
|
|
1233
1259
|
).finally(() => {
|
|
1234
1260
|
this.cameraSdk.stopVideo();
|
|
1235
|
-
}),
|
|
1261
|
+
}), d) : (this.cameraSdk.stopVideo(), new _(!1));
|
|
1236
1262
|
}
|
|
1237
1263
|
return new _(!1);
|
|
1238
1264
|
}
|
|
1239
|
-
async retryInCaseOfError(e, t,
|
|
1240
|
-
let
|
|
1265
|
+
async retryInCaseOfError(e, t, r) {
|
|
1266
|
+
let i = 2;
|
|
1241
1267
|
do
|
|
1242
1268
|
try {
|
|
1243
|
-
const
|
|
1244
|
-
if ((await t(
|
|
1245
|
-
|
|
1269
|
+
const d = await e();
|
|
1270
|
+
if ((await t(d)).shouldRetry)
|
|
1271
|
+
i = 2;
|
|
1246
1272
|
else break;
|
|
1247
|
-
} catch (
|
|
1248
|
-
if (!(await
|
|
1273
|
+
} catch (d) {
|
|
1274
|
+
if (!(await r(d)).shouldRetry)
|
|
1249
1275
|
break;
|
|
1250
|
-
if (
|
|
1251
|
-
throw
|
|
1276
|
+
if (i--, i <= 0)
|
|
1277
|
+
throw d;
|
|
1252
1278
|
}
|
|
1253
1279
|
while (!0);
|
|
1254
1280
|
}
|
|
1255
1281
|
resolveTechUserId() {
|
|
1256
1282
|
let t = new URL(window.location.href).searchParams.get("reTechUserId");
|
|
1257
|
-
return t != null ? localStorage.setItem("verify-tech-user-id", t) : (t = localStorage.getItem("verify-tech-user-id"), t == null && (t =
|
|
1283
|
+
return t != null ? localStorage.setItem("verify-tech-user-id", t) : (t = localStorage.getItem("verify-tech-user-id"), t == null && (t = Be(), localStorage.setItem("verify-tech-user-id", t))), t;
|
|
1258
1284
|
}
|
|
1259
|
-
async callInitCoreSession(e, t,
|
|
1260
|
-
const
|
|
1285
|
+
async callInitCoreSession(e, t, r) {
|
|
1286
|
+
const i = await fetch(
|
|
1261
1287
|
`${this.apiBaseUrl}/api/v1/verification/init-session`,
|
|
1262
1288
|
{
|
|
1263
1289
|
method: "POST",
|
|
@@ -1267,23 +1293,23 @@ class Yt {
|
|
|
1267
1293
|
"x-verify-tech-user-id": this.resolveTechUserId(),
|
|
1268
1294
|
Authorization: `Bearer ${t}`
|
|
1269
1295
|
},
|
|
1270
|
-
body: JSON.stringify({ verificationSessionId: e, localTime: (/* @__PURE__ */ new Date()).toISOString(), isHeadless:
|
|
1296
|
+
body: JSON.stringify({ verificationSessionId: e, localTime: (/* @__PURE__ */ new Date()).toISOString(), isHeadless: r }),
|
|
1271
1297
|
signal: this.abortSignal
|
|
1272
1298
|
}
|
|
1273
1299
|
);
|
|
1274
|
-
return this.parseInitResponse(
|
|
1300
|
+
return this.parseInitResponse(i);
|
|
1275
1301
|
}
|
|
1276
1302
|
async parseInitResponse(e) {
|
|
1277
1303
|
if (!e.ok) {
|
|
1278
1304
|
if (e.status === 429) throw new H();
|
|
1279
|
-
const
|
|
1280
|
-
throw e.status >= 400 && e.status < 500 ? new
|
|
1305
|
+
const r = (await e.text()).trim() || "An error occurred during initializing the session!";
|
|
1306
|
+
throw e.status >= 400 && e.status < 500 ? new ye(r, e.status) : new Error(r);
|
|
1281
1307
|
}
|
|
1282
1308
|
return e.json();
|
|
1283
1309
|
}
|
|
1284
|
-
async callVerify(e, t,
|
|
1285
|
-
let
|
|
1286
|
-
const
|
|
1310
|
+
async callVerify(e, t, r) {
|
|
1311
|
+
let i = `${this.apiBaseUrl}/api/v1/verification/verify`;
|
|
1312
|
+
const d = await fetch(i, {
|
|
1287
1313
|
method: "POST",
|
|
1288
1314
|
headers: {
|
|
1289
1315
|
"Content-Type": "application/json",
|
|
@@ -1293,10 +1319,10 @@ class Yt {
|
|
|
1293
1319
|
"x-verify-event-source-id": j().verificationSessionId
|
|
1294
1320
|
},
|
|
1295
1321
|
body: JSON.stringify({ verificationSessionId: e, failedReason: t }),
|
|
1296
|
-
signal:
|
|
1322
|
+
signal: r ?? this.abortSignal
|
|
1297
1323
|
});
|
|
1298
|
-
if (!
|
|
1299
|
-
throw
|
|
1324
|
+
if (!d.ok)
|
|
1325
|
+
throw d.status === 429 ? new H() : new Error(await d.text() || "Verification failed");
|
|
1300
1326
|
}
|
|
1301
1327
|
async callCaptureImage(e) {
|
|
1302
1328
|
const t = await fetch(
|
|
@@ -1319,7 +1345,7 @@ class Yt {
|
|
|
1319
1345
|
return new _(!0);
|
|
1320
1346
|
}
|
|
1321
1347
|
async callCaptureVideo(e) {
|
|
1322
|
-
const t = await this.blobToBase64(e.videoBlob),
|
|
1348
|
+
const t = await this.blobToBase64(e.videoBlob), r = await fetch(
|
|
1323
1349
|
`${this.apiBaseUrl}/api/v1/verification/capture-video`,
|
|
1324
1350
|
{
|
|
1325
1351
|
method: "POST",
|
|
@@ -1339,48 +1365,48 @@ class Yt {
|
|
|
1339
1365
|
signal: this.abortSignal
|
|
1340
1366
|
}
|
|
1341
1367
|
);
|
|
1342
|
-
if (!
|
|
1343
|
-
throw
|
|
1368
|
+
if (!r.ok)
|
|
1369
|
+
throw r.status === 429 ? new H() : r.status === 400 ? new Error(await r.text()) : new Error("An error occurred during capturing video!");
|
|
1344
1370
|
return new _(!0);
|
|
1345
1371
|
}
|
|
1346
1372
|
async blobToBase64(e) {
|
|
1347
1373
|
if (!e || e.size === 0)
|
|
1348
1374
|
throw new Error("Empty or invalid video blob");
|
|
1349
|
-
return new Promise((t,
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
const
|
|
1353
|
-
if (!
|
|
1354
|
-
|
|
1375
|
+
return new Promise((t, r) => {
|
|
1376
|
+
const i = new FileReader();
|
|
1377
|
+
i.onloadend = () => {
|
|
1378
|
+
const d = i.result;
|
|
1379
|
+
if (!d || typeof d != "string") {
|
|
1380
|
+
r(new Error("Failed to read blob as data URL"));
|
|
1355
1381
|
return;
|
|
1356
1382
|
}
|
|
1357
|
-
const
|
|
1358
|
-
if (
|
|
1359
|
-
|
|
1383
|
+
const h = d.split(",");
|
|
1384
|
+
if (h.length !== 2 || !h[1]) {
|
|
1385
|
+
r(new Error("Invalid data URL format"));
|
|
1360
1386
|
return;
|
|
1361
1387
|
}
|
|
1362
|
-
const
|
|
1363
|
-
console.log(`Video blob converted to base64: ${(
|
|
1364
|
-
},
|
|
1365
|
-
|
|
1366
|
-
},
|
|
1388
|
+
const c = h[1];
|
|
1389
|
+
console.log(`Video blob converted to base64: ${(c.length * 0.75 / 1024).toFixed(2)} KB`), t(c);
|
|
1390
|
+
}, i.onerror = () => {
|
|
1391
|
+
r(new Error(`FileReader error: ${i.error?.message || "Unknown error"}`));
|
|
1392
|
+
}, i.readAsDataURL(e);
|
|
1367
1393
|
});
|
|
1368
1394
|
}
|
|
1369
1395
|
}
|
|
1370
|
-
class
|
|
1396
|
+
class er {
|
|
1371
1397
|
verificationSessionId;
|
|
1372
1398
|
base64Image;
|
|
1373
1399
|
constructor(e, t) {
|
|
1374
1400
|
this.verificationSessionId = e, this.base64Image = t;
|
|
1375
1401
|
}
|
|
1376
1402
|
}
|
|
1377
|
-
class
|
|
1403
|
+
class tr {
|
|
1378
1404
|
verificationSessionId;
|
|
1379
1405
|
videoBlob;
|
|
1380
1406
|
cryptoChain;
|
|
1381
1407
|
mimeType;
|
|
1382
|
-
constructor(e, t,
|
|
1383
|
-
this.verificationSessionId = e, this.videoBlob = t, this.cryptoChain =
|
|
1408
|
+
constructor(e, t, r, i) {
|
|
1409
|
+
this.verificationSessionId = e, this.videoBlob = t, this.cryptoChain = r, this.mimeType = i;
|
|
1384
1410
|
}
|
|
1385
1411
|
}
|
|
1386
1412
|
class _ {
|
|
@@ -1390,33 +1416,33 @@ class _ {
|
|
|
1390
1416
|
this.faceDetected = e, this.base64Image = t;
|
|
1391
1417
|
}
|
|
1392
1418
|
}
|
|
1393
|
-
const
|
|
1394
|
-
isOpen:
|
|
1419
|
+
const rr = ({
|
|
1420
|
+
isOpen: o,
|
|
1395
1421
|
uniqueId: e,
|
|
1396
1422
|
onPermissionGranted: t,
|
|
1397
|
-
onPermissionDenied:
|
|
1398
|
-
verificationService:
|
|
1423
|
+
onPermissionDenied: r,
|
|
1424
|
+
verificationService: i
|
|
1399
1425
|
}) => {
|
|
1400
|
-
if (!
|
|
1401
|
-
const
|
|
1402
|
-
return
|
|
1403
|
-
if (
|
|
1426
|
+
if (!o) return;
|
|
1427
|
+
const d = W(), h = Q(d).typography;
|
|
1428
|
+
return i.checkCameraAccess().then((c) => {
|
|
1429
|
+
if (c === "granted") {
|
|
1404
1430
|
t();
|
|
1405
1431
|
return;
|
|
1406
|
-
} else if (
|
|
1407
|
-
|
|
1432
|
+
} else if (c === "denied") {
|
|
1433
|
+
r();
|
|
1408
1434
|
return;
|
|
1409
1435
|
} else
|
|
1410
|
-
|
|
1411
|
-
if (
|
|
1412
|
-
|
|
1436
|
+
i.startCamera().then((n) => {
|
|
1437
|
+
if (n.isGranted) {
|
|
1438
|
+
i.stopCamera(), t();
|
|
1413
1439
|
return;
|
|
1414
1440
|
}
|
|
1415
|
-
|
|
1441
|
+
r();
|
|
1416
1442
|
}).catch(() => {
|
|
1417
|
-
|
|
1443
|
+
r();
|
|
1418
1444
|
});
|
|
1419
|
-
}), /* @__PURE__ */
|
|
1445
|
+
}), /* @__PURE__ */ s(q, { open: o, children: /* @__PURE__ */ s(
|
|
1420
1446
|
$,
|
|
1421
1447
|
{
|
|
1422
1448
|
sx: {
|
|
@@ -1426,7 +1452,7 @@ const Xt = ({
|
|
|
1426
1452
|
alignItems: "center !important"
|
|
1427
1453
|
},
|
|
1428
1454
|
children: /* @__PURE__ */ S(
|
|
1429
|
-
|
|
1455
|
+
U,
|
|
1430
1456
|
{
|
|
1431
1457
|
direction: "column",
|
|
1432
1458
|
spacing: 2,
|
|
@@ -1436,13 +1462,13 @@ const Xt = ({
|
|
|
1436
1462
|
alignItems: "center"
|
|
1437
1463
|
},
|
|
1438
1464
|
children: [
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
|
|
1465
|
+
/* @__PURE__ */ s(
|
|
1466
|
+
R,
|
|
1441
1467
|
{
|
|
1442
1468
|
variant: "h2",
|
|
1443
1469
|
component: "div",
|
|
1444
1470
|
sx: {
|
|
1445
|
-
fontSize:
|
|
1471
|
+
fontSize: h.h2.fontSize,
|
|
1446
1472
|
fontWeight: "bold",
|
|
1447
1473
|
color: "#263235"
|
|
1448
1474
|
},
|
|
@@ -1450,22 +1476,22 @@ const Xt = ({
|
|
|
1450
1476
|
}
|
|
1451
1477
|
),
|
|
1452
1478
|
/* @__PURE__ */ S(
|
|
1453
|
-
|
|
1479
|
+
R,
|
|
1454
1480
|
{
|
|
1455
1481
|
variant: "body2",
|
|
1456
1482
|
component: "div",
|
|
1457
1483
|
sx: {
|
|
1458
|
-
fontSize:
|
|
1484
|
+
fontSize: h.body2.fontSize,
|
|
1459
1485
|
color: "#263235"
|
|
1460
1486
|
},
|
|
1461
1487
|
children: [
|
|
1462
1488
|
"Realeyes needs brief camera access ",
|
|
1463
|
-
/* @__PURE__ */
|
|
1489
|
+
/* @__PURE__ */ s("br", {}),
|
|
1464
1490
|
"Please, click “Allow”"
|
|
1465
1491
|
]
|
|
1466
1492
|
}
|
|
1467
1493
|
),
|
|
1468
|
-
/* @__PURE__ */
|
|
1494
|
+
/* @__PURE__ */ s("div", { className: "face-icon-container", children: /* @__PURE__ */ s(
|
|
1469
1495
|
"img",
|
|
1470
1496
|
{
|
|
1471
1497
|
src: se,
|
|
@@ -1474,7 +1500,7 @@ const Xt = ({
|
|
|
1474
1500
|
}
|
|
1475
1501
|
) }),
|
|
1476
1502
|
/* @__PURE__ */ S(
|
|
1477
|
-
|
|
1503
|
+
U,
|
|
1478
1504
|
{
|
|
1479
1505
|
direction: "column",
|
|
1480
1506
|
sx: {
|
|
@@ -1483,28 +1509,28 @@ const Xt = ({
|
|
|
1483
1509
|
alignItems: "center"
|
|
1484
1510
|
},
|
|
1485
1511
|
children: [
|
|
1486
|
-
/* @__PURE__ */
|
|
1487
|
-
|
|
1512
|
+
/* @__PURE__ */ s(
|
|
1513
|
+
R,
|
|
1488
1514
|
{
|
|
1489
1515
|
variant: "body2",
|
|
1490
1516
|
component: "div",
|
|
1491
1517
|
sx: {
|
|
1492
1518
|
flexGrow: 1,
|
|
1493
|
-
fontSize:
|
|
1519
|
+
fontSize: h.body2.fontSize,
|
|
1494
1520
|
fontWeight: "bold",
|
|
1495
1521
|
color: "#263235"
|
|
1496
1522
|
},
|
|
1497
1523
|
children: "No one will ever see you"
|
|
1498
1524
|
}
|
|
1499
1525
|
),
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
|
|
1526
|
+
/* @__PURE__ */ s(
|
|
1527
|
+
R,
|
|
1502
1528
|
{
|
|
1503
1529
|
variant: "body2",
|
|
1504
1530
|
component: "div",
|
|
1505
1531
|
sx: {
|
|
1506
1532
|
flexGrow: 1,
|
|
1507
|
-
fontSize:
|
|
1533
|
+
fontSize: h.body2.fontSize,
|
|
1508
1534
|
fontWeight: "bold",
|
|
1509
1535
|
color: "#263235"
|
|
1510
1536
|
},
|
|
@@ -1514,15 +1540,15 @@ const Xt = ({
|
|
|
1514
1540
|
]
|
|
1515
1541
|
}
|
|
1516
1542
|
),
|
|
1517
|
-
/* @__PURE__ */
|
|
1543
|
+
/* @__PURE__ */ s(ee, { uniqueId: e })
|
|
1518
1544
|
]
|
|
1519
1545
|
}
|
|
1520
1546
|
)
|
|
1521
1547
|
}
|
|
1522
1548
|
) });
|
|
1523
|
-
},
|
|
1524
|
-
if (
|
|
1525
|
-
return e || (e = "Loading..."), /* @__PURE__ */
|
|
1549
|
+
}, ve = ({ isOpen: o, text: e }) => {
|
|
1550
|
+
if (o)
|
|
1551
|
+
return e || (e = "Loading..."), /* @__PURE__ */ s(q, { open: o, children: /* @__PURE__ */ s(
|
|
1526
1552
|
$,
|
|
1527
1553
|
{
|
|
1528
1554
|
sx: {
|
|
@@ -1532,7 +1558,7 @@ const Xt = ({
|
|
|
1532
1558
|
alignItems: "center !important"
|
|
1533
1559
|
},
|
|
1534
1560
|
children: /* @__PURE__ */ S(
|
|
1535
|
-
|
|
1561
|
+
Se,
|
|
1536
1562
|
{
|
|
1537
1563
|
display: "flex",
|
|
1538
1564
|
flexDirection: "column",
|
|
@@ -1541,21 +1567,21 @@ const Xt = ({
|
|
|
1541
1567
|
minHeight: "100px",
|
|
1542
1568
|
minWidth: "300px",
|
|
1543
1569
|
children: [
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ s(Ee, { sx: { color: "#10b981" } }),
|
|
1571
|
+
/* @__PURE__ */ s(R, { variant: "body2", sx: { mt: 2 }, children: e })
|
|
1546
1572
|
]
|
|
1547
1573
|
}
|
|
1548
1574
|
)
|
|
1549
1575
|
}
|
|
1550
1576
|
) });
|
|
1551
|
-
},
|
|
1552
|
-
isOpen:
|
|
1577
|
+
}, ir = ({
|
|
1578
|
+
isOpen: o,
|
|
1553
1579
|
uniqueId: e,
|
|
1554
1580
|
onTryAgain: t
|
|
1555
1581
|
}) => {
|
|
1556
|
-
if (!
|
|
1557
|
-
const
|
|
1558
|
-
return /* @__PURE__ */
|
|
1582
|
+
if (!o) return;
|
|
1583
|
+
const r = W(), i = Q(r).typography;
|
|
1584
|
+
return /* @__PURE__ */ s(q, { open: o, children: /* @__PURE__ */ s(
|
|
1559
1585
|
$,
|
|
1560
1586
|
{
|
|
1561
1587
|
sx: {
|
|
@@ -1565,7 +1591,7 @@ const Xt = ({
|
|
|
1565
1591
|
alignItems: "center !important"
|
|
1566
1592
|
},
|
|
1567
1593
|
children: /* @__PURE__ */ S(
|
|
1568
|
-
|
|
1594
|
+
U,
|
|
1569
1595
|
{
|
|
1570
1596
|
direction: "column",
|
|
1571
1597
|
spacing: 2,
|
|
@@ -1575,14 +1601,14 @@ const Xt = ({
|
|
|
1575
1601
|
alignItems: "center"
|
|
1576
1602
|
},
|
|
1577
1603
|
children: [
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
|
|
1604
|
+
/* @__PURE__ */ s(
|
|
1605
|
+
R,
|
|
1580
1606
|
{
|
|
1581
1607
|
variant: "h2",
|
|
1582
1608
|
component: "div",
|
|
1583
1609
|
sx: {
|
|
1584
1610
|
flexGrow: 1,
|
|
1585
|
-
fontSize:
|
|
1611
|
+
fontSize: i.h2.fontSize,
|
|
1586
1612
|
fontWeight: "bold",
|
|
1587
1613
|
color: "#263235"
|
|
1588
1614
|
},
|
|
@@ -1590,22 +1616,22 @@ const Xt = ({
|
|
|
1590
1616
|
}
|
|
1591
1617
|
),
|
|
1592
1618
|
/* @__PURE__ */ S(
|
|
1593
|
-
|
|
1619
|
+
R,
|
|
1594
1620
|
{
|
|
1595
1621
|
variant: "body2",
|
|
1596
1622
|
component: "div",
|
|
1597
1623
|
sx: {
|
|
1598
|
-
fontSize:
|
|
1624
|
+
fontSize: i.body2.fontSize,
|
|
1599
1625
|
color: "#263235"
|
|
1600
1626
|
},
|
|
1601
1627
|
children: [
|
|
1602
1628
|
"Realeyes needs brief camera access ",
|
|
1603
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ s("br", {}),
|
|
1604
1630
|
'Please allow your camera and click on "Try Again".'
|
|
1605
1631
|
]
|
|
1606
1632
|
}
|
|
1607
1633
|
),
|
|
1608
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ s("div", { className: "face-icon-container", children: /* @__PURE__ */ s(
|
|
1609
1635
|
"img",
|
|
1610
1636
|
{
|
|
1611
1637
|
src: se,
|
|
@@ -1614,7 +1640,7 @@ const Xt = ({
|
|
|
1614
1640
|
}
|
|
1615
1641
|
) }),
|
|
1616
1642
|
/* @__PURE__ */ S(
|
|
1617
|
-
|
|
1643
|
+
U,
|
|
1618
1644
|
{
|
|
1619
1645
|
direction: "column",
|
|
1620
1646
|
sx: {
|
|
@@ -1623,28 +1649,28 @@ const Xt = ({
|
|
|
1623
1649
|
alignItems: "center"
|
|
1624
1650
|
},
|
|
1625
1651
|
children: [
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
|
|
1652
|
+
/* @__PURE__ */ s(
|
|
1653
|
+
R,
|
|
1628
1654
|
{
|
|
1629
1655
|
variant: "body2",
|
|
1630
1656
|
component: "div",
|
|
1631
1657
|
sx: {
|
|
1632
1658
|
flexGrow: 1,
|
|
1633
|
-
fontSize:
|
|
1659
|
+
fontSize: i.body2.fontSize,
|
|
1634
1660
|
fontWeight: "bold",
|
|
1635
1661
|
color: "#263235"
|
|
1636
1662
|
},
|
|
1637
1663
|
children: "No one will ever see you"
|
|
1638
1664
|
}
|
|
1639
1665
|
),
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
|
|
1666
|
+
/* @__PURE__ */ s(
|
|
1667
|
+
R,
|
|
1642
1668
|
{
|
|
1643
1669
|
variant: "body2",
|
|
1644
1670
|
component: "div",
|
|
1645
1671
|
sx: {
|
|
1646
1672
|
flexGrow: 1,
|
|
1647
|
-
fontSize:
|
|
1673
|
+
fontSize: i.body2.fontSize,
|
|
1648
1674
|
fontWeight: "bold",
|
|
1649
1675
|
color: "#263235"
|
|
1650
1676
|
},
|
|
@@ -1654,26 +1680,26 @@ const Xt = ({
|
|
|
1654
1680
|
]
|
|
1655
1681
|
}
|
|
1656
1682
|
),
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ s("button", { className: "realeyes-btn", onClick: t, children: "Try Again" }),
|
|
1684
|
+
/* @__PURE__ */ s(ee, { uniqueId: e })
|
|
1659
1685
|
]
|
|
1660
1686
|
}
|
|
1661
1687
|
)
|
|
1662
1688
|
}
|
|
1663
1689
|
) });
|
|
1664
|
-
},
|
|
1665
|
-
isOpen:
|
|
1690
|
+
}, nr = ({
|
|
1691
|
+
isOpen: o,
|
|
1666
1692
|
uniqueId: e,
|
|
1667
1693
|
onFaceDetected: t,
|
|
1668
|
-
onNoFaceDetected:
|
|
1669
|
-
detectFace:
|
|
1694
|
+
onNoFaceDetected: r,
|
|
1695
|
+
detectFace: i
|
|
1670
1696
|
}) => {
|
|
1671
|
-
const
|
|
1697
|
+
const d = W(), h = Q(d).typography;
|
|
1672
1698
|
return Z(() => {
|
|
1673
|
-
|
|
1674
|
-
|
|
1699
|
+
o && i().then((c) => {
|
|
1700
|
+
c.faceDetected ? t() : r(c.base64Image);
|
|
1675
1701
|
});
|
|
1676
|
-
}, [
|
|
1702
|
+
}, [o]), o ? /* @__PURE__ */ s(q, { open: o, children: /* @__PURE__ */ s(
|
|
1677
1703
|
$,
|
|
1678
1704
|
{
|
|
1679
1705
|
sx: {
|
|
@@ -1683,7 +1709,7 @@ const Xt = ({
|
|
|
1683
1709
|
alignItems: "center !important"
|
|
1684
1710
|
},
|
|
1685
1711
|
children: /* @__PURE__ */ S(
|
|
1686
|
-
|
|
1712
|
+
U,
|
|
1687
1713
|
{
|
|
1688
1714
|
direction: "column",
|
|
1689
1715
|
spacing: 2,
|
|
@@ -1693,21 +1719,21 @@ const Xt = ({
|
|
|
1693
1719
|
alignItems: "center"
|
|
1694
1720
|
},
|
|
1695
1721
|
children: [
|
|
1696
|
-
/* @__PURE__ */
|
|
1697
|
-
|
|
1722
|
+
/* @__PURE__ */ s(
|
|
1723
|
+
R,
|
|
1698
1724
|
{
|
|
1699
1725
|
variant: "h2",
|
|
1700
1726
|
component: "div",
|
|
1701
1727
|
sx: {
|
|
1702
1728
|
flexGrow: 1,
|
|
1703
|
-
fontSize:
|
|
1729
|
+
fontSize: h.h2.fontSize,
|
|
1704
1730
|
fontWeight: "bold",
|
|
1705
1731
|
color: "#263235"
|
|
1706
1732
|
},
|
|
1707
1733
|
children: "Verification in progress"
|
|
1708
1734
|
}
|
|
1709
1735
|
),
|
|
1710
|
-
/* @__PURE__ */
|
|
1736
|
+
/* @__PURE__ */ s("div", { className: "face-icon-container", children: /* @__PURE__ */ s(
|
|
1711
1737
|
"img",
|
|
1712
1738
|
{
|
|
1713
1739
|
src: se,
|
|
@@ -1715,22 +1741,22 @@ const Xt = ({
|
|
|
1715
1741
|
className: "face-icon"
|
|
1716
1742
|
}
|
|
1717
1743
|
) }),
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1744
|
+
/* @__PURE__ */ s(Ee, { size: "4rem", sx: { color: "#10b981" } }),
|
|
1745
|
+
/* @__PURE__ */ s(ee, { uniqueId: e })
|
|
1720
1746
|
]
|
|
1721
1747
|
}
|
|
1722
1748
|
)
|
|
1723
1749
|
}
|
|
1724
1750
|
) }) : null;
|
|
1725
|
-
},
|
|
1726
|
-
isOpen:
|
|
1751
|
+
}, sr = ({
|
|
1752
|
+
isOpen: o,
|
|
1727
1753
|
uniqueId: e,
|
|
1728
1754
|
onRetry: t,
|
|
1729
|
-
base64Image:
|
|
1755
|
+
base64Image: r
|
|
1730
1756
|
}) => {
|
|
1731
|
-
if (!
|
|
1732
|
-
const
|
|
1733
|
-
return /* @__PURE__ */
|
|
1757
|
+
if (!o) return;
|
|
1758
|
+
const i = W(), d = Q(i).typography;
|
|
1759
|
+
return /* @__PURE__ */ s(q, { open: o, children: /* @__PURE__ */ s(
|
|
1734
1760
|
$,
|
|
1735
1761
|
{
|
|
1736
1762
|
sx: {
|
|
@@ -1740,7 +1766,7 @@ const Xt = ({
|
|
|
1740
1766
|
alignItems: "center !important"
|
|
1741
1767
|
},
|
|
1742
1768
|
children: /* @__PURE__ */ S(
|
|
1743
|
-
|
|
1769
|
+
U,
|
|
1744
1770
|
{
|
|
1745
1771
|
direction: "column",
|
|
1746
1772
|
spacing: 2,
|
|
@@ -1750,22 +1776,22 @@ const Xt = ({
|
|
|
1750
1776
|
alignItems: "center"
|
|
1751
1777
|
},
|
|
1752
1778
|
children: [
|
|
1753
|
-
/* @__PURE__ */
|
|
1754
|
-
|
|
1779
|
+
/* @__PURE__ */ s(
|
|
1780
|
+
R,
|
|
1755
1781
|
{
|
|
1756
1782
|
variant: "h2",
|
|
1757
1783
|
component: "div",
|
|
1758
1784
|
sx: {
|
|
1759
1785
|
flexGrow: 1,
|
|
1760
|
-
fontSize:
|
|
1786
|
+
fontSize: d.h2.fontSize,
|
|
1761
1787
|
fontWeight: "bold",
|
|
1762
1788
|
color: "#263235"
|
|
1763
1789
|
},
|
|
1764
1790
|
children: "We cannot see your face"
|
|
1765
1791
|
}
|
|
1766
1792
|
),
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
|
|
1793
|
+
/* @__PURE__ */ s(
|
|
1794
|
+
U,
|
|
1769
1795
|
{
|
|
1770
1796
|
direction: "column",
|
|
1771
1797
|
spacing: 0,
|
|
@@ -1774,65 +1800,65 @@ const Xt = ({
|
|
|
1774
1800
|
justifyContent: "center",
|
|
1775
1801
|
alignItems: "center"
|
|
1776
1802
|
},
|
|
1777
|
-
children: /* @__PURE__ */
|
|
1803
|
+
children: /* @__PURE__ */ s(
|
|
1778
1804
|
"img",
|
|
1779
1805
|
{
|
|
1780
|
-
src:
|
|
1806
|
+
src: r,
|
|
1781
1807
|
alt: "No face detected",
|
|
1782
1808
|
style: { maxWidth: "300px" }
|
|
1783
1809
|
}
|
|
1784
1810
|
)
|
|
1785
1811
|
}
|
|
1786
1812
|
),
|
|
1787
|
-
/* @__PURE__ */
|
|
1788
|
-
|
|
1813
|
+
/* @__PURE__ */ s(
|
|
1814
|
+
R,
|
|
1789
1815
|
{
|
|
1790
1816
|
variant: "body2",
|
|
1791
1817
|
component: "div",
|
|
1792
1818
|
sx: {
|
|
1793
|
-
fontSize:
|
|
1819
|
+
fontSize: d.body2.fontSize,
|
|
1794
1820
|
textAlign: "left",
|
|
1795
1821
|
color: "#263235"
|
|
1796
1822
|
},
|
|
1797
1823
|
style: { marginTop: 10 },
|
|
1798
1824
|
children: /* @__PURE__ */ S("ul", { style: { paddingLeft: 0 }, children: [
|
|
1799
1825
|
/* @__PURE__ */ S("li", { children: [
|
|
1800
|
-
/* @__PURE__ */
|
|
1826
|
+
/* @__PURE__ */ s("b", { children: "Look" }),
|
|
1801
1827
|
" into the camera"
|
|
1802
1828
|
] }),
|
|
1803
1829
|
/* @__PURE__ */ S("li", { children: [
|
|
1804
1830
|
"Check your ",
|
|
1805
|
-
/* @__PURE__ */
|
|
1831
|
+
/* @__PURE__ */ s("b", { children: "ligthning" })
|
|
1806
1832
|
] }),
|
|
1807
1833
|
/* @__PURE__ */ S("li", { children: [
|
|
1808
1834
|
"Make sure only this page ",
|
|
1809
|
-
/* @__PURE__ */
|
|
1835
|
+
/* @__PURE__ */ s("b", { children: "uses your camera" })
|
|
1810
1836
|
] })
|
|
1811
1837
|
] })
|
|
1812
1838
|
}
|
|
1813
1839
|
),
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1840
|
+
/* @__PURE__ */ s("button", { className: "realeyes-btn", onClick: t, children: "Retry" }),
|
|
1841
|
+
/* @__PURE__ */ s(ee, { uniqueId: e })
|
|
1816
1842
|
]
|
|
1817
1843
|
}
|
|
1818
1844
|
)
|
|
1819
1845
|
}
|
|
1820
1846
|
) });
|
|
1821
|
-
},
|
|
1822
|
-
isOpen:
|
|
1847
|
+
}, or = ({
|
|
1848
|
+
isOpen: o,
|
|
1823
1849
|
onOk: e
|
|
1824
1850
|
}) => {
|
|
1825
|
-
const [t,
|
|
1851
|
+
const [t, r] = D(60), i = W(), d = Q(i).typography;
|
|
1826
1852
|
return Z(() => {
|
|
1827
|
-
if (!
|
|
1828
|
-
|
|
1853
|
+
if (!o) {
|
|
1854
|
+
r(60);
|
|
1829
1855
|
return;
|
|
1830
1856
|
}
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1857
|
+
const h = setInterval(() => {
|
|
1858
|
+
r((c) => c <= 1 ? (clearInterval(h), e(), 0) : c - 1);
|
|
1833
1859
|
}, 1e3);
|
|
1834
|
-
return () => clearInterval(
|
|
1835
|
-
}, [
|
|
1860
|
+
return () => clearInterval(h);
|
|
1861
|
+
}, [o, e]), o ? /* @__PURE__ */ s(q, { open: o, children: /* @__PURE__ */ s(
|
|
1836
1862
|
$,
|
|
1837
1863
|
{
|
|
1838
1864
|
sx: {
|
|
@@ -1842,7 +1868,7 @@ const Xt = ({
|
|
|
1842
1868
|
alignItems: "center !important"
|
|
1843
1869
|
},
|
|
1844
1870
|
children: /* @__PURE__ */ S(
|
|
1845
|
-
|
|
1871
|
+
U,
|
|
1846
1872
|
{
|
|
1847
1873
|
direction: "column",
|
|
1848
1874
|
spacing: 3,
|
|
@@ -1852,38 +1878,38 @@ const Xt = ({
|
|
|
1852
1878
|
alignItems: "center"
|
|
1853
1879
|
},
|
|
1854
1880
|
children: [
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
|
|
1881
|
+
/* @__PURE__ */ s(
|
|
1882
|
+
R,
|
|
1857
1883
|
{
|
|
1858
1884
|
variant: "h2",
|
|
1859
1885
|
component: "div",
|
|
1860
1886
|
sx: {
|
|
1861
|
-
fontSize:
|
|
1887
|
+
fontSize: d.h2.fontSize,
|
|
1862
1888
|
fontWeight: "700",
|
|
1863
1889
|
color: "#263235"
|
|
1864
1890
|
},
|
|
1865
1891
|
children: "Session timeout"
|
|
1866
1892
|
}
|
|
1867
1893
|
),
|
|
1868
|
-
/* @__PURE__ */
|
|
1869
|
-
|
|
1894
|
+
/* @__PURE__ */ s(
|
|
1895
|
+
R,
|
|
1870
1896
|
{
|
|
1871
1897
|
variant: "body2",
|
|
1872
1898
|
component: "div",
|
|
1873
1899
|
sx: {
|
|
1874
|
-
fontSize:
|
|
1900
|
+
fontSize: d.body2.fontSize,
|
|
1875
1901
|
color: "#263235"
|
|
1876
1902
|
},
|
|
1877
1903
|
children: "Your session has expired. Please try again."
|
|
1878
1904
|
}
|
|
1879
1905
|
),
|
|
1880
1906
|
/* @__PURE__ */ S(
|
|
1881
|
-
|
|
1907
|
+
R,
|
|
1882
1908
|
{
|
|
1883
1909
|
variant: "body2",
|
|
1884
1910
|
component: "div",
|
|
1885
1911
|
sx: {
|
|
1886
|
-
fontSize:
|
|
1912
|
+
fontSize: d.body2.fontSize,
|
|
1887
1913
|
color: "#666666"
|
|
1888
1914
|
},
|
|
1889
1915
|
children: [
|
|
@@ -1893,13 +1919,13 @@ const Xt = ({
|
|
|
1893
1919
|
]
|
|
1894
1920
|
}
|
|
1895
1921
|
),
|
|
1896
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ s("button", { className: "realeyes-btn", onClick: e, children: "OK" })
|
|
1897
1923
|
]
|
|
1898
1924
|
}
|
|
1899
1925
|
)
|
|
1900
1926
|
}
|
|
1901
1927
|
) }) : null;
|
|
1902
|
-
},
|
|
1928
|
+
}, ar = gt(() => import("./livenessCheckDialog-DymTrMxB.js")), cr = Et({
|
|
1903
1929
|
palette: {
|
|
1904
1930
|
mode: "light"
|
|
1905
1931
|
},
|
|
@@ -1931,50 +1957,52 @@ const Xt = ({
|
|
|
1931
1957
|
}
|
|
1932
1958
|
}
|
|
1933
1959
|
}
|
|
1934
|
-
}),
|
|
1960
|
+
}), lr = 300 * 1e3, _e = {
|
|
1935
1961
|
SkipIfCameraGranted: "1",
|
|
1936
1962
|
AlwaysSkip: "2"
|
|
1937
|
-
},
|
|
1938
|
-
const [
|
|
1963
|
+
}, dr = ({ strategy: o, config: e, consentSkipMode: t, headless: r = !1, onServiceError: i, headlessCallbacks: d, showVerificationSessionId: h = !1, mediaStream: c }) => {
|
|
1964
|
+
const [n, a] = D(!1), [l, u] = D(!1), [p, f] = D(!1), [v, T] = D(!1), [oe, we] = D(!1), [ae, K] = D(!1), [je, ce] = D(!1), [be, Ce] = D(!1), [Re, He] = D(!0), [$e, De] = D(!1), [Ie, le] = D(!1), [de, x] = D(""), [We, xe] = D(!0), [ue, me] = D(null), te = C(2), fe = C(3), Ae = C(0), Te = C(0), [qe, Ke] = D(""), [J, Je] = D("..."), Y = C(!1), G = C(null), he = C(!1), E = C("..."), ke = C(""), Me = C(""), w = C(new Zt(e)).current, g = C(new Qt(w, E)).current, I = C(new Xt(w, e)).current;
|
|
1939
1965
|
I.statsService = g;
|
|
1940
|
-
const
|
|
1941
|
-
|
|
1942
|
-
const
|
|
1943
|
-
console.error(`Error during ${m}`),
|
|
1944
|
-
}, re =
|
|
1945
|
-
re.current =
|
|
1946
|
-
const
|
|
1966
|
+
const Oe = C(i);
|
|
1967
|
+
Oe.current = i;
|
|
1968
|
+
const V = (m) => {
|
|
1969
|
+
console.error(`Error during ${m}`), Oe.current?.(m);
|
|
1970
|
+
}, re = C(d);
|
|
1971
|
+
re.current = d;
|
|
1972
|
+
const ie = C(c);
|
|
1973
|
+
ie.current = c;
|
|
1974
|
+
const Le = C(!1), pe = C(null);
|
|
1947
1975
|
Z(() => {
|
|
1948
1976
|
const m = new AbortController();
|
|
1949
|
-
if (
|
|
1977
|
+
if (pe.current = m, G.current)
|
|
1950
1978
|
I.setAbortSignal(m.signal);
|
|
1951
1979
|
else {
|
|
1952
1980
|
const b = new AbortController();
|
|
1953
|
-
I.setAbortSignal(b.signal), w.sendEvent("PageLoaded", null, {}),
|
|
1954
|
-
() =>
|
|
1981
|
+
I.setAbortSignal(b.signal), w.sendEvent("PageLoaded", null, {}), r || Ye(), G.current = Ne(
|
|
1982
|
+
() => Qe(),
|
|
1955
1983
|
1e3,
|
|
1956
1984
|
4,
|
|
1957
|
-
(
|
|
1958
|
-
|
|
1985
|
+
(k) => {
|
|
1986
|
+
Ae.current = k;
|
|
1959
1987
|
}
|
|
1960
1988
|
).finally(() => {
|
|
1961
|
-
I.setAbortSignal(
|
|
1989
|
+
I.setAbortSignal(pe.current?.signal);
|
|
1962
1990
|
}).catch(() => {
|
|
1963
|
-
|
|
1964
|
-
}),
|
|
1991
|
+
V("init-session");
|
|
1992
|
+
}), r && Ze();
|
|
1965
1993
|
}
|
|
1966
1994
|
const y = setTimeout(async () => {
|
|
1967
|
-
if (!
|
|
1995
|
+
if (!he.current) {
|
|
1968
1996
|
g.stopTimer("consentDuration", !1), g.stopTimer("permissionDuration", !1), g.stopTimer("livenessDuration", !1), g.stopTimer("captureImageDuration", !1), g.stopTimer("initDuration", !1);
|
|
1969
1997
|
const b = window.__pageLoadStart;
|
|
1970
|
-
b !== void 0 && g.addStat("sessionDuration", performance.now() - b, !1), await g.forceSendStats(), w.sendEvent("ClientSideFailed", E.current, { reason: "session_timeout" }),
|
|
1998
|
+
b !== void 0 && g.addStat("sessionDuration", performance.now() - b, !1), await g.forceSendStats(), w.sendEvent("ClientSideFailed", E.current, { reason: "session_timeout" }), Ce(!0), A("SESSION_TIMEOUT", { status: "timeout" });
|
|
1971
1999
|
}
|
|
1972
|
-
},
|
|
2000
|
+
}, lr);
|
|
1973
2001
|
return () => {
|
|
1974
2002
|
clearTimeout(y), m.abort();
|
|
1975
2003
|
};
|
|
1976
2004
|
}, []), Z(() => {
|
|
1977
|
-
if (!
|
|
2005
|
+
if (!l) return;
|
|
1978
2006
|
let m = 0;
|
|
1979
2007
|
const y = requestAnimationFrame(() => {
|
|
1980
2008
|
m = requestAnimationFrame(() => {
|
|
@@ -1984,8 +2012,8 @@ const Xt = ({
|
|
|
1984
2012
|
return () => {
|
|
1985
2013
|
cancelAnimationFrame(y), m && cancelAnimationFrame(m);
|
|
1986
2014
|
};
|
|
1987
|
-
}, [
|
|
1988
|
-
if (!
|
|
2015
|
+
}, [l]), Z(() => {
|
|
2016
|
+
if (!ae) return;
|
|
1989
2017
|
let m = 0;
|
|
1990
2018
|
const y = requestAnimationFrame(() => {
|
|
1991
2019
|
m = requestAnimationFrame(() => {
|
|
@@ -1995,8 +2023,8 @@ const Xt = ({
|
|
|
1995
2023
|
return () => {
|
|
1996
2024
|
cancelAnimationFrame(y), m && cancelAnimationFrame(m);
|
|
1997
2025
|
};
|
|
1998
|
-
}, [
|
|
1999
|
-
if (!
|
|
2026
|
+
}, [ae]), Z(() => {
|
|
2027
|
+
if (!p) return;
|
|
2000
2028
|
let m = 0;
|
|
2001
2029
|
const y = requestAnimationFrame(() => {
|
|
2002
2030
|
m = requestAnimationFrame(() => {
|
|
@@ -2006,69 +2034,72 @@ const Xt = ({
|
|
|
2006
2034
|
return () => {
|
|
2007
2035
|
cancelAnimationFrame(y), m && cancelAnimationFrame(m);
|
|
2008
2036
|
};
|
|
2009
|
-
}, [
|
|
2010
|
-
const
|
|
2011
|
-
switch (
|
|
2012
|
-
case
|
|
2037
|
+
}, [p]);
|
|
2038
|
+
const Ye = async () => {
|
|
2039
|
+
switch (He(!1), t) {
|
|
2040
|
+
case _e.SkipIfCameraGranted: {
|
|
2013
2041
|
const m = await I.checkCameraAccess();
|
|
2014
|
-
m !== "granted" ? (w.sendEvent("ConsentShown", E.current, { consentMode: t, cameraAccess: m }),
|
|
2042
|
+
m !== "granted" ? (w.sendEvent("ConsentShown", E.current, { consentMode: t, cameraAccess: m }), u(!0)) : (w.sendEvent("ConsentSkipped", E.current, { contentMode: t, cameraAccess: m }), K(!0));
|
|
2015
2043
|
break;
|
|
2016
2044
|
}
|
|
2017
|
-
case
|
|
2045
|
+
case _e.AlwaysSkip:
|
|
2018
2046
|
w.sendEvent("ConsentSkipped", E.current, { consentMode: t }), K(!0);
|
|
2019
2047
|
break;
|
|
2020
2048
|
default:
|
|
2021
|
-
w.sendEvent("ConsentShown", E.current, { consentMode: t }),
|
|
2049
|
+
w.sendEvent("ConsentShown", E.current, { consentMode: t }), u(!0);
|
|
2022
2050
|
}
|
|
2023
|
-
},
|
|
2051
|
+
}, Ze = async () => {
|
|
2024
2052
|
re.current?.onVerificationStarting?.();
|
|
2025
2053
|
try {
|
|
2026
2054
|
await G.current;
|
|
2027
2055
|
} catch {
|
|
2028
2056
|
}
|
|
2029
|
-
if (Y.current)
|
|
2057
|
+
if (Y.current) {
|
|
2058
|
+
ie.current && (Le.current ? console.warn("VerifyVerifier: 'mediaStream' is ignored for AWS-liveness sessions.") : I.setExternalStream(ie.current));
|
|
2030
2059
|
try {
|
|
2031
|
-
re.current?.onBeforeCameraAccess?.()
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2060
|
+
if (re.current?.onBeforeCameraAccess?.(), !ie.current) {
|
|
2061
|
+
const y = await I.checkCameraAccess();
|
|
2062
|
+
if (y === "unknown" || y !== "granted") {
|
|
2063
|
+
const b = await I.startCamera();
|
|
2064
|
+
if (await I.stopCamera(), b === "unknown" || !b.isGranted) {
|
|
2065
|
+
w.sendEvent("CameraPermissionDenied", E.current, {}), await A("CAMERA_ACCESS_ERROR", { status: "camera_error" });
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2038
2068
|
}
|
|
2039
2069
|
}
|
|
2040
2070
|
re.current?.onAfterCameraAccess?.(), w.sendEvent("CameraPermissionGranted", E.current, {}), g.startTimer("captureImageDuration");
|
|
2041
|
-
const
|
|
2042
|
-
g.stopTimer("captureImageDuration"),
|
|
2071
|
+
const m = await Ue();
|
|
2072
|
+
g.stopTimer("captureImageDuration"), m.faceDetected ? await A() : (w.sendEvent("ClientSideFailed", E.current, { reason: "no_face" }), await A());
|
|
2043
2073
|
} catch {
|
|
2044
|
-
|
|
2074
|
+
V("unknown");
|
|
2045
2075
|
}
|
|
2046
|
-
|
|
2076
|
+
}
|
|
2077
|
+
}, Ne = async (m, y = 1e3, b = 4, k) => {
|
|
2047
2078
|
const ne = Date.now();
|
|
2048
|
-
let
|
|
2079
|
+
let P = y, O = 1;
|
|
2049
2080
|
for (; ; )
|
|
2050
2081
|
try {
|
|
2051
2082
|
return await m();
|
|
2052
2083
|
} catch {
|
|
2053
|
-
const
|
|
2054
|
-
if (
|
|
2055
|
-
throw new Error(`Retry limit exceeded after ${
|
|
2056
|
-
console.warn(`Retrying (attempt: ${
|
|
2057
|
-
for (let
|
|
2058
|
-
|
|
2059
|
-
`Retrying (attempt: ${
|
|
2060
|
-
), await new Promise((
|
|
2061
|
-
setTimeout(
|
|
2062
|
-
}),
|
|
2084
|
+
const mt = Date.now() - ne;
|
|
2085
|
+
if (O > b)
|
|
2086
|
+
throw new Error(`Retry limit exceeded after ${mt / 1e3} seconds`);
|
|
2087
|
+
console.warn(`Retrying (attempt: ${O}) in ${P / 1e3} seconds...`), me(`Retrying (attempt: ${O}) in ${P / 1e3} seconds...`), await new Promise(async (ft) => {
|
|
2088
|
+
for (let ge = 0; ge < P / 1e3; ge++)
|
|
2089
|
+
me(
|
|
2090
|
+
`Retrying (attempt: ${O}) in ${P / 1e3} / ${P / 1e3 - ge} seconds...`
|
|
2091
|
+
), await new Promise((ht) => setTimeout(ht, 1e3));
|
|
2092
|
+
setTimeout(ft, 0);
|
|
2093
|
+
}), P *= 2, k?.(O), O++;
|
|
2063
2094
|
}
|
|
2064
|
-
},
|
|
2065
|
-
|
|
2095
|
+
}, Qe = async () => {
|
|
2096
|
+
x(""), g.startTimer("initDuration");
|
|
2066
2097
|
const m = window.__pageLoadStart;
|
|
2067
2098
|
m && g.addStat("pageLoadDuration", performance.now() - m);
|
|
2068
2099
|
try {
|
|
2069
|
-
const y = await
|
|
2070
|
-
if (E.current = y.verificationSessionId,
|
|
2071
|
-
|
|
2100
|
+
const y = await o.initSession(I);
|
|
2101
|
+
if (E.current = y.verificationSessionId, Je(y.verificationSessionId), I.livenessCheckType = y.livenessCheckType?.toLowerCase(), y.livenessCheckConfig) {
|
|
2102
|
+
a(!0), Le.current = !0, Me.current = y.livenessCheckConfig.aws_project_region, ke.current = y.livenessCheckSessionId;
|
|
2072
2103
|
const { Amplify: b } = await import("aws-amplify");
|
|
2073
2104
|
b.configure(y.livenessCheckConfig);
|
|
2074
2105
|
} else
|
|
@@ -2077,182 +2108,186 @@ const Xt = ({
|
|
|
2077
2108
|
} catch (y) {
|
|
2078
2109
|
if (y instanceof H)
|
|
2079
2110
|
throw y;
|
|
2080
|
-
y instanceof DOMException && y.name === "AbortError" || (y instanceof
|
|
2111
|
+
y instanceof DOMException && y.name === "AbortError" || (y instanceof ye ? (x(y.message), xe(!1), V("init-session")) : y instanceof Error ? (x(y.message), V("init-session")) : (x("An error occurred during initializing the session!"), V("init-session")));
|
|
2081
2112
|
}
|
|
2082
|
-
},
|
|
2083
|
-
|
|
2113
|
+
}, Ue = async () => {
|
|
2114
|
+
x("");
|
|
2084
2115
|
try {
|
|
2085
2116
|
return await I.detectFace(E.current);
|
|
2086
2117
|
} catch (m) {
|
|
2087
2118
|
if (m instanceof H)
|
|
2088
2119
|
throw m;
|
|
2089
|
-
m instanceof
|
|
2120
|
+
m instanceof ye ? (x(m.message), xe(!1)) : m instanceof Error ? x(m.message) : x("An error occurred during face detection!"), V("capture-image");
|
|
2090
2121
|
}
|
|
2091
2122
|
return new _(!1);
|
|
2092
|
-
},
|
|
2093
|
-
if (!
|
|
2094
|
-
g.startTimer("getResultDuration"),
|
|
2123
|
+
}, A = async (m, y = { status: "completed" }) => {
|
|
2124
|
+
if (!he.current) {
|
|
2125
|
+
g.startTimer("getResultDuration"), he.current = !0, le(!0);
|
|
2095
2126
|
try {
|
|
2096
|
-
await
|
|
2127
|
+
await Ne(
|
|
2097
2128
|
async () => {
|
|
2098
2129
|
try {
|
|
2099
|
-
const b = await
|
|
2130
|
+
const b = await o.fetchResult(
|
|
2100
2131
|
E.current,
|
|
2101
2132
|
I,
|
|
2102
2133
|
m,
|
|
2103
|
-
|
|
2134
|
+
pe.current?.signal
|
|
2104
2135
|
);
|
|
2105
2136
|
g.stopTimer("getResultDuration", !1);
|
|
2106
|
-
const
|
|
2107
|
-
g.addStat("totalUserInteractionDuration", ne, !1), g.addStat("totalDuration", ne +
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2137
|
+
const k = g.getAllStatsAsObject(), ne = (k.consentDuration ?? 0) + (k.permissionDuration ?? 0) + (k.livenessDuration ?? 0), P = (k.initDuration ?? 0) + (k.pageLoadDuration ?? 0) + (k.getResultDuration ?? 0) + (k.captureImageDuration ?? 0);
|
|
2138
|
+
g.addStat("totalUserInteractionDuration", ne, !1), g.addStat("totalDuration", ne + P, !1);
|
|
2139
|
+
const O = window.__pageLoadStart;
|
|
2140
|
+
O !== void 0 && g.addStatIfMissing("sessionDuration", performance.now() - O, !1), g.addStat("throttlingInitRetryCount", Ae.current, !1), g.addStat("throttlingGetResultRetryCount", Te.current, !1), g.addStat("cameraPermissionRetryCount", 3 - fe.current, !1), g.addStat("noFaceRetryCount", 2 - te.current, !1), await g.forceSendStats() || console.error("[StatsService] forceSendStats failed - StatsCollected event not sent to Kinesis"), await w.sendEvent(
|
|
2110
2141
|
"VerificationCompleted",
|
|
2111
2142
|
E.current,
|
|
2112
2143
|
b.logPayload ?? {}
|
|
2113
|
-
), g.reset(),
|
|
2144
|
+
), g.reset(), o.complete(b, y);
|
|
2114
2145
|
} catch (b) {
|
|
2115
2146
|
if (b instanceof H) throw b;
|
|
2116
|
-
console.error("completeVerification failed:", b),
|
|
2147
|
+
console.error("completeVerification failed:", b), x("An error occurred during the verification!"), le(!1), V("verify");
|
|
2117
2148
|
}
|
|
2118
2149
|
},
|
|
2119
2150
|
1e3,
|
|
2120
2151
|
4,
|
|
2121
2152
|
(b) => {
|
|
2122
|
-
|
|
2153
|
+
Te.current = b;
|
|
2123
2154
|
}
|
|
2124
2155
|
);
|
|
2125
2156
|
} catch (b) {
|
|
2126
|
-
console.error("completeVerification throttling retry exhausted:", b), m !== "THROTTLING_LIMIT" &&
|
|
2157
|
+
console.error("completeVerification throttling retry exhausted:", b), m !== "THROTTLING_LIMIT" && o.onThrottlingLimitExhausted?.(E.current, I), x("Service is currently busy. Please try again later."), le(!1), V("verify");
|
|
2127
2158
|
} finally {
|
|
2128
|
-
|
|
2159
|
+
me(null);
|
|
2129
2160
|
}
|
|
2130
2161
|
}
|
|
2131
|
-
}, Ye = async () => {
|
|
2132
|
-
Y.current || (Ce(!0), await G.current, Ce(!1)), g.stopTimer("consentDuration"), w.sendEvent("ConsentClosed", E.current, { result: "accepted" }), d(!1), K(!0);
|
|
2133
|
-
}, Ze = async () => {
|
|
2134
|
-
Y.current || await G.current, g.stopTimer("consentDuration"), w.sendEvent("ConsentClosed", E.current, { result: "declined" }), w.sendEvent("ClientSideFailed", E.current, { reason: "no_consent" }), d(!1), await x("CONSENT_DECLINED", { status: "consent_declined" });
|
|
2135
|
-
}, Qe = async () => {
|
|
2136
|
-
Y.current || await G.current, g.stopTimer("permissionDuration"), w.sendEvent("CameraPermissionGranted", E.current, {}), K(!1), l ? (w.sendEvent("LivenessCheckStarted", E.current, {}), h(!0)) : (g.startTimer("captureImageDuration"), v(!0));
|
|
2137
2162
|
}, Xe = async () => {
|
|
2138
|
-
Y.current || await G.current, g.stopTimer("
|
|
2163
|
+
Y.current || (De(!0), await G.current, De(!1)), g.stopTimer("consentDuration"), w.sendEvent("ConsentClosed", E.current, { result: "accepted" }), u(!1), K(!0);
|
|
2139
2164
|
}, et = async () => {
|
|
2140
|
-
|
|
2141
|
-
ae(!1), await x("CAMERA_ACCESS_ERROR", { status: "camera_error" });
|
|
2142
|
-
return;
|
|
2143
|
-
}
|
|
2144
|
-
me.current -= 1, ae(!1), K(!0);
|
|
2165
|
+
Y.current || await G.current, g.stopTimer("consentDuration"), w.sendEvent("ConsentClosed", E.current, { result: "declined" }), w.sendEvent("ClientSideFailed", E.current, { reason: "no_consent" }), u(!1), await A("CONSENT_DECLINED", { status: "consent_declined" });
|
|
2145
2166
|
}, tt = async () => {
|
|
2146
|
-
g.stopTimer("
|
|
2147
|
-
}, it = async (m) => {
|
|
2148
|
-
g.stopTimer("captureImageDuration"), v(!1), $e(m), ie.current <= 0 ? (w.sendEvent("ClientSideFailed", E.current, { reason: "no_face" }), await x()) : (ie.current -= 1, te(!0));
|
|
2167
|
+
Y.current || await G.current, g.stopTimer("permissionDuration"), w.sendEvent("CameraPermissionGranted", E.current, {}), K(!1), n ? (w.sendEvent("LivenessCheckStarted", E.current, {}), f(!0)) : (g.startTimer("captureImageDuration"), T(!0));
|
|
2149
2168
|
}, rt = async () => {
|
|
2150
|
-
|
|
2169
|
+
Y.current || await G.current, g.stopTimer("permissionDuration"), w.sendEvent("CameraPermissionDenied", E.current, {}), K(!1), ce(!0);
|
|
2170
|
+
}, it = async () => {
|
|
2171
|
+
if (fe.current <= 0) {
|
|
2172
|
+
ce(!1), await A("CAMERA_ACCESS_ERROR", { status: "camera_error" });
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
fe.current -= 1, ce(!1), K(!0);
|
|
2151
2176
|
}, nt = async () => {
|
|
2152
|
-
|
|
2177
|
+
g.stopTimer("captureImageDuration"), T(!1), await A();
|
|
2153
2178
|
}, st = async (m) => {
|
|
2179
|
+
g.stopTimer("captureImageDuration"), T(!1), Ke(m), te.current <= 0 ? (w.sendEvent("ClientSideFailed", E.current, { reason: "no_face" }), await A()) : (te.current -= 1, we(!0));
|
|
2180
|
+
}, ot = async () => {
|
|
2181
|
+
we(!1), te.current >= 0 ? (g.startTimer("captureImageDuration"), T(!0)) : await A();
|
|
2182
|
+
}, at = async () => {
|
|
2183
|
+
console.log("Liveness check completed"), g.stopTimer("livenessDuration"), w.sendEvent("LivenessCheckPassed", E.current, {}), f(!1), await A();
|
|
2184
|
+
}, ct = async (m) => {
|
|
2154
2185
|
if (console.error("Liveness check failed:", m), m.state === "CAMERA_ACCESS_ERROR") {
|
|
2155
|
-
|
|
2186
|
+
x("Please allow the camera for the liveness test!");
|
|
2156
2187
|
return;
|
|
2157
2188
|
}
|
|
2158
2189
|
if (m.state === "MOBILE_LANDSCAPE_ERROR") {
|
|
2159
|
-
|
|
2190
|
+
x("Please use the mobile in portrait mode!");
|
|
2160
2191
|
return;
|
|
2161
2192
|
}
|
|
2162
|
-
g.stopTimer("livenessDuration"), w.sendEvent("LivenessCheckFailed", E.current, { reason: m.state }),
|
|
2163
|
-
},
|
|
2164
|
-
g.stopTimer("livenessDuration"), w.sendEvent("ClientSideFailed", E.current, { reason: "liveness_cancelled" }),
|
|
2165
|
-
},
|
|
2166
|
-
|
|
2193
|
+
g.stopTimer("livenessDuration"), w.sendEvent("LivenessCheckFailed", E.current, { reason: m.state }), f(!1), await A(m.state, { status: "liveness_error" });
|
|
2194
|
+
}, lt = async () => {
|
|
2195
|
+
g.stopTimer("livenessDuration"), w.sendEvent("ClientSideFailed", E.current, { reason: "liveness_cancelled" }), f(!1), await A("LIVENESS_CANCELED", { status: "liveness_canceled" });
|
|
2196
|
+
}, dt = async () => {
|
|
2197
|
+
Ce(!1), o.onSessionTimeout?.(E.current);
|
|
2167
2198
|
};
|
|
2168
|
-
if (
|
|
2199
|
+
if (r)
|
|
2169
2200
|
return null;
|
|
2170
2201
|
let B;
|
|
2171
|
-
return
|
|
2172
|
-
/* @__PURE__ */
|
|
2173
|
-
/* @__PURE__ */
|
|
2174
|
-
] }) :
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
|
|
2178
|
-
] }) :
|
|
2179
|
-
/* @__PURE__ */
|
|
2180
|
-
|
|
2202
|
+
return ue ? B = /* @__PURE__ */ S(Ve, { open: !!ue, maxWidth: "xs", fullWidth: !0, children: [
|
|
2203
|
+
/* @__PURE__ */ s(Pe, { children: "Server is busy" }),
|
|
2204
|
+
/* @__PURE__ */ s(ze, { children: /* @__PURE__ */ s(Fe, { children: ue }) })
|
|
2205
|
+
] }) : de ? B = /* @__PURE__ */ S(Ve, { open: !!de, maxWidth: "xs", fullWidth: !0, children: [
|
|
2206
|
+
/* @__PURE__ */ s(Pe, { children: "Error" }),
|
|
2207
|
+
/* @__PURE__ */ s(ze, { children: /* @__PURE__ */ s(Fe, { children: de }) }),
|
|
2208
|
+
We && /* @__PURE__ */ s(Rt, { children: /* @__PURE__ */ s(Dt, { onClick: () => window.location.reload(), variant: "contained", color: "primary", children: "Retry" }) })
|
|
2209
|
+
] }) : be ? B = /* @__PURE__ */ s(or, { isOpen: be, onOk: dt }) : Re ? B = /* @__PURE__ */ s(ve, { isOpen: Re }) : Ie ? B = /* @__PURE__ */ s(ve, { isOpen: Ie, text: "Verifying..." }) : B = /* @__PURE__ */ S(Se, { children: [
|
|
2210
|
+
/* @__PURE__ */ s(
|
|
2211
|
+
Vt,
|
|
2181
2212
|
{
|
|
2182
|
-
isOpen:
|
|
2183
|
-
onAccept:
|
|
2184
|
-
onClose:
|
|
2213
|
+
isOpen: l,
|
|
2214
|
+
onAccept: Xe,
|
|
2215
|
+
onClose: et,
|
|
2185
2216
|
uniqueId: J,
|
|
2186
|
-
isConsentButtonLoading:
|
|
2187
|
-
showVerificationSessionId:
|
|
2217
|
+
isConsentButtonLoading: $e,
|
|
2218
|
+
showVerificationSessionId: h
|
|
2188
2219
|
}
|
|
2189
2220
|
),
|
|
2190
|
-
/* @__PURE__ */
|
|
2191
|
-
|
|
2221
|
+
/* @__PURE__ */ s(
|
|
2222
|
+
rr,
|
|
2192
2223
|
{
|
|
2193
|
-
isOpen:
|
|
2224
|
+
isOpen: ae,
|
|
2194
2225
|
uniqueId: J,
|
|
2195
|
-
onPermissionGranted:
|
|
2196
|
-
onPermissionDenied:
|
|
2226
|
+
onPermissionGranted: tt,
|
|
2227
|
+
onPermissionDenied: rt,
|
|
2197
2228
|
verificationService: I
|
|
2198
2229
|
}
|
|
2199
2230
|
),
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
|
|
2231
|
+
/* @__PURE__ */ s(
|
|
2232
|
+
ir,
|
|
2202
2233
|
{
|
|
2203
|
-
isOpen:
|
|
2234
|
+
isOpen: je,
|
|
2204
2235
|
uniqueId: J,
|
|
2205
|
-
onTryAgain:
|
|
2236
|
+
onTryAgain: it
|
|
2206
2237
|
}
|
|
2207
2238
|
),
|
|
2208
|
-
/* @__PURE__ */
|
|
2209
|
-
|
|
2239
|
+
/* @__PURE__ */ s(
|
|
2240
|
+
nr,
|
|
2210
2241
|
{
|
|
2211
|
-
isOpen:
|
|
2242
|
+
isOpen: v,
|
|
2212
2243
|
uniqueId: J,
|
|
2213
|
-
detectFace:
|
|
2214
|
-
onFaceDetected:
|
|
2215
|
-
onNoFaceDetected:
|
|
2244
|
+
detectFace: Ue,
|
|
2245
|
+
onFaceDetected: nt,
|
|
2246
|
+
onNoFaceDetected: st
|
|
2216
2247
|
}
|
|
2217
2248
|
),
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
|
|
2249
|
+
/* @__PURE__ */ s(
|
|
2250
|
+
sr,
|
|
2220
2251
|
{
|
|
2221
|
-
isOpen:
|
|
2252
|
+
isOpen: oe,
|
|
2222
2253
|
uniqueId: J,
|
|
2223
|
-
onRetry:
|
|
2224
|
-
base64Image:
|
|
2254
|
+
onRetry: ot,
|
|
2255
|
+
base64Image: qe
|
|
2225
2256
|
}
|
|
2226
2257
|
),
|
|
2227
|
-
|
|
2228
|
-
|
|
2258
|
+
n && p && /* @__PURE__ */ s(vt, { fallback: /* @__PURE__ */ s(ve, { isOpen: !0 }), children: /* @__PURE__ */ s(
|
|
2259
|
+
ar,
|
|
2229
2260
|
{
|
|
2230
|
-
isOpen:
|
|
2261
|
+
isOpen: p,
|
|
2231
2262
|
uniqueId: J,
|
|
2232
|
-
livenessSessionId:
|
|
2233
|
-
livenessRegion:
|
|
2234
|
-
onLivenessComplete:
|
|
2235
|
-
onLivenessError:
|
|
2236
|
-
onClose:
|
|
2263
|
+
livenessSessionId: ke.current,
|
|
2264
|
+
livenessRegion: Me.current,
|
|
2265
|
+
onLivenessComplete: at,
|
|
2266
|
+
onLivenessError: ct,
|
|
2267
|
+
onClose: lt
|
|
2237
2268
|
}
|
|
2238
2269
|
) })
|
|
2239
|
-
] }), /* @__PURE__ */ S(
|
|
2240
|
-
/* @__PURE__ */
|
|
2241
|
-
/* @__PURE__ */
|
|
2270
|
+
] }), /* @__PURE__ */ S(wt, { theme: cr, children: [
|
|
2271
|
+
/* @__PURE__ */ s(bt, {}),
|
|
2272
|
+
/* @__PURE__ */ s(Ct, { children: B })
|
|
2242
2273
|
] });
|
|
2243
|
-
},
|
|
2244
|
-
if (!
|
|
2274
|
+
}, Ir = ({ sessionId: o, accessToken: e, onVerificationCompleted: t, consentSkipMode: r, headless: i = !1, onServiceError: d, headlessCallbacks: h, showVerificationSessionId: c, region: n, createConfig: a, mediaStream: l }) => {
|
|
2275
|
+
if (!Lt(n))
|
|
2276
|
+
throw new Error(
|
|
2277
|
+
`VerifyVerifier: invalid "region" prop ${JSON.stringify(n)}. Expected one of: ${Ge.map((f) => `"${f}"`).join(", ")}.`
|
|
2278
|
+
);
|
|
2279
|
+
if (l && !i)
|
|
2245
2280
|
throw new Error(
|
|
2246
|
-
|
|
2281
|
+
'VerifyVerifier: "mediaStream" prop is only valid when "headless" is true.'
|
|
2247
2282
|
);
|
|
2248
|
-
const
|
|
2249
|
-
return /* @__PURE__ */
|
|
2283
|
+
const u = C(a ? a(n) : new Nt(n)), p = C(new Ot(o, e, t, i));
|
|
2284
|
+
return /* @__PURE__ */ s(dr, { strategy: p.current, config: u.current, consentSkipMode: r, headless: i, onServiceError: d, headlessCallbacks: h, showVerificationSessionId: c, mediaStream: l });
|
|
2250
2285
|
};
|
|
2251
2286
|
export {
|
|
2252
|
-
|
|
2287
|
+
Ut as C,
|
|
2253
2288
|
ee as D,
|
|
2254
2289
|
q as R,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2290
|
+
Ir as V,
|
|
2291
|
+
_e as a,
|
|
2292
|
+
Ge as b
|
|
2258
2293
|
};
|