@tempots/beatui 0.82.0 → 0.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +63 -1351
- package/dist/auth-divider-BqZPH1-z.cjs +1 -0
- package/dist/auth-divider-Wr-S16kF.js +1355 -0
- package/dist/beatui.css +1347 -0
- package/dist/beatui.tailwind.css +1347 -0
- package/dist/better-auth/index.cjs.js +1 -0
- package/dist/better-auth/index.es.js +754 -0
- package/dist/{deep-merge-CiOwVWn8.js → deep-merge-BYm0y62g.js} +34 -33
- package/dist/deep-merge-d7sf0xmN.cjs +1 -0
- package/dist/duration-input-B9UNmUCh.cjs +1 -0
- package/dist/{duration-input-B3vnnwBZ.js → duration-input-DqcJbxKD.js} +23 -22
- package/dist/editor-toolbar-group--a-xgsJw.cjs +1 -0
- package/dist/editor-toolbar-group-CVpl5mxF.js +31 -0
- package/dist/{hls.light.min-Bhrf47iR.cjs → hls.light.min-C6xKDzRR.cjs} +1 -1
- package/dist/{hls.light.min-C6VwviEa.js → hls.light.min-hEMf_E8u.js} +1 -1
- package/dist/{index-C5YCCgnn.cjs → index-05UbKOYe.cjs} +1 -1
- package/dist/{index-ChsRjiIp.cjs → index-Bt7FYl80.cjs} +19 -19
- package/dist/{index-DT6-HMMz.js → index-C2Lq1m45.js} +1432 -1462
- package/dist/{index-CiAVfKIZ.js → index-lYhXnu6I.js} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +2326 -2680
- package/dist/input-container-C6qEIjcA.cjs +1 -0
- package/dist/input-container-DiCjOzR2.js +247 -0
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +33 -32
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +1 -1
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +542 -700
- package/dist/lexical/index.cjs.js +46 -0
- package/dist/lexical/index.es.js +21370 -0
- package/dist/lexical.css +1124 -0
- package/dist/menu-CZzRsQP_.js +372 -0
- package/dist/menu-ClrU72xH.cjs +1 -0
- package/dist/modal-I5srcntN.cjs +1 -0
- package/dist/modal-v3u2Fpnd.js +488 -0
- package/dist/{notice-CZHWWwOQ.js → notice-BuZvdvZh.js} +48 -47
- package/dist/notice-CLDdy1MW.cjs +1 -0
- package/dist/{oneof-branch-detection-C8g3eWnx.cjs → oneof-branch-detection-DsM1K5xc.cjs} +1 -1
- package/dist/{oneof-branch-detection-BVNoKU9d.js → oneof-branch-detection-Dt8ss9lc.js} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/session-id-3KiilioY.js +8 -0
- package/dist/session-id-B5lJMzbB.cjs +1 -0
- package/dist/styles-url-B2dzXrYt.cjs +1 -0
- package/dist/styles-url-Cw_mxshe.js +4 -0
- package/dist/text-input-B3VBat1k.js +44 -0
- package/dist/text-input-Ds8e7Z1G.cjs +1 -0
- package/dist/{toolbar-DR2Zd4Oo.js → toolbar-D994_E_s.js} +4 -4
- package/dist/toolbar-x0_8lmKu.cjs +1 -0
- package/dist/types/better-auth/bridge.d.ts +2 -0
- package/dist/types/better-auth/callbacks.d.ts +6 -0
- package/dist/types/better-auth/components/authenticated.d.ts +4 -0
- package/dist/types/better-auth/components/better-auth-container.d.ts +4 -0
- package/dist/types/better-auth/components/better-auth-modal.d.ts +4 -0
- package/dist/types/better-auth/components/magic-link-form.d.ts +7 -0
- package/dist/types/better-auth/components/passkey-management.d.ts +6 -0
- package/dist/types/better-auth/components/passkey-signin.d.ts +12 -0
- package/dist/types/better-auth/components/two-factor-setup.d.ts +8 -0
- package/dist/types/better-auth/components/two-factor-verify.d.ts +10 -0
- package/dist/types/better-auth/i18n/default.d.ts +29 -0
- package/dist/types/better-auth/i18n/locales/en.d.ts +28 -0
- package/dist/types/better-auth/i18n/translations.d.ts +27 -0
- package/dist/types/better-auth/index.d.ts +22 -0
- package/dist/types/better-auth/provider.d.ts +6 -0
- package/dist/types/better-auth/session.d.ts +14 -0
- package/dist/types/better-auth/social-mapping.d.ts +2 -0
- package/dist/types/better-auth/types.d.ts +164 -0
- package/dist/types/components/auth/auth-container.d.ts +1 -1
- package/dist/types/components/auth/social-providers.d.ts +1 -1
- package/dist/types/components/auth/types.d.ts +2 -0
- package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +16 -0
- package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +9 -0
- package/dist/types/components/editor-toolbar/index.d.ts +2 -0
- package/dist/types/components/json-structure/controls/control-utils.d.ts +19 -0
- package/dist/types/components/json-structure/controls/index.d.ts +1 -0
- package/dist/types/components/lexical/bare-editor.d.ts +29 -0
- package/dist/types/components/lexical/code/index.d.ts +1 -0
- package/dist/types/components/lexical/code/language-selector.d.ts +13 -0
- package/dist/types/components/lexical/contextual-editor.d.ts +22 -0
- package/dist/types/components/lexical/docked-editor.d.ts +23 -0
- package/dist/types/components/lexical/floating/block-handle.d.ts +16 -0
- package/dist/types/components/lexical/floating/floating-toolbar.d.ts +12 -0
- package/dist/types/components/lexical/floating/index.d.ts +6 -0
- package/dist/types/components/lexical/floating/slash-command-palette.d.ts +20 -0
- package/dist/types/components/lexical/index.d.ts +8 -0
- package/dist/types/components/lexical/lexical-editor-input.d.ts +30 -0
- package/dist/types/components/lexical/table/index.d.ts +1 -0
- package/dist/types/components/lexical/table/table-controls.d.ts +12 -0
- package/dist/types/components/lexical/toolbar/index.d.ts +6 -0
- package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +12 -0
- package/dist/types/components/lexical/toolbar/toolbar-button.d.ts +1 -0
- package/dist/types/components/lexical/toolbar/toolbar-group.d.ts +1 -0
- package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +30 -0
- package/dist/types/components/prosemirror/etoolbar-button.d.ts +1 -11
- package/dist/types/components/prosemirror/etoolbar-group.d.ts +1 -4
- package/dist/types/lexical/commands/index.d.ts +17 -0
- package/dist/types/lexical/headless.d.ts +39 -0
- package/dist/types/lexical/horizontal-rule-node.d.ts +20 -0
- package/dist/types/lexical/index.d.ts +20 -0
- package/dist/types/lexical/lazy-loader.d.ts +35 -0
- package/dist/types/lexical/nodes.d.ts +29 -0
- package/dist/types/lexical/plugins/auto-link.d.ts +7 -0
- package/dist/types/lexical/plugins/clipboard.d.ts +11 -0
- package/dist/types/lexical/plugins/code-shiki.d.ts +11 -0
- package/dist/types/lexical/plugins/code.d.ts +7 -0
- package/dist/types/lexical/plugins/dragon.d.ts +6 -0
- package/dist/types/lexical/plugins/file-io.d.ts +10 -0
- package/dist/types/lexical/plugins/hashtag.d.ts +7 -0
- package/dist/types/lexical/plugins/history.d.ts +7 -0
- package/dist/types/lexical/plugins/horizontal-rule.d.ts +12 -0
- package/dist/types/lexical/plugins/html-io.d.ts +9 -0
- package/dist/types/lexical/plugins/index.d.ts +24 -0
- package/dist/types/lexical/plugins/link.d.ts +6 -0
- package/dist/types/lexical/plugins/list.d.ts +6 -0
- package/dist/types/lexical/plugins/mark.d.ts +15 -0
- package/dist/types/lexical/plugins/markdown-io.d.ts +13 -0
- package/dist/types/lexical/plugins/offset.d.ts +6 -0
- package/dist/types/lexical/plugins/overflow.d.ts +7 -0
- package/dist/types/lexical/plugins/plain-text.d.ts +6 -0
- package/dist/types/lexical/plugins/rich-text.d.ts +6 -0
- package/dist/types/lexical/plugins/selection.d.ts +6 -0
- package/dist/types/lexical/plugins/slash-commands.d.ts +26 -0
- package/dist/types/lexical/plugins/table.d.ts +11 -0
- package/dist/types/lexical/plugins/text.d.ts +13 -0
- package/dist/types/lexical/plugins/yjs.d.ts +9 -0
- package/dist/types/lexical/styles-url.d.ts +2 -0
- package/dist/types/lexical/styles.d.ts +2 -0
- package/dist/types/lexical/types.d.ts +634 -0
- package/dist/types/lexical-i18n/default.d.ts +92 -0
- package/dist/types/lexical-i18n/index.d.ts +21 -0
- package/dist/types/lexical-i18n/locales/ar.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/de.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/en.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/es.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/fa.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/fr.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/he.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/hi.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/it.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ja.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ko.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/nl.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/pl.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/pt.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ru.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/tr.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ur.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/vi.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/zh.d.ts +91 -0
- package/dist/types/lexical-i18n/translations.d.ts +21 -0
- package/dist/use-animated-toggle-ChycsEoj.js +175 -0
- package/dist/use-animated-toggle-DR6CyMac.cjs +1 -0
- package/dist/{use-form-CgZyrACX.js → use-form-B56E_x5Y.js} +83 -88
- package/dist/use-form-Cnp3XQ5X.cjs +2 -0
- package/dist/widget-customization-Dk7XcVly.cjs +1 -0
- package/dist/{widget-customization-DRA7E9Zf.js → widget-customization-Ds9sicAg.js} +106 -105
- package/package.json +48 -3
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +0 -1
- package/dist/deep-merge-DxZqCkE5.cjs +0 -1
- package/dist/duration-input-Dg5SX3lM.cjs +0 -1
- package/dist/modal-D2xE47kr.cjs +0 -1
- package/dist/modal-hkQD1bqZ.js +0 -655
- package/dist/notice-C0SmlheE.cjs +0 -1
- package/dist/text-input-CByq5OIo.cjs +0 -1
- package/dist/text-input-CFJntP7G.js +0 -287
- package/dist/toolbar-TPWYzoiF.cjs +0 -1
- package/dist/use-form-JjeKCINk.cjs +0 -2
- package/dist/widget-customization-G-QLB1rw.cjs +0 -1
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
import { prop as b, computedOf as B, makeProviderMark as U, When as y, Unless as C, Use as S, html as r, attr as l, Ensure as g, OneOfValue as D, Fragment as E, NotEmpty as O, ForEach as R, on as L } from "@tempots/dom";
|
|
2
|
+
import { A as M, a as T } from "../auth-divider-Wr-S16kF.js";
|
|
3
|
+
import { m as N } from "../translations-Cq8bUKJP.js";
|
|
4
|
+
import { N as v, P as V, E as x } from "../notice-BuZvdvZh.js";
|
|
5
|
+
import { S as P } from "../stack-BJgsPJ9A.js";
|
|
6
|
+
import { B as k } from "../input-container-DiCjOzR2.js";
|
|
7
|
+
import { T as I } from "../text-input-B3VBat1k.js";
|
|
8
|
+
function F(t, e) {
|
|
9
|
+
return t.error ? (e.onError?.({
|
|
10
|
+
message: t.error.message,
|
|
11
|
+
status: t.error.status
|
|
12
|
+
}), t.error.message) : null;
|
|
13
|
+
}
|
|
14
|
+
function z(t, e, a) {
|
|
15
|
+
return async (n) => {
|
|
16
|
+
const u = await t.signIn.email({
|
|
17
|
+
email: n.email,
|
|
18
|
+
password: n.password,
|
|
19
|
+
callbackURL: e.callbackURL
|
|
20
|
+
}), o = F(u, e);
|
|
21
|
+
return o || (await a(), null);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function q(t, e, a) {
|
|
25
|
+
return async (n) => {
|
|
26
|
+
const u = await t.signUp.email({
|
|
27
|
+
name: n.name,
|
|
28
|
+
email: n.email,
|
|
29
|
+
password: n.password,
|
|
30
|
+
callbackURL: e.callbackURL
|
|
31
|
+
}), o = F(u, e);
|
|
32
|
+
return o || (await a(), null);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function j(t, e) {
|
|
36
|
+
return async (a) => {
|
|
37
|
+
const n = await t.requestPasswordReset({
|
|
38
|
+
email: a.email,
|
|
39
|
+
redirectTo: e.callbackURL
|
|
40
|
+
});
|
|
41
|
+
return F(n, e);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function H(t, e) {
|
|
45
|
+
return async (a) => {
|
|
46
|
+
const n = await t.signIn.social({
|
|
47
|
+
provider: a,
|
|
48
|
+
callbackURL: e.callbackURL,
|
|
49
|
+
errorCallbackURL: e.errorCallbackURL
|
|
50
|
+
});
|
|
51
|
+
F(n, e);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function W(t, e = {}) {
|
|
55
|
+
const a = b(null), n = b(!0), u = B(a)(
|
|
56
|
+
(w) => w?.user ?? null
|
|
57
|
+
), o = B(a)((w) => w != null);
|
|
58
|
+
let d;
|
|
59
|
+
async function m() {
|
|
60
|
+
try {
|
|
61
|
+
const w = await t.getSession();
|
|
62
|
+
w.error || !w.data ? a.set(null) : a.set({
|
|
63
|
+
user: w.data.user,
|
|
64
|
+
session: w.data.session
|
|
65
|
+
});
|
|
66
|
+
} catch {
|
|
67
|
+
a.set(null);
|
|
68
|
+
} finally {
|
|
69
|
+
n.set(!1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
e.onSessionChange && a.on(e.onSessionChange), m(), e.refreshInterval && e.refreshInterval > 0 && (d = setInterval(m, e.refreshInterval));
|
|
73
|
+
function f() {
|
|
74
|
+
d != null && (clearInterval(d), d = void 0), a.dispose(), n.dispose(), u.dispose(), o.dispose();
|
|
75
|
+
}
|
|
76
|
+
return { session: a, isPending: n, user: u, isAuthenticated: o, refresh: m, dispose: f };
|
|
77
|
+
}
|
|
78
|
+
function Y(t) {
|
|
79
|
+
return t.map((e) => ({
|
|
80
|
+
provider: e
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
function G(t, e = {}) {
|
|
84
|
+
const a = W(t, {
|
|
85
|
+
refreshInterval: e.refreshInterval,
|
|
86
|
+
onSessionChange: e.onSessionChange
|
|
87
|
+
}), n = () => a.refresh(), u = z(t, e, n), o = q(t, e, n), d = j(t, e), m = H(t, e), f = e.socialProviders ? Y(e.socialProviders) : [], w = {
|
|
88
|
+
onSignIn: u,
|
|
89
|
+
passwordRules: e.passwordRules,
|
|
90
|
+
showRememberMe: e.showRememberMe,
|
|
91
|
+
labels: e.labels ? {
|
|
92
|
+
emailLabel: e.labels.emailLabel,
|
|
93
|
+
passwordLabel: e.labels.passwordLabel,
|
|
94
|
+
rememberMeLabel: e.labels.rememberMeLabel,
|
|
95
|
+
signInButton: e.labels.signInButton,
|
|
96
|
+
forgotPasswordLink: e.labels.forgotPasswordLink,
|
|
97
|
+
noAccountLink: e.labels.noAccountLink
|
|
98
|
+
} : void 0
|
|
99
|
+
}, c = {
|
|
100
|
+
onSignUp: o,
|
|
101
|
+
passwordRules: e.passwordRules,
|
|
102
|
+
showPasswordStrength: e.showPasswordStrength,
|
|
103
|
+
showNameField: e.showNameField,
|
|
104
|
+
showConfirmPassword: e.showConfirmPassword,
|
|
105
|
+
labels: e.labels ? {
|
|
106
|
+
nameLabel: e.labels.nameLabel,
|
|
107
|
+
emailLabel: e.labels.emailLabel,
|
|
108
|
+
passwordLabel: e.labels.passwordLabel,
|
|
109
|
+
confirmPasswordLabel: e.labels.confirmPasswordLabel,
|
|
110
|
+
acceptTermsLabel: e.labels.acceptTermsLabel,
|
|
111
|
+
signUpButton: e.labels.signUpButton,
|
|
112
|
+
hasAccountLink: e.labels.hasAccountLink
|
|
113
|
+
} : void 0
|
|
114
|
+
}, p = {
|
|
115
|
+
onResetPassword: d,
|
|
116
|
+
labels: e.labels ? {
|
|
117
|
+
resetPasswordButton: e.labels.resetPasswordButton,
|
|
118
|
+
resetPasswordDescription: e.labels.resetPasswordDescription,
|
|
119
|
+
emailLabel: e.labels.emailLabel,
|
|
120
|
+
backToSignInLink: e.labels.backToSignInLink
|
|
121
|
+
} : void 0
|
|
122
|
+
}, i = {
|
|
123
|
+
onSignIn: u,
|
|
124
|
+
onSignUp: o,
|
|
125
|
+
onResetPassword: d,
|
|
126
|
+
onSocialLogin: m,
|
|
127
|
+
socialProviders: f.length > 0 ? f : void 0,
|
|
128
|
+
showSocialDivider: f.length > 0,
|
|
129
|
+
passwordRules: e.passwordRules,
|
|
130
|
+
showRememberMe: e.showRememberMe,
|
|
131
|
+
showPasswordStrength: e.showPasswordStrength,
|
|
132
|
+
showNameField: e.showNameField,
|
|
133
|
+
showConfirmPassword: e.showConfirmPassword,
|
|
134
|
+
labels: e.labels
|
|
135
|
+
};
|
|
136
|
+
async function s() {
|
|
137
|
+
await t.signOut(), await n();
|
|
138
|
+
}
|
|
139
|
+
function h() {
|
|
140
|
+
a.dispose();
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
session: a.session,
|
|
144
|
+
isPending: a.isPending,
|
|
145
|
+
user: a.user,
|
|
146
|
+
isAuthenticated: a.isAuthenticated,
|
|
147
|
+
containerOptions: i,
|
|
148
|
+
signInOptions: w,
|
|
149
|
+
signUpOptions: c,
|
|
150
|
+
resetOptions: p,
|
|
151
|
+
socialProviders: f,
|
|
152
|
+
signOut: s,
|
|
153
|
+
refreshSession: n,
|
|
154
|
+
dispose: h
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const ne = {
|
|
158
|
+
mark: U("BetterAuth"),
|
|
159
|
+
create: (t) => {
|
|
160
|
+
if (!t)
|
|
161
|
+
throw new Error("BetterAuth provider requires a client option");
|
|
162
|
+
const e = G(t.client, t);
|
|
163
|
+
return {
|
|
164
|
+
value: e,
|
|
165
|
+
dispose: () => e.dispose()
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
function re(t, e, ...a) {
|
|
170
|
+
return M(
|
|
171
|
+
{ ...t.containerOptions, ...e },
|
|
172
|
+
...a
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
function oe(t, e) {
|
|
176
|
+
return T(
|
|
177
|
+
(a) => e(
|
|
178
|
+
(n) => a({ ...t.containerOptions, ...n })
|
|
179
|
+
)
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
function ie(t, e) {
|
|
183
|
+
return y(t.isAuthenticated, e);
|
|
184
|
+
}
|
|
185
|
+
function ce(t, e) {
|
|
186
|
+
return C(t.isAuthenticated, e);
|
|
187
|
+
}
|
|
188
|
+
const J = {
|
|
189
|
+
// Two-Factor Authentication
|
|
190
|
+
twoFactorSetupDescription: "Enter your password to enable two-factor authentication.",
|
|
191
|
+
twoFactorEnableButton: "Enable 2FA",
|
|
192
|
+
twoFactorVerifyButton: "Verify",
|
|
193
|
+
twoFactorScanDescription: "Scan the code below with your authenticator app, then enter the verification code.",
|
|
194
|
+
twoFactorBackupCodesDescription: "Save these backup codes in a safe place. You can use them to sign in if you lose access to your authenticator.",
|
|
195
|
+
twoFactorCodePlaceholder: "Enter 6-digit code",
|
|
196
|
+
twoFactorBackupCodePlaceholder: "Enter backup code",
|
|
197
|
+
twoFactorEnabled: "Two-factor authentication has been enabled.",
|
|
198
|
+
twoFactorTotpDescription: "Enter the code from your authenticator app.",
|
|
199
|
+
twoFactorOtpDescription: "Enter the one-time code sent to you.",
|
|
200
|
+
twoFactorBackupDescription: "Enter one of your backup codes.",
|
|
201
|
+
twoFactorSendOtpButton: "Send Code",
|
|
202
|
+
twoFactorMethodLabel: (t) => {
|
|
203
|
+
switch (t) {
|
|
204
|
+
case "totp":
|
|
205
|
+
return "Authenticator";
|
|
206
|
+
case "otp":
|
|
207
|
+
return "Email/SMS";
|
|
208
|
+
case "backup":
|
|
209
|
+
return "Backup Code";
|
|
210
|
+
default:
|
|
211
|
+
return t;
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
passwordPlaceholder: "Enter your password",
|
|
215
|
+
// Magic Link
|
|
216
|
+
magicLinkDescription: "Enter your email to receive a sign-in link.",
|
|
217
|
+
magicLinkSendButton: "Send Magic Link",
|
|
218
|
+
magicLinkSent: "A sign-in link has been sent to your email.",
|
|
219
|
+
// Passkey
|
|
220
|
+
passkeySignInButton: "Sign in with Passkey",
|
|
221
|
+
passkeyAddButton: "Add Passkey",
|
|
222
|
+
passkeyDeleteButton: "Delete",
|
|
223
|
+
passkeyRenameButton: "Rename",
|
|
224
|
+
passkeySaveButton: "Save",
|
|
225
|
+
passkeyCancelButton: "Cancel",
|
|
226
|
+
passkeyNamePlaceholder: "Passkey name (optional)",
|
|
227
|
+
passkeyUnnamed: "Unnamed passkey"
|
|
228
|
+
}, $ = J, A = "en", K = /* @__PURE__ */ Object.assign({}), _ = N({
|
|
229
|
+
defaultLocale: A,
|
|
230
|
+
defaultMessages: $,
|
|
231
|
+
localeLoader: async (t) => {
|
|
232
|
+
if (t === A) return $;
|
|
233
|
+
const e = K[`./locales/${t}.ts`];
|
|
234
|
+
return e ? await e() : $;
|
|
235
|
+
},
|
|
236
|
+
providerName: "BetterAuthI18n"
|
|
237
|
+
});
|
|
238
|
+
function le({
|
|
239
|
+
twoFactor: t,
|
|
240
|
+
issuer: e,
|
|
241
|
+
onComplete: a
|
|
242
|
+
}) {
|
|
243
|
+
const n = b(""), u = b(null), o = b([]), d = b(""), m = b(null), f = b(!1), w = b("password");
|
|
244
|
+
async function c(i) {
|
|
245
|
+
i.preventDefault(), f.set(!0), m.set(null);
|
|
246
|
+
const s = await t.enable({
|
|
247
|
+
password: n.value,
|
|
248
|
+
issuer: e
|
|
249
|
+
});
|
|
250
|
+
if (f.set(!1), s.error) {
|
|
251
|
+
m.set(s.error.message);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
s.data && (u.set(s.data.totpURI), o.set(s.data.backupCodes), w.set("verify"));
|
|
255
|
+
}
|
|
256
|
+
async function p(i) {
|
|
257
|
+
i.preventDefault(), f.set(!0), m.set(null);
|
|
258
|
+
const s = await t.verifyTotp({ code: d.value });
|
|
259
|
+
if (f.set(!1), s.error) {
|
|
260
|
+
m.set(s.error.message);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
w.set("complete"), a?.();
|
|
264
|
+
}
|
|
265
|
+
return S(
|
|
266
|
+
_,
|
|
267
|
+
(i) => r.div(
|
|
268
|
+
l.class("bc-two-factor"),
|
|
269
|
+
g(
|
|
270
|
+
m,
|
|
271
|
+
(s) => v(
|
|
272
|
+
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
273
|
+
r.div(s)
|
|
274
|
+
)
|
|
275
|
+
),
|
|
276
|
+
D(w, {
|
|
277
|
+
password: () => r.form(
|
|
278
|
+
l.class("bc-two-factor__form"),
|
|
279
|
+
L.submit(c),
|
|
280
|
+
P(
|
|
281
|
+
r.p(
|
|
282
|
+
l.class("bc-auth-form__description"),
|
|
283
|
+
i.$.twoFactorSetupDescription
|
|
284
|
+
),
|
|
285
|
+
V({
|
|
286
|
+
value: n,
|
|
287
|
+
onChange: (s) => n.set(s),
|
|
288
|
+
placeholder: i.$.passwordPlaceholder
|
|
289
|
+
}),
|
|
290
|
+
k(
|
|
291
|
+
{
|
|
292
|
+
type: "submit",
|
|
293
|
+
variant: "filled",
|
|
294
|
+
color: "primary",
|
|
295
|
+
loading: f
|
|
296
|
+
},
|
|
297
|
+
l.class("bc-auth-form__submit"),
|
|
298
|
+
i.$.twoFactorEnableButton
|
|
299
|
+
)
|
|
300
|
+
)
|
|
301
|
+
),
|
|
302
|
+
verify: () => E(
|
|
303
|
+
g(
|
|
304
|
+
u,
|
|
305
|
+
(s) => r.div(
|
|
306
|
+
l.class("bc-two-factor__totp-uri"),
|
|
307
|
+
r.p(i.$.twoFactorScanDescription),
|
|
308
|
+
r.code(l.class("bc-two-factor__code-display"), s)
|
|
309
|
+
)
|
|
310
|
+
),
|
|
311
|
+
O(
|
|
312
|
+
o,
|
|
313
|
+
() => r.div(
|
|
314
|
+
l.class("bc-two-factor__backup-codes"),
|
|
315
|
+
r.p(i.$.twoFactorBackupCodesDescription),
|
|
316
|
+
r.ul(
|
|
317
|
+
R(
|
|
318
|
+
o,
|
|
319
|
+
(s) => r.li(s)
|
|
320
|
+
)
|
|
321
|
+
)
|
|
322
|
+
)
|
|
323
|
+
),
|
|
324
|
+
r.form(
|
|
325
|
+
l.class("bc-two-factor__form"),
|
|
326
|
+
L.submit(p),
|
|
327
|
+
P(
|
|
328
|
+
I({
|
|
329
|
+
value: d,
|
|
330
|
+
onChange: (s) => d.set(s),
|
|
331
|
+
placeholder: i.$.twoFactorCodePlaceholder
|
|
332
|
+
}),
|
|
333
|
+
k(
|
|
334
|
+
{
|
|
335
|
+
type: "submit",
|
|
336
|
+
variant: "filled",
|
|
337
|
+
color: "primary",
|
|
338
|
+
loading: f
|
|
339
|
+
},
|
|
340
|
+
l.class("bc-auth-form__submit"),
|
|
341
|
+
i.$.twoFactorVerifyButton
|
|
342
|
+
)
|
|
343
|
+
)
|
|
344
|
+
)
|
|
345
|
+
),
|
|
346
|
+
complete: () => r.div(
|
|
347
|
+
l.class("bc-two-factor__complete"),
|
|
348
|
+
v(
|
|
349
|
+
{ variant: "success", tone: "prominent" },
|
|
350
|
+
r.div(i.$.twoFactorEnabled)
|
|
351
|
+
)
|
|
352
|
+
)
|
|
353
|
+
})
|
|
354
|
+
)
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
function ue({
|
|
358
|
+
twoFactor: t,
|
|
359
|
+
methods: e = ["totp", "backup"],
|
|
360
|
+
trustDevice: a,
|
|
361
|
+
onVerified: n
|
|
362
|
+
}) {
|
|
363
|
+
const u = b(""), o = b(null), d = b(!1), m = b(e[0] ?? "totp");
|
|
364
|
+
async function f(c) {
|
|
365
|
+
c.preventDefault(), d.set(!0), o.set(null);
|
|
366
|
+
const p = m.value;
|
|
367
|
+
let i;
|
|
368
|
+
if (p === "totp")
|
|
369
|
+
i = await t.verifyTotp({
|
|
370
|
+
code: u.value,
|
|
371
|
+
trustDevice: a
|
|
372
|
+
});
|
|
373
|
+
else if (p === "otp" && t.verifyOtp)
|
|
374
|
+
i = await t.verifyOtp({
|
|
375
|
+
code: u.value,
|
|
376
|
+
trustDevice: a
|
|
377
|
+
});
|
|
378
|
+
else if (p === "backup")
|
|
379
|
+
i = await t.verifyBackupCode({ code: u.value });
|
|
380
|
+
else {
|
|
381
|
+
o.set("Unsupported verification method"), d.set(!1);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (d.set(!1), i.error) {
|
|
385
|
+
o.set(i.error.message);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
n?.();
|
|
389
|
+
}
|
|
390
|
+
async function w() {
|
|
391
|
+
if (!t.sendOtp) return;
|
|
392
|
+
d.set(!0), o.set(null);
|
|
393
|
+
const c = await t.sendOtp({ trustDevice: a });
|
|
394
|
+
d.set(!1), c.error && o.set(c.error.message);
|
|
395
|
+
}
|
|
396
|
+
return S(_, (c) => {
|
|
397
|
+
const p = B(m, c)((s, h) => s === "totp" ? h.twoFactorTotpDescription : s === "otp" ? h.twoFactorOtpDescription : h.twoFactorBackupDescription), i = B(m, c)((s, h) => s === "backup" ? h.twoFactorBackupCodePlaceholder : h.twoFactorCodePlaceholder);
|
|
398
|
+
return r.div(
|
|
399
|
+
l.class("bc-two-factor"),
|
|
400
|
+
g(
|
|
401
|
+
o,
|
|
402
|
+
(s) => v(
|
|
403
|
+
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
404
|
+
r.div(s)
|
|
405
|
+
)
|
|
406
|
+
),
|
|
407
|
+
// Method selector (only if more than one method)
|
|
408
|
+
y(
|
|
409
|
+
e.length > 1,
|
|
410
|
+
() => r.div(
|
|
411
|
+
l.class("bc-two-factor__methods"),
|
|
412
|
+
...e.map(
|
|
413
|
+
(s) => r.button(
|
|
414
|
+
l.type("button"),
|
|
415
|
+
l.class("bc-two-factor__method-button"),
|
|
416
|
+
l.class(
|
|
417
|
+
m.map(
|
|
418
|
+
(h) => h === s ? "bc-two-factor__method-button--active" : ""
|
|
419
|
+
)
|
|
420
|
+
),
|
|
421
|
+
L.click(() => {
|
|
422
|
+
m.set(s), u.set(""), o.set(null);
|
|
423
|
+
}),
|
|
424
|
+
c.$.twoFactorMethodLabel.map((h) => h(s))
|
|
425
|
+
)
|
|
426
|
+
)
|
|
427
|
+
)
|
|
428
|
+
),
|
|
429
|
+
r.form(
|
|
430
|
+
l.class("bc-two-factor__form"),
|
|
431
|
+
L.submit(f),
|
|
432
|
+
P(
|
|
433
|
+
r.p(
|
|
434
|
+
l.class("bc-auth-form__description"),
|
|
435
|
+
p
|
|
436
|
+
),
|
|
437
|
+
// Send OTP button (only for OTP method)
|
|
438
|
+
y(
|
|
439
|
+
m.map((s) => s === "otp" && t.sendOtp != null),
|
|
440
|
+
() => k(
|
|
441
|
+
{
|
|
442
|
+
type: "button",
|
|
443
|
+
variant: "outline",
|
|
444
|
+
color: "primary",
|
|
445
|
+
onClick: w,
|
|
446
|
+
loading: d
|
|
447
|
+
},
|
|
448
|
+
c.$.twoFactorSendOtpButton
|
|
449
|
+
)
|
|
450
|
+
),
|
|
451
|
+
I({
|
|
452
|
+
value: u,
|
|
453
|
+
onChange: (s) => u.set(s),
|
|
454
|
+
placeholder: i
|
|
455
|
+
}),
|
|
456
|
+
k(
|
|
457
|
+
{
|
|
458
|
+
type: "submit",
|
|
459
|
+
variant: "filled",
|
|
460
|
+
color: "primary",
|
|
461
|
+
loading: d
|
|
462
|
+
},
|
|
463
|
+
l.class("bc-auth-form__submit"),
|
|
464
|
+
c.$.twoFactorVerifyButton
|
|
465
|
+
)
|
|
466
|
+
)
|
|
467
|
+
)
|
|
468
|
+
);
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function de({
|
|
472
|
+
client: t,
|
|
473
|
+
callbackURL: e
|
|
474
|
+
}) {
|
|
475
|
+
const a = b(""), n = b(null), u = b(!1), o = b(!1);
|
|
476
|
+
async function d(m) {
|
|
477
|
+
if (m.preventDefault(), !t.signIn.magicLink) {
|
|
478
|
+
n.set("Magic link sign-in is not configured");
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
u.set(!0), n.set(null);
|
|
482
|
+
const f = await t.signIn.magicLink({
|
|
483
|
+
email: a.value,
|
|
484
|
+
callbackURL: e
|
|
485
|
+
});
|
|
486
|
+
if (u.set(!1), f.error) {
|
|
487
|
+
n.set(f.error.message);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
o.set(!0);
|
|
491
|
+
}
|
|
492
|
+
return S(
|
|
493
|
+
_,
|
|
494
|
+
(m) => r.div(
|
|
495
|
+
l.class("bc-auth-form"),
|
|
496
|
+
g(
|
|
497
|
+
n,
|
|
498
|
+
(f) => v(
|
|
499
|
+
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
500
|
+
r.div(f)
|
|
501
|
+
)
|
|
502
|
+
),
|
|
503
|
+
C(
|
|
504
|
+
o,
|
|
505
|
+
() => r.form(
|
|
506
|
+
l.class("bc-auth-form__form"),
|
|
507
|
+
L.submit(d),
|
|
508
|
+
P(
|
|
509
|
+
l.class("bc-auth-form__fields"),
|
|
510
|
+
r.p(
|
|
511
|
+
l.class("bc-auth-form__description"),
|
|
512
|
+
m.$.magicLinkDescription
|
|
513
|
+
),
|
|
514
|
+
x({
|
|
515
|
+
value: a,
|
|
516
|
+
onChange: (f) => a.set(f)
|
|
517
|
+
}),
|
|
518
|
+
k(
|
|
519
|
+
{
|
|
520
|
+
type: "submit",
|
|
521
|
+
variant: "filled",
|
|
522
|
+
color: "primary",
|
|
523
|
+
loading: u
|
|
524
|
+
},
|
|
525
|
+
l.class("bc-auth-form__submit"),
|
|
526
|
+
m.$.magicLinkSendButton
|
|
527
|
+
)
|
|
528
|
+
)
|
|
529
|
+
)
|
|
530
|
+
),
|
|
531
|
+
y(
|
|
532
|
+
o,
|
|
533
|
+
() => v(
|
|
534
|
+
{ variant: "success", tone: "prominent" },
|
|
535
|
+
r.div(m.$.magicLinkSent)
|
|
536
|
+
)
|
|
537
|
+
)
|
|
538
|
+
)
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
function me({
|
|
542
|
+
client: t,
|
|
543
|
+
autoFill: e,
|
|
544
|
+
onSuccess: a,
|
|
545
|
+
onError: n
|
|
546
|
+
}) {
|
|
547
|
+
const u = b(!1);
|
|
548
|
+
async function o() {
|
|
549
|
+
if (!t.signIn.passkey) return;
|
|
550
|
+
u.set(!0);
|
|
551
|
+
const d = await t.signIn.passkey({ autoFill: e });
|
|
552
|
+
if (u.set(!1), d.error) {
|
|
553
|
+
n?.({ message: d.error.message, status: d.error.status });
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
a?.();
|
|
557
|
+
}
|
|
558
|
+
return S(
|
|
559
|
+
_,
|
|
560
|
+
(d) => k(
|
|
561
|
+
{
|
|
562
|
+
type: "button",
|
|
563
|
+
variant: "outline",
|
|
564
|
+
color: "primary",
|
|
565
|
+
onClick: o,
|
|
566
|
+
loading: u
|
|
567
|
+
},
|
|
568
|
+
l.class("bc-passkey-signin"),
|
|
569
|
+
d.$.passkeySignInButton
|
|
570
|
+
)
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
function fe({
|
|
574
|
+
passkey: t
|
|
575
|
+
}) {
|
|
576
|
+
const e = b([]), a = b(null), n = b(!1), u = b("");
|
|
577
|
+
async function o(c, p) {
|
|
578
|
+
n.set(!0), a.set(null);
|
|
579
|
+
const i = await c();
|
|
580
|
+
if (n.set(!1), i.error) {
|
|
581
|
+
a.set(i.error.message);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
await p?.(i.data);
|
|
585
|
+
}
|
|
586
|
+
async function d() {
|
|
587
|
+
await o(
|
|
588
|
+
() => t.listUserPasskeys(),
|
|
589
|
+
(c) => e.set(c ?? [])
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
async function m() {
|
|
593
|
+
const c = u.value || void 0;
|
|
594
|
+
await o(
|
|
595
|
+
() => t.addPasskey({ name: c }),
|
|
596
|
+
async () => {
|
|
597
|
+
u.set(""), await d();
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
async function f(c) {
|
|
602
|
+
await o(
|
|
603
|
+
() => t.deletePasskey({ id: c }),
|
|
604
|
+
() => d()
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
async function w(c, p) {
|
|
608
|
+
await o(
|
|
609
|
+
() => t.updatePasskey({ id: c, name: p }),
|
|
610
|
+
() => d()
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
return d(), S(
|
|
614
|
+
_,
|
|
615
|
+
(c) => r.div(
|
|
616
|
+
l.class("bc-passkey-management"),
|
|
617
|
+
g(
|
|
618
|
+
a,
|
|
619
|
+
(p) => v(
|
|
620
|
+
{ variant: "danger", tone: "prominent", role: "alert" },
|
|
621
|
+
r.div(p)
|
|
622
|
+
)
|
|
623
|
+
),
|
|
624
|
+
// Passkey list
|
|
625
|
+
r.div(
|
|
626
|
+
l.class("bc-passkey-list"),
|
|
627
|
+
R(e, (p) => {
|
|
628
|
+
const i = b(!1), s = b(p.$.name?.value ?? "");
|
|
629
|
+
return r.div(
|
|
630
|
+
l.class("bc-passkey-item"),
|
|
631
|
+
C(
|
|
632
|
+
i,
|
|
633
|
+
() => r.div(
|
|
634
|
+
l.class("bc-passkey-item__info"),
|
|
635
|
+
r.span(
|
|
636
|
+
l.class("bc-passkey-item__name"),
|
|
637
|
+
p.$.name?.map((h) => h ?? c.$.passkeyUnnamed.value) ?? c.$.passkeyUnnamed
|
|
638
|
+
),
|
|
639
|
+
r.span(
|
|
640
|
+
l.class("bc-passkey-item__date"),
|
|
641
|
+
p.$.createdAt
|
|
642
|
+
)
|
|
643
|
+
)
|
|
644
|
+
),
|
|
645
|
+
y(
|
|
646
|
+
i,
|
|
647
|
+
() => r.div(
|
|
648
|
+
l.class("bc-passkey-item__edit"),
|
|
649
|
+
I({
|
|
650
|
+
value: s,
|
|
651
|
+
onChange: (h) => s.set(h)
|
|
652
|
+
})
|
|
653
|
+
)
|
|
654
|
+
),
|
|
655
|
+
r.div(
|
|
656
|
+
l.class("bc-passkey-item__actions"),
|
|
657
|
+
C(
|
|
658
|
+
i,
|
|
659
|
+
() => r.div(
|
|
660
|
+
k(
|
|
661
|
+
{
|
|
662
|
+
type: "button",
|
|
663
|
+
variant: "text",
|
|
664
|
+
size: "sm",
|
|
665
|
+
onClick: () => {
|
|
666
|
+
s.set(p.$.name?.value ?? ""), i.set(!0);
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
c.$.passkeyRenameButton
|
|
670
|
+
),
|
|
671
|
+
k(
|
|
672
|
+
{
|
|
673
|
+
type: "button",
|
|
674
|
+
variant: "text",
|
|
675
|
+
size: "sm",
|
|
676
|
+
color: "danger",
|
|
677
|
+
onClick: () => f(p.$.id.value)
|
|
678
|
+
},
|
|
679
|
+
c.$.passkeyDeleteButton
|
|
680
|
+
)
|
|
681
|
+
)
|
|
682
|
+
),
|
|
683
|
+
y(
|
|
684
|
+
i,
|
|
685
|
+
() => r.div(
|
|
686
|
+
k(
|
|
687
|
+
{
|
|
688
|
+
type: "button",
|
|
689
|
+
variant: "text",
|
|
690
|
+
size: "sm",
|
|
691
|
+
onClick: async () => {
|
|
692
|
+
await w(
|
|
693
|
+
p.$.id.value,
|
|
694
|
+
s.value
|
|
695
|
+
), i.set(!1);
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
c.$.passkeySaveButton
|
|
699
|
+
),
|
|
700
|
+
k(
|
|
701
|
+
{
|
|
702
|
+
type: "button",
|
|
703
|
+
variant: "text",
|
|
704
|
+
size: "sm",
|
|
705
|
+
onClick: () => i.set(!1)
|
|
706
|
+
},
|
|
707
|
+
c.$.passkeyCancelButton
|
|
708
|
+
)
|
|
709
|
+
)
|
|
710
|
+
)
|
|
711
|
+
)
|
|
712
|
+
);
|
|
713
|
+
})
|
|
714
|
+
),
|
|
715
|
+
// Add passkey
|
|
716
|
+
r.div(
|
|
717
|
+
l.class("bc-passkey-add"),
|
|
718
|
+
P(
|
|
719
|
+
I({
|
|
720
|
+
value: u,
|
|
721
|
+
onChange: (p) => u.set(p),
|
|
722
|
+
placeholder: c.$.passkeyNamePlaceholder
|
|
723
|
+
}),
|
|
724
|
+
k(
|
|
725
|
+
{
|
|
726
|
+
type: "button",
|
|
727
|
+
variant: "filled",
|
|
728
|
+
color: "primary",
|
|
729
|
+
onClick: m,
|
|
730
|
+
loading: n
|
|
731
|
+
},
|
|
732
|
+
c.$.passkeyAddButton
|
|
733
|
+
)
|
|
734
|
+
)
|
|
735
|
+
)
|
|
736
|
+
)
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
export {
|
|
740
|
+
ie as Authenticated,
|
|
741
|
+
ne as BetterAuth,
|
|
742
|
+
re as BetterAuthContainer,
|
|
743
|
+
_ as BetterAuthI18n,
|
|
744
|
+
oe as BetterAuthModal,
|
|
745
|
+
de as MagicLinkForm,
|
|
746
|
+
fe as PasskeyManagement,
|
|
747
|
+
me as PasskeySignIn,
|
|
748
|
+
le as TwoFactorSetup,
|
|
749
|
+
ue as TwoFactorVerify,
|
|
750
|
+
ce as Unauthenticated,
|
|
751
|
+
G as createBetterAuthBridge,
|
|
752
|
+
W as createSessionManager,
|
|
753
|
+
Y as mapSocialProviders
|
|
754
|
+
};
|