@better-auth-ui/heroui 1.6.28 → 1.6.29
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/components/auth/last-login-method/last-used-badge.d.ts +13 -0
- package/dist/components/auth/provider-button.d.ts +3 -1
- package/dist/components/auth/provider-buttons.d.ts +3 -1
- package/dist/index.js +310 -291
- package/dist/lib/auth/last-login-method-plugin.d.ts +12 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +1003 -981
- package/dist/user-view-D9ial2fQ.js +150 -0
- package/package.json +1 -1
- package/src/components/auth/last-login-method/last-used-badge.tsx +40 -0
- package/src/components/auth/magic-link/magic-link.tsx +2 -2
- package/src/components/auth/provider-button.tsx +17 -3
- package/src/components/auth/provider-buttons.tsx +5 -1
- package/src/components/auth/sign-in.tsx +10 -3
- package/src/components/auth/sign-up.tsx +2 -2
- package/src/components/auth/username/sign-in-username.tsx +6 -3
- package/src/lib/auth/last-login-method-plugin.ts +12 -0
- package/src/plugins.ts +2 -0
- package/dist/user-view-CxSDufx_.js +0 -126
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as e, i as t, n, o as r, r as i,
|
|
3
|
-
import { authMutationKeys as
|
|
4
|
-
import { AuthProvider as
|
|
5
|
-
import { ArrowRightFromSquare as
|
|
6
|
-
import { Button as k, Calendar as A, Card as j, Checkbox as M, Chip as
|
|
7
|
-
import { fromDate as
|
|
8
|
-
import { isValidElement as
|
|
2
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./user-view-D9ial2fQ.js";
|
|
3
|
+
import { authMutationKeys as s, authQueryKeys as c, fileToBase64 as l, getProviderName as u, parseAdditionalFieldValue as d, resolveInputType as f } from "@better-auth-ui/core";
|
|
4
|
+
import { AuthProvider as p, providerIcons as m, useAccountInfo as h, useAuth as g, useAuthenticate as _, useChangeEmail as v, useChangePassword as ee, useFetchOptions as te, useLinkSocial as y, useListAccounts as b, useListSessions as x, useRequestPasswordReset as S, useResetPassword as C, useRevokeSession as w, useSendVerificationEmail as ne, useSession as T, useSignInEmail as re, useSignOut as ie, useSignUpEmail as ae, useUnlinkAccount as oe, useUpdateUser as E } from "@better-auth-ui/react";
|
|
5
|
+
import { ArrowRightFromSquare as se, ArrowRightToSquare as ce, Check as le, ChevronsExpandVertical as ue, CloudArrowUpIn as de, Copy as fe, Display as pe, Eye as D, EyeSlash as O, Gear as me, Link as he, LinkSlash as ge, Person as _e, PersonPlus as ve, PlugConnection as ye, Shield as be, Smartphone as xe, TrashBin as Se, Xmark as Ce } from "@gravity-ui/icons";
|
|
6
|
+
import { Button as k, Calendar as A, Card as j, Checkbox as M, Chip as we, ComboBox as Te, DateField as Ee, DatePicker as De, Description as N, Dropdown as P, FieldError as F, Fieldset as I, Form as L, Input as R, InputGroup as z, Label as B, Link as V, ListBox as H, NumberField as Oe, RouterProvider as ke, Select as Ae, Skeleton as U, Slider as je, Spinner as W, Switch as Me, Tabs as G, TextArea as Ne, TextField as K, TimeField as Pe, cn as q, toast as J, useIsHydrated as Fe } from "@heroui/react";
|
|
7
|
+
import { fromDate as Ie, getLocalTimeZone as Le, parseDate as Re, parseDateTime as ze, toCalendarDate as Be, toCalendarDateTime as Ve } from "@internationalized/date";
|
|
8
|
+
import { isValidElement as He, useEffect as Y, useMemo as Ue, useRef as We, useState as X } from "react";
|
|
9
9
|
import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
10
|
-
import { matchMutation as
|
|
11
|
-
import
|
|
10
|
+
import { matchMutation as Ge, matchQuery as Ke, useIsMutating as qe, useQueryClient as Je } from "@tanstack/react-query";
|
|
11
|
+
import Ye from "bowser";
|
|
12
12
|
//#region src/components/auth/additional-field.tsx
|
|
13
|
-
function
|
|
14
|
-
if (e instanceof Date) return
|
|
13
|
+
function Xe(e) {
|
|
14
|
+
if (e instanceof Date) return Be(Ie(e, Le()));
|
|
15
15
|
if (typeof e == "string") try {
|
|
16
|
-
return
|
|
16
|
+
return Re(e.slice(0, 10));
|
|
17
17
|
} catch {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
if (e instanceof Date) return
|
|
21
|
+
function Ze(e) {
|
|
22
|
+
if (e instanceof Date) return Ve(Ie(e, Le()));
|
|
23
23
|
if (typeof e == "string") try {
|
|
24
|
-
return
|
|
24
|
+
return ze(e.replace(/(Z|[+-]\d{2}:?\d{2})$/, ""));
|
|
25
25
|
} catch {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
let { localization: n } =
|
|
29
|
+
function Qe({ getValue: e, isDisabled: t }) {
|
|
30
|
+
let { localization: n } = g(), [r, i] = X(!1);
|
|
31
31
|
async function a() {
|
|
32
32
|
let t = e();
|
|
33
33
|
if (t) try {
|
|
@@ -43,11 +43,11 @@ function Ze({ getValue: e, isDisabled: t }) {
|
|
|
43
43
|
variant: "ghost",
|
|
44
44
|
isDisabled: t,
|
|
45
45
|
onPress: a,
|
|
46
|
-
children: Q(r ?
|
|
46
|
+
children: Q(r ? le : fe, { className: "size-4" })
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
let { localization: i } =
|
|
49
|
+
function $e({ name: e, field: t, isPending: n, variant: r }) {
|
|
50
|
+
let { localization: i } = g(), a = f(t), o = r === "transparent" ? "primary" : "secondary";
|
|
51
51
|
if (t.render) {
|
|
52
52
|
let i = t.render;
|
|
53
53
|
return /* @__PURE__ */ Q(i, {
|
|
@@ -69,7 +69,7 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
69
69
|
isReadOnly: t.readOnly,
|
|
70
70
|
children: [
|
|
71
71
|
/* @__PURE__ */ Q(B, { children: t.label }),
|
|
72
|
-
/* @__PURE__ */ Q(
|
|
72
|
+
/* @__PURE__ */ Q(Ne, {
|
|
73
73
|
placeholder: t.placeholder,
|
|
74
74
|
required: t.required,
|
|
75
75
|
variant: o
|
|
@@ -79,7 +79,7 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
79
79
|
});
|
|
80
80
|
if (a === "number") {
|
|
81
81
|
let r = t.formatOptions?.maximumFractionDigits;
|
|
82
|
-
return /* @__PURE__ */ $(
|
|
82
|
+
return /* @__PURE__ */ $(Oe, {
|
|
83
83
|
name: e,
|
|
84
84
|
defaultValue: typeof t.defaultValue == "number" ? t.defaultValue : t.defaultValue != null && t.defaultValue !== "" ? Number(t.defaultValue) : void 0,
|
|
85
85
|
minValue: t.min,
|
|
@@ -91,13 +91,13 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
91
91
|
variant: o,
|
|
92
92
|
children: [
|
|
93
93
|
/* @__PURE__ */ Q(B, { children: t.label }),
|
|
94
|
-
/* @__PURE__ */ $(
|
|
95
|
-
/* @__PURE__ */ Q(
|
|
96
|
-
/* @__PURE__ */ Q(
|
|
94
|
+
/* @__PURE__ */ $(Oe.Group, { children: [
|
|
95
|
+
/* @__PURE__ */ Q(Oe.DecrementButton, {}),
|
|
96
|
+
/* @__PURE__ */ Q(Oe.Input, {
|
|
97
97
|
placeholder: t.placeholder,
|
|
98
98
|
required: t.required
|
|
99
99
|
}),
|
|
100
|
-
/* @__PURE__ */ Q(
|
|
100
|
+
/* @__PURE__ */ Q(Oe.IncrementButton, {})
|
|
101
101
|
] }),
|
|
102
102
|
/* @__PURE__ */ Q(F, {})
|
|
103
103
|
]
|
|
@@ -105,7 +105,7 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
105
105
|
}
|
|
106
106
|
if (a === "slider") {
|
|
107
107
|
let r = t.formatOptions?.maximumFractionDigits;
|
|
108
|
-
return /* @__PURE__ */ $(
|
|
108
|
+
return /* @__PURE__ */ $(je, {
|
|
109
109
|
defaultValue: typeof t.defaultValue == "number" ? t.defaultValue : t.defaultValue == null ? void 0 : Number(t.defaultValue),
|
|
110
110
|
minValue: t.min ?? 0,
|
|
111
111
|
maxValue: t.max ?? 100,
|
|
@@ -115,16 +115,16 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
115
115
|
className: "flex flex-col gap-2",
|
|
116
116
|
children: [/* @__PURE__ */ $("div", {
|
|
117
117
|
className: "flex items-center justify-between gap-2",
|
|
118
|
-
children: [/* @__PURE__ */ Q(B, { children: t.label }), /* @__PURE__ */ Q(
|
|
119
|
-
}), /* @__PURE__ */ $(
|
|
118
|
+
children: [/* @__PURE__ */ Q(B, { children: t.label }), /* @__PURE__ */ Q(je.Output, { className: "text-sm text-muted" })]
|
|
119
|
+
}), /* @__PURE__ */ $(je.Track, { children: [/* @__PURE__ */ Q(je.Fill, {}), /* @__PURE__ */ Q(je.Thumb, { name: e })] })]
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
if (a === "switch") return /* @__PURE__ */ Q(
|
|
122
|
+
if (a === "switch") return /* @__PURE__ */ Q(Me, {
|
|
123
123
|
name: e,
|
|
124
124
|
defaultSelected: t.defaultValue === !0 || t.defaultValue === "true",
|
|
125
125
|
isDisabled: n,
|
|
126
126
|
isReadOnly: t.readOnly,
|
|
127
|
-
children: /* @__PURE__ */ $(
|
|
127
|
+
children: /* @__PURE__ */ $(Me.Content, { children: [/* @__PURE__ */ Q(Me.Control, { children: /* @__PURE__ */ Q(Me.Thumb, {}) }), t.label] })
|
|
128
128
|
});
|
|
129
129
|
if (a === "checkbox") return /* @__PURE__ */ Q(M, {
|
|
130
130
|
name: e,
|
|
@@ -135,7 +135,7 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
135
135
|
variant: o,
|
|
136
136
|
children: /* @__PURE__ */ $(M.Content, { children: [/* @__PURE__ */ Q(M.Control, { children: /* @__PURE__ */ Q(M.Indicator, {}) }), t.label] })
|
|
137
137
|
});
|
|
138
|
-
if (a === "select") return /* @__PURE__ */ $(
|
|
138
|
+
if (a === "select") return /* @__PURE__ */ $(Ae, {
|
|
139
139
|
className: "[&[data-required=true]>.label]:after:content-none",
|
|
140
140
|
name: e,
|
|
141
141
|
defaultValue: t.defaultValue == null ? void 0 : String(t.defaultValue),
|
|
@@ -146,8 +146,8 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
146
146
|
fullWidth: !0,
|
|
147
147
|
children: [
|
|
148
148
|
/* @__PURE__ */ Q(B, { children: t.label }),
|
|
149
|
-
/* @__PURE__ */ $(
|
|
150
|
-
/* @__PURE__ */ Q(
|
|
149
|
+
/* @__PURE__ */ $(Ae.Trigger, { children: [/* @__PURE__ */ Q(Ae.Value, {}), /* @__PURE__ */ Q(Ae.Indicator, {})] }),
|
|
150
|
+
/* @__PURE__ */ Q(Ae.Popover, { children: /* @__PURE__ */ Q(H, { children: t.options?.map((e) => /* @__PURE__ */ $(H.Item, {
|
|
151
151
|
id: e.value,
|
|
152
152
|
textValue: typeof e.label == "string" ? e.label : e.value,
|
|
153
153
|
children: [e.label, /* @__PURE__ */ Q(H.ItemIndicator, {})]
|
|
@@ -155,7 +155,7 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
155
155
|
/* @__PURE__ */ Q(F, {})
|
|
156
156
|
]
|
|
157
157
|
});
|
|
158
|
-
if (a === "combobox") return /* @__PURE__ */ $(
|
|
158
|
+
if (a === "combobox") return /* @__PURE__ */ $(Te, {
|
|
159
159
|
className: "[&[data-required=true]>.label]:after:content-none",
|
|
160
160
|
name: e,
|
|
161
161
|
defaultSelectedKey: t.defaultValue == null ? void 0 : String(t.defaultValue),
|
|
@@ -166,8 +166,8 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
166
166
|
fullWidth: !0,
|
|
167
167
|
children: [
|
|
168
168
|
/* @__PURE__ */ Q(B, { children: t.label }),
|
|
169
|
-
/* @__PURE__ */ $(
|
|
170
|
-
/* @__PURE__ */ Q(
|
|
169
|
+
/* @__PURE__ */ $(Te.InputGroup, { children: [/* @__PURE__ */ Q(R, { placeholder: t.placeholder }), /* @__PURE__ */ Q(Te.Trigger, {})] }),
|
|
170
|
+
/* @__PURE__ */ Q(Te.Popover, { children: /* @__PURE__ */ Q(H, { children: t.options?.map((e) => /* @__PURE__ */ $(H.Item, {
|
|
171
171
|
id: e.value,
|
|
172
172
|
textValue: typeof e.label == "string" ? e.label : e.value,
|
|
173
173
|
children: [e.label, /* @__PURE__ */ Q(H.ItemIndicator, {})]
|
|
@@ -177,23 +177,23 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
177
177
|
});
|
|
178
178
|
if (a === "date" || a === "datetime") {
|
|
179
179
|
let r = a === "datetime";
|
|
180
|
-
return /* @__PURE__ */ Q(
|
|
180
|
+
return /* @__PURE__ */ Q(De, {
|
|
181
181
|
className: "w-full [&[data-required=true]>.label]:after:content-none",
|
|
182
182
|
name: e,
|
|
183
|
-
defaultValue: r ?
|
|
183
|
+
defaultValue: r ? Ze(t.defaultValue) : Xe(t.defaultValue),
|
|
184
184
|
granularity: r ? "minute" : "day",
|
|
185
185
|
isDisabled: n,
|
|
186
186
|
isReadOnly: t.readOnly,
|
|
187
187
|
isRequired: t.required,
|
|
188
188
|
children: ({ state: n }) => /* @__PURE__ */ $(Z, { children: [
|
|
189
189
|
/* @__PURE__ */ Q(B, { children: t.label }),
|
|
190
|
-
/* @__PURE__ */ $(
|
|
190
|
+
/* @__PURE__ */ $(Ee.Group, {
|
|
191
191
|
variant: o,
|
|
192
192
|
fullWidth: !0,
|
|
193
|
-
children: [/* @__PURE__ */ Q(
|
|
193
|
+
children: [/* @__PURE__ */ Q(Ee.Input, { children: (e) => /* @__PURE__ */ Q(Ee.Segment, { segment: e }) }), /* @__PURE__ */ Q(Ee.Suffix, { children: /* @__PURE__ */ Q(De.Trigger, { children: /* @__PURE__ */ Q(De.TriggerIndicator, {}) }) })]
|
|
194
194
|
}),
|
|
195
195
|
/* @__PURE__ */ Q(F, {}),
|
|
196
|
-
/* @__PURE__ */ $(
|
|
196
|
+
/* @__PURE__ */ $(De.Popover, {
|
|
197
197
|
className: "flex flex-col gap-3",
|
|
198
198
|
children: [/* @__PURE__ */ $(A, {
|
|
199
199
|
"aria-label": typeof t.label == "string" ? t.label : e,
|
|
@@ -208,14 +208,14 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
208
208
|
]
|
|
209
209
|
}), r && /* @__PURE__ */ $("div", {
|
|
210
210
|
className: "flex items-center justify-between",
|
|
211
|
-
children: [/* @__PURE__ */ Q(B, { children: i.settings.time }), /* @__PURE__ */ Q(
|
|
211
|
+
children: [/* @__PURE__ */ Q(B, { children: i.settings.time }), /* @__PURE__ */ Q(Pe, {
|
|
212
212
|
"aria-label": i.settings.time,
|
|
213
213
|
granularity: "minute",
|
|
214
214
|
value: n.timeValue,
|
|
215
215
|
onChange: (e) => n.setTimeValue(e),
|
|
216
|
-
children: /* @__PURE__ */ Q(
|
|
216
|
+
children: /* @__PURE__ */ Q(Pe.Group, {
|
|
217
217
|
variant: "secondary",
|
|
218
|
-
children: /* @__PURE__ */ Q(
|
|
218
|
+
children: /* @__PURE__ */ Q(Pe.Input, { children: (e) => /* @__PURE__ */ Q(Pe.Segment, { segment: e }) })
|
|
219
219
|
})
|
|
220
220
|
})]
|
|
221
221
|
})]
|
|
@@ -223,15 +223,15 @@ function Qe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
223
223
|
] })
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
|
-
return /* @__PURE__ */ Q(
|
|
226
|
+
return /* @__PURE__ */ Q(et, {
|
|
227
227
|
name: e,
|
|
228
228
|
field: t,
|
|
229
229
|
isPending: n,
|
|
230
230
|
variant: r
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
let i =
|
|
233
|
+
function et({ name: e, field: t, isPending: n, variant: r }) {
|
|
234
|
+
let i = We(null), a = r === "transparent" ? "primary" : "secondary", o = t.prefix != null, s = t.suffix != null || t.copyable, c = t.type === "number", l = t.formatOptions?.maximumFractionDigits, u = c ? "number" : void 0, d = c ? l ? "decimal" : "numeric" : void 0, f = l ? 1 / 10 ** l : void 0;
|
|
235
235
|
return o || s ? /* @__PURE__ */ $(K, {
|
|
236
236
|
name: e,
|
|
237
237
|
defaultValue: t.defaultValue == null ? void 0 : String(t.defaultValue),
|
|
@@ -253,7 +253,7 @@ function $e({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
253
253
|
}),
|
|
254
254
|
t.copyable ? /* @__PURE__ */ Q(z.Suffix, {
|
|
255
255
|
className: "px-0",
|
|
256
|
-
children: /* @__PURE__ */ Q(
|
|
256
|
+
children: /* @__PURE__ */ Q(Qe, {
|
|
257
257
|
getValue: () => i.current?.value,
|
|
258
258
|
isDisabled: n
|
|
259
259
|
})
|
|
@@ -283,9 +283,9 @@ function $e({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
283
283
|
}
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/components/auth/reset-link-sent.tsx
|
|
286
|
-
var
|
|
287
|
-
function
|
|
288
|
-
let { basePaths: n, localization:
|
|
286
|
+
var tt = "better-auth-ui.reset-link-sent";
|
|
287
|
+
function nt({ className: e, variant: t }) {
|
|
288
|
+
let { basePaths: n, localization: r, viewPaths: i } = g(), [o, s] = X(Fe() && sessionStorage.getItem("better-auth-ui.reset-link-sent") || "");
|
|
289
289
|
return Y(() => {
|
|
290
290
|
s(sessionStorage.getItem("better-auth-ui.reset-link-sent") ?? "");
|
|
291
291
|
}, []), /* @__PURE__ */ $(j, {
|
|
@@ -294,26 +294,26 @@ function tt({ className: e, variant: t }) {
|
|
|
294
294
|
children: [
|
|
295
295
|
/* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
|
|
296
296
|
className: "text-xl font-semibold mb-1",
|
|
297
|
-
children:
|
|
297
|
+
children: r.auth.checkYourEmailTitle
|
|
298
298
|
}) }),
|
|
299
299
|
/* @__PURE__ */ $(j.Content, {
|
|
300
300
|
className: "gap-4",
|
|
301
301
|
children: [/* @__PURE__ */ Q(N, {
|
|
302
302
|
className: "text-sm",
|
|
303
|
-
children: o ?
|
|
304
|
-
}), o && /* @__PURE__ */ Q(
|
|
303
|
+
children: o ? r.auth.resetLinkSentTo.replace("{{email}}", o) : r.auth.passwordResetEmailSent
|
|
304
|
+
}), o && /* @__PURE__ */ Q(a, { email: o })]
|
|
305
305
|
}),
|
|
306
306
|
/* @__PURE__ */ Q(j.Footer, {
|
|
307
307
|
className: "flex-col gap-3",
|
|
308
308
|
children: /* @__PURE__ */ $(N, {
|
|
309
309
|
className: "text-sm",
|
|
310
310
|
children: [
|
|
311
|
-
|
|
311
|
+
r.auth.rememberYourPassword,
|
|
312
312
|
" ",
|
|
313
313
|
/* @__PURE__ */ Q(V, {
|
|
314
|
-
href: `${n.auth}/${
|
|
314
|
+
href: `${n.auth}/${i.auth.signIn}`,
|
|
315
315
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
316
|
-
children:
|
|
316
|
+
children: r.auth.signIn
|
|
317
317
|
})
|
|
318
318
|
]
|
|
319
319
|
})
|
|
@@ -323,13 +323,13 @@ function tt({ className: e, variant: t }) {
|
|
|
323
323
|
}
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region src/components/auth/forgot-password.tsx
|
|
326
|
-
function
|
|
327
|
-
let { authClient: n, baseURL: r, basePaths: i, localization: a, viewPaths: o, navigate: s, plugins: c } =
|
|
326
|
+
function rt({ className: e, variant: t }) {
|
|
327
|
+
let { authClient: n, baseURL: r, basePaths: i, localization: a, viewPaths: o, navigate: s, plugins: c } = g(), { fetchOptions: l, resetFetchOptions: u } = te(), { mutate: d, isPending: f } = S(n, {
|
|
328
328
|
onError: () => {
|
|
329
329
|
u();
|
|
330
330
|
},
|
|
331
331
|
onSuccess: (e, { email: t }) => {
|
|
332
|
-
sessionStorage.setItem(
|
|
332
|
+
sessionStorage.setItem(tt, t), s({ to: `${i.auth}/${o.auth.resetLinkSent}` });
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
335
|
function p(e) {
|
|
@@ -412,8 +412,8 @@ function nt({ className: e, variant: t }) {
|
|
|
412
412
|
}
|
|
413
413
|
//#endregion
|
|
414
414
|
//#region src/components/auth/reset-password.tsx
|
|
415
|
-
function
|
|
416
|
-
let { authClient: n, basePaths: r, emailAndPassword: i, localization: a, viewPaths: o, navigate: s } =
|
|
415
|
+
function it({ className: e, variant: t }) {
|
|
416
|
+
let { authClient: n, basePaths: r, emailAndPassword: i, localization: a, viewPaths: o, navigate: s } = g(), { mutate: c, isPending: l } = C(n, { onSuccess: () => {
|
|
417
417
|
J.success(a.auth.passwordResetSuccess), s({ to: `${r.auth}/${o.auth.signIn}` });
|
|
418
418
|
} }), [u, d] = X(!1), [f, p] = X(!1);
|
|
419
419
|
Y(() => {
|
|
@@ -564,36 +564,39 @@ function rt({ className: e, variant: t }) {
|
|
|
564
564
|
}
|
|
565
565
|
//#endregion
|
|
566
566
|
//#region src/components/auth/sign-in.tsx
|
|
567
|
-
function
|
|
568
|
-
let { authClient:
|
|
567
|
+
function at({ className: t, socialLayout: n, socialPosition: a = "bottom", variant: o }) {
|
|
568
|
+
let { authClient: c, basePaths: l, emailAndPassword: u, localization: d, plugins: f, redirectTo: p, socialProviders: m, viewPaths: h, navigate: _ } = g(), { fetchOptions: v, resetFetchOptions: ee } = te(), [y, b] = X(""), { mutate: x, isPending: S } = re(c, {
|
|
569
569
|
onError: (e, { email: t }) => {
|
|
570
|
-
|
|
570
|
+
b(""), e.error?.code === "EMAIL_NOT_VERIFIED" && (sessionStorage.setItem("better-auth-ui.verify-email", t), _({ to: `${l.auth}/${h.auth.verifyEmail}` })), ee();
|
|
571
571
|
},
|
|
572
|
-
onSuccess: () =>
|
|
573
|
-
}),
|
|
572
|
+
onSuccess: () => _({ to: p })
|
|
573
|
+
}), C = (e) => {
|
|
574
574
|
e.preventDefault();
|
|
575
575
|
let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
|
|
576
|
-
|
|
576
|
+
x({
|
|
577
577
|
email: n,
|
|
578
|
-
password:
|
|
579
|
-
...
|
|
580
|
-
fetchOptions:
|
|
578
|
+
password: y,
|
|
579
|
+
...u?.rememberMe ? { rememberMe: r } : {},
|
|
580
|
+
fetchOptions: v
|
|
581
581
|
});
|
|
582
|
-
}, w =
|
|
582
|
+
}, w = qe({ mutationKey: s.signIn.all }) + qe({ mutationKey: s.signUp.all }) > 0, ne = f.find((e) => e.captchaComponent)?.captchaComponent, T = u?.enabled && !!m?.length;
|
|
583
583
|
return /* @__PURE__ */ $(j, {
|
|
584
584
|
className: q("w-full max-w-sm gap-4 md:p-6", t),
|
|
585
|
-
variant:
|
|
585
|
+
variant: o,
|
|
586
586
|
children: [
|
|
587
587
|
/* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
|
|
588
588
|
className: "text-xl font-semibold mb-1",
|
|
589
|
-
children:
|
|
589
|
+
children: d.auth.signIn
|
|
590
590
|
}) }),
|
|
591
591
|
/* @__PURE__ */ $(j.Content, {
|
|
592
592
|
className: "gap-4",
|
|
593
593
|
children: [
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
594
|
+
a === "top" && /* @__PURE__ */ $(Z, { children: [!!m?.length && /* @__PURE__ */ Q(i, {
|
|
595
|
+
socialLayout: n,
|
|
596
|
+
view: "signIn"
|
|
597
|
+
}), T && /* @__PURE__ */ Q(r, { children: d.auth.or })] }),
|
|
598
|
+
u?.enabled && /* @__PURE__ */ $(L, {
|
|
599
|
+
onSubmit: C,
|
|
597
600
|
className: "flex flex-col gap-4",
|
|
598
601
|
children: [
|
|
599
602
|
/* @__PURE__ */ $(K, {
|
|
@@ -602,86 +605,96 @@ function it({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
602
605
|
autoComplete: "email",
|
|
603
606
|
isDisabled: w,
|
|
604
607
|
validate: (e) => {
|
|
605
|
-
if (!e) return
|
|
606
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return
|
|
608
|
+
if (!e) return d.auth.fieldRequired;
|
|
609
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return d.auth.invalidEmail;
|
|
607
610
|
},
|
|
608
611
|
children: [
|
|
609
|
-
/* @__PURE__ */ Q(B, { children:
|
|
612
|
+
/* @__PURE__ */ Q(B, { children: d.auth.email }),
|
|
610
613
|
/* @__PURE__ */ Q(R, {
|
|
611
|
-
placeholder:
|
|
612
|
-
variant:
|
|
614
|
+
placeholder: d.auth.emailPlaceholder,
|
|
615
|
+
variant: o === "transparent" ? "primary" : "secondary",
|
|
613
616
|
required: !0
|
|
614
617
|
}),
|
|
615
618
|
/* @__PURE__ */ Q(F, {})
|
|
616
619
|
]
|
|
617
620
|
}),
|
|
618
621
|
/* @__PURE__ */ $(K, {
|
|
619
|
-
minLength:
|
|
620
|
-
maxLength:
|
|
622
|
+
minLength: u?.minPasswordLength,
|
|
623
|
+
maxLength: u?.maxPasswordLength,
|
|
621
624
|
name: "password",
|
|
622
625
|
type: "password",
|
|
623
626
|
autoComplete: "current-password",
|
|
624
627
|
isDisabled: w,
|
|
625
|
-
value:
|
|
626
|
-
onChange:
|
|
628
|
+
value: y,
|
|
629
|
+
onChange: b,
|
|
627
630
|
validate: (e) => {
|
|
628
|
-
if (!e) return
|
|
629
|
-
let t =
|
|
630
|
-
if (t && e.length < t) return
|
|
631
|
-
if (n && e.length > n) return
|
|
631
|
+
if (!e) return d.auth.fieldRequired;
|
|
632
|
+
let t = u?.minPasswordLength, n = u?.maxPasswordLength;
|
|
633
|
+
if (t && e.length < t) return d.auth.tooShort.replace("{{min}}", String(t));
|
|
634
|
+
if (n && e.length > n) return d.auth.tooLong.replace("{{max}}", String(n));
|
|
632
635
|
},
|
|
633
636
|
children: [
|
|
634
|
-
/* @__PURE__ */ Q(B, { children:
|
|
637
|
+
/* @__PURE__ */ Q(B, { children: d.auth.password }),
|
|
635
638
|
/* @__PURE__ */ Q(R, {
|
|
636
|
-
placeholder:
|
|
637
|
-
variant:
|
|
639
|
+
placeholder: d.auth.passwordPlaceholder,
|
|
640
|
+
variant: o === "transparent" ? "primary" : "secondary",
|
|
638
641
|
required: !0
|
|
639
642
|
}),
|
|
640
643
|
/* @__PURE__ */ Q(F, {})
|
|
641
644
|
]
|
|
642
645
|
}),
|
|
643
|
-
|
|
646
|
+
u?.rememberMe && /* @__PURE__ */ Q(M, {
|
|
644
647
|
name: "rememberMe",
|
|
645
648
|
isDisabled: w,
|
|
646
|
-
variant:
|
|
647
|
-
children: /* @__PURE__ */ $(M.Content, { children: [/* @__PURE__ */ Q(M.Control, { children: /* @__PURE__ */ Q(M.Indicator, {}) }),
|
|
649
|
+
variant: o === "transparent" ? "primary" : "secondary",
|
|
650
|
+
children: /* @__PURE__ */ $(M.Content, { children: [/* @__PURE__ */ Q(M.Control, { children: /* @__PURE__ */ Q(M.Indicator, {}) }), d.auth.rememberMe] })
|
|
648
651
|
}),
|
|
649
|
-
|
|
652
|
+
ne && /* @__PURE__ */ Q("div", {
|
|
650
653
|
className: "flex justify-center",
|
|
651
|
-
children:
|
|
654
|
+
children: ne
|
|
652
655
|
}),
|
|
653
656
|
/* @__PURE__ */ $("div", {
|
|
654
657
|
className: "flex flex-col gap-3",
|
|
655
658
|
children: [/* @__PURE__ */ $(k, {
|
|
656
659
|
type: "submit",
|
|
657
|
-
className: "w-full",
|
|
660
|
+
className: "relative w-full overflow-visible",
|
|
658
661
|
isPending: w,
|
|
659
|
-
children: [
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
662
|
+
children: [
|
|
663
|
+
S && /* @__PURE__ */ Q(W, {
|
|
664
|
+
color: "current",
|
|
665
|
+
size: "sm"
|
|
666
|
+
}),
|
|
667
|
+
d.auth.signIn,
|
|
668
|
+
/* @__PURE__ */ Q(e, {
|
|
669
|
+
method: "email",
|
|
670
|
+
floating: !0
|
|
671
|
+
})
|
|
672
|
+
]
|
|
673
|
+
}), f.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ Q(t, { view: "signIn" }, `${e.id}-${n.toString()}`)))]
|
|
664
674
|
})
|
|
665
675
|
]
|
|
666
676
|
}),
|
|
667
|
-
|
|
677
|
+
a === "bottom" && /* @__PURE__ */ $(Z, { children: [T && /* @__PURE__ */ Q(r, { children: d.auth.or }), !!m?.length && /* @__PURE__ */ Q(i, {
|
|
678
|
+
socialLayout: n,
|
|
679
|
+
view: "signIn"
|
|
680
|
+
})] })
|
|
668
681
|
]
|
|
669
682
|
}),
|
|
670
683
|
/* @__PURE__ */ $(j.Footer, {
|
|
671
684
|
className: "flex-col gap-3",
|
|
672
|
-
children: [
|
|
673
|
-
href: `${
|
|
685
|
+
children: [u?.enabled && u?.forgotPassword && /* @__PURE__ */ Q(V, {
|
|
686
|
+
href: `${l.auth}/${h.auth.forgotPassword}`,
|
|
674
687
|
className: "text-sm no-underline hover:underline",
|
|
675
|
-
children:
|
|
676
|
-
}),
|
|
688
|
+
children: d.auth.forgotPasswordLink
|
|
689
|
+
}), u?.enabled && /* @__PURE__ */ $(N, {
|
|
677
690
|
className: "text-sm",
|
|
678
691
|
children: [
|
|
679
|
-
|
|
692
|
+
d.auth.needToCreateAnAccount,
|
|
680
693
|
" ",
|
|
681
694
|
/* @__PURE__ */ Q(V, {
|
|
682
|
-
href: `${
|
|
695
|
+
href: `${l.auth}/${h.auth.signUp}`,
|
|
683
696
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
684
|
-
children:
|
|
697
|
+
children: d.auth.signUp
|
|
685
698
|
})
|
|
686
699
|
]
|
|
687
700
|
})]
|
|
@@ -691,8 +704,8 @@ function it({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
691
704
|
}
|
|
692
705
|
//#endregion
|
|
693
706
|
//#region src/components/auth/sign-out.tsx
|
|
694
|
-
function
|
|
695
|
-
let { authClient: t, basePaths: n, navigate: r, viewPaths: i } =
|
|
707
|
+
function ot({ className: e }) {
|
|
708
|
+
let { authClient: t, basePaths: n, navigate: r, viewPaths: i } = g(), { mutate: a } = ie(t, {
|
|
696
709
|
onError: () => {
|
|
697
710
|
r({
|
|
698
711
|
to: `${n.auth}/${i.auth.signIn}`,
|
|
@@ -703,7 +716,7 @@ function at({ className: e }) {
|
|
|
703
716
|
to: `${n.auth}/${i.auth.signIn}`,
|
|
704
717
|
replace: !0
|
|
705
718
|
})
|
|
706
|
-
}), o =
|
|
719
|
+
}), o = We(!1);
|
|
707
720
|
return Y(() => {
|
|
708
721
|
o.current || (o.current = !0, a());
|
|
709
722
|
}, [a]), /* @__PURE__ */ Q(W, {
|
|
@@ -713,25 +726,25 @@ function at({ className: e }) {
|
|
|
713
726
|
}
|
|
714
727
|
//#endregion
|
|
715
728
|
//#region src/components/auth/sign-up.tsx
|
|
716
|
-
function
|
|
717
|
-
let { additionalFields:
|
|
729
|
+
function st({ className: e, socialLayout: t, socialPosition: n = "bottom", variant: a }) {
|
|
730
|
+
let { additionalFields: o, authClient: c, basePaths: l, emailAndPassword: u, localization: f, plugins: p, redirectTo: m, socialProviders: h, viewPaths: _, navigate: v } = g(), { fetchOptions: ee, resetFetchOptions: y } = te(), [b, x] = X(""), [S, C] = X(""), { mutate: w, isPending: ne } = ae(c, {
|
|
718
731
|
onError: () => {
|
|
719
|
-
|
|
732
|
+
x(""), C(""), y();
|
|
720
733
|
},
|
|
721
734
|
onSuccess: (e, { email: t }) => {
|
|
722
|
-
|
|
735
|
+
u?.requireEmailVerification ? (sessionStorage.setItem("better-auth-ui.verify-email", t), v({ to: `${l.auth}/${_.auth.verifyEmail}` })) : v({ to: m });
|
|
723
736
|
}
|
|
724
|
-
}), [
|
|
737
|
+
}), [T, re] = X(!1), [ie, oe] = X(!1), E = qe({ mutationKey: s.signIn.all }) + qe({ mutationKey: s.signUp.all }) > 0, se = p.find((e) => e.captchaComponent)?.captchaComponent, ce = async (e) => {
|
|
725
738
|
e.preventDefault();
|
|
726
739
|
let t = new FormData(e.currentTarget), n = t.get("name") ?? "", r = t.get("email");
|
|
727
|
-
if (
|
|
728
|
-
J.danger(f.auth.passwordsDoNotMatch),
|
|
740
|
+
if (u?.confirmPassword && b !== S) {
|
|
741
|
+
J.danger(f.auth.passwordsDoNotMatch), x(""), C("");
|
|
729
742
|
return;
|
|
730
743
|
}
|
|
731
744
|
let i = {};
|
|
732
|
-
for (let e of
|
|
745
|
+
for (let e of o ?? []) {
|
|
733
746
|
if (!e.signUp || e.readOnly) continue;
|
|
734
|
-
let n =
|
|
747
|
+
let n = d(e, t.get(e.name));
|
|
735
748
|
if (e.validate) try {
|
|
736
749
|
await e.validate(n);
|
|
737
750
|
} catch (e) {
|
|
@@ -740,16 +753,16 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
740
753
|
}
|
|
741
754
|
n !== void 0 && (i[e.name] = n);
|
|
742
755
|
}
|
|
743
|
-
|
|
756
|
+
w({
|
|
744
757
|
name: n,
|
|
745
758
|
email: r,
|
|
746
|
-
password:
|
|
759
|
+
password: b,
|
|
747
760
|
...i,
|
|
748
|
-
fetchOptions:
|
|
761
|
+
fetchOptions: ee
|
|
749
762
|
});
|
|
750
|
-
}, le =
|
|
763
|
+
}, le = u?.enabled && !!h?.length;
|
|
751
764
|
return /* @__PURE__ */ $(j, {
|
|
752
|
-
className: q("w-full max-w-sm gap-4 md:p-6",
|
|
765
|
+
className: q("w-full max-w-sm gap-4 md:p-6", e),
|
|
753
766
|
variant: a,
|
|
754
767
|
children: [
|
|
755
768
|
/* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
|
|
@@ -759,12 +772,15 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
759
772
|
/* @__PURE__ */ $(j.Content, {
|
|
760
773
|
className: "gap-4",
|
|
761
774
|
children: [
|
|
762
|
-
|
|
763
|
-
|
|
775
|
+
n === "top" && /* @__PURE__ */ $(Z, { children: [!!h?.length && /* @__PURE__ */ Q(i, {
|
|
776
|
+
socialLayout: t,
|
|
777
|
+
view: "signUp"
|
|
778
|
+
}), le && /* @__PURE__ */ Q(r, { children: f.auth.or })] }),
|
|
779
|
+
u?.enabled && /* @__PURE__ */ $(L, {
|
|
764
780
|
onSubmit: ce,
|
|
765
781
|
className: "flex flex-col gap-4",
|
|
766
782
|
children: [
|
|
767
|
-
|
|
783
|
+
u.name !== !1 && /* @__PURE__ */ $(K, {
|
|
768
784
|
name: "name",
|
|
769
785
|
type: "text",
|
|
770
786
|
autoComplete: "name",
|
|
@@ -801,23 +817,23 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
801
817
|
/* @__PURE__ */ Q(F, {})
|
|
802
818
|
]
|
|
803
819
|
}),
|
|
804
|
-
|
|
820
|
+
o?.map((e) => e.signUp === "above" && /* @__PURE__ */ Q($e, {
|
|
805
821
|
name: e.name,
|
|
806
822
|
field: e,
|
|
807
823
|
isPending: E,
|
|
808
824
|
variant: a
|
|
809
825
|
}, e.name)),
|
|
810
826
|
/* @__PURE__ */ $(K, {
|
|
811
|
-
minLength:
|
|
812
|
-
maxLength:
|
|
827
|
+
minLength: u?.minPasswordLength,
|
|
828
|
+
maxLength: u?.maxPasswordLength,
|
|
813
829
|
name: "password",
|
|
814
830
|
autoComplete: "new-password",
|
|
815
831
|
isDisabled: E,
|
|
816
|
-
value:
|
|
817
|
-
onChange:
|
|
832
|
+
value: b,
|
|
833
|
+
onChange: x,
|
|
818
834
|
validate: (e) => {
|
|
819
835
|
if (!e) return f.auth.fieldRequired;
|
|
820
|
-
let t =
|
|
836
|
+
let t = u?.minPasswordLength, n = u?.maxPasswordLength;
|
|
821
837
|
if (t && e.length < t) return f.auth.tooShort.replace("{{min}}", String(t));
|
|
822
838
|
if (n && e.length > n) return f.auth.tooLong.replace("{{max}}", String(n));
|
|
823
839
|
},
|
|
@@ -827,36 +843,36 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
827
843
|
variant: a === "transparent" ? "primary" : "secondary",
|
|
828
844
|
children: [/* @__PURE__ */ Q(z.Input, {
|
|
829
845
|
placeholder: f.auth.passwordPlaceholder,
|
|
830
|
-
type:
|
|
846
|
+
type: T ? "text" : "password",
|
|
831
847
|
name: "password",
|
|
832
848
|
required: !0
|
|
833
849
|
}), /* @__PURE__ */ Q(z.Suffix, {
|
|
834
850
|
className: "px-0",
|
|
835
851
|
children: /* @__PURE__ */ Q(k, {
|
|
836
852
|
isIconOnly: !0,
|
|
837
|
-
"aria-label":
|
|
853
|
+
"aria-label": T ? f.auth.hidePassword : f.auth.showPassword,
|
|
838
854
|
size: "sm",
|
|
839
855
|
variant: "ghost",
|
|
840
|
-
onPress: () => re(!
|
|
856
|
+
onPress: () => re(!T),
|
|
841
857
|
isDisabled: E,
|
|
842
|
-
children: Q(
|
|
858
|
+
children: Q(T ? O : D, {})
|
|
843
859
|
})
|
|
844
860
|
})]
|
|
845
861
|
}),
|
|
846
862
|
/* @__PURE__ */ Q(F, {})
|
|
847
863
|
]
|
|
848
864
|
}),
|
|
849
|
-
|
|
850
|
-
minLength:
|
|
851
|
-
maxLength:
|
|
865
|
+
u?.confirmPassword && /* @__PURE__ */ $(K, {
|
|
866
|
+
minLength: u?.minPasswordLength,
|
|
867
|
+
maxLength: u?.maxPasswordLength,
|
|
852
868
|
name: "confirmPassword",
|
|
853
869
|
autoComplete: "new-password",
|
|
854
870
|
isDisabled: E,
|
|
855
|
-
value:
|
|
856
|
-
onChange:
|
|
871
|
+
value: S,
|
|
872
|
+
onChange: C,
|
|
857
873
|
validate: (e) => {
|
|
858
874
|
if (!e) return f.auth.fieldRequired;
|
|
859
|
-
let t =
|
|
875
|
+
let t = u?.minPasswordLength, n = u?.maxPasswordLength;
|
|
860
876
|
if (t && e.length < t) return f.auth.tooShort.replace("{{min}}", String(t));
|
|
861
877
|
if (n && e.length > n) return f.auth.tooLong.replace("{{max}}", String(n));
|
|
862
878
|
},
|
|
@@ -867,25 +883,25 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
867
883
|
children: [/* @__PURE__ */ Q(z.Input, {
|
|
868
884
|
name: "confirmPassword",
|
|
869
885
|
placeholder: f.auth.confirmPasswordPlaceholder,
|
|
870
|
-
type:
|
|
886
|
+
type: ie ? "text" : "password",
|
|
871
887
|
required: !0
|
|
872
888
|
}), /* @__PURE__ */ Q(z.Suffix, {
|
|
873
889
|
className: "px-0",
|
|
874
890
|
children: /* @__PURE__ */ Q(k, {
|
|
875
891
|
isIconOnly: !0,
|
|
876
|
-
"aria-label":
|
|
892
|
+
"aria-label": ie ? f.auth.hidePassword : f.auth.showPassword,
|
|
877
893
|
size: "sm",
|
|
878
894
|
variant: "ghost",
|
|
879
|
-
onPress: () => oe(!
|
|
895
|
+
onPress: () => oe(!ie),
|
|
880
896
|
isDisabled: E,
|
|
881
|
-
children: Q(
|
|
897
|
+
children: Q(ie ? O : D, {})
|
|
882
898
|
})
|
|
883
899
|
})]
|
|
884
900
|
}),
|
|
885
901
|
/* @__PURE__ */ Q(F, {})
|
|
886
902
|
]
|
|
887
903
|
}),
|
|
888
|
-
|
|
904
|
+
o?.map((e) => e.signUp && e.signUp !== "above" && /* @__PURE__ */ Q($e, {
|
|
889
905
|
name: e.name,
|
|
890
906
|
field: e,
|
|
891
907
|
isPending: E,
|
|
@@ -901,7 +917,7 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
901
917
|
type: "submit",
|
|
902
918
|
className: "w-full",
|
|
903
919
|
isPending: E,
|
|
904
|
-
children: [
|
|
920
|
+
children: [ne && /* @__PURE__ */ Q(W, {
|
|
905
921
|
color: "current",
|
|
906
922
|
size: "sm"
|
|
907
923
|
}), f.auth.signUp]
|
|
@@ -909,7 +925,10 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
909
925
|
})
|
|
910
926
|
]
|
|
911
927
|
}),
|
|
912
|
-
|
|
928
|
+
n === "bottom" && /* @__PURE__ */ $(Z, { children: [le && /* @__PURE__ */ Q(r, { children: f.auth.or }), !!h?.length && /* @__PURE__ */ Q(i, {
|
|
929
|
+
socialLayout: t,
|
|
930
|
+
view: "signUp"
|
|
931
|
+
})] })
|
|
913
932
|
]
|
|
914
933
|
}),
|
|
915
934
|
/* @__PURE__ */ Q(j.Footer, {
|
|
@@ -932,9 +951,9 @@ function ot({ className: t, socialLayout: n, socialPosition: r = "bottom", varia
|
|
|
932
951
|
}
|
|
933
952
|
//#endregion
|
|
934
953
|
//#region src/components/auth/verify-email.tsx
|
|
935
|
-
var
|
|
936
|
-
function
|
|
937
|
-
let { authClient: n, basePaths:
|
|
954
|
+
var ct = 60;
|
|
955
|
+
function lt({ className: e, variant: t }) {
|
|
956
|
+
let { authClient: n, basePaths: r, baseURL: i, localization: o, redirectTo: s, viewPaths: c } = g(), [l, u] = X(Fe() && sessionStorage.getItem("better-auth-ui.verify-email") || ""), [d, f] = X(ct);
|
|
938
957
|
Y(() => {
|
|
939
958
|
u(sessionStorage.getItem("better-auth-ui.verify-email") ?? "");
|
|
940
959
|
}, []), Y(() => {
|
|
@@ -944,9 +963,9 @@ function ct({ className: e, variant: t }) {
|
|
|
944
963
|
}, 1e3);
|
|
945
964
|
return () => clearInterval(e);
|
|
946
965
|
}, [d, l]);
|
|
947
|
-
let { mutate: p, isPending: m } =
|
|
948
|
-
J.success(o.auth.verificationEmailSent), f(
|
|
949
|
-
} }),
|
|
966
|
+
let { mutate: p, isPending: m } = ne(n, { onSuccess: () => {
|
|
967
|
+
J.success(o.auth.verificationEmailSent), f(ct);
|
|
968
|
+
} }), h = d > 0;
|
|
950
969
|
return /* @__PURE__ */ $(j, {
|
|
951
970
|
className: q("w-full max-w-sm gap-4 md:p-6", e),
|
|
952
971
|
variant: t,
|
|
@@ -962,19 +981,19 @@ function ct({ className: e, variant: t }) {
|
|
|
962
981
|
children: o.auth.checkYourEmail
|
|
963
982
|
}), l && /* @__PURE__ */ $("div", {
|
|
964
983
|
className: "flex flex-col gap-3",
|
|
965
|
-
children: [/* @__PURE__ */ Q(
|
|
984
|
+
children: [/* @__PURE__ */ Q(a, { email: l }), /* @__PURE__ */ $(k, {
|
|
966
985
|
className: "w-full",
|
|
967
986
|
variant: "tertiary",
|
|
968
|
-
isDisabled: !l ||
|
|
987
|
+
isDisabled: !l || h || m,
|
|
969
988
|
isPending: m,
|
|
970
989
|
onPress: () => p({
|
|
971
990
|
email: l,
|
|
972
|
-
callbackURL: `${
|
|
991
|
+
callbackURL: `${i}${s}`
|
|
973
992
|
}),
|
|
974
993
|
children: [m && /* @__PURE__ */ Q(W, {
|
|
975
994
|
color: "current",
|
|
976
995
|
size: "sm"
|
|
977
|
-
}),
|
|
996
|
+
}), h ? o.auth.resendIn.replace("{{seconds}}", String(d)) : o.auth.resend]
|
|
978
997
|
})]
|
|
979
998
|
})]
|
|
980
999
|
}),
|
|
@@ -986,7 +1005,7 @@ function ct({ className: e, variant: t }) {
|
|
|
986
1005
|
o.auth.alreadyVerifiedYourEmail,
|
|
987
1006
|
" ",
|
|
988
1007
|
/* @__PURE__ */ Q(V, {
|
|
989
|
-
href: `${
|
|
1008
|
+
href: `${r.auth}/${c.auth.signIn}`,
|
|
990
1009
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
991
1010
|
children: o.auth.signIn
|
|
992
1011
|
})
|
|
@@ -998,24 +1017,24 @@ function ct({ className: e, variant: t }) {
|
|
|
998
1017
|
}
|
|
999
1018
|
//#endregion
|
|
1000
1019
|
//#region src/components/auth/auth.tsx
|
|
1001
|
-
var
|
|
1020
|
+
var ut = [
|
|
1002
1021
|
"signUp",
|
|
1003
1022
|
"forgotPassword",
|
|
1004
1023
|
"resetPassword",
|
|
1005
1024
|
"resetLinkSent"
|
|
1006
|
-
],
|
|
1007
|
-
signIn:
|
|
1008
|
-
signOut:
|
|
1009
|
-
signUp:
|
|
1010
|
-
forgotPassword:
|
|
1011
|
-
resetPassword:
|
|
1012
|
-
resetLinkSent:
|
|
1013
|
-
verifyEmail:
|
|
1025
|
+
], dt = {
|
|
1026
|
+
signIn: at,
|
|
1027
|
+
signOut: ot,
|
|
1028
|
+
signUp: st,
|
|
1029
|
+
forgotPassword: rt,
|
|
1030
|
+
resetPassword: it,
|
|
1031
|
+
resetLinkSent: nt,
|
|
1032
|
+
verifyEmail: lt
|
|
1014
1033
|
};
|
|
1015
|
-
function
|
|
1016
|
-
let { basePaths: o, emailAndPassword: s, plugins: c, viewPaths: l, navigate: u } =
|
|
1034
|
+
function ft({ className: e, path: t, socialLayout: n, socialPosition: r, variant: i, view: a }) {
|
|
1035
|
+
let { basePaths: o, emailAndPassword: s, plugins: c, viewPaths: l, navigate: u } = g();
|
|
1017
1036
|
if (!a && !t) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
|
|
1018
|
-
let d = a || Object.keys(l.auth).find((e) => l.auth[e] === t), f = !s?.enabled && d &&
|
|
1037
|
+
let d = a || Object.keys(l.auth).find((e) => l.auth[e] === t), f = !s?.enabled && d && ut.includes(d);
|
|
1019
1038
|
if (Y(() => {
|
|
1020
1039
|
f && u({
|
|
1021
1040
|
to: `${o.auth}/${l.auth.signIn}`,
|
|
@@ -1047,8 +1066,8 @@ function dt({ className: e, path: t, socialLayout: n, socialPosition: r, variant
|
|
|
1047
1066
|
variant: i
|
|
1048
1067
|
});
|
|
1049
1068
|
}
|
|
1050
|
-
let p = d ?
|
|
1051
|
-
if (!p) throw Error(`[Better Auth UI] Unknown view "${d}". Valid views are: ${Object.keys(
|
|
1069
|
+
let p = d ? dt[d] : void 0;
|
|
1070
|
+
if (!p) throw Error(`[Better Auth UI] Unknown view "${d}". Valid views are: ${Object.keys(dt).join(", ")}`);
|
|
1052
1071
|
return /* @__PURE__ */ Q(p, {
|
|
1053
1072
|
className: e,
|
|
1054
1073
|
socialLayout: n,
|
|
@@ -1058,20 +1077,20 @@ function dt({ className: e, path: t, socialLayout: n, socialPosition: r, variant
|
|
|
1058
1077
|
}
|
|
1059
1078
|
//#endregion
|
|
1060
1079
|
//#region src/components/auth/error-toaster.tsx
|
|
1061
|
-
function
|
|
1062
|
-
let e =
|
|
1080
|
+
function pt() {
|
|
1081
|
+
let e = Je();
|
|
1063
1082
|
return Y(() => {
|
|
1064
1083
|
let t = e.getQueryCache(), n = t.config.onError;
|
|
1065
1084
|
t.config.onError = (e, t) => {
|
|
1066
|
-
if (n?.(e, t), !
|
|
1085
|
+
if (n?.(e, t), !Ke({ queryKey: c.all }, t)) return;
|
|
1067
1086
|
let r = e;
|
|
1068
1087
|
r?.error?.code !== "EMAIL_NOT_VERIFIED" && r?.error && J.danger(r.error.message);
|
|
1069
1088
|
};
|
|
1070
1089
|
let r = e.getMutationCache(), i = r.config.onError;
|
|
1071
1090
|
return r.config.onError = (e, t, n, r, a) => {
|
|
1072
|
-
if (i?.(e, t, n, r, a), !
|
|
1073
|
-
let
|
|
1074
|
-
|
|
1091
|
+
if (i?.(e, t, n, r, a), !Ge({ mutationKey: s.all }, r)) return;
|
|
1092
|
+
let o = e;
|
|
1093
|
+
o.error?.code !== "EMAIL_NOT_VERIFIED" && J.danger(o.error?.message || o.message);
|
|
1075
1094
|
}, () => {
|
|
1076
1095
|
t.config.onError = n, r.config.onError = i;
|
|
1077
1096
|
};
|
|
@@ -1079,20 +1098,20 @@ function ft() {
|
|
|
1079
1098
|
}
|
|
1080
1099
|
//#endregion
|
|
1081
1100
|
//#region src/components/auth/auth-provider.tsx
|
|
1082
|
-
function
|
|
1083
|
-
return /* @__PURE__ */ Q(
|
|
1101
|
+
function mt({ children: e, navigate: t, ...n }) {
|
|
1102
|
+
return /* @__PURE__ */ Q(p, {
|
|
1084
1103
|
navigate: t,
|
|
1085
1104
|
...n,
|
|
1086
|
-
children: /* @__PURE__ */ $(
|
|
1105
|
+
children: /* @__PURE__ */ $(ke, {
|
|
1087
1106
|
navigate: (e) => t({ to: e }),
|
|
1088
|
-
children: [e, /* @__PURE__ */ Q(
|
|
1107
|
+
children: [e, /* @__PURE__ */ Q(pt, {})]
|
|
1089
1108
|
})
|
|
1090
1109
|
});
|
|
1091
1110
|
}
|
|
1092
1111
|
//#endregion
|
|
1093
1112
|
//#region src/components/auth/settings/account/change-email.tsx
|
|
1094
|
-
function
|
|
1095
|
-
let { authClient: r, localization: i, baseURL: a, viewPaths: o } =
|
|
1113
|
+
function ht({ className: e, variant: t, ...n }) {
|
|
1114
|
+
let { authClient: r, localization: i, baseURL: a, viewPaths: o } = g(), { data: s } = T(r), { mutate: c, isPending: l } = v(r, { onSuccess: () => J.success(i.settings.changeEmailSuccess) });
|
|
1096
1115
|
function u(e) {
|
|
1097
1116
|
e.preventDefault(), c({
|
|
1098
1117
|
newEmail: new FormData(e.currentTarget).get("email"),
|
|
@@ -1141,15 +1160,15 @@ function mt({ className: e, variant: t, ...n }) {
|
|
|
1141
1160
|
}
|
|
1142
1161
|
//#endregion
|
|
1143
1162
|
//#region src/components/auth/settings/account/change-avatar.tsx
|
|
1144
|
-
function
|
|
1145
|
-
let { authClient: t, localization: r, avatar: i } =
|
|
1146
|
-
async function
|
|
1163
|
+
function gt({ className: e }) {
|
|
1164
|
+
let { authClient: t, localization: r, avatar: i } = g(), { data: a } = T(t), { mutate: o, isPending: s } = E(t), c = We(null), [u, d] = X(!1), [f, p] = X(!1), m = s || u || f;
|
|
1165
|
+
async function h(e) {
|
|
1147
1166
|
let t = e.target.files?.[0];
|
|
1148
1167
|
if (t) {
|
|
1149
1168
|
e.target.value = "", d(!0);
|
|
1150
1169
|
try {
|
|
1151
1170
|
let e = await i.resize?.(t, i.size, i.extension) || t;
|
|
1152
|
-
o({ image: await i.upload?.(e) || await
|
|
1171
|
+
o({ image: await i.upload?.(e) || await l(e) }, { onSuccess: () => J.success(r.settings.avatarChangedSuccess) });
|
|
1153
1172
|
} catch (e) {
|
|
1154
1173
|
e instanceof Error && J.danger(e.message);
|
|
1155
1174
|
}
|
|
@@ -1178,11 +1197,11 @@ function ht({ className: e }) {
|
|
|
1178
1197
|
children: r.settings.avatar
|
|
1179
1198
|
}),
|
|
1180
1199
|
/* @__PURE__ */ Q("input", {
|
|
1181
|
-
ref:
|
|
1200
|
+
ref: c,
|
|
1182
1201
|
type: "file",
|
|
1183
1202
|
accept: "image/*",
|
|
1184
1203
|
className: "hidden",
|
|
1185
|
-
onChange:
|
|
1204
|
+
onChange: h
|
|
1186
1205
|
}),
|
|
1187
1206
|
/* @__PURE__ */ $("div", {
|
|
1188
1207
|
className: "flex items-center gap-4",
|
|
@@ -1192,7 +1211,7 @@ function ht({ className: e }) {
|
|
|
1192
1211
|
variant: "ghost",
|
|
1193
1212
|
className: "p-0 h-auto w-auto rounded-full",
|
|
1194
1213
|
isDisabled: !a || m,
|
|
1195
|
-
onPress: () =>
|
|
1214
|
+
onPress: () => c.current?.click(),
|
|
1196
1215
|
children: /* @__PURE__ */ Q(n, {
|
|
1197
1216
|
size: "lg",
|
|
1198
1217
|
isPending: m
|
|
@@ -1206,14 +1225,14 @@ function ht({ className: e }) {
|
|
|
1206
1225
|
className: "min-w-fit",
|
|
1207
1226
|
children: /* @__PURE__ */ $(P.Menu, { children: [/* @__PURE__ */ $(P.Item, {
|
|
1208
1227
|
textValue: r.settings.uploadAvatar,
|
|
1209
|
-
onAction: () =>
|
|
1210
|
-
children: [/* @__PURE__ */ Q(
|
|
1228
|
+
onAction: () => c.current?.click(),
|
|
1229
|
+
children: [/* @__PURE__ */ Q(de, { className: "text-muted" }), /* @__PURE__ */ Q(B, { children: r.settings.uploadAvatar })]
|
|
1211
1230
|
}), /* @__PURE__ */ $(P.Item, {
|
|
1212
1231
|
textValue: r.settings.deleteAvatar,
|
|
1213
1232
|
isDisabled: !a?.user.image,
|
|
1214
1233
|
onAction: _,
|
|
1215
1234
|
variant: "danger",
|
|
1216
|
-
children: [/* @__PURE__ */ Q(
|
|
1235
|
+
children: [/* @__PURE__ */ Q(Se, { className: "text-danger" }), /* @__PURE__ */ Q(B, { children: r.settings.deleteAvatar })]
|
|
1217
1236
|
})] })
|
|
1218
1237
|
})] })]
|
|
1219
1238
|
})
|
|
@@ -1222,14 +1241,14 @@ function ht({ className: e }) {
|
|
|
1222
1241
|
}
|
|
1223
1242
|
//#endregion
|
|
1224
1243
|
//#region src/components/auth/settings/account/user-profile.tsx
|
|
1225
|
-
function
|
|
1226
|
-
let { additionalFields: r, authClient: i, localization: a } =
|
|
1244
|
+
function _t({ className: e, variant: t, ...n }) {
|
|
1245
|
+
let { additionalFields: r, authClient: i, localization: a } = g(), { data: o } = T(i), { mutate: s, isPending: c } = E(i, { onSuccess: () => J.success(a.settings.profileUpdatedSuccess) });
|
|
1227
1246
|
async function l(e) {
|
|
1228
1247
|
e.preventDefault();
|
|
1229
1248
|
let t = new FormData(e.currentTarget), n = t.get("name"), i = {};
|
|
1230
1249
|
for (let e of r ?? []) {
|
|
1231
1250
|
if (e.profile === !1 || e.readOnly) continue;
|
|
1232
|
-
let n =
|
|
1251
|
+
let n = d(e, t.get(e.name));
|
|
1233
1252
|
if (e.validate) try {
|
|
1234
1253
|
await e.validate(n);
|
|
1235
1254
|
} catch (e) {
|
|
@@ -1254,7 +1273,7 @@ function gt({ className: e, variant: t, ...n }) {
|
|
|
1254
1273
|
onSubmit: l,
|
|
1255
1274
|
className: "flex flex-col gap-4",
|
|
1256
1275
|
children: [
|
|
1257
|
-
/* @__PURE__ */ Q(
|
|
1276
|
+
/* @__PURE__ */ Q(gt, {}),
|
|
1258
1277
|
/* @__PURE__ */ $(K, {
|
|
1259
1278
|
name: "name",
|
|
1260
1279
|
defaultValue: o?.user.name,
|
|
@@ -1274,7 +1293,7 @@ function gt({ className: e, variant: t, ...n }) {
|
|
|
1274
1293
|
r?.filter((e) => e.profile !== !1).map((e) => {
|
|
1275
1294
|
if (!o) return e.inputType === "hidden" ? null : /* @__PURE__ */ Q(U, { className: "h-10 md:h-9 w-full rounded-xl" }, e.name);
|
|
1276
1295
|
let n = o.user[e.name], r = `${o.user.id}-${e.name}-${n instanceof Date ? n.toISOString() : String(n ?? "")}`;
|
|
1277
|
-
return /* @__PURE__ */ Q(
|
|
1296
|
+
return /* @__PURE__ */ Q($e, {
|
|
1278
1297
|
name: e.name,
|
|
1279
1298
|
field: {
|
|
1280
1299
|
...e,
|
|
@@ -1301,21 +1320,21 @@ function gt({ className: e, variant: t, ...n }) {
|
|
|
1301
1320
|
}
|
|
1302
1321
|
//#endregion
|
|
1303
1322
|
//#region src/components/auth/settings/account/account-settings.tsx
|
|
1304
|
-
function
|
|
1305
|
-
let { emailAndPassword: r, plugins: i } =
|
|
1323
|
+
function vt({ className: e, variant: t, ...n }) {
|
|
1324
|
+
let { emailAndPassword: r, plugins: i } = g(), a = i.some((e) => e.id === "magicLink");
|
|
1306
1325
|
return /* @__PURE__ */ $("div", {
|
|
1307
1326
|
className: q("flex w-full flex-col gap-4 md:gap-6", e),
|
|
1308
1327
|
...n,
|
|
1309
1328
|
children: [
|
|
1310
|
-
/* @__PURE__ */ Q(
|
|
1311
|
-
(r?.enabled || a) && /* @__PURE__ */ Q(
|
|
1329
|
+
/* @__PURE__ */ Q(_t, { variant: t }),
|
|
1330
|
+
(r?.enabled || a) && /* @__PURE__ */ Q(ht, { variant: t }),
|
|
1312
1331
|
i.flatMap((e) => e.accountCards?.map((n, r) => /* @__PURE__ */ Q(n, { variant: t }, `${e.id}-${r.toString()}`)))
|
|
1313
1332
|
]
|
|
1314
1333
|
});
|
|
1315
1334
|
}
|
|
1316
1335
|
//#endregion
|
|
1317
1336
|
//#region src/components/auth/settings/security/active-session.tsx
|
|
1318
|
-
function
|
|
1337
|
+
function yt(e) {
|
|
1319
1338
|
let t = Math.floor((Date.now() - e.getTime()) / 1e3), n = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
1320
1339
|
for (let [e, r] of [
|
|
1321
1340
|
["year", 31536e3],
|
|
@@ -1328,27 +1347,27 @@ function vt(e) {
|
|
|
1328
1347
|
]) if (t >= r) return n.format(-Math.floor(t / r), e);
|
|
1329
1348
|
return n.format(0, "second");
|
|
1330
1349
|
}
|
|
1331
|
-
function
|
|
1332
|
-
let { authClient: t, basePaths: n, localization: r, viewPaths: i, navigate: a } =
|
|
1350
|
+
function bt({ activeSession: e }) {
|
|
1351
|
+
let { authClient: t, basePaths: n, localization: r, viewPaths: i, navigate: a } = g(), { data: o } = T(t, { refetchOnMount: !1 }), { mutate: s, isPending: c } = w(t, { onSuccess: () => J.success(r.settings.revokeSessionSuccess) }), l = e.token === o?.session.token, u = Ye.parse(e.userAgent || "");
|
|
1333
1352
|
return /* @__PURE__ */ $("div", {
|
|
1334
1353
|
className: "flex items-center gap-3",
|
|
1335
1354
|
children: [
|
|
1336
1355
|
/* @__PURE__ */ Q("div", {
|
|
1337
1356
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
1338
|
-
children: u.platform.type === "mobile" || u.platform.type === "tablet" ? /* @__PURE__ */ Q(
|
|
1357
|
+
children: u.platform.type === "mobile" || u.platform.type === "tablet" ? /* @__PURE__ */ Q(xe, { className: "size-4.5" }) : /* @__PURE__ */ Q(pe, { className: "size-4.5" })
|
|
1339
1358
|
}),
|
|
1340
1359
|
/* @__PURE__ */ $("div", {
|
|
1341
1360
|
className: "flex flex-col min-w-0",
|
|
1342
1361
|
children: [/* @__PURE__ */ $("span", {
|
|
1343
1362
|
className: "text-sm font-medium truncate",
|
|
1344
1363
|
children: [u.browser.name || "Unknown Browser", u.os.name ? `, ${u.os.name}` : ""]
|
|
1345
|
-
}), l ? /* @__PURE__ */ Q(
|
|
1364
|
+
}), l ? /* @__PURE__ */ Q(we, {
|
|
1346
1365
|
color: "accent",
|
|
1347
1366
|
size: "sm",
|
|
1348
1367
|
children: r.settings.currentSession
|
|
1349
1368
|
}) : e.createdAt && /* @__PURE__ */ Q("span", {
|
|
1350
1369
|
className: "text-xs text-muted capitalize",
|
|
1351
|
-
children:
|
|
1370
|
+
children: yt(e.createdAt)
|
|
1352
1371
|
})]
|
|
1353
1372
|
}),
|
|
1354
1373
|
/* @__PURE__ */ $(k, {
|
|
@@ -1361,15 +1380,15 @@ function yt({ activeSession: e }) {
|
|
|
1361
1380
|
children: [c ? /* @__PURE__ */ Q(W, {
|
|
1362
1381
|
color: "current",
|
|
1363
1382
|
size: "sm"
|
|
1364
|
-
}) : Q(l ?
|
|
1383
|
+
}) : Q(l ? se : Ce, {}), l ? r.auth.signOut : r.settings.revoke]
|
|
1365
1384
|
})
|
|
1366
1385
|
]
|
|
1367
1386
|
});
|
|
1368
1387
|
}
|
|
1369
1388
|
//#endregion
|
|
1370
1389
|
//#region src/components/auth/settings/security/active-sessions.tsx
|
|
1371
|
-
function
|
|
1372
|
-
let { authClient: r, localization: i } =
|
|
1390
|
+
function xt({ className: e, variant: t, ...n }) {
|
|
1391
|
+
let { authClient: r, localization: i } = g(), { data: a } = T(r), { data: o, isPending: s } = x(r), c = o && [...o].sort((e, t) => e.id === a?.session.id ? -1 : +(t.id === a?.session.id));
|
|
1373
1392
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1374
1393
|
className: q("text-sm font-semibold mb-3"),
|
|
1375
1394
|
children: i.settings.activeSessions
|
|
@@ -1379,11 +1398,11 @@ function bt({ className: e, variant: t, ...n }) {
|
|
|
1379
1398
|
...n,
|
|
1380
1399
|
children: /* @__PURE__ */ Q(j.Content, {
|
|
1381
1400
|
className: "gap-0",
|
|
1382
|
-
children: s ? /* @__PURE__ */ Q(
|
|
1401
|
+
children: s ? /* @__PURE__ */ Q(St, {}) : c?.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(bt, { activeSession: e })] }, e.id))
|
|
1383
1402
|
})
|
|
1384
1403
|
})] });
|
|
1385
1404
|
}
|
|
1386
|
-
function
|
|
1405
|
+
function St() {
|
|
1387
1406
|
return /* @__PURE__ */ Q("div", {
|
|
1388
1407
|
className: "flex items-center justify-between",
|
|
1389
1408
|
children: /* @__PURE__ */ $("div", {
|
|
@@ -1397,13 +1416,13 @@ function xt() {
|
|
|
1397
1416
|
}
|
|
1398
1417
|
//#endregion
|
|
1399
1418
|
//#region src/components/auth/settings/security/change-password.tsx
|
|
1400
|
-
function
|
|
1401
|
-
let { authClient: r, emailAndPassword: i, localization: a } =
|
|
1402
|
-
return !c && !l ? /* @__PURE__ */ Q(
|
|
1419
|
+
function Ct({ className: e, variant: t, ...n }) {
|
|
1420
|
+
let { authClient: r, emailAndPassword: i, localization: a } = g(), { data: o } = T(r), { data: s, isPending: c } = b(r), l = s?.some((e) => e.providerId === "credential");
|
|
1421
|
+
return !c && !l ? /* @__PURE__ */ Q(wt, {
|
|
1403
1422
|
className: e,
|
|
1404
1423
|
variant: t,
|
|
1405
1424
|
...n
|
|
1406
|
-
}) : /* @__PURE__ */ Q(
|
|
1425
|
+
}) : /* @__PURE__ */ Q(Tt, {
|
|
1407
1426
|
className: e,
|
|
1408
1427
|
variant: t,
|
|
1409
1428
|
emailAndPassword: i,
|
|
@@ -1412,15 +1431,15 @@ function St({ className: e, variant: t, ...n }) {
|
|
|
1412
1431
|
...n
|
|
1413
1432
|
});
|
|
1414
1433
|
}
|
|
1415
|
-
function
|
|
1416
|
-
let { authClient:
|
|
1434
|
+
function wt({ className: e, variant: t, ...n }) {
|
|
1435
|
+
let { authClient: r, localization: i, plugins: o } = g(), { data: s } = T(r), { fetchOptions: c, resetFetchOptions: l } = te(), [u, d] = X(""), { mutate: f, isPending: p } = S(r, {
|
|
1417
1436
|
onError: () => {
|
|
1418
1437
|
l();
|
|
1419
1438
|
},
|
|
1420
1439
|
onSuccess: (e, { email: t }) => {
|
|
1421
1440
|
d(t);
|
|
1422
1441
|
}
|
|
1423
|
-
}), m = o.find((e) => e.captchaComponent)?.captchaComponent,
|
|
1442
|
+
}), m = o.find((e) => e.captchaComponent)?.captchaComponent, h = () => {
|
|
1424
1443
|
s?.user.email && f({
|
|
1425
1444
|
email: s.user.email,
|
|
1426
1445
|
fetchOptions: c
|
|
@@ -1428,7 +1447,7 @@ function Ct({ className: e, variant: t, ...n }) {
|
|
|
1428
1447
|
};
|
|
1429
1448
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1430
1449
|
className: q("text-sm font-semibold mb-3"),
|
|
1431
|
-
children:
|
|
1450
|
+
children: i.settings.changePassword
|
|
1432
1451
|
}), /* @__PURE__ */ Q(j, {
|
|
1433
1452
|
className: q(e),
|
|
1434
1453
|
variant: t,
|
|
@@ -1437,17 +1456,17 @@ function Ct({ className: e, variant: t, ...n }) {
|
|
|
1437
1456
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1438
1457
|
children: [/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("p", {
|
|
1439
1458
|
className: "text-sm font-medium leading-tight",
|
|
1440
|
-
children:
|
|
1459
|
+
children: i.settings.setPassword
|
|
1441
1460
|
}), /* @__PURE__ */ Q("p", {
|
|
1442
1461
|
className: "text-muted text-xs mt-0.5",
|
|
1443
|
-
children:
|
|
1462
|
+
children: i.settings.setPasswordDescription
|
|
1444
1463
|
})] }), u ? /* @__PURE__ */ $("div", {
|
|
1445
1464
|
className: "flex flex-col gap-3 items-start sm:items-end",
|
|
1446
1465
|
children: [/* @__PURE__ */ Q("p", {
|
|
1447
1466
|
className: "text-sm",
|
|
1448
1467
|
role: "status",
|
|
1449
|
-
children:
|
|
1450
|
-
}), /* @__PURE__ */ Q(
|
|
1468
|
+
children: i.auth.resetLinkSentTo.replace("{{email}}", u)
|
|
1469
|
+
}), /* @__PURE__ */ Q(a, {
|
|
1451
1470
|
email: u,
|
|
1452
1471
|
className: "w-auto"
|
|
1453
1472
|
})]
|
|
@@ -1457,25 +1476,25 @@ function Ct({ className: e, variant: t, ...n }) {
|
|
|
1457
1476
|
size: "sm",
|
|
1458
1477
|
isPending: p,
|
|
1459
1478
|
isDisabled: !s?.user.email,
|
|
1460
|
-
onPress:
|
|
1479
|
+
onPress: h,
|
|
1461
1480
|
children: [p && /* @__PURE__ */ Q(W, {
|
|
1462
1481
|
color: "current",
|
|
1463
1482
|
size: "sm"
|
|
1464
|
-
}),
|
|
1483
|
+
}), i.auth.sendResetLink]
|
|
1465
1484
|
})]
|
|
1466
1485
|
})]
|
|
1467
1486
|
})
|
|
1468
1487
|
})] });
|
|
1469
1488
|
}
|
|
1470
|
-
function
|
|
1471
|
-
let { authClient: o } =
|
|
1489
|
+
function Tt({ className: e, variant: t, emailAndPassword: n, localization: r, session: i, ...a }) {
|
|
1490
|
+
let { authClient: o } = g(), [s, c] = X(""), [l, u] = X(""), [d, f] = X(""), { mutate: p, isPending: m } = ee(o, {
|
|
1472
1491
|
onError: () => {
|
|
1473
1492
|
c(""), u(""), f("");
|
|
1474
1493
|
},
|
|
1475
1494
|
onSuccess: () => {
|
|
1476
1495
|
c(""), u(""), f(""), J.success(r.settings.changePasswordSuccess);
|
|
1477
1496
|
}
|
|
1478
|
-
}), [
|
|
1497
|
+
}), [h, _] = X(!1), [v, te] = X(!1), y = (e) => {
|
|
1479
1498
|
if (e.preventDefault(), n?.confirmPassword && l !== d) {
|
|
1480
1499
|
c(""), u(""), f(""), J.danger(r.auth.passwordsDoNotMatch);
|
|
1481
1500
|
return;
|
|
@@ -1494,7 +1513,7 @@ function wt({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1494
1513
|
variant: t,
|
|
1495
1514
|
...a,
|
|
1496
1515
|
children: /* @__PURE__ */ Q(j.Content, { children: /* @__PURE__ */ Q(L, {
|
|
1497
|
-
onSubmit:
|
|
1516
|
+
onSubmit: y,
|
|
1498
1517
|
children: /* @__PURE__ */ $(I, {
|
|
1499
1518
|
className: "w-full gap-4",
|
|
1500
1519
|
children: [/* @__PURE__ */ $(I.Group, { children: [
|
|
@@ -1531,7 +1550,7 @@ function wt({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1531
1550
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
1532
1551
|
children: [/* @__PURE__ */ Q(z.Input, {
|
|
1533
1552
|
name: "newPassword",
|
|
1534
|
-
type:
|
|
1553
|
+
type: h ? "text" : "password",
|
|
1535
1554
|
autoComplete: "new-password",
|
|
1536
1555
|
placeholder: r.auth.newPasswordPlaceholder,
|
|
1537
1556
|
required: !0
|
|
@@ -1539,12 +1558,12 @@ function wt({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1539
1558
|
className: "px-0",
|
|
1540
1559
|
children: /* @__PURE__ */ Q(k, {
|
|
1541
1560
|
isIconOnly: !0,
|
|
1542
|
-
"aria-label":
|
|
1561
|
+
"aria-label": h ? r.auth.hidePassword : r.auth.showPassword,
|
|
1543
1562
|
size: "sm",
|
|
1544
1563
|
variant: "ghost",
|
|
1545
|
-
onPress: () => _(!
|
|
1564
|
+
onPress: () => _(!h),
|
|
1546
1565
|
isDisabled: m,
|
|
1547
|
-
children: Q(
|
|
1566
|
+
children: Q(h ? O : D, {})
|
|
1548
1567
|
})
|
|
1549
1568
|
})]
|
|
1550
1569
|
}),
|
|
@@ -1566,7 +1585,7 @@ function wt({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1566
1585
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
1567
1586
|
children: [/* @__PURE__ */ Q(z.Input, {
|
|
1568
1587
|
name: "confirmPassword",
|
|
1569
|
-
type:
|
|
1588
|
+
type: v ? "text" : "password",
|
|
1570
1589
|
autoComplete: "new-password",
|
|
1571
1590
|
placeholder: r.auth.confirmPasswordPlaceholder,
|
|
1572
1591
|
required: !0
|
|
@@ -1574,12 +1593,12 @@ function wt({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1574
1593
|
className: "px-0",
|
|
1575
1594
|
children: /* @__PURE__ */ Q(k, {
|
|
1576
1595
|
isIconOnly: !0,
|
|
1577
|
-
"aria-label":
|
|
1596
|
+
"aria-label": v ? r.auth.hidePassword : r.auth.showPassword,
|
|
1578
1597
|
size: "sm",
|
|
1579
1598
|
variant: "ghost",
|
|
1580
|
-
onPress: () =>
|
|
1599
|
+
onPress: () => te(!v),
|
|
1581
1600
|
isDisabled: m,
|
|
1582
|
-
children: Q(
|
|
1601
|
+
children: Q(v ? O : D, {})
|
|
1583
1602
|
})
|
|
1584
1603
|
})]
|
|
1585
1604
|
}),
|
|
@@ -1603,36 +1622,36 @@ function wt({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1603
1622
|
}
|
|
1604
1623
|
//#endregion
|
|
1605
1624
|
//#region src/components/auth/settings/security/linked-account.tsx
|
|
1606
|
-
function
|
|
1607
|
-
let { authClient: n, baseURL: r, localization: i } =
|
|
1625
|
+
function Et({ account: e, provider: t }) {
|
|
1626
|
+
let { authClient: n, baseURL: r, localization: i } = g(), { data: a, isPending: o } = h(n, { query: { accountId: e?.accountId } }), { mutate: s, isPending: c } = y(n), { mutate: l, isPending: d } = oe(n, { onSuccess: () => J.success(i.settings.accountUnlinked) }), f = m[t], p = u(t), _ = a?.data?.login || a?.data?.username || a?.user?.email || a?.user?.name || e?.accountId;
|
|
1608
1627
|
return /* @__PURE__ */ $("div", {
|
|
1609
1628
|
className: "flex items-center gap-3",
|
|
1610
1629
|
children: [
|
|
1611
1630
|
/* @__PURE__ */ Q("div", {
|
|
1612
1631
|
className: q("flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary"),
|
|
1613
|
-
children: Q(f ||
|
|
1632
|
+
children: Q(f || ye, { className: "size-4.5" })
|
|
1614
1633
|
}),
|
|
1615
1634
|
/* @__PURE__ */ $("div", {
|
|
1616
1635
|
className: "flex flex-col min-w-0",
|
|
1617
1636
|
children: [/* @__PURE__ */ Q("span", {
|
|
1618
1637
|
className: "text-sm font-medium leading-tight",
|
|
1619
|
-
children:
|
|
1638
|
+
children: p
|
|
1620
1639
|
}), e && o ? /* @__PURE__ */ Q(U, { className: "h-3 w-24 my-0.5 rounded-lg" }) : /* @__PURE__ */ Q("span", {
|
|
1621
1640
|
className: "text-xs text-muted truncate",
|
|
1622
|
-
children: e ? _ : i.settings.linkProvider.replace("{{provider}}",
|
|
1641
|
+
children: e ? _ : i.settings.linkProvider.replace("{{provider}}", p)
|
|
1623
1642
|
})]
|
|
1624
1643
|
}),
|
|
1625
1644
|
e ? /* @__PURE__ */ $(k, {
|
|
1626
1645
|
className: "ml-auto shrink-0",
|
|
1627
1646
|
variant: "outline",
|
|
1628
1647
|
size: "sm",
|
|
1629
|
-
onPress: () =>
|
|
1648
|
+
onPress: () => l({ providerId: e.providerId }),
|
|
1630
1649
|
isPending: d,
|
|
1631
|
-
"aria-label": i.settings.unlinkProvider.replace("{{provider}}",
|
|
1650
|
+
"aria-label": i.settings.unlinkProvider.replace("{{provider}}", p),
|
|
1632
1651
|
children: [d ? /* @__PURE__ */ Q(W, {
|
|
1633
1652
|
color: "current",
|
|
1634
1653
|
size: "sm"
|
|
1635
|
-
}) : /* @__PURE__ */ Q(
|
|
1654
|
+
}) : /* @__PURE__ */ Q(ge, {}), i.settings.unlinkProvider.replace("{{provider}}", "").trim()]
|
|
1636
1655
|
}) : /* @__PURE__ */ $(k, {
|
|
1637
1656
|
className: "ml-auto shrink-0",
|
|
1638
1657
|
variant: "outline",
|
|
@@ -1642,19 +1661,19 @@ function Tt({ account: e, provider: t }) {
|
|
|
1642
1661
|
callbackURL: `${r}${window.location.pathname}`
|
|
1643
1662
|
}),
|
|
1644
1663
|
isPending: c,
|
|
1645
|
-
"aria-label": i.settings.linkProvider.replace("{{provider}}",
|
|
1664
|
+
"aria-label": i.settings.linkProvider.replace("{{provider}}", p),
|
|
1646
1665
|
children: [c ? /* @__PURE__ */ Q(W, {
|
|
1647
1666
|
color: "current",
|
|
1648
1667
|
size: "sm"
|
|
1649
|
-
}) : /* @__PURE__ */ Q(
|
|
1668
|
+
}) : /* @__PURE__ */ Q(he, {}), i.settings.link]
|
|
1650
1669
|
})
|
|
1651
1670
|
]
|
|
1652
1671
|
});
|
|
1653
1672
|
}
|
|
1654
1673
|
//#endregion
|
|
1655
1674
|
//#region src/components/auth/settings/security/linked-accounts.tsx
|
|
1656
|
-
function
|
|
1657
|
-
let { authClient: r, localization: i, multipleAccountsPerProvider: a, socialProviders: o } =
|
|
1675
|
+
function Dt({ className: e, variant: t, ...n }) {
|
|
1676
|
+
let { authClient: r, localization: i, multipleAccountsPerProvider: a, socialProviders: o } = g(), { data: s, isPending: c } = b(r), l = s?.filter((e) => e.providerId !== "credential"), u = new Set(l?.map((e) => e.providerId)), d = a === !1 ? o?.filter((e) => !u.has(e)) : o, f = [...l?.map((e) => ({
|
|
1658
1677
|
key: e.id,
|
|
1659
1678
|
account: e,
|
|
1660
1679
|
provider: e.providerId
|
|
@@ -1672,14 +1691,14 @@ function Et({ className: e, variant: t, ...n }) {
|
|
|
1672
1691
|
...n,
|
|
1673
1692
|
children: /* @__PURE__ */ Q(j.Content, {
|
|
1674
1693
|
className: "gap-0",
|
|
1675
|
-
children: c ? o?.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(
|
|
1694
|
+
children: c ? o?.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(Ot, {})] }, e)) : f.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(Et, {
|
|
1676
1695
|
account: e.account,
|
|
1677
1696
|
provider: e.provider
|
|
1678
1697
|
})] }, e.key))
|
|
1679
1698
|
})
|
|
1680
1699
|
})] });
|
|
1681
1700
|
}
|
|
1682
|
-
function
|
|
1701
|
+
function Ot() {
|
|
1683
1702
|
return /* @__PURE__ */ Q("div", {
|
|
1684
1703
|
className: "flex items-center justify-between",
|
|
1685
1704
|
children: /* @__PURE__ */ $("div", {
|
|
@@ -1693,26 +1712,26 @@ function Dt() {
|
|
|
1693
1712
|
}
|
|
1694
1713
|
//#endregion
|
|
1695
1714
|
//#region src/components/auth/settings/security/security-settings.tsx
|
|
1696
|
-
function
|
|
1697
|
-
let { emailAndPassword: r, plugins: i, socialProviders: a } =
|
|
1715
|
+
function kt({ className: e, variant: t, ...n }) {
|
|
1716
|
+
let { emailAndPassword: r, plugins: i, socialProviders: a } = g();
|
|
1698
1717
|
return /* @__PURE__ */ $("div", {
|
|
1699
1718
|
className: q("flex w-full flex-col gap-4 md:gap-6", e),
|
|
1700
1719
|
...n,
|
|
1701
1720
|
children: [
|
|
1702
|
-
r?.enabled && /* @__PURE__ */ Q(
|
|
1703
|
-
!!a?.length && /* @__PURE__ */ Q(
|
|
1704
|
-
/* @__PURE__ */ Q(
|
|
1721
|
+
r?.enabled && /* @__PURE__ */ Q(Ct, { variant: t }),
|
|
1722
|
+
!!a?.length && /* @__PURE__ */ Q(Dt, { variant: t }),
|
|
1723
|
+
/* @__PURE__ */ Q(xt, { variant: t }),
|
|
1705
1724
|
i.flatMap((e) => e.securityCards?.map((n, r) => /* @__PURE__ */ Q(n, { variant: t }, `${e.id}-${r.toString()}`)))
|
|
1706
1725
|
]
|
|
1707
1726
|
});
|
|
1708
1727
|
}
|
|
1709
1728
|
//#endregion
|
|
1710
1729
|
//#region src/components/auth/settings/settings.tsx
|
|
1711
|
-
function
|
|
1730
|
+
function At({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
1712
1731
|
if (!i && !n) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
|
|
1713
|
-
let { authClient: o, basePaths: s, localization: c, viewPaths: l, plugins: u } =
|
|
1714
|
-
|
|
1715
|
-
let d =
|
|
1732
|
+
let { authClient: o, basePaths: s, localization: c, viewPaths: l, plugins: u } = g();
|
|
1733
|
+
_(o);
|
|
1734
|
+
let d = Ue(() => {
|
|
1716
1735
|
if (i) return i;
|
|
1717
1736
|
if (n) return [l.settings, ...u.map((e) => e.viewPaths?.settings)].flatMap((e) => Object.entries(e ?? {})).find(([, e]) => e === n)?.[0];
|
|
1718
1737
|
}, [
|
|
@@ -1744,7 +1763,7 @@ function kt({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
1744
1763
|
inline: "center"
|
|
1745
1764
|
}),
|
|
1746
1765
|
children: [
|
|
1747
|
-
/* @__PURE__ */ Q(
|
|
1766
|
+
/* @__PURE__ */ Q(_e, { className: "text-muted" }),
|
|
1748
1767
|
c.settings.account,
|
|
1749
1768
|
/* @__PURE__ */ Q(G.Indicator, {})
|
|
1750
1769
|
]
|
|
@@ -1758,7 +1777,7 @@ function kt({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
1758
1777
|
inline: "center"
|
|
1759
1778
|
}),
|
|
1760
1779
|
children: [
|
|
1761
|
-
/* @__PURE__ */ Q(
|
|
1780
|
+
/* @__PURE__ */ Q(be, { className: "text-muted" }),
|
|
1762
1781
|
c.settings.security,
|
|
1763
1782
|
/* @__PURE__ */ Q(G.Indicator, {})
|
|
1764
1783
|
]
|
|
@@ -1778,12 +1797,12 @@ function kt({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
1778
1797
|
/* @__PURE__ */ Q(G.Panel, {
|
|
1779
1798
|
id: "account",
|
|
1780
1799
|
className: "px-0",
|
|
1781
|
-
children: /* @__PURE__ */ Q(
|
|
1800
|
+
children: /* @__PURE__ */ Q(vt, { variant: r })
|
|
1782
1801
|
}),
|
|
1783
1802
|
/* @__PURE__ */ Q(G.Panel, {
|
|
1784
1803
|
id: "security",
|
|
1785
1804
|
className: "px-0",
|
|
1786
|
-
children: /* @__PURE__ */ Q(
|
|
1805
|
+
children: /* @__PURE__ */ Q(kt, { variant: r })
|
|
1787
1806
|
}),
|
|
1788
1807
|
u.flatMap((e) => e.settingsTabs?.map((t, n) => /* @__PURE__ */ Q(G.Panel, {
|
|
1789
1808
|
id: t.view,
|
|
@@ -1795,8 +1814,8 @@ function kt({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
1795
1814
|
}
|
|
1796
1815
|
//#endregion
|
|
1797
1816
|
//#region src/components/auth/user/user-button.tsx
|
|
1798
|
-
function
|
|
1799
|
-
if (
|
|
1817
|
+
function jt(e, t) {
|
|
1818
|
+
if (He(e)) return e;
|
|
1800
1819
|
let { label: n, href: r, icon: i, variant: a } = e;
|
|
1801
1820
|
return /* @__PURE__ */ $(P.Item, {
|
|
1802
1821
|
href: r,
|
|
@@ -1805,13 +1824,13 @@ function At(e, t) {
|
|
|
1805
1824
|
children: [i, /* @__PURE__ */ Q(B, { children: n })]
|
|
1806
1825
|
}, t);
|
|
1807
1826
|
}
|
|
1808
|
-
function
|
|
1809
|
-
let { authClient: l, basePaths: u, viewPaths: d, localization: f, plugins: p } =
|
|
1810
|
-
if (!
|
|
1827
|
+
function Mt({ className: e, placement: t, size: r = "default", variant: i = "ghost", links: a, hideSettings: s, hideSubtitle: c }) {
|
|
1828
|
+
let { authClient: l, basePaths: u, viewPaths: d, localization: f, plugins: p } = g(), { data: m, isPending: h } = T(l), _ = p.flatMap((e) => e.userMenuItems?.map((t, n) => /* @__PURE__ */ Q(t, { hideSubtitle: c }, `${e.id}-${n.toString()}`)) ?? []), v = a?.flatMap((e, t) => {
|
|
1829
|
+
if (!He(e)) {
|
|
1811
1830
|
let t = e.visibility ?? "always";
|
|
1812
1831
|
if (t === "authenticated" && !m || t === "unauthenticated" && m) return [];
|
|
1813
1832
|
}
|
|
1814
|
-
return [
|
|
1833
|
+
return [jt(e, `user-button-link-${t.toString()}`)];
|
|
1815
1834
|
});
|
|
1816
1835
|
return /* @__PURE__ */ $(P, { children: [r === "icon" ? /* @__PURE__ */ Q(P.Trigger, {
|
|
1817
1836
|
className: q("rounded-full"),
|
|
@@ -1819,48 +1838,48 @@ function jt({ className: e, placement: t, size: r = "default", variant: i = "gho
|
|
|
1819
1838
|
}) : /* @__PURE__ */ $(k, {
|
|
1820
1839
|
variant: i,
|
|
1821
1840
|
className: q("h-auto font-normal justify-start px-2 py-2 text-left", e),
|
|
1822
|
-
children: [m ||
|
|
1823
|
-
isPending:
|
|
1841
|
+
children: [m || h ? /* @__PURE__ */ Q(o, {
|
|
1842
|
+
isPending: h,
|
|
1824
1843
|
hideSubtitle: c
|
|
1825
1844
|
}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(n, {}), /* @__PURE__ */ Q("p", {
|
|
1826
1845
|
className: "text-sm font-medium",
|
|
1827
1846
|
children: f.auth.account
|
|
1828
|
-
})] }), /* @__PURE__ */ Q(
|
|
1847
|
+
})] }), /* @__PURE__ */ Q(ue, { className: "ml-auto size-3 text-muted" })]
|
|
1829
1848
|
}), /* @__PURE__ */ $(P.Popover, {
|
|
1830
1849
|
placement: t,
|
|
1831
1850
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
1832
1851
|
children: [m && /* @__PURE__ */ Q("div", {
|
|
1833
1852
|
className: "px-3 pt-3 pb-1",
|
|
1834
|
-
children: /* @__PURE__ */ Q(
|
|
1853
|
+
children: /* @__PURE__ */ Q(o, { hideSubtitle: c })
|
|
1835
1854
|
}), /* @__PURE__ */ Q(P.Menu, { children: m ? /* @__PURE__ */ $(Z, { children: [
|
|
1836
1855
|
v,
|
|
1837
1856
|
!s && /* @__PURE__ */ $(P.Item, {
|
|
1838
1857
|
textValue: f.settings.settings,
|
|
1839
1858
|
href: `${u.settings}/${d.settings.account}`,
|
|
1840
|
-
children: [/* @__PURE__ */ Q(
|
|
1859
|
+
children: [/* @__PURE__ */ Q(me, { className: "text-muted" }), /* @__PURE__ */ Q(B, { children: f.settings.settings })]
|
|
1841
1860
|
}),
|
|
1842
1861
|
_,
|
|
1843
1862
|
/* @__PURE__ */ $(P.Item, {
|
|
1844
1863
|
textValue: f.auth.signOut,
|
|
1845
1864
|
href: `${u.auth}/${d.auth.signOut}`,
|
|
1846
1865
|
variant: "danger",
|
|
1847
|
-
children: [/* @__PURE__ */ Q(
|
|
1866
|
+
children: [/* @__PURE__ */ Q(se, { className: "text-danger" }), /* @__PURE__ */ Q(B, { children: f.auth.signOut })]
|
|
1848
1867
|
})
|
|
1849
1868
|
] }) : /* @__PURE__ */ $(Z, { children: [
|
|
1850
1869
|
v,
|
|
1851
1870
|
/* @__PURE__ */ $(P.Item, {
|
|
1852
1871
|
textValue: f.auth.signIn,
|
|
1853
1872
|
href: `${u.auth}/${d.auth.signIn}`,
|
|
1854
|
-
children: [/* @__PURE__ */ Q(
|
|
1873
|
+
children: [/* @__PURE__ */ Q(ce, { className: "text-muted" }), /* @__PURE__ */ Q(B, { children: f.auth.signIn })]
|
|
1855
1874
|
}),
|
|
1856
1875
|
/* @__PURE__ */ $(P.Item, {
|
|
1857
1876
|
textValue: f.auth.signUp,
|
|
1858
1877
|
href: `${u.auth}/${d.auth.signUp}`,
|
|
1859
|
-
children: [/* @__PURE__ */ Q(
|
|
1878
|
+
children: [/* @__PURE__ */ Q(ve, { className: "text-muted" }), /* @__PURE__ */ Q(B, { children: f.auth.signUp })]
|
|
1860
1879
|
}),
|
|
1861
1880
|
_
|
|
1862
1881
|
] }) })]
|
|
1863
1882
|
})] });
|
|
1864
1883
|
}
|
|
1865
1884
|
//#endregion
|
|
1866
|
-
export {
|
|
1885
|
+
export { vt as AccountSettings, xt as ActiveSessions, $e as AdditionalField, ft as Auth, mt as AuthProvider, ht as ChangeEmail, Ct as ChangePassword, rt as ForgotPassword, Dt as LinkedAccounts, a as OpenEmailButton, t as ProviderButton, i as ProviderButtons, tt as RESET_LINK_SENT_STORAGE_KEY, nt as ResetLinkSent, it as ResetPassword, kt as SecuritySettings, At as Settings, at as SignIn, ot as SignOut, st as SignUp, n as UserAvatar, Mt as UserButton, _t as UserProfile, o as UserView, lt as VerifyEmail };
|