@nice2dev/auth 1.0.11 → 1.0.12
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.map +1 -1
- package/dist/NicePasswordStrength.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +125 -115
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useState as _, useCallback as x, forwardRef as E, useMemo as
|
|
2
|
-
import { jsxs as
|
|
1
|
+
import { useState as _, useCallback as x, forwardRef as E, useMemo as V } from "react";
|
|
2
|
+
import { jsxs as n, jsx as e, Fragment as q } from "react/jsx-runtime";
|
|
3
3
|
function X(a = {}) {
|
|
4
|
-
const { onLogin:
|
|
4
|
+
const { onLogin: t, onRefresh: o, onLogout: d, storageKey: u = "nice_auth", persistAuth: f = !1 } = a, [r, m] = _(() => {
|
|
5
5
|
if (f && typeof window < "u")
|
|
6
6
|
try {
|
|
7
7
|
const s = localStorage.getItem(u);
|
|
@@ -25,8 +25,8 @@ function X(a = {}) {
|
|
|
25
25
|
async (s, h) => {
|
|
26
26
|
c({ loading: !0, error: null });
|
|
27
27
|
try {
|
|
28
|
-
if (
|
|
29
|
-
const p = await
|
|
28
|
+
if (t) {
|
|
29
|
+
const p = await t(s, h);
|
|
30
30
|
return c({
|
|
31
31
|
isAuthenticated: !0,
|
|
32
32
|
user: p.user,
|
|
@@ -42,7 +42,7 @@ function X(a = {}) {
|
|
|
42
42
|
}), !1;
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
[
|
|
45
|
+
[t, c]
|
|
46
46
|
), i = x(() => {
|
|
47
47
|
d == null || d(), c({ isAuthenticated: !1, user: null, tokens: null, loading: !1, error: null });
|
|
48
48
|
}, [d, c]), k = x(async () => {
|
|
@@ -83,7 +83,7 @@ function X(a = {}) {
|
|
|
83
83
|
const j = E(
|
|
84
84
|
({
|
|
85
85
|
onSubmit: a,
|
|
86
|
-
loading:
|
|
86
|
+
loading: t = !1,
|
|
87
87
|
error: o,
|
|
88
88
|
showRememberMe: d = !0,
|
|
89
89
|
showForgotPassword: u = !0,
|
|
@@ -101,7 +101,7 @@ const j = E(
|
|
|
101
101
|
tracelessPolicy: s,
|
|
102
102
|
privacyMessage: h
|
|
103
103
|
}, p) => {
|
|
104
|
-
const [$, g] = _(""), [S, y] = _(""), [T, R] = _(!1), L =
|
|
104
|
+
const [$, g] = _(""), [S, y] = _(""), [T, R] = _(!1), L = V(() => !(!d || s && !s.cookiesAllowed), [d, s]), P = x(
|
|
105
105
|
(F) => {
|
|
106
106
|
F.preventDefault();
|
|
107
107
|
const D = (s == null ? void 0 : s.cookiesAllowed) === !1 ? !1 : T;
|
|
@@ -109,7 +109,7 @@ const j = E(
|
|
|
109
109
|
},
|
|
110
110
|
[$, S, T, a, s]
|
|
111
111
|
);
|
|
112
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ n(
|
|
113
113
|
"form",
|
|
114
114
|
{
|
|
115
115
|
ref: p,
|
|
@@ -121,7 +121,7 @@ const j = E(
|
|
|
121
121
|
i && /* @__PURE__ */ e("div", { className: "nice-login-form__logo", children: i }),
|
|
122
122
|
/* @__PURE__ */ e("h2", { className: "nice-login-form__title", children: c }),
|
|
123
123
|
o && /* @__PURE__ */ e("div", { className: "nice-login-form__error", role: "alert", children: o }),
|
|
124
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ n("div", { className: "nice-login-form__field", children: [
|
|
125
125
|
/* @__PURE__ */ e("label", { htmlFor: "nice-login-email", children: w }),
|
|
126
126
|
/* @__PURE__ */ e(
|
|
127
127
|
"input",
|
|
@@ -133,11 +133,11 @@ const j = E(
|
|
|
133
133
|
onChange: (F) => g(F.target.value),
|
|
134
134
|
autoComplete: "email",
|
|
135
135
|
required: !0,
|
|
136
|
-
disabled:
|
|
136
|
+
disabled: t
|
|
137
137
|
}
|
|
138
138
|
)
|
|
139
139
|
] }),
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ n("div", { className: "nice-login-form__field", children: [
|
|
141
141
|
/* @__PURE__ */ e("label", { htmlFor: "nice-login-password", children: A }),
|
|
142
142
|
/* @__PURE__ */ e(
|
|
143
143
|
"input",
|
|
@@ -149,19 +149,19 @@ const j = E(
|
|
|
149
149
|
onChange: (F) => y(F.target.value),
|
|
150
150
|
autoComplete: "current-password",
|
|
151
151
|
required: !0,
|
|
152
|
-
disabled:
|
|
152
|
+
disabled: t
|
|
153
153
|
}
|
|
154
154
|
)
|
|
155
155
|
] }),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
L && /* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ n("div", { className: "nice-login-form__options", children: [
|
|
157
|
+
L && /* @__PURE__ */ n("label", { className: "nice-login-form__remember", children: [
|
|
158
158
|
/* @__PURE__ */ e(
|
|
159
159
|
"input",
|
|
160
160
|
{
|
|
161
161
|
type: "checkbox",
|
|
162
162
|
checked: T,
|
|
163
163
|
onChange: (F) => R(F.target.checked),
|
|
164
|
-
disabled:
|
|
164
|
+
disabled: t
|
|
165
165
|
}
|
|
166
166
|
),
|
|
167
167
|
/* @__PURE__ */ e("span", { children: "Remember me" })
|
|
@@ -173,7 +173,7 @@ const j = E(
|
|
|
173
173
|
type: "button",
|
|
174
174
|
className: "nice-login-form__forgot",
|
|
175
175
|
onClick: f,
|
|
176
|
-
disabled:
|
|
176
|
+
disabled: t,
|
|
177
177
|
children: "Forgot password?"
|
|
178
178
|
}
|
|
179
179
|
)
|
|
@@ -183,13 +183,13 @@ const j = E(
|
|
|
183
183
|
{
|
|
184
184
|
type: "submit",
|
|
185
185
|
className: "nice-btn nice-btn--primary nice-login-form__submit",
|
|
186
|
-
disabled:
|
|
187
|
-
children:
|
|
186
|
+
disabled: t || !$ || !S,
|
|
187
|
+
children: t ? "…" : v
|
|
188
188
|
}
|
|
189
189
|
),
|
|
190
|
-
r && /* @__PURE__ */
|
|
190
|
+
r && /* @__PURE__ */ n("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: m, disabled:
|
|
192
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: m, disabled: t, children: "Register" })
|
|
193
193
|
] }),
|
|
194
194
|
k && /* @__PURE__ */ e("div", { className: "nice-login-form__footer", children: k })
|
|
195
195
|
]
|
|
@@ -214,13 +214,13 @@ const B = {
|
|
|
214
214
|
function I(a) {
|
|
215
215
|
if (!a)
|
|
216
216
|
return 0;
|
|
217
|
-
let
|
|
218
|
-
return a.length >= 8 &&
|
|
217
|
+
let t = 0;
|
|
218
|
+
return a.length >= 8 && t++, a.length >= 12 && t++, /[a-z]/.test(a) && /[A-Z]/.test(a) && t++, /\d/.test(a) && t++, /[^a-zA-Z0-9]/.test(a) && t++, Math.min(4, t);
|
|
219
219
|
}
|
|
220
220
|
const M = E(
|
|
221
|
-
({ password: a, strength:
|
|
222
|
-
const r =
|
|
223
|
-
return /* @__PURE__ */
|
|
221
|
+
({ password: a, strength: t, showLabel: o = !0, labels: d = B, className: u }, f) => {
|
|
222
|
+
const r = t ?? I(a), m = G[r], c = (r + 1) / 5 * 100;
|
|
223
|
+
return /* @__PURE__ */ n("div", { ref: f, className: `nice-password-strength${u ? ` ${u}` : ""}`, children: [
|
|
224
224
|
/* @__PURE__ */ e("div", { className: "nice-password-strength__bar", children: /* @__PURE__ */ e(
|
|
225
225
|
"div",
|
|
226
226
|
{
|
|
@@ -236,7 +236,7 @@ M.displayName = "NicePasswordStrength";
|
|
|
236
236
|
const Q = E(
|
|
237
237
|
({
|
|
238
238
|
onSubmit: a,
|
|
239
|
-
loading:
|
|
239
|
+
loading: t = !1,
|
|
240
240
|
error: o,
|
|
241
241
|
onLoginClick: d,
|
|
242
242
|
showPasswordStrength: u = !0,
|
|
@@ -249,13 +249,13 @@ const Q = E(
|
|
|
249
249
|
className: k,
|
|
250
250
|
style: b
|
|
251
251
|
}, C) => {
|
|
252
|
-
const [w, A] = _(""), [s, h] = _(""), [p, $] = _(""), [g, S] = _(""), [y, T] = _(""), [R, L] = _(!1), P = I(g), F = g === y, D = w && p && g && F && R && P >= f && !
|
|
252
|
+
const [w, A] = _(""), [s, h] = _(""), [p, $] = _(""), [g, S] = _(""), [y, T] = _(""), [R, L] = _(!1), P = I(g), F = g === y, D = w && p && g && F && R && P >= f && !t, l = x(
|
|
253
253
|
(N) => {
|
|
254
254
|
N.preventDefault(), D && (a == null || a({ firstName: w, lastName: s, email: p, password: g, acceptTerms: R }));
|
|
255
255
|
},
|
|
256
256
|
[D, w, s, p, g, R, a]
|
|
257
257
|
);
|
|
258
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ n(
|
|
259
259
|
"form",
|
|
260
260
|
{
|
|
261
261
|
ref: C,
|
|
@@ -267,8 +267,8 @@ const Q = E(
|
|
|
267
267
|
v && /* @__PURE__ */ e("div", { className: "nice-register-form__logo", children: v }),
|
|
268
268
|
/* @__PURE__ */ e("h2", { className: "nice-register-form__title", children: c }),
|
|
269
269
|
o && /* @__PURE__ */ e("div", { className: "nice-register-form__error", role: "alert", children: o }),
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ n("div", { className: "nice-register-form__row", children: [
|
|
271
|
+
/* @__PURE__ */ n("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",
|
|
@@ -279,12 +279,12 @@ const Q = E(
|
|
|
279
279
|
value: w,
|
|
280
280
|
onChange: (N) => A(N.target.value),
|
|
281
281
|
required: !0,
|
|
282
|
-
disabled:
|
|
282
|
+
disabled: t,
|
|
283
283
|
autoComplete: "given-name"
|
|
284
284
|
}
|
|
285
285
|
)
|
|
286
286
|
] }),
|
|
287
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ n("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",
|
|
@@ -294,13 +294,13 @@ const Q = E(
|
|
|
294
294
|
type: "text",
|
|
295
295
|
value: s,
|
|
296
296
|
onChange: (N) => h(N.target.value),
|
|
297
|
-
disabled:
|
|
297
|
+
disabled: t,
|
|
298
298
|
autoComplete: "family-name"
|
|
299
299
|
}
|
|
300
300
|
)
|
|
301
301
|
] })
|
|
302
302
|
] }),
|
|
303
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ n("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",
|
|
@@ -311,12 +311,12 @@ const Q = E(
|
|
|
311
311
|
value: p,
|
|
312
312
|
onChange: (N) => $(N.target.value),
|
|
313
313
|
required: !0,
|
|
314
|
-
disabled:
|
|
314
|
+
disabled: t,
|
|
315
315
|
autoComplete: "email"
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
] }),
|
|
319
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ n("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",
|
|
@@ -327,13 +327,13 @@ const Q = E(
|
|
|
327
327
|
value: g,
|
|
328
328
|
onChange: (N) => S(N.target.value),
|
|
329
329
|
required: !0,
|
|
330
|
-
disabled:
|
|
330
|
+
disabled: t,
|
|
331
331
|
autoComplete: "new-password"
|
|
332
332
|
}
|
|
333
333
|
),
|
|
334
334
|
u && g.length > 0 && /* @__PURE__ */ e(M, { password: g })
|
|
335
335
|
] }),
|
|
336
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ n("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",
|
|
@@ -344,27 +344,27 @@ const Q = E(
|
|
|
344
344
|
value: y,
|
|
345
345
|
onChange: (N) => T(N.target.value),
|
|
346
346
|
required: !0,
|
|
347
|
-
disabled:
|
|
347
|
+
disabled: t,
|
|
348
348
|
autoComplete: "new-password"
|
|
349
349
|
}
|
|
350
350
|
),
|
|
351
351
|
y && !F && /* @__PURE__ */ e("span", { className: "nice-error-text", children: "Passwords do not match" })
|
|
352
352
|
] }),
|
|
353
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ n("label", { className: "nice-register-form__terms", children: [
|
|
354
354
|
/* @__PURE__ */ e(
|
|
355
355
|
"input",
|
|
356
356
|
{
|
|
357
357
|
type: "checkbox",
|
|
358
358
|
checked: R,
|
|
359
359
|
onChange: (N) => L(N.target.checked),
|
|
360
|
-
disabled:
|
|
360
|
+
disabled: t
|
|
361
361
|
}
|
|
362
362
|
),
|
|
363
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ n("span", { children: [
|
|
364
364
|
"I accept the",
|
|
365
365
|
" ",
|
|
366
366
|
r ? /* @__PURE__ */ e("a", { href: r, target: "_blank", rel: "noopener noreferrer", children: "Terms" }) : "Terms",
|
|
367
|
-
m && /* @__PURE__ */
|
|
367
|
+
m && /* @__PURE__ */ n(q, { children: [
|
|
368
368
|
" ",
|
|
369
369
|
"and",
|
|
370
370
|
" ",
|
|
@@ -379,10 +379,10 @@ const Q = E(
|
|
|
379
379
|
type: "submit",
|
|
380
380
|
className: "nice-btn nice-btn--primary nice-register-form__submit",
|
|
381
381
|
disabled: !D,
|
|
382
|
-
children:
|
|
382
|
+
children: t ? "…" : "Register"
|
|
383
383
|
}
|
|
384
384
|
),
|
|
385
|
-
d && /* @__PURE__ */
|
|
385
|
+
d && /* @__PURE__ */ n("div", { className: "nice-register-form__login", children: [
|
|
386
386
|
/* @__PURE__ */ e("span", { children: "Already have an account? " }),
|
|
387
387
|
/* @__PURE__ */ e("button", { type: "button", onClick: d, children: "Sign in" })
|
|
388
388
|
] }),
|
|
@@ -396,7 +396,7 @@ Q.displayName = "NiceRegistrationForm";
|
|
|
396
396
|
const z = E(
|
|
397
397
|
({
|
|
398
398
|
requireCurrentPassword: a = !0,
|
|
399
|
-
onSubmit:
|
|
399
|
+
onSubmit: t,
|
|
400
400
|
loading: o = !1,
|
|
401
401
|
error: d,
|
|
402
402
|
success: u,
|
|
@@ -407,14 +407,14 @@ const z = E(
|
|
|
407
407
|
}, v) => {
|
|
408
408
|
const [i, k] = _(""), [b, C] = _(""), [w, A] = _(""), s = I(b), h = b === w, p = (!a || i.length > 0) && b.length > 0 && h && s >= f && !o, $ = x(
|
|
409
409
|
(g) => {
|
|
410
|
-
g.preventDefault(), p && (
|
|
410
|
+
g.preventDefault(), p && (t == null || t({
|
|
411
411
|
currentPassword: a ? i : void 0,
|
|
412
412
|
newPassword: b
|
|
413
413
|
}));
|
|
414
414
|
},
|
|
415
|
-
[p, i, b, a,
|
|
415
|
+
[p, i, b, a, t]
|
|
416
416
|
);
|
|
417
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ n(
|
|
418
418
|
"form",
|
|
419
419
|
{
|
|
420
420
|
ref: v,
|
|
@@ -426,7 +426,7 @@ const z = E(
|
|
|
426
426
|
/* @__PURE__ */ e("h3", { className: "nice-change-password__title", children: r }),
|
|
427
427
|
d && /* @__PURE__ */ e("div", { className: "nice-change-password__error", role: "alert", children: d }),
|
|
428
428
|
u && /* @__PURE__ */ e("div", { className: "nice-change-password__success", role: "status", children: u }),
|
|
429
|
-
a && /* @__PURE__ */
|
|
429
|
+
a && /* @__PURE__ */ n("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",
|
|
@@ -442,7 +442,7 @@ const z = E(
|
|
|
442
442
|
}
|
|
443
443
|
)
|
|
444
444
|
] }),
|
|
445
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ n("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",
|
|
@@ -459,7 +459,7 @@ const z = E(
|
|
|
459
459
|
),
|
|
460
460
|
b.length > 0 && /* @__PURE__ */ e(M, { password: b })
|
|
461
461
|
] }),
|
|
462
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ n("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",
|
|
@@ -485,7 +485,7 @@ const z = E(
|
|
|
485
485
|
z.displayName = "NiceChangePassword";
|
|
486
486
|
const J = E(({
|
|
487
487
|
secret: a,
|
|
488
|
-
qrCodeUrl:
|
|
488
|
+
qrCodeUrl: t,
|
|
489
489
|
issuer: o,
|
|
490
490
|
accountName: d,
|
|
491
491
|
onVerify: u,
|
|
@@ -501,21 +501,21 @@ const J = E(({
|
|
|
501
501
|
const [w, A] = _(""), [s, h] = _(!1), [p, $] = _(!1), g = x((y) => {
|
|
502
502
|
y.preventDefault(), w.length >= 6 && (u == null || u(w));
|
|
503
503
|
}, [w, u]), S = `otpauth://totp/${o ? `${o}:` : ""}${d ?? "user"}?secret=${a}${o ? `&issuer=${o}` : ""}&digits=6&period=30`;
|
|
504
|
-
return /* @__PURE__ */
|
|
504
|
+
return /* @__PURE__ */ n("div", { ref: C, className: `nice-2fa-setup${k ? ` ${k}` : ""}`, style: b, children: [
|
|
505
505
|
/* @__PURE__ */ e("h3", { className: "nice-2fa-setup__title", children: "Two-Factor Authentication" }),
|
|
506
|
-
v === "setup" && /* @__PURE__ */
|
|
506
|
+
v === "setup" && /* @__PURE__ */ n("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
|
-
|
|
508
|
+
t ? /* @__PURE__ */ e("img", { src: t, alt: "2FA QR Code", className: "nice-2fa-setup__qr" }) : /* @__PURE__ */ n("div", { className: "nice-2fa-setup__qr-placeholder", children: [
|
|
509
509
|
/* @__PURE__ */ e("span", { children: "QR Code" }),
|
|
510
510
|
/* @__PURE__ */ e("code", { className: "nice-2fa-setup__uri", children: S })
|
|
511
511
|
] }),
|
|
512
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ n("div", { className: "nice-2fa-setup__secret", children: [
|
|
513
513
|
/* @__PURE__ */ e("span", { children: "Or enter manually: " }),
|
|
514
514
|
s ? /* @__PURE__ */ e("code", { className: "nice-2fa-setup__secret-key", children: a }) : /* @__PURE__ */ e("button", { type: "button", onClick: () => h(!0), children: "Show secret key" })
|
|
515
515
|
] }),
|
|
516
516
|
/* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: () => i == null ? void 0 : i("verify"), children: "Next — Verify" })
|
|
517
517
|
] }),
|
|
518
|
-
v === "verify" && /* @__PURE__ */
|
|
518
|
+
v === "verify" && /* @__PURE__ */ n("form", { className: "nice-2fa-setup__step", onSubmit: g, children: [
|
|
519
519
|
/* @__PURE__ */ e("p", { className: "nice-2fa-setup__instruction", children: "Enter the 6-digit code from your authenticator app:" }),
|
|
520
520
|
r && /* @__PURE__ */ e("div", { className: "nice-2fa-setup__error", role: "alert", children: r }),
|
|
521
521
|
/* @__PURE__ */ e(
|
|
@@ -533,12 +533,12 @@ const J = E(({
|
|
|
533
533
|
autoComplete: "one-time-code"
|
|
534
534
|
}
|
|
535
535
|
),
|
|
536
|
-
/* @__PURE__ */
|
|
536
|
+
/* @__PURE__ */ n("div", { className: "nice-2fa-setup__actions", children: [
|
|
537
537
|
/* @__PURE__ */ e("button", { type: "button", className: "nice-btn", onClick: () => i == null ? void 0 : i("setup"), children: "Back" }),
|
|
538
538
|
/* @__PURE__ */ e("button", { type: "submit", className: "nice-btn nice-btn--primary", disabled: f || w.length < 6, children: f ? "…" : "Verify" })
|
|
539
539
|
] })
|
|
540
540
|
] }),
|
|
541
|
-
v === "recovery" && c && /* @__PURE__ */
|
|
541
|
+
v === "recovery" && c && /* @__PURE__ */ n("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
543
|
/* @__PURE__ */ e("div", { className: "nice-2fa-setup__recovery-codes", children: c.map((y, T) => /* @__PURE__ */ e("code", { className: "nice-2fa-setup__recovery-code", children: y }, T)) }),
|
|
544
544
|
/* @__PURE__ */ e(
|
|
@@ -560,40 +560,50 @@ const J = E(({
|
|
|
560
560
|
] });
|
|
561
561
|
});
|
|
562
562
|
J.displayName = "NiceTwoFaSetup";
|
|
563
|
-
const K = E(
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
"
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
563
|
+
const K = E(
|
|
564
|
+
({
|
|
565
|
+
provider: a = "custom",
|
|
566
|
+
siteKey: t,
|
|
567
|
+
onVerify: o,
|
|
568
|
+
onExpire: d,
|
|
569
|
+
onError: u,
|
|
570
|
+
theme: f = "light",
|
|
571
|
+
size: r = "normal",
|
|
572
|
+
customRender: m,
|
|
573
|
+
className: c,
|
|
574
|
+
style: v
|
|
575
|
+
}, i) => a === "custom" && m ? /* @__PURE__ */ e(
|
|
576
|
+
"div",
|
|
577
|
+
{
|
|
578
|
+
ref: i,
|
|
579
|
+
className: `nice-captcha nice-captcha--custom${c ? ` ${c}` : ""}`,
|
|
580
|
+
style: v,
|
|
581
|
+
children: m
|
|
582
|
+
}
|
|
583
|
+
) : /* @__PURE__ */ e(
|
|
584
|
+
"div",
|
|
585
|
+
{
|
|
586
|
+
ref: i,
|
|
587
|
+
className: `nice-captcha nice-captcha--${a} nice-captcha--${f}${r === "compact" ? " nice-captcha--compact" : ""}${c ? ` ${c}` : ""}`,
|
|
588
|
+
style: v,
|
|
589
|
+
"data-sitekey": t,
|
|
590
|
+
"data-theme": f,
|
|
591
|
+
"data-size": r,
|
|
592
|
+
children: /* @__PURE__ */ n("div", { className: "nice-captcha__placeholder", children: [
|
|
593
|
+
/* @__PURE__ */ n("span", { children: [
|
|
594
|
+
"🔒 Captcha (",
|
|
595
|
+
a,
|
|
596
|
+
")"
|
|
597
|
+
] }),
|
|
598
|
+
/* @__PURE__ */ n("p", { children: [
|
|
599
|
+
"Load the ",
|
|
600
|
+
a,
|
|
601
|
+
" SDK to activate verification."
|
|
602
|
+
] })
|
|
593
603
|
] })
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
)
|
|
604
|
+
}
|
|
605
|
+
)
|
|
606
|
+
);
|
|
597
607
|
K.displayName = "NiceCaptcha";
|
|
598
608
|
const U = [
|
|
599
609
|
{ id: "google", label: "Google", icon: "🔵", color: "#4285f4", textColor: "#fff" },
|
|
@@ -603,7 +613,7 @@ const U = [
|
|
|
603
613
|
{ id: "github", label: "GitHub", icon: "🐙", color: "#24292e", textColor: "#fff" }
|
|
604
614
|
], Z = E(({
|
|
605
615
|
providers: a = U,
|
|
606
|
-
onProviderClick:
|
|
616
|
+
onProviderClick: t,
|
|
607
617
|
disabled: o = !1,
|
|
608
618
|
loadingProvider: d,
|
|
609
619
|
direction: u = "vertical",
|
|
@@ -611,25 +621,25 @@ const U = [
|
|
|
611
621
|
showSeparator: r = !0,
|
|
612
622
|
className: m,
|
|
613
623
|
style: c
|
|
614
|
-
}, v) => /* @__PURE__ */
|
|
624
|
+
}, v) => /* @__PURE__ */ n(
|
|
615
625
|
"div",
|
|
616
626
|
{
|
|
617
627
|
ref: v,
|
|
618
628
|
className: `nice-oauth nice-oauth--${u}${m ? ` ${m}` : ""}`,
|
|
619
629
|
style: c,
|
|
620
630
|
children: [
|
|
621
|
-
r && /* @__PURE__ */
|
|
631
|
+
r && /* @__PURE__ */ n("div", { className: "nice-oauth__separator", children: [
|
|
622
632
|
/* @__PURE__ */ e("hr", {}),
|
|
623
633
|
/* @__PURE__ */ e("span", { children: f }),
|
|
624
634
|
/* @__PURE__ */ e("hr", {})
|
|
625
635
|
] }),
|
|
626
|
-
/* @__PURE__ */ e("div", { className: "nice-oauth__buttons", children: a.map((i) => /* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ e("div", { className: "nice-oauth__buttons", children: a.map((i) => /* @__PURE__ */ n(
|
|
627
637
|
"button",
|
|
628
638
|
{
|
|
629
639
|
type: "button",
|
|
630
640
|
className: `nice-oauth__btn${d === i.id ? " nice-oauth__btn--loading" : ""}`,
|
|
631
641
|
style: { backgroundColor: i.color, color: i.textColor },
|
|
632
|
-
onClick: () =>
|
|
642
|
+
onClick: () => t == null ? void 0 : t(i.id),
|
|
633
643
|
disabled: o || !!d,
|
|
634
644
|
children: [
|
|
635
645
|
i.icon && /* @__PURE__ */ e("span", { className: "nice-oauth__btn-icon", children: i.icon }),
|
|
@@ -643,7 +653,7 @@ const U = [
|
|
|
643
653
|
));
|
|
644
654
|
Z.displayName = "NiceOAuthButtons";
|
|
645
655
|
const Y = E(
|
|
646
|
-
function(
|
|
656
|
+
function(t, o) {
|
|
647
657
|
const {
|
|
648
658
|
tokens: d,
|
|
649
659
|
onCreate: u,
|
|
@@ -653,7 +663,7 @@ const Y = E(
|
|
|
653
663
|
title: c = "API Tokens",
|
|
654
664
|
className: v,
|
|
655
665
|
style: i
|
|
656
|
-
} =
|
|
666
|
+
} = t, [k, b] = _(!1), [C, w] = _(""), [A, s] = _([]), [h, p] = _("90"), [$, g] = _(null), [S, y] = _(!1), [T, R] = _(null), L = x(async () => {
|
|
657
667
|
if (!(!u || !C.trim())) {
|
|
658
668
|
y(!0);
|
|
659
669
|
try {
|
|
@@ -680,8 +690,8 @@ const Y = E(
|
|
|
680
690
|
(N) => N.includes(l) ? N.filter((O) => O !== l) : [...N, l]
|
|
681
691
|
);
|
|
682
692
|
}, D = d.length < m;
|
|
683
|
-
return /* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ n("div", { ref: o, className: `nice-token-management ${v ?? ""}`, style: i, children: [
|
|
694
|
+
/* @__PURE__ */ n("div", { className: "nice-token-management__header", children: [
|
|
685
695
|
/* @__PURE__ */ e("h3", { children: c }),
|
|
686
696
|
D && /* @__PURE__ */ e(
|
|
687
697
|
"button",
|
|
@@ -693,16 +703,16 @@ const Y = E(
|
|
|
693
703
|
}
|
|
694
704
|
)
|
|
695
705
|
] }),
|
|
696
|
-
$ && /* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
706
|
+
$ && /* @__PURE__ */ n("div", { className: "nice-token-management__reveal", children: [
|
|
707
|
+
/* @__PURE__ */ n("p", { children: [
|
|
698
708
|
/* @__PURE__ */ e("strong", { children: "New token created!" }),
|
|
699
709
|
" Copy it now — it won't be shown again."
|
|
700
710
|
] }),
|
|
701
711
|
/* @__PURE__ */ e("code", { className: "nice-token-management__token-value", children: $ }),
|
|
702
712
|
/* @__PURE__ */ e("button", { onClick: () => g(null), children: "Dismiss" })
|
|
703
713
|
] }),
|
|
704
|
-
k && /* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
714
|
+
k && /* @__PURE__ */ n("div", { className: "nice-token-management__create-form", children: [
|
|
715
|
+
/* @__PURE__ */ n("label", { children: [
|
|
706
716
|
"Name",
|
|
707
717
|
/* @__PURE__ */ e(
|
|
708
718
|
"input",
|
|
@@ -715,9 +725,9 @@ const Y = E(
|
|
|
715
725
|
}
|
|
716
726
|
)
|
|
717
727
|
] }),
|
|
718
|
-
r.length > 0 && /* @__PURE__ */
|
|
728
|
+
r.length > 0 && /* @__PURE__ */ n("fieldset", { children: [
|
|
719
729
|
/* @__PURE__ */ e("legend", { children: "Scopes" }),
|
|
720
|
-
r.map((l) => /* @__PURE__ */
|
|
730
|
+
r.map((l) => /* @__PURE__ */ n("label", { className: "nice-token-management__scope", children: [
|
|
721
731
|
/* @__PURE__ */ e(
|
|
722
732
|
"input",
|
|
723
733
|
{
|
|
@@ -729,7 +739,7 @@ const Y = E(
|
|
|
729
739
|
l
|
|
730
740
|
] }, l))
|
|
731
741
|
] }),
|
|
732
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ n("label", { children: [
|
|
733
743
|
"Expires in (days)",
|
|
734
744
|
/* @__PURE__ */ e(
|
|
735
745
|
"input",
|
|
@@ -742,13 +752,13 @@ const Y = E(
|
|
|
742
752
|
}
|
|
743
753
|
)
|
|
744
754
|
] }),
|
|
745
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ n("div", { className: "nice-token-management__create-actions", children: [
|
|
746
756
|
/* @__PURE__ */ e("button", { onClick: L, disabled: S || !C.trim(), children: S ? "Creating…" : "Create Token" }),
|
|
747
757
|
/* @__PURE__ */ e("button", { onClick: () => b(!1), children: "Cancel" })
|
|
748
758
|
] })
|
|
749
759
|
] }),
|
|
750
|
-
d.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-token-management__empty", children: "No API tokens yet." }) : /* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
760
|
+
d.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-token-management__empty", children: "No API tokens yet." }) : /* @__PURE__ */ n("table", { className: "nice-token-management__table", children: [
|
|
761
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
752
762
|
/* @__PURE__ */ e("th", { children: "Name" }),
|
|
753
763
|
/* @__PURE__ */ e("th", { children: "Prefix" }),
|
|
754
764
|
/* @__PURE__ */ e("th", { children: "Created" }),
|
|
@@ -759,9 +769,9 @@ const Y = E(
|
|
|
759
769
|
] }) }),
|
|
760
770
|
/* @__PURE__ */ e("tbody", { children: d.map((l) => {
|
|
761
771
|
var N;
|
|
762
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ n("tr", { children: [
|
|
763
773
|
/* @__PURE__ */ e("td", { children: l.name }),
|
|
764
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ n("code", { children: [
|
|
765
775
|
l.prefix,
|
|
766
776
|
"…"
|
|
767
777
|
] }) }),
|