@casperid/react 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +2 -0
- package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/dist/camera_utils-BQaOSBPu.js +397 -0
- package/dist/camera_utils-BQaOSBPu.js.map +1 -0
- package/dist/camera_utils-wchtqrQn.cjs +2 -0
- package/dist/camera_utils-wchtqrQn.cjs.map +1 -0
- package/dist/face_mesh-DYMPc5Ce.js +4212 -0
- package/dist/face_mesh-DYMPc5Ce.js.map +1 -0
- package/dist/face_mesh-fEvyDoPt.cjs +19 -0
- package/dist/face_mesh-fEvyDoPt.cjs.map +1 -0
- package/dist/index.cjs +41 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1786 -1501
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +23 -10
- package/src/CasperIDModal.tsx +0 -777
- package/src/index.css +0 -217
- package/src/index.ts +0 -41
- package/src/screens/AuthSelection.tsx +0 -221
- package/src/screens/DocumentScan.tsx +0 -348
- package/src/screens/FaceScan.tsx +0 -368
- package/src/screens/IdentityVerified.tsx +0 -51
- package/src/screens/L1Setup.tsx +0 -335
- package/src/screens/Login.tsx +0 -186
- package/src/screens/MintingIdentity.tsx +0 -446
- package/src/screens/PasskeyAuth.tsx +0 -259
- package/src/screens/PasskeyRegister.tsx +0 -281
- package/src/screens/PermissionsRequest.tsx +0 -96
- package/src/screens/PinVerification.tsx +0 -321
- package/src/screens/ReviewData.tsx +0 -315
- package/src/screens/SecurityUpgrade.tsx +0 -83
- package/src/screens/VerifyIdentityChoice.tsx +0 -59
- package/src/shared/Footer.tsx +0 -13
- package/src/shared/GlassContainer.tsx +0 -17
- package/src/shared/Header.tsx +0 -62
- package/src/types.ts +0 -342
- package/src/utils/fetchWithTimeout.ts +0 -52
- package/src/utils/i18n.ts +0 -640
- package/src/utils/webauthn.ts +0 -261
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { motion as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as re } from "react/jsx-runtime";
|
|
2
|
+
import _t, { forwardRef as Ze, createElement as je, useState as y, useEffect as ce, useCallback as J, useRef as se } from "react";
|
|
3
|
+
import { motion as P, AnimatePresence as Me } from "framer-motion";
|
|
4
|
+
const He = ({ children: r, className: a = "", theme: n = "" }) => (
|
|
5
5
|
// Destructure theme and provide default
|
|
6
6
|
/* @__PURE__ */ e(
|
|
7
7
|
"div",
|
|
8
8
|
{
|
|
9
|
-
className: `glass-container relative w-full h-full rounded-[var(--casperid-radius,1.5rem)] overflow-hidden flex flex-col shadow-2xl border dark:border-white/10 border-white/40 ${
|
|
9
|
+
className: `glass-container relative w-full h-full rounded-[var(--casperid-radius,1.5rem)] overflow-hidden flex flex-col shadow-2xl border dark:border-white/10 border-white/40 ${a} ${n}`,
|
|
10
10
|
children: r
|
|
11
11
|
}
|
|
12
12
|
)
|
|
@@ -17,14 +17,14 @@ const Ve = ({ children: r, className: i = "", theme: s = "" }) => (
|
|
|
17
17
|
* This source code is licensed under the ISC license.
|
|
18
18
|
* See the LICENSE file in the root directory of this source tree.
|
|
19
19
|
*/
|
|
20
|
-
const
|
|
20
|
+
const yt = (r) => r.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Xe = (...r) => r.filter((a, n, l) => !!a && l.indexOf(a) === n).join(" ");
|
|
21
21
|
/**
|
|
22
22
|
* @license lucide-react v0.400.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
26
|
*/
|
|
27
|
-
var
|
|
27
|
+
var xt = {
|
|
28
28
|
xmlns: "http://www.w3.org/2000/svg",
|
|
29
29
|
width: 24,
|
|
30
30
|
height: 24,
|
|
@@ -41,31 +41,31 @@ var ht = {
|
|
|
41
41
|
* This source code is licensed under the ISC license.
|
|
42
42
|
* See the LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
|
-
const
|
|
44
|
+
const gt = Ze(
|
|
45
45
|
({
|
|
46
46
|
color: r = "currentColor",
|
|
47
|
-
size:
|
|
48
|
-
strokeWidth:
|
|
49
|
-
absoluteStrokeWidth:
|
|
50
|
-
className:
|
|
51
|
-
children:
|
|
52
|
-
iconNode:
|
|
53
|
-
...
|
|
54
|
-
},
|
|
47
|
+
size: a = 24,
|
|
48
|
+
strokeWidth: n = 2,
|
|
49
|
+
absoluteStrokeWidth: l,
|
|
50
|
+
className: N = "",
|
|
51
|
+
children: p,
|
|
52
|
+
iconNode: f,
|
|
53
|
+
...m
|
|
54
|
+
}, s) => je(
|
|
55
55
|
"svg",
|
|
56
56
|
{
|
|
57
|
-
ref:
|
|
58
|
-
...
|
|
59
|
-
width:
|
|
60
|
-
height:
|
|
57
|
+
ref: s,
|
|
58
|
+
...xt,
|
|
59
|
+
width: a,
|
|
60
|
+
height: a,
|
|
61
61
|
stroke: r,
|
|
62
|
-
strokeWidth:
|
|
63
|
-
className:
|
|
64
|
-
...
|
|
62
|
+
strokeWidth: l ? Number(n) * 24 / Number(a) : n,
|
|
63
|
+
className: Xe("lucide", N),
|
|
64
|
+
...m
|
|
65
65
|
},
|
|
66
66
|
[
|
|
67
|
-
...
|
|
68
|
-
...Array.isArray(
|
|
67
|
+
...f.map(([c, d]) => je(c, d)),
|
|
68
|
+
...Array.isArray(p) ? p : [p]
|
|
69
69
|
]
|
|
70
70
|
)
|
|
71
71
|
);
|
|
@@ -75,16 +75,16 @@ const ft = Be(
|
|
|
75
75
|
* This source code is licensed under the ISC license.
|
|
76
76
|
* See the LICENSE file in the root directory of this source tree.
|
|
77
77
|
*/
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
({ className:
|
|
81
|
-
ref:
|
|
82
|
-
iconNode:
|
|
83
|
-
className:
|
|
84
|
-
...
|
|
78
|
+
const j = (r, a) => {
|
|
79
|
+
const n = Ze(
|
|
80
|
+
({ className: l, ...N }, p) => je(gt, {
|
|
81
|
+
ref: p,
|
|
82
|
+
iconNode: a,
|
|
83
|
+
className: Xe(`lucide-${yt(r)}`, l),
|
|
84
|
+
...N
|
|
85
85
|
})
|
|
86
86
|
);
|
|
87
|
-
return
|
|
87
|
+
return n.displayName = `${r}`, n;
|
|
88
88
|
};
|
|
89
89
|
/**
|
|
90
90
|
* @license lucide-react v0.400.0 - ISC
|
|
@@ -92,7 +92,7 @@ const M = (r, i) => {
|
|
|
92
92
|
* This source code is licensed under the ISC license.
|
|
93
93
|
* See the LICENSE file in the root directory of this source tree.
|
|
94
94
|
*/
|
|
95
|
-
const
|
|
95
|
+
const Oe = j("ArrowRight", [
|
|
96
96
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
97
97
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
98
98
|
]);
|
|
@@ -102,7 +102,7 @@ const Se = M("ArrowRight", [
|
|
|
102
102
|
* This source code is licensed under the ISC license.
|
|
103
103
|
* See the LICENSE file in the root directory of this source tree.
|
|
104
104
|
*/
|
|
105
|
-
const
|
|
105
|
+
const Fe = j("BadgeCheck", [
|
|
106
106
|
[
|
|
107
107
|
"path",
|
|
108
108
|
{
|
|
@@ -118,7 +118,7 @@ const Ee = M("BadgeCheck", [
|
|
|
118
118
|
* This source code is licensed under the ISC license.
|
|
119
119
|
* See the LICENSE file in the root directory of this source tree.
|
|
120
120
|
*/
|
|
121
|
-
const
|
|
121
|
+
const vt = j("Calendar", [
|
|
122
122
|
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
123
123
|
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
124
124
|
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
@@ -130,7 +130,7 @@ const bt = M("Calendar", [
|
|
|
130
130
|
* This source code is licensed under the ISC license.
|
|
131
131
|
* See the LICENSE file in the root directory of this source tree.
|
|
132
132
|
*/
|
|
133
|
-
const
|
|
133
|
+
const wt = j("Camera", [
|
|
134
134
|
[
|
|
135
135
|
"path",
|
|
136
136
|
{
|
|
@@ -146,7 +146,7 @@ const _t = M("Camera", [
|
|
|
146
146
|
* This source code is licensed under the ISC license.
|
|
147
147
|
* See the LICENSE file in the root directory of this source tree.
|
|
148
148
|
*/
|
|
149
|
-
const
|
|
149
|
+
const Le = j("ChevronRight", [
|
|
150
150
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
151
151
|
]);
|
|
152
152
|
/**
|
|
@@ -155,7 +155,7 @@ const Ie = M("ChevronRight", [
|
|
|
155
155
|
* This source code is licensed under the ISC license.
|
|
156
156
|
* See the LICENSE file in the root directory of this source tree.
|
|
157
157
|
*/
|
|
158
|
-
const
|
|
158
|
+
const ve = j("CircleAlert", [
|
|
159
159
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
160
160
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
161
161
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
@@ -166,7 +166,7 @@ const se = M("CircleAlert", [
|
|
|
166
166
|
* This source code is licensed under the ISC license.
|
|
167
167
|
* See the LICENSE file in the root directory of this source tree.
|
|
168
168
|
*/
|
|
169
|
-
const
|
|
169
|
+
const Ce = j("CircleCheck", [
|
|
170
170
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
171
171
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
172
172
|
]);
|
|
@@ -176,7 +176,7 @@ const he = M("CircleCheck", [
|
|
|
176
176
|
* This source code is licensed under the ISC license.
|
|
177
177
|
* See the LICENSE file in the root directory of this source tree.
|
|
178
178
|
*/
|
|
179
|
-
const
|
|
179
|
+
const kt = j("CircleHelp", [
|
|
180
180
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
181
181
|
["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
|
|
182
182
|
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
@@ -187,7 +187,7 @@ const yt = M("CircleHelp", [
|
|
|
187
187
|
* This source code is licensed under the ISC license.
|
|
188
188
|
* See the LICENSE file in the root directory of this source tree.
|
|
189
189
|
*/
|
|
190
|
-
const
|
|
190
|
+
const Qe = j("CreditCard", [
|
|
191
191
|
["rect", { width: "20", height: "14", x: "2", y: "5", rx: "2", key: "ynyp8z" }],
|
|
192
192
|
["line", { x1: "2", x2: "22", y1: "10", y2: "10", key: "1b3vmo" }]
|
|
193
193
|
]);
|
|
@@ -197,7 +197,7 @@ const Ke = M("CreditCard", [
|
|
|
197
197
|
* This source code is licensed under the ISC license.
|
|
198
198
|
* See the LICENSE file in the root directory of this source tree.
|
|
199
199
|
*/
|
|
200
|
-
const
|
|
200
|
+
const Nt = j("Delete", [
|
|
201
201
|
["path", { d: "M20 5H9l-7 7 7 7h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2Z", key: "1oy587" }],
|
|
202
202
|
["line", { x1: "18", x2: "12", y1: "9", y2: "15", key: "1olkx5" }],
|
|
203
203
|
["line", { x1: "12", x2: "18", y1: "9", y2: "15", key: "1n50pc" }]
|
|
@@ -208,7 +208,7 @@ const xt = M("Delete", [
|
|
|
208
208
|
* This source code is licensed under the ISC license.
|
|
209
209
|
* See the LICENSE file in the root directory of this source tree.
|
|
210
210
|
*/
|
|
211
|
-
const
|
|
211
|
+
const Ie = j("Fingerprint", [
|
|
212
212
|
["path", { d: "M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4", key: "1nerag" }],
|
|
213
213
|
["path", { d: "M14 13.12c0 2.38 0 6.38-1 8.88", key: "o46ks0" }],
|
|
214
214
|
["path", { d: "M17.29 21.02c.12-.6.43-2.3.5-3.02", key: "ptglia" }],
|
|
@@ -225,7 +225,7 @@ const pe = M("Fingerprint", [
|
|
|
225
225
|
* This source code is licensed under the ISC license.
|
|
226
226
|
* See the LICENSE file in the root directory of this source tree.
|
|
227
227
|
*/
|
|
228
|
-
const
|
|
228
|
+
const It = j("Flashlight", [
|
|
229
229
|
[
|
|
230
230
|
"path",
|
|
231
231
|
{
|
|
@@ -242,7 +242,7 @@ const gt = M("Flashlight", [
|
|
|
242
242
|
* This source code is licensed under the ISC license.
|
|
243
243
|
* See the LICENSE file in the root directory of this source tree.
|
|
244
244
|
*/
|
|
245
|
-
const
|
|
245
|
+
const et = j("Globe", [
|
|
246
246
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
247
247
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
248
248
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
@@ -253,7 +253,7 @@ const We = M("Globe", [
|
|
|
253
253
|
* This source code is licensed under the ISC license.
|
|
254
254
|
* See the LICENSE file in the root directory of this source tree.
|
|
255
255
|
*/
|
|
256
|
-
const
|
|
256
|
+
const Ct = j("Key", [
|
|
257
257
|
["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
|
|
258
258
|
["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
|
|
259
259
|
["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
|
|
@@ -264,7 +264,7 @@ const vt = M("Key", [
|
|
|
264
264
|
* This source code is licensed under the ISC license.
|
|
265
265
|
* See the LICENSE file in the root directory of this source tree.
|
|
266
266
|
*/
|
|
267
|
-
const
|
|
267
|
+
const _e = j("LoaderCircle", [
|
|
268
268
|
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
269
269
|
]);
|
|
270
270
|
/**
|
|
@@ -273,7 +273,7 @@ const ee = M("LoaderCircle", [
|
|
|
273
273
|
* This source code is licensed under the ISC license.
|
|
274
274
|
* See the LICENSE file in the root directory of this source tree.
|
|
275
275
|
*/
|
|
276
|
-
const
|
|
276
|
+
const tt = j("Lock", [
|
|
277
277
|
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
|
278
278
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
|
279
279
|
]);
|
|
@@ -283,7 +283,7 @@ const Ae = M("Lock", [
|
|
|
283
283
|
* This source code is licensed under the ISC license.
|
|
284
284
|
* See the LICENSE file in the root directory of this source tree.
|
|
285
285
|
*/
|
|
286
|
-
const
|
|
286
|
+
const St = j("Mail", [
|
|
287
287
|
["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }],
|
|
288
288
|
["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }]
|
|
289
289
|
]);
|
|
@@ -293,7 +293,7 @@ const wt = M("Mail", [
|
|
|
293
293
|
* This source code is licensed under the ISC license.
|
|
294
294
|
* See the LICENSE file in the root directory of this source tree.
|
|
295
295
|
*/
|
|
296
|
-
const
|
|
296
|
+
const Et = j("Moon", [
|
|
297
297
|
["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
|
|
298
298
|
]);
|
|
299
299
|
/**
|
|
@@ -302,7 +302,7 @@ const kt = M("Moon", [
|
|
|
302
302
|
* This source code is licensed under the ISC license.
|
|
303
303
|
* See the LICENSE file in the root directory of this source tree.
|
|
304
304
|
*/
|
|
305
|
-
const
|
|
305
|
+
const At = j("Network", [
|
|
306
306
|
["rect", { x: "16", y: "16", width: "6", height: "6", rx: "1", key: "4q2zg0" }],
|
|
307
307
|
["rect", { x: "2", y: "16", width: "6", height: "6", rx: "1", key: "8cvhb9" }],
|
|
308
308
|
["rect", { x: "9", y: "2", width: "6", height: "6", rx: "1", key: "1egb70" }],
|
|
@@ -315,7 +315,7 @@ const Nt = M("Network", [
|
|
|
315
315
|
* This source code is licensed under the ISC license.
|
|
316
316
|
* See the LICENSE file in the root directory of this source tree.
|
|
317
317
|
*/
|
|
318
|
-
const
|
|
318
|
+
const Dt = j("Puzzle", [
|
|
319
319
|
[
|
|
320
320
|
"path",
|
|
321
321
|
{
|
|
@@ -330,7 +330,7 @@ const Ct = M("Puzzle", [
|
|
|
330
330
|
* This source code is licensed under the ISC license.
|
|
331
331
|
* See the LICENSE file in the root directory of this source tree.
|
|
332
332
|
*/
|
|
333
|
-
const
|
|
333
|
+
const Te = j("RefreshCw", [
|
|
334
334
|
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
335
335
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
336
336
|
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
@@ -342,7 +342,7 @@ const xe = M("RefreshCw", [
|
|
|
342
342
|
* This source code is licensed under the ISC license.
|
|
343
343
|
* See the LICENSE file in the root directory of this source tree.
|
|
344
344
|
*/
|
|
345
|
-
const
|
|
345
|
+
const Rt = j("RotateCcw", [
|
|
346
346
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
347
347
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
348
348
|
]);
|
|
@@ -352,7 +352,7 @@ const It = M("RotateCcw", [
|
|
|
352
352
|
* This source code is licensed under the ISC license.
|
|
353
353
|
* See the LICENSE file in the root directory of this source tree.
|
|
354
354
|
*/
|
|
355
|
-
const
|
|
355
|
+
const Se = j("ShieldCheck", [
|
|
356
356
|
[
|
|
357
357
|
"path",
|
|
358
358
|
{
|
|
@@ -368,7 +368,7 @@ const fe = M("ShieldCheck", [
|
|
|
368
368
|
* This source code is licensed under the ISC license.
|
|
369
369
|
* See the LICENSE file in the root directory of this source tree.
|
|
370
370
|
*/
|
|
371
|
-
const
|
|
371
|
+
const it = j("Shield", [
|
|
372
372
|
[
|
|
373
373
|
"path",
|
|
374
374
|
{
|
|
@@ -383,7 +383,7 @@ const Ge = M("Shield", [
|
|
|
383
383
|
* This source code is licensed under the ISC license.
|
|
384
384
|
* See the LICENSE file in the root directory of this source tree.
|
|
385
385
|
*/
|
|
386
|
-
const
|
|
386
|
+
const qe = j("Smartphone", [
|
|
387
387
|
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
|
|
388
388
|
["path", { d: "M12 18h.01", key: "mhygvu" }]
|
|
389
389
|
]);
|
|
@@ -393,7 +393,7 @@ const De = M("Smartphone", [
|
|
|
393
393
|
* This source code is licensed under the ISC license.
|
|
394
394
|
* See the LICENSE file in the root directory of this source tree.
|
|
395
395
|
*/
|
|
396
|
-
const
|
|
396
|
+
const Pt = j("Sparkles", [
|
|
397
397
|
[
|
|
398
398
|
"path",
|
|
399
399
|
{
|
|
@@ -412,7 +412,7 @@ const St = M("Sparkles", [
|
|
|
412
412
|
* This source code is licensed under the ISC license.
|
|
413
413
|
* See the LICENSE file in the root directory of this source tree.
|
|
414
414
|
*/
|
|
415
|
-
const
|
|
415
|
+
const Tt = j("Sun", [
|
|
416
416
|
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
417
417
|
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
418
418
|
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
@@ -429,7 +429,7 @@ const Et = M("Sun", [
|
|
|
429
429
|
* This source code is licensed under the ISC license.
|
|
430
430
|
* See the LICENSE file in the root directory of this source tree.
|
|
431
431
|
*/
|
|
432
|
-
const
|
|
432
|
+
const zt = j("User", [
|
|
433
433
|
["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
|
|
434
434
|
["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
|
|
435
435
|
]);
|
|
@@ -439,7 +439,7 @@ const At = M("User", [
|
|
|
439
439
|
* This source code is licensed under the ISC license.
|
|
440
440
|
* See the LICENSE file in the root directory of this source tree.
|
|
441
441
|
*/
|
|
442
|
-
const
|
|
442
|
+
const Vt = j("Wallet", [
|
|
443
443
|
[
|
|
444
444
|
"path",
|
|
445
445
|
{
|
|
@@ -455,46 +455,46 @@ const Dt = M("Wallet", [
|
|
|
455
455
|
* This source code is licensed under the ISC license.
|
|
456
456
|
* See the LICENSE file in the root directory of this source tree.
|
|
457
457
|
*/
|
|
458
|
-
const
|
|
458
|
+
const jt = j("X", [
|
|
459
459
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
460
460
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
461
|
-
]),
|
|
461
|
+
]), We = ({
|
|
462
462
|
onClose: r,
|
|
463
|
-
title:
|
|
464
|
-
subtitle:
|
|
465
|
-
showClose:
|
|
466
|
-
theme:
|
|
467
|
-
toggleTheme:
|
|
468
|
-
logoUrl:
|
|
469
|
-
}) => /* @__PURE__ */
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
/* @__PURE__ */ e("div", { className: "p-2 bg-brand rounded-xl flex items-center justify-center shadow-brand", children:
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */ e("h2", { className: "text-lg font-bold tracking-tight text-main", children:
|
|
474
|
-
|
|
463
|
+
title: a = "CasperID",
|
|
464
|
+
subtitle: n = "SECURE SDK",
|
|
465
|
+
showClose: l = !0,
|
|
466
|
+
theme: N,
|
|
467
|
+
toggleTheme: p,
|
|
468
|
+
logoUrl: f
|
|
469
|
+
}) => /* @__PURE__ */ i("header", { className: "flex items-center justify-between px-6 pt-8 pb-4 relative z-20", children: [
|
|
470
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
471
|
+
/* @__PURE__ */ e("div", { className: "p-2 bg-brand rounded-xl flex items-center justify-center shadow-brand", children: f ? /* @__PURE__ */ e("img", { src: f, alt: a, className: "w-5 h-5 object-contain" }) : /* @__PURE__ */ e(it, { className: "text-white w-5 h-5" }) }),
|
|
472
|
+
/* @__PURE__ */ i("div", { children: [
|
|
473
|
+
/* @__PURE__ */ e("h2", { className: "text-lg font-bold tracking-tight text-main", children: a }),
|
|
474
|
+
n && /* @__PURE__ */ e("p", { className: "text-[10px] uppercase tracking-widest text-brand font-bold", children: n })
|
|
475
475
|
] })
|
|
476
476
|
] }),
|
|
477
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
478
478
|
/* @__PURE__ */ e(
|
|
479
479
|
"button",
|
|
480
480
|
{
|
|
481
|
-
onClick:
|
|
482
|
-
className: "p-2 dark:hover:bg-white/10 hover:bg-slate-200/50 rounded-xl transition-colors text-muted",
|
|
481
|
+
onClick: p,
|
|
482
|
+
className: "p-2 dark:hover:bg-slate-200 dark:bg-white/10 hover:bg-slate-200/50 rounded-xl transition-colors text-muted",
|
|
483
483
|
"aria-label": "Toggle theme",
|
|
484
|
-
children:
|
|
484
|
+
children: N === "dark" ? /* @__PURE__ */ e(Tt, { className: "w-5 h-5" }) : /* @__PURE__ */ e(Et, { className: "w-5 h-5" })
|
|
485
485
|
}
|
|
486
486
|
),
|
|
487
|
-
|
|
487
|
+
l && /* @__PURE__ */ e(
|
|
488
488
|
"button",
|
|
489
489
|
{
|
|
490
490
|
onClick: r,
|
|
491
|
-
className: "p-2 dark:hover:bg-white/10 hover:bg-slate-200/50 rounded-full transition-colors text-muted",
|
|
491
|
+
className: "p-2 dark:hover:bg-slate-200 dark:bg-white/10 hover:bg-slate-200/50 rounded-full transition-colors text-muted",
|
|
492
492
|
"aria-label": "Close",
|
|
493
|
-
children: /* @__PURE__ */ e(
|
|
493
|
+
children: /* @__PURE__ */ e(jt, { className: "w-5 h-5" })
|
|
494
494
|
}
|
|
495
495
|
)
|
|
496
496
|
] })
|
|
497
|
-
] }),
|
|
497
|
+
] }), Ye = ({ children: r }) => /* @__PURE__ */ e("footer", { className: "p-8 text-center relative z-20", children: r }), Ve = {
|
|
498
498
|
EN: {
|
|
499
499
|
welcome_back: "Welcome back",
|
|
500
500
|
enter_email: "Enter your email to receive a verification code.",
|
|
@@ -545,6 +545,8 @@ const Rt = M("X", [
|
|
|
545
545
|
live_camera: "LIVE CAMERA",
|
|
546
546
|
initializing: "INITIALIZING",
|
|
547
547
|
processing_verification: "Processing Verification...",
|
|
548
|
+
processing_liveness: "Verifying Liveness...",
|
|
549
|
+
processing_documents: "Processing Documents...",
|
|
548
550
|
processing_subtitle: "Validating your documents and biometrics",
|
|
549
551
|
minting_identity: "Minting your Identity...",
|
|
550
552
|
minting_subtitle: "Securing your decentralized identity on the Casper Network",
|
|
@@ -554,7 +556,12 @@ const Rt = M("X", [
|
|
|
554
556
|
try_again: "Try Again",
|
|
555
557
|
credential_hash: "Credential Hash",
|
|
556
558
|
identity_verified: "Identity Verified",
|
|
559
|
+
identity_verified_subtitle: "Your liveness check passed. You are now verified.",
|
|
557
560
|
identity_verified_desc: "Your CasperID has been successfully authenticated on the Casper blockchain. You're ready to go.",
|
|
561
|
+
submitting_for_review: "Submitting for Review...",
|
|
562
|
+
submitting_review_subtitle: "Your documents are being prepared for verification",
|
|
563
|
+
verification_submitted: "Verification Submitted",
|
|
564
|
+
verification_submitted_subtitle: "Your documents are under review. You'll be notified once verified.",
|
|
558
565
|
share_data_consent: "Share Data Consent",
|
|
559
566
|
authorize_dapps: "Authorize dApps to access your credentials",
|
|
560
567
|
return_to_app: "Return to App",
|
|
@@ -617,6 +624,11 @@ const Rt = M("X", [
|
|
|
617
624
|
perm_identity: "Verify Identity Status",
|
|
618
625
|
perm_profile: "Read Public Profile",
|
|
619
626
|
perm_kyc: "Share KYC Level",
|
|
627
|
+
"verify:identity": "Verify Identity Status",
|
|
628
|
+
"read:profile": "Read Public Profile",
|
|
629
|
+
"read:kyc_level": "Share KYC Level",
|
|
630
|
+
"read:email": "Access Email Address",
|
|
631
|
+
"read:wallet": "View Wallet Address",
|
|
620
632
|
full_name: "FULL NAME",
|
|
621
633
|
id_number: "ID NUMBER",
|
|
622
634
|
// Passkey Auth
|
|
@@ -648,7 +660,11 @@ const Rt = M("X", [
|
|
|
648
660
|
generating_wallet: "Generating secure wallet...",
|
|
649
661
|
minting_did: "Minting your DID...",
|
|
650
662
|
l1_complete: "Identity setup complete!",
|
|
651
|
-
l1_failed: "Setup failed. Please try again."
|
|
663
|
+
l1_failed: "Setup failed. Please try again.",
|
|
664
|
+
facial_verification: "Facial Verification",
|
|
665
|
+
secure_face_scan_desc: "Secure Face Scan • Encrypted",
|
|
666
|
+
analyzing_liveness: "Analyzing Liveness",
|
|
667
|
+
calibration_complete: "Calibration Complete"
|
|
652
668
|
},
|
|
653
669
|
ES: {
|
|
654
670
|
welcome_back: "Bienvenido de nuevo",
|
|
@@ -700,6 +716,8 @@ const Rt = M("X", [
|
|
|
700
716
|
live_camera: "CÁMARA EN VIVO",
|
|
701
717
|
initializing: "INICIALIZANDO",
|
|
702
718
|
processing_verification: "Procesando verificación...",
|
|
719
|
+
processing_liveness: "Verificando vivacidad...",
|
|
720
|
+
processing_documents: "Procesando documentos...",
|
|
703
721
|
processing_subtitle: "Validando sus documentos y biometría",
|
|
704
722
|
minting_identity: "Minting identidad...",
|
|
705
723
|
minting_subtitle: "Asegurando su identidad descentralizada en Casper Network",
|
|
@@ -709,7 +727,12 @@ const Rt = M("X", [
|
|
|
709
727
|
try_again: "Intentar de nuevo",
|
|
710
728
|
credential_hash: "Hash de credencial",
|
|
711
729
|
identity_verified: "Identidad verificada",
|
|
730
|
+
identity_verified_subtitle: "Su verificación de vida fue exitosa. Ahora está verificado.",
|
|
712
731
|
identity_verified_desc: "Su CasperID ha sido autenticado con éxito en la cadena de bloques Casper.",
|
|
732
|
+
submitting_for_review: "Enviando para revisión...",
|
|
733
|
+
submitting_review_subtitle: "Sus documentos están siendo preparados para verificación",
|
|
734
|
+
verification_submitted: "Verificación Enviada",
|
|
735
|
+
verification_submitted_subtitle: "Sus documentos están en revisión. Le notificaremos una vez verificado.",
|
|
713
736
|
share_data_consent: "Consentimiento de datos",
|
|
714
737
|
authorize_dapps: "Autorizar dApps para acceder a credenciales",
|
|
715
738
|
return_to_app: "Volver a la aplicación",
|
|
@@ -772,6 +795,11 @@ const Rt = M("X", [
|
|
|
772
795
|
perm_identity: "Verificar estado de identidad",
|
|
773
796
|
perm_profile: "Leer perfil público",
|
|
774
797
|
perm_kyc: "Compartir nivel de KYC",
|
|
798
|
+
"verify:identity": "Verificar estado de identidad",
|
|
799
|
+
"read:profile": "Leer perfil público",
|
|
800
|
+
"read:kyc_level": "Compartir nivel de KYC",
|
|
801
|
+
"read:email": "Acceso a correo electrónico",
|
|
802
|
+
"read:wallet": "Ver dirección de billetera",
|
|
775
803
|
full_name: "NOMBRE COMPLETO",
|
|
776
804
|
id_number: "NÚMERO DE IDENTIFICACIÓN",
|
|
777
805
|
// Passkey Auth
|
|
@@ -803,7 +831,11 @@ const Rt = M("X", [
|
|
|
803
831
|
generating_wallet: "Generando billetera segura...",
|
|
804
832
|
minting_did: "Minting su DID...",
|
|
805
833
|
l1_complete: "¡Configuración de identidad completa!",
|
|
806
|
-
l1_failed: "Configuración fallida. Intente de nuevo."
|
|
834
|
+
l1_failed: "Configuración fallida. Intente de nuevo.",
|
|
835
|
+
facial_verification: "Verificación Facial",
|
|
836
|
+
secure_face_scan_desc: "Escaneo Facial Seguro • Encriptado",
|
|
837
|
+
analyzing_liveness: "Analizando Vivacidad",
|
|
838
|
+
calibration_complete: "Calibración Completa"
|
|
807
839
|
},
|
|
808
840
|
FR: {
|
|
809
841
|
welcome_back: "Bon retour",
|
|
@@ -855,6 +887,8 @@ const Rt = M("X", [
|
|
|
855
887
|
live_camera: "CAMÉRA EN DIRECT",
|
|
856
888
|
initializing: "INITIALISATION",
|
|
857
889
|
processing_verification: "Traitement de la vérification...",
|
|
890
|
+
processing_liveness: "Vérification de la vivacité...",
|
|
891
|
+
processing_documents: "Traitement des documents...",
|
|
858
892
|
processing_subtitle: "Validation de vos documents et biométrie",
|
|
859
893
|
minting_identity: "Mint Identité en cours...",
|
|
860
894
|
minting_subtitle: "Sécurisation de votre identité sur le réseau Casper",
|
|
@@ -864,7 +898,12 @@ const Rt = M("X", [
|
|
|
864
898
|
try_again: "Réessayer",
|
|
865
899
|
credential_hash: "Hachage de créance",
|
|
866
900
|
identity_verified: "Identité vérifiée",
|
|
901
|
+
identity_verified_subtitle: "Votre vérification de vivacité a réussi. Vous êtes maintenant vérifié.",
|
|
867
902
|
identity_verified_desc: "Votre CasperID a été authentifié avec succès sur la blockchain Casper.",
|
|
903
|
+
submitting_for_review: "Soumission pour révision...",
|
|
904
|
+
submitting_review_subtitle: "Vos documents sont en cours de préparation pour la vérification",
|
|
905
|
+
verification_submitted: "Vérification Soumise",
|
|
906
|
+
verification_submitted_subtitle: "Vos documents sont en cours de révision. Vous serez notifié une fois vérifié.",
|
|
868
907
|
share_data_consent: "Partage de données",
|
|
869
908
|
authorize_dapps: "Autoriser dApps à accéder aux identifiants",
|
|
870
909
|
return_to_app: "Retour à l'application",
|
|
@@ -927,6 +966,11 @@ const Rt = M("X", [
|
|
|
927
966
|
perm_identity: "Vérifier le statut d'identité",
|
|
928
967
|
perm_profile: "Lire le profil public",
|
|
929
968
|
perm_kyc: "Partager le niveau KYC",
|
|
969
|
+
"verify:identity": "Vérifier le statut d'identité",
|
|
970
|
+
"read:profile": "Lire le profil public",
|
|
971
|
+
"read:kyc_level": "Partager le niveau KYC",
|
|
972
|
+
"read:email": "Accéder à l'adresse email",
|
|
973
|
+
"read:wallet": "Voir l'adresse du portefeuille",
|
|
930
974
|
full_name: "NOM COMPLET",
|
|
931
975
|
id_number: "NUMÉRO DE DOCUMENT",
|
|
932
976
|
// Passkey Auth
|
|
@@ -958,7 +1002,11 @@ const Rt = M("X", [
|
|
|
958
1002
|
generating_wallet: "Génération du portefeuille sécurisé...",
|
|
959
1003
|
minting_did: "Création de votre DID...",
|
|
960
1004
|
l1_complete: "Configuration d'identité terminée!",
|
|
961
|
-
l1_failed: "Échec de la configuration. Réessayez."
|
|
1005
|
+
l1_failed: "Échec de la configuration. Réessayez.",
|
|
1006
|
+
facial_verification: "Vérification Faciale",
|
|
1007
|
+
secure_face_scan_desc: "Scan Facial Sécurisé • Crypté",
|
|
1008
|
+
analyzing_liveness: "Analyse de Vivacité",
|
|
1009
|
+
calibration_complete: "Calibration Terminée"
|
|
962
1010
|
},
|
|
963
1011
|
DE: {
|
|
964
1012
|
welcome_back: "Willkommen zurück",
|
|
@@ -1010,6 +1058,8 @@ const Rt = M("X", [
|
|
|
1010
1058
|
live_camera: "LIVE-KAMERA",
|
|
1011
1059
|
initializing: "INITIALISIERUNG",
|
|
1012
1060
|
processing_verification: "Verifizierung wird verarbeitet...",
|
|
1061
|
+
processing_liveness: "Lebendigkeitsprüfung läuft...",
|
|
1062
|
+
processing_documents: "Dokumente werden verarbeitet...",
|
|
1013
1063
|
processing_subtitle: "Dokumente und Biometrie werden validiert",
|
|
1014
1064
|
minting_identity: "Identität wird geprägt...",
|
|
1015
1065
|
minting_subtitle: "Ihre dezentrale Identität wird im Casper-Netzwerk gesichert",
|
|
@@ -1019,7 +1069,12 @@ const Rt = M("X", [
|
|
|
1019
1069
|
try_again: "Erneut versuchen",
|
|
1020
1070
|
credential_hash: "Anmeldedaten-Hash",
|
|
1021
1071
|
identity_verified: "Identität verifiziert",
|
|
1072
|
+
identity_verified_subtitle: "Ihre Lebendigkeitsprüfung war erfolgreich. Sie sind jetzt verifiziert.",
|
|
1022
1073
|
identity_verified_desc: "Ihre CasperID wurde erfolgreich in der Casper-Blockchain authentifiziert.",
|
|
1074
|
+
submitting_for_review: "Zur Überprüfung einreichen...",
|
|
1075
|
+
submitting_review_subtitle: "Ihre Dokumente werden für die Verifizierung vorbereitet",
|
|
1076
|
+
verification_submitted: "Verifizierung eingereicht",
|
|
1077
|
+
verification_submitted_subtitle: "Ihre Dokumente werden überprüft. Sie werden benachrichtigt, sobald verifiziert.",
|
|
1023
1078
|
share_data_consent: "Datenfreigabe",
|
|
1024
1079
|
authorize_dapps: "dApps Zugriff auf Anmeldedaten erlauben",
|
|
1025
1080
|
return_to_app: "Zurück zur App",
|
|
@@ -1059,6 +1114,7 @@ const Rt = M("X", [
|
|
|
1059
1114
|
error_verify_failed: "Verifizierung nicht möglich. Bitte erneut versuchen.",
|
|
1060
1115
|
error_resend_failed: "Code konnte nicht gesendet werden. Bitte erneut versuchen.",
|
|
1061
1116
|
sending: "Senden...",
|
|
1117
|
+
facial_verification: "Gesichtsverifizierung",
|
|
1062
1118
|
secure_face_scan_desc: "Sicherer Gesichtsscan • Verschlüsselt",
|
|
1063
1119
|
analyzing_liveness: "Lebendigkeitsprüfung",
|
|
1064
1120
|
calibration_complete: "Kalibrierung abgeschlossen",
|
|
@@ -1088,6 +1144,11 @@ const Rt = M("X", [
|
|
|
1088
1144
|
perm_identity: "Identitätsstatus überprüfen",
|
|
1089
1145
|
perm_profile: "Öffentliches Profil lesen",
|
|
1090
1146
|
perm_kyc: "KYC-Level teilen",
|
|
1147
|
+
"verify:identity": "Identitätsstatus überprüfen",
|
|
1148
|
+
"read:profile": "Öffentliches Profil lesen",
|
|
1149
|
+
"read:kyc_level": "KYC-Level teilen",
|
|
1150
|
+
"read:email": "E-Mail-Adresse zugreifen",
|
|
1151
|
+
"read:wallet": "Wallet-Adresse anzeigen",
|
|
1091
1152
|
full_name: "VOLLSTÄNDIGER NAME",
|
|
1092
1153
|
id_number: "AUSWEISNUMMER",
|
|
1093
1154
|
// Passkey Auth
|
|
@@ -1121,387 +1182,391 @@ const Rt = M("X", [
|
|
|
1121
1182
|
l1_complete: "Identitätseinrichtung abgeschlossen!",
|
|
1122
1183
|
l1_failed: "Einrichtung fehlgeschlagen. Erneut versuchen."
|
|
1123
1184
|
}
|
|
1124
|
-
}, t = (r,
|
|
1125
|
-
const
|
|
1126
|
-
return (
|
|
1127
|
-
},
|
|
1185
|
+
}, t = (r, a = "EN") => {
|
|
1186
|
+
const n = a.toUpperCase();
|
|
1187
|
+
return (Ve[n] || Ve.EN)[r] || Ve.EN[r] || r;
|
|
1188
|
+
}, Mt = ({
|
|
1128
1189
|
onNext: r,
|
|
1129
|
-
onExtensionSuccess:
|
|
1130
|
-
onError:
|
|
1131
|
-
language:
|
|
1190
|
+
onExtensionSuccess: a,
|
|
1191
|
+
onError: n,
|
|
1192
|
+
language: l = "EN",
|
|
1193
|
+
platform: N = "desktop"
|
|
1132
1194
|
}) => {
|
|
1133
|
-
const [
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
}, []),
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1195
|
+
const [p, f] = y(!1), [m, s] = y(null), [c, d] = y("");
|
|
1196
|
+
ce(() => {
|
|
1197
|
+
D();
|
|
1198
|
+
}, []), ce(() => {
|
|
1199
|
+
const o = (I) => {
|
|
1200
|
+
f(!1), I.detail && I.detail.wallet && (a == null || a(I.detail));
|
|
1139
1201
|
};
|
|
1140
|
-
return window.addEventListener("casperid-login",
|
|
1141
|
-
window.removeEventListener("casperid-login",
|
|
1202
|
+
return window.addEventListener("casperid-login", o), () => {
|
|
1203
|
+
window.removeEventListener("casperid-login", o);
|
|
1142
1204
|
};
|
|
1143
|
-
}, [
|
|
1144
|
-
const
|
|
1145
|
-
const
|
|
1146
|
-
let
|
|
1205
|
+
}, [a]);
|
|
1206
|
+
const D = J(() => {
|
|
1207
|
+
const o = document.getElementById("casperid-draggable-anchor");
|
|
1208
|
+
let I = null;
|
|
1147
1209
|
try {
|
|
1148
|
-
|
|
1210
|
+
I = localStorage.getItem("casperid_user");
|
|
1149
1211
|
} catch {
|
|
1150
1212
|
}
|
|
1151
|
-
return
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1213
|
+
return o || I ? (s(!0), !0) : (setTimeout(() => {
|
|
1214
|
+
const g = document.getElementById("casperid-draggable-anchor");
|
|
1215
|
+
s(!!g);
|
|
1154
1216
|
}, 500), !1);
|
|
1155
|
-
}, []),
|
|
1156
|
-
|
|
1217
|
+
}, []), h = (o) => typeof o == "object" && o !== null && "wallet" in o && typeof o.wallet == "string" && o.wallet.length > 0, A = async () => {
|
|
1218
|
+
f(!0), d("");
|
|
1157
1219
|
try {
|
|
1158
|
-
const
|
|
1159
|
-
if (
|
|
1160
|
-
const
|
|
1161
|
-
if (g
|
|
1162
|
-
|
|
1220
|
+
const I = localStorage.getItem("casperid_user");
|
|
1221
|
+
if (I) {
|
|
1222
|
+
const g = JSON.parse(I);
|
|
1223
|
+
if (h(g)) {
|
|
1224
|
+
f(!1), a == null || a(g);
|
|
1163
1225
|
return;
|
|
1164
1226
|
}
|
|
1165
1227
|
}
|
|
1166
1228
|
} catch {
|
|
1167
1229
|
}
|
|
1168
|
-
const
|
|
1169
|
-
|
|
1170
|
-
|
|
1230
|
+
const o = document.getElementById("casperid-draggable-anchor");
|
|
1231
|
+
o ? (o.click(), setTimeout(() => {
|
|
1232
|
+
f(!1);
|
|
1171
1233
|
try {
|
|
1172
|
-
localStorage.getItem("casperid_user") || d(t("extension_connect_msg",
|
|
1234
|
+
localStorage.getItem("casperid_user") || d(t("extension_connect_msg", l));
|
|
1173
1235
|
} catch {
|
|
1174
|
-
d(t("extension_connect_msg",
|
|
1236
|
+
d(t("extension_connect_msg", l));
|
|
1175
1237
|
}
|
|
1176
|
-
}, 3e3)) : (
|
|
1177
|
-
},
|
|
1238
|
+
}, 3e3)) : (f(!1), d(t("extension_not_detected", l)), n == null || n("Extension not installed"));
|
|
1239
|
+
}, _ = () => {
|
|
1178
1240
|
d(""), r("otp");
|
|
1179
1241
|
};
|
|
1180
|
-
return /* @__PURE__ */
|
|
1181
|
-
|
|
1242
|
+
return /* @__PURE__ */ i(
|
|
1243
|
+
P.div,
|
|
1182
1244
|
{
|
|
1183
1245
|
initial: { opacity: 0, y: 20 },
|
|
1184
1246
|
animate: { opacity: 1, y: 0 },
|
|
1185
1247
|
exit: { opacity: 0, y: -20 },
|
|
1186
1248
|
className: "flex-1 px-8 flex flex-col justify-center gap-8",
|
|
1187
1249
|
children: [
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1250
|
+
/* @__PURE__ */ i("div", { className: "text-center space-y-3", children: [
|
|
1251
|
+
/* @__PURE__ */ i("div", { className: "relative w-24 h-24 mx-auto mb-6", children: [
|
|
1190
1252
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-brand-20 blur-2xl rounded-full" }),
|
|
1191
|
-
/* @__PURE__ */ e("div", { className: "relative w-full h-full glass-container flex items-center justify-center rounded-2xl border border-brand-30", children: /* @__PURE__ */ e(
|
|
1253
|
+
/* @__PURE__ */ e("div", { className: "relative w-full h-full glass-container flex items-center justify-center rounded-2xl border border-brand-30", children: /* @__PURE__ */ e(Ie, { className: "w-10 h-10 text-brand" }) })
|
|
1192
1254
|
] }),
|
|
1193
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-extrabold leading-tight tracking-tight text-main", children: t("welcome_back",
|
|
1194
|
-
/* @__PURE__ */ e("p", { className: "text-muted text-sm leading-relaxed", children: t("auth_subtitle",
|
|
1255
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-extrabold leading-tight tracking-tight text-main", children: t("welcome_back", l) }),
|
|
1256
|
+
/* @__PURE__ */ e("p", { className: "text-muted text-sm leading-relaxed", children: t("auth_subtitle", l) })
|
|
1195
1257
|
] }),
|
|
1196
|
-
|
|
1197
|
-
/* @__PURE__ */ e(
|
|
1198
|
-
/* @__PURE__ */ e("p", { className: "text-red-600 dark:text-red-400 text-sm font-medium", children:
|
|
1258
|
+
c && /* @__PURE__ */ i("div", { className: "flex items-start gap-3 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-2xl", children: [
|
|
1259
|
+
/* @__PURE__ */ e(ve, { className: "w-5 h-5 text-red-500 shrink-0 mt-0.5" }),
|
|
1260
|
+
/* @__PURE__ */ e("p", { className: "text-red-600 dark:text-red-400 text-sm font-medium", children: c })
|
|
1199
1261
|
] }),
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ i("div", { className: "space-y-4", children: [
|
|
1263
|
+
N === "desktop" && /* @__PURE__ */ i(
|
|
1202
1264
|
"button",
|
|
1203
1265
|
{
|
|
1204
|
-
onClick:
|
|
1205
|
-
disabled:
|
|
1266
|
+
onClick: A,
|
|
1267
|
+
disabled: p,
|
|
1206
1268
|
className: "w-full group relative overflow-hidden flex items-center gap-4 bg-brand hover:bg-brand-90 text-white py-5 px-6 rounded-2xl font-bold transition-all transform active:scale-[0.98] disabled:opacity-70 disabled:cursor-not-allowed shadow-brand",
|
|
1207
1269
|
children: [
|
|
1208
|
-
/* @__PURE__ */ e("div", { className: "bg-white/20 p-2 rounded-lg", children:
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
/* @__PURE__ */ e("span", { className: "text-base", children: t(
|
|
1211
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-widest text-white/70", children: t(
|
|
1270
|
+
/* @__PURE__ */ e("div", { className: "bg-white/20 p-2 rounded-lg", children: p ? /* @__PURE__ */ e(_e, { className: "w-5 h-5 animate-spin" }) : /* @__PURE__ */ e(Dt, { className: "w-5 h-5" }) }),
|
|
1271
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col items-start", children: [
|
|
1272
|
+
/* @__PURE__ */ e("span", { className: "text-base", children: t(p ? "connecting" : "sign_in_with_extension", l) }),
|
|
1273
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-widest text-slate-600 dark:text-white/70", children: t(m === !0 ? "extension_detected" : "secure_wallet", l) })
|
|
1212
1274
|
] }),
|
|
1213
|
-
/* @__PURE__ */ e(
|
|
1275
|
+
/* @__PURE__ */ e(Le, { className: "ml-auto w-4 h-4 opacity-50 group-hover:opacity-100 transition-opacity" })
|
|
1214
1276
|
]
|
|
1215
1277
|
}
|
|
1216
1278
|
),
|
|
1217
|
-
/* @__PURE__ */
|
|
1279
|
+
/* @__PURE__ */ i(
|
|
1218
1280
|
"button",
|
|
1219
1281
|
{
|
|
1220
|
-
onClick:
|
|
1221
|
-
disabled:
|
|
1282
|
+
onClick: _,
|
|
1283
|
+
disabled: p,
|
|
1222
1284
|
className: "w-full group relative overflow-hidden flex items-center gap-4 dark:bg-white/5 bg-slate-100/50 hover:dark:bg-white/10 hover:bg-slate-200/80 border dark:border-white/10 border-slate-200 text-main py-5 px-6 rounded-2xl font-bold transition-all transform active:scale-[0.98] disabled:opacity-50",
|
|
1223
1285
|
children: [
|
|
1224
|
-
/* @__PURE__ */ e("div", { className: "bg-brand-10 p-2 rounded-lg", children: /* @__PURE__ */ e(
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
/* @__PURE__ */ e("span", { className: "text-base", children: t("sign_in_with_otp",
|
|
1227
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-widest text-brand font-bold", children: t("two_factor_auth",
|
|
1286
|
+
/* @__PURE__ */ e("div", { className: "bg-brand-10 p-2 rounded-lg", children: /* @__PURE__ */ e(qe, { className: "w-5 h-5 text-brand" }) }),
|
|
1287
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col items-start", children: [
|
|
1288
|
+
/* @__PURE__ */ e("span", { className: "text-base", children: t("sign_in_with_otp", l) }),
|
|
1289
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-widest text-brand font-bold", children: t("two_factor_auth", l) })
|
|
1228
1290
|
] }),
|
|
1229
|
-
/* @__PURE__ */ e(
|
|
1291
|
+
/* @__PURE__ */ e(Le, { className: "ml-auto w-4 h-4 opacity-50 group-hover:opacity-100 transition-opacity" })
|
|
1230
1292
|
]
|
|
1231
1293
|
}
|
|
1232
1294
|
)
|
|
1233
1295
|
] }),
|
|
1234
|
-
/* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
/* @__PURE__ */ e(
|
|
1237
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted", children: t("fully_audited",
|
|
1296
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
1297
|
+
/* @__PURE__ */ i("div", { className: "glass-container p-4 rounded-2xl flex flex-col items-center gap-2 text-center border-slate-200/50", children: [
|
|
1298
|
+
/* @__PURE__ */ e(Se, { className: "w-5 h-5 text-brand" }),
|
|
1299
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted", children: t("fully_audited", l) })
|
|
1238
1300
|
] }),
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
/* @__PURE__ */ e(
|
|
1241
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted", children: t("non_custodial",
|
|
1301
|
+
/* @__PURE__ */ i("div", { className: "glass-container p-4 rounded-2xl flex flex-col items-center gap-2 text-center border-slate-200/50", children: [
|
|
1302
|
+
/* @__PURE__ */ e(Te, { className: "w-5 h-5 text-brand" }),
|
|
1303
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted", children: t("non_custodial", l) })
|
|
1242
1304
|
] })
|
|
1243
1305
|
] })
|
|
1244
1306
|
]
|
|
1245
1307
|
}
|
|
1246
1308
|
);
|
|
1247
|
-
},
|
|
1309
|
+
}, Lt = ({
|
|
1248
1310
|
onNext: r,
|
|
1249
|
-
onPasskeyUser:
|
|
1250
|
-
onError:
|
|
1251
|
-
apiBaseUrl:
|
|
1252
|
-
|
|
1253
|
-
|
|
1311
|
+
onPasskeyUser: a,
|
|
1312
|
+
onError: n,
|
|
1313
|
+
apiBaseUrl: l = "https://apis.casperid.com",
|
|
1314
|
+
apiKey: N = "",
|
|
1315
|
+
previewMode: p = !1,
|
|
1316
|
+
language: f = "EN"
|
|
1254
1317
|
}) => {
|
|
1255
|
-
const [
|
|
1256
|
-
if (!
|
|
1257
|
-
|
|
1318
|
+
const [m, s] = y(""), [c, d] = y(!1), [D, h] = y(""), A = async () => {
|
|
1319
|
+
if (!m.trim()) {
|
|
1320
|
+
h(t("error_email_required", f));
|
|
1258
1321
|
return;
|
|
1259
1322
|
}
|
|
1260
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(
|
|
1261
|
-
|
|
1323
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)) {
|
|
1324
|
+
h(t("error_invalid_email", f));
|
|
1262
1325
|
return;
|
|
1263
1326
|
}
|
|
1264
|
-
if (d(!0),
|
|
1327
|
+
if (d(!0), h(""), p) {
|
|
1265
1328
|
setTimeout(() => {
|
|
1266
|
-
d(!1), r(
|
|
1329
|
+
d(!1), r(m.trim().toLowerCase(), "mock-v-id-123456789");
|
|
1267
1330
|
}, 1e3);
|
|
1268
1331
|
return;
|
|
1269
1332
|
}
|
|
1270
1333
|
try {
|
|
1271
|
-
const
|
|
1334
|
+
const I = await fetch(`${l}/api/auth/send-otp`, {
|
|
1272
1335
|
method: "POST",
|
|
1273
1336
|
headers: {
|
|
1274
|
-
"Content-Type": "application/json"
|
|
1337
|
+
"Content-Type": "application/json",
|
|
1338
|
+
...N ? { "X-App-Id": N } : {}
|
|
1275
1339
|
},
|
|
1276
|
-
body: JSON.stringify({ email:
|
|
1340
|
+
body: JSON.stringify({ email: m.trim().toLowerCase() })
|
|
1277
1341
|
});
|
|
1278
|
-
if (!
|
|
1279
|
-
const
|
|
1280
|
-
throw new Error(
|
|
1342
|
+
if (!I.ok) {
|
|
1343
|
+
const k = await I.json().catch(() => ({}));
|
|
1344
|
+
throw new Error(k.error || `Request failed with status ${I.status}`);
|
|
1281
1345
|
}
|
|
1282
|
-
const
|
|
1283
|
-
if (
|
|
1284
|
-
if (
|
|
1285
|
-
|
|
1346
|
+
const g = await I.json();
|
|
1347
|
+
if (g.success) {
|
|
1348
|
+
if (g.userExists && g.hasPasskey) {
|
|
1349
|
+
a ? a(m.trim().toLowerCase()) : h(t("error_passkey_registered", f)), d(!1);
|
|
1286
1350
|
return;
|
|
1287
1351
|
}
|
|
1288
|
-
|
|
1352
|
+
g.verificationId ? r(m.trim().toLowerCase(), g.verificationId) : h(t("error_send_code_failed", f));
|
|
1289
1353
|
} else
|
|
1290
|
-
g
|
|
1354
|
+
h(g.error || t("error_send_code_failed", f)), n == null || n(g.error || t("error_send_code_failed", f));
|
|
1291
1355
|
} catch {
|
|
1292
|
-
const
|
|
1293
|
-
g
|
|
1356
|
+
const g = t("error_connection_failed", f);
|
|
1357
|
+
h(g), n == null || n(g);
|
|
1294
1358
|
} finally {
|
|
1295
1359
|
d(!1);
|
|
1296
1360
|
}
|
|
1297
|
-
},
|
|
1298
|
-
|
|
1361
|
+
}, _ = (o) => {
|
|
1362
|
+
o.key === "Enter" && !c && A();
|
|
1299
1363
|
};
|
|
1300
|
-
return /* @__PURE__ */
|
|
1301
|
-
|
|
1364
|
+
return /* @__PURE__ */ i(
|
|
1365
|
+
P.div,
|
|
1302
1366
|
{
|
|
1303
1367
|
initial: { opacity: 0, x: 20 },
|
|
1304
1368
|
animate: { opacity: 1, x: 0 },
|
|
1305
1369
|
exit: { opacity: 0, x: -20 },
|
|
1306
1370
|
className: "flex-1 flex flex-col px-8 pt-12",
|
|
1307
1371
|
children: [
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */ e("h2", { className: "text-3xl font-extrabold text-main tracking-tight leading-tight", children: t("welcome_back",
|
|
1310
|
-
/* @__PURE__ */ e("p", { className: "text-muted mt-3 text-sm leading-relaxed", children: t("enter_email",
|
|
1372
|
+
/* @__PURE__ */ i("div", { className: "mb-8", children: [
|
|
1373
|
+
/* @__PURE__ */ e("h2", { className: "text-3xl font-extrabold text-main tracking-tight leading-tight", children: t("welcome_back", f) }),
|
|
1374
|
+
/* @__PURE__ */ e("p", { className: "text-muted mt-3 text-sm leading-relaxed", children: t("enter_email", f) })
|
|
1311
1375
|
] }),
|
|
1312
|
-
/* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */ e("label", { className: "text-xs font-bold text-slate-500 uppercase tracking-widest ml-1", children: t("email_address",
|
|
1315
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ i("div", { className: "space-y-6", children: [
|
|
1377
|
+
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
1378
|
+
/* @__PURE__ */ e("label", { className: "text-xs font-bold text-slate-500 uppercase tracking-widest ml-1", children: t("email_address", f) }),
|
|
1379
|
+
/* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1316
1380
|
/* @__PURE__ */ e(
|
|
1317
1381
|
"input",
|
|
1318
1382
|
{
|
|
1319
|
-
className: `w-full dark:bg-black/20 bg-slate-100/50 border ${
|
|
1383
|
+
className: `w-full dark:bg-black/20 bg-slate-100/50 border ${D ? "border-red-400 dark:border-red-500" : "dark:border-white/10 border-slate-200"} rounded-2xl h-14 px-5 text-main placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-brand-30 transition-all font-medium`,
|
|
1320
1384
|
placeholder: "name@example.com",
|
|
1321
1385
|
type: "email",
|
|
1322
|
-
value:
|
|
1323
|
-
onChange: (
|
|
1324
|
-
|
|
1386
|
+
value: m,
|
|
1387
|
+
onChange: (o) => {
|
|
1388
|
+
s(o.target.value), D && h("");
|
|
1325
1389
|
},
|
|
1326
|
-
onKeyDown:
|
|
1327
|
-
disabled:
|
|
1390
|
+
onKeyDown: _,
|
|
1391
|
+
disabled: c,
|
|
1328
1392
|
autoComplete: "email",
|
|
1329
1393
|
autoFocus: !0
|
|
1330
1394
|
}
|
|
1331
1395
|
),
|
|
1332
|
-
/* @__PURE__ */ e("div", { className: "absolute right-4 top-1/2 -translate-y-1/2 flex items-center text-slate-400", children: /* @__PURE__ */ e(
|
|
1396
|
+
/* @__PURE__ */ e("div", { className: "absolute right-4 top-1/2 -translate-y-1/2 flex items-center text-slate-400", children: /* @__PURE__ */ e(St, { className: "w-5 h-5" }) })
|
|
1333
1397
|
] }),
|
|
1334
|
-
|
|
1398
|
+
D && /* @__PURE__ */ e("p", { className: "text-red-500 text-xs font-medium ml-1 mt-1", children: D })
|
|
1335
1399
|
] }),
|
|
1336
1400
|
/* @__PURE__ */ e(
|
|
1337
1401
|
"button",
|
|
1338
1402
|
{
|
|
1339
|
-
onClick:
|
|
1340
|
-
disabled:
|
|
1403
|
+
onClick: A,
|
|
1404
|
+
disabled: c,
|
|
1341
1405
|
className: "w-full h-14 bg-brand hover:bg-brand/90 text-white font-bold rounded-2xl shadow-xl shadow-brand flex items-center justify-center gap-2 transition-transform active:scale-[0.98] disabled:opacity-70 disabled:cursor-not-allowed",
|
|
1342
|
-
children:
|
|
1343
|
-
/* @__PURE__ */ e(
|
|
1344
|
-
/* @__PURE__ */ e("span", { children: t("sending_code",
|
|
1345
|
-
] }) : /* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */ e("span", { children: t("continue",
|
|
1347
|
-
/* @__PURE__ */ e(
|
|
1406
|
+
children: c ? /* @__PURE__ */ i(re, { children: [
|
|
1407
|
+
/* @__PURE__ */ e(_e, { className: "w-5 h-5 animate-spin" }),
|
|
1408
|
+
/* @__PURE__ */ e("span", { children: t("sending_code", f) })
|
|
1409
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
1410
|
+
/* @__PURE__ */ e("span", { children: t("continue", f) }),
|
|
1411
|
+
/* @__PURE__ */ e(Oe, { className: "w-5 h-5" })
|
|
1348
1412
|
] })
|
|
1349
1413
|
}
|
|
1350
1414
|
)
|
|
1351
1415
|
] }),
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */ e("div", { className: "p-4 dark:bg-white/5 bg-slate-100/50 rounded-2xl mb-6", children: /* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */ e(
|
|
1355
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted leading-normal font-medium", children: t("security_notice",
|
|
1416
|
+
/* @__PURE__ */ i("div", { className: "mt-auto pb-8", children: [
|
|
1417
|
+
/* @__PURE__ */ e("div", { className: "p-4 dark:bg-white/5 bg-slate-100/50 rounded-2xl mb-6", children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
1418
|
+
/* @__PURE__ */ e(Fe, { className: "text-[#6DE8EC] w-5 h-5 mt-0.5 shrink-0" }),
|
|
1419
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted leading-normal font-medium", children: t("security_notice", f) })
|
|
1356
1420
|
] }) }),
|
|
1357
|
-
/* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */ e(
|
|
1359
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-[0.2em] font-bold text-muted", children: t("e2e_encrypted",
|
|
1421
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-center gap-2 opacity-50", children: [
|
|
1422
|
+
/* @__PURE__ */ e(tt, { className: "text-muted w-3 h-3" }),
|
|
1423
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-[0.2em] font-bold text-muted", children: t("e2e_encrypted", f) })
|
|
1360
1424
|
] })
|
|
1361
1425
|
] })
|
|
1362
1426
|
]
|
|
1363
1427
|
}
|
|
1364
1428
|
);
|
|
1365
1429
|
};
|
|
1366
|
-
function
|
|
1367
|
-
const
|
|
1368
|
-
let
|
|
1369
|
-
for (let
|
|
1370
|
-
|
|
1371
|
-
return btoa(
|
|
1430
|
+
function xe(r) {
|
|
1431
|
+
const a = new Uint8Array(r);
|
|
1432
|
+
let n = "";
|
|
1433
|
+
for (let l = 0; l < a.byteLength; l++)
|
|
1434
|
+
n += String.fromCharCode(a[l]);
|
|
1435
|
+
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
1372
1436
|
}
|
|
1373
|
-
function
|
|
1374
|
-
const
|
|
1375
|
-
for (let
|
|
1376
|
-
|
|
1377
|
-
return
|
|
1437
|
+
function Ne(r) {
|
|
1438
|
+
const a = "=".repeat((4 - r.length % 4) % 4), n = r.replace(/-/g, "+").replace(/_/g, "/") + a, l = atob(n), N = new Uint8Array(l.length);
|
|
1439
|
+
for (let p = 0; p < l.length; p++)
|
|
1440
|
+
N[p] = l.charCodeAt(p);
|
|
1441
|
+
return N.buffer;
|
|
1378
1442
|
}
|
|
1379
|
-
function
|
|
1443
|
+
function Ee() {
|
|
1380
1444
|
return !!(window.PublicKeyCredential && typeof window.PublicKeyCredential == "function");
|
|
1381
1445
|
}
|
|
1382
|
-
async function
|
|
1383
|
-
if (!
|
|
1446
|
+
async function at() {
|
|
1447
|
+
if (!Ee()) return !1;
|
|
1384
1448
|
try {
|
|
1385
1449
|
return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();
|
|
1386
1450
|
} catch {
|
|
1387
1451
|
return !1;
|
|
1388
1452
|
}
|
|
1389
1453
|
}
|
|
1390
|
-
function
|
|
1454
|
+
function Ot() {
|
|
1391
1455
|
const r = navigator.userAgent.toLowerCase();
|
|
1392
1456
|
return /iphone|ipod|android.*mobile|windows phone|blackberry/i.test(r) ? "mobile" : /ipad|android(?!.*mobile)|tablet/i.test(r) ? "tablet" : "desktop";
|
|
1393
1457
|
}
|
|
1394
|
-
function
|
|
1458
|
+
function Ft() {
|
|
1395
1459
|
return {
|
|
1396
1460
|
platform: navigator.platform || "unknown",
|
|
1397
1461
|
userAgent: navigator.userAgent,
|
|
1398
|
-
deviceType:
|
|
1462
|
+
deviceType: Ot()
|
|
1399
1463
|
};
|
|
1400
1464
|
}
|
|
1401
|
-
function
|
|
1402
|
-
var
|
|
1465
|
+
function qt(r) {
|
|
1466
|
+
var a;
|
|
1403
1467
|
return {
|
|
1404
1468
|
...r,
|
|
1405
|
-
challenge:
|
|
1469
|
+
challenge: Ne(r.challenge),
|
|
1406
1470
|
user: {
|
|
1407
1471
|
...r.user,
|
|
1408
|
-
id:
|
|
1472
|
+
id: Ne(r.user.id)
|
|
1409
1473
|
},
|
|
1410
|
-
excludeCredentials: (
|
|
1411
|
-
...
|
|
1412
|
-
id:
|
|
1474
|
+
excludeCredentials: (a = r.excludeCredentials) == null ? void 0 : a.map((n) => ({
|
|
1475
|
+
...n,
|
|
1476
|
+
id: Ne(n.id)
|
|
1413
1477
|
}))
|
|
1414
1478
|
};
|
|
1415
1479
|
}
|
|
1416
|
-
function
|
|
1417
|
-
var
|
|
1480
|
+
function Ut(r) {
|
|
1481
|
+
var a;
|
|
1418
1482
|
return {
|
|
1419
1483
|
...r,
|
|
1420
|
-
challenge:
|
|
1421
|
-
allowCredentials: (
|
|
1422
|
-
...
|
|
1423
|
-
id:
|
|
1484
|
+
challenge: Ne(r.challenge),
|
|
1485
|
+
allowCredentials: (a = r.allowCredentials) == null ? void 0 : a.map((n) => ({
|
|
1486
|
+
...n,
|
|
1487
|
+
id: Ne(n.id)
|
|
1424
1488
|
}))
|
|
1425
1489
|
};
|
|
1426
1490
|
}
|
|
1427
|
-
function
|
|
1428
|
-
const
|
|
1491
|
+
function $t(r) {
|
|
1492
|
+
const a = r.response;
|
|
1429
1493
|
return {
|
|
1430
1494
|
id: r.id,
|
|
1431
|
-
rawId:
|
|
1495
|
+
rawId: xe(r.rawId),
|
|
1432
1496
|
type: r.type,
|
|
1433
1497
|
response: {
|
|
1434
|
-
clientDataJSON:
|
|
1435
|
-
attestationObject:
|
|
1498
|
+
clientDataJSON: xe(a.clientDataJSON),
|
|
1499
|
+
attestationObject: xe(a.attestationObject)
|
|
1436
1500
|
},
|
|
1437
1501
|
clientExtensionResults: r.getClientExtensionResults(),
|
|
1438
|
-
deviceInfo:
|
|
1502
|
+
deviceInfo: Ft()
|
|
1439
1503
|
};
|
|
1440
1504
|
}
|
|
1441
|
-
function
|
|
1442
|
-
const
|
|
1505
|
+
function Bt(r) {
|
|
1506
|
+
const a = r.response;
|
|
1443
1507
|
return {
|
|
1444
1508
|
id: r.id,
|
|
1445
|
-
rawId:
|
|
1509
|
+
rawId: xe(r.rawId),
|
|
1446
1510
|
type: r.type,
|
|
1447
1511
|
response: {
|
|
1448
|
-
clientDataJSON:
|
|
1449
|
-
authenticatorData:
|
|
1450
|
-
signature:
|
|
1451
|
-
userHandle:
|
|
1512
|
+
clientDataJSON: xe(a.clientDataJSON),
|
|
1513
|
+
authenticatorData: xe(a.authenticatorData),
|
|
1514
|
+
signature: xe(a.signature),
|
|
1515
|
+
userHandle: a.userHandle ? xe(a.userHandle) : null
|
|
1452
1516
|
},
|
|
1453
1517
|
clientExtensionResults: r.getClientExtensionResults()
|
|
1454
1518
|
};
|
|
1455
1519
|
}
|
|
1456
|
-
async function
|
|
1457
|
-
if (!
|
|
1520
|
+
async function Ht(r) {
|
|
1521
|
+
if (!Ee())
|
|
1458
1522
|
throw new Error("WebAuthn is not supported in this browser");
|
|
1459
|
-
const
|
|
1460
|
-
publicKey:
|
|
1523
|
+
const a = qt(r), n = await navigator.credentials.create({
|
|
1524
|
+
publicKey: a
|
|
1461
1525
|
});
|
|
1462
|
-
if (!
|
|
1526
|
+
if (!n)
|
|
1463
1527
|
throw new Error("Passkey creation was cancelled or failed");
|
|
1464
|
-
return
|
|
1528
|
+
return $t(n);
|
|
1465
1529
|
}
|
|
1466
|
-
async function
|
|
1467
|
-
if (!
|
|
1530
|
+
async function Wt(r) {
|
|
1531
|
+
if (!Ee())
|
|
1468
1532
|
throw new Error("WebAuthn is not supported in this browser");
|
|
1469
|
-
const
|
|
1470
|
-
publicKey:
|
|
1533
|
+
const a = Ut(r), n = await navigator.credentials.get({
|
|
1534
|
+
publicKey: a
|
|
1471
1535
|
});
|
|
1472
|
-
if (!
|
|
1536
|
+
if (!n)
|
|
1473
1537
|
throw new Error("Passkey authentication was cancelled or failed");
|
|
1474
|
-
return
|
|
1538
|
+
return Bt(n);
|
|
1475
1539
|
}
|
|
1476
|
-
const
|
|
1540
|
+
const Yt = ({
|
|
1477
1541
|
email: r,
|
|
1478
|
-
onSuccess:
|
|
1479
|
-
onError:
|
|
1480
|
-
onFallbackToOTP:
|
|
1481
|
-
apiBaseUrl:
|
|
1482
|
-
|
|
1483
|
-
|
|
1542
|
+
onSuccess: a,
|
|
1543
|
+
onError: n,
|
|
1544
|
+
onFallbackToOTP: l,
|
|
1545
|
+
apiBaseUrl: N = "https://apis.casperid.com",
|
|
1546
|
+
apiKey: p = "",
|
|
1547
|
+
previewMode: f = !1,
|
|
1548
|
+
language: m = "EN"
|
|
1484
1549
|
}) => {
|
|
1485
|
-
const [
|
|
1486
|
-
|
|
1550
|
+
const [s, c] = y(!1), [d, D] = y(""), [h, A] = y(!0), [_, o] = y(!1);
|
|
1551
|
+
ce(() => {
|
|
1487
1552
|
(async () => {
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1553
|
+
const k = Ee(), V = await at();
|
|
1554
|
+
A(k && V), (!k || !V) && D(t("webauthn_not_supported", m));
|
|
1490
1555
|
})();
|
|
1491
|
-
}, [
|
|
1492
|
-
if (
|
|
1493
|
-
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1556
|
+
}, [m]), ce(() => {
|
|
1557
|
+
if (h && !_ && !f) {
|
|
1558
|
+
o(!0);
|
|
1559
|
+
const g = setTimeout(() => {
|
|
1560
|
+
I();
|
|
1496
1561
|
}, 500);
|
|
1497
|
-
return () => clearTimeout(
|
|
1562
|
+
return () => clearTimeout(g);
|
|
1498
1563
|
}
|
|
1499
|
-
}, [
|
|
1500
|
-
const
|
|
1501
|
-
if (!
|
|
1502
|
-
if (
|
|
1564
|
+
}, [h, _, f]);
|
|
1565
|
+
const I = async () => {
|
|
1566
|
+
if (!s) {
|
|
1567
|
+
if (c(!0), D(""), f) {
|
|
1503
1568
|
setTimeout(() => {
|
|
1504
|
-
|
|
1569
|
+
c(!1), a("mock-session-token", {
|
|
1505
1570
|
user_id: "mock-user-id",
|
|
1506
1571
|
email: r,
|
|
1507
1572
|
tier: "layer_1"
|
|
@@ -1510,138 +1575,146 @@ const $t = ({
|
|
|
1510
1575
|
return;
|
|
1511
1576
|
}
|
|
1512
1577
|
try {
|
|
1513
|
-
const
|
|
1578
|
+
const g = await fetch(`${N}/api/passkey/auth/begin`, {
|
|
1514
1579
|
method: "POST",
|
|
1515
|
-
headers: {
|
|
1580
|
+
headers: {
|
|
1581
|
+
"Content-Type": "application/json",
|
|
1582
|
+
...p ? { "X-App-Id": p } : {}
|
|
1583
|
+
},
|
|
1516
1584
|
credentials: "include",
|
|
1517
1585
|
body: JSON.stringify({ email: r })
|
|
1518
1586
|
});
|
|
1519
|
-
if (!
|
|
1520
|
-
const
|
|
1521
|
-
throw new Error(
|
|
1587
|
+
if (!g.ok) {
|
|
1588
|
+
const Y = await g.json().catch(() => ({}));
|
|
1589
|
+
throw new Error(Y.error || "Failed to initialize authentication");
|
|
1522
1590
|
}
|
|
1523
|
-
const
|
|
1524
|
-
if (!
|
|
1525
|
-
throw new Error(
|
|
1526
|
-
const
|
|
1591
|
+
const k = await g.json();
|
|
1592
|
+
if (!k.success || !k.options)
|
|
1593
|
+
throw new Error(k.error || "Invalid authentication options");
|
|
1594
|
+
const V = await Wt(k.options), w = await fetch(`${N}/api/passkey/auth/finish`, {
|
|
1527
1595
|
method: "POST",
|
|
1528
|
-
headers: {
|
|
1596
|
+
headers: {
|
|
1597
|
+
"Content-Type": "application/json",
|
|
1598
|
+
...p ? { "X-App-Id": p } : {}
|
|
1599
|
+
},
|
|
1529
1600
|
credentials: "include",
|
|
1530
1601
|
body: JSON.stringify({
|
|
1531
1602
|
email: r,
|
|
1532
|
-
|
|
1603
|
+
challengeId: k.challengeId,
|
|
1604
|
+
credential: V
|
|
1533
1605
|
})
|
|
1534
1606
|
});
|
|
1535
|
-
if (!
|
|
1536
|
-
const
|
|
1537
|
-
throw new Error(
|
|
1607
|
+
if (!w.ok) {
|
|
1608
|
+
const Y = await w.json().catch(() => ({}));
|
|
1609
|
+
throw new Error(Y.error || "Authentication failed");
|
|
1538
1610
|
}
|
|
1539
|
-
const
|
|
1540
|
-
if (
|
|
1541
|
-
|
|
1611
|
+
const T = await w.json();
|
|
1612
|
+
if (T.success && T.session_token)
|
|
1613
|
+
a(T.session_token, T.user, T.business_token);
|
|
1542
1614
|
else
|
|
1543
|
-
throw new Error(
|
|
1544
|
-
} catch (
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1615
|
+
throw new Error(T.error || "Authentication failed");
|
|
1616
|
+
} catch (g) {
|
|
1617
|
+
const k = g instanceof Error ? g.message : "Authentication failed";
|
|
1618
|
+
k.includes("cancelled") || k.includes("NotAllowedError") ? D(t("passkey_cancelled", m)) : (D(k), n == null || n(k));
|
|
1547
1619
|
} finally {
|
|
1548
|
-
|
|
1620
|
+
c(!1);
|
|
1549
1621
|
}
|
|
1550
1622
|
}
|
|
1551
1623
|
};
|
|
1552
|
-
return /* @__PURE__ */
|
|
1553
|
-
|
|
1624
|
+
return /* @__PURE__ */ i(
|
|
1625
|
+
P.div,
|
|
1554
1626
|
{
|
|
1555
1627
|
initial: { opacity: 0, x: 20 },
|
|
1556
1628
|
animate: { opacity: 1, x: 0 },
|
|
1557
1629
|
exit: { opacity: 0, x: -20 },
|
|
1558
1630
|
className: "flex-1 flex flex-col px-8 pt-12",
|
|
1559
1631
|
children: [
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */ e("h2", { className: "text-3xl font-extrabold text-main tracking-tight leading-tight", children: t("welcome_back",
|
|
1562
|
-
/* @__PURE__ */ e("p", { className: "text-muted mt-3 text-sm leading-relaxed", children: t("passkey_auth_subtitle",
|
|
1632
|
+
/* @__PURE__ */ i("div", { className: "mb-8", children: [
|
|
1633
|
+
/* @__PURE__ */ e("h2", { className: "text-3xl font-extrabold text-main tracking-tight leading-tight", children: t("welcome_back", m) }),
|
|
1634
|
+
/* @__PURE__ */ e("p", { className: "text-muted mt-3 text-sm leading-relaxed", children: t("passkey_auth_subtitle", m) })
|
|
1563
1635
|
] }),
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted mb-1", children: t("signing_in_as",
|
|
1636
|
+
/* @__PURE__ */ i("div", { className: "mb-6 p-4 dark:bg-white/5 bg-slate-100/50 rounded-2xl", children: [
|
|
1637
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted mb-1", children: t("signing_in_as", m) }),
|
|
1566
1638
|
/* @__PURE__ */ e("p", { className: "text-main font-semibold", children: r })
|
|
1567
1639
|
] }),
|
|
1568
|
-
/* @__PURE__ */
|
|
1640
|
+
/* @__PURE__ */ i("div", { className: "flex-1 flex flex-col items-center justify-center py-8", children: [
|
|
1569
1641
|
/* @__PURE__ */ e(
|
|
1570
|
-
|
|
1642
|
+
P.div,
|
|
1571
1643
|
{
|
|
1572
|
-
animate:
|
|
1644
|
+
animate: s ? {
|
|
1573
1645
|
scale: [1, 1.1, 1],
|
|
1574
1646
|
opacity: [1, 0.7, 1]
|
|
1575
1647
|
} : {},
|
|
1576
1648
|
transition: {
|
|
1577
1649
|
duration: 1.5,
|
|
1578
|
-
repeat:
|
|
1650
|
+
repeat: s ? 1 / 0 : 0,
|
|
1579
1651
|
ease: "easeInOut"
|
|
1580
1652
|
},
|
|
1581
|
-
className: `w-24 h-24 rounded-full flex items-center justify-center mb-6 ${
|
|
1582
|
-
children:
|
|
1653
|
+
className: `w-24 h-24 rounded-full flex items-center justify-center mb-6 ${s ? "bg-brand/20 border-2 border-brand" : d ? "bg-red-500/10 border-2 border-red-400" : "bg-brand/10 border-2 border-brand/30"}`,
|
|
1654
|
+
children: s ? /* @__PURE__ */ e(_e, { className: "w-10 h-10 text-brand animate-spin" }) : d ? /* @__PURE__ */ e(ve, { className: "w-10 h-10 text-red-400" }) : /* @__PURE__ */ e(Ie, { className: "w-10 h-10 text-brand" })
|
|
1583
1655
|
}
|
|
1584
1656
|
),
|
|
1585
|
-
/* @__PURE__ */ e("p", { className: "text-main font-semibold text-center mb-2", children: t(
|
|
1657
|
+
/* @__PURE__ */ e("p", { className: "text-main font-semibold text-center mb-2", children: t(s ? "authenticating" : d ? "authentication_failed" : "use_passkey", m) }),
|
|
1586
1658
|
d && /* @__PURE__ */ e("p", { className: "text-red-500 text-sm text-center mb-4 max-w-xs", children: d }),
|
|
1587
|
-
!
|
|
1659
|
+
!s && /* @__PURE__ */ e("p", { className: "text-muted text-sm text-center max-w-xs", children: t("passkey_auth_hint", m) })
|
|
1588
1660
|
] }),
|
|
1589
|
-
/* @__PURE__ */
|
|
1590
|
-
!
|
|
1661
|
+
/* @__PURE__ */ i("div", { className: "space-y-3 pb-8", children: [
|
|
1662
|
+
!s && /* @__PURE__ */ e(
|
|
1591
1663
|
"button",
|
|
1592
1664
|
{
|
|
1593
|
-
onClick:
|
|
1594
|
-
disabled: !
|
|
1665
|
+
onClick: I,
|
|
1666
|
+
disabled: !h,
|
|
1595
1667
|
className: "w-full h-14 bg-brand hover:bg-brand/90 text-white font-bold rounded-2xl shadow-xl shadow-brand/30 flex items-center justify-center gap-2 transition-transform active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1596
|
-
children: d ? /* @__PURE__ */
|
|
1597
|
-
/* @__PURE__ */ e(
|
|
1598
|
-
/* @__PURE__ */ e("span", { children: t("try_again",
|
|
1599
|
-
] }) : /* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */ e(
|
|
1601
|
-
/* @__PURE__ */ e("span", { children: t("authenticate",
|
|
1668
|
+
children: d ? /* @__PURE__ */ i(re, { children: [
|
|
1669
|
+
/* @__PURE__ */ e(Te, { className: "w-5 h-5" }),
|
|
1670
|
+
/* @__PURE__ */ e("span", { children: t("try_again", m) })
|
|
1671
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
1672
|
+
/* @__PURE__ */ e(Ie, { className: "w-5 h-5" }),
|
|
1673
|
+
/* @__PURE__ */ e("span", { children: t("authenticate", m) })
|
|
1602
1674
|
] })
|
|
1603
1675
|
}
|
|
1604
1676
|
),
|
|
1605
|
-
|
|
1677
|
+
l && /* @__PURE__ */ e(
|
|
1606
1678
|
"button",
|
|
1607
1679
|
{
|
|
1608
|
-
onClick:
|
|
1609
|
-
disabled:
|
|
1680
|
+
onClick: l,
|
|
1681
|
+
disabled: s,
|
|
1610
1682
|
className: "w-full h-12 bg-transparent border dark:border-white/10 border-slate-200 text-muted hover:text-main font-medium rounded-2xl flex items-center justify-center gap-2 transition-colors disabled:opacity-50",
|
|
1611
|
-
children: t("use_email_instead",
|
|
1683
|
+
children: t("use_email_instead", m)
|
|
1612
1684
|
}
|
|
1613
1685
|
)
|
|
1614
1686
|
] }),
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
/* @__PURE__ */ e(
|
|
1617
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-[0.2em] font-bold text-muted", children: t("biometric_secured",
|
|
1687
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-center gap-2 pb-4 opacity-50", children: [
|
|
1688
|
+
/* @__PURE__ */ e(Se, { className: "text-muted w-3 h-3" }),
|
|
1689
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-[0.2em] font-bold text-muted", children: t("biometric_secured", m) })
|
|
1618
1690
|
] })
|
|
1619
1691
|
]
|
|
1620
1692
|
}
|
|
1621
1693
|
);
|
|
1622
|
-
},
|
|
1694
|
+
}, Gt = ({
|
|
1623
1695
|
email: r,
|
|
1624
|
-
sessionToken:
|
|
1625
|
-
onSuccess:
|
|
1626
|
-
onError:
|
|
1627
|
-
onSkip:
|
|
1628
|
-
apiBaseUrl:
|
|
1629
|
-
|
|
1630
|
-
|
|
1696
|
+
sessionToken: a,
|
|
1697
|
+
onSuccess: n,
|
|
1698
|
+
onError: l,
|
|
1699
|
+
onSkip: N,
|
|
1700
|
+
apiBaseUrl: p = "https://apis.casperid.com",
|
|
1701
|
+
apiKey: f = "",
|
|
1702
|
+
previewMode: m = !1,
|
|
1703
|
+
language: s = "EN"
|
|
1631
1704
|
}) => {
|
|
1632
|
-
const [
|
|
1633
|
-
|
|
1705
|
+
const [c, d] = y(!1), [D, h] = y(""), [A, _] = y(!0), [o, I] = y(!1);
|
|
1706
|
+
ce(() => {
|
|
1634
1707
|
(async () => {
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1708
|
+
const w = Ee(), T = await at();
|
|
1709
|
+
_(w && T), (!w || !T) && h(t("webauthn_not_supported", s));
|
|
1637
1710
|
})();
|
|
1638
|
-
}, [
|
|
1639
|
-
const
|
|
1640
|
-
if (!
|
|
1641
|
-
if (d(!0),
|
|
1711
|
+
}, [s]);
|
|
1712
|
+
const g = async () => {
|
|
1713
|
+
if (!c) {
|
|
1714
|
+
if (d(!0), h(""), m) {
|
|
1642
1715
|
setTimeout(() => {
|
|
1643
|
-
d(!1),
|
|
1644
|
-
|
|
1716
|
+
d(!1), I(!0), setTimeout(() => {
|
|
1717
|
+
n({
|
|
1645
1718
|
user_id: "mock-user-id",
|
|
1646
1719
|
email: r,
|
|
1647
1720
|
tier: "layer_0"
|
|
@@ -1651,333 +1724,335 @@ const $t = ({
|
|
|
1651
1724
|
return;
|
|
1652
1725
|
}
|
|
1653
1726
|
try {
|
|
1654
|
-
const
|
|
1727
|
+
const V = await fetch(`${p}/api/passkey/register/begin`, {
|
|
1655
1728
|
method: "POST",
|
|
1656
1729
|
headers: {
|
|
1657
1730
|
"Content-Type": "application/json",
|
|
1658
|
-
Authorization: `Bearer ${
|
|
1731
|
+
Authorization: `Bearer ${a}`,
|
|
1732
|
+
...f ? { "X-App-Id": f } : {}
|
|
1659
1733
|
},
|
|
1660
1734
|
credentials: "include",
|
|
1661
1735
|
body: JSON.stringify({ email: r })
|
|
1662
1736
|
});
|
|
1663
|
-
if (!
|
|
1664
|
-
const
|
|
1665
|
-
throw new Error(
|
|
1737
|
+
if (!V.ok) {
|
|
1738
|
+
const B = await V.json().catch(() => ({}));
|
|
1739
|
+
throw new Error(B.error || "Failed to initialize registration");
|
|
1666
1740
|
}
|
|
1667
|
-
const
|
|
1668
|
-
if (!
|
|
1669
|
-
throw new Error(
|
|
1670
|
-
const
|
|
1741
|
+
const w = await V.json();
|
|
1742
|
+
if (!w.success || !w.options)
|
|
1743
|
+
throw new Error(w.error || "Invalid registration options");
|
|
1744
|
+
const T = await Ht(w.options), Y = await fetch(`${p}/api/passkey/register/finish`, {
|
|
1671
1745
|
method: "POST",
|
|
1672
1746
|
headers: {
|
|
1673
1747
|
"Content-Type": "application/json",
|
|
1674
|
-
Authorization: `Bearer ${
|
|
1748
|
+
Authorization: `Bearer ${a}`,
|
|
1749
|
+
...f ? { "X-App-Id": f } : {}
|
|
1675
1750
|
},
|
|
1676
1751
|
credentials: "include",
|
|
1677
1752
|
body: JSON.stringify({
|
|
1678
|
-
userId:
|
|
1679
|
-
credential:
|
|
1753
|
+
userId: w.userId,
|
|
1754
|
+
credential: T,
|
|
1680
1755
|
deviceInfo: {
|
|
1681
1756
|
userAgent: navigator.userAgent
|
|
1682
1757
|
}
|
|
1683
1758
|
})
|
|
1684
1759
|
});
|
|
1685
|
-
if (!
|
|
1686
|
-
const
|
|
1687
|
-
throw new Error(
|
|
1760
|
+
if (!Y.ok) {
|
|
1761
|
+
const B = await Y.json().catch(() => ({}));
|
|
1762
|
+
throw new Error(B.error || "Registration failed");
|
|
1688
1763
|
}
|
|
1689
|
-
const
|
|
1690
|
-
if (
|
|
1691
|
-
|
|
1692
|
-
|
|
1764
|
+
const W = await Y.json();
|
|
1765
|
+
if (W.success)
|
|
1766
|
+
I(!0), setTimeout(() => {
|
|
1767
|
+
n(W.user, W.business_token);
|
|
1693
1768
|
}, 1e3);
|
|
1694
1769
|
else
|
|
1695
|
-
throw new Error(
|
|
1696
|
-
} catch (
|
|
1697
|
-
const
|
|
1698
|
-
|
|
1770
|
+
throw new Error(W.error || "Registration failed");
|
|
1771
|
+
} catch (V) {
|
|
1772
|
+
const w = V instanceof Error ? V.message : "Registration failed";
|
|
1773
|
+
w.includes("cancelled") || w.includes("NotAllowedError") ? h(t("passkey_cancelled", s)) : (h(w), l == null || l(w));
|
|
1699
1774
|
} finally {
|
|
1700
1775
|
d(!1);
|
|
1701
1776
|
}
|
|
1702
1777
|
}
|
|
1703
|
-
},
|
|
1704
|
-
{ icon:
|
|
1705
|
-
{ icon:
|
|
1706
|
-
{ icon:
|
|
1778
|
+
}, k = [
|
|
1779
|
+
{ icon: Ct, text: t("passkey_benefit_1", s) },
|
|
1780
|
+
{ icon: Se, text: t("passkey_benefit_2", s) },
|
|
1781
|
+
{ icon: qe, text: t("passkey_benefit_3", s) }
|
|
1707
1782
|
];
|
|
1708
|
-
return /* @__PURE__ */
|
|
1709
|
-
|
|
1783
|
+
return /* @__PURE__ */ i(
|
|
1784
|
+
P.div,
|
|
1710
1785
|
{
|
|
1711
1786
|
initial: { opacity: 0, x: 20 },
|
|
1712
1787
|
animate: { opacity: 1, x: 0 },
|
|
1713
1788
|
exit: { opacity: 0, x: -20 },
|
|
1714
1789
|
className: "flex-1 flex flex-col px-8 pt-12",
|
|
1715
1790
|
children: [
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */ e("h2", { className: "text-3xl font-extrabold text-main tracking-tight leading-tight", children: t("create_passkey",
|
|
1718
|
-
/* @__PURE__ */ e("p", { className: "text-muted mt-3 text-sm leading-relaxed", children: t("passkey_register_subtitle",
|
|
1791
|
+
/* @__PURE__ */ i("div", { className: "mb-8", children: [
|
|
1792
|
+
/* @__PURE__ */ e("h2", { className: "text-3xl font-extrabold text-main tracking-tight leading-tight", children: t("create_passkey", s) }),
|
|
1793
|
+
/* @__PURE__ */ e("p", { className: "text-muted mt-3 text-sm leading-relaxed", children: t("passkey_register_subtitle", s) })
|
|
1719
1794
|
] }),
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted mb-1", children: t("signing_in_as",
|
|
1795
|
+
/* @__PURE__ */ i("div", { className: "mb-6 p-4 dark:bg-white/5 bg-slate-100/50 rounded-2xl", children: [
|
|
1796
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted mb-1", children: t("signing_in_as", s) }),
|
|
1722
1797
|
/* @__PURE__ */ e("p", { className: "text-main font-semibold", children: r })
|
|
1723
1798
|
] }),
|
|
1724
|
-
/* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-semibold text-main mb-4", children: t("passkey_benefits_title",
|
|
1726
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children:
|
|
1727
|
-
/* @__PURE__ */ e("div", { className: "w-10 h-10 rounded-xl bg-brand/10 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
1728
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-muted", children:
|
|
1729
|
-
] },
|
|
1799
|
+
/* @__PURE__ */ i("div", { className: "mb-8", children: [
|
|
1800
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-semibold text-main mb-4", children: t("passkey_benefits_title", s) }),
|
|
1801
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: k.map((V, w) => /* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
1802
|
+
/* @__PURE__ */ e("div", { className: "w-10 h-10 rounded-xl bg-brand/10 flex items-center justify-center", children: /* @__PURE__ */ e(V.icon, { className: "w-5 h-5 text-brand" }) }),
|
|
1803
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-muted", children: V.text })
|
|
1804
|
+
] }, w)) })
|
|
1730
1805
|
] }),
|
|
1731
|
-
(
|
|
1806
|
+
(c || o || D) && /* @__PURE__ */ i("div", { className: "flex-1 flex flex-col items-center justify-center py-4", children: [
|
|
1732
1807
|
/* @__PURE__ */ e(
|
|
1733
|
-
|
|
1808
|
+
P.div,
|
|
1734
1809
|
{
|
|
1735
|
-
animate:
|
|
1810
|
+
animate: c ? {
|
|
1736
1811
|
scale: [1, 1.1, 1],
|
|
1737
1812
|
opacity: [1, 0.7, 1]
|
|
1738
1813
|
} : {},
|
|
1739
1814
|
transition: {
|
|
1740
1815
|
duration: 1.5,
|
|
1741
|
-
repeat:
|
|
1816
|
+
repeat: c ? 1 / 0 : 0,
|
|
1742
1817
|
ease: "easeInOut"
|
|
1743
1818
|
},
|
|
1744
|
-
className: `w-20 h-20 rounded-full flex items-center justify-center mb-4 ${
|
|
1745
|
-
children:
|
|
1819
|
+
className: `w-20 h-20 rounded-full flex items-center justify-center mb-4 ${o ? "bg-green-500/20 border-2 border-green-400" : c ? "bg-brand/20 border-2 border-brand" : "bg-red-500/10 border-2 border-red-400"}`,
|
|
1820
|
+
children: o ? /* @__PURE__ */ e(Ce, { className: "w-10 h-10 text-green-400" }) : c ? /* @__PURE__ */ e(_e, { className: "w-10 h-10 text-brand animate-spin" }) : /* @__PURE__ */ e(ve, { className: "w-10 h-10 text-red-400" })
|
|
1746
1821
|
}
|
|
1747
1822
|
),
|
|
1748
|
-
/* @__PURE__ */ e("p", { className: "text-main font-semibold text-center", children: t(
|
|
1749
|
-
|
|
1823
|
+
/* @__PURE__ */ e("p", { className: "text-main font-semibold text-center", children: t(o ? "passkey_created" : c ? "creating_passkey" : "passkey_create_failed", s) }),
|
|
1824
|
+
D && /* @__PURE__ */ e("p", { className: "text-red-500 text-sm text-center mt-2 max-w-xs", children: D })
|
|
1750
1825
|
] }),
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
!
|
|
1826
|
+
/* @__PURE__ */ i("div", { className: "mt-auto space-y-3 pb-8", children: [
|
|
1827
|
+
!o && /* @__PURE__ */ e(
|
|
1753
1828
|
"button",
|
|
1754
1829
|
{
|
|
1755
|
-
onClick:
|
|
1756
|
-
disabled: !
|
|
1830
|
+
onClick: g,
|
|
1831
|
+
disabled: !A || c,
|
|
1757
1832
|
className: "w-full h-14 bg-brand hover:bg-brand/90 text-white font-bold rounded-2xl shadow-xl shadow-brand/30 flex items-center justify-center gap-2 transition-transform active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1758
|
-
children:
|
|
1759
|
-
/* @__PURE__ */ e(
|
|
1760
|
-
/* @__PURE__ */ e("span", { children: t("creating_passkey",
|
|
1761
|
-
] }) : /* @__PURE__ */
|
|
1762
|
-
/* @__PURE__ */ e(
|
|
1763
|
-
/* @__PURE__ */ e("span", { children: t("register_passkey",
|
|
1833
|
+
children: c ? /* @__PURE__ */ i(re, { children: [
|
|
1834
|
+
/* @__PURE__ */ e(_e, { className: "w-5 h-5 animate-spin" }),
|
|
1835
|
+
/* @__PURE__ */ e("span", { children: t("creating_passkey", s) })
|
|
1836
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
1837
|
+
/* @__PURE__ */ e(Ie, { className: "w-5 h-5" }),
|
|
1838
|
+
/* @__PURE__ */ e("span", { children: t("register_passkey", s) })
|
|
1764
1839
|
] })
|
|
1765
1840
|
}
|
|
1766
1841
|
),
|
|
1767
|
-
|
|
1842
|
+
N && !c && !o && /* @__PURE__ */ e(
|
|
1768
1843
|
"button",
|
|
1769
1844
|
{
|
|
1770
|
-
onClick:
|
|
1845
|
+
onClick: N,
|
|
1771
1846
|
className: "w-full h-12 bg-transparent border dark:border-white/10 border-slate-200 text-muted hover:text-main font-medium rounded-2xl flex items-center justify-center transition-colors",
|
|
1772
|
-
children: t("do_this_later",
|
|
1847
|
+
children: t("do_this_later", s)
|
|
1773
1848
|
}
|
|
1774
1849
|
)
|
|
1775
1850
|
] }),
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */ e(
|
|
1778
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-[0.2em] font-bold text-muted", children: t("e2e_encrypted",
|
|
1851
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-center gap-2 pb-4 opacity-50", children: [
|
|
1852
|
+
/* @__PURE__ */ e(tt, { className: "text-muted w-3 h-3" }),
|
|
1853
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-[0.2em] font-bold text-muted", children: t("e2e_encrypted", s) })
|
|
1779
1854
|
] })
|
|
1780
1855
|
]
|
|
1781
1856
|
}
|
|
1782
1857
|
);
|
|
1783
|
-
},
|
|
1858
|
+
}, Jt = ({
|
|
1784
1859
|
email: r,
|
|
1785
|
-
verificationId:
|
|
1786
|
-
onNext:
|
|
1787
|
-
onError:
|
|
1788
|
-
apiBaseUrl:
|
|
1789
|
-
apiKey:
|
|
1790
|
-
previewMode:
|
|
1791
|
-
language:
|
|
1860
|
+
verificationId: a,
|
|
1861
|
+
onNext: n,
|
|
1862
|
+
onError: l,
|
|
1863
|
+
apiBaseUrl: N = "https://apis.casperid.com",
|
|
1864
|
+
apiKey: p,
|
|
1865
|
+
previewMode: f = !1,
|
|
1866
|
+
language: m = "EN"
|
|
1792
1867
|
}) => {
|
|
1793
|
-
const [
|
|
1794
|
-
|
|
1795
|
-
if (
|
|
1796
|
-
const
|
|
1797
|
-
return () => clearTimeout(
|
|
1868
|
+
const [s, c] = y(["", "", "", "", "", ""]), [d, D] = y(!1), [h, A] = y(!1), [_, o] = y(""), [I, g] = y(0), [k, V] = y(a);
|
|
1869
|
+
ce(() => {
|
|
1870
|
+
if (I > 0) {
|
|
1871
|
+
const b = setTimeout(() => g(I - 1), 1e3);
|
|
1872
|
+
return () => clearTimeout(b);
|
|
1798
1873
|
}
|
|
1799
|
-
}, [
|
|
1800
|
-
|
|
1801
|
-
}, [
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1804
|
-
const
|
|
1805
|
-
return
|
|
1874
|
+
}, [I]), ce(() => {
|
|
1875
|
+
s.every((b) => b !== "") && !d && Y();
|
|
1876
|
+
}, [s]);
|
|
1877
|
+
const w = J((b) => {
|
|
1878
|
+
o(""), c((C) => {
|
|
1879
|
+
const S = [...C], L = S.findIndex((O) => O === "");
|
|
1880
|
+
return L !== -1 && (S[L] = b), S;
|
|
1806
1881
|
});
|
|
1807
|
-
}, []),
|
|
1808
|
-
|
|
1809
|
-
const
|
|
1810
|
-
for (let
|
|
1811
|
-
if (
|
|
1812
|
-
|
|
1882
|
+
}, []), T = J(() => {
|
|
1883
|
+
o(""), c((b) => {
|
|
1884
|
+
const C = [...b];
|
|
1885
|
+
for (let S = C.length - 1; S >= 0; S--)
|
|
1886
|
+
if (C[S] !== "") {
|
|
1887
|
+
C[S] = "";
|
|
1813
1888
|
break;
|
|
1814
1889
|
}
|
|
1815
|
-
return
|
|
1890
|
+
return C;
|
|
1816
1891
|
});
|
|
1817
1892
|
}, []);
|
|
1818
|
-
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1893
|
+
ce(() => {
|
|
1894
|
+
const b = (C) => {
|
|
1895
|
+
d || (/^[0-9]$/.test(C.key) ? (C.preventDefault(), w(C.key)) : (C.key === "Backspace" || C.key === "Delete") && (C.preventDefault(), T()));
|
|
1821
1896
|
};
|
|
1822
|
-
return window.addEventListener("keydown",
|
|
1823
|
-
}, [
|
|
1824
|
-
const
|
|
1825
|
-
const
|
|
1826
|
-
if (
|
|
1827
|
-
|
|
1897
|
+
return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
|
|
1898
|
+
}, [d, w, T]);
|
|
1899
|
+
const Y = async () => {
|
|
1900
|
+
const b = s.join("");
|
|
1901
|
+
if (b.length !== 6) {
|
|
1902
|
+
o(t("error_pin_incomplete", m));
|
|
1828
1903
|
return;
|
|
1829
1904
|
}
|
|
1830
|
-
if (
|
|
1905
|
+
if (D(!0), o(""), f) {
|
|
1831
1906
|
setTimeout(() => {
|
|
1832
|
-
|
|
1907
|
+
D(!1), n("mock-session-token", null);
|
|
1833
1908
|
}, 1e3);
|
|
1834
1909
|
return;
|
|
1835
1910
|
}
|
|
1836
1911
|
try {
|
|
1837
|
-
const
|
|
1912
|
+
const C = await fetch(`${N}/api/auth/verify-otp`, {
|
|
1838
1913
|
method: "POST",
|
|
1839
1914
|
headers: {
|
|
1840
1915
|
"Content-Type": "application/json",
|
|
1841
|
-
"X-App-ID":
|
|
1916
|
+
"X-App-ID": p || ""
|
|
1842
1917
|
},
|
|
1843
1918
|
body: JSON.stringify({
|
|
1844
|
-
verificationId:
|
|
1845
|
-
otp:
|
|
1919
|
+
verificationId: k,
|
|
1920
|
+
otp: b
|
|
1846
1921
|
})
|
|
1847
1922
|
});
|
|
1848
|
-
if (!
|
|
1849
|
-
const
|
|
1850
|
-
throw new Error(
|
|
1923
|
+
if (!C.ok) {
|
|
1924
|
+
const L = await C.json().catch(() => ({}));
|
|
1925
|
+
throw new Error(L.error || `Verification failed with status ${C.status}`);
|
|
1851
1926
|
}
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1927
|
+
const S = await C.json();
|
|
1928
|
+
S.success && S.sessionToken ? n(S.sessionToken, S.userAccount, S.business_token) : (o(S.error || t("invalid_code", m)), S.attemptsLeft !== void 0 && o(t("invalid_code_attempts", m).replace("{attempts}", S.attemptsLeft.toString())), c(["", "", "", "", "", ""]), l == null || l(S.error || t("verification_failed", m)));
|
|
1854
1929
|
} catch {
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1930
|
+
const S = t("error_verify_failed", m);
|
|
1931
|
+
o(S), c(["", "", "", "", "", ""]), l == null || l(S);
|
|
1857
1932
|
} finally {
|
|
1858
|
-
|
|
1933
|
+
D(!1);
|
|
1859
1934
|
}
|
|
1860
|
-
},
|
|
1861
|
-
if (!(
|
|
1862
|
-
if (
|
|
1935
|
+
}, W = async () => {
|
|
1936
|
+
if (!(I > 0 || h)) {
|
|
1937
|
+
if (A(!0), o(""), f) {
|
|
1863
1938
|
setTimeout(() => {
|
|
1864
|
-
|
|
1939
|
+
A(!1), g(60), c(["", "", "", "", "", ""]);
|
|
1865
1940
|
}, 800);
|
|
1866
1941
|
return;
|
|
1867
1942
|
}
|
|
1868
1943
|
try {
|
|
1869
|
-
const
|
|
1944
|
+
const b = await fetch(`${N}/api/auth/resend-otp`, {
|
|
1870
1945
|
method: "POST",
|
|
1871
1946
|
headers: {
|
|
1872
1947
|
"Content-Type": "application/json"
|
|
1873
1948
|
},
|
|
1874
|
-
body: JSON.stringify({ verificationId:
|
|
1949
|
+
body: JSON.stringify({ verificationId: k })
|
|
1875
1950
|
});
|
|
1876
|
-
if (!
|
|
1877
|
-
const
|
|
1878
|
-
throw new Error(
|
|
1951
|
+
if (!b.ok) {
|
|
1952
|
+
const S = await b.json().catch(() => ({}));
|
|
1953
|
+
throw new Error(S.error || `Request failed with status ${b.status}`);
|
|
1879
1954
|
}
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1955
|
+
const C = await b.json();
|
|
1956
|
+
C.success ? (g(60), c(["", "", "", "", "", ""])) : o(C.error || t("error_resend_failed", m));
|
|
1882
1957
|
} catch {
|
|
1883
|
-
|
|
1958
|
+
o(t("error_resend_failed", m));
|
|
1884
1959
|
} finally {
|
|
1885
|
-
|
|
1960
|
+
A(!1);
|
|
1886
1961
|
}
|
|
1887
1962
|
}
|
|
1888
|
-
},
|
|
1889
|
-
return /* @__PURE__ */
|
|
1890
|
-
|
|
1963
|
+
}, B = r.replace(/(.{2})(.*)(@.*)/, "$1***$3");
|
|
1964
|
+
return /* @__PURE__ */ i(
|
|
1965
|
+
P.div,
|
|
1891
1966
|
{
|
|
1892
1967
|
initial: { opacity: 0, scale: 0.95 },
|
|
1893
1968
|
animate: { opacity: 1, scale: 1 },
|
|
1894
1969
|
exit: { opacity: 0, scale: 1.05 },
|
|
1895
1970
|
className: "flex-1 flex flex-col px-8 pt-12",
|
|
1896
1971
|
children: [
|
|
1897
|
-
/* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */ e("h1", { className: "text-3xl font-bold tracking-tight text-main", children: t("verify_email",
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
t("enter_code",
|
|
1972
|
+
/* @__PURE__ */ i("div", { className: "space-y-2 mb-8", children: [
|
|
1973
|
+
/* @__PURE__ */ e("h1", { className: "text-3xl font-bold tracking-tight text-main", children: t("verify_email", m) }),
|
|
1974
|
+
/* @__PURE__ */ i("p", { className: "text-muted text-sm font-medium", children: [
|
|
1975
|
+
t("enter_code", m),
|
|
1901
1976
|
" ",
|
|
1902
|
-
/* @__PURE__ */ e("span", { className: "text-main font-semibold", children:
|
|
1977
|
+
/* @__PURE__ */ e("span", { className: "text-main font-semibold", children: B })
|
|
1903
1978
|
] })
|
|
1904
1979
|
] }),
|
|
1905
|
-
/* @__PURE__ */ e("div", { className: "flex justify-between gap-2 mb-6", children:
|
|
1980
|
+
/* @__PURE__ */ e("div", { className: "flex justify-between gap-2 mb-6", children: s.map((b, C) => /* @__PURE__ */ i(
|
|
1906
1981
|
"div",
|
|
1907
1982
|
{
|
|
1908
|
-
className: `size-12 rounded-2xl dark:bg-black/20 bg-slate-100/50 flex items-center justify-center text-xl font-bold border transition-all ${
|
|
1983
|
+
className: `size-12 rounded-2xl dark:bg-black/20 bg-slate-100/50 flex items-center justify-center text-xl font-bold border transition-all ${b ? "text-brand dark:border-brand-30 border-brand-50" : "text-muted dark:border-white/10 border-slate-200"} ${_ ? "border-red-400 dark:border-red-500" : ""}`,
|
|
1909
1984
|
children: [
|
|
1910
|
-
|
|
1911
|
-
!
|
|
1985
|
+
b,
|
|
1986
|
+
!b && s.findIndex((S) => S === "") === C && /* @__PURE__ */ e("div", { className: "w-0.5 h-6 bg-brand animate-pulse" })
|
|
1912
1987
|
]
|
|
1913
1988
|
},
|
|
1914
|
-
|
|
1989
|
+
C
|
|
1915
1990
|
)) }),
|
|
1916
|
-
|
|
1917
|
-
/* @__PURE__ */
|
|
1918
|
-
[1, 2, 3, 4, 5, 6, 7, 8, 9].map((
|
|
1991
|
+
_ && /* @__PURE__ */ e("p", { className: "text-red-500 text-xs font-medium text-center mb-4", children: _ }),
|
|
1992
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-3 gap-4 mb-8", children: [
|
|
1993
|
+
[1, 2, 3, 4, 5, 6, 7, 8, 9].map((b) => /* @__PURE__ */ e(
|
|
1919
1994
|
"button",
|
|
1920
1995
|
{
|
|
1921
|
-
onClick: () =>
|
|
1922
|
-
disabled:
|
|
1923
|
-
className: "h-14 rounded-2xl dark:hover:bg-white/5 hover:bg-slate-100 flex items-center justify-center text-xl font-bold transition-colors text-main disabled:opacity-50",
|
|
1924
|
-
children:
|
|
1996
|
+
onClick: () => w(b.toString()),
|
|
1997
|
+
disabled: d,
|
|
1998
|
+
className: "h-14 rounded-2xl dark:hover:bg-slate-100 dark:bg-white/5 hover:bg-slate-100 flex items-center justify-center text-xl font-bold transition-colors text-main disabled:opacity-50",
|
|
1999
|
+
children: b
|
|
1925
2000
|
},
|
|
1926
|
-
|
|
2001
|
+
b
|
|
1927
2002
|
)),
|
|
1928
2003
|
/* @__PURE__ */ e("div", { className: "h-14" }),
|
|
1929
2004
|
/* @__PURE__ */ e(
|
|
1930
2005
|
"button",
|
|
1931
2006
|
{
|
|
1932
|
-
onClick: () =>
|
|
1933
|
-
disabled:
|
|
1934
|
-
className: "h-14 rounded-2xl dark:hover:bg-white/5 hover:bg-slate-100 flex items-center justify-center text-xl font-bold transition-colors text-main disabled:opacity-50",
|
|
2007
|
+
onClick: () => w("0"),
|
|
2008
|
+
disabled: d,
|
|
2009
|
+
className: "h-14 rounded-2xl dark:hover:bg-slate-100 dark:bg-white/5 hover:bg-slate-100 flex items-center justify-center text-xl font-bold transition-colors text-main disabled:opacity-50",
|
|
1935
2010
|
children: "0"
|
|
1936
2011
|
}
|
|
1937
2012
|
),
|
|
1938
2013
|
/* @__PURE__ */ e(
|
|
1939
2014
|
"button",
|
|
1940
2015
|
{
|
|
1941
|
-
onClick:
|
|
1942
|
-
disabled:
|
|
1943
|
-
className: "h-14 rounded-2xl dark:hover:bg-white/5 hover:bg-slate-100 flex items-center justify-center transition-colors text-main disabled:opacity-50",
|
|
1944
|
-
children: /* @__PURE__ */ e(
|
|
2016
|
+
onClick: T,
|
|
2017
|
+
disabled: d,
|
|
2018
|
+
className: "h-14 rounded-2xl dark:hover:bg-slate-100 dark:bg-white/5 hover:bg-slate-100 flex items-center justify-center transition-colors text-main disabled:opacity-50",
|
|
2019
|
+
children: /* @__PURE__ */ e(Nt, { className: "w-6 h-6" })
|
|
1945
2020
|
}
|
|
1946
2021
|
)
|
|
1947
2022
|
] }),
|
|
1948
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ i("div", { className: "mt-auto pb-8 space-y-4", children: [
|
|
1949
2024
|
/* @__PURE__ */ e(
|
|
1950
2025
|
"button",
|
|
1951
2026
|
{
|
|
1952
|
-
onClick:
|
|
1953
|
-
disabled:
|
|
2027
|
+
onClick: Y,
|
|
2028
|
+
disabled: d || s.some((b) => b === ""),
|
|
1954
2029
|
className: "w-full h-14 bg-brand hover:bg-brand/90 text-white font-bold rounded-2xl transition-all shadow-lg shadow-brand flex items-center justify-center gap-2 group disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1955
|
-
children:
|
|
1956
|
-
/* @__PURE__ */ e(
|
|
1957
|
-
/* @__PURE__ */ e("span", { children: t("verifying",
|
|
1958
|
-
] }) : /* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */ e("span", { children: t("verify",
|
|
1960
|
-
/* @__PURE__ */ e(
|
|
2030
|
+
children: d ? /* @__PURE__ */ i(re, { children: [
|
|
2031
|
+
/* @__PURE__ */ e(_e, { className: "w-5 h-5 animate-spin" }),
|
|
2032
|
+
/* @__PURE__ */ e("span", { children: t("verifying", m) })
|
|
2033
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
2034
|
+
/* @__PURE__ */ e("span", { children: t("verify", m) }),
|
|
2035
|
+
/* @__PURE__ */ e(Oe, { className: "w-5 h-5 group-hover:translate-x-1 transition-transform" })
|
|
1961
2036
|
] })
|
|
1962
2037
|
}
|
|
1963
2038
|
),
|
|
1964
2039
|
/* @__PURE__ */ e(
|
|
1965
2040
|
"button",
|
|
1966
2041
|
{
|
|
1967
|
-
onClick:
|
|
1968
|
-
disabled:
|
|
2042
|
+
onClick: W,
|
|
2043
|
+
disabled: I > 0 || h,
|
|
1969
2044
|
className: "w-full h-14 dark:bg-white/5 hover:dark:bg-white/10 bg-slate-100 hover:bg-slate-200 text-muted font-bold rounded-2xl transition-all border dark:border-white/10 border-slate-200 flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1970
|
-
children:
|
|
1971
|
-
/* @__PURE__ */ e(
|
|
1972
|
-
/* @__PURE__ */ e("span", { children: t("sending",
|
|
1973
|
-
] }) :
|
|
1974
|
-
t("resend_code",
|
|
2045
|
+
children: h ? /* @__PURE__ */ i(re, { children: [
|
|
2046
|
+
/* @__PURE__ */ e(_e, { className: "w-4 h-4 animate-spin" }),
|
|
2047
|
+
/* @__PURE__ */ e("span", { children: t("sending", m) })
|
|
2048
|
+
] }) : I > 0 ? /* @__PURE__ */ i("span", { children: [
|
|
2049
|
+
t("resend_code", m),
|
|
1975
2050
|
" (",
|
|
1976
|
-
|
|
2051
|
+
I,
|
|
1977
2052
|
"s)"
|
|
1978
|
-
] }) : /* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */ e(
|
|
1980
|
-
/* @__PURE__ */ e("span", { children: t("resend_code",
|
|
2053
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
2054
|
+
/* @__PURE__ */ e(Te, { className: "w-4 h-4" }),
|
|
2055
|
+
/* @__PURE__ */ e("span", { children: t("resend_code", m) })
|
|
1981
2056
|
] })
|
|
1982
2057
|
}
|
|
1983
2058
|
)
|
|
@@ -1985,20 +2060,20 @@ const $t = ({
|
|
|
1985
2060
|
]
|
|
1986
2061
|
}
|
|
1987
2062
|
);
|
|
1988
|
-
},
|
|
1989
|
-
|
|
2063
|
+
}, Kt = ({ onNext: r, onSkip: a, language: n = "EN" }) => /* @__PURE__ */ i(
|
|
2064
|
+
P.div,
|
|
1990
2065
|
{
|
|
1991
2066
|
initial: { opacity: 0 },
|
|
1992
2067
|
animate: { opacity: 1 },
|
|
1993
2068
|
exit: { opacity: 0 },
|
|
1994
2069
|
className: "flex-1 flex flex-col",
|
|
1995
2070
|
children: [
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-semibold uppercase tracking-widest text-brand/80", children: t("verification_step",
|
|
1999
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted", children: t("kyc_required",
|
|
2071
|
+
/* @__PURE__ */ i("div", { className: "p-6 pb-2", children: [
|
|
2072
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center mb-4", children: [
|
|
2073
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-semibold uppercase tracking-widest text-brand/80", children: t("verification_step", n) }),
|
|
2074
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted", children: t("kyc_required", n) })
|
|
2000
2075
|
] }),
|
|
2001
|
-
/* @__PURE__ */ e("div", { className: "w-full bg-brand
|
|
2076
|
+
/* @__PURE__ */ e("div", { className: "w-full bg-brand-10 h-1.5 rounded-full overflow-hidden", children: /* @__PURE__ */ e(
|
|
2002
2077
|
"div",
|
|
2003
2078
|
{
|
|
2004
2079
|
className: "bg-brand h-full rounded-full",
|
|
@@ -2006,319 +2081,411 @@ const $t = ({
|
|
|
2006
2081
|
}
|
|
2007
2082
|
) })
|
|
2008
2083
|
] }),
|
|
2009
|
-
/* @__PURE__ */
|
|
2010
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ i("div", { className: "flex-1 flex flex-col items-center justify-center px-8 text-center gap-8", children: [
|
|
2085
|
+
/* @__PURE__ */ i("div", { className: "relative group", children: [
|
|
2011
2086
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-cyan-400/20 blur-3xl rounded-full scale-75 group-hover:scale-100 transition-transform duration-500" }),
|
|
2012
|
-
/* @__PURE__ */ e("div", { className: "relative w-32 h-32 rounded-full bg-gradient-to-tr from-brand-20 to-brand-5 flex items-center justify-center border border-brand-30 shadow-inner", children: /* @__PURE__ */ e(
|
|
2013
|
-
/* @__PURE__ */ e("div", { className: "absolute bottom-1 right-1 w-8 h-8 rounded-full
|
|
2087
|
+
/* @__PURE__ */ e("div", { className: "relative w-32 h-32 rounded-full bg-gradient-to-tr from-brand-20 to-brand-5 flex items-center justify-center border border-brand-30 shadow-inner", children: /* @__PURE__ */ e(Fe, { className: "w-16 h-16 text-brand" }) }),
|
|
2088
|
+
/* @__PURE__ */ e("div", { className: "absolute bottom-1 right-1 w-8 h-8 rounded-full glass-container border-2 border-brand flex items-center justify-center", children: /* @__PURE__ */ e(Te, { className: "w-4 h-4 text-brand" }) })
|
|
2014
2089
|
] }),
|
|
2015
|
-
/* @__PURE__ */
|
|
2016
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold tracking-tight text-main leading-tight", children: t("security_upgrade_required",
|
|
2017
|
-
/* @__PURE__ */ e("p", { className: "text-muted text-base leading-relaxed font-medium", children: t("security_upgrade_desc",
|
|
2090
|
+
/* @__PURE__ */ i("div", { className: "space-y-4", children: [
|
|
2091
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold tracking-tight text-main leading-tight", children: t("security_upgrade_required", n) }),
|
|
2092
|
+
/* @__PURE__ */ e("p", { className: "text-muted text-base leading-relaxed font-medium", children: t("security_upgrade_desc", n) })
|
|
2018
2093
|
] }),
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
/* @__PURE__ */ e("span", { className: "px-3 py-1 bg-brand/10 rounded-xl text-[10px] font-bold text-brand uppercase tracking-tighter border border-brand-10", children: t("biometric_secure",
|
|
2021
|
-
/* @__PURE__ */ e("span", { className: "px-3 py-1 bg-cyan-400/10 rounded-xl text-[10px] font-bold text-cyan-500 uppercase tracking-tighter border border-cyan-400/10", children: t("zero_knowledge",
|
|
2094
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap justify-center gap-2", children: [
|
|
2095
|
+
/* @__PURE__ */ e("span", { className: "px-3 py-1 bg-brand/10 rounded-xl text-[10px] font-bold text-brand uppercase tracking-tighter border border-brand-10", children: t("biometric_secure", n) }),
|
|
2096
|
+
/* @__PURE__ */ e("span", { className: "px-3 py-1 bg-cyan-400/10 rounded-xl text-[10px] font-bold text-cyan-500 uppercase tracking-tighter border border-cyan-400/10", children: t("zero_knowledge", n) })
|
|
2022
2097
|
] })
|
|
2023
2098
|
] }),
|
|
2024
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ i("div", { className: "p-8 space-y-4", children: [
|
|
2025
2100
|
/* @__PURE__ */ e(
|
|
2026
2101
|
"button",
|
|
2027
2102
|
{
|
|
2028
2103
|
onClick: r,
|
|
2029
2104
|
className: "w-full bg-brand hover:bg-brand/90 text-white rounded-2xl py-4 font-bold text-lg shadow-xl shadow-brand transition-all active:scale-[0.98]",
|
|
2030
|
-
children: t("start_upgrade",
|
|
2105
|
+
children: t("start_upgrade", n)
|
|
2031
2106
|
}
|
|
2032
2107
|
),
|
|
2033
|
-
|
|
2108
|
+
a && /* @__PURE__ */ e(
|
|
2034
2109
|
"button",
|
|
2035
2110
|
{
|
|
2036
|
-
onClick:
|
|
2037
|
-
className: "w-full
|
|
2038
|
-
children: t("do_this_later",
|
|
2111
|
+
onClick: a,
|
|
2112
|
+
className: "w-full text-muted text-sm font-bold hover:text-main transition-colors",
|
|
2113
|
+
children: t("do_this_later", n)
|
|
2039
2114
|
}
|
|
2040
2115
|
)
|
|
2041
2116
|
] })
|
|
2042
2117
|
]
|
|
2043
2118
|
}
|
|
2044
|
-
),
|
|
2045
|
-
"
|
|
2046
|
-
"
|
|
2047
|
-
"
|
|
2048
|
-
"
|
|
2049
|
-
"
|
|
2050
|
-
],
|
|
2119
|
+
), ke = [
|
|
2120
|
+
"Position your face in the frame",
|
|
2121
|
+
"Blink 3 times naturally",
|
|
2122
|
+
"Open your mouth",
|
|
2123
|
+
"Hold still",
|
|
2124
|
+
"Processing verification..."
|
|
2125
|
+
], Pe = (r, a) => Math.sqrt(Math.pow(r.x - a.x, 2) + Math.pow(r.y - a.y, 2)), Zt = ({
|
|
2051
2126
|
requestId: r,
|
|
2052
|
-
onNext:
|
|
2053
|
-
onError:
|
|
2054
|
-
apiBaseUrl:
|
|
2055
|
-
|
|
2056
|
-
|
|
2127
|
+
onNext: a,
|
|
2128
|
+
onError: n,
|
|
2129
|
+
apiBaseUrl: l = "https://apis.casperid.com",
|
|
2130
|
+
apiKey: N = "",
|
|
2131
|
+
previewMode: p = !1,
|
|
2132
|
+
language: f = "EN"
|
|
2057
2133
|
}) => {
|
|
2058
|
-
const
|
|
2059
|
-
|
|
2134
|
+
const m = se(null), s = se(null), c = se(null), d = se([]), D = se(null), h = se(null), [A, _] = y(0), [o, I] = y(!1), [g, k] = y(""), [V, w] = y(!1), [T, Y] = y(!1), [W, B] = y(0), [b, C] = y(!1), [S, L] = y(0), O = se(0), F = se(0), G = se(!1), Q = se(0), de = se(!1), ue = (v) => {
|
|
2135
|
+
O.current = v, _(v);
|
|
2136
|
+
}, te = (v) => {
|
|
2137
|
+
F.current = v, B(v);
|
|
2138
|
+
}, ie = (v) => {
|
|
2139
|
+
G.current = v, C(v);
|
|
2140
|
+
}, q = (v) => {
|
|
2141
|
+
Q.current = v, L(v);
|
|
2142
|
+
}, pe = A === 0 ? 0 : A === 1 ? W / 3 * 100 : A === 2 ? S : A === 3 ? 100 : Math.min(100, Math.round(A / (ke.length - 1) * 100));
|
|
2143
|
+
ce(() => ((async () => {
|
|
2060
2144
|
try {
|
|
2061
|
-
const
|
|
2062
|
-
|
|
2063
|
-
});
|
|
2064
|
-
n.current = R, u.current && (u.current.srcObject = R, u.current.onloadedmetadata = () => {
|
|
2065
|
-
O(!0);
|
|
2145
|
+
const { FaceMesh: M } = await import("./face_mesh-DYMPc5Ce.js").then((z) => z.f), { Camera: Z } = await import("./camera_utils-BQaOSBPu.js").then((z) => z.c), fe = new M({
|
|
2146
|
+
locateFile: (z) => `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh/${z}`
|
|
2066
2147
|
});
|
|
2067
|
-
|
|
2068
|
-
|
|
2148
|
+
if (fe.setOptions({
|
|
2149
|
+
maxNumFaces: 1,
|
|
2150
|
+
refineLandmarks: !0,
|
|
2151
|
+
minDetectionConfidence: 0.3,
|
|
2152
|
+
minTrackingConfidence: 0.3
|
|
2153
|
+
}), console.log("✅ MediaPipe FaceMesh loaded successfully"), fe.onResults(K), D.current = fe, m.current) {
|
|
2154
|
+
const z = new Z(m.current, {
|
|
2155
|
+
onFrame: async () => {
|
|
2156
|
+
D.current && m.current && await D.current.send({ image: m.current });
|
|
2157
|
+
},
|
|
2158
|
+
width: 640,
|
|
2159
|
+
height: 480
|
|
2160
|
+
});
|
|
2161
|
+
await z.start(), h.current = z, I(!0), console.log("📹 Camera started successfully");
|
|
2162
|
+
}
|
|
2163
|
+
} catch (M) {
|
|
2164
|
+
console.error("FaceMesh initialization error:", M), M.name === "NotAllowedError" ? (Y(!0), k("Camera permission denied. Please enable camera access.")) : k("Unable to initialize face detection. Please try again."), n == null || n("FaceMesh initialization failed");
|
|
2069
2165
|
}
|
|
2070
2166
|
})(), () => {
|
|
2071
|
-
|
|
2072
|
-
}), [
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2167
|
+
h.current && h.current.stop(), c.current && c.current.getTracks().forEach((M) => M.stop());
|
|
2168
|
+
}), []);
|
|
2169
|
+
const K = (v) => {
|
|
2170
|
+
if (!s.current || V) return;
|
|
2171
|
+
const M = s.current, Z = M.getContext("2d");
|
|
2172
|
+
if (!(!Z || !v.image))
|
|
2173
|
+
if (Z.save(), Z.clearRect(0, 0, M.width, M.height), Z.translate(M.width, 0), Z.scale(-1, 1), Z.drawImage(v.image, 0, 0, M.width, M.height), Z.restore(), v.multiFaceLandmarks && v.multiFaceLandmarks.length > 0) {
|
|
2174
|
+
const fe = v.multiFaceLandmarks[0];
|
|
2175
|
+
me(fe);
|
|
2176
|
+
} else
|
|
2177
|
+
console.log("⚠️ No face detected in frame");
|
|
2178
|
+
}, me = (v) => {
|
|
2179
|
+
const M = O.current, Z = F.current, fe = G.current;
|
|
2180
|
+
if (M === 0) {
|
|
2181
|
+
const z = v[1], X = z.x > 0.35 && z.x < 0.65 && z.y > 0.35 && z.y < 0.65;
|
|
2182
|
+
Math.random() < 0.05 && console.log(`📍 Face position: x=${z.x.toFixed(2)}, y=${z.y.toFixed(2)} (centered: ${X})`), X && (console.log("✅ Face centered! Advancing to blink detection..."), setTimeout(() => ue(1), 500));
|
|
2183
|
+
} else if (M === 1) {
|
|
2184
|
+
const z = Pe(v[159], v[145]), X = Pe(v[33], v[133]), he = z / X;
|
|
2185
|
+
if (Math.random() < 0.1 && console.log(`👁️ Eye ratio: ${he.toFixed(3)} (threshold: 0.16, ${he < 0.16 ? "CLOSED" : "OPEN"})`), he < 0.16)
|
|
2186
|
+
fe || (console.log("👁️ Blink started (eye closed)"), ie(!0));
|
|
2187
|
+
else if (fe) {
|
|
2188
|
+
const H = Z + 1;
|
|
2189
|
+
console.log(`✅ Blink detected! Count: ${H}/3`), ie(!1), te(H), ee(), H >= 3 && (console.log("🎉 All 3 blinks completed! Moving to mouth opening step..."), setTimeout(() => {
|
|
2190
|
+
ue(2), q(0);
|
|
2191
|
+
}, 300));
|
|
2192
|
+
}
|
|
2193
|
+
} else if (M === 2) {
|
|
2194
|
+
const z = v[13], X = v[14], he = Pe(z, X), H = v[10], oe = v[152], ge = Pe(H, oe), ae = he / ge, ye = Math.min(ae / 0.15 * 100, 100);
|
|
2195
|
+
q(ye), d.current.length < 15 && ee(), ae > 0.12 && d.current.length >= 10 && !de.current && (de.current = !0, ee(), setTimeout(() => {
|
|
2196
|
+
ue(3), ne();
|
|
2197
|
+
}, 500));
|
|
2198
|
+
}
|
|
2199
|
+
}, ee = () => {
|
|
2200
|
+
!s.current || d.current.length >= 25 || s.current.toBlob((v) => {
|
|
2201
|
+
v && d.current.push(v);
|
|
2202
|
+
}, "image/jpeg", 0.8);
|
|
2203
|
+
}, ne = async () => {
|
|
2204
|
+
var v, M, Z, fe;
|
|
2205
|
+
if (w(!0), ue(4), p) {
|
|
2100
2206
|
setTimeout(() => {
|
|
2101
|
-
|
|
2207
|
+
w(!1), a(!0);
|
|
2102
2208
|
}, 2e3);
|
|
2103
2209
|
return;
|
|
2104
2210
|
}
|
|
2105
2211
|
try {
|
|
2106
|
-
const
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2212
|
+
const z = new FormData(), X = !!r, he = X ? `${l}/api/v2/verification/liveness` : `${l}/api/ai/verify-liveness-sequence`;
|
|
2213
|
+
if (X) {
|
|
2214
|
+
z.append("requestId", r);
|
|
2215
|
+
const ae = {
|
|
2216
|
+
totalFrames: d.current.length,
|
|
2217
|
+
stepSequence: ["blink", "open_mouth"],
|
|
2218
|
+
timestamp: Date.now()
|
|
2219
|
+
};
|
|
2220
|
+
z.append("metadata", JSON.stringify(ae)), d.current.slice(-10).forEach((Ae, De) => {
|
|
2221
|
+
z.append("imageFrames", Ae, `frame_${De}.jpg`);
|
|
2222
|
+
});
|
|
2223
|
+
} else
|
|
2224
|
+
d.current.forEach((ae, ye) => {
|
|
2225
|
+
z.append(`frame_${ye}`, ae, `frame_${ye}.jpg`);
|
|
2226
|
+
}), z.append("totalFrames", d.current.length.toString()), z.append("stepSequence", JSON.stringify(["blink", "open_mouth"]));
|
|
2227
|
+
const H = await fetch(he, {
|
|
2115
2228
|
method: "POST",
|
|
2116
|
-
|
|
2229
|
+
headers: {
|
|
2230
|
+
...N ? { "X-App-Id": N } : {}
|
|
2231
|
+
},
|
|
2232
|
+
body: z,
|
|
2117
2233
|
credentials: "include"
|
|
2118
2234
|
});
|
|
2119
|
-
if (!
|
|
2120
|
-
const
|
|
2121
|
-
throw new Error(
|
|
2235
|
+
if (!H.ok) {
|
|
2236
|
+
const ae = await H.json().catch(() => ({}));
|
|
2237
|
+
throw new Error(ae.error || `Liveness check failed with status ${H.status}`);
|
|
2238
|
+
}
|
|
2239
|
+
const oe = await H.json();
|
|
2240
|
+
if (X ? oe.success && (((v = oe.liveness) == null ? void 0 : v.success) || ((M = oe.liveness) == null ? void 0 : M.status) === "completed" || ((Z = oe.liveness) == null ? void 0 : Z.status) === "approved") : oe.success && oe.passed)
|
|
2241
|
+
h.current && h.current.stop(), c.current && c.current.getTracks().forEach((ae) => ae.stop()), a(!0);
|
|
2242
|
+
else {
|
|
2243
|
+
const ae = oe.error || ((fe = oe.liveness) == null ? void 0 : fe.error) || "Liveness check failed. Please try again.";
|
|
2244
|
+
k(ae), ue(0), te(0), q(0), d.current = [], w(!1), de.current = !1;
|
|
2122
2245
|
}
|
|
2123
|
-
const v = await U.json();
|
|
2124
|
-
v.success && ((E = v.liveness) != null && E.passed) ? (n.current && n.current.getTracks().forEach((k) => k.stop()), i(!0)) : (_(v.error || "Liveness check failed. Please try again."), g(0), d.current = [], I(!1));
|
|
2125
2246
|
} catch {
|
|
2126
|
-
|
|
2247
|
+
k("Verification failed. Please try again."), ue(0), te(0), q(0), d.current = [], w(!1), n == null || n("Liveness submission failed");
|
|
2127
2248
|
}
|
|
2128
|
-
},
|
|
2129
|
-
|
|
2249
|
+
}, U = () => {
|
|
2250
|
+
k(""), ue(0), te(0), q(0), d.current = [], w(!1), de.current = !1;
|
|
2130
2251
|
};
|
|
2131
|
-
return T ? /* @__PURE__ */
|
|
2132
|
-
|
|
2252
|
+
return T ? /* @__PURE__ */ i(
|
|
2253
|
+
P.div,
|
|
2133
2254
|
{
|
|
2134
2255
|
initial: { opacity: 0 },
|
|
2135
2256
|
animate: { opacity: 1 },
|
|
2136
|
-
className: "flex-1 flex flex-col items-center justify-center px-8 text-center",
|
|
2257
|
+
className: "flex-1 flex flex-col items-center justify-center px-8 text-center bg-black",
|
|
2137
2258
|
children: [
|
|
2138
|
-
/* @__PURE__ */ e(
|
|
2139
|
-
/* @__PURE__ */ e("h2", { className: "text-xl font-bold text-
|
|
2140
|
-
/* @__PURE__ */ e("p", { className: "text-
|
|
2259
|
+
/* @__PURE__ */ e("div", { className: "w-16 h-16 text-red-500 mb-6 text-5xl", children: "⚠️" }),
|
|
2260
|
+
/* @__PURE__ */ e("h2", { className: "text-xl font-bold text-white mb-3", children: "Camera Access Required" }),
|
|
2261
|
+
/* @__PURE__ */ e("p", { className: "text-gray-400 text-sm mb-6", children: "Please enable camera access in your browser settings to continue with face verification." }),
|
|
2141
2262
|
/* @__PURE__ */ e(
|
|
2142
2263
|
"button",
|
|
2143
2264
|
{
|
|
2144
2265
|
onClick: () => window.location.reload(),
|
|
2145
|
-
className: "px-6 py-3 bg-
|
|
2266
|
+
className: "px-6 py-3 bg-[#8651e1] text-white rounded-2xl font-bold",
|
|
2146
2267
|
children: "Try Again"
|
|
2147
2268
|
}
|
|
2148
2269
|
)
|
|
2149
2270
|
]
|
|
2150
2271
|
}
|
|
2151
|
-
) : /* @__PURE__ */
|
|
2152
|
-
|
|
2272
|
+
) : /* @__PURE__ */ i(
|
|
2273
|
+
P.div,
|
|
2153
2274
|
{
|
|
2154
2275
|
initial: { opacity: 0 },
|
|
2155
2276
|
animate: { opacity: 1 },
|
|
2156
2277
|
exit: { opacity: 0 },
|
|
2157
|
-
className: "flex-1 flex flex-col relative
|
|
2278
|
+
className: "flex-1 flex flex-col relative bg-black overflow-hidden",
|
|
2158
2279
|
children: [
|
|
2159
|
-
/* @__PURE__ */ e(
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
mask: "radial-gradient(ellipse 100px 145px at center, transparent 99%, black 100%)",
|
|
2172
|
-
WebkitMask: "radial-gradient(ellipse 100px 145px at center, transparent 99%, black 100%)"
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
),
|
|
2176
|
-
/* @__PURE__ */ a("div", { className: "relative z-30 flex items-center justify-center", children: [
|
|
2177
|
-
/* @__PURE__ */ a("div", { className: "w-[200px] h-[290px] flex-shrink-0 rounded-full border-[3px] border-[#6fe8ec] shadow-[0_0_40px_rgba(111,232,236,0.4),inset_0_0_20px_rgba(111,232,236,0.2)] relative overflow-hidden", children: [
|
|
2178
|
-
/* @__PURE__ */ e(
|
|
2179
|
-
"video",
|
|
2180
|
-
{
|
|
2181
|
-
ref: u,
|
|
2182
|
-
autoPlay: !0,
|
|
2183
|
-
playsInline: !0,
|
|
2184
|
-
muted: !0,
|
|
2185
|
-
className: "absolute inset-0 w-full h-full object-cover scale-x-[-1]"
|
|
2186
|
-
}
|
|
2187
|
-
),
|
|
2188
|
-
/* @__PURE__ */ e(
|
|
2189
|
-
V.div,
|
|
2190
|
-
{
|
|
2191
|
-
animate: { opacity: [0.4, 1, 0.4] },
|
|
2192
|
-
transition: { duration: 2, repeat: 1 / 0 },
|
|
2193
|
-
className: "absolute inset-0 rounded-full border-[1px] border-white/30"
|
|
2194
|
-
}
|
|
2195
|
-
),
|
|
2196
|
-
/* @__PURE__ */ e(
|
|
2197
|
-
V.div,
|
|
2198
|
-
{
|
|
2199
|
-
animate: { top: ["-10%", "110%"] },
|
|
2200
|
-
transition: { duration: 3, repeat: 1 / 0, ease: "easeInOut" },
|
|
2201
|
-
className: "absolute left-0 w-full h-[3px] bg-gradient-to-r from-transparent via-[#6fe8ec] to-transparent shadow-[0_0_20px_#6fe8ec] z-10"
|
|
2202
|
-
}
|
|
2203
|
-
)
|
|
2204
|
-
] }),
|
|
2205
|
-
/* @__PURE__ */ a("div", { className: "absolute w-[280px] h-[380px] pointer-events-none flex items-center justify-center", children: [
|
|
2206
|
-
/* @__PURE__ */ e("div", { className: "absolute top-0 left-0 w-10 h-10 border-t-2 border-l-2 border-[#6fe8ec]/30 rounded-tl-2xl" }),
|
|
2207
|
-
/* @__PURE__ */ e("div", { className: "absolute top-0 right-0 w-10 h-10 border-t-2 border-r-2 border-[#6fe8ec]/30 rounded-tr-2xl" }),
|
|
2208
|
-
/* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 w-10 h-10 border-b-2 border-l-2 border-[#6fe8ec]/30 rounded-bl-2xl" }),
|
|
2209
|
-
/* @__PURE__ */ e("div", { className: "absolute bottom-0 right-0 w-10 h-10 border-b-2 border-r-2 border-[#6fe8ec]/30 rounded-br-2xl" })
|
|
2210
|
-
] })
|
|
2211
|
-
] })
|
|
2212
|
-
] }),
|
|
2213
|
-
/* @__PURE__ */ a("footer", { className: "relative z-40 p-8 flex flex-col items-center gap-6", children: [
|
|
2214
|
-
h ? /* @__PURE__ */ a("div", { className: "dark:bg-red-900/30 bg-red-50 backdrop-blur-2xl border border-red-500/30 w-full p-6 rounded-[2.5rem] text-center", children: [
|
|
2215
|
-
/* @__PURE__ */ e("p", { className: "text-red-500 font-bold text-lg mb-4", children: h }),
|
|
2280
|
+
/* @__PURE__ */ e(
|
|
2281
|
+
"video",
|
|
2282
|
+
{
|
|
2283
|
+
ref: m,
|
|
2284
|
+
className: "hidden",
|
|
2285
|
+
playsInline: !0,
|
|
2286
|
+
muted: !0
|
|
2287
|
+
}
|
|
2288
|
+
),
|
|
2289
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0 z-0 bg-gradient-to-b from-transparent via-[#8651e1]/5 to-[#8651e1]/10 pointer-events-none" }),
|
|
2290
|
+
/* @__PURE__ */ e("div", { className: "relative z-20 flex-1 flex flex-col items-center justify-center pt-8", children: /* @__PURE__ */ i("div", { className: "relative w-72 h-96 flex items-center justify-center", children: [
|
|
2291
|
+
/* @__PURE__ */ i("div", { className: "absolute inset-0 rounded-[3rem] overflow-hidden border-2 border-slate-200 dark:border-white/10 shadow-2xl", children: [
|
|
2216
2292
|
/* @__PURE__ */ e(
|
|
2217
|
-
"
|
|
2293
|
+
"canvas",
|
|
2218
2294
|
{
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2295
|
+
ref: s,
|
|
2296
|
+
width: 640,
|
|
2297
|
+
height: 480,
|
|
2298
|
+
className: "w-full h-full object-cover"
|
|
2222
2299
|
}
|
|
2223
|
-
)
|
|
2224
|
-
|
|
2225
|
-
/* @__PURE__ */ e(
|
|
2226
|
-
V.p,
|
|
2227
|
-
{
|
|
2228
|
-
initial: { opacity: 0, y: 10 },
|
|
2229
|
-
animate: { opacity: 1, y: 0 },
|
|
2230
|
-
exit: { opacity: 0, y: -10 },
|
|
2231
|
-
className: "text-[#6fe8ec] font-bold text-2xl tracking-tight mb-2",
|
|
2232
|
-
children: f ? /* @__PURE__ */ a("span", { className: "flex items-center justify-center gap-3", children: [
|
|
2233
|
-
/* @__PURE__ */ e(ee, { className: "w-6 h-6 animate-spin" }),
|
|
2234
|
-
"Verifying..."
|
|
2235
|
-
] }) : t(de[m], l)
|
|
2236
|
-
},
|
|
2237
|
-
m
|
|
2238
|
-
) }),
|
|
2239
|
-
/* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-2 text-muted text-[10px] font-bold uppercase tracking-widest", children: [
|
|
2240
|
-
/* @__PURE__ */ e(Ae, { className: "w-3 h-3" }),
|
|
2241
|
-
t("secure_face_scan_desc", l)
|
|
2242
|
-
] })
|
|
2300
|
+
),
|
|
2301
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-[#8651e1]/10 mix-blend-overlay" }),
|
|
2302
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-gradient-to-t from-black via-transparent to-transparent h-1/3 mt-auto" })
|
|
2243
2303
|
] }),
|
|
2244
|
-
/* @__PURE__ */ e("div", { className: "
|
|
2245
|
-
"
|
|
2304
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0 z-30 pointer-events-none", children: [
|
|
2305
|
+
{ t: "30%", l: "50%" },
|
|
2306
|
+
{ t: "35%", l: "40%" },
|
|
2307
|
+
{ t: "35%", l: "60%" },
|
|
2308
|
+
{ t: "45%", l: "50%" },
|
|
2309
|
+
{ t: "52%", l: "35%" },
|
|
2310
|
+
{ t: "52%", l: "65%" },
|
|
2311
|
+
{ t: "60%", l: "45%" },
|
|
2312
|
+
{ t: "60%", l: "55%" },
|
|
2313
|
+
{ t: "70%", l: "50%" }
|
|
2314
|
+
].map((v, M) => /* @__PURE__ */ e(
|
|
2315
|
+
P.div,
|
|
2246
2316
|
{
|
|
2247
|
-
|
|
2317
|
+
initial: { scale: 0, opacity: 0 },
|
|
2318
|
+
animate: {
|
|
2319
|
+
scale: [0, 1.5, 1],
|
|
2320
|
+
opacity: pe > M * 11 ? 1 : 0
|
|
2321
|
+
},
|
|
2322
|
+
className: "absolute w-2 h-2 bg-[#6DE8EC] rounded-full shadow-[0_0_12px_#6DE8EC]",
|
|
2323
|
+
style: { top: v.t, left: v.l }
|
|
2248
2324
|
},
|
|
2249
|
-
|
|
2325
|
+
M
|
|
2250
2326
|
)) }),
|
|
2251
|
-
/* @__PURE__ */
|
|
2327
|
+
/* @__PURE__ */ i("div", { className: "absolute -inset-6 z-40", children: [
|
|
2252
2328
|
/* @__PURE__ */ e(
|
|
2253
|
-
|
|
2329
|
+
P.div,
|
|
2330
|
+
{
|
|
2331
|
+
animate: { opacity: [0.3, 1, 0.3] },
|
|
2332
|
+
transition: { duration: 2, repeat: 1 / 0 },
|
|
2333
|
+
className: "absolute top-0 left-0 w-20 h-20 border-t-4 border-l-4 border-[#14b8a6] rounded-tl-[3.5rem]"
|
|
2334
|
+
}
|
|
2335
|
+
),
|
|
2336
|
+
/* @__PURE__ */ e(
|
|
2337
|
+
P.div,
|
|
2254
2338
|
{
|
|
2255
|
-
|
|
2339
|
+
animate: { opacity: [0.3, 1, 0.3] },
|
|
2340
|
+
transition: { duration: 2, repeat: 1 / 0 },
|
|
2341
|
+
className: "absolute top-0 right-0 w-20 h-20 border-t-4 border-r-4 border-[#14b8a6] rounded-tr-[3.5rem]"
|
|
2256
2342
|
}
|
|
2257
2343
|
),
|
|
2258
|
-
/* @__PURE__ */ e(
|
|
2344
|
+
/* @__PURE__ */ e(
|
|
2345
|
+
P.div,
|
|
2346
|
+
{
|
|
2347
|
+
animate: { opacity: [0.3, 1, 0.3] },
|
|
2348
|
+
transition: { duration: 2, repeat: 1 / 0 },
|
|
2349
|
+
className: "absolute bottom-0 left-0 w-20 h-20 border-b-4 border-l-4 border-[#14b8a6] rounded-bl-[3.5rem]"
|
|
2350
|
+
}
|
|
2351
|
+
),
|
|
2352
|
+
/* @__PURE__ */ e(
|
|
2353
|
+
P.div,
|
|
2354
|
+
{
|
|
2355
|
+
animate: { opacity: [0.3, 1, 0.3] },
|
|
2356
|
+
transition: { duration: 2, repeat: 1 / 0 },
|
|
2357
|
+
className: "absolute bottom-0 right-0 w-20 h-20 border-b-4 border-r-4 border-[#14b8a6] rounded-br-[3.5rem]"
|
|
2358
|
+
}
|
|
2359
|
+
)
|
|
2360
|
+
] }),
|
|
2361
|
+
/* @__PURE__ */ e(
|
|
2362
|
+
P.div,
|
|
2363
|
+
{
|
|
2364
|
+
animate: { top: ["0%", "100%"] },
|
|
2365
|
+
transition: { duration: 3, repeat: 1 / 0, ease: "linear" },
|
|
2366
|
+
className: "absolute left-0 right-0 h-1 bg-gradient-to-r from-transparent via-[#6DE8EC] to-transparent shadow-[0_0_15px_#6DE8EC] z-50 pointer-events-none",
|
|
2367
|
+
style: { borderRadius: "100%" }
|
|
2368
|
+
}
|
|
2369
|
+
)
|
|
2370
|
+
] }) }),
|
|
2371
|
+
/* @__PURE__ */ i("div", { className: "relative z-50 px-8 pb-20 pt-4 flex flex-col items-center gap-6", children: [
|
|
2372
|
+
g ? /* @__PURE__ */ i(
|
|
2373
|
+
P.div,
|
|
2374
|
+
{
|
|
2375
|
+
initial: { opacity: 0, scale: 0.9 },
|
|
2376
|
+
animate: { opacity: 1, scale: 1 },
|
|
2377
|
+
className: "bg-red-900/30 border border-red-500/50 p-6 rounded-3xl w-full text-center",
|
|
2378
|
+
children: [
|
|
2379
|
+
/* @__PURE__ */ e("p", { className: "text-red-400 font-bold text-lg mb-4", children: g }),
|
|
2380
|
+
/* @__PURE__ */ e(
|
|
2381
|
+
"button",
|
|
2382
|
+
{
|
|
2383
|
+
onClick: U,
|
|
2384
|
+
className: "px-8 py-3 bg-red-500 hover:bg-red-600 text-white rounded-xl font-bold transition-colors",
|
|
2385
|
+
children: "Try Again"
|
|
2386
|
+
}
|
|
2387
|
+
)
|
|
2388
|
+
]
|
|
2389
|
+
}
|
|
2390
|
+
) : /* @__PURE__ */ e(Me, { mode: "wait", children: /* @__PURE__ */ e(
|
|
2391
|
+
P.div,
|
|
2392
|
+
{
|
|
2393
|
+
initial: { opacity: 0, y: 10, filter: "blur(5px)" },
|
|
2394
|
+
animate: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
2395
|
+
exit: { opacity: 0, y: -10, filter: "blur(5px)" },
|
|
2396
|
+
className: "text-white text-center font-bold text-xl leading-tight min-h-[3rem] flex items-center justify-center drop-shadow-lg flex-col gap-2",
|
|
2397
|
+
children: V && A === 4 ? /* @__PURE__ */ i("span", { className: "flex items-center gap-3", children: [
|
|
2398
|
+
/* @__PURE__ */ i("svg", { className: "animate-spin h-5 w-5", viewBox: "0 0 24 24", children: [
|
|
2399
|
+
/* @__PURE__ */ e("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4", fill: "none" }),
|
|
2400
|
+
/* @__PURE__ */ e("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
2401
|
+
] }),
|
|
2402
|
+
ke[A]
|
|
2403
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
2404
|
+
/* @__PURE__ */ e("span", { children: ke[A] }),
|
|
2405
|
+
A === 1 && /* @__PURE__ */ i("span", { className: "text-[#6DE8EC] text-2xl", children: [
|
|
2406
|
+
"(",
|
|
2407
|
+
W,
|
|
2408
|
+
"/3)"
|
|
2409
|
+
] })
|
|
2410
|
+
] })
|
|
2411
|
+
},
|
|
2412
|
+
A === 1 ? `${ke[A]}-${W}` : ke[A]
|
|
2413
|
+
) }),
|
|
2414
|
+
/* @__PURE__ */ e("div", { className: "w-full max-w-[240px] h-1.5 bg-slate-200 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ e(
|
|
2415
|
+
P.div,
|
|
2416
|
+
{
|
|
2417
|
+
className: "h-full bg-gradient-to-r from-[#8651e1] to-[#6DE8EC]",
|
|
2418
|
+
animate: { width: `${pe}%` },
|
|
2419
|
+
transition: { duration: 0.3 }
|
|
2420
|
+
}
|
|
2421
|
+
) }),
|
|
2422
|
+
!g && /* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-gray-400 text-xs", children: [
|
|
2423
|
+
/* @__PURE__ */ e("div", { className: `w-2 h-2 rounded-full ${o ? "bg-[#6DE8EC] shadow-[0_0_8px_#6DE8EC]" : "bg-yellow-500 animate-pulse"}` }),
|
|
2424
|
+
/* @__PURE__ */ e("span", { className: "uppercase tracking-widest font-bold", children: o ? "LIVE CAMERA" : "INITIALIZING..." })
|
|
2259
2425
|
] })
|
|
2260
2426
|
] })
|
|
2261
2427
|
]
|
|
2262
2428
|
}
|
|
2263
2429
|
);
|
|
2264
|
-
},
|
|
2265
|
-
{ id: "passport", title: "Passport", desc: "All countries supported", Icon:
|
|
2266
|
-
{ id: "drivers_license", title: "Driver License", desc: "Government issued card", Icon:
|
|
2267
|
-
{ id: "national_id", title: "ID Card", desc: "National identity document", Icon:
|
|
2268
|
-
],
|
|
2269
|
-
|
|
2430
|
+
}, Xt = [
|
|
2431
|
+
{ id: "passport", title: "Passport", desc: "All countries supported", Icon: et },
|
|
2432
|
+
{ id: "drivers_license", title: "Driver License", desc: "Government issued card", Icon: Qe },
|
|
2433
|
+
{ id: "national_id", title: "ID Card", desc: "National identity document", Icon: qe }
|
|
2434
|
+
], Qt = ({ onNext: r, language: a = "EN" }) => /* @__PURE__ */ i(
|
|
2435
|
+
P.div,
|
|
2270
2436
|
{
|
|
2271
2437
|
initial: { opacity: 0, x: 20 },
|
|
2272
2438
|
animate: { opacity: 1, x: 0 },
|
|
2273
2439
|
exit: { opacity: 0, x: -20 },
|
|
2274
2440
|
className: "flex-1 px-6 pt-4 flex flex-col",
|
|
2275
2441
|
children: [
|
|
2276
|
-
/* @__PURE__ */ e("h3", { className: "text-2xl font-bold mb-2 text-main", children: t("verify_identity",
|
|
2277
|
-
/* @__PURE__ */ e("p", { className: "text-muted text-sm mb-8 leading-relaxed", children: t("choose_document",
|
|
2278
|
-
/* @__PURE__ */
|
|
2279
|
-
|
|
2442
|
+
/* @__PURE__ */ e("h3", { className: "text-2xl font-bold mb-2 text-main", children: t("verify_identity", a) }),
|
|
2443
|
+
/* @__PURE__ */ e("p", { className: "text-muted text-sm mb-8 leading-relaxed", children: t("choose_document", a) }),
|
|
2444
|
+
/* @__PURE__ */ i("div", { className: "space-y-4 overflow-y-auto pr-1 pb-6", children: [
|
|
2445
|
+
Xt.map(({ id: n, title: l, desc: N, Icon: p }) => /* @__PURE__ */ i(
|
|
2280
2446
|
"button",
|
|
2281
2447
|
{
|
|
2282
|
-
onClick: () => r(
|
|
2448
|
+
onClick: () => r(n),
|
|
2283
2449
|
className: "w-full group cursor-pointer dark:bg-white/5 bg-slate-100/50 border dark:border-white/10 border-slate-200 rounded-2xl p-5 flex items-center gap-4 hover:dark:bg-brand/15 hover:bg-brand/5 hover:dark:border-brand-40 hover:border-brand-30 transition-all transform hover:-translate-y-1",
|
|
2284
2450
|
children: [
|
|
2285
|
-
/* @__PURE__ */ e("div", { className: "w-14 h-14 rounded-xl dark:bg-slate-800/50 bg-white flex items-center justify-center text-brand group-hover:bg-brand/20 transition-colors border dark:border-transparent border-slate-100", children: /* @__PURE__ */ e(
|
|
2286
|
-
/* @__PURE__ */
|
|
2287
|
-
/* @__PURE__ */ e("h4", { className: "font-bold text-base text-main", children: t(
|
|
2288
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted font-medium", children: t(`${
|
|
2451
|
+
/* @__PURE__ */ e("div", { className: "w-14 h-14 rounded-xl dark:bg-slate-800/50 bg-white flex items-center justify-center text-brand group-hover:bg-brand/20 transition-colors border dark:border-transparent border-slate-100", children: /* @__PURE__ */ e(p, { className: "w-8 h-8" }) }),
|
|
2452
|
+
/* @__PURE__ */ i("div", { className: "flex-1 text-left", children: [
|
|
2453
|
+
/* @__PURE__ */ e("h4", { className: "font-bold text-base text-main", children: t(n, a) }),
|
|
2454
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted font-medium", children: t(`${n}_desc`, a) })
|
|
2289
2455
|
] }),
|
|
2290
|
-
/* @__PURE__ */ e(
|
|
2456
|
+
/* @__PURE__ */ e(Le, { className: "text-brand w-5 h-5" })
|
|
2291
2457
|
]
|
|
2292
2458
|
},
|
|
2293
|
-
|
|
2459
|
+
n
|
|
2294
2460
|
)),
|
|
2295
|
-
/* @__PURE__ */
|
|
2461
|
+
/* @__PURE__ */ i("div", { className: "mt-8 relative h-32 w-full rounded-2xl overflow-hidden dark:bg-white/5 bg-slate-100/30 flex items-center justify-center border border-dashed dark:border-brand-30 border-brand-40", children: [
|
|
2296
2462
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 opacity-10 bg-[radial-gradient(circle_at_center,_var(--tw-gradient-stops))] from-brand via-transparent to-transparent" }),
|
|
2297
|
-
/* @__PURE__ */
|
|
2298
|
-
/* @__PURE__ */ e(
|
|
2463
|
+
/* @__PURE__ */ i("div", { className: "text-center z-10", children: [
|
|
2464
|
+
/* @__PURE__ */ e(Se, { className: "text-brand/40 w-10 h-10 mx-auto mb-1" }),
|
|
2299
2465
|
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted uppercase tracking-tighter font-bold", children: "Encrypted E2E" })
|
|
2300
2466
|
] })
|
|
2301
2467
|
] })
|
|
2302
2468
|
] })
|
|
2303
2469
|
]
|
|
2304
2470
|
}
|
|
2305
|
-
),
|
|
2471
|
+
), ei = (r) => ({
|
|
2306
2472
|
passport: t("passport", r),
|
|
2307
2473
|
drivers_license: t("drivers_license", r),
|
|
2308
2474
|
national_id: t("national_id", r)
|
|
2309
|
-
}),
|
|
2475
|
+
}), ti = ({
|
|
2310
2476
|
requestId: r,
|
|
2311
|
-
documentType:
|
|
2312
|
-
onNext:
|
|
2313
|
-
onError:
|
|
2314
|
-
apiBaseUrl:
|
|
2315
|
-
|
|
2316
|
-
|
|
2477
|
+
documentType: a,
|
|
2478
|
+
onNext: n,
|
|
2479
|
+
onError: l,
|
|
2480
|
+
apiBaseUrl: N = "https://apis.casperid.com",
|
|
2481
|
+
apiKey: p = "",
|
|
2482
|
+
previewMode: f = !1,
|
|
2483
|
+
language: m = "EN"
|
|
2317
2484
|
}) => {
|
|
2318
|
-
const
|
|
2319
|
-
|
|
2485
|
+
const s = se(null), c = se(null), d = se(null), [D, h] = y(!1), [A, _] = y(null), [o, I] = y(null), [g, k] = y(!1), [V, w] = y(""), [T, Y] = y("front"), [W, B] = y(null);
|
|
2486
|
+
ce(() => ((async () => {
|
|
2320
2487
|
try {
|
|
2321
|
-
const
|
|
2488
|
+
const O = await navigator.mediaDevices.getUserMedia({
|
|
2322
2489
|
video: {
|
|
2323
2490
|
facingMode: "environment",
|
|
2324
2491
|
// Use back camera for documents
|
|
@@ -2326,100 +2493,111 @@ const $t = ({
|
|
|
2326
2493
|
height: { ideal: 720 }
|
|
2327
2494
|
}
|
|
2328
2495
|
});
|
|
2329
|
-
d.current =
|
|
2330
|
-
|
|
2496
|
+
d.current = O, s.current && (s.current.srcObject = O, s.current.onloadedmetadata = () => {
|
|
2497
|
+
h(!0);
|
|
2331
2498
|
});
|
|
2332
2499
|
} catch {
|
|
2333
2500
|
try {
|
|
2334
|
-
const
|
|
2501
|
+
const F = await navigator.mediaDevices.getUserMedia({
|
|
2335
2502
|
video: { facingMode: "user", width: { ideal: 1280 }, height: { ideal: 720 } }
|
|
2336
2503
|
});
|
|
2337
|
-
d.current =
|
|
2338
|
-
|
|
2504
|
+
d.current = F, s.current && (s.current.srcObject = F, s.current.onloadedmetadata = () => {
|
|
2505
|
+
h(!0);
|
|
2339
2506
|
});
|
|
2340
2507
|
} catch {
|
|
2341
|
-
|
|
2508
|
+
w(t("unable_access_camera", m)), l == null || l("Camera access failed");
|
|
2342
2509
|
}
|
|
2343
2510
|
}
|
|
2344
2511
|
})(), () => {
|
|
2345
|
-
d.current && d.current.getTracks().forEach((
|
|
2346
|
-
}), [
|
|
2347
|
-
const
|
|
2348
|
-
if (!
|
|
2349
|
-
const
|
|
2350
|
-
|
|
2351
|
-
|
|
2512
|
+
d.current && d.current.getTracks().forEach((O) => O.stop()), o && URL.revokeObjectURL(o);
|
|
2513
|
+
}), [l]);
|
|
2514
|
+
const b = async () => {
|
|
2515
|
+
if (!s.current || !c.current) return;
|
|
2516
|
+
const L = c.current, O = s.current, F = L.getContext("2d");
|
|
2517
|
+
F && (L.width = O.videoWidth, L.height = O.videoHeight, F.drawImage(O, 0, 0), L.toBlob((G) => {
|
|
2518
|
+
G && (_(G), I(URL.createObjectURL(G)));
|
|
2352
2519
|
}, "image/jpeg", 0.9));
|
|
2353
|
-
},
|
|
2354
|
-
|
|
2355
|
-
},
|
|
2356
|
-
if (
|
|
2520
|
+
}, C = () => {
|
|
2521
|
+
o && URL.revokeObjectURL(o), _(null), I(null), w("");
|
|
2522
|
+
}, S = async () => {
|
|
2523
|
+
if (k(!0), f) {
|
|
2357
2524
|
setTimeout(() => {
|
|
2358
|
-
|
|
2525
|
+
k(!1), n({
|
|
2359
2526
|
first_name: "JOHN",
|
|
2360
2527
|
last_name: "DOE",
|
|
2361
2528
|
date_of_birth: "01 JAN 1990",
|
|
2362
|
-
nationality: "
|
|
2363
|
-
}, "mock-upload-id-789"
|
|
2529
|
+
nationality: ""
|
|
2530
|
+
}, "mock-upload-id-789", {
|
|
2531
|
+
frontImageUrl: "mock-front-url",
|
|
2532
|
+
frontImageFileId: "mock-front-id",
|
|
2533
|
+
backImageUrl: "mock-back-url",
|
|
2534
|
+
backImageFileId: "mock-back-id"
|
|
2535
|
+
});
|
|
2364
2536
|
}, 2e3);
|
|
2365
2537
|
return;
|
|
2366
2538
|
}
|
|
2367
|
-
if (!
|
|
2368
|
-
|
|
2539
|
+
if (!A) {
|
|
2540
|
+
k(!1);
|
|
2369
2541
|
return;
|
|
2370
2542
|
}
|
|
2371
|
-
if (
|
|
2372
|
-
|
|
2543
|
+
if (T === "front" && a !== "passport") {
|
|
2544
|
+
B(A), _(null), I(null), Y("back"), k(!1);
|
|
2373
2545
|
return;
|
|
2374
2546
|
}
|
|
2375
|
-
|
|
2547
|
+
k(!0), w("");
|
|
2376
2548
|
try {
|
|
2377
|
-
const
|
|
2378
|
-
|
|
2379
|
-
const
|
|
2549
|
+
const L = new FormData();
|
|
2550
|
+
L.append("document_type", a), W ? (L.append("front_image", W, "front.jpg"), L.append("back_image", A, "back.jpg")) : L.append("front_image", A, "document.jpg");
|
|
2551
|
+
const O = await fetch(`${N}/api/v2/verification/layer3/documents/upload`, {
|
|
2380
2552
|
method: "POST",
|
|
2381
|
-
body:
|
|
2553
|
+
body: L,
|
|
2382
2554
|
credentials: "include",
|
|
2383
2555
|
headers: {
|
|
2384
|
-
"X-Request-Id": r
|
|
2556
|
+
"X-Request-Id": r,
|
|
2557
|
+
...p ? { "X-App-Id": p } : {}
|
|
2385
2558
|
}
|
|
2386
2559
|
});
|
|
2387
|
-
if (!
|
|
2388
|
-
const
|
|
2389
|
-
throw new Error(
|
|
2560
|
+
if (!O.ok) {
|
|
2561
|
+
const G = await O.json().catch(() => ({}));
|
|
2562
|
+
throw new Error(G.error || `Document upload failed with status ${O.status}`);
|
|
2390
2563
|
}
|
|
2391
|
-
const
|
|
2392
|
-
|
|
2564
|
+
const F = await O.json();
|
|
2565
|
+
F.success && F.extracted_data ? (d.current && d.current.getTracks().forEach((G) => G.stop()), n(F.extracted_data, F.upload_id || "", {
|
|
2566
|
+
frontImageUrl: F.front_image_url,
|
|
2567
|
+
frontImageFileId: F.front_image_file_id,
|
|
2568
|
+
backImageUrl: F.back_image_url,
|
|
2569
|
+
backImageFileId: F.back_image_file_id
|
|
2570
|
+
})) : (w(F.error || "Failed to process document. Please try again."), k(!1));
|
|
2393
2571
|
} catch {
|
|
2394
|
-
|
|
2572
|
+
w("Upload failed. Please try again."), k(!1), l == null || l("Document upload failed");
|
|
2395
2573
|
}
|
|
2396
2574
|
};
|
|
2397
|
-
return /* @__PURE__ */
|
|
2398
|
-
|
|
2575
|
+
return /* @__PURE__ */ i(
|
|
2576
|
+
P.div,
|
|
2399
2577
|
{
|
|
2400
2578
|
initial: { opacity: 0 },
|
|
2401
2579
|
animate: { opacity: 1 },
|
|
2402
2580
|
exit: { opacity: 0 },
|
|
2403
2581
|
className: "flex-1 flex flex-col relative",
|
|
2404
2582
|
children: [
|
|
2405
|
-
/* @__PURE__ */ e("canvas", { ref:
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */ e("div", { className: "w-full h-full bg-
|
|
2583
|
+
/* @__PURE__ */ e("canvas", { ref: c, className: "hidden" }),
|
|
2584
|
+
/* @__PURE__ */ i("div", { className: "absolute inset-0 z-0", children: [
|
|
2585
|
+
/* @__PURE__ */ e("div", { className: "w-full h-full bg-main opacity-10 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-full h-full opacity-30 bg-[radial-gradient(circle_at_center,_var(--tw-gradient-stops))] from-[#6DE8EC]/20 via-transparent to-transparent" }) }),
|
|
2408
2586
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-black/30 backdrop-blur-[2px]" })
|
|
2409
2587
|
] }),
|
|
2410
|
-
/* @__PURE__ */ e("div", { className: "relative z-10 p-6 flex flex-col items-center", children: /* @__PURE__ */ e("div", { className: "text-center px-4 py-2
|
|
2411
|
-
/* @__PURE__ */ e("div", { className: "relative z-10 flex-1 flex items-center justify-center px-6", children: /* @__PURE__ */
|
|
2412
|
-
|
|
2588
|
+
/* @__PURE__ */ e("div", { className: "relative z-10 p-6 flex flex-col items-center", children: /* @__PURE__ */ e("div", { className: "text-center px-4 py-2 bg-brand-10 backdrop-blur-xl rounded-full border border-brand-10", children: /* @__PURE__ */ e("h3", { className: "text-main text-sm font-medium tracking-wide uppercase", children: t("scan_instruction", m).replace("{side}", t(T, m)).replace("{docType}", ei(m)[a]) }) }) }),
|
|
2589
|
+
/* @__PURE__ */ e("div", { className: "relative z-10 flex-1 flex items-center justify-center px-6", children: /* @__PURE__ */ i("div", { className: "w-full aspect-[1.58/1] relative", children: [
|
|
2590
|
+
o ? /* @__PURE__ */ e(
|
|
2413
2591
|
"img",
|
|
2414
2592
|
{
|
|
2415
|
-
src:
|
|
2593
|
+
src: o,
|
|
2416
2594
|
alt: "Captured document",
|
|
2417
2595
|
className: "absolute inset-0 w-full h-full object-cover rounded-2xl"
|
|
2418
2596
|
}
|
|
2419
2597
|
) : /* @__PURE__ */ e(
|
|
2420
2598
|
"video",
|
|
2421
2599
|
{
|
|
2422
|
-
ref:
|
|
2600
|
+
ref: s,
|
|
2423
2601
|
autoPlay: !0,
|
|
2424
2602
|
playsInline: !0,
|
|
2425
2603
|
muted: !0,
|
|
@@ -2431,453 +2609,531 @@ const $t = ({
|
|
|
2431
2609
|
/* @__PURE__ */ e("div", { className: "absolute top-0 right-0 w-8 h-8 border-t-4 border-r-4 border-[#6DE8EC] rounded-tr-2xl" }),
|
|
2432
2610
|
/* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 w-8 h-8 border-b-4 border-l-4 border-[#6DE8EC] rounded-bl-2xl" }),
|
|
2433
2611
|
/* @__PURE__ */ e("div", { className: "absolute bottom-0 right-0 w-8 h-8 border-b-4 border-r-4 border-[#6DE8EC] rounded-br-2xl" }),
|
|
2434
|
-
!
|
|
2435
|
-
|
|
2612
|
+
!o && D && /* @__PURE__ */ e(
|
|
2613
|
+
P.div,
|
|
2436
2614
|
{
|
|
2437
2615
|
animate: { top: ["0%", "100%", "0%"] },
|
|
2438
2616
|
transition: { duration: 4, repeat: 1 / 0, ease: "linear" },
|
|
2439
2617
|
className: "absolute left-0 w-full h-[2px] bg-gradient-to-r from-transparent via-[#6DE8EC] to-transparent opacity-50"
|
|
2440
2618
|
}
|
|
2441
2619
|
),
|
|
2442
|
-
!
|
|
2620
|
+
!D && !o && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 rounded-2xl", children: /* @__PURE__ */ e(_e, { className: "w-8 h-8 text-[#6DE8EC] animate-spin" }) })
|
|
2443
2621
|
] }) }),
|
|
2444
|
-
|
|
2445
|
-
/* @__PURE__ */ e(
|
|
2446
|
-
/* @__PURE__ */ e("p", { className: "text-red-400 text-sm font-medium", children:
|
|
2622
|
+
V && /* @__PURE__ */ i("div", { className: "relative z-10 mx-6 mb-4 p-4 bg-red-500/20 border border-red-500/30 rounded-xl flex items-center gap-3", children: [
|
|
2623
|
+
/* @__PURE__ */ e(ve, { className: "w-5 h-5 text-red-500 shrink-0" }),
|
|
2624
|
+
/* @__PURE__ */ e("p", { className: "text-red-400 text-sm font-medium", children: V })
|
|
2447
2625
|
] }),
|
|
2448
|
-
/* @__PURE__ */
|
|
2449
|
-
/* @__PURE__ */ e("p", { className: "text-muted text-xs text-center mb-6 font-medium", children: t(
|
|
2450
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-between gap-4", children:
|
|
2626
|
+
/* @__PURE__ */ i("div", { className: "relative z-10 p-8 glass-container backdrop-blur-2xl border-t border-brand-10 rounded-t-3xl", children: [
|
|
2627
|
+
/* @__PURE__ */ e("p", { className: "text-muted text-xs text-center mb-6 font-medium", children: t(o ? "review_capture" : "align_document", m) }),
|
|
2628
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-between gap-4", children: o ? /* @__PURE__ */ i(re, { children: [
|
|
2451
2629
|
/* @__PURE__ */ e(
|
|
2452
2630
|
"button",
|
|
2453
2631
|
{
|
|
2454
|
-
onClick:
|
|
2455
|
-
disabled:
|
|
2456
|
-
className: "w-12 h-12 rounded-xl
|
|
2457
|
-
children: /* @__PURE__ */ e(
|
|
2632
|
+
onClick: C,
|
|
2633
|
+
disabled: g,
|
|
2634
|
+
className: "w-12 h-12 rounded-xl bg-brand-5 flex items-center justify-center text-muted disabled:opacity-50",
|
|
2635
|
+
children: /* @__PURE__ */ e(Rt, { className: "w-6 h-6" })
|
|
2458
2636
|
}
|
|
2459
2637
|
),
|
|
2460
2638
|
/* @__PURE__ */ e(
|
|
2461
2639
|
"button",
|
|
2462
2640
|
{
|
|
2463
|
-
onClick:
|
|
2464
|
-
disabled:
|
|
2641
|
+
onClick: S,
|
|
2642
|
+
disabled: g,
|
|
2465
2643
|
className: "flex-1 bg-brand hover:bg-brand/90 text-white h-14 rounded-2xl flex items-center justify-center gap-2 font-bold text-lg transition-all active:scale-95 shadow-[0_0_25px_rgba(130,66,240,0.5)] disabled:opacity-70",
|
|
2466
|
-
children:
|
|
2467
|
-
/* @__PURE__ */ e(
|
|
2468
|
-
/* @__PURE__ */ e("span", { children: t("processing",
|
|
2469
|
-
] }) : /* @__PURE__ */ e("span", { children: t(
|
|
2644
|
+
children: g ? /* @__PURE__ */ i(re, { children: [
|
|
2645
|
+
/* @__PURE__ */ e(_e, { className: "w-6 h-6 animate-spin" }),
|
|
2646
|
+
/* @__PURE__ */ e("span", { children: t("processing", m) })
|
|
2647
|
+
] }) : /* @__PURE__ */ e("span", { children: t(T === "front" && a !== "passport" ? "next_back_side" : "confirm", m) })
|
|
2470
2648
|
}
|
|
2471
2649
|
),
|
|
2472
2650
|
/* @__PURE__ */ e("div", { className: "w-12 h-12" }),
|
|
2473
2651
|
" "
|
|
2474
|
-
] }) : /* @__PURE__ */
|
|
2475
|
-
/* @__PURE__ */ e("button", { className: "w-12 h-12 rounded-xl
|
|
2476
|
-
/* @__PURE__ */
|
|
2652
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
2653
|
+
/* @__PURE__ */ e("button", { className: "w-12 h-12 rounded-xl bg-brand-5 flex items-center justify-center text-muted", children: /* @__PURE__ */ e(It, { className: "w-6 h-6" }) }),
|
|
2654
|
+
/* @__PURE__ */ i(
|
|
2477
2655
|
"button",
|
|
2478
2656
|
{
|
|
2479
|
-
onClick:
|
|
2480
|
-
disabled: !
|
|
2657
|
+
onClick: b,
|
|
2658
|
+
disabled: !D,
|
|
2481
2659
|
className: "flex-1 bg-brand hover:bg-brand/90 text-white h-14 rounded-2xl flex items-center justify-center gap-2 font-bold text-lg transition-all active:scale-95 shadow-[0_0_25px_rgba(130,66,240,0.5)] disabled:opacity-50",
|
|
2482
2660
|
children: [
|
|
2483
|
-
/* @__PURE__ */ e(
|
|
2484
|
-
/* @__PURE__ */ e("span", { children: t("capture",
|
|
2661
|
+
/* @__PURE__ */ e(wt, { className: "w-6 h-6" }),
|
|
2662
|
+
/* @__PURE__ */ e("span", { children: t("capture", m) })
|
|
2485
2663
|
]
|
|
2486
2664
|
}
|
|
2487
2665
|
),
|
|
2488
|
-
/* @__PURE__ */ e("button", { className: "w-12 h-12 rounded-xl
|
|
2666
|
+
/* @__PURE__ */ e("button", { className: "w-12 h-12 rounded-xl bg-brand-5 flex items-center justify-center text-muted", children: /* @__PURE__ */ e(kt, { className: "w-6 h-6" }) })
|
|
2489
2667
|
] }) }),
|
|
2490
|
-
/* @__PURE__ */ e("div", { className: "w-32 h-1.5 bg-
|
|
2668
|
+
/* @__PURE__ */ e("div", { className: "w-32 h-1.5 bg-brand-10 rounded-full mx-auto mt-8" })
|
|
2491
2669
|
] })
|
|
2492
2670
|
]
|
|
2493
2671
|
}
|
|
2494
2672
|
);
|
|
2495
|
-
},
|
|
2673
|
+
}, ii = ({
|
|
2496
2674
|
requestId: r,
|
|
2497
|
-
documentType:
|
|
2498
|
-
extractedData:
|
|
2499
|
-
uploadId:
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2675
|
+
documentType: a,
|
|
2676
|
+
extractedData: n,
|
|
2677
|
+
uploadId: l,
|
|
2678
|
+
frontImageUrl: N,
|
|
2679
|
+
frontImageFileId: p,
|
|
2680
|
+
backImageUrl: f,
|
|
2681
|
+
backImageFileId: m,
|
|
2682
|
+
onNext: s,
|
|
2683
|
+
onRetake: c,
|
|
2684
|
+
onError: d,
|
|
2685
|
+
apiBaseUrl: D = "https://apis.casperid.com",
|
|
2686
|
+
apiKey: h = "",
|
|
2687
|
+
previewMode: A = !1,
|
|
2688
|
+
language: _ = "EN"
|
|
2506
2689
|
}) => {
|
|
2507
|
-
const [
|
|
2508
|
-
firstName:
|
|
2509
|
-
lastName:
|
|
2510
|
-
documentNumber:
|
|
2511
|
-
dateOfBirth:
|
|
2512
|
-
nationality:
|
|
2513
|
-
gender:
|
|
2514
|
-
}), [
|
|
2515
|
-
|
|
2516
|
-
},
|
|
2517
|
-
if (!
|
|
2518
|
-
|
|
2690
|
+
const [o, I] = y({
|
|
2691
|
+
firstName: n.first_name || "",
|
|
2692
|
+
lastName: n.last_name || "",
|
|
2693
|
+
documentNumber: n.document_number || "",
|
|
2694
|
+
dateOfBirth: n.date_of_birth || "",
|
|
2695
|
+
nationality: n.nationality || "",
|
|
2696
|
+
gender: n.gender || ""
|
|
2697
|
+
}), [g, k] = y(!1), [V, w] = y(""), T = (b, C) => {
|
|
2698
|
+
I((S) => ({ ...S, [b]: C }));
|
|
2699
|
+
}, Y = async () => {
|
|
2700
|
+
if (!o.firstName || !o.lastName || !o.documentNumber) {
|
|
2701
|
+
w(t("error_required_fields", _));
|
|
2519
2702
|
return;
|
|
2520
2703
|
}
|
|
2521
|
-
if (
|
|
2704
|
+
if (k(!0), w(""), A) {
|
|
2522
2705
|
setTimeout(() => {
|
|
2523
|
-
|
|
2524
|
-
first_name:
|
|
2525
|
-
last_name:
|
|
2526
|
-
document_number:
|
|
2527
|
-
date_of_birth:
|
|
2528
|
-
nationality:
|
|
2529
|
-
gender:
|
|
2530
|
-
document_type:
|
|
2706
|
+
k(!1), s({
|
|
2707
|
+
first_name: o.firstName,
|
|
2708
|
+
last_name: o.lastName,
|
|
2709
|
+
document_number: o.documentNumber,
|
|
2710
|
+
date_of_birth: o.dateOfBirth,
|
|
2711
|
+
nationality: o.nationality,
|
|
2712
|
+
gender: o.gender,
|
|
2713
|
+
document_type: a
|
|
2531
2714
|
});
|
|
2532
2715
|
}, 1500);
|
|
2533
2716
|
return;
|
|
2534
2717
|
}
|
|
2535
2718
|
try {
|
|
2536
|
-
const
|
|
2719
|
+
const b = await fetch(`${D}/api/v2/verification/layer3/submit`, {
|
|
2537
2720
|
method: "POST",
|
|
2538
2721
|
headers: {
|
|
2539
|
-
"Content-Type": "application/json"
|
|
2722
|
+
"Content-Type": "application/json",
|
|
2723
|
+
...h ? { "X-App-Id": h } : {}
|
|
2540
2724
|
},
|
|
2541
2725
|
credentials: "include",
|
|
2542
2726
|
body: JSON.stringify({
|
|
2543
|
-
upload_id:
|
|
2544
|
-
|
|
2727
|
+
upload_id: l,
|
|
2728
|
+
front_image_url: N,
|
|
2729
|
+
front_image_file_id: p,
|
|
2730
|
+
back_image_url: f,
|
|
2731
|
+
back_image_file_id: m,
|
|
2732
|
+
liveness_verified: !1,
|
|
2733
|
+
// Will be updated after FaceScan
|
|
2545
2734
|
document_data: {
|
|
2546
|
-
first_name:
|
|
2547
|
-
last_name:
|
|
2548
|
-
document_number:
|
|
2549
|
-
date_of_birth:
|
|
2550
|
-
nationality:
|
|
2551
|
-
gender:
|
|
2552
|
-
document_type:
|
|
2735
|
+
first_name: o.firstName,
|
|
2736
|
+
last_name: o.lastName,
|
|
2737
|
+
document_number: o.documentNumber,
|
|
2738
|
+
date_of_birth: o.dateOfBirth,
|
|
2739
|
+
nationality: o.nationality,
|
|
2740
|
+
gender: o.gender,
|
|
2741
|
+
document_type: a
|
|
2553
2742
|
}
|
|
2554
2743
|
})
|
|
2555
2744
|
});
|
|
2556
|
-
if (!
|
|
2557
|
-
const
|
|
2558
|
-
throw new Error(
|
|
2745
|
+
if (!b.ok) {
|
|
2746
|
+
const S = await b.json().catch(() => ({}));
|
|
2747
|
+
throw new Error(S.error || `Data submission failed with status ${b.status}`);
|
|
2559
2748
|
}
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2562
|
-
first_name:
|
|
2563
|
-
last_name:
|
|
2564
|
-
document_number:
|
|
2565
|
-
date_of_birth:
|
|
2566
|
-
nationality:
|
|
2567
|
-
gender:
|
|
2568
|
-
document_type:
|
|
2569
|
-
}) : (
|
|
2749
|
+
const C = await b.json();
|
|
2750
|
+
C.success ? s({
|
|
2751
|
+
first_name: o.firstName,
|
|
2752
|
+
last_name: o.lastName,
|
|
2753
|
+
document_number: o.documentNumber,
|
|
2754
|
+
date_of_birth: o.dateOfBirth,
|
|
2755
|
+
nationality: o.nationality,
|
|
2756
|
+
gender: o.gender,
|
|
2757
|
+
document_type: a
|
|
2758
|
+
}) : (w(C.error || "Failed to submit data. Please try again."), k(!1));
|
|
2570
2759
|
} catch {
|
|
2571
|
-
|
|
2760
|
+
w("Failed to submit data. Please try again."), k(!1), d == null || d("Data submission failed");
|
|
2572
2761
|
}
|
|
2573
|
-
},
|
|
2574
|
-
return /* @__PURE__ */
|
|
2575
|
-
|
|
2762
|
+
}, W = n.confidence || 0, B = Math.round(W);
|
|
2763
|
+
return /* @__PURE__ */ i(
|
|
2764
|
+
P.div,
|
|
2576
2765
|
{
|
|
2577
2766
|
initial: { opacity: 0, y: 20 },
|
|
2578
2767
|
animate: { opacity: 1, y: 0 },
|
|
2579
2768
|
exit: { opacity: 0, y: -20 },
|
|
2580
2769
|
className: "flex-1 overflow-y-auto px-6 pb-6",
|
|
2581
2770
|
children: [
|
|
2582
|
-
/* @__PURE__ */ e("div", { className: "flex gap-1 mb-6", children: [1, 2, 3, 0].map((
|
|
2771
|
+
/* @__PURE__ */ e("div", { className: "flex gap-1 mb-6", children: [1, 2, 3, 0].map((b, C) => /* @__PURE__ */ e(
|
|
2583
2772
|
"div",
|
|
2584
2773
|
{
|
|
2585
|
-
className: `h-1 flex-1 rounded-xl ${
|
|
2774
|
+
className: `h-1 flex-1 rounded-xl ${b ? "bg-brand" : "bg-brand/20"}`
|
|
2586
2775
|
},
|
|
2587
|
-
|
|
2776
|
+
C
|
|
2588
2777
|
)) }),
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-main mb-2", children: t("review_data",
|
|
2591
|
-
/* @__PURE__ */ e("p", { className: "text-muted text-sm leading-relaxed", children: t("verify_data_desc",
|
|
2778
|
+
/* @__PURE__ */ i("div", { className: "mb-6", children: [
|
|
2779
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-main mb-2", children: t("review_data", _) }),
|
|
2780
|
+
/* @__PURE__ */ e("p", { className: "text-muted text-sm leading-relaxed", children: t("verify_data_desc", _) })
|
|
2592
2781
|
] }),
|
|
2593
|
-
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-semibold text-muted", children: t("ocr_confidence",
|
|
2596
|
-
/* @__PURE__ */
|
|
2597
|
-
|
|
2782
|
+
W > 0 && /* @__PURE__ */ i("div", { className: "mb-6 p-3 rounded-xl bg-brand-5 border border-brand-10", children: [
|
|
2783
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-2", children: [
|
|
2784
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-semibold text-muted", children: t("ocr_confidence", _) }),
|
|
2785
|
+
/* @__PURE__ */ i("span", { className: `text-xs font-bold ${B >= 80 ? "text-green-500" : B >= 60 ? "text-yellow-500" : "text-red-500"}`, children: [
|
|
2786
|
+
B,
|
|
2598
2787
|
"%"
|
|
2599
2788
|
] })
|
|
2600
2789
|
] }),
|
|
2601
|
-
/* @__PURE__ */ e("div", { className: "w-full h-1.5
|
|
2790
|
+
/* @__PURE__ */ e("div", { className: "w-full h-1.5 bg-brand-10 rounded-full overflow-hidden", children: /* @__PURE__ */ e(
|
|
2602
2791
|
"div",
|
|
2603
2792
|
{
|
|
2604
|
-
className: `h-full rounded-full transition-all ${
|
|
2605
|
-
style: { width: `${
|
|
2793
|
+
className: `h-full rounded-full transition-all ${B >= 80 ? "bg-green-500" : B >= 60 ? "bg-yellow-500" : "bg-red-500"}`,
|
|
2794
|
+
style: { width: `${B}%` }
|
|
2606
2795
|
}
|
|
2607
2796
|
) }),
|
|
2608
|
-
|
|
2797
|
+
B < 80 && /* @__PURE__ */ e("p", { className: "text-[10px] text-yellow-500 mt-2", children: t("verify_data_carefully", _) })
|
|
2609
2798
|
] }),
|
|
2610
|
-
|
|
2611
|
-
/* @__PURE__ */ e(
|
|
2612
|
-
/* @__PURE__ */ e("p", { className: "text-red-400 text-xs font-medium", children:
|
|
2799
|
+
V && /* @__PURE__ */ i("div", { className: "mb-4 p-3 bg-red-500/20 border border-red-500/30 rounded-xl flex items-center gap-2", children: [
|
|
2800
|
+
/* @__PURE__ */ e(ve, { className: "w-4 h-4 text-red-500 shrink-0" }),
|
|
2801
|
+
/* @__PURE__ */ e("p", { className: "text-red-400 text-xs font-medium", children: V })
|
|
2613
2802
|
] }),
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
2616
|
-
/* @__PURE__ */
|
|
2617
|
-
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
|
|
2803
|
+
/* @__PURE__ */ i("div", { className: "space-y-5", children: [
|
|
2804
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2805
|
+
/* @__PURE__ */ i("div", { className: "space-y-3", children: [
|
|
2806
|
+
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("first_name", _) || "First Name" }),
|
|
2807
|
+
/* @__PURE__ */ i("div", { className: "flex items-center px-1 transition-all", children: [
|
|
2808
|
+
/* @__PURE__ */ e(zt, { className: "text-brand mr-3 w-5 h-5 shrink-0" }),
|
|
2809
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col w-full", children: /* @__PURE__ */ e(
|
|
2810
|
+
"input",
|
|
2811
|
+
{
|
|
2812
|
+
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-muted",
|
|
2813
|
+
type: "text",
|
|
2814
|
+
value: o.firstName,
|
|
2815
|
+
onChange: (b) => T("firstName", b.target.value),
|
|
2816
|
+
placeholder: t("enter_first_name", _) || "First name"
|
|
2817
|
+
}
|
|
2818
|
+
) })
|
|
2819
|
+
] })
|
|
2820
|
+
] }),
|
|
2821
|
+
/* @__PURE__ */ i("div", { className: "space-y-3", children: [
|
|
2822
|
+
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("last_name", _) || "Last Name" }),
|
|
2823
|
+
/* @__PURE__ */ e("div", { className: "flex items-center px-1 transition-all", children: /* @__PURE__ */ e("div", { className: "flex flex-col w-full", children: /* @__PURE__ */ e(
|
|
2620
2824
|
"input",
|
|
2621
2825
|
{
|
|
2622
|
-
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-
|
|
2826
|
+
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-muted",
|
|
2623
2827
|
type: "text",
|
|
2624
|
-
value:
|
|
2625
|
-
onChange: (
|
|
2626
|
-
|
|
2627
|
-
f("firstName", j[0] || ""), f("lastName", j.slice(1).join(" ") || "");
|
|
2628
|
-
},
|
|
2629
|
-
placeholder: t("enter_first_name", d)
|
|
2828
|
+
value: o.lastName,
|
|
2829
|
+
onChange: (b) => T("lastName", b.target.value),
|
|
2830
|
+
placeholder: t("enter_last_name", _) || "Last name"
|
|
2630
2831
|
}
|
|
2631
|
-
) })
|
|
2832
|
+
) }) })
|
|
2632
2833
|
] })
|
|
2633
2834
|
] }),
|
|
2634
|
-
/* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("id_number",
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
/* @__PURE__ */ e(
|
|
2835
|
+
/* @__PURE__ */ i("div", { className: "space-y-3", children: [
|
|
2836
|
+
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("id_number", _) }),
|
|
2837
|
+
/* @__PURE__ */ i("div", { className: "flex items-center px-1 transition-all", children: [
|
|
2838
|
+
/* @__PURE__ */ e(Qe, { className: "text-brand mr-4 w-6 h-6 shrink-0" }),
|
|
2638
2839
|
/* @__PURE__ */ e(
|
|
2639
2840
|
"input",
|
|
2640
2841
|
{
|
|
2641
|
-
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-
|
|
2842
|
+
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-muted",
|
|
2642
2843
|
type: "text",
|
|
2643
|
-
value:
|
|
2644
|
-
onChange: (
|
|
2645
|
-
placeholder: t("enter_doc_number",
|
|
2844
|
+
value: o.documentNumber,
|
|
2845
|
+
onChange: (b) => T("documentNumber", b.target.value),
|
|
2846
|
+
placeholder: t("enter_doc_number", _)
|
|
2646
2847
|
}
|
|
2647
2848
|
)
|
|
2648
2849
|
] })
|
|
2649
2850
|
] }),
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("date_of_birth",
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */ e(
|
|
2851
|
+
/* @__PURE__ */ i("div", { className: "space-y-3", children: [
|
|
2852
|
+
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("date_of_birth", _) }),
|
|
2853
|
+
/* @__PURE__ */ i("div", { className: "flex items-center px-1 transition-all", children: [
|
|
2854
|
+
/* @__PURE__ */ e(vt, { className: "text-brand mr-4 w-6 h-6 shrink-0" }),
|
|
2654
2855
|
/* @__PURE__ */ e(
|
|
2655
2856
|
"input",
|
|
2656
2857
|
{
|
|
2657
|
-
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-
|
|
2858
|
+
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-muted",
|
|
2658
2859
|
type: "text",
|
|
2659
|
-
value:
|
|
2660
|
-
onChange: (
|
|
2661
|
-
placeholder: t("date_format",
|
|
2860
|
+
value: o.dateOfBirth,
|
|
2861
|
+
onChange: (b) => T("dateOfBirth", b.target.value),
|
|
2862
|
+
placeholder: t("date_format", _)
|
|
2662
2863
|
}
|
|
2663
2864
|
)
|
|
2664
2865
|
] })
|
|
2665
2866
|
] }),
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("nationality",
|
|
2668
|
-
/* @__PURE__ */
|
|
2669
|
-
/* @__PURE__ */ e(
|
|
2867
|
+
/* @__PURE__ */ i("div", { className: "space-y-3", children: [
|
|
2868
|
+
/* @__PURE__ */ e("label", { className: "text-xs font-bold uppercase tracking-[0.15em] text-brand ml-1", children: t("nationality", _) }),
|
|
2869
|
+
/* @__PURE__ */ i("div", { className: "flex items-center px-1 transition-all", children: [
|
|
2870
|
+
/* @__PURE__ */ e(et, { className: "text-brand mr-4 w-6 h-6 shrink-0" }),
|
|
2670
2871
|
/* @__PURE__ */ e(
|
|
2671
2872
|
"input",
|
|
2672
2873
|
{
|
|
2673
|
-
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-
|
|
2874
|
+
className: "bg-transparent border-none p-0 w-full focus:ring-0 text-main font-bold text-lg focus:outline-none placeholder:text-muted",
|
|
2674
2875
|
type: "text",
|
|
2675
|
-
value:
|
|
2676
|
-
onChange: (
|
|
2677
|
-
placeholder: t("enter_nationality",
|
|
2876
|
+
value: o.nationality,
|
|
2877
|
+
onChange: (b) => T("nationality", b.target.value),
|
|
2878
|
+
placeholder: t("enter_nationality", _)
|
|
2678
2879
|
}
|
|
2679
2880
|
)
|
|
2680
2881
|
] })
|
|
2681
2882
|
] }),
|
|
2682
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ i("div", { className: "mt-8 relative h-32 w-full rounded-2xl overflow-hidden border border-brand-20 group", children: [
|
|
2683
2884
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-gradient-to-tr from-brand-20 to-cyan-500/10 blur-sm" }),
|
|
2684
|
-
/* @__PURE__ */
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */ e(
|
|
2687
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-bold
|
|
2885
|
+
/* @__PURE__ */ i("div", { className: "absolute inset-0 bg-brand/10 flex flex-col items-center justify-center p-4", children: [
|
|
2886
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
2887
|
+
/* @__PURE__ */ e(Ce, { className: "text-brand w-5 h-5" }),
|
|
2888
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-main", children: t("scanned_successfully", _) })
|
|
2688
2889
|
] }),
|
|
2689
|
-
|
|
2890
|
+
c && /* @__PURE__ */ e(
|
|
2690
2891
|
"button",
|
|
2691
2892
|
{
|
|
2692
|
-
onClick:
|
|
2893
|
+
onClick: c,
|
|
2693
2894
|
className: "mt-2 text-[10px] text-brand underline font-medium",
|
|
2694
2895
|
type: "button",
|
|
2695
|
-
children: t("retake_photo",
|
|
2896
|
+
children: t("retake_photo", _)
|
|
2696
2897
|
}
|
|
2697
2898
|
)
|
|
2698
2899
|
] })
|
|
2699
2900
|
] })
|
|
2700
2901
|
] }),
|
|
2701
|
-
/* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
2702
2903
|
/* @__PURE__ */ e(
|
|
2703
2904
|
"button",
|
|
2704
2905
|
{
|
|
2705
|
-
onClick:
|
|
2706
|
-
disabled:
|
|
2906
|
+
onClick: Y,
|
|
2907
|
+
disabled: g,
|
|
2707
2908
|
className: "w-full bg-brand hover:bg-brand/90 text-white font-bold py-4 rounded-2xl shadow-lg shadow-brand flex items-center justify-center gap-2 transition-transform active:scale-95 disabled:opacity-70",
|
|
2708
|
-
children:
|
|
2909
|
+
children: g ? /* @__PURE__ */ i(re, { children: [
|
|
2709
2910
|
/* @__PURE__ */ e("div", { className: "w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
|
|
2710
|
-
/* @__PURE__ */ e("span", { children: t("submitting",
|
|
2711
|
-
] }) : /* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */ e("span", { children: t("confirm_mint",
|
|
2713
|
-
/* @__PURE__ */ e(
|
|
2911
|
+
/* @__PURE__ */ e("span", { children: t("submitting", _) })
|
|
2912
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
2913
|
+
/* @__PURE__ */ e("span", { children: t("confirm_mint", _) }),
|
|
2914
|
+
/* @__PURE__ */ e(Pt, { className: "w-5 h-5" })
|
|
2714
2915
|
] })
|
|
2715
2916
|
}
|
|
2716
2917
|
),
|
|
2717
|
-
/* @__PURE__ */ e("p", { className: "text-center text-[10px] mt-4 text-
|
|
2918
|
+
/* @__PURE__ */ e("p", { className: "text-center text-[10px] mt-4 text-muted", children: t("secured_by_casper", _) })
|
|
2718
2919
|
] })
|
|
2719
2920
|
]
|
|
2720
2921
|
}
|
|
2721
2922
|
);
|
|
2722
|
-
},
|
|
2923
|
+
}, ai = (r, a) => r === "layer_1" ? {
|
|
2924
|
+
processing: {
|
|
2925
|
+
title: t("generating_wallet", a),
|
|
2926
|
+
subtitle: t("wallet_subtitle", a)
|
|
2927
|
+
},
|
|
2928
|
+
minting: {
|
|
2929
|
+
title: t("minting_did", a),
|
|
2930
|
+
subtitle: t("did_subtitle", a)
|
|
2931
|
+
},
|
|
2932
|
+
completed: {
|
|
2933
|
+
title: t("identity_created", a),
|
|
2934
|
+
subtitle: t("identity_created_subtitle", a)
|
|
2935
|
+
},
|
|
2936
|
+
failed: {
|
|
2937
|
+
title: t("setup_failed", a),
|
|
2938
|
+
subtitle: t("setup_failed_subtitle", a)
|
|
2939
|
+
}
|
|
2940
|
+
} : r === "layer_2" ? {
|
|
2723
2941
|
processing: {
|
|
2724
|
-
title: t("
|
|
2725
|
-
subtitle: t("
|
|
2942
|
+
title: t("processing_liveness", a),
|
|
2943
|
+
subtitle: t("processing_subtitle", a)
|
|
2726
2944
|
},
|
|
2727
2945
|
minting: {
|
|
2728
|
-
title: t("
|
|
2729
|
-
subtitle: t("
|
|
2946
|
+
title: t("minting_identity", a),
|
|
2947
|
+
subtitle: t("minting_subtitle", a)
|
|
2730
2948
|
},
|
|
2731
2949
|
completed: {
|
|
2732
|
-
title: t("
|
|
2733
|
-
subtitle: t("
|
|
2950
|
+
title: t("identity_verified", a),
|
|
2951
|
+
subtitle: t("identity_verified_subtitle", a)
|
|
2734
2952
|
},
|
|
2735
2953
|
failed: {
|
|
2736
|
-
title: t("
|
|
2737
|
-
subtitle: t("
|
|
2954
|
+
title: t("verification_failed", a),
|
|
2955
|
+
subtitle: t("verification_failed_subtitle", a)
|
|
2738
2956
|
}
|
|
2739
2957
|
} : {
|
|
2740
2958
|
processing: {
|
|
2741
|
-
title: t(
|
|
2742
|
-
subtitle: t("processing_subtitle",
|
|
2959
|
+
title: t("processing_documents", a),
|
|
2960
|
+
subtitle: t("processing_subtitle", a)
|
|
2743
2961
|
},
|
|
2744
2962
|
minting: {
|
|
2745
|
-
title: t("
|
|
2746
|
-
subtitle: t("
|
|
2963
|
+
title: t("submitting_for_review", a),
|
|
2964
|
+
subtitle: t("submitting_review_subtitle", a)
|
|
2747
2965
|
},
|
|
2748
2966
|
completed: {
|
|
2749
|
-
title: t("verification_submitted",
|
|
2750
|
-
subtitle: t("verification_submitted_subtitle",
|
|
2967
|
+
title: t("verification_submitted", a),
|
|
2968
|
+
subtitle: t("verification_submitted_subtitle", a)
|
|
2751
2969
|
},
|
|
2752
2970
|
failed: {
|
|
2753
|
-
title: t("verification_failed",
|
|
2754
|
-
subtitle: t("verification_failed_subtitle",
|
|
2971
|
+
title: t("verification_failed", a),
|
|
2972
|
+
subtitle: t("verification_failed_subtitle", a)
|
|
2755
2973
|
}
|
|
2756
|
-
},
|
|
2974
|
+
}, ri = ({
|
|
2757
2975
|
tier: r,
|
|
2758
|
-
sessionToken:
|
|
2759
|
-
requestId:
|
|
2760
|
-
onNext:
|
|
2761
|
-
onError:
|
|
2762
|
-
apiBaseUrl:
|
|
2763
|
-
|
|
2764
|
-
|
|
2976
|
+
sessionToken: a,
|
|
2977
|
+
requestId: n,
|
|
2978
|
+
onNext: l,
|
|
2979
|
+
onError: N,
|
|
2980
|
+
apiBaseUrl: p = "https://apis.casperid.com",
|
|
2981
|
+
apiKey: f = "",
|
|
2982
|
+
previewMode: m = !1,
|
|
2983
|
+
language: s = "EN"
|
|
2765
2984
|
}) => {
|
|
2766
|
-
const [
|
|
2767
|
-
|
|
2768
|
-
|
|
2985
|
+
const [c, d] = y("processing"), [D, h] = y(0), [A, _] = y(""), [o, I] = y(null), [g, k] = y(null), [V, w] = y(null), [T, Y] = y(null), W = se(!1), b = ai(r, s)[c];
|
|
2986
|
+
ce(() => {
|
|
2987
|
+
W.current || (W.current = !0, m ? C() : S());
|
|
2769
2988
|
}, []);
|
|
2770
|
-
const
|
|
2771
|
-
d("processing"),
|
|
2989
|
+
const C = async () => {
|
|
2990
|
+
d("processing"), h(20), await Q(1e3), h(50), await Q(1e3), d("minting"), h(70), await Q(1e3), h(100), d("completed"), r === "layer_1" ? (I("account-hash-abc123..."), Y("casper-user-1234"), k("did:casper:abc123...")) : w("mock-credential-hash-xyz"), await Q(1500), l({
|
|
2772
2991
|
wallet: "account-hash-abc123...",
|
|
2773
2992
|
didAddress: "did:casper:abc123...",
|
|
2774
2993
|
credentialHash: "mock-credential-hash-xyz"
|
|
2775
2994
|
});
|
|
2776
|
-
},
|
|
2995
|
+
}, S = async () => {
|
|
2777
2996
|
try {
|
|
2778
|
-
r === "layer_1" ? await
|
|
2779
|
-
} catch (
|
|
2780
|
-
const
|
|
2781
|
-
|
|
2997
|
+
r === "layer_1" ? await L() : await G();
|
|
2998
|
+
} catch (ie) {
|
|
2999
|
+
const q = ie instanceof Error ? ie.message : "Setup failed";
|
|
3000
|
+
_(q), d("failed"), N == null || N(q);
|
|
2782
3001
|
}
|
|
2783
|
-
},
|
|
2784
|
-
var
|
|
2785
|
-
d("processing"),
|
|
2786
|
-
const
|
|
3002
|
+
}, L = async () => {
|
|
3003
|
+
var me;
|
|
3004
|
+
d("processing"), h(10);
|
|
3005
|
+
const ie = await fetch(`${p}/api/passkey/wallet/generate`, {
|
|
2787
3006
|
method: "POST",
|
|
2788
3007
|
headers: {
|
|
2789
3008
|
"Content-Type": "application/json",
|
|
2790
|
-
Authorization: `Bearer ${
|
|
3009
|
+
Authorization: `Bearer ${a}`,
|
|
3010
|
+
...f ? { "X-App-Id": f } : {}
|
|
2791
3011
|
},
|
|
2792
3012
|
credentials: "include"
|
|
2793
3013
|
});
|
|
2794
|
-
if (!
|
|
2795
|
-
const
|
|
2796
|
-
throw new Error(
|
|
3014
|
+
if (!ie.ok) {
|
|
3015
|
+
const ee = await ie.json().catch(() => ({}));
|
|
3016
|
+
throw new Error(ee.error || "Failed to generate wallet");
|
|
2797
3017
|
}
|
|
2798
|
-
const
|
|
2799
|
-
if (!
|
|
2800
|
-
throw new Error(
|
|
2801
|
-
|
|
2802
|
-
const
|
|
3018
|
+
const q = await ie.json();
|
|
3019
|
+
if (!q.success || !((me = q.walletInfo) != null && me.walletAddress))
|
|
3020
|
+
throw new Error(q.error || "Wallet generation failed");
|
|
3021
|
+
I(q.walletInfo.walletAddress), q.walletInfo.humanId && Y(q.walletInfo.humanId), h(50), d("minting"), h(60);
|
|
3022
|
+
const pe = await fetch(`${p}/api/passkey/did/mint`, {
|
|
2803
3023
|
method: "POST",
|
|
2804
3024
|
headers: {
|
|
2805
3025
|
"Content-Type": "application/json",
|
|
2806
|
-
Authorization: `Bearer ${
|
|
3026
|
+
Authorization: `Bearer ${a}`,
|
|
3027
|
+
...f ? { "X-App-Id": f } : {}
|
|
2807
3028
|
},
|
|
2808
3029
|
credentials: "include"
|
|
2809
3030
|
});
|
|
2810
|
-
if (!
|
|
2811
|
-
const
|
|
2812
|
-
throw new Error(
|
|
3031
|
+
if (!pe.ok) {
|
|
3032
|
+
const ee = await pe.json().catch(() => ({}));
|
|
3033
|
+
throw new Error(ee.error || "Failed to mint DID");
|
|
2813
3034
|
}
|
|
2814
|
-
const
|
|
2815
|
-
if (!
|
|
2816
|
-
throw new Error(
|
|
2817
|
-
|
|
2818
|
-
wallet:
|
|
2819
|
-
didAddress:
|
|
2820
|
-
credentialHash:
|
|
3035
|
+
const K = await pe.json();
|
|
3036
|
+
if (!K.success)
|
|
3037
|
+
throw new Error(K.error || "DID minting failed");
|
|
3038
|
+
k(K.did_address), w(K.transaction_hash), h(100), d("completed"), await Q(1500), l({
|
|
3039
|
+
wallet: q.walletInfo.walletAddress,
|
|
3040
|
+
didAddress: K.did_address,
|
|
3041
|
+
credentialHash: K.transaction_hash
|
|
2821
3042
|
});
|
|
2822
|
-
},
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
3043
|
+
}, O = async () => {
|
|
3044
|
+
var pe, K, me, ee;
|
|
3045
|
+
if (d("processing"), h(20), !n)
|
|
3046
|
+
throw new Error("No verification request ID provided");
|
|
3047
|
+
const ie = 10, q = 1500;
|
|
3048
|
+
for (let ne = 0; ne < ie; ne++)
|
|
3049
|
+
try {
|
|
3050
|
+
const U = await fetch(`${p}/api/v2/verification/${n}/status`, {
|
|
3051
|
+
method: "GET",
|
|
3052
|
+
headers: {
|
|
3053
|
+
"Content-Type": "application/json",
|
|
3054
|
+
...f ? { "X-App-Id": f } : {}
|
|
3055
|
+
},
|
|
3056
|
+
credentials: "include"
|
|
3057
|
+
});
|
|
3058
|
+
if (!U.ok)
|
|
3059
|
+
throw new Error("Failed to check verification status");
|
|
3060
|
+
const v = await U.json(), M = (pe = v.verification) == null ? void 0 : pe.status;
|
|
3061
|
+
if (h(Math.min(20 + ne * 8, 80)), M === "completed") {
|
|
3062
|
+
d("minting"), h(90), await Q(500), h(100), d("completed");
|
|
3063
|
+
const Z = (me = (K = v.verification) == null ? void 0 : K.results) == null ? void 0 : me.proofHash;
|
|
3064
|
+
await Q(1500), l({ credentialHash: Z || n });
|
|
3065
|
+
return;
|
|
3066
|
+
}
|
|
3067
|
+
if (M === "failed")
|
|
3068
|
+
throw new Error(((ee = v.verification) == null ? void 0 : ee.error) || "Verification failed");
|
|
3069
|
+
await Q(q);
|
|
3070
|
+
} catch (U) {
|
|
3071
|
+
if (ne === ie - 1)
|
|
3072
|
+
throw U;
|
|
3073
|
+
await Q(q);
|
|
3074
|
+
}
|
|
3075
|
+
d("minting"), h(90), await Q(500), h(100), d("completed"), await Q(1500), l({ credentialHash: n });
|
|
3076
|
+
}, F = async () => {
|
|
3077
|
+
d("processing"), h(30), await Q(800), h(60), d("minting"), h(80), await Q(800), h(100), d("completed"), await Q(2e3), l({ credentialHash: n });
|
|
3078
|
+
}, G = async () => {
|
|
3079
|
+
r === "layer_2" ? await O() : await F();
|
|
3080
|
+
}, Q = (ie) => new Promise((q) => setTimeout(q, ie)), de = () => {
|
|
3081
|
+
d("processing"), h(0), _(""), W.current = !1, m ? C() : S();
|
|
3082
|
+
}, ue = () => r === "layer_1" ? c === "minting" ? /* @__PURE__ */ e(Ie, { className: "text-brand w-4 h-4" }) : /* @__PURE__ */ e(Vt, { className: "text-brand w-4 h-4" }) : /* @__PURE__ */ e(it, { className: "text-brand w-4 h-4" }), te = () => {
|
|
2827
3083
|
if (r === "layer_1") {
|
|
2828
|
-
if (
|
|
2829
|
-
if (
|
|
2830
|
-
if (
|
|
3084
|
+
if (c === "processing") return t("creating_wallet", s);
|
|
3085
|
+
if (c === "minting") return t("minting_did_chain", s);
|
|
3086
|
+
if (c === "completed") return t("identity_live", s);
|
|
2831
3087
|
} else {
|
|
2832
|
-
if (
|
|
2833
|
-
if (
|
|
2834
|
-
if (
|
|
3088
|
+
if (c === "processing") return t("validating_docs", s);
|
|
3089
|
+
if (c === "minting") return t("submitting_verification", s);
|
|
3090
|
+
if (c === "completed") return t("verification_queued", s);
|
|
2835
3091
|
}
|
|
2836
3092
|
return "";
|
|
2837
3093
|
};
|
|
2838
|
-
return /* @__PURE__ */
|
|
2839
|
-
|
|
3094
|
+
return /* @__PURE__ */ i(
|
|
3095
|
+
P.div,
|
|
2840
3096
|
{
|
|
2841
3097
|
initial: { opacity: 0 },
|
|
2842
3098
|
animate: { opacity: 1 },
|
|
2843
3099
|
exit: { opacity: 0 },
|
|
2844
3100
|
className: "flex-1 flex flex-col items-center justify-center px-8 text-center",
|
|
2845
3101
|
children: [
|
|
2846
|
-
/* @__PURE__ */
|
|
3102
|
+
/* @__PURE__ */ i("div", { className: "relative w-64 h-64 flex items-center justify-center mb-12", children: [
|
|
2847
3103
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 rounded-full border-4 border-dashed border-brand-20 animate-[spin_10s_linear_infinite]" }),
|
|
2848
3104
|
/* @__PURE__ */ e("div", { className: "absolute inset-4 rounded-full border-2 border-[#6DE8EC]/20 animate-[spin_6s_linear_infinite_reverse]" }),
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
|
|
3105
|
+
/* @__PURE__ */ i(
|
|
3106
|
+
P.div,
|
|
2851
3107
|
{
|
|
2852
|
-
animate:
|
|
3108
|
+
animate: c !== "failed" ? { rotateY: [0, 180, 360], y: [-10, 10, -10] } : {},
|
|
2853
3109
|
transition: { duration: 6, repeat: 1 / 0, ease: "easeInOut" },
|
|
2854
|
-
className: `relative w-40 h-56 backdrop-blur-xl border rounded-2xl flex flex-col p-4 ${
|
|
3110
|
+
className: `relative w-40 h-56 backdrop-blur-xl border rounded-2xl flex flex-col p-4 ${c === "completed" ? "bg-green-500/10 border-green-500/30 shadow-[0_0_50px_-12px_rgba(34,197,94,0.5)]" : c === "failed" ? "bg-red-500/10 border-red-500/30 shadow-[0_0_50px_-12px_rgba(239,68,68,0.5)]" : "bg-brand/10 border-brand-30 shadow-[0_0_50px_-12px_rgba(114,43,238,0.5)]"}`,
|
|
2855
3111
|
children: [
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */ e("div", { className: `w-8 h-8 rounded flex items-center justify-center ${
|
|
2858
|
-
/* @__PURE__ */ e("div", { className: `w-6 h-1 rounded-full ${
|
|
3112
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-start mb-6", children: [
|
|
3113
|
+
/* @__PURE__ */ e("div", { className: `w-8 h-8 rounded flex items-center justify-center ${c === "completed" ? "bg-green-500/30" : c === "failed" ? "bg-red-500/30" : "bg-brand/30"}`, children: c === "completed" ? /* @__PURE__ */ e(Ce, { className: "text-green-500 w-4 h-4" }) : c === "failed" ? /* @__PURE__ */ e(ve, { className: "text-red-500 w-4 h-4" }) : ue() }),
|
|
3114
|
+
/* @__PURE__ */ e("div", { className: `w-6 h-1 rounded-full ${c === "completed" ? "bg-green-500/40" : c === "failed" ? "bg-red-500/40" : "bg-brand/40"}` })
|
|
2859
3115
|
] }),
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */ e("div", { className: `h-2 w-3/4 rounded-full ${
|
|
2862
|
-
/* @__PURE__ */ e("div", { className: `h-2 w-1/2 rounded-full ${
|
|
3116
|
+
/* @__PURE__ */ i("div", { className: "space-y-3 mb-auto", children: [
|
|
3117
|
+
/* @__PURE__ */ e("div", { className: `h-2 w-3/4 rounded-full ${c === "completed" ? "bg-green-500/20" : c === "failed" ? "bg-red-500/20" : "bg-brand/20"}` }),
|
|
3118
|
+
/* @__PURE__ */ e("div", { className: `h-2 w-1/2 rounded-full ${c === "completed" ? "bg-green-500/20" : c === "failed" ? "bg-red-500/20" : "bg-brand/20"}` })
|
|
2863
3119
|
] }),
|
|
2864
|
-
/* @__PURE__ */
|
|
2865
|
-
/* @__PURE__ */ e("div", { className: `size-6 rounded-full overflow-hidden border border-white/10 ${
|
|
2866
|
-
/* @__PURE__ */
|
|
2867
|
-
|
|
2868
|
-
|
|
3120
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2 mt-4", children: [
|
|
3121
|
+
/* @__PURE__ */ e("div", { className: `size-6 rounded-full overflow-hidden border border-slate-200 dark:border-white/10 ${c === "completed" ? "bg-gradient-to-tr from-green-500 to-[#6DE8EC]" : c === "failed" ? "bg-gradient-to-tr from-red-500 to-orange-500" : "bg-gradient-to-tr from-brand to-[#6DE8EC]"}` }),
|
|
3122
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col items-start max-w-[80px]", children: [
|
|
3123
|
+
T ? /* @__PURE__ */ e(
|
|
3124
|
+
P.span,
|
|
2869
3125
|
{
|
|
2870
3126
|
initial: { opacity: 0 },
|
|
2871
3127
|
animate: { opacity: 1 },
|
|
2872
|
-
className: "text-[10px] font-bold text-white/90 truncate w-full text-left",
|
|
2873
|
-
children:
|
|
3128
|
+
className: "text-[10px] font-bold text-slate-800 dark:text-white/90 truncate w-full text-left",
|
|
3129
|
+
children: T
|
|
2874
3130
|
}
|
|
2875
3131
|
) : /* @__PURE__ */ e("div", { className: "h-1.5 w-12 bg-white/20 rounded-full mb-1" }),
|
|
2876
|
-
/* @__PURE__ */ e("div", { className: "h-1 w-8 bg-white/10 rounded-full" })
|
|
3132
|
+
/* @__PURE__ */ e("div", { className: "h-1 w-8 bg-slate-200 dark:bg-white/10 rounded-full" })
|
|
2877
3133
|
] })
|
|
2878
3134
|
] }),
|
|
2879
|
-
|
|
2880
|
-
|
|
3135
|
+
c !== "failed" && c !== "completed" && /* @__PURE__ */ e(
|
|
3136
|
+
P.div,
|
|
2881
3137
|
{
|
|
2882
3138
|
animate: { top: ["0%", "100%", "0%"] },
|
|
2883
3139
|
transition: { duration: 2, repeat: 1 / 0 },
|
|
@@ -2888,385 +3144,401 @@ const $t = ({
|
|
|
2888
3144
|
}
|
|
2889
3145
|
)
|
|
2890
3146
|
] }),
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
/* @__PURE__ */ e("h2", { className: `text-2xl font-bold bg-clip-text ${
|
|
2893
|
-
/* @__PURE__ */ e("p", { className: "dark:text-slate-400 text-slate-500 text-sm leading-relaxed max-w-[280px] mx-auto", children:
|
|
3147
|
+
/* @__PURE__ */ i("div", { className: "space-y-4", children: [
|
|
3148
|
+
/* @__PURE__ */ e("h2", { className: `text-2xl font-bold bg-clip-text ${c === "completed" ? "text-green-500" : c === "failed" ? "text-red-500" : "dark:bg-gradient-to-r dark:from-slate-100 dark:to-slate-400 bg-slate-900 dark:text-transparent text-slate-900"}`, children: b.title }),
|
|
3149
|
+
/* @__PURE__ */ e("p", { className: "dark:text-slate-400 text-slate-500 text-sm leading-relaxed max-w-[280px] mx-auto", children: b.subtitle })
|
|
2894
3150
|
] }),
|
|
2895
|
-
|
|
2896
|
-
/* @__PURE__ */ e("p", { className: "text-red-500 text-sm", children:
|
|
3151
|
+
c === "failed" && /* @__PURE__ */ i("div", { className: "mt-6 space-y-3", children: [
|
|
3152
|
+
/* @__PURE__ */ e("p", { className: "text-red-500 text-sm", children: A }),
|
|
2897
3153
|
/* @__PURE__ */ e(
|
|
2898
3154
|
"button",
|
|
2899
3155
|
{
|
|
2900
|
-
onClick:
|
|
3156
|
+
onClick: de,
|
|
2901
3157
|
className: "px-6 py-3 bg-brand text-white rounded-2xl font-bold",
|
|
2902
|
-
children: t("try_again",
|
|
3158
|
+
children: t("try_again", s)
|
|
2903
3159
|
}
|
|
2904
3160
|
)
|
|
2905
3161
|
] }),
|
|
2906
|
-
r === "layer_1" &&
|
|
2907
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted mb-1", children: t("your_wallet",
|
|
2908
|
-
/* @__PURE__ */
|
|
2909
|
-
|
|
3162
|
+
r === "layer_1" && o && c === "completed" && /* @__PURE__ */ i("div", { className: "mt-6 p-3 dark:bg-white/5 bg-black/5 rounded-xl border dark:border-white/10 border-black/5", children: [
|
|
3163
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted mb-1", children: t("your_wallet", s) }),
|
|
3164
|
+
/* @__PURE__ */ i("p", { className: "text-xs font-mono text-main break-all", children: [
|
|
3165
|
+
o.slice(0, 20),
|
|
2910
3166
|
"...",
|
|
2911
|
-
|
|
3167
|
+
o.slice(-10)
|
|
2912
3168
|
] })
|
|
2913
3169
|
] }),
|
|
2914
|
-
r !== "layer_1" &&
|
|
2915
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted mb-1", children: t("verification_id",
|
|
2916
|
-
/* @__PURE__ */
|
|
2917
|
-
|
|
3170
|
+
r !== "layer_1" && V && c === "completed" && /* @__PURE__ */ i("div", { className: "mt-6 p-3 dark:bg-white/5 bg-black/5 rounded-xl border dark:border-white/10 border-black/5", children: [
|
|
3171
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted mb-1", children: t("verification_id", s) }),
|
|
3172
|
+
/* @__PURE__ */ i("p", { className: "text-xs font-mono text-main break-all", children: [
|
|
3173
|
+
V.slice(0, 20),
|
|
2918
3174
|
"..."
|
|
2919
3175
|
] })
|
|
2920
3176
|
] }),
|
|
2921
|
-
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-medium text-brand uppercase tracking-widest", children: t(r === "layer_1" ? "setup_status" : "transaction_status",
|
|
2924
|
-
/* @__PURE__ */ e("span", { className: `text-xs font-bold ${
|
|
3177
|
+
c !== "failed" && /* @__PURE__ */ i("div", { className: "w-full mt-12 p-6 dark:bg-brand/5 bg-brand/5 border-t dark:border-white/5 border-black/5", children: [
|
|
3178
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center mb-3", children: [
|
|
3179
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-medium text-brand uppercase tracking-widest", children: t(r === "layer_1" ? "setup_status" : "transaction_status", s) }),
|
|
3180
|
+
/* @__PURE__ */ e("span", { className: `text-xs font-bold ${c === "completed" ? "text-green-500" : "text-[#6DE8EC]"}`, children: t("complete_percent", s).replace("{percent}", D.toString()) })
|
|
2925
3181
|
] }),
|
|
2926
3182
|
/* @__PURE__ */ e("div", { className: "w-full h-1.5 dark:bg-brand/10 bg-brand/10 rounded-full overflow-hidden mb-4", children: /* @__PURE__ */ e(
|
|
2927
|
-
|
|
3183
|
+
P.div,
|
|
2928
3184
|
{
|
|
2929
3185
|
initial: { width: "0%" },
|
|
2930
|
-
animate: { width: `${
|
|
3186
|
+
animate: { width: `${D}%` },
|
|
2931
3187
|
transition: { duration: 0.5 },
|
|
2932
|
-
className: `h-full rounded-full ${
|
|
3188
|
+
className: `h-full rounded-full ${c === "completed" ? "bg-gradient-to-r from-green-500 to-[#6DE8EC]" : "bg-gradient-to-r from-brand to-[#6DE8EC]"} shadow-[0_0_10px_rgba(114,43,238,0.5)]`
|
|
2933
3189
|
}
|
|
2934
3190
|
) }),
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */ e(
|
|
2937
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] dark:text-slate-300 text-slate-600 font-medium", children:
|
|
3191
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3 px-3 py-2 dark:bg-brand/10 bg-brand/10 rounded-xl border dark:border-brand-10 border-brand-5", children: [
|
|
3192
|
+
/* @__PURE__ */ e(At, { className: `w-4 h-4 ${c === "completed" ? "text-green-500" : "text-brand"}` }),
|
|
3193
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] dark:text-slate-300 text-slate-600 font-medium", children: te() })
|
|
2938
3194
|
] })
|
|
2939
3195
|
] })
|
|
2940
3196
|
]
|
|
2941
3197
|
}
|
|
2942
3198
|
);
|
|
2943
|
-
},
|
|
2944
|
-
|
|
3199
|
+
}, ni = ({ onNext: r, language: a = "EN" }) => /* @__PURE__ */ i(
|
|
3200
|
+
P.div,
|
|
2945
3201
|
{
|
|
2946
3202
|
initial: { opacity: 0, scale: 0.9 },
|
|
2947
3203
|
animate: { opacity: 1, scale: 1 },
|
|
2948
3204
|
exit: { opacity: 0, scale: 1.1 },
|
|
2949
3205
|
className: "flex-1 flex flex-col items-center justify-center px-8 text-center",
|
|
2950
3206
|
children: [
|
|
2951
|
-
/* @__PURE__ */
|
|
3207
|
+
/* @__PURE__ */ i("div", { className: "relative mb-10 group", children: [
|
|
2952
3208
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-[#6fe8ec]/30 rounded-3xl blur-3xl group-hover:blur-2xl transition-all" }),
|
|
2953
|
-
/* @__PURE__ */ e("div", { className: "relative w-32 h-32 rounded-2xl bg-[#6fe8ec] flex items-center justify-center shadow-[0_0_40px_rgba(111,232,236,0.4)] border-4 dark:border-white border-slate-100", children: /* @__PURE__ */ e(
|
|
3209
|
+
/* @__PURE__ */ e("div", { className: "relative w-32 h-32 rounded-2xl bg-[#6fe8ec] flex items-center justify-center shadow-[0_0_40px_rgba(111,232,236,0.4)] border-4 dark:border-white border-slate-100", children: /* @__PURE__ */ e(Ce, { className: "text-slate-900 w-16 h-16" }) })
|
|
2954
3210
|
] }),
|
|
2955
|
-
/* @__PURE__ */ e("h1", { className: "text-main text-3xl font-bold leading-tight mb-3", children: t("identity_verified",
|
|
2956
|
-
/* @__PURE__ */ e("p", { className: "text-muted text-base leading-relaxed mb-12", children: t("identity_verified_desc",
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */ e("span", { className: "text-main font-bold text-sm", children: t("share_data_consent",
|
|
2960
|
-
/* @__PURE__ */ e("p", { className: "text-muted text-xs leading-normal", children: t("authorize_dapps",
|
|
3211
|
+
/* @__PURE__ */ e("h1", { className: "text-main text-3xl font-bold leading-tight mb-3", children: t("identity_verified", a) }),
|
|
3212
|
+
/* @__PURE__ */ e("p", { className: "text-muted text-base leading-relaxed mb-12", children: t("identity_verified_desc", a) }),
|
|
3213
|
+
/* @__PURE__ */ i("div", { className: "w-full bg-white dark:bg-white/5 shadow-sm border border-slate-200 dark:border-white/10 rounded-2xl p-5 mb-8 flex items-center justify-between text-left", children: [
|
|
3214
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-0.5", children: [
|
|
3215
|
+
/* @__PURE__ */ e("span", { className: "text-main font-bold text-sm", children: t("share_data_consent", a) }),
|
|
3216
|
+
/* @__PURE__ */ e("p", { className: "text-muted text-xs leading-normal", children: t("authorize_dapps", a) })
|
|
2961
3217
|
] }),
|
|
2962
3218
|
/* @__PURE__ */ e("div", { className: "w-11 h-6 bg-brand rounded-full relative p-1 cursor-pointer", children: /* @__PURE__ */ e("div", { className: "absolute right-1 top-1 size-4 bg-white rounded-full" }) })
|
|
2963
3219
|
] }),
|
|
2964
|
-
/* @__PURE__ */
|
|
3220
|
+
/* @__PURE__ */ i(
|
|
2965
3221
|
"button",
|
|
2966
3222
|
{
|
|
2967
3223
|
onClick: r,
|
|
2968
3224
|
className: "w-full bg-[#6fe8ec] hover:brightness-105 active:scale-[0.98] transition-all text-slate-900 font-bold py-4 rounded-2xl shadow-lg shadow-[#6fe8ec]/20 flex items-center justify-center gap-2",
|
|
2969
3225
|
children: [
|
|
2970
|
-
t("return_to_app",
|
|
2971
|
-
/* @__PURE__ */ e(
|
|
3226
|
+
t("return_to_app", a),
|
|
3227
|
+
/* @__PURE__ */ e(Oe, { className: "w-5 h-5" })
|
|
2972
3228
|
]
|
|
2973
3229
|
}
|
|
2974
3230
|
)
|
|
2975
3231
|
]
|
|
2976
3232
|
}
|
|
2977
|
-
),
|
|
2978
|
-
"
|
|
2979
|
-
"
|
|
2980
|
-
"
|
|
2981
|
-
],
|
|
3233
|
+
), si = [
|
|
3234
|
+
"verify:identity",
|
|
3235
|
+
"read:profile",
|
|
3236
|
+
"read:kyc_level"
|
|
3237
|
+
], ci = ({
|
|
2982
3238
|
appName: r = "This App",
|
|
2983
|
-
appLogo:
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
/* @__PURE__ */ e("p", { className: "text-brand/70 text-sm font-medium mt-1 uppercase tracking-wider", children: t("requesting_access", x) })
|
|
3003
|
-
] })
|
|
3004
|
-
] }),
|
|
3005
|
-
/* @__PURE__ */ a("div", { className: "w-full space-y-3", children: [
|
|
3006
|
-
/* @__PURE__ */ e("h3", { className: "text-xs font-semibold uppercase tracking-widest text-slate-500 mb-4 px-1", children: t("permission_request", x) }),
|
|
3007
|
-
ta.map((l) => /* @__PURE__ */ a(
|
|
3008
|
-
"div",
|
|
3009
|
-
{
|
|
3010
|
-
className: "flex items-center gap-4 p-4 rounded-2xl dark:bg-white/5 bg-black/5 transition-all",
|
|
3011
|
-
children: [
|
|
3012
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-center w-8 h-8 rounded-full bg-cyan-400/10 text-cyan-400 shrink-0", children: /* @__PURE__ */ e(he, { className: "w-5 h-5" }) }),
|
|
3013
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-main", children: t(l, x) })
|
|
3014
|
-
]
|
|
3015
|
-
},
|
|
3016
|
-
l
|
|
3017
|
-
))
|
|
3018
|
-
] }),
|
|
3019
|
-
/* @__PURE__ */ a("div", { className: "mt-8 flex gap-3 p-4 rounded-2xl dark:bg-brand/5 bg-brand/5", children: [
|
|
3020
|
-
/* @__PURE__ */ e(fe, { className: "text-brand w-5 h-5 shrink-0" }),
|
|
3021
|
-
/* @__PURE__ */ a("p", { className: "text-xs leading-relaxed text-muted", children: [
|
|
3022
|
-
/* @__PURE__ */ a("span", { className: "font-bold text-main", children: [
|
|
3023
|
-
t("privacy_note", x),
|
|
3024
|
-
":"
|
|
3239
|
+
appLogo: a,
|
|
3240
|
+
requestedScopes: n,
|
|
3241
|
+
onApprove: l,
|
|
3242
|
+
onDeny: N,
|
|
3243
|
+
language: p = "EN"
|
|
3244
|
+
}) => {
|
|
3245
|
+
const f = n || si;
|
|
3246
|
+
return /* @__PURE__ */ i(
|
|
3247
|
+
P.div,
|
|
3248
|
+
{
|
|
3249
|
+
initial: { opacity: 0, y: 20 },
|
|
3250
|
+
animate: { opacity: 1, y: 0 },
|
|
3251
|
+
exit: { opacity: 0, y: -20 },
|
|
3252
|
+
className: "flex-1 px-8 pt-8 flex flex-col items-center",
|
|
3253
|
+
children: [
|
|
3254
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col items-center gap-4 mb-10", children: [
|
|
3255
|
+
/* @__PURE__ */ i("div", { className: "relative", children: [
|
|
3256
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0 rounded-full shadow-[0_0_20px_rgba(134,81,225,0.3)] animate-pulse" }),
|
|
3257
|
+
/* @__PURE__ */ e("div", { className: "relative w-24 h-24 rounded-full border-2 border-brand-40 p-1 dark:bg-black/50 bg-white", children: a ? /* @__PURE__ */ e("div", { className: "w-full h-full rounded-full overflow-hidden", children: /* @__PURE__ */ e("img", { src: a, alt: r, className: "w-full h-full object-cover" }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full rounded-full bg-gradient-to-br from-emerald-500 to-teal-700 flex items-center justify-center text-white font-bold text-2xl", children: r.slice(0, 2).toUpperCase() }) })
|
|
3025
3258
|
] }),
|
|
3026
|
-
" ",
|
|
3027
|
-
|
|
3259
|
+
/* @__PURE__ */ i("div", { className: "text-center", children: [
|
|
3260
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold tracking-tight text-main", children: r }),
|
|
3261
|
+
/* @__PURE__ */ e("p", { className: "text-brand/70 text-sm font-medium mt-1 uppercase tracking-wider", children: t("requesting_access", p) })
|
|
3262
|
+
] })
|
|
3263
|
+
] }),
|
|
3264
|
+
/* @__PURE__ */ i("div", { className: "w-full space-y-3", children: [
|
|
3265
|
+
/* @__PURE__ */ e("h3", { className: "text-xs font-semibold uppercase tracking-widest text-slate-500 mb-4 px-1", children: t("permission_request", p) }),
|
|
3266
|
+
f.map((m) => /* @__PURE__ */ i(
|
|
3267
|
+
"div",
|
|
3268
|
+
{
|
|
3269
|
+
className: "flex items-center gap-4 p-4 rounded-2xl dark:bg-white/5 bg-black/5 transition-all",
|
|
3270
|
+
children: [
|
|
3271
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-center w-8 h-8 rounded-full bg-cyan-400/10 text-cyan-400 shrink-0", children: /* @__PURE__ */ e(Ce, { className: "w-5 h-5" }) }),
|
|
3272
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-main", children: t(m, p) })
|
|
3273
|
+
]
|
|
3274
|
+
},
|
|
3275
|
+
m
|
|
3276
|
+
))
|
|
3277
|
+
] }),
|
|
3278
|
+
/* @__PURE__ */ i("div", { className: "mt-8 flex gap-3 p-4 rounded-2xl dark:bg-brand/5 bg-brand/5", children: [
|
|
3279
|
+
/* @__PURE__ */ e(Se, { className: "text-brand w-5 h-5 shrink-0" }),
|
|
3280
|
+
/* @__PURE__ */ i("p", { className: "text-xs leading-relaxed text-muted", children: [
|
|
3281
|
+
/* @__PURE__ */ i("span", { className: "font-bold text-main", children: [
|
|
3282
|
+
t("privacy_note", p),
|
|
3283
|
+
":"
|
|
3284
|
+
] }),
|
|
3285
|
+
" ",
|
|
3286
|
+
t("privacy_desc", p)
|
|
3287
|
+
] })
|
|
3288
|
+
] }),
|
|
3289
|
+
/* @__PURE__ */ i("footer", { className: "mt-auto w-full pb-8 flex flex-col gap-3", children: [
|
|
3290
|
+
/* @__PURE__ */ i(
|
|
3291
|
+
"button",
|
|
3292
|
+
{
|
|
3293
|
+
onClick: l,
|
|
3294
|
+
className: "w-full py-4 rounded-2xl bg-brand hover:bg-brand-90 text-white font-bold text-base shadow-xl shadow-brand transition-all flex items-center justify-center gap-2",
|
|
3295
|
+
children: [
|
|
3296
|
+
t("approve_verify", p),
|
|
3297
|
+
/* @__PURE__ */ e(Fe, { className: "w-5 h-5" })
|
|
3298
|
+
]
|
|
3299
|
+
}
|
|
3300
|
+
),
|
|
3301
|
+
/* @__PURE__ */ e(
|
|
3302
|
+
"button",
|
|
3303
|
+
{
|
|
3304
|
+
onClick: N,
|
|
3305
|
+
className: "w-full py-3 rounded-2xl bg-transparent dark:hover:bg-slate-100 dark:bg-white/5 hover:bg-black/5 dark:text-slate-400 text-slate-500 font-semibold text-sm transition-all",
|
|
3306
|
+
children: t("deny", p)
|
|
3307
|
+
}
|
|
3308
|
+
)
|
|
3028
3309
|
] })
|
|
3029
|
-
]
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
onClick: s,
|
|
3035
|
-
className: "w-full py-4 rounded-2xl bg-brand hover:bg-brand-90 text-white font-bold text-base shadow-xl shadow-brand transition-all flex items-center justify-center gap-2",
|
|
3036
|
-
children: [
|
|
3037
|
-
t("approve_verify", x),
|
|
3038
|
-
/* @__PURE__ */ e(Ee, { className: "w-5 h-5" })
|
|
3039
|
-
]
|
|
3040
|
-
}
|
|
3041
|
-
),
|
|
3042
|
-
/* @__PURE__ */ e(
|
|
3043
|
-
"button",
|
|
3044
|
-
{
|
|
3045
|
-
onClick: o,
|
|
3046
|
-
className: "w-full py-3 rounded-2xl bg-transparent dark:hover:bg-white/5 hover:bg-black/5 dark:text-slate-400 text-slate-500 font-semibold text-sm transition-all",
|
|
3047
|
-
children: t("deny", x)
|
|
3048
|
-
}
|
|
3049
|
-
)
|
|
3050
|
-
] })
|
|
3051
|
-
]
|
|
3052
|
-
}
|
|
3053
|
-
);
|
|
3054
|
-
function Ue(r = "light") {
|
|
3310
|
+
]
|
|
3311
|
+
}
|
|
3312
|
+
);
|
|
3313
|
+
};
|
|
3314
|
+
function Ge(r = "light") {
|
|
3055
3315
|
return r === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : r;
|
|
3056
3316
|
}
|
|
3057
|
-
const
|
|
3317
|
+
const Je = ["AuthSelection", "Login", "PasskeyAuth", "PinVerification", "PasskeyRegister"], oi = "https://apis.casperid.com", Ke = {
|
|
3058
3318
|
requestId: "",
|
|
3059
3319
|
verificationTier: "layer_3"
|
|
3060
|
-
},
|
|
3320
|
+
}, pi = ({
|
|
3061
3321
|
isOpen: r,
|
|
3062
|
-
apiKey:
|
|
3063
|
-
theme:
|
|
3064
|
-
requiredTier:
|
|
3065
|
-
onSuccess:
|
|
3066
|
-
onClose:
|
|
3067
|
-
onError:
|
|
3068
|
-
mode:
|
|
3069
|
-
previewMode:
|
|
3070
|
-
initialScreen:
|
|
3071
|
-
apiBaseUrl:
|
|
3072
|
-
termsUrl:
|
|
3073
|
-
privacyUrl:
|
|
3074
|
-
logoUrl:
|
|
3075
|
-
language:
|
|
3076
|
-
layout:
|
|
3322
|
+
apiKey: a,
|
|
3323
|
+
theme: n = {},
|
|
3324
|
+
requiredTier: l,
|
|
3325
|
+
onSuccess: N,
|
|
3326
|
+
onClose: p,
|
|
3327
|
+
onError: f,
|
|
3328
|
+
mode: m = "login",
|
|
3329
|
+
previewMode: s = !1,
|
|
3330
|
+
initialScreen: c,
|
|
3331
|
+
apiBaseUrl: d,
|
|
3332
|
+
termsUrl: D = "#",
|
|
3333
|
+
privacyUrl: h = "#",
|
|
3334
|
+
logoUrl: A,
|
|
3335
|
+
language: _ = "EN",
|
|
3336
|
+
layout: o,
|
|
3337
|
+
platform: I
|
|
3077
3338
|
}) => {
|
|
3078
|
-
var
|
|
3079
|
-
const [
|
|
3080
|
-
primaryColor:
|
|
3081
|
-
borderRadius:
|
|
3082
|
-
fontFamily:
|
|
3083
|
-
mode:
|
|
3084
|
-
layout:
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3339
|
+
var Be;
|
|
3340
|
+
const [g, k] = y({}), [V, w] = y(!s && !!a), {
|
|
3341
|
+
primaryColor: T,
|
|
3342
|
+
borderRadius: Y,
|
|
3343
|
+
fontFamily: W,
|
|
3344
|
+
mode: B = "light",
|
|
3345
|
+
layout: b,
|
|
3346
|
+
platform: C
|
|
3347
|
+
} = n || {}, S = typeof navigator < "u" && /iPhone|iPad|iPod|Android/i.test(navigator.userAgent), L = T || g.primaryColor || "#8651e1", O = Y || g.borderRadius || "12", F = W || g.fontFamily || "Inter", G = o || b || g.layout || "auto", Q = I || C || g.platform || (S ? "mobile" : "desktop"), [de, ue] = y(Ge(B)), [te, ie] = y(
|
|
3348
|
+
c ?? (m === "verify" ? "SecurityUpgrade" : "AuthSelection")
|
|
3349
|
+
), [q, pe] = y({ email: "", verificationId: "" }), [K, me] = y(null), [ee, ne] = y({
|
|
3088
3350
|
email: "",
|
|
3089
3351
|
userExists: !1,
|
|
3090
3352
|
hasPasskey: !1,
|
|
3091
3353
|
userAccount: null
|
|
3092
|
-
}), [
|
|
3093
|
-
"--casperid-primary":
|
|
3094
|
-
"--casperid-radius":
|
|
3095
|
-
"--casperid-font":
|
|
3096
|
-
},
|
|
3097
|
-
#casperid-modal-${
|
|
3098
|
-
#casperid-modal-${
|
|
3099
|
-
--casperid-primary: ${
|
|
3100
|
-
--casperid-radius: ${
|
|
3101
|
-
--casperid-font: ${
|
|
3354
|
+
}), [U, v] = y(Ke), [M, Z] = y(""), [fe, z] = y(""), [X, he] = y(null), H = d || oi, oe = O.toString().endsWith("px") ? O.toString() : `${O}px`, ge = F.includes(" ") ? `"${F}", sans-serif` : `${F}, sans-serif`, ae = _t.useId().replace(/:/g, ""), ye = {
|
|
3355
|
+
"--casperid-primary": L,
|
|
3356
|
+
"--casperid-radius": oe,
|
|
3357
|
+
"--casperid-font": ge
|
|
3358
|
+
}, Ae = `${ae}-${L}-${oe}-${ge}`, De = `
|
|
3359
|
+
#casperid-modal-${ae},
|
|
3360
|
+
#casperid-modal-${ae} * {
|
|
3361
|
+
--casperid-primary: ${L} !important;
|
|
3362
|
+
--casperid-radius: ${oe} !important;
|
|
3363
|
+
--casperid-font: ${ge} !important;
|
|
3102
3364
|
}
|
|
3103
3365
|
`;
|
|
3104
|
-
|
|
3105
|
-
if (
|
|
3106
|
-
const
|
|
3107
|
-
return
|
|
3366
|
+
ce(() => {
|
|
3367
|
+
if (B === "system") {
|
|
3368
|
+
const u = window.matchMedia("(prefers-color-scheme: dark)"), x = (E) => ue(E.matches ? "dark" : "light");
|
|
3369
|
+
return u.addEventListener("change", x), () => u.removeEventListener("change", x);
|
|
3108
3370
|
} else
|
|
3109
|
-
|
|
3110
|
-
}, [
|
|
3111
|
-
|
|
3112
|
-
}, [
|
|
3113
|
-
r && !
|
|
3114
|
-
}, [r,
|
|
3115
|
-
if (!
|
|
3116
|
-
|
|
3371
|
+
ue(Ge(B));
|
|
3372
|
+
}, [B]), ce(() => {
|
|
3373
|
+
s && c && ie(c);
|
|
3374
|
+
}, [s, c]), ce(() => {
|
|
3375
|
+
r && !s && (ie(c ?? (m === "verify" ? "SecurityUpgrade" : "AuthSelection")), pe({ email: "", verificationId: "" }), me(null), ne({ email: "", userExists: !1, hasPasskey: !1, userAccount: null }), v(Ke), Z(""), z(""));
|
|
3376
|
+
}, [r, m, s, c]), ce(() => {
|
|
3377
|
+
if (!a || s) {
|
|
3378
|
+
w(!1);
|
|
3117
3379
|
return;
|
|
3118
3380
|
}
|
|
3119
3381
|
(async () => {
|
|
3120
3382
|
try {
|
|
3121
|
-
const
|
|
3122
|
-
if (
|
|
3123
|
-
const
|
|
3124
|
-
|
|
3125
|
-
primaryColor:
|
|
3126
|
-
borderRadius:
|
|
3127
|
-
fontFamily:
|
|
3128
|
-
layout:
|
|
3383
|
+
const x = await fetch(`${H}/api/business/app-metadata/${a}`);
|
|
3384
|
+
if (x.ok) {
|
|
3385
|
+
const E = await x.json();
|
|
3386
|
+
E.success && E.app && (he(E.app), E.app.theme && k({
|
|
3387
|
+
primaryColor: E.app.theme.primaryColor,
|
|
3388
|
+
borderRadius: E.app.theme.borderRadius,
|
|
3389
|
+
fontFamily: E.app.theme.fontFamily,
|
|
3390
|
+
layout: E.app.theme.layout,
|
|
3391
|
+
platform: E.app.theme.platform
|
|
3129
3392
|
}));
|
|
3130
3393
|
}
|
|
3131
|
-
} catch (
|
|
3132
|
-
console.warn("[CasperID] Failed to fetch app metadata:",
|
|
3394
|
+
} catch (x) {
|
|
3395
|
+
console.warn("[CasperID] Failed to fetch app metadata:", x);
|
|
3133
3396
|
} finally {
|
|
3134
|
-
|
|
3397
|
+
w(!1);
|
|
3135
3398
|
}
|
|
3136
3399
|
})();
|
|
3137
|
-
}, [
|
|
3138
|
-
const
|
|
3400
|
+
}, [a, H, s]);
|
|
3401
|
+
const Ue = () => ue((u) => u === "dark" ? "light" : "dark"), R = J((u) => ie(u), []), ze = J(async (u) => {
|
|
3139
3402
|
try {
|
|
3140
|
-
const
|
|
3403
|
+
const x = u === "layer_2" ? `${d}/api/v2/verification/layer2/start` : `${d}/api/v2/verification/layer3/start`, E = await fetch(x, {
|
|
3141
3404
|
method: "POST",
|
|
3142
3405
|
headers: {
|
|
3143
3406
|
"Content-Type": "application/json",
|
|
3144
|
-
"X-API-Key":
|
|
3407
|
+
"X-API-Key": a
|
|
3145
3408
|
},
|
|
3146
3409
|
credentials: "include",
|
|
3147
3410
|
body: JSON.stringify({
|
|
3148
3411
|
purpose: "sdk_verification",
|
|
3149
|
-
...
|
|
3412
|
+
...u === "layer_3" ? { verificationMethod: "document" } : {}
|
|
3150
3413
|
})
|
|
3151
3414
|
});
|
|
3152
|
-
if (!
|
|
3153
|
-
const
|
|
3154
|
-
throw new Error(
|
|
3415
|
+
if (!E.ok) {
|
|
3416
|
+
const le = await E.json().catch(() => ({}));
|
|
3417
|
+
throw new Error(le.error || `Request failed with status ${E.status}`);
|
|
3155
3418
|
}
|
|
3156
|
-
const
|
|
3157
|
-
if (
|
|
3158
|
-
return
|
|
3159
|
-
...
|
|
3160
|
-
requestId:
|
|
3161
|
-
verificationTier:
|
|
3162
|
-
})),
|
|
3163
|
-
throw new Error(
|
|
3164
|
-
} catch (
|
|
3165
|
-
return
|
|
3419
|
+
const $ = await E.json();
|
|
3420
|
+
if ($.success && $.verification)
|
|
3421
|
+
return v((le) => ({
|
|
3422
|
+
...le,
|
|
3423
|
+
requestId: $.verification.requestId,
|
|
3424
|
+
verificationTier: u
|
|
3425
|
+
})), $.verification.requestId;
|
|
3426
|
+
throw new Error($.error || "Failed to start verification");
|
|
3427
|
+
} catch (x) {
|
|
3428
|
+
return f == null || f(x instanceof Error ? x : new Error("Failed to start verification")), null;
|
|
3166
3429
|
}
|
|
3167
|
-
}, [
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
sessionToken:
|
|
3171
|
-
businessToken:
|
|
3172
|
-
userAccount:
|
|
3173
|
-
})),
|
|
3174
|
-
}, [
|
|
3175
|
-
|
|
3176
|
-
}, [
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
sessionToken:
|
|
3180
|
-
businessToken:
|
|
3181
|
-
userAccount:
|
|
3182
|
-
user_id:
|
|
3183
|
-
wallet:
|
|
3184
|
-
tier:
|
|
3185
|
-
did_address:
|
|
3430
|
+
}, [d, a, f]), rt = J((u, x, E) => {
|
|
3431
|
+
me(u), ne(($) => ({
|
|
3432
|
+
...$,
|
|
3433
|
+
sessionToken: u,
|
|
3434
|
+
businessToken: E,
|
|
3435
|
+
userAccount: x || null
|
|
3436
|
+
})), x != null && x.wallet && (x != null && x.did_address) && ee.hasPasskey ? Re(x.tier) : R("PasskeyRegister");
|
|
3437
|
+
}, [R, ee.hasPasskey]), nt = J((u) => {
|
|
3438
|
+
ne((x) => ({ ...x, email: u, hasPasskey: !0, userExists: !0 })), R("PasskeyAuth");
|
|
3439
|
+
}, [R]), st = J((u, x, E) => {
|
|
3440
|
+
me(u), ne(($) => ({
|
|
3441
|
+
...$,
|
|
3442
|
+
sessionToken: u,
|
|
3443
|
+
businessToken: E,
|
|
3444
|
+
userAccount: x ? {
|
|
3445
|
+
user_id: x.user_id,
|
|
3446
|
+
wallet: x.wallet,
|
|
3447
|
+
tier: x.tier,
|
|
3448
|
+
did_address: x.did_address
|
|
3186
3449
|
} : null
|
|
3187
|
-
})),
|
|
3188
|
-
}, []),
|
|
3189
|
-
|
|
3190
|
-
...
|
|
3450
|
+
})), Re(x == null ? void 0 : x.tier);
|
|
3451
|
+
}, []), ct = J((u, x) => {
|
|
3452
|
+
ne((E) => ({
|
|
3453
|
+
...E,
|
|
3191
3454
|
hasPasskey: !0,
|
|
3192
|
-
businessToken:
|
|
3193
|
-
userAccount:
|
|
3194
|
-
user_id:
|
|
3195
|
-
tier:
|
|
3196
|
-
} :
|
|
3197
|
-
})),
|
|
3198
|
-
}, [
|
|
3199
|
-
const
|
|
3200
|
-
if (!
|
|
3201
|
-
|
|
3455
|
+
businessToken: x,
|
|
3456
|
+
userAccount: u ? {
|
|
3457
|
+
user_id: u.user_id,
|
|
3458
|
+
tier: u.tier
|
|
3459
|
+
} : E.userAccount
|
|
3460
|
+
})), R("MintingIdentity");
|
|
3461
|
+
}, [R]), Re = J((u) => {
|
|
3462
|
+
const x = u || "layer_0";
|
|
3463
|
+
if (!l) {
|
|
3464
|
+
R("IdentityVerified");
|
|
3202
3465
|
return;
|
|
3203
3466
|
}
|
|
3204
|
-
const
|
|
3205
|
-
|
|
3206
|
-
}, [
|
|
3207
|
-
var
|
|
3208
|
-
if (
|
|
3209
|
-
var
|
|
3467
|
+
const E = l === "L1" ? "layer_1" : l === "L2" ? "layer_2" : l === "L3" ? "layer_3" : "layer_1", $ = ["layer_0", "layer_1", "layer_2", "layer_3"], le = $.indexOf(x), we = $.indexOf(E);
|
|
3468
|
+
le >= we ? R("IdentityVerified") : we >= 2 ? R("SecurityUpgrade") : R("IdentityVerified");
|
|
3469
|
+
}, [l, R]), ot = J(async (u) => {
|
|
3470
|
+
var E;
|
|
3471
|
+
if (u != null && u.wallet && ne(($) => {
|
|
3472
|
+
var le;
|
|
3210
3473
|
return {
|
|
3211
|
-
|
|
3474
|
+
...$,
|
|
3212
3475
|
userAccount: {
|
|
3213
|
-
|
|
3214
|
-
user_id: ((
|
|
3215
|
-
wallet:
|
|
3216
|
-
did_address:
|
|
3476
|
+
...$.userAccount,
|
|
3477
|
+
user_id: ((le = $.userAccount) == null ? void 0 : le.user_id) || "",
|
|
3478
|
+
wallet: u.wallet,
|
|
3479
|
+
did_address: u.didAddress,
|
|
3217
3480
|
tier: "layer_1"
|
|
3218
3481
|
}
|
|
3219
3482
|
};
|
|
3220
|
-
}),
|
|
3483
|
+
}), u != null && u.credentialHash && z(u.credentialHash), K && !s)
|
|
3221
3484
|
try {
|
|
3222
|
-
const
|
|
3485
|
+
const $ = await fetch(`${H}/api/casperid/refresh`, {
|
|
3223
3486
|
method: "POST",
|
|
3224
3487
|
headers: { "Content-Type": "application/json" },
|
|
3225
|
-
body: JSON.stringify({ token:
|
|
3488
|
+
body: JSON.stringify({ token: K, apiKey: a })
|
|
3226
3489
|
});
|
|
3227
|
-
if (
|
|
3228
|
-
const
|
|
3229
|
-
|
|
3230
|
-
...
|
|
3231
|
-
sessionToken:
|
|
3232
|
-
businessToken:
|
|
3490
|
+
if ($.ok) {
|
|
3491
|
+
const le = await $.json();
|
|
3492
|
+
le.success && le.token && (console.log("[CasperID SDK] Token refreshed after verification"), me(le.token), ne((we) => ({
|
|
3493
|
+
...we,
|
|
3494
|
+
sessionToken: le.token,
|
|
3495
|
+
businessToken: le.business_token || we.businessToken
|
|
3233
3496
|
})));
|
|
3234
3497
|
}
|
|
3235
|
-
} catch (
|
|
3236
|
-
console.warn("[CasperID SDK] Failed to refresh token after verification:",
|
|
3498
|
+
} catch ($) {
|
|
3499
|
+
console.warn("[CasperID SDK] Failed to refresh token after verification:", $);
|
|
3237
3500
|
}
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
}, [(
|
|
3241
|
-
const
|
|
3242
|
-
|
|
3243
|
-
}, [
|
|
3244
|
-
await
|
|
3245
|
-
}, [
|
|
3246
|
-
|
|
3247
|
-
}, [
|
|
3248
|
-
|
|
3249
|
-
}, [
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3501
|
+
let x = u != null && u.wallet ? "layer_1" : ((E = ee.userAccount) == null ? void 0 : E.tier) || "layer_1";
|
|
3502
|
+
U.livenessVerified && U.verificationTier === "layer_2" ? x = "layer_2" : U.documentType && U.verificationTier === "layer_3" && (x = "layer_3"), Re(x);
|
|
3503
|
+
}, [(Be = ee.userAccount) == null ? void 0 : Be.tier, Re, K, H, s, U]), lt = J((u) => {
|
|
3504
|
+
const x = (u == null ? void 0 : u.sessionToken) || (u == null ? void 0 : u.token), E = (u == null ? void 0 : u.business_token) || (u == null ? void 0 : u.businessToken);
|
|
3505
|
+
x && me(x), E && ne(($) => ({ ...$, businessToken: E })), R("SecurityUpgrade");
|
|
3506
|
+
}, [R]), dt = J(async () => {
|
|
3507
|
+
l === "L3" ? await ze("layer_3") && R("VerifyIdentityChoice") : await ze("layer_2") && R("FaceScan");
|
|
3508
|
+
}, [l, ze, R]), ut = J(async (u) => {
|
|
3509
|
+
v((x) => ({ ...x, livenessVerified: u })), R("MintingIdentity");
|
|
3510
|
+
}, [R]), mt = J((u) => {
|
|
3511
|
+
v((x) => ({ ...x, documentType: u })), R("DocumentScan");
|
|
3512
|
+
}, [R]), pt = J((u, x, E) => {
|
|
3513
|
+
v(($) => ({
|
|
3514
|
+
...$,
|
|
3515
|
+
extractedData: u,
|
|
3516
|
+
frontImageUrl: E.frontImageUrl,
|
|
3517
|
+
frontImageFileId: E.frontImageFileId,
|
|
3518
|
+
backImageUrl: E.backImageUrl,
|
|
3519
|
+
backImageFileId: E.backImageFileId
|
|
3520
|
+
})), Z(x), R("ReviewData");
|
|
3521
|
+
}, [R]), ft = J((u) => {
|
|
3522
|
+
v((x) => ({ ...x, extractedData: u })), R("FaceScan");
|
|
3523
|
+
}, [R]);
|
|
3524
|
+
J(() => {
|
|
3525
|
+
v((u) => ({ ...u, extractedData: void 0 })), Z(""), R("DocumentScan");
|
|
3526
|
+
}, [R]);
|
|
3527
|
+
const ht = J(() => {
|
|
3528
|
+
if (!K) {
|
|
3529
|
+
f == null || f(new Error("No valid session token available"));
|
|
3258
3530
|
return;
|
|
3259
3531
|
}
|
|
3260
|
-
|
|
3261
|
-
businessToken:
|
|
3262
|
-
}),
|
|
3263
|
-
}, [
|
|
3264
|
-
|
|
3265
|
-
}, [
|
|
3266
|
-
|
|
3267
|
-
}, [
|
|
3268
|
-
if (!r && !
|
|
3269
|
-
if (
|
|
3532
|
+
N == null || N(K, {
|
|
3533
|
+
businessToken: ee.businessToken
|
|
3534
|
+
}), p == null || p();
|
|
3535
|
+
}, [K, ee.businessToken, N, p, f]), be = J((u) => {
|
|
3536
|
+
f == null || f(new Error(u));
|
|
3537
|
+
}, [f]), bt = J((u, x) => {
|
|
3538
|
+
pe({ email: u, verificationId: x }), ne((E) => ({ ...E, email: u })), R("PinVerification");
|
|
3539
|
+
}, [R]);
|
|
3540
|
+
if (!r && !s) return null;
|
|
3541
|
+
if (V && !s)
|
|
3270
3542
|
return /* @__PURE__ */ e(
|
|
3271
3543
|
"div",
|
|
3272
3544
|
{
|
|
@@ -3275,233 +3547,246 @@ const $e = ["AuthSelection", "Login", "PasskeyAuth", "PinVerification", "Passkey
|
|
|
3275
3547
|
children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-3 border-white/20 border-t-white/80 rounded-full animate-spin" })
|
|
3276
3548
|
}
|
|
3277
3549
|
);
|
|
3278
|
-
const
|
|
3279
|
-
switch (
|
|
3550
|
+
const $e = () => {
|
|
3551
|
+
switch (te) {
|
|
3280
3552
|
case "AuthSelection":
|
|
3281
3553
|
return /* @__PURE__ */ e(
|
|
3282
|
-
|
|
3554
|
+
Mt,
|
|
3283
3555
|
{
|
|
3284
|
-
onNext: (
|
|
3285
|
-
onExtensionSuccess:
|
|
3286
|
-
onError:
|
|
3287
|
-
language:
|
|
3556
|
+
onNext: (x) => R(x === "otp" ? "Login" : "SecurityUpgrade"),
|
|
3557
|
+
onExtensionSuccess: lt,
|
|
3558
|
+
onError: be,
|
|
3559
|
+
language: _,
|
|
3560
|
+
platform: Q
|
|
3288
3561
|
}
|
|
3289
3562
|
);
|
|
3290
3563
|
case "Login":
|
|
3291
3564
|
return /* @__PURE__ */ e(
|
|
3292
|
-
|
|
3565
|
+
Lt,
|
|
3293
3566
|
{
|
|
3294
|
-
onNext:
|
|
3295
|
-
onPasskeyUser:
|
|
3296
|
-
onError:
|
|
3297
|
-
apiBaseUrl:
|
|
3298
|
-
|
|
3299
|
-
|
|
3567
|
+
onNext: bt,
|
|
3568
|
+
onPasskeyUser: nt,
|
|
3569
|
+
onError: be,
|
|
3570
|
+
apiBaseUrl: H,
|
|
3571
|
+
apiKey: a,
|
|
3572
|
+
previewMode: s,
|
|
3573
|
+
language: _
|
|
3300
3574
|
}
|
|
3301
3575
|
);
|
|
3302
3576
|
case "PasskeyAuth":
|
|
3303
3577
|
return /* @__PURE__ */ e(
|
|
3304
|
-
|
|
3578
|
+
Yt,
|
|
3305
3579
|
{
|
|
3306
|
-
email:
|
|
3307
|
-
onSuccess:
|
|
3308
|
-
onError:
|
|
3309
|
-
onFallbackToOTP: () =>
|
|
3310
|
-
apiBaseUrl:
|
|
3311
|
-
|
|
3312
|
-
|
|
3580
|
+
email: ee.email,
|
|
3581
|
+
onSuccess: st,
|
|
3582
|
+
onError: be,
|
|
3583
|
+
onFallbackToOTP: () => R("Login"),
|
|
3584
|
+
apiBaseUrl: H,
|
|
3585
|
+
apiKey: a,
|
|
3586
|
+
previewMode: s,
|
|
3587
|
+
language: _
|
|
3313
3588
|
}
|
|
3314
3589
|
);
|
|
3315
3590
|
case "PasskeyRegister":
|
|
3316
3591
|
return /* @__PURE__ */ e(
|
|
3317
|
-
|
|
3592
|
+
Gt,
|
|
3318
3593
|
{
|
|
3319
|
-
email:
|
|
3320
|
-
sessionToken:
|
|
3321
|
-
onSuccess:
|
|
3322
|
-
onError:
|
|
3323
|
-
apiBaseUrl:
|
|
3324
|
-
|
|
3325
|
-
|
|
3594
|
+
email: ee.email || q.email,
|
|
3595
|
+
sessionToken: K || "",
|
|
3596
|
+
onSuccess: ct,
|
|
3597
|
+
onError: be,
|
|
3598
|
+
apiBaseUrl: H,
|
|
3599
|
+
apiKey: a,
|
|
3600
|
+
previewMode: s,
|
|
3601
|
+
language: _
|
|
3326
3602
|
}
|
|
3327
3603
|
);
|
|
3328
3604
|
case "PinVerification":
|
|
3329
3605
|
return /* @__PURE__ */ e(
|
|
3330
|
-
|
|
3606
|
+
Jt,
|
|
3331
3607
|
{
|
|
3332
|
-
email:
|
|
3333
|
-
verificationId:
|
|
3334
|
-
onNext:
|
|
3335
|
-
onError:
|
|
3336
|
-
apiBaseUrl:
|
|
3337
|
-
apiKey:
|
|
3338
|
-
previewMode:
|
|
3339
|
-
language:
|
|
3608
|
+
email: q.email,
|
|
3609
|
+
verificationId: q.verificationId,
|
|
3610
|
+
onNext: rt,
|
|
3611
|
+
onError: be,
|
|
3612
|
+
apiBaseUrl: H,
|
|
3613
|
+
apiKey: a,
|
|
3614
|
+
previewMode: s,
|
|
3615
|
+
language: _
|
|
3340
3616
|
}
|
|
3341
3617
|
);
|
|
3342
3618
|
case "SecurityUpgrade":
|
|
3343
3619
|
return /* @__PURE__ */ e(
|
|
3344
|
-
|
|
3620
|
+
Kt,
|
|
3345
3621
|
{
|
|
3346
|
-
onNext:
|
|
3347
|
-
onSkip: () =>
|
|
3348
|
-
language:
|
|
3622
|
+
onNext: dt,
|
|
3623
|
+
onSkip: () => R("IdentityVerified"),
|
|
3624
|
+
language: _
|
|
3349
3625
|
}
|
|
3350
3626
|
);
|
|
3351
3627
|
case "FaceScan":
|
|
3352
3628
|
return /* @__PURE__ */ e(
|
|
3353
|
-
|
|
3629
|
+
Zt,
|
|
3354
3630
|
{
|
|
3355
|
-
requestId:
|
|
3356
|
-
onNext:
|
|
3357
|
-
onError:
|
|
3358
|
-
apiBaseUrl:
|
|
3359
|
-
|
|
3360
|
-
|
|
3631
|
+
requestId: U.requestId,
|
|
3632
|
+
onNext: ut,
|
|
3633
|
+
onError: be,
|
|
3634
|
+
apiBaseUrl: H,
|
|
3635
|
+
apiKey: a,
|
|
3636
|
+
previewMode: s,
|
|
3637
|
+
language: _
|
|
3361
3638
|
}
|
|
3362
3639
|
);
|
|
3363
3640
|
case "VerifyIdentityChoice":
|
|
3364
3641
|
return /* @__PURE__ */ e(
|
|
3365
|
-
|
|
3642
|
+
Qt,
|
|
3366
3643
|
{
|
|
3367
|
-
onNext:
|
|
3368
|
-
language:
|
|
3644
|
+
onNext: mt,
|
|
3645
|
+
language: _
|
|
3369
3646
|
}
|
|
3370
3647
|
);
|
|
3371
3648
|
case "DocumentScan":
|
|
3372
3649
|
return /* @__PURE__ */ e(
|
|
3373
|
-
|
|
3650
|
+
ti,
|
|
3374
3651
|
{
|
|
3375
|
-
requestId:
|
|
3376
|
-
documentType:
|
|
3377
|
-
onNext:
|
|
3378
|
-
onError:
|
|
3379
|
-
apiBaseUrl:
|
|
3380
|
-
|
|
3381
|
-
|
|
3652
|
+
requestId: U.requestId,
|
|
3653
|
+
documentType: U.documentType,
|
|
3654
|
+
onNext: pt,
|
|
3655
|
+
onError: be,
|
|
3656
|
+
apiBaseUrl: H,
|
|
3657
|
+
apiKey: a,
|
|
3658
|
+
previewMode: s,
|
|
3659
|
+
language: _
|
|
3382
3660
|
}
|
|
3383
3661
|
);
|
|
3384
3662
|
case "ReviewData":
|
|
3385
3663
|
return /* @__PURE__ */ e(
|
|
3386
|
-
|
|
3664
|
+
ii,
|
|
3387
3665
|
{
|
|
3388
|
-
requestId:
|
|
3389
|
-
documentType:
|
|
3390
|
-
extractedData:
|
|
3391
|
-
uploadId:
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3666
|
+
requestId: U.requestId,
|
|
3667
|
+
documentType: U.documentType,
|
|
3668
|
+
extractedData: U.extractedData,
|
|
3669
|
+
uploadId: M,
|
|
3670
|
+
frontImageUrl: U.frontImageUrl,
|
|
3671
|
+
frontImageFileId: U.frontImageFileId,
|
|
3672
|
+
backImageUrl: U.backImageUrl,
|
|
3673
|
+
backImageFileId: U.backImageFileId,
|
|
3674
|
+
onNext: ft,
|
|
3675
|
+
onRetake: () => R("DocumentScan"),
|
|
3676
|
+
onError: be,
|
|
3677
|
+
apiBaseUrl: H,
|
|
3678
|
+
apiKey: a,
|
|
3679
|
+
previewMode: s,
|
|
3680
|
+
language: _
|
|
3398
3681
|
}
|
|
3399
3682
|
);
|
|
3400
3683
|
case "MintingIdentity":
|
|
3401
|
-
const
|
|
3684
|
+
const u = U.requestId ? U.verificationTier : "layer_1";
|
|
3402
3685
|
return /* @__PURE__ */ e(
|
|
3403
|
-
|
|
3686
|
+
ri,
|
|
3404
3687
|
{
|
|
3405
|
-
tier:
|
|
3406
|
-
sessionToken:
|
|
3407
|
-
requestId:
|
|
3408
|
-
onNext:
|
|
3409
|
-
onError:
|
|
3410
|
-
apiBaseUrl:
|
|
3411
|
-
|
|
3412
|
-
|
|
3688
|
+
tier: u,
|
|
3689
|
+
sessionToken: K || "",
|
|
3690
|
+
requestId: U.requestId,
|
|
3691
|
+
onNext: ot,
|
|
3692
|
+
onError: be,
|
|
3693
|
+
apiBaseUrl: H,
|
|
3694
|
+
apiKey: a,
|
|
3695
|
+
previewMode: s,
|
|
3696
|
+
language: _
|
|
3413
3697
|
}
|
|
3414
3698
|
);
|
|
3415
3699
|
case "IdentityVerified":
|
|
3416
|
-
return /* @__PURE__ */ e(
|
|
3700
|
+
return /* @__PURE__ */ e(ni, { onNext: () => R("PermissionsRequest"), language: _ });
|
|
3417
3701
|
case "PermissionsRequest":
|
|
3418
3702
|
return /* @__PURE__ */ e(
|
|
3419
|
-
|
|
3703
|
+
ci,
|
|
3420
3704
|
{
|
|
3421
|
-
onApprove:
|
|
3422
|
-
onDeny: () =>
|
|
3423
|
-
language:
|
|
3424
|
-
appName:
|
|
3425
|
-
appLogo:
|
|
3705
|
+
onApprove: ht,
|
|
3706
|
+
onDeny: () => p == null ? void 0 : p(),
|
|
3707
|
+
language: _,
|
|
3708
|
+
appName: X == null ? void 0 : X.name,
|
|
3709
|
+
appLogo: A || (X == null ? void 0 : X.logo_url),
|
|
3710
|
+
requestedScopes: X == null ? void 0 : X.requested_scopes
|
|
3426
3711
|
}
|
|
3427
3712
|
);
|
|
3428
3713
|
default:
|
|
3429
3714
|
return null;
|
|
3430
3715
|
}
|
|
3431
3716
|
};
|
|
3432
|
-
return
|
|
3433
|
-
/* @__PURE__ */ e("style", { children:
|
|
3434
|
-
/* @__PURE__ */ e("div", { id: `casperid-modal-${
|
|
3435
|
-
/* @__PURE__ */ e(
|
|
3436
|
-
|
|
3717
|
+
return s ? /* @__PURE__ */ i(re, { children: [
|
|
3718
|
+
/* @__PURE__ */ e("style", { children: De }, Ae),
|
|
3719
|
+
/* @__PURE__ */ e("div", { id: `casperid-modal-${ae}`, style: ye, className: `relative ${de}`, children: /* @__PURE__ */ i(He, { className: "backdrop-blur-3xl", theme: de, children: [
|
|
3720
|
+
te !== "FaceScan" && /* @__PURE__ */ e(
|
|
3721
|
+
We,
|
|
3437
3722
|
{
|
|
3438
|
-
onClose:
|
|
3439
|
-
showClose:
|
|
3440
|
-
subtitle:
|
|
3441
|
-
theme:
|
|
3442
|
-
toggleTheme:
|
|
3723
|
+
onClose: p,
|
|
3724
|
+
showClose: te !== "AuthSelection",
|
|
3725
|
+
subtitle: te === "PermissionsRequest" ? "PERMISSION REQUEST" : "SECURE SDK",
|
|
3726
|
+
theme: de,
|
|
3727
|
+
toggleTheme: Ue
|
|
3443
3728
|
}
|
|
3444
3729
|
),
|
|
3445
|
-
/* @__PURE__ */ e("div", { className: "flex-1 flex flex-col relative overflow-hidden", children: /* @__PURE__ */ e(
|
|
3446
|
-
|
|
3730
|
+
/* @__PURE__ */ e("div", { className: "flex-1 flex flex-col relative overflow-hidden", children: /* @__PURE__ */ e(Me, { mode: "wait", children: /* @__PURE__ */ e(P.div, { className: "flex-1 flex flex-col", children: $e() }, te) }) }),
|
|
3731
|
+
Je.includes(te) && /* @__PURE__ */ e(Ye, { children: /* @__PURE__ */ i("p", { className: "text-[11px] text-slate-500 font-medium", children: [
|
|
3447
3732
|
"By connecting, you agree to our",
|
|
3448
3733
|
" ",
|
|
3449
|
-
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href:
|
|
3734
|
+
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href: D, target: "_blank", rel: "noopener noreferrer", children: "Terms of Service" }),
|
|
3450
3735
|
" ",
|
|
3451
3736
|
"&",
|
|
3452
3737
|
" ",
|
|
3453
|
-
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href:
|
|
3738
|
+
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href: h, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })
|
|
3454
3739
|
] }) })
|
|
3455
3740
|
] }) })
|
|
3456
|
-
] }) : /* @__PURE__ */
|
|
3457
|
-
/* @__PURE__ */ e("style", { children:
|
|
3458
|
-
/* @__PURE__ */
|
|
3741
|
+
] }) : /* @__PURE__ */ i(re, { children: [
|
|
3742
|
+
/* @__PURE__ */ e("style", { children: De }, Ae),
|
|
3743
|
+
/* @__PURE__ */ i(
|
|
3459
3744
|
"div",
|
|
3460
3745
|
{
|
|
3461
|
-
className: `fixed inset-0 z-[9999] flex items-center justify-center ${
|
|
3462
|
-
style: { backgroundColor:
|
|
3463
|
-
onClick: (
|
|
3746
|
+
className: `fixed inset-0 z-[9999] flex items-center justify-center ${G === "fullscreen" ? "p-0" : "p-4"}`,
|
|
3747
|
+
style: { backgroundColor: G === "fullscreen" ? "transparent" : "rgba(0,0,0,0.6)", backdropFilter: G === "fullscreen" ? "none" : "blur(6px)" },
|
|
3748
|
+
onClick: (u) => u.target === u.currentTarget && (p == null ? void 0 : p()),
|
|
3464
3749
|
children: [
|
|
3465
|
-
|
|
3750
|
+
G !== "fullscreen" && /* @__PURE__ */ i("div", { className: "absolute inset-0 pointer-events-none overflow-hidden", children: [
|
|
3466
3751
|
/* @__PURE__ */ e(
|
|
3467
3752
|
"div",
|
|
3468
3753
|
{
|
|
3469
3754
|
className: "absolute top-[-10%] left-[-10%] w-[60%] h-[40%] rounded-full blur-[120px]",
|
|
3470
|
-
style: { backgroundColor: `${
|
|
3755
|
+
style: { backgroundColor: `${L}1a` }
|
|
3471
3756
|
}
|
|
3472
3757
|
),
|
|
3473
3758
|
/* @__PURE__ */ e("div", { className: "absolute bottom-[-5%] right-[-5%] w-[50%] h-[30%] bg-[#6DE8EC]/5 blur-[100px] rounded-full" })
|
|
3474
3759
|
] }),
|
|
3475
3760
|
/* @__PURE__ */ e(
|
|
3476
|
-
|
|
3761
|
+
P.div,
|
|
3477
3762
|
{
|
|
3478
|
-
id: `casperid-modal-${
|
|
3479
|
-
initial:
|
|
3763
|
+
id: `casperid-modal-${ae}`,
|
|
3764
|
+
initial: G === "fullscreen" ? { opacity: 0 } : { opacity: 0, scale: 0.95, y: 20 },
|
|
3480
3765
|
animate: { opacity: 1, scale: 1, y: 0 },
|
|
3481
|
-
exit:
|
|
3766
|
+
exit: G === "fullscreen" ? { opacity: 0 } : { opacity: 0, scale: 0.95, y: 20 },
|
|
3482
3767
|
transition: { type: "spring", damping: 28, stiffness: 300 },
|
|
3483
|
-
style:
|
|
3484
|
-
className: `relative selection:bg-brand/30 ${
|
|
3485
|
-
children: /* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */ e(
|
|
3487
|
-
|
|
3768
|
+
style: ye,
|
|
3769
|
+
className: `relative selection:bg-brand/30 ${de} ${G === "fullscreen" ? "w-full h-full" : Q === "mobile" ? "w-full max-w-md h-[90vh] max-h-[800px]" : "w-full max-w-xl h-[85vh] max-h-[900px]"}`,
|
|
3770
|
+
children: /* @__PURE__ */ i(He, { className: `backdrop-blur-3xl ${G === "fullscreen" ? "w-full h-full rounded-none" : ""}`, theme: de, children: [
|
|
3771
|
+
te !== "FaceScan" && /* @__PURE__ */ e(
|
|
3772
|
+
We,
|
|
3488
3773
|
{
|
|
3489
|
-
onClose:
|
|
3490
|
-
showClose:
|
|
3491
|
-
subtitle:
|
|
3492
|
-
theme:
|
|
3493
|
-
toggleTheme:
|
|
3774
|
+
onClose: p,
|
|
3775
|
+
showClose: te !== "AuthSelection",
|
|
3776
|
+
subtitle: te === "PermissionsRequest" ? "PERMISSION REQUEST" : "SECURE SDK",
|
|
3777
|
+
theme: de,
|
|
3778
|
+
toggleTheme: Ue
|
|
3494
3779
|
}
|
|
3495
3780
|
),
|
|
3496
|
-
/* @__PURE__ */ e("div", { className: "flex-1 flex flex-col relative overflow-hidden", children: /* @__PURE__ */ e(
|
|
3497
|
-
|
|
3781
|
+
/* @__PURE__ */ e("div", { className: "flex-1 flex flex-col relative overflow-hidden", children: /* @__PURE__ */ e(Me, { mode: "wait", children: /* @__PURE__ */ e(P.div, { className: "flex-1 flex flex-col", children: $e() }, te) }) }),
|
|
3782
|
+
Je.includes(te) && /* @__PURE__ */ e(Ye, { children: /* @__PURE__ */ i("p", { className: "text-[11px] text-slate-500 font-medium", children: [
|
|
3498
3783
|
"By connecting, you agree to our",
|
|
3499
3784
|
" ",
|
|
3500
|
-
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href:
|
|
3785
|
+
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href: D, target: "_blank", rel: "noopener noreferrer", children: "Terms of Service" }),
|
|
3501
3786
|
" ",
|
|
3502
3787
|
"&",
|
|
3503
3788
|
" ",
|
|
3504
|
-
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href:
|
|
3789
|
+
/* @__PURE__ */ e("a", { className: "text-brand hover:underline ml-1", href: h, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })
|
|
3505
3790
|
] }) })
|
|
3506
3791
|
] })
|
|
3507
3792
|
}
|
|
@@ -3511,51 +3796,51 @@ const $e = ["AuthSelection", "Login", "PasskeyAuth", "PinVerification", "Passkey
|
|
|
3511
3796
|
)
|
|
3512
3797
|
] });
|
|
3513
3798
|
};
|
|
3514
|
-
async function
|
|
3515
|
-
const
|
|
3799
|
+
async function fi(r, a = {}, n = 3e4) {
|
|
3800
|
+
const l = new AbortController(), N = setTimeout(() => l.abort(), n);
|
|
3516
3801
|
try {
|
|
3517
3802
|
return await fetch(r, {
|
|
3518
|
-
...
|
|
3519
|
-
signal:
|
|
3803
|
+
...a,
|
|
3804
|
+
signal: l.signal
|
|
3520
3805
|
});
|
|
3521
3806
|
} finally {
|
|
3522
|
-
clearTimeout(
|
|
3807
|
+
clearTimeout(N);
|
|
3523
3808
|
}
|
|
3524
3809
|
}
|
|
3525
|
-
class
|
|
3526
|
-
constructor(
|
|
3527
|
-
super(
|
|
3810
|
+
class li extends Error {
|
|
3811
|
+
constructor(a, n) {
|
|
3812
|
+
super(a), this.name = "ApiError", this.status = n;
|
|
3528
3813
|
}
|
|
3529
3814
|
}
|
|
3530
|
-
async function
|
|
3815
|
+
async function hi(r) {
|
|
3531
3816
|
if (!r.ok) {
|
|
3532
|
-
const
|
|
3533
|
-
throw new
|
|
3534
|
-
|
|
3817
|
+
const a = await r.json().catch(() => ({}));
|
|
3818
|
+
throw new li(
|
|
3819
|
+
a.error || a.message || `Request failed with status ${r.status}`,
|
|
3535
3820
|
r.status
|
|
3536
3821
|
);
|
|
3537
3822
|
}
|
|
3538
3823
|
return r.json();
|
|
3539
3824
|
}
|
|
3540
3825
|
export {
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3826
|
+
li as ApiError,
|
|
3827
|
+
Mt as AuthSelectionScreen,
|
|
3828
|
+
pi as CasperIDModal,
|
|
3829
|
+
ti as DocumentScanScreen,
|
|
3830
|
+
Zt as FaceScanScreen,
|
|
3831
|
+
Ye as Footer,
|
|
3832
|
+
He as GlassContainer,
|
|
3833
|
+
We as Header,
|
|
3834
|
+
ni as IdentityVerifiedScreen,
|
|
3835
|
+
Lt as LoginScreen,
|
|
3836
|
+
ri as MintingIdentityScreen,
|
|
3837
|
+
ci as PermissionsRequestScreen,
|
|
3838
|
+
Jt as PinVerificationScreen,
|
|
3839
|
+
ii as ReviewDataScreen,
|
|
3840
|
+
Kt as SecurityUpgradeScreen,
|
|
3841
|
+
Qt as VerifyIdentityChoiceScreen,
|
|
3842
|
+
pi as default,
|
|
3843
|
+
fi as fetchWithTimeout,
|
|
3844
|
+
hi as handleApiResponse
|
|
3560
3845
|
};
|
|
3561
3846
|
//# sourceMappingURL=index.mjs.map
|