@nice2dev/auth 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NiceCaptcha.d.ts +54 -12
- package/dist/NiceCaptcha.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +629 -392
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
import { useState as _, useCallback as
|
|
2
|
-
import { jsxs as
|
|
3
|
-
function
|
|
4
|
-
const { onLogin: t, onRefresh:
|
|
5
|
-
if (
|
|
1
|
+
import { useState as _, useCallback as w, forwardRef as O, useMemo as X, useRef as U, useImperativeHandle as ae, useEffect as W } from "react";
|
|
2
|
+
import { jsxs as a, jsx as e, Fragment as ce } from "react/jsx-runtime";
|
|
3
|
+
function ve(i = {}) {
|
|
4
|
+
const { onLogin: t, onRefresh: c, onLogout: n, storageKey: r = "nice_auth", persistAuth: l = !1 } = i, [o, p] = _(() => {
|
|
5
|
+
if (l && typeof window < "u")
|
|
6
6
|
try {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
return { ...JSON.parse(
|
|
7
|
+
const h = localStorage.getItem(r);
|
|
8
|
+
if (h)
|
|
9
|
+
return { ...JSON.parse(h), loading: !1, error: null };
|
|
10
10
|
} catch {
|
|
11
11
|
}
|
|
12
12
|
return { isAuthenticated: !1, user: null, tokens: null, loading: !1, error: null };
|
|
13
|
-
}),
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
JSON.stringify({ isAuthenticated: !0, user:
|
|
20
|
-
) : localStorage.removeItem(
|
|
13
|
+
}), d = w(
|
|
14
|
+
(h) => {
|
|
15
|
+
p((m) => {
|
|
16
|
+
const f = { ...m, ...h };
|
|
17
|
+
return l && typeof window < "u" && (f.isAuthenticated ? localStorage.setItem(
|
|
18
|
+
r,
|
|
19
|
+
JSON.stringify({ isAuthenticated: !0, user: f.user })
|
|
20
|
+
) : localStorage.removeItem(r)), f;
|
|
21
21
|
});
|
|
22
22
|
},
|
|
23
|
-
[
|
|
24
|
-
),
|
|
25
|
-
async (
|
|
26
|
-
|
|
23
|
+
[l, r]
|
|
24
|
+
), $ = w(
|
|
25
|
+
async (h, m) => {
|
|
26
|
+
d({ loading: !0, error: null });
|
|
27
27
|
try {
|
|
28
28
|
if (t) {
|
|
29
|
-
const
|
|
30
|
-
return
|
|
29
|
+
const f = await t(h, m);
|
|
30
|
+
return d({
|
|
31
31
|
isAuthenticated: !0,
|
|
32
|
-
user:
|
|
33
|
-
tokens:
|
|
32
|
+
user: f.user,
|
|
33
|
+
tokens: f.tokens,
|
|
34
34
|
loading: !1
|
|
35
35
|
}), !0;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
38
|
-
} catch (
|
|
39
|
-
return
|
|
37
|
+
return d({ loading: !1, error: "No login handler configured" }), !1;
|
|
38
|
+
} catch (f) {
|
|
39
|
+
return d({
|
|
40
40
|
loading: !1,
|
|
41
|
-
error: (
|
|
41
|
+
error: (f == null ? void 0 : f.message) ?? "Login failed"
|
|
42
42
|
}), !1;
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
[t,
|
|
46
|
-
),
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
var
|
|
50
|
-
if (!((
|
|
45
|
+
[t, d]
|
|
46
|
+
), s = w(() => {
|
|
47
|
+
n == null || n(), d({ isAuthenticated: !1, user: null, tokens: null, loading: !1, error: null });
|
|
48
|
+
}, [n, d]), C = w(async () => {
|
|
49
|
+
var h;
|
|
50
|
+
if (!((h = o.tokens) != null && h.refreshToken) || !c)
|
|
51
51
|
return !1;
|
|
52
52
|
try {
|
|
53
|
-
const
|
|
54
|
-
return
|
|
53
|
+
const m = await c(o.tokens.refreshToken);
|
|
54
|
+
return d({ tokens: m }), !0;
|
|
55
55
|
} catch {
|
|
56
|
-
return
|
|
56
|
+
return s(), !1;
|
|
57
57
|
}
|
|
58
|
-
}, [
|
|
59
|
-
(
|
|
60
|
-
|
|
58
|
+
}, [o.tokens, c, d, s]), b = w(
|
|
59
|
+
(h, m) => {
|
|
60
|
+
d({ isAuthenticated: !0, user: h, tokens: m, loading: !1, error: null });
|
|
61
61
|
},
|
|
62
|
-
[
|
|
63
|
-
),
|
|
64
|
-
(...
|
|
65
|
-
[
|
|
66
|
-
),
|
|
67
|
-
(...
|
|
68
|
-
[
|
|
69
|
-
),
|
|
70
|
-
|
|
71
|
-
}, [
|
|
62
|
+
[d]
|
|
63
|
+
), x = w(
|
|
64
|
+
(...h) => o.user ? h.every((m) => o.user.roles.includes(m)) : !1,
|
|
65
|
+
[o.user]
|
|
66
|
+
), g = w(
|
|
67
|
+
(...h) => o.user ? h.every((m) => o.user.permissions.includes(m)) : !1,
|
|
68
|
+
[o.user]
|
|
69
|
+
), F = w(() => {
|
|
70
|
+
d({ error: null });
|
|
71
|
+
}, [d]);
|
|
72
72
|
return {
|
|
73
|
-
...
|
|
74
|
-
login:
|
|
75
|
-
logout:
|
|
76
|
-
refreshToken:
|
|
73
|
+
...o,
|
|
74
|
+
login: $,
|
|
75
|
+
logout: s,
|
|
76
|
+
refreshToken: C,
|
|
77
77
|
setAuth: b,
|
|
78
|
-
hasRoles:
|
|
79
|
-
hasPermissions:
|
|
80
|
-
clearError:
|
|
78
|
+
hasRoles: x,
|
|
79
|
+
hasPermissions: g,
|
|
80
|
+
clearError: F
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const ie = O(
|
|
84
84
|
({
|
|
85
|
-
onSubmit:
|
|
85
|
+
onSubmit: i,
|
|
86
86
|
loading: t = !1,
|
|
87
|
-
error:
|
|
88
|
-
showRememberMe:
|
|
89
|
-
showForgotPassword:
|
|
90
|
-
onForgotPassword:
|
|
91
|
-
showRegisterLink:
|
|
92
|
-
onRegisterClick:
|
|
93
|
-
title:
|
|
94
|
-
submitLabel:
|
|
95
|
-
logo:
|
|
96
|
-
footer:
|
|
87
|
+
error: c,
|
|
88
|
+
showRememberMe: n = !0,
|
|
89
|
+
showForgotPassword: r = !0,
|
|
90
|
+
onForgotPassword: l,
|
|
91
|
+
showRegisterLink: o = !0,
|
|
92
|
+
onRegisterClick: p,
|
|
93
|
+
title: d = "Sign In",
|
|
94
|
+
submitLabel: $ = "Sign In",
|
|
95
|
+
logo: s,
|
|
96
|
+
footer: C,
|
|
97
97
|
className: b,
|
|
98
|
-
style:
|
|
99
|
-
emailLabel:
|
|
100
|
-
passwordLabel:
|
|
101
|
-
tracelessPolicy:
|
|
102
|
-
privacyMessage:
|
|
103
|
-
},
|
|
104
|
-
const [
|
|
105
|
-
(
|
|
106
|
-
|
|
107
|
-
const D = (
|
|
108
|
-
|
|
98
|
+
style: x,
|
|
99
|
+
emailLabel: g = "Email",
|
|
100
|
+
passwordLabel: F = "Password",
|
|
101
|
+
tracelessPolicy: h,
|
|
102
|
+
privacyMessage: m
|
|
103
|
+
}, f) => {
|
|
104
|
+
const [T, N] = _(""), [P, S] = _(""), [E, k] = _(!1), M = X(() => !(!n || h && !h.cookiesAllowed), [n, h]), q = w(
|
|
105
|
+
(A) => {
|
|
106
|
+
A.preventDefault();
|
|
107
|
+
const D = (h == null ? void 0 : h.cookiesAllowed) === !1 ? !1 : E;
|
|
108
|
+
i == null || i({ email: T, password: P, rememberMe: D });
|
|
109
109
|
},
|
|
110
|
-
[
|
|
110
|
+
[T, P, E, i, h]
|
|
111
111
|
);
|
|
112
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ a(
|
|
113
113
|
"form",
|
|
114
114
|
{
|
|
115
|
-
ref:
|
|
115
|
+
ref: f,
|
|
116
116
|
className: `nice-login-form${b ? ` ${b}` : ""}`,
|
|
117
|
-
style:
|
|
118
|
-
onSubmit:
|
|
117
|
+
style: x,
|
|
118
|
+
onSubmit: q,
|
|
119
119
|
noValidate: !0,
|
|
120
120
|
children: [
|
|
121
|
-
|
|
122
|
-
/* @__PURE__ */ e("h2", { className: "nice-login-form__title", children:
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */ e("label", { htmlFor: "nice-login-email", children:
|
|
121
|
+
s && /* @__PURE__ */ e("div", { className: "nice-login-form__logo", children: s }),
|
|
122
|
+
/* @__PURE__ */ e("h2", { className: "nice-login-form__title", children: d }),
|
|
123
|
+
c && /* @__PURE__ */ e("div", { className: "nice-login-form__error", role: "alert", children: c }),
|
|
124
|
+
/* @__PURE__ */ a("div", { className: "nice-login-form__field", children: [
|
|
125
|
+
/* @__PURE__ */ e("label", { htmlFor: "nice-login-email", children: g }),
|
|
126
126
|
/* @__PURE__ */ e(
|
|
127
127
|
"input",
|
|
128
128
|
{
|
|
129
129
|
id: "nice-login-email",
|
|
130
130
|
className: "nice-input",
|
|
131
131
|
type: "email",
|
|
132
|
-
value:
|
|
133
|
-
onChange: (
|
|
132
|
+
value: T,
|
|
133
|
+
onChange: (A) => N(A.target.value),
|
|
134
134
|
autoComplete: "email",
|
|
135
135
|
required: !0,
|
|
136
136
|
disabled: t
|
|
137
137
|
}
|
|
138
138
|
)
|
|
139
139
|
] }),
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
/* @__PURE__ */ e("label", { htmlFor: "nice-login-password", children:
|
|
140
|
+
/* @__PURE__ */ a("div", { className: "nice-login-form__field", children: [
|
|
141
|
+
/* @__PURE__ */ e("label", { htmlFor: "nice-login-password", children: F }),
|
|
142
142
|
/* @__PURE__ */ e(
|
|
143
143
|
"input",
|
|
144
144
|
{
|
|
145
145
|
id: "nice-login-password",
|
|
146
146
|
className: "nice-input",
|
|
147
147
|
type: "password",
|
|
148
|
-
value:
|
|
149
|
-
onChange: (
|
|
148
|
+
value: P,
|
|
149
|
+
onChange: (A) => S(A.target.value),
|
|
150
150
|
autoComplete: "current-password",
|
|
151
151
|
required: !0,
|
|
152
152
|
disabled: t
|
|
153
153
|
}
|
|
154
154
|
)
|
|
155
155
|
] }),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
|
|
156
|
+
/* @__PURE__ */ a("div", { className: "nice-login-form__options", children: [
|
|
157
|
+
M && /* @__PURE__ */ a("label", { className: "nice-login-form__remember", children: [
|
|
158
158
|
/* @__PURE__ */ e(
|
|
159
159
|
"input",
|
|
160
160
|
{
|
|
161
161
|
type: "checkbox",
|
|
162
|
-
checked:
|
|
163
|
-
onChange: (
|
|
162
|
+
checked: E,
|
|
163
|
+
onChange: (A) => k(A.target.checked),
|
|
164
164
|
disabled: t
|
|
165
165
|
}
|
|
166
166
|
),
|
|
167
167
|
/* @__PURE__ */ e("span", { children: "Remember me" })
|
|
168
168
|
] }),
|
|
169
|
-
!
|
|
170
|
-
|
|
169
|
+
!M && n && m && /* @__PURE__ */ e("span", { className: "nice-login-form__privacy-notice", children: m }),
|
|
170
|
+
r && /* @__PURE__ */ e(
|
|
171
171
|
"button",
|
|
172
172
|
{
|
|
173
173
|
type: "button",
|
|
174
174
|
className: "nice-login-form__forgot",
|
|
175
|
-
onClick:
|
|
175
|
+
onClick: l,
|
|
176
176
|
disabled: t,
|
|
177
177
|
children: "Forgot password?"
|
|
178
178
|
}
|
|
@@ -183,92 +183,92 @@ const j = E(
|
|
|
183
183
|
{
|
|
184
184
|
type: "submit",
|
|
185
185
|
className: "nice-btn nice-btn--primary nice-login-form__submit",
|
|
186
|
-
disabled: t ||
|
|
187
|
-
children: t ? "…" :
|
|
186
|
+
disabled: t || !T || !P,
|
|
187
|
+
children: t ? "…" : $
|
|
188
188
|
}
|
|
189
189
|
),
|
|
190
|
-
|
|
190
|
+
o && /* @__PURE__ */ a("div", { className: "nice-login-form__register", children: [
|
|
191
191
|
/* @__PURE__ */ e("span", { children: "Don't have an account? " }),
|
|
192
|
-
/* @__PURE__ */ e("button", { type: "button", onClick:
|
|
192
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: p, disabled: t, children: "Register" })
|
|
193
193
|
] }),
|
|
194
|
-
|
|
194
|
+
C && /* @__PURE__ */ e("div", { className: "nice-login-form__footer", children: C })
|
|
195
195
|
]
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
);
|
|
200
|
-
|
|
201
|
-
const
|
|
200
|
+
ie.displayName = "NiceLoginForm";
|
|
201
|
+
const re = {
|
|
202
202
|
0: "Very weak",
|
|
203
203
|
1: "Weak",
|
|
204
204
|
2: "Fair",
|
|
205
205
|
3: "Strong",
|
|
206
206
|
4: "Very strong"
|
|
207
|
-
},
|
|
207
|
+
}, se = {
|
|
208
208
|
0: "#d9534f",
|
|
209
209
|
1: "#f0ad4e",
|
|
210
210
|
2: "#5bc0de",
|
|
211
211
|
3: "#5cb85c",
|
|
212
212
|
4: "#2e7d32"
|
|
213
213
|
};
|
|
214
|
-
function
|
|
215
|
-
if (!
|
|
214
|
+
function J(i) {
|
|
215
|
+
if (!i)
|
|
216
216
|
return 0;
|
|
217
217
|
let t = 0;
|
|
218
|
-
return
|
|
218
|
+
return i.length >= 8 && t++, i.length >= 12 && t++, /[a-z]/.test(i) && /[A-Z]/.test(i) && t++, /\d/.test(i) && t++, /[^a-zA-Z0-9]/.test(i) && t++, Math.min(4, t);
|
|
219
219
|
}
|
|
220
|
-
const
|
|
221
|
-
({ password:
|
|
222
|
-
const
|
|
223
|
-
return /* @__PURE__ */
|
|
220
|
+
const Z = O(
|
|
221
|
+
({ password: i, strength: t, showLabel: c = !0, labels: n = re, className: r }, l) => {
|
|
222
|
+
const o = t ?? J(i), p = se[o], d = (o + 1) / 5 * 100;
|
|
223
|
+
return /* @__PURE__ */ a("div", { ref: l, className: `nice-password-strength${r ? ` ${r}` : ""}`, children: [
|
|
224
224
|
/* @__PURE__ */ e("div", { className: "nice-password-strength__bar", children: /* @__PURE__ */ e(
|
|
225
225
|
"div",
|
|
226
226
|
{
|
|
227
227
|
className: "nice-password-strength__fill",
|
|
228
|
-
style: { width: `${
|
|
228
|
+
style: { width: `${d}%`, backgroundColor: p }
|
|
229
229
|
}
|
|
230
230
|
) }),
|
|
231
|
-
|
|
231
|
+
c && /* @__PURE__ */ e("span", { className: "nice-password-strength__label", style: { color: p }, children: n[o] })
|
|
232
232
|
] });
|
|
233
233
|
}
|
|
234
234
|
);
|
|
235
|
-
|
|
236
|
-
const
|
|
235
|
+
Z.displayName = "NicePasswordStrength";
|
|
236
|
+
const le = O(
|
|
237
237
|
({
|
|
238
|
-
onSubmit:
|
|
238
|
+
onSubmit: i,
|
|
239
239
|
loading: t = !1,
|
|
240
|
-
error:
|
|
241
|
-
onLoginClick:
|
|
242
|
-
showPasswordStrength:
|
|
243
|
-
minPasswordStrength:
|
|
244
|
-
termsUrl:
|
|
245
|
-
privacyUrl:
|
|
246
|
-
title:
|
|
247
|
-
logo:
|
|
248
|
-
footer:
|
|
249
|
-
className:
|
|
240
|
+
error: c,
|
|
241
|
+
onLoginClick: n,
|
|
242
|
+
showPasswordStrength: r = !0,
|
|
243
|
+
minPasswordStrength: l = 2,
|
|
244
|
+
termsUrl: o,
|
|
245
|
+
privacyUrl: p,
|
|
246
|
+
title: d = "Create Account",
|
|
247
|
+
logo: $,
|
|
248
|
+
footer: s,
|
|
249
|
+
className: C,
|
|
250
250
|
style: b
|
|
251
|
-
},
|
|
252
|
-
const [
|
|
253
|
-
(
|
|
254
|
-
|
|
251
|
+
}, x) => {
|
|
252
|
+
const [g, F] = _(""), [h, m] = _(""), [f, T] = _(""), [N, P] = _(""), [S, E] = _(""), [k, M] = _(!1), q = J(N), A = N === S, D = g && f && N && A && k && q >= l && !t, u = w(
|
|
253
|
+
(v) => {
|
|
254
|
+
v.preventDefault(), D && (i == null || i({ firstName: g, lastName: h, email: f, password: N, acceptTerms: k }));
|
|
255
255
|
},
|
|
256
|
-
[D,
|
|
256
|
+
[D, g, h, f, N, k, i]
|
|
257
257
|
);
|
|
258
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ a(
|
|
259
259
|
"form",
|
|
260
260
|
{
|
|
261
|
-
ref:
|
|
262
|
-
className: `nice-register-form${
|
|
261
|
+
ref: x,
|
|
262
|
+
className: `nice-register-form${C ? ` ${C}` : ""}`,
|
|
263
263
|
style: b,
|
|
264
|
-
onSubmit:
|
|
264
|
+
onSubmit: u,
|
|
265
265
|
noValidate: !0,
|
|
266
266
|
children: [
|
|
267
|
-
|
|
268
|
-
/* @__PURE__ */ e("h2", { className: "nice-register-form__title", children:
|
|
269
|
-
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
267
|
+
$ && /* @__PURE__ */ e("div", { className: "nice-register-form__logo", children: $ }),
|
|
268
|
+
/* @__PURE__ */ e("h2", { className: "nice-register-form__title", children: d }),
|
|
269
|
+
c && /* @__PURE__ */ e("div", { className: "nice-register-form__error", role: "alert", children: c }),
|
|
270
|
+
/* @__PURE__ */ a("div", { className: "nice-register-form__row", children: [
|
|
271
|
+
/* @__PURE__ */ a("div", { className: "nice-register-form__field", children: [
|
|
272
272
|
/* @__PURE__ */ e("label", { htmlFor: "nice-reg-first", children: "First name *" }),
|
|
273
273
|
/* @__PURE__ */ e(
|
|
274
274
|
"input",
|
|
@@ -276,15 +276,15 @@ const Q = E(
|
|
|
276
276
|
id: "nice-reg-first",
|
|
277
277
|
className: "nice-input",
|
|
278
278
|
type: "text",
|
|
279
|
-
value:
|
|
280
|
-
onChange: (
|
|
279
|
+
value: g,
|
|
280
|
+
onChange: (v) => F(v.target.value),
|
|
281
281
|
required: !0,
|
|
282
282
|
disabled: t,
|
|
283
283
|
autoComplete: "given-name"
|
|
284
284
|
}
|
|
285
285
|
)
|
|
286
286
|
] }),
|
|
287
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ a("div", { className: "nice-register-form__field", children: [
|
|
288
288
|
/* @__PURE__ */ e("label", { htmlFor: "nice-reg-last", children: "Last name" }),
|
|
289
289
|
/* @__PURE__ */ e(
|
|
290
290
|
"input",
|
|
@@ -292,15 +292,15 @@ const Q = E(
|
|
|
292
292
|
id: "nice-reg-last",
|
|
293
293
|
className: "nice-input",
|
|
294
294
|
type: "text",
|
|
295
|
-
value:
|
|
296
|
-
onChange: (
|
|
295
|
+
value: h,
|
|
296
|
+
onChange: (v) => m(v.target.value),
|
|
297
297
|
disabled: t,
|
|
298
298
|
autoComplete: "family-name"
|
|
299
299
|
}
|
|
300
300
|
)
|
|
301
301
|
] })
|
|
302
302
|
] }),
|
|
303
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ a("div", { className: "nice-register-form__field", children: [
|
|
304
304
|
/* @__PURE__ */ e("label", { htmlFor: "nice-reg-email", children: "Email *" }),
|
|
305
305
|
/* @__PURE__ */ e(
|
|
306
306
|
"input",
|
|
@@ -308,15 +308,15 @@ const Q = E(
|
|
|
308
308
|
id: "nice-reg-email",
|
|
309
309
|
className: "nice-input",
|
|
310
310
|
type: "email",
|
|
311
|
-
value:
|
|
312
|
-
onChange: (
|
|
311
|
+
value: f,
|
|
312
|
+
onChange: (v) => T(v.target.value),
|
|
313
313
|
required: !0,
|
|
314
314
|
disabled: t,
|
|
315
315
|
autoComplete: "email"
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
] }),
|
|
319
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ a("div", { className: "nice-register-form__field", children: [
|
|
320
320
|
/* @__PURE__ */ e("label", { htmlFor: "nice-reg-pass", children: "Password *" }),
|
|
321
321
|
/* @__PURE__ */ e(
|
|
322
322
|
"input",
|
|
@@ -324,16 +324,16 @@ const Q = E(
|
|
|
324
324
|
id: "nice-reg-pass",
|
|
325
325
|
className: "nice-input",
|
|
326
326
|
type: "password",
|
|
327
|
-
value:
|
|
328
|
-
onChange: (
|
|
327
|
+
value: N,
|
|
328
|
+
onChange: (v) => P(v.target.value),
|
|
329
329
|
required: !0,
|
|
330
330
|
disabled: t,
|
|
331
331
|
autoComplete: "new-password"
|
|
332
332
|
}
|
|
333
333
|
),
|
|
334
|
-
|
|
334
|
+
r && N.length > 0 && /* @__PURE__ */ e(Z, { password: N })
|
|
335
335
|
] }),
|
|
336
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ a("div", { className: "nice-register-form__field", children: [
|
|
337
337
|
/* @__PURE__ */ e("label", { htmlFor: "nice-reg-confirm", children: "Confirm password *" }),
|
|
338
338
|
/* @__PURE__ */ e(
|
|
339
339
|
"input",
|
|
@@ -341,34 +341,34 @@ const Q = E(
|
|
|
341
341
|
id: "nice-reg-confirm",
|
|
342
342
|
className: "nice-input",
|
|
343
343
|
type: "password",
|
|
344
|
-
value:
|
|
345
|
-
onChange: (
|
|
344
|
+
value: S,
|
|
345
|
+
onChange: (v) => E(v.target.value),
|
|
346
346
|
required: !0,
|
|
347
347
|
disabled: t,
|
|
348
348
|
autoComplete: "new-password"
|
|
349
349
|
}
|
|
350
350
|
),
|
|
351
|
-
|
|
351
|
+
S && !A && /* @__PURE__ */ e("span", { className: "nice-error-text", children: "Passwords do not match" })
|
|
352
352
|
] }),
|
|
353
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ a("label", { className: "nice-register-form__terms", children: [
|
|
354
354
|
/* @__PURE__ */ e(
|
|
355
355
|
"input",
|
|
356
356
|
{
|
|
357
357
|
type: "checkbox",
|
|
358
|
-
checked:
|
|
359
|
-
onChange: (
|
|
358
|
+
checked: k,
|
|
359
|
+
onChange: (v) => M(v.target.checked),
|
|
360
360
|
disabled: t
|
|
361
361
|
}
|
|
362
362
|
),
|
|
363
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ a("span", { children: [
|
|
364
364
|
"I accept the",
|
|
365
365
|
" ",
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
o ? /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", children: "Terms" }) : "Terms",
|
|
367
|
+
p && /* @__PURE__ */ a(ce, { children: [
|
|
368
368
|
" ",
|
|
369
369
|
"and",
|
|
370
370
|
" ",
|
|
371
|
-
/* @__PURE__ */ e("a", { href:
|
|
371
|
+
/* @__PURE__ */ e("a", { href: p, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })
|
|
372
372
|
] }),
|
|
373
373
|
" *"
|
|
374
374
|
] })
|
|
@@ -382,51 +382,51 @@ const Q = E(
|
|
|
382
382
|
children: t ? "…" : "Register"
|
|
383
383
|
}
|
|
384
384
|
),
|
|
385
|
-
|
|
385
|
+
n && /* @__PURE__ */ a("div", { className: "nice-register-form__login", children: [
|
|
386
386
|
/* @__PURE__ */ e("span", { children: "Already have an account? " }),
|
|
387
|
-
/* @__PURE__ */ e("button", { type: "button", onClick:
|
|
387
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: n, children: "Sign in" })
|
|
388
388
|
] }),
|
|
389
|
-
|
|
389
|
+
s && /* @__PURE__ */ e("div", { className: "nice-register-form__footer", children: s })
|
|
390
390
|
]
|
|
391
391
|
}
|
|
392
392
|
);
|
|
393
393
|
}
|
|
394
394
|
);
|
|
395
|
-
|
|
396
|
-
const
|
|
395
|
+
le.displayName = "NiceRegistrationForm";
|
|
396
|
+
const oe = O(
|
|
397
397
|
({
|
|
398
|
-
requireCurrentPassword:
|
|
398
|
+
requireCurrentPassword: i = !0,
|
|
399
399
|
onSubmit: t,
|
|
400
|
-
loading:
|
|
401
|
-
error:
|
|
402
|
-
success:
|
|
403
|
-
minPasswordStrength:
|
|
404
|
-
title:
|
|
405
|
-
className:
|
|
406
|
-
style:
|
|
407
|
-
},
|
|
408
|
-
const [
|
|
409
|
-
(
|
|
410
|
-
|
|
411
|
-
currentPassword:
|
|
400
|
+
loading: c = !1,
|
|
401
|
+
error: n,
|
|
402
|
+
success: r,
|
|
403
|
+
minPasswordStrength: l = 2,
|
|
404
|
+
title: o = "Change Password",
|
|
405
|
+
className: p,
|
|
406
|
+
style: d
|
|
407
|
+
}, $) => {
|
|
408
|
+
const [s, C] = _(""), [b, x] = _(""), [g, F] = _(""), h = J(b), m = b === g, f = (!i || s.length > 0) && b.length > 0 && m && h >= l && !c, T = w(
|
|
409
|
+
(N) => {
|
|
410
|
+
N.preventDefault(), f && (t == null || t({
|
|
411
|
+
currentPassword: i ? s : void 0,
|
|
412
412
|
newPassword: b
|
|
413
413
|
}));
|
|
414
414
|
},
|
|
415
|
-
[
|
|
415
|
+
[f, s, b, i, t]
|
|
416
416
|
);
|
|
417
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ a(
|
|
418
418
|
"form",
|
|
419
419
|
{
|
|
420
|
-
ref:
|
|
421
|
-
className: `nice-change-password${
|
|
422
|
-
style:
|
|
423
|
-
onSubmit:
|
|
420
|
+
ref: $,
|
|
421
|
+
className: `nice-change-password${p ? ` ${p}` : ""}`,
|
|
422
|
+
style: d,
|
|
423
|
+
onSubmit: T,
|
|
424
424
|
noValidate: !0,
|
|
425
425
|
children: [
|
|
426
|
-
/* @__PURE__ */ e("h3", { className: "nice-change-password__title", children:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
/* @__PURE__ */ e("h3", { className: "nice-change-password__title", children: o }),
|
|
427
|
+
n && /* @__PURE__ */ e("div", { className: "nice-change-password__error", role: "alert", children: n }),
|
|
428
|
+
r && /* @__PURE__ */ e("div", { className: "nice-change-password__success", role: "status", children: r }),
|
|
429
|
+
i && /* @__PURE__ */ a("div", { className: "nice-change-password__field", children: [
|
|
430
430
|
/* @__PURE__ */ e("label", { htmlFor: "nice-cp-current", children: "Current password" }),
|
|
431
431
|
/* @__PURE__ */ e(
|
|
432
432
|
"input",
|
|
@@ -434,15 +434,15 @@ const z = E(
|
|
|
434
434
|
id: "nice-cp-current",
|
|
435
435
|
className: "nice-input",
|
|
436
436
|
type: "password",
|
|
437
|
-
value:
|
|
438
|
-
onChange: (
|
|
437
|
+
value: s,
|
|
438
|
+
onChange: (N) => C(N.target.value),
|
|
439
439
|
autoComplete: "current-password",
|
|
440
|
-
disabled:
|
|
440
|
+
disabled: c,
|
|
441
441
|
required: !0
|
|
442
442
|
}
|
|
443
443
|
)
|
|
444
444
|
] }),
|
|
445
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ a("div", { className: "nice-change-password__field", children: [
|
|
446
446
|
/* @__PURE__ */ e("label", { htmlFor: "nice-cp-new", children: "New password" }),
|
|
447
447
|
/* @__PURE__ */ e(
|
|
448
448
|
"input",
|
|
@@ -451,15 +451,15 @@ const z = E(
|
|
|
451
451
|
className: "nice-input",
|
|
452
452
|
type: "password",
|
|
453
453
|
value: b,
|
|
454
|
-
onChange: (
|
|
454
|
+
onChange: (N) => x(N.target.value),
|
|
455
455
|
autoComplete: "new-password",
|
|
456
|
-
disabled:
|
|
456
|
+
disabled: c,
|
|
457
457
|
required: !0
|
|
458
458
|
}
|
|
459
459
|
),
|
|
460
|
-
b.length > 0 && /* @__PURE__ */ e(
|
|
460
|
+
b.length > 0 && /* @__PURE__ */ e(Z, { password: b })
|
|
461
461
|
] }),
|
|
462
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ a("div", { className: "nice-change-password__field", children: [
|
|
463
463
|
/* @__PURE__ */ e("label", { htmlFor: "nice-cp-confirm", children: "Confirm new password" }),
|
|
464
464
|
/* @__PURE__ */ e(
|
|
465
465
|
"input",
|
|
@@ -467,57 +467,57 @@ const z = E(
|
|
|
467
467
|
id: "nice-cp-confirm",
|
|
468
468
|
className: "nice-input",
|
|
469
469
|
type: "password",
|
|
470
|
-
value:
|
|
471
|
-
onChange: (
|
|
470
|
+
value: g,
|
|
471
|
+
onChange: (N) => F(N.target.value),
|
|
472
472
|
autoComplete: "new-password",
|
|
473
|
-
disabled:
|
|
473
|
+
disabled: c,
|
|
474
474
|
required: !0
|
|
475
475
|
}
|
|
476
476
|
),
|
|
477
|
-
|
|
477
|
+
g && !m && /* @__PURE__ */ e("span", { className: "nice-error-text", children: "Passwords do not match" })
|
|
478
478
|
] }),
|
|
479
|
-
/* @__PURE__ */ e("button", { type: "submit", className: "nice-btn nice-btn--primary", disabled: !
|
|
479
|
+
/* @__PURE__ */ e("button", { type: "submit", className: "nice-btn nice-btn--primary", disabled: !f, children: c ? "…" : "Change Password" })
|
|
480
480
|
]
|
|
481
481
|
}
|
|
482
482
|
);
|
|
483
483
|
}
|
|
484
484
|
);
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
secret:
|
|
485
|
+
oe.displayName = "NiceChangePassword";
|
|
486
|
+
const de = O(({
|
|
487
|
+
secret: i,
|
|
488
488
|
qrCodeUrl: t,
|
|
489
|
-
issuer:
|
|
490
|
-
accountName:
|
|
491
|
-
onVerify:
|
|
492
|
-
loading:
|
|
493
|
-
error:
|
|
494
|
-
onCancel:
|
|
495
|
-
recoveryCodes:
|
|
496
|
-
step:
|
|
497
|
-
onStepChange:
|
|
498
|
-
className:
|
|
489
|
+
issuer: c,
|
|
490
|
+
accountName: n,
|
|
491
|
+
onVerify: r,
|
|
492
|
+
loading: l = !1,
|
|
493
|
+
error: o,
|
|
494
|
+
onCancel: p,
|
|
495
|
+
recoveryCodes: d,
|
|
496
|
+
step: $ = "setup",
|
|
497
|
+
onStepChange: s,
|
|
498
|
+
className: C,
|
|
499
499
|
style: b
|
|
500
|
-
},
|
|
501
|
-
const [
|
|
502
|
-
|
|
503
|
-
}, [
|
|
504
|
-
return /* @__PURE__ */
|
|
500
|
+
}, x) => {
|
|
501
|
+
const [g, F] = _(""), [h, m] = _(!1), [f, T] = _(!1), N = w((S) => {
|
|
502
|
+
S.preventDefault(), g.length >= 6 && (r == null || r(g));
|
|
503
|
+
}, [g, r]), P = `otpauth://totp/${c ? `${c}:` : ""}${n ?? "user"}?secret=${i}${c ? `&issuer=${c}` : ""}&digits=6&period=30`;
|
|
504
|
+
return /* @__PURE__ */ a("div", { ref: x, className: `nice-2fa-setup${C ? ` ${C}` : ""}`, style: b, children: [
|
|
505
505
|
/* @__PURE__ */ e("h3", { className: "nice-2fa-setup__title", children: "Two-Factor Authentication" }),
|
|
506
|
-
|
|
506
|
+
$ === "setup" && /* @__PURE__ */ a("div", { className: "nice-2fa-setup__step", children: [
|
|
507
507
|
/* @__PURE__ */ e("p", { className: "nice-2fa-setup__instruction", children: "Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.):" }),
|
|
508
|
-
t ? /* @__PURE__ */ e("img", { src: t, alt: "2FA QR Code", className: "nice-2fa-setup__qr" }) : /* @__PURE__ */
|
|
508
|
+
t ? /* @__PURE__ */ e("img", { src: t, alt: "2FA QR Code", className: "nice-2fa-setup__qr" }) : /* @__PURE__ */ a("div", { className: "nice-2fa-setup__qr-placeholder", children: [
|
|
509
509
|
/* @__PURE__ */ e("span", { children: "QR Code" }),
|
|
510
|
-
/* @__PURE__ */ e("code", { className: "nice-2fa-setup__uri", children:
|
|
510
|
+
/* @__PURE__ */ e("code", { className: "nice-2fa-setup__uri", children: P })
|
|
511
511
|
] }),
|
|
512
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ a("div", { className: "nice-2fa-setup__secret", children: [
|
|
513
513
|
/* @__PURE__ */ e("span", { children: "Or enter manually: " }),
|
|
514
|
-
|
|
514
|
+
h ? /* @__PURE__ */ e("code", { className: "nice-2fa-setup__secret-key", children: i }) : /* @__PURE__ */ e("button", { type: "button", onClick: () => m(!0), children: "Show secret key" })
|
|
515
515
|
] }),
|
|
516
|
-
/* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: () =>
|
|
516
|
+
/* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: () => s == null ? void 0 : s("verify"), children: "Next — Verify" })
|
|
517
517
|
] }),
|
|
518
|
-
|
|
518
|
+
$ === "verify" && /* @__PURE__ */ a("form", { className: "nice-2fa-setup__step", onSubmit: N, children: [
|
|
519
519
|
/* @__PURE__ */ e("p", { className: "nice-2fa-setup__instruction", children: "Enter the 6-digit code from your authenticator app:" }),
|
|
520
|
-
|
|
520
|
+
o && /* @__PURE__ */ e("div", { className: "nice-2fa-setup__error", role: "alert", children: o }),
|
|
521
521
|
/* @__PURE__ */ e(
|
|
522
522
|
"input",
|
|
523
523
|
{
|
|
@@ -525,240 +525,477 @@ const J = E(({
|
|
|
525
525
|
type: "text",
|
|
526
526
|
inputMode: "numeric",
|
|
527
527
|
maxLength: 6,
|
|
528
|
-
value:
|
|
529
|
-
onChange: (
|
|
528
|
+
value: g,
|
|
529
|
+
onChange: (S) => F(S.target.value.replace(/\D/g, "").slice(0, 6)),
|
|
530
530
|
placeholder: "000000",
|
|
531
531
|
autoFocus: !0,
|
|
532
|
-
disabled:
|
|
532
|
+
disabled: l,
|
|
533
533
|
autoComplete: "one-time-code"
|
|
534
534
|
}
|
|
535
535
|
),
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */ e("button", { type: "button", className: "nice-btn", onClick: () =>
|
|
538
|
-
/* @__PURE__ */ e("button", { type: "submit", className: "nice-btn nice-btn--primary", disabled:
|
|
536
|
+
/* @__PURE__ */ a("div", { className: "nice-2fa-setup__actions", children: [
|
|
537
|
+
/* @__PURE__ */ e("button", { type: "button", className: "nice-btn", onClick: () => s == null ? void 0 : s("setup"), children: "Back" }),
|
|
538
|
+
/* @__PURE__ */ e("button", { type: "submit", className: "nice-btn nice-btn--primary", disabled: l || g.length < 6, children: l ? "…" : "Verify" })
|
|
539
539
|
] })
|
|
540
540
|
] }),
|
|
541
|
-
|
|
541
|
+
$ === "recovery" && d && /* @__PURE__ */ a("div", { className: "nice-2fa-setup__step", children: [
|
|
542
542
|
/* @__PURE__ */ e("p", { className: "nice-2fa-setup__instruction", children: "Save these recovery codes in a safe place. Each code can only be used once:" }),
|
|
543
|
-
/* @__PURE__ */ e("div", { className: "nice-2fa-setup__recovery-codes", children:
|
|
543
|
+
/* @__PURE__ */ e("div", { className: "nice-2fa-setup__recovery-codes", children: d.map((S, E) => /* @__PURE__ */ e("code", { className: "nice-2fa-setup__recovery-code", children: S }, E)) }),
|
|
544
544
|
/* @__PURE__ */ e(
|
|
545
545
|
"button",
|
|
546
546
|
{
|
|
547
547
|
type: "button",
|
|
548
548
|
className: "nice-btn",
|
|
549
549
|
onClick: () => {
|
|
550
|
-
var
|
|
551
|
-
(
|
|
552
|
-
`)),
|
|
550
|
+
var S;
|
|
551
|
+
(S = navigator.clipboard) == null || S.writeText(d.join(`
|
|
552
|
+
`)), T(!0);
|
|
553
553
|
},
|
|
554
|
-
children:
|
|
554
|
+
children: f ? "Copied!" : "Copy all codes"
|
|
555
555
|
}
|
|
556
556
|
),
|
|
557
|
-
|
|
557
|
+
p && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: p, children: "Done" })
|
|
558
558
|
] }),
|
|
559
|
-
|
|
559
|
+
p && $ !== "recovery" && /* @__PURE__ */ e("button", { type: "button", className: "nice-2fa-setup__cancel", onClick: p, children: "Cancel" })
|
|
560
560
|
] });
|
|
561
561
|
});
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
"
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
562
|
+
de.displayName = "NiceTwoFaSetup";
|
|
563
|
+
const he = 500;
|
|
564
|
+
function I(i, t) {
|
|
565
|
+
return Math.floor(Math.random() * (t - i + 1)) + i;
|
|
566
|
+
}
|
|
567
|
+
function ue() {
|
|
568
|
+
return `${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
569
|
+
}
|
|
570
|
+
function me(i, t) {
|
|
571
|
+
switch (i) {
|
|
572
|
+
case "math": {
|
|
573
|
+
const c = t === "easy" ? 5 : t === "hard" ? 20 : 10, n = I(1, c), r = I(1, c), l = t !== "easy" && n >= r && Math.random() < 0.5, o = l ? n - r : n + r;
|
|
574
|
+
return { kind: "math", prompt: `${n} ${l ? "−" : "+"} ${r}`, answer: o };
|
|
575
|
+
}
|
|
576
|
+
case "text": {
|
|
577
|
+
const c = t === "easy" ? 4 : t === "hard" ? 7 : 5, n = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
|
|
578
|
+
let r = "";
|
|
579
|
+
for (let l = 0; l < c; l++)
|
|
580
|
+
r += n[I(0, n.length - 1)];
|
|
581
|
+
return { kind: "text", text: r };
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
case "slider":
|
|
584
|
+
return { kind: "slider", target: I(70, 92), tolerance: t === "easy" ? 8 : t === "hard" ? 2 : 4 };
|
|
585
|
+
case "checkbox":
|
|
586
|
+
default:
|
|
587
|
+
return { kind: "checkbox" };
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
function pe(i, t, c) {
|
|
591
|
+
if (!i)
|
|
592
|
+
return;
|
|
593
|
+
const n = i.getContext("2d");
|
|
594
|
+
if (!n)
|
|
595
|
+
return;
|
|
596
|
+
const r = i.width, l = i.height;
|
|
597
|
+
n.clearRect(0, 0, r, l), n.fillStyle = c ? "#1a1a1a" : "#f3f4f6", n.fillRect(0, 0, r, l), n.strokeStyle = c ? "rgba(255,255,255,0.18)" : "rgba(0,0,0,0.18)", n.lineWidth = 1;
|
|
598
|
+
for (let p = 0; p < 6; p++)
|
|
599
|
+
n.beginPath(), n.moveTo(I(0, r), I(0, l)), n.lineTo(I(0, r), I(0, l)), n.stroke();
|
|
600
|
+
n.fillStyle = c ? "#e5e7eb" : "#111827", n.textBaseline = "middle";
|
|
601
|
+
const o = r / (t.length + 1);
|
|
602
|
+
for (let p = 0; p < t.length; p++) {
|
|
603
|
+
const d = I(22, 30);
|
|
604
|
+
n.save(), n.translate(o * (p + 1), l / 2 + I(-4, 4)), n.rotate(I(-22, 22) * Math.PI / 180), n.font = `bold ${d}px monospace`, n.fillText(t[p], -d / 3, 0), n.restore();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
const fe = O((i, t) => {
|
|
608
|
+
const {
|
|
609
|
+
variant: c,
|
|
610
|
+
difficulty: n = "medium",
|
|
611
|
+
refreshable: r = !0,
|
|
612
|
+
verifyToken: l,
|
|
613
|
+
expiresMs: o,
|
|
614
|
+
label: p = "I'm not a robot",
|
|
615
|
+
provider: d = "custom",
|
|
616
|
+
siteKey: $,
|
|
617
|
+
onVerify: s,
|
|
618
|
+
onExpire: C,
|
|
619
|
+
onError: b,
|
|
620
|
+
onRefresh: x,
|
|
621
|
+
theme: g = "light",
|
|
622
|
+
size: F = "normal",
|
|
623
|
+
customRender: h,
|
|
624
|
+
className: m,
|
|
625
|
+
style: f
|
|
626
|
+
} = i, T = U(null), N = U(null), P = U(), [S, E] = _(0), [k, M] = _("idle"), [q, A] = _(""), [D, u] = _(""), [v, z] = _(0), R = X(
|
|
627
|
+
() => me(c ?? "checkbox", n),
|
|
628
|
+
[c, n, S]
|
|
629
|
+
), K = w(() => {
|
|
630
|
+
M("idle"), A(""), u(""), z(0), E((y) => y + 1);
|
|
631
|
+
}, []), G = w(() => {
|
|
632
|
+
K(), x == null || x();
|
|
633
|
+
}, [K, x]);
|
|
634
|
+
ae(
|
|
635
|
+
t,
|
|
636
|
+
() => ({ reset: K, refresh: G, container: T.current }),
|
|
637
|
+
[K, G]
|
|
638
|
+
), W(() => {
|
|
639
|
+
c === "text" && R.kind === "text" && pe(N.current, R.text, g === "dark");
|
|
640
|
+
}, [c, R, g]), W(() => {
|
|
641
|
+
if (k !== "verified" || !o)
|
|
642
|
+
return;
|
|
643
|
+
const y = setTimeout(() => {
|
|
644
|
+
C == null || C(), K();
|
|
645
|
+
}, o);
|
|
646
|
+
return () => clearTimeout(y);
|
|
647
|
+
}, [k, o, C, K]);
|
|
648
|
+
const B = w(() => {
|
|
649
|
+
const y = `ntd-cap:${c}:${ue()}`;
|
|
650
|
+
l ? (M("verifying"), A(""), Promise.resolve().then(() => l(y)).then((Q) => {
|
|
651
|
+
Q ? (M("verified"), s == null || s(y)) : (M("error"), A("Verification failed. Please try again."), E((ne) => ne + 1), u(""));
|
|
652
|
+
}).catch((Q) => {
|
|
653
|
+
M("error"), A("Verification error. Please try again."), b == null || b(Q);
|
|
654
|
+
})) : (M("verified"), s == null || s(y));
|
|
655
|
+
}, [c, l, s, b]), H = w(() => {
|
|
656
|
+
M("error"), A("Incorrect, please try again."), E((y) => y + 1), u("");
|
|
657
|
+
}, []), Y = w(() => {
|
|
658
|
+
k === "verifying" || k === "verified" || (M("verifying"), A(""), P.current = setTimeout(B, he));
|
|
659
|
+
}, [k, B]);
|
|
660
|
+
W(() => () => clearTimeout(P.current), []);
|
|
661
|
+
const j = w(() => {
|
|
662
|
+
R.kind === "math" ? D.trim() !== "" && Number(D) === R.answer ? B() : H() : R.kind === "text" && (D.trim().toUpperCase() === R.text ? B() : H());
|
|
663
|
+
}, [R, D, B, H]), ee = w(
|
|
664
|
+
(y) => {
|
|
665
|
+
z(y), !(R.kind !== "slider" || k === "verified" || k === "verifying") && Math.abs(y - R.target) <= R.tolerance && B();
|
|
666
|
+
},
|
|
667
|
+
[R, k, B]
|
|
668
|
+
);
|
|
669
|
+
if (!c)
|
|
670
|
+
return d === "custom" && h ? /* @__PURE__ */ e(
|
|
671
|
+
"div",
|
|
672
|
+
{
|
|
673
|
+
ref: T,
|
|
674
|
+
className: `nice-captcha nice-captcha--custom${m ? ` ${m}` : ""}`,
|
|
675
|
+
style: f,
|
|
676
|
+
children: h
|
|
677
|
+
}
|
|
678
|
+
) : /* @__PURE__ */ e(
|
|
679
|
+
"div",
|
|
680
|
+
{
|
|
681
|
+
ref: T,
|
|
682
|
+
className: `nice-captcha nice-captcha--${d} nice-captcha--${g}${F === "compact" ? " nice-captcha--compact" : ""}${m ? ` ${m}` : ""}`,
|
|
683
|
+
style: f,
|
|
684
|
+
"data-sitekey": $,
|
|
685
|
+
"data-theme": g,
|
|
686
|
+
"data-size": F,
|
|
687
|
+
children: /* @__PURE__ */ a("div", { className: "nice-captcha__placeholder", children: [
|
|
688
|
+
/* @__PURE__ */ a("span", { children: [
|
|
689
|
+
"🔒 Captcha (",
|
|
690
|
+
d,
|
|
691
|
+
")"
|
|
692
|
+
] }),
|
|
693
|
+
/* @__PURE__ */ a("p", { children: [
|
|
694
|
+
"Load the ",
|
|
695
|
+
d,
|
|
696
|
+
" SDK to activate verification."
|
|
697
|
+
] })
|
|
698
|
+
] })
|
|
699
|
+
}
|
|
700
|
+
);
|
|
701
|
+
const L = k === "verifying", V = k === "verified", te = `nice-captcha nice-captcha--${c} nice-captcha--${g} nice-captcha--${k}${F === "compact" ? " nice-captcha--compact" : ""}${m ? ` ${m}` : ""}`;
|
|
702
|
+
return /* @__PURE__ */ a(
|
|
584
703
|
"div",
|
|
585
704
|
{
|
|
586
|
-
ref:
|
|
587
|
-
className:
|
|
588
|
-
style:
|
|
589
|
-
"
|
|
590
|
-
"
|
|
591
|
-
"data-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
"
|
|
705
|
+
ref: T,
|
|
706
|
+
className: te,
|
|
707
|
+
style: f,
|
|
708
|
+
role: "group",
|
|
709
|
+
"aria-label": "Captcha challenge",
|
|
710
|
+
"data-variant": c,
|
|
711
|
+
"data-status": k,
|
|
712
|
+
"data-theme": g,
|
|
713
|
+
children: [
|
|
714
|
+
c === "checkbox" && /* @__PURE__ */ a(
|
|
715
|
+
"button",
|
|
716
|
+
{
|
|
717
|
+
type: "button",
|
|
718
|
+
className: "nice-captcha__checkbox",
|
|
719
|
+
role: "checkbox",
|
|
720
|
+
"aria-checked": V,
|
|
721
|
+
"aria-busy": L,
|
|
722
|
+
disabled: L || V,
|
|
723
|
+
onClick: Y,
|
|
724
|
+
children: [
|
|
725
|
+
/* @__PURE__ */ e("span", { className: "nice-captcha__box", "aria-hidden": "true", children: L ? "…" : V ? "✓" : "" }),
|
|
726
|
+
/* @__PURE__ */ e("span", { className: "nice-captcha__label", children: p })
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
),
|
|
730
|
+
c === "math" && R.kind === "math" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge", children: [
|
|
731
|
+
/* @__PURE__ */ a("span", { className: "nice-captcha__prompt", "aria-hidden": "true", children: [
|
|
732
|
+
R.prompt,
|
|
733
|
+
" ="
|
|
734
|
+
] }),
|
|
735
|
+
/* @__PURE__ */ e(
|
|
736
|
+
"input",
|
|
737
|
+
{
|
|
738
|
+
className: "nice-input nice-captcha__answer",
|
|
739
|
+
type: "number",
|
|
740
|
+
inputMode: "numeric",
|
|
741
|
+
value: D,
|
|
742
|
+
"aria-label": `What is ${R.prompt}?`,
|
|
743
|
+
disabled: L || V,
|
|
744
|
+
onChange: (y) => u(y.target.value),
|
|
745
|
+
onKeyDown: (y) => {
|
|
746
|
+
y.key === "Enter" && (y.preventDefault(), j());
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
),
|
|
750
|
+
/* @__PURE__ */ e(
|
|
751
|
+
"button",
|
|
752
|
+
{
|
|
753
|
+
type: "button",
|
|
754
|
+
className: "nice-btn nice-btn--primary nice-captcha__verify",
|
|
755
|
+
disabled: L || V || D.trim() === "",
|
|
756
|
+
onClick: j,
|
|
757
|
+
children: L ? "…" : "Verify"
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
] }),
|
|
761
|
+
c === "text" && R.kind === "text" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge", children: [
|
|
762
|
+
/* @__PURE__ */ e(
|
|
763
|
+
"canvas",
|
|
764
|
+
{
|
|
765
|
+
ref: N,
|
|
766
|
+
className: "nice-captcha__canvas",
|
|
767
|
+
width: 160,
|
|
768
|
+
height: 56,
|
|
769
|
+
"aria-hidden": "true"
|
|
770
|
+
}
|
|
771
|
+
),
|
|
772
|
+
/* @__PURE__ */ e(
|
|
773
|
+
"input",
|
|
774
|
+
{
|
|
775
|
+
className: "nice-input nice-captcha__answer",
|
|
776
|
+
type: "text",
|
|
777
|
+
autoCapitalize: "characters",
|
|
778
|
+
autoComplete: "off",
|
|
779
|
+
value: D,
|
|
780
|
+
"aria-label": "Type the characters shown in the image",
|
|
781
|
+
disabled: L || V,
|
|
782
|
+
onChange: (y) => u(y.target.value),
|
|
783
|
+
onKeyDown: (y) => {
|
|
784
|
+
y.key === "Enter" && (y.preventDefault(), j());
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
/* @__PURE__ */ e(
|
|
789
|
+
"button",
|
|
790
|
+
{
|
|
791
|
+
type: "button",
|
|
792
|
+
className: "nice-btn nice-btn--primary nice-captcha__verify",
|
|
793
|
+
disabled: L || V || D.trim() === "",
|
|
794
|
+
onClick: j,
|
|
795
|
+
children: L ? "…" : "Verify"
|
|
796
|
+
}
|
|
797
|
+
)
|
|
597
798
|
] }),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
"
|
|
600
|
-
a,
|
|
601
|
-
|
|
799
|
+
c === "slider" && R.kind === "slider" && /* @__PURE__ */ a("div", { className: "nice-captcha__challenge nice-captcha__challenge--slider", children: [
|
|
800
|
+
/* @__PURE__ */ e("span", { className: "nice-captcha__slider-hint", "aria-hidden": "true", children: V ? "Verified ✓" : "Slide to the marker" }),
|
|
801
|
+
/* @__PURE__ */ a("div", { className: "nice-captcha__track", children: [
|
|
802
|
+
/* @__PURE__ */ e(
|
|
803
|
+
"span",
|
|
804
|
+
{
|
|
805
|
+
className: "nice-captcha__target",
|
|
806
|
+
"aria-hidden": "true",
|
|
807
|
+
style: { left: `${R.target}%` }
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
/* @__PURE__ */ e(
|
|
811
|
+
"input",
|
|
812
|
+
{
|
|
813
|
+
className: "nice-captcha__slider",
|
|
814
|
+
type: "range",
|
|
815
|
+
min: 0,
|
|
816
|
+
max: 100,
|
|
817
|
+
value: v,
|
|
818
|
+
"aria-label": "Slide the handle to the marker to verify",
|
|
819
|
+
"aria-valuetext": `${v}%`,
|
|
820
|
+
disabled: V || L,
|
|
821
|
+
onChange: (y) => ee(Number(y.target.value))
|
|
822
|
+
}
|
|
823
|
+
)
|
|
824
|
+
] })
|
|
825
|
+
] }),
|
|
826
|
+
/* @__PURE__ */ a("div", { className: "nice-captcha__footer", children: [
|
|
827
|
+
/* @__PURE__ */ e("div", { className: "nice-captcha__message", role: "status", "aria-live": "polite", children: q }),
|
|
828
|
+
r && /* @__PURE__ */ e(
|
|
829
|
+
"button",
|
|
830
|
+
{
|
|
831
|
+
type: "button",
|
|
832
|
+
className: "nice-captcha__refresh",
|
|
833
|
+
"aria-label": "Refresh challenge",
|
|
834
|
+
title: "Refresh challenge",
|
|
835
|
+
onClick: G,
|
|
836
|
+
children: "↻"
|
|
837
|
+
}
|
|
838
|
+
)
|
|
602
839
|
] })
|
|
603
|
-
]
|
|
840
|
+
]
|
|
604
841
|
}
|
|
605
|
-
)
|
|
606
|
-
);
|
|
607
|
-
|
|
608
|
-
const
|
|
842
|
+
);
|
|
843
|
+
});
|
|
844
|
+
fe.displayName = "NiceCaptcha";
|
|
845
|
+
const ge = [
|
|
609
846
|
{ id: "google", label: "Google", icon: "🔵", color: "#4285f4", textColor: "#fff" },
|
|
610
847
|
{ id: "microsoft", label: "Microsoft", icon: "🟦", color: "#00a4ef", textColor: "#fff" },
|
|
611
848
|
{ id: "discord", label: "Discord", icon: "💬", color: "#5865f2", textColor: "#fff" },
|
|
612
849
|
{ id: "spotify", label: "Spotify", icon: "🎵", color: "#1db954", textColor: "#fff" },
|
|
613
850
|
{ id: "github", label: "GitHub", icon: "🐙", color: "#24292e", textColor: "#fff" }
|
|
614
|
-
],
|
|
615
|
-
providers:
|
|
851
|
+
], _e = O(({
|
|
852
|
+
providers: i = ge,
|
|
616
853
|
onProviderClick: t,
|
|
617
|
-
disabled:
|
|
618
|
-
loadingProvider:
|
|
619
|
-
direction:
|
|
620
|
-
separatorText:
|
|
621
|
-
showSeparator:
|
|
622
|
-
className:
|
|
623
|
-
style:
|
|
624
|
-
},
|
|
854
|
+
disabled: c = !1,
|
|
855
|
+
loadingProvider: n,
|
|
856
|
+
direction: r = "vertical",
|
|
857
|
+
separatorText: l = "or continue with",
|
|
858
|
+
showSeparator: o = !0,
|
|
859
|
+
className: p,
|
|
860
|
+
style: d
|
|
861
|
+
}, $) => /* @__PURE__ */ a(
|
|
625
862
|
"div",
|
|
626
863
|
{
|
|
627
|
-
ref:
|
|
628
|
-
className: `nice-oauth nice-oauth--${
|
|
629
|
-
style:
|
|
864
|
+
ref: $,
|
|
865
|
+
className: `nice-oauth nice-oauth--${r}${p ? ` ${p}` : ""}`,
|
|
866
|
+
style: d,
|
|
630
867
|
children: [
|
|
631
|
-
|
|
868
|
+
o && /* @__PURE__ */ a("div", { className: "nice-oauth__separator", children: [
|
|
632
869
|
/* @__PURE__ */ e("hr", {}),
|
|
633
|
-
/* @__PURE__ */ e("span", { children:
|
|
870
|
+
/* @__PURE__ */ e("span", { children: l }),
|
|
634
871
|
/* @__PURE__ */ e("hr", {})
|
|
635
872
|
] }),
|
|
636
|
-
/* @__PURE__ */ e("div", { className: "nice-oauth__buttons", children:
|
|
873
|
+
/* @__PURE__ */ e("div", { className: "nice-oauth__buttons", children: i.map((s) => /* @__PURE__ */ a(
|
|
637
874
|
"button",
|
|
638
875
|
{
|
|
639
876
|
type: "button",
|
|
640
|
-
className: `nice-oauth__btn${
|
|
641
|
-
style: { backgroundColor:
|
|
642
|
-
onClick: () => t == null ? void 0 : t(
|
|
643
|
-
disabled:
|
|
877
|
+
className: `nice-oauth__btn${n === s.id ? " nice-oauth__btn--loading" : ""}`,
|
|
878
|
+
style: { backgroundColor: s.color, color: s.textColor },
|
|
879
|
+
onClick: () => t == null ? void 0 : t(s.id),
|
|
880
|
+
disabled: c || !!n,
|
|
644
881
|
children: [
|
|
645
|
-
|
|
646
|
-
/* @__PURE__ */ e("span", { className: "nice-oauth__btn-label", children:
|
|
882
|
+
s.icon && /* @__PURE__ */ e("span", { className: "nice-oauth__btn-icon", children: s.icon }),
|
|
883
|
+
/* @__PURE__ */ e("span", { className: "nice-oauth__btn-label", children: n === s.id ? "…" : s.label })
|
|
647
884
|
]
|
|
648
885
|
},
|
|
649
|
-
|
|
886
|
+
s.id
|
|
650
887
|
)) })
|
|
651
888
|
]
|
|
652
889
|
}
|
|
653
890
|
));
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
function(t,
|
|
891
|
+
_e.displayName = "NiceOAuthButtons";
|
|
892
|
+
const ye = O(
|
|
893
|
+
function(t, c) {
|
|
657
894
|
const {
|
|
658
|
-
tokens:
|
|
659
|
-
onCreate:
|
|
660
|
-
onRevoke:
|
|
661
|
-
availableScopes:
|
|
662
|
-
maxTokens:
|
|
663
|
-
title:
|
|
664
|
-
className:
|
|
665
|
-
style:
|
|
666
|
-
} = t, [
|
|
667
|
-
if (!(!
|
|
668
|
-
|
|
895
|
+
tokens: n,
|
|
896
|
+
onCreate: r,
|
|
897
|
+
onRevoke: l,
|
|
898
|
+
availableScopes: o = [],
|
|
899
|
+
maxTokens: p = 10,
|
|
900
|
+
title: d = "API Tokens",
|
|
901
|
+
className: $,
|
|
902
|
+
style: s
|
|
903
|
+
} = t, [C, b] = _(!1), [x, g] = _(""), [F, h] = _([]), [m, f] = _("90"), [T, N] = _(null), [P, S] = _(!1), [E, k] = _(null), M = w(async () => {
|
|
904
|
+
if (!(!r || !x.trim())) {
|
|
905
|
+
S(!0);
|
|
669
906
|
try {
|
|
670
|
-
const
|
|
671
|
-
|
|
907
|
+
const u = m ? parseInt(m, 10) : void 0, v = await r(x.trim(), F, u);
|
|
908
|
+
N(v), g(""), h([]), b(!1);
|
|
672
909
|
} finally {
|
|
673
|
-
|
|
910
|
+
S(!1);
|
|
674
911
|
}
|
|
675
912
|
}
|
|
676
|
-
}, [
|
|
677
|
-
async (
|
|
678
|
-
if (
|
|
679
|
-
|
|
913
|
+
}, [r, x, F, m]), q = w(
|
|
914
|
+
async (u) => {
|
|
915
|
+
if (l) {
|
|
916
|
+
k(u);
|
|
680
917
|
try {
|
|
681
|
-
await
|
|
918
|
+
await l(u);
|
|
682
919
|
} finally {
|
|
683
|
-
|
|
920
|
+
k(null);
|
|
684
921
|
}
|
|
685
922
|
}
|
|
686
923
|
},
|
|
687
|
-
[
|
|
688
|
-
),
|
|
689
|
-
|
|
690
|
-
(
|
|
924
|
+
[l]
|
|
925
|
+
), A = (u) => {
|
|
926
|
+
h(
|
|
927
|
+
(v) => v.includes(u) ? v.filter((z) => z !== u) : [...v, u]
|
|
691
928
|
);
|
|
692
|
-
}, D =
|
|
693
|
-
return /* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */ e("h3", { children:
|
|
929
|
+
}, D = n.length < p;
|
|
930
|
+
return /* @__PURE__ */ a("div", { ref: c, className: `nice-token-management ${$ ?? ""}`, style: s, children: [
|
|
931
|
+
/* @__PURE__ */ a("div", { className: "nice-token-management__header", children: [
|
|
932
|
+
/* @__PURE__ */ e("h3", { children: d }),
|
|
696
933
|
D && /* @__PURE__ */ e(
|
|
697
934
|
"button",
|
|
698
935
|
{
|
|
699
936
|
className: "nice-token-management__new-btn",
|
|
700
937
|
onClick: () => b(!0),
|
|
701
|
-
disabled:
|
|
938
|
+
disabled: C,
|
|
702
939
|
children: "+ New Token"
|
|
703
940
|
}
|
|
704
941
|
)
|
|
705
942
|
] }),
|
|
706
|
-
|
|
707
|
-
/* @__PURE__ */
|
|
943
|
+
T && /* @__PURE__ */ a("div", { className: "nice-token-management__reveal", children: [
|
|
944
|
+
/* @__PURE__ */ a("p", { children: [
|
|
708
945
|
/* @__PURE__ */ e("strong", { children: "New token created!" }),
|
|
709
946
|
" Copy it now — it won't be shown again."
|
|
710
947
|
] }),
|
|
711
|
-
/* @__PURE__ */ e("code", { className: "nice-token-management__token-value", children:
|
|
712
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
948
|
+
/* @__PURE__ */ e("code", { className: "nice-token-management__token-value", children: T }),
|
|
949
|
+
/* @__PURE__ */ e("button", { onClick: () => N(null), children: "Dismiss" })
|
|
713
950
|
] }),
|
|
714
|
-
|
|
715
|
-
/* @__PURE__ */
|
|
951
|
+
C && /* @__PURE__ */ a("div", { className: "nice-token-management__create-form", children: [
|
|
952
|
+
/* @__PURE__ */ a("label", { children: [
|
|
716
953
|
"Name",
|
|
717
954
|
/* @__PURE__ */ e(
|
|
718
955
|
"input",
|
|
719
956
|
{
|
|
720
957
|
type: "text",
|
|
721
|
-
value:
|
|
722
|
-
onChange: (
|
|
958
|
+
value: x,
|
|
959
|
+
onChange: (u) => g(u.target.value),
|
|
723
960
|
placeholder: "My API token",
|
|
724
961
|
maxLength: 64
|
|
725
962
|
}
|
|
726
963
|
)
|
|
727
964
|
] }),
|
|
728
|
-
|
|
965
|
+
o.length > 0 && /* @__PURE__ */ a("fieldset", { children: [
|
|
729
966
|
/* @__PURE__ */ e("legend", { children: "Scopes" }),
|
|
730
|
-
|
|
967
|
+
o.map((u) => /* @__PURE__ */ a("label", { className: "nice-token-management__scope", children: [
|
|
731
968
|
/* @__PURE__ */ e(
|
|
732
969
|
"input",
|
|
733
970
|
{
|
|
734
971
|
type: "checkbox",
|
|
735
|
-
checked:
|
|
736
|
-
onChange: () =>
|
|
972
|
+
checked: F.includes(u),
|
|
973
|
+
onChange: () => A(u)
|
|
737
974
|
}
|
|
738
975
|
),
|
|
739
|
-
|
|
740
|
-
] },
|
|
976
|
+
u
|
|
977
|
+
] }, u))
|
|
741
978
|
] }),
|
|
742
|
-
/* @__PURE__ */
|
|
979
|
+
/* @__PURE__ */ a("label", { children: [
|
|
743
980
|
"Expires in (days)",
|
|
744
981
|
/* @__PURE__ */ e(
|
|
745
982
|
"input",
|
|
746
983
|
{
|
|
747
984
|
type: "number",
|
|
748
|
-
value:
|
|
749
|
-
onChange: (
|
|
985
|
+
value: m,
|
|
986
|
+
onChange: (u) => f(u.target.value),
|
|
750
987
|
min: 1,
|
|
751
988
|
max: 365
|
|
752
989
|
}
|
|
753
990
|
)
|
|
754
991
|
] }),
|
|
755
|
-
/* @__PURE__ */
|
|
756
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
992
|
+
/* @__PURE__ */ a("div", { className: "nice-token-management__create-actions", children: [
|
|
993
|
+
/* @__PURE__ */ e("button", { onClick: M, disabled: P || !x.trim(), children: P ? "Creating…" : "Create Token" }),
|
|
757
994
|
/* @__PURE__ */ e("button", { onClick: () => b(!1), children: "Cancel" })
|
|
758
995
|
] })
|
|
759
996
|
] }),
|
|
760
|
-
|
|
761
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
997
|
+
n.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-token-management__empty", children: "No API tokens yet." }) : /* @__PURE__ */ a("table", { className: "nice-token-management__table", children: [
|
|
998
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
762
999
|
/* @__PURE__ */ e("th", { children: "Name" }),
|
|
763
1000
|
/* @__PURE__ */ e("th", { children: "Prefix" }),
|
|
764
1001
|
/* @__PURE__ */ e("th", { children: "Created" }),
|
|
@@ -767,43 +1004,43 @@ const Y = E(
|
|
|
767
1004
|
/* @__PURE__ */ e("th", { children: "Scopes" }),
|
|
768
1005
|
/* @__PURE__ */ e("th", {})
|
|
769
1006
|
] }) }),
|
|
770
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
771
|
-
var
|
|
772
|
-
return /* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */ e("td", { children:
|
|
774
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */
|
|
775
|
-
|
|
1007
|
+
/* @__PURE__ */ e("tbody", { children: n.map((u) => {
|
|
1008
|
+
var v;
|
|
1009
|
+
return /* @__PURE__ */ a("tr", { children: [
|
|
1010
|
+
/* @__PURE__ */ e("td", { children: u.name }),
|
|
1011
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ a("code", { children: [
|
|
1012
|
+
u.prefix,
|
|
776
1013
|
"…"
|
|
777
1014
|
] }) }),
|
|
778
|
-
/* @__PURE__ */ e("td", { children:
|
|
779
|
-
/* @__PURE__ */ e("td", { children:
|
|
780
|
-
/* @__PURE__ */ e("td", { children:
|
|
781
|
-
/* @__PURE__ */ e("td", { children: ((
|
|
1015
|
+
/* @__PURE__ */ e("td", { children: u.createdAt }),
|
|
1016
|
+
/* @__PURE__ */ e("td", { children: u.expiresAt ?? "—" }),
|
|
1017
|
+
/* @__PURE__ */ e("td", { children: u.lastUsedAt ?? "Never" }),
|
|
1018
|
+
/* @__PURE__ */ e("td", { children: ((v = u.scopes) == null ? void 0 : v.join(", ")) || "—" }),
|
|
782
1019
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
783
1020
|
"button",
|
|
784
1021
|
{
|
|
785
1022
|
className: "nice-token-management__revoke-btn",
|
|
786
|
-
onClick: () =>
|
|
787
|
-
disabled:
|
|
788
|
-
children:
|
|
1023
|
+
onClick: () => q(u.id),
|
|
1024
|
+
disabled: E === u.id,
|
|
1025
|
+
children: E === u.id ? "Revoking…" : "Revoke"
|
|
789
1026
|
}
|
|
790
1027
|
) })
|
|
791
|
-
] },
|
|
1028
|
+
] }, u.id);
|
|
792
1029
|
}) })
|
|
793
1030
|
] })
|
|
794
1031
|
] });
|
|
795
1032
|
}
|
|
796
1033
|
);
|
|
797
1034
|
export {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1035
|
+
fe as NiceCaptcha,
|
|
1036
|
+
oe as NiceChangePassword,
|
|
1037
|
+
ie as NiceLoginForm,
|
|
1038
|
+
_e as NiceOAuthButtons,
|
|
1039
|
+
Z as NicePasswordStrength,
|
|
1040
|
+
le as NiceRegistrationForm,
|
|
1041
|
+
ye as NiceTokenManagement,
|
|
1042
|
+
de as NiceTwoFaSetup,
|
|
1043
|
+
J as calcPasswordStrength,
|
|
1044
|
+
ve as useAuth
|
|
808
1045
|
};
|
|
809
1046
|
//# sourceMappingURL=index.mjs.map
|