@tempots/beatui 1.6.1 → 1.7.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/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/auth-divider-CjcrgXmq.cjs +1 -0
- package/dist/{auth-divider-qnJuYK-x.js → auth-divider-D9KnNeyF.js} +239 -230
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +396 -347
- package/dist/{custom-validation-BetUqAEz.js → custom-validation-7por5nJN.js} +1 -1
- package/dist/{deep-merge-ZVigk5Qf.js → deep-merge-DT2H9AGq.js} +1 -1
- package/dist/{duration-input-GMBmT1BE.js → duration-input-D4V_PHIg.js} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +2325 -2263
- package/dist/json-schema/index.es.js +5 -5
- package/dist/json-structure/index.es.js +3 -3
- package/dist/{notice-B6ojfenv.js → notice-CQGJyZ8o.js} +1 -1
- package/dist/types/better-auth/callbacks.d.ts +4 -4
- package/dist/types/better-auth/components/authenticated.d.ts +27 -2
- package/dist/types/better-auth/components/better-auth-container.d.ts +6 -0
- package/dist/types/better-auth/index.d.ts +2 -1
- package/dist/types/better-auth/provider.d.ts +1 -1
- package/dist/types/better-auth/types.d.ts +22 -0
- package/dist/types/components/auth/auth-email-prop.d.ts +6 -12
- package/dist/types/components/auth/types.d.ts +7 -6
- package/dist/types/components/auth/utils.d.ts +4 -2
- package/dist/types/components/query/index.d.ts +2 -0
- package/dist/types/components/query/query-data-source.d.ts +73 -0
- package/dist/types/components/query/query-data-table.d.ts +62 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/{use-form-NfobsGNl.js → use-form-8NnZ-KHk.js} +9 -9
- package/dist/{widget-customization-BtkexHgm.js → widget-customization-BIBva3f-.js} +2 -2
- package/package.json +1 -1
- package/dist/auth-divider-DewHpITQ.cjs +0 -1
|
@@ -1,62 +1,86 @@
|
|
|
1
|
-
import { prop as b, computedOf as _, makeProviderMark as U, When as
|
|
2
|
-
import { b as
|
|
3
|
-
import { m as
|
|
4
|
-
import { N as
|
|
5
|
-
import { S as
|
|
6
|
-
import { B as
|
|
1
|
+
import { prop as b, computedOf as _, makeProviderMark as E, Task as U, Provide as D, When as k, Empty as O, Unless as B, Use as L, html as i, attr as d, Ensure as v, OneOfValue as M, Fragment as T, NotEmpty as N, ForEach as $, on as P } from "@tempots/dom";
|
|
2
|
+
import { b as V, d as x } from "../auth-divider-D9KnNeyF.js";
|
|
3
|
+
import { m as z } from "../translations-BCMP-h52.js";
|
|
4
|
+
import { N as g, P as j, E as q } from "../notice-CQGJyZ8o.js";
|
|
5
|
+
import { S as C } from "../stack-BLMteGTn.js";
|
|
6
|
+
import { B as y } from "../input-container-8JFB11xN.js";
|
|
7
7
|
import { T as A } from "../text-input-NJypZSnE.js";
|
|
8
8
|
function I(t, e) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (t.error) {
|
|
10
|
+
e.onError?.({
|
|
11
|
+
message: t.error.message,
|
|
12
|
+
status: t.error.status
|
|
13
|
+
});
|
|
14
|
+
const a = t.error;
|
|
15
|
+
if (a.fieldErrors && typeof a.fieldErrors == "object") {
|
|
16
|
+
const s = [];
|
|
17
|
+
for (const [o, c] of Object.entries(
|
|
18
|
+
a.fieldErrors
|
|
19
|
+
))
|
|
20
|
+
typeof c == "string" && s.push({ field: o, message: c });
|
|
21
|
+
if (s.length > 0)
|
|
22
|
+
return s;
|
|
23
|
+
}
|
|
24
|
+
return t.error.message;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
13
27
|
}
|
|
14
|
-
function
|
|
15
|
-
return async (
|
|
16
|
-
const
|
|
17
|
-
email:
|
|
18
|
-
password:
|
|
28
|
+
function H(t, e, a, s) {
|
|
29
|
+
return async (o) => {
|
|
30
|
+
const c = await t.signIn.email({
|
|
31
|
+
email: o.email,
|
|
32
|
+
password: o.password,
|
|
19
33
|
callbackURL: e.callbackURL
|
|
20
|
-
}),
|
|
21
|
-
|
|
34
|
+
}), r = I(c, e);
|
|
35
|
+
if (r) return r;
|
|
36
|
+
if (await a(), s) {
|
|
37
|
+
const f = await t.getSession();
|
|
38
|
+
f.data?.user && s(f.data.user);
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
22
41
|
};
|
|
23
42
|
}
|
|
24
|
-
function
|
|
25
|
-
return async (
|
|
26
|
-
const
|
|
27
|
-
name:
|
|
28
|
-
email:
|
|
29
|
-
password:
|
|
43
|
+
function W(t, e, a, s) {
|
|
44
|
+
return async (o) => {
|
|
45
|
+
const c = await t.signUp.email({
|
|
46
|
+
name: o.name,
|
|
47
|
+
email: o.email,
|
|
48
|
+
password: o.password,
|
|
30
49
|
callbackURL: e.callbackURL
|
|
31
|
-
}),
|
|
32
|
-
|
|
50
|
+
}), r = I(c, e);
|
|
51
|
+
if (r) return r;
|
|
52
|
+
if (await a(), s) {
|
|
53
|
+
const f = await t.getSession();
|
|
54
|
+
f.data?.user && s(f.data.user);
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
33
57
|
};
|
|
34
58
|
}
|
|
35
|
-
function
|
|
59
|
+
function Y(t, e) {
|
|
36
60
|
return async (a) => {
|
|
37
|
-
const
|
|
61
|
+
const s = await t.requestPasswordReset({
|
|
38
62
|
email: a.email,
|
|
39
63
|
redirectTo: e.callbackURL
|
|
40
64
|
});
|
|
41
|
-
return I(
|
|
65
|
+
return I(s, e);
|
|
42
66
|
};
|
|
43
67
|
}
|
|
44
|
-
function
|
|
68
|
+
function G(t, e) {
|
|
45
69
|
return async (a) => {
|
|
46
|
-
const
|
|
70
|
+
const s = await t.signIn.social({
|
|
47
71
|
provider: a,
|
|
48
72
|
callbackURL: e.callbackURL,
|
|
49
73
|
errorCallbackURL: e.errorCallbackURL
|
|
50
74
|
});
|
|
51
|
-
I(
|
|
75
|
+
I(s, e);
|
|
52
76
|
};
|
|
53
77
|
}
|
|
54
|
-
function
|
|
55
|
-
const a = b(null),
|
|
78
|
+
function J(t, e = {}) {
|
|
79
|
+
const a = b(null), s = b(!0), o = _(a)(
|
|
56
80
|
(w) => w?.user ?? null
|
|
57
|
-
),
|
|
58
|
-
let
|
|
59
|
-
async function
|
|
81
|
+
), c = _(a)((w) => w != null);
|
|
82
|
+
let r;
|
|
83
|
+
async function f() {
|
|
60
84
|
try {
|
|
61
85
|
const w = await t.getSession();
|
|
62
86
|
w.error || !w.data ? a.set(null) : a.set({
|
|
@@ -66,26 +90,36 @@ function W(t, e = {}) {
|
|
|
66
90
|
} catch {
|
|
67
91
|
a.set(null);
|
|
68
92
|
} finally {
|
|
69
|
-
|
|
93
|
+
s.set(!1);
|
|
70
94
|
}
|
|
71
95
|
}
|
|
72
|
-
e.onSessionChange && a.on(e.onSessionChange),
|
|
73
|
-
function
|
|
74
|
-
|
|
96
|
+
e.onSessionChange && a.on(e.onSessionChange), f(), e.refreshInterval && e.refreshInterval > 0 && (r = setInterval(f, e.refreshInterval));
|
|
97
|
+
function m() {
|
|
98
|
+
r != null && (clearInterval(r), r = void 0), a.dispose(), s.dispose(), o.dispose(), c.dispose();
|
|
75
99
|
}
|
|
76
|
-
return { session: a, isPending:
|
|
100
|
+
return { session: a, isPending: s, user: o, isAuthenticated: c, refresh: f, dispose: m };
|
|
77
101
|
}
|
|
78
|
-
function
|
|
102
|
+
function K(t) {
|
|
79
103
|
return t.map((e) => ({
|
|
80
104
|
provider: e
|
|
81
105
|
}));
|
|
82
106
|
}
|
|
83
|
-
function
|
|
84
|
-
const a =
|
|
107
|
+
function Q(t, e = {}) {
|
|
108
|
+
const a = J(t, {
|
|
85
109
|
refreshInterval: e.refreshInterval,
|
|
86
110
|
onSessionChange: e.onSessionChange
|
|
87
|
-
}),
|
|
88
|
-
|
|
111
|
+
}), s = () => a.refresh(), o = H(
|
|
112
|
+
t,
|
|
113
|
+
e,
|
|
114
|
+
s,
|
|
115
|
+
e.onAuthSuccess
|
|
116
|
+
), c = W(
|
|
117
|
+
t,
|
|
118
|
+
e,
|
|
119
|
+
s,
|
|
120
|
+
e.onAuthSuccess
|
|
121
|
+
), r = Y(t, e), f = G(t, e), m = e.socialProviders ? K(e.socialProviders) : [], w = {
|
|
122
|
+
onSignIn: o,
|
|
89
123
|
passwordRules: e.passwordRules,
|
|
90
124
|
showRememberMe: e.showRememberMe,
|
|
91
125
|
labels: e.labels ? {
|
|
@@ -96,8 +130,8 @@ function G(t, e = {}) {
|
|
|
96
130
|
forgotPasswordLink: e.labels.forgotPasswordLink,
|
|
97
131
|
noAccountLink: e.labels.noAccountLink
|
|
98
132
|
} : void 0
|
|
99
|
-
},
|
|
100
|
-
onSignUp:
|
|
133
|
+
}, u = {
|
|
134
|
+
onSignUp: c,
|
|
101
135
|
passwordRules: e.passwordRules,
|
|
102
136
|
showPasswordStrength: e.showPasswordStrength,
|
|
103
137
|
showNameField: e.showNameField,
|
|
@@ -114,20 +148,20 @@ function G(t, e = {}) {
|
|
|
114
148
|
hasAccountLink: e.labels.hasAccountLink
|
|
115
149
|
} : void 0
|
|
116
150
|
}, p = {
|
|
117
|
-
onResetPassword:
|
|
151
|
+
onResetPassword: r,
|
|
118
152
|
labels: e.labels ? {
|
|
119
153
|
resetPasswordButton: e.labels.resetPasswordButton,
|
|
120
154
|
resetPasswordDescription: e.labels.resetPasswordDescription,
|
|
121
155
|
emailLabel: e.labels.emailLabel,
|
|
122
156
|
backToSignInLink: e.labels.backToSignInLink
|
|
123
157
|
} : void 0
|
|
124
|
-
},
|
|
125
|
-
onSignIn:
|
|
126
|
-
onSignUp:
|
|
127
|
-
onResetPassword:
|
|
128
|
-
onSocialLogin:
|
|
129
|
-
socialProviders:
|
|
130
|
-
showSocialDivider:
|
|
158
|
+
}, l = {
|
|
159
|
+
onSignIn: o,
|
|
160
|
+
onSignUp: c,
|
|
161
|
+
onResetPassword: r,
|
|
162
|
+
onSocialLogin: f,
|
|
163
|
+
socialProviders: m.length > 0 ? m : void 0,
|
|
164
|
+
showSocialDivider: m.length > 0,
|
|
131
165
|
passwordRules: e.passwordRules,
|
|
132
166
|
showRememberMe: e.showRememberMe,
|
|
133
167
|
showPasswordStrength: e.showPasswordStrength,
|
|
@@ -137,8 +171,8 @@ function G(t, e = {}) {
|
|
|
137
171
|
termsAndConditions: e.termsAndConditions,
|
|
138
172
|
labels: e.labels
|
|
139
173
|
};
|
|
140
|
-
async function
|
|
141
|
-
await t.signOut(), await
|
|
174
|
+
async function n() {
|
|
175
|
+
await t.signOut(), await s();
|
|
142
176
|
}
|
|
143
177
|
function h() {
|
|
144
178
|
a.dispose();
|
|
@@ -148,43 +182,58 @@ function G(t, e = {}) {
|
|
|
148
182
|
isPending: a.isPending,
|
|
149
183
|
user: a.user,
|
|
150
184
|
isAuthenticated: a.isAuthenticated,
|
|
151
|
-
containerOptions:
|
|
185
|
+
containerOptions: l,
|
|
152
186
|
signInOptions: w,
|
|
153
|
-
signUpOptions:
|
|
187
|
+
signUpOptions: u,
|
|
154
188
|
resetOptions: p,
|
|
155
|
-
socialProviders:
|
|
156
|
-
signOut:
|
|
157
|
-
refreshSession:
|
|
189
|
+
socialProviders: m,
|
|
190
|
+
signOut: n,
|
|
191
|
+
refreshSession: s,
|
|
158
192
|
dispose: h
|
|
159
193
|
};
|
|
160
194
|
}
|
|
161
|
-
const
|
|
162
|
-
mark:
|
|
195
|
+
const ie = {
|
|
196
|
+
mark: E("BetterAuth"),
|
|
163
197
|
create: (t) => {
|
|
164
198
|
if (!t)
|
|
165
199
|
throw new Error("BetterAuth provider requires a client option");
|
|
166
|
-
const e =
|
|
200
|
+
const e = Q(t.client, t);
|
|
167
201
|
return {
|
|
168
202
|
value: e,
|
|
169
203
|
dispose: () => e.dispose()
|
|
170
204
|
};
|
|
171
205
|
}
|
|
172
206
|
};
|
|
173
|
-
function
|
|
174
|
-
return
|
|
207
|
+
function ce(t, e, ...a) {
|
|
208
|
+
return U(
|
|
209
|
+
() => import("../translations-5cXBrENb.js").then((s) => s.t),
|
|
210
|
+
({ AuthI18n: s }) => D(
|
|
211
|
+
s,
|
|
212
|
+
{},
|
|
213
|
+
() => V({ ...t.containerOptions, ...e }, ...a)
|
|
214
|
+
)
|
|
215
|
+
);
|
|
175
216
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
178
|
-
(a) => e((
|
|
217
|
+
function le(t, e) {
|
|
218
|
+
return x(
|
|
219
|
+
(a) => e((s) => a({ ...t.containerOptions, ...s }))
|
|
179
220
|
);
|
|
180
221
|
}
|
|
181
|
-
function
|
|
182
|
-
return
|
|
222
|
+
function ue(t, e) {
|
|
223
|
+
return k(
|
|
224
|
+
t.isPending,
|
|
225
|
+
e.loading ?? (() => O),
|
|
226
|
+
() => k(t.isAuthenticated, e.children)
|
|
227
|
+
);
|
|
183
228
|
}
|
|
184
|
-
function
|
|
185
|
-
return
|
|
229
|
+
function de(t, e) {
|
|
230
|
+
return k(
|
|
231
|
+
t.isPending,
|
|
232
|
+
e.loading ?? e.children,
|
|
233
|
+
() => B(t.isAuthenticated, e.children)
|
|
234
|
+
);
|
|
186
235
|
}
|
|
187
|
-
const
|
|
236
|
+
const X = {
|
|
188
237
|
// Two-Factor Authentication
|
|
189
238
|
twoFactorSetupDescription: "Enter your password to enable two-factor authentication.",
|
|
190
239
|
twoFactorEnableButton: "Enable 2FA",
|
|
@@ -224,478 +273,478 @@ const J = {
|
|
|
224
273
|
passkeyCancelButton: "Cancel",
|
|
225
274
|
passkeyNamePlaceholder: "Passkey name (optional)",
|
|
226
275
|
passkeyUnnamed: "Unnamed passkey"
|
|
227
|
-
}, F =
|
|
228
|
-
defaultLocale:
|
|
276
|
+
}, F = X, R = "en", Z = /* @__PURE__ */ Object.assign({}), S = z({
|
|
277
|
+
defaultLocale: R,
|
|
229
278
|
defaultMessages: F,
|
|
230
279
|
localeLoader: async (t) => {
|
|
231
|
-
if (t ===
|
|
232
|
-
const e =
|
|
280
|
+
if (t === R) return F;
|
|
281
|
+
const e = Z[`./locales/${t}.ts`];
|
|
233
282
|
return e ? await e() : F;
|
|
234
283
|
},
|
|
235
284
|
providerName: "BetterAuthI18n"
|
|
236
285
|
});
|
|
237
|
-
function
|
|
286
|
+
function fe({
|
|
238
287
|
twoFactor: t,
|
|
239
288
|
issuer: e,
|
|
240
289
|
onComplete: a
|
|
241
290
|
}) {
|
|
242
|
-
const
|
|
243
|
-
async function
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
password:
|
|
291
|
+
const s = b(""), o = b(null), c = b([]), r = b(""), f = b(null), m = b(!1), w = b("password");
|
|
292
|
+
async function u(l) {
|
|
293
|
+
l.preventDefault(), m.set(!0), f.set(null);
|
|
294
|
+
const n = await t.enable({
|
|
295
|
+
password: s.value,
|
|
247
296
|
issuer: e
|
|
248
297
|
});
|
|
249
|
-
if (
|
|
250
|
-
|
|
298
|
+
if (m.set(!1), n.error) {
|
|
299
|
+
f.set(n.error.message);
|
|
251
300
|
return;
|
|
252
301
|
}
|
|
253
|
-
|
|
302
|
+
n.data && (o.set(n.data.totpURI), c.set(n.data.backupCodes), w.set("verify"));
|
|
254
303
|
}
|
|
255
|
-
async function p(
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
|
|
304
|
+
async function p(l) {
|
|
305
|
+
l.preventDefault(), m.set(!0), f.set(null);
|
|
306
|
+
const n = await t.verifyTotp({ code: r.value });
|
|
307
|
+
if (m.set(!1), n.error) {
|
|
308
|
+
f.set(n.error.message);
|
|
260
309
|
return;
|
|
261
310
|
}
|
|
262
311
|
w.set("complete"), a?.();
|
|
263
312
|
}
|
|
264
|
-
return
|
|
313
|
+
return L(
|
|
265
314
|
S,
|
|
266
|
-
(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
(
|
|
315
|
+
(l) => i.div(
|
|
316
|
+
d.class("bc-two-factor"),
|
|
317
|
+
v(
|
|
318
|
+
f,
|
|
319
|
+
(n) => g(
|
|
271
320
|
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
272
|
-
|
|
321
|
+
i.div(n)
|
|
273
322
|
)
|
|
274
323
|
),
|
|
275
|
-
|
|
276
|
-
password: () =>
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
324
|
+
M(w, {
|
|
325
|
+
password: () => i.form(
|
|
326
|
+
d.class("bc-two-factor__form"),
|
|
327
|
+
P.submit(u),
|
|
328
|
+
C(
|
|
329
|
+
i.p(
|
|
330
|
+
d.class("bc-auth-form__description"),
|
|
331
|
+
l.$.twoFactorSetupDescription
|
|
283
332
|
),
|
|
284
|
-
|
|
285
|
-
value:
|
|
286
|
-
onChange: (
|
|
287
|
-
placeholder:
|
|
333
|
+
j({
|
|
334
|
+
value: s,
|
|
335
|
+
onChange: (n) => s.set(n),
|
|
336
|
+
placeholder: l.$.passwordPlaceholder
|
|
288
337
|
}),
|
|
289
|
-
|
|
338
|
+
y(
|
|
290
339
|
{
|
|
291
340
|
type: "submit",
|
|
292
341
|
variant: "filled",
|
|
293
342
|
color: "primary",
|
|
294
|
-
loading:
|
|
343
|
+
loading: m
|
|
295
344
|
},
|
|
296
|
-
|
|
297
|
-
|
|
345
|
+
d.class("bc-auth-form__submit"),
|
|
346
|
+
l.$.twoFactorEnableButton
|
|
298
347
|
)
|
|
299
348
|
)
|
|
300
349
|
),
|
|
301
|
-
verify: () =>
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
(
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
350
|
+
verify: () => T(
|
|
351
|
+
v(
|
|
352
|
+
o,
|
|
353
|
+
(n) => i.div(
|
|
354
|
+
d.class("bc-two-factor__totp-uri"),
|
|
355
|
+
i.p(l.$.twoFactorScanDescription),
|
|
356
|
+
i.code(d.class("bc-two-factor__code-display"), n)
|
|
308
357
|
)
|
|
309
358
|
),
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
() =>
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
359
|
+
N(
|
|
360
|
+
c,
|
|
361
|
+
() => i.div(
|
|
362
|
+
d.class("bc-two-factor__backup-codes"),
|
|
363
|
+
i.p(l.$.twoFactorBackupCodesDescription),
|
|
364
|
+
i.ul($(c, (n) => i.li(n)))
|
|
316
365
|
)
|
|
317
366
|
),
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
367
|
+
i.form(
|
|
368
|
+
d.class("bc-two-factor__form"),
|
|
369
|
+
P.submit(p),
|
|
370
|
+
C(
|
|
322
371
|
A({
|
|
323
|
-
value:
|
|
324
|
-
onChange: (
|
|
325
|
-
placeholder:
|
|
372
|
+
value: r,
|
|
373
|
+
onChange: (n) => r.set(n),
|
|
374
|
+
placeholder: l.$.twoFactorCodePlaceholder
|
|
326
375
|
}),
|
|
327
|
-
|
|
376
|
+
y(
|
|
328
377
|
{
|
|
329
378
|
type: "submit",
|
|
330
379
|
variant: "filled",
|
|
331
380
|
color: "primary",
|
|
332
|
-
loading:
|
|
381
|
+
loading: m
|
|
333
382
|
},
|
|
334
|
-
|
|
335
|
-
|
|
383
|
+
d.class("bc-auth-form__submit"),
|
|
384
|
+
l.$.twoFactorVerifyButton
|
|
336
385
|
)
|
|
337
386
|
)
|
|
338
387
|
)
|
|
339
388
|
),
|
|
340
|
-
complete: () =>
|
|
341
|
-
|
|
342
|
-
|
|
389
|
+
complete: () => i.div(
|
|
390
|
+
d.class("bc-two-factor__complete"),
|
|
391
|
+
g(
|
|
343
392
|
{ variant: "success", tone: "prominent" },
|
|
344
|
-
|
|
393
|
+
i.div(l.$.twoFactorEnabled)
|
|
345
394
|
)
|
|
346
395
|
)
|
|
347
396
|
})
|
|
348
397
|
)
|
|
349
398
|
);
|
|
350
399
|
}
|
|
351
|
-
function
|
|
400
|
+
function me({
|
|
352
401
|
twoFactor: t,
|
|
353
402
|
methods: e = ["totp", "backup"],
|
|
354
403
|
trustDevice: a,
|
|
355
|
-
onVerified:
|
|
404
|
+
onVerified: s
|
|
356
405
|
}) {
|
|
357
|
-
const
|
|
358
|
-
async function
|
|
359
|
-
|
|
360
|
-
const p =
|
|
361
|
-
let
|
|
406
|
+
const o = b(""), c = b(null), r = b(!1), f = b(e[0] ?? "totp");
|
|
407
|
+
async function m(u) {
|
|
408
|
+
u.preventDefault(), r.set(!0), c.set(null);
|
|
409
|
+
const p = f.value;
|
|
410
|
+
let l;
|
|
362
411
|
if (p === "totp")
|
|
363
|
-
|
|
364
|
-
code:
|
|
412
|
+
l = await t.verifyTotp({
|
|
413
|
+
code: o.value,
|
|
365
414
|
trustDevice: a
|
|
366
415
|
});
|
|
367
416
|
else if (p === "otp" && t.verifyOtp)
|
|
368
|
-
|
|
369
|
-
code:
|
|
417
|
+
l = await t.verifyOtp({
|
|
418
|
+
code: o.value,
|
|
370
419
|
trustDevice: a
|
|
371
420
|
});
|
|
372
421
|
else if (p === "backup")
|
|
373
|
-
|
|
422
|
+
l = await t.verifyBackupCode({ code: o.value });
|
|
374
423
|
else {
|
|
375
|
-
|
|
424
|
+
c.set("Unsupported verification method"), r.set(!1);
|
|
376
425
|
return;
|
|
377
426
|
}
|
|
378
|
-
if (
|
|
379
|
-
|
|
427
|
+
if (r.set(!1), l.error) {
|
|
428
|
+
c.set(l.error.message);
|
|
380
429
|
return;
|
|
381
430
|
}
|
|
382
|
-
|
|
431
|
+
s?.();
|
|
383
432
|
}
|
|
384
433
|
async function w() {
|
|
385
434
|
if (!t.sendOtp) return;
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
|
|
435
|
+
r.set(!0), c.set(null);
|
|
436
|
+
const u = await t.sendOtp({ trustDevice: a });
|
|
437
|
+
r.set(!1), u.error && c.set(u.error.message);
|
|
389
438
|
}
|
|
390
|
-
return
|
|
439
|
+
return L(S, (u) => {
|
|
391
440
|
const p = _(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
)((
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
)((
|
|
398
|
-
return
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
(
|
|
441
|
+
f,
|
|
442
|
+
u
|
|
443
|
+
)((n, h) => n === "totp" ? h.twoFactorTotpDescription : n === "otp" ? h.twoFactorOtpDescription : h.twoFactorBackupDescription), l = _(
|
|
444
|
+
f,
|
|
445
|
+
u
|
|
446
|
+
)((n, h) => n === "backup" ? h.twoFactorBackupCodePlaceholder : h.twoFactorCodePlaceholder);
|
|
447
|
+
return i.div(
|
|
448
|
+
d.class("bc-two-factor"),
|
|
449
|
+
v(
|
|
450
|
+
c,
|
|
451
|
+
(n) => g(
|
|
403
452
|
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
404
|
-
|
|
453
|
+
i.div(n)
|
|
405
454
|
)
|
|
406
455
|
),
|
|
407
456
|
// Method selector (only if more than one method)
|
|
408
|
-
|
|
457
|
+
k(
|
|
409
458
|
e.length > 1,
|
|
410
|
-
() =>
|
|
411
|
-
|
|
459
|
+
() => i.div(
|
|
460
|
+
d.class("bc-two-factor__methods"),
|
|
412
461
|
...e.map(
|
|
413
|
-
(
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
(h) => h ===
|
|
462
|
+
(n) => i.button(
|
|
463
|
+
d.type("button"),
|
|
464
|
+
d.class("bc-two-factor__method-button"),
|
|
465
|
+
d.class(
|
|
466
|
+
f.map(
|
|
467
|
+
(h) => h === n ? "bc-two-factor__method-button--active" : ""
|
|
419
468
|
)
|
|
420
469
|
),
|
|
421
|
-
|
|
422
|
-
|
|
470
|
+
P.click(() => {
|
|
471
|
+
f.set(n), o.set(""), c.set(null);
|
|
423
472
|
}),
|
|
424
|
-
|
|
473
|
+
u.$.twoFactorMethodLabel.map((h) => h(n))
|
|
425
474
|
)
|
|
426
475
|
)
|
|
427
476
|
)
|
|
428
477
|
),
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
478
|
+
i.form(
|
|
479
|
+
d.class("bc-two-factor__form"),
|
|
480
|
+
P.submit(m),
|
|
481
|
+
C(
|
|
482
|
+
i.p(d.class("bc-auth-form__description"), p),
|
|
434
483
|
// Send OTP button (only for OTP method)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
() =>
|
|
484
|
+
k(
|
|
485
|
+
f.map((n) => n === "otp" && t.sendOtp != null),
|
|
486
|
+
() => y(
|
|
438
487
|
{
|
|
439
488
|
type: "button",
|
|
440
489
|
variant: "outline",
|
|
441
490
|
color: "primary",
|
|
442
491
|
onClick: w,
|
|
443
|
-
loading:
|
|
492
|
+
loading: r
|
|
444
493
|
},
|
|
445
|
-
|
|
494
|
+
u.$.twoFactorSendOtpButton
|
|
446
495
|
)
|
|
447
496
|
),
|
|
448
497
|
A({
|
|
449
|
-
value:
|
|
450
|
-
onChange: (
|
|
451
|
-
placeholder:
|
|
498
|
+
value: o,
|
|
499
|
+
onChange: (n) => o.set(n),
|
|
500
|
+
placeholder: l
|
|
452
501
|
}),
|
|
453
|
-
|
|
502
|
+
y(
|
|
454
503
|
{
|
|
455
504
|
type: "submit",
|
|
456
505
|
variant: "filled",
|
|
457
506
|
color: "primary",
|
|
458
|
-
loading:
|
|
507
|
+
loading: r
|
|
459
508
|
},
|
|
460
|
-
|
|
461
|
-
|
|
509
|
+
d.class("bc-auth-form__submit"),
|
|
510
|
+
u.$.twoFactorVerifyButton
|
|
462
511
|
)
|
|
463
512
|
)
|
|
464
513
|
)
|
|
465
514
|
);
|
|
466
515
|
});
|
|
467
516
|
}
|
|
468
|
-
function
|
|
517
|
+
function pe({
|
|
469
518
|
client: t,
|
|
470
519
|
callbackURL: e
|
|
471
520
|
}) {
|
|
472
|
-
const a = b(""),
|
|
473
|
-
async function
|
|
474
|
-
if (
|
|
475
|
-
|
|
521
|
+
const a = b(""), s = b(null), o = b(!1), c = b(!1);
|
|
522
|
+
async function r(f) {
|
|
523
|
+
if (f.preventDefault(), !t.signIn.magicLink) {
|
|
524
|
+
s.set("Magic link sign-in is not configured");
|
|
476
525
|
return;
|
|
477
526
|
}
|
|
478
|
-
|
|
479
|
-
const
|
|
527
|
+
o.set(!0), s.set(null);
|
|
528
|
+
const m = await t.signIn.magicLink({
|
|
480
529
|
email: a.value,
|
|
481
530
|
callbackURL: e
|
|
482
531
|
});
|
|
483
|
-
if (
|
|
484
|
-
|
|
532
|
+
if (o.set(!1), m.error) {
|
|
533
|
+
s.set(m.error.message);
|
|
485
534
|
return;
|
|
486
535
|
}
|
|
487
|
-
|
|
536
|
+
c.set(!0);
|
|
488
537
|
}
|
|
489
|
-
return
|
|
538
|
+
return L(
|
|
490
539
|
S,
|
|
491
|
-
(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
(
|
|
540
|
+
(f) => i.div(
|
|
541
|
+
d.class("bc-auth-form"),
|
|
542
|
+
v(
|
|
543
|
+
s,
|
|
544
|
+
(m) => g(
|
|
496
545
|
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
497
|
-
|
|
546
|
+
i.div(m)
|
|
498
547
|
)
|
|
499
548
|
),
|
|
500
549
|
B(
|
|
501
|
-
|
|
502
|
-
() =>
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
550
|
+
c,
|
|
551
|
+
() => i.form(
|
|
552
|
+
d.class("bc-auth-form__form"),
|
|
553
|
+
P.submit(r),
|
|
554
|
+
C(
|
|
555
|
+
d.class("bc-auth-form__fields"),
|
|
556
|
+
i.p(
|
|
557
|
+
d.class("bc-auth-form__description"),
|
|
558
|
+
f.$.magicLinkDescription
|
|
510
559
|
),
|
|
511
|
-
|
|
560
|
+
q({
|
|
512
561
|
value: a,
|
|
513
|
-
onChange: (
|
|
562
|
+
onChange: (m) => a.set(m)
|
|
514
563
|
}),
|
|
515
|
-
|
|
564
|
+
y(
|
|
516
565
|
{
|
|
517
566
|
type: "submit",
|
|
518
567
|
variant: "filled",
|
|
519
568
|
color: "primary",
|
|
520
|
-
loading:
|
|
569
|
+
loading: o
|
|
521
570
|
},
|
|
522
|
-
|
|
523
|
-
|
|
571
|
+
d.class("bc-auth-form__submit"),
|
|
572
|
+
f.$.magicLinkSendButton
|
|
524
573
|
)
|
|
525
574
|
)
|
|
526
575
|
)
|
|
527
576
|
),
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
() =>
|
|
577
|
+
k(
|
|
578
|
+
c,
|
|
579
|
+
() => g(
|
|
531
580
|
{ variant: "success", tone: "prominent" },
|
|
532
|
-
|
|
581
|
+
i.div(f.$.magicLinkSent)
|
|
533
582
|
)
|
|
534
583
|
)
|
|
535
584
|
)
|
|
536
585
|
);
|
|
537
586
|
}
|
|
538
|
-
function
|
|
587
|
+
function be({
|
|
539
588
|
client: t,
|
|
540
589
|
autoFill: e,
|
|
541
590
|
onSuccess: a,
|
|
542
|
-
onError:
|
|
591
|
+
onError: s
|
|
543
592
|
}) {
|
|
544
|
-
const
|
|
545
|
-
async function
|
|
593
|
+
const o = b(!1);
|
|
594
|
+
async function c() {
|
|
546
595
|
if (!t.signIn.passkey) return;
|
|
547
|
-
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
550
|
-
|
|
596
|
+
o.set(!0);
|
|
597
|
+
const r = await t.signIn.passkey({ autoFill: e });
|
|
598
|
+
if (o.set(!1), r.error) {
|
|
599
|
+
s?.({ message: r.error.message, status: r.error.status });
|
|
551
600
|
return;
|
|
552
601
|
}
|
|
553
602
|
a?.();
|
|
554
603
|
}
|
|
555
|
-
return
|
|
604
|
+
return L(
|
|
556
605
|
S,
|
|
557
|
-
(
|
|
606
|
+
(r) => y(
|
|
558
607
|
{
|
|
559
608
|
type: "button",
|
|
560
609
|
variant: "outline",
|
|
561
610
|
color: "primary",
|
|
562
|
-
onClick:
|
|
563
|
-
loading:
|
|
611
|
+
onClick: c,
|
|
612
|
+
loading: o
|
|
564
613
|
},
|
|
565
|
-
|
|
566
|
-
|
|
614
|
+
d.class("bc-passkey-signin"),
|
|
615
|
+
r.$.passkeySignInButton
|
|
567
616
|
)
|
|
568
617
|
);
|
|
569
618
|
}
|
|
570
|
-
function
|
|
619
|
+
function we({
|
|
571
620
|
passkey: t
|
|
572
621
|
}) {
|
|
573
|
-
const e = b([]), a = b(null),
|
|
574
|
-
async function
|
|
575
|
-
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
578
|
-
a.set(
|
|
622
|
+
const e = b([]), a = b(null), s = b(!1), o = b("");
|
|
623
|
+
async function c(u, p) {
|
|
624
|
+
s.set(!0), a.set(null);
|
|
625
|
+
const l = await u();
|
|
626
|
+
if (s.set(!1), l.error) {
|
|
627
|
+
a.set(l.error.message);
|
|
579
628
|
return;
|
|
580
629
|
}
|
|
581
|
-
await p?.(
|
|
630
|
+
await p?.(l.data);
|
|
582
631
|
}
|
|
583
|
-
async function
|
|
584
|
-
await
|
|
632
|
+
async function r() {
|
|
633
|
+
await c(
|
|
585
634
|
() => t.listUserPasskeys(),
|
|
586
|
-
(
|
|
635
|
+
(u) => e.set(u ?? [])
|
|
587
636
|
);
|
|
588
637
|
}
|
|
589
|
-
async function
|
|
590
|
-
const
|
|
591
|
-
await
|
|
592
|
-
() => t.addPasskey({ name:
|
|
638
|
+
async function f() {
|
|
639
|
+
const u = o.value || void 0;
|
|
640
|
+
await c(
|
|
641
|
+
() => t.addPasskey({ name: u }),
|
|
593
642
|
async () => {
|
|
594
|
-
|
|
643
|
+
o.set(""), await r();
|
|
595
644
|
}
|
|
596
645
|
);
|
|
597
646
|
}
|
|
598
|
-
async function
|
|
599
|
-
await
|
|
600
|
-
() => t.deletePasskey({ id:
|
|
601
|
-
() =>
|
|
647
|
+
async function m(u) {
|
|
648
|
+
await c(
|
|
649
|
+
() => t.deletePasskey({ id: u }),
|
|
650
|
+
() => r()
|
|
602
651
|
);
|
|
603
652
|
}
|
|
604
|
-
async function w(
|
|
605
|
-
await
|
|
606
|
-
() => t.updatePasskey({ id:
|
|
607
|
-
() =>
|
|
653
|
+
async function w(u, p) {
|
|
654
|
+
await c(
|
|
655
|
+
() => t.updatePasskey({ id: u, name: p }),
|
|
656
|
+
() => r()
|
|
608
657
|
);
|
|
609
658
|
}
|
|
610
|
-
return
|
|
659
|
+
return r(), L(
|
|
611
660
|
S,
|
|
612
|
-
(
|
|
613
|
-
|
|
614
|
-
|
|
661
|
+
(u) => i.div(
|
|
662
|
+
d.class("bc-passkey-management"),
|
|
663
|
+
v(
|
|
615
664
|
a,
|
|
616
|
-
(p) =>
|
|
665
|
+
(p) => g(
|
|
617
666
|
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
618
|
-
|
|
667
|
+
i.div(p)
|
|
619
668
|
)
|
|
620
669
|
),
|
|
621
670
|
// Passkey list
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
const
|
|
626
|
-
return
|
|
627
|
-
|
|
671
|
+
i.div(
|
|
672
|
+
d.class("bc-passkey-list"),
|
|
673
|
+
$(e, (p) => {
|
|
674
|
+
const l = b(!1), n = b(p.$.name?.value ?? "");
|
|
675
|
+
return i.div(
|
|
676
|
+
d.class("bc-passkey-item"),
|
|
628
677
|
B(
|
|
629
|
-
|
|
630
|
-
() =>
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
p.$.name?.map((h) => h ??
|
|
678
|
+
l,
|
|
679
|
+
() => i.div(
|
|
680
|
+
d.class("bc-passkey-item__info"),
|
|
681
|
+
i.span(
|
|
682
|
+
d.class("bc-passkey-item__name"),
|
|
683
|
+
p.$.name?.map((h) => h ?? u.$.passkeyUnnamed.value) ?? u.$.passkeyUnnamed
|
|
635
684
|
),
|
|
636
|
-
|
|
685
|
+
i.span(d.class("bc-passkey-item__date"), p.$.createdAt)
|
|
637
686
|
)
|
|
638
687
|
),
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
() =>
|
|
642
|
-
|
|
688
|
+
k(
|
|
689
|
+
l,
|
|
690
|
+
() => i.div(
|
|
691
|
+
d.class("bc-passkey-item__edit"),
|
|
643
692
|
A({
|
|
644
|
-
value:
|
|
645
|
-
onChange: (h) =>
|
|
693
|
+
value: n,
|
|
694
|
+
onChange: (h) => n.set(h)
|
|
646
695
|
})
|
|
647
696
|
)
|
|
648
697
|
),
|
|
649
|
-
|
|
650
|
-
|
|
698
|
+
i.div(
|
|
699
|
+
d.class("bc-passkey-item__actions"),
|
|
651
700
|
B(
|
|
652
|
-
|
|
653
|
-
() =>
|
|
654
|
-
|
|
701
|
+
l,
|
|
702
|
+
() => i.div(
|
|
703
|
+
y(
|
|
655
704
|
{
|
|
656
705
|
type: "button",
|
|
657
706
|
variant: "text",
|
|
658
707
|
size: "sm",
|
|
659
708
|
onClick: () => {
|
|
660
|
-
|
|
709
|
+
n.set(p.$.name?.value ?? ""), l.set(!0);
|
|
661
710
|
}
|
|
662
711
|
},
|
|
663
|
-
|
|
712
|
+
u.$.passkeyRenameButton
|
|
664
713
|
),
|
|
665
|
-
|
|
714
|
+
y(
|
|
666
715
|
{
|
|
667
716
|
type: "button",
|
|
668
717
|
variant: "text",
|
|
669
718
|
size: "sm",
|
|
670
719
|
color: "danger",
|
|
671
|
-
onClick: () =>
|
|
720
|
+
onClick: () => m(p.$.id.value)
|
|
672
721
|
},
|
|
673
|
-
|
|
722
|
+
u.$.passkeyDeleteButton
|
|
674
723
|
)
|
|
675
724
|
)
|
|
676
725
|
),
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
() =>
|
|
680
|
-
|
|
726
|
+
k(
|
|
727
|
+
l,
|
|
728
|
+
() => i.div(
|
|
729
|
+
y(
|
|
681
730
|
{
|
|
682
731
|
type: "button",
|
|
683
732
|
variant: "text",
|
|
684
733
|
size: "sm",
|
|
685
734
|
onClick: async () => {
|
|
686
|
-
await w(p.$.id.value,
|
|
735
|
+
await w(p.$.id.value, n.value), l.set(!1);
|
|
687
736
|
}
|
|
688
737
|
},
|
|
689
|
-
|
|
738
|
+
u.$.passkeySaveButton
|
|
690
739
|
),
|
|
691
|
-
|
|
740
|
+
y(
|
|
692
741
|
{
|
|
693
742
|
type: "button",
|
|
694
743
|
variant: "text",
|
|
695
744
|
size: "sm",
|
|
696
|
-
onClick: () =>
|
|
745
|
+
onClick: () => l.set(!1)
|
|
697
746
|
},
|
|
698
|
-
|
|
747
|
+
u.$.passkeyCancelButton
|
|
699
748
|
)
|
|
700
749
|
)
|
|
701
750
|
)
|
|
@@ -704,23 +753,23 @@ function fe({
|
|
|
704
753
|
})
|
|
705
754
|
),
|
|
706
755
|
// Add passkey
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
756
|
+
i.div(
|
|
757
|
+
d.class("bc-passkey-add"),
|
|
758
|
+
C(
|
|
710
759
|
A({
|
|
711
|
-
value:
|
|
712
|
-
onChange: (p) =>
|
|
713
|
-
placeholder:
|
|
760
|
+
value: o,
|
|
761
|
+
onChange: (p) => o.set(p),
|
|
762
|
+
placeholder: u.$.passkeyNamePlaceholder
|
|
714
763
|
}),
|
|
715
|
-
|
|
764
|
+
y(
|
|
716
765
|
{
|
|
717
766
|
type: "button",
|
|
718
767
|
variant: "filled",
|
|
719
768
|
color: "primary",
|
|
720
|
-
onClick:
|
|
721
|
-
loading:
|
|
769
|
+
onClick: f,
|
|
770
|
+
loading: s
|
|
722
771
|
},
|
|
723
|
-
|
|
772
|
+
u.$.passkeyAddButton
|
|
724
773
|
)
|
|
725
774
|
)
|
|
726
775
|
)
|
|
@@ -728,18 +777,18 @@ function fe({
|
|
|
728
777
|
);
|
|
729
778
|
}
|
|
730
779
|
export {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
780
|
+
ue as Authenticated,
|
|
781
|
+
ie as BetterAuth,
|
|
782
|
+
ce as BetterAuthContainer,
|
|
734
783
|
S as BetterAuthI18n,
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
784
|
+
le as BetterAuthModal,
|
|
785
|
+
pe as MagicLinkForm,
|
|
786
|
+
we as PasskeyManagement,
|
|
787
|
+
be as PasskeySignIn,
|
|
788
|
+
fe as TwoFactorSetup,
|
|
789
|
+
me as TwoFactorVerify,
|
|
790
|
+
de as Unauthenticated,
|
|
791
|
+
Q as createBetterAuthBridge,
|
|
792
|
+
J as createSessionManager,
|
|
793
|
+
K as mapSocialProviders
|
|
745
794
|
};
|