@better-auth-ui/heroui 1.6.19 → 1.6.20
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/auth.d.ts +2 -1
- package/dist/components/auth/forgot-password.d.ts +1 -1
- package/dist/components/auth/magic-link/magic-link.d.ts +1 -1
- package/dist/components/auth/reset-password.d.ts +1 -1
- package/dist/components/auth/sign-in.d.ts +1 -1
- package/dist/components/auth/sign-up.d.ts +1 -1
- package/dist/components/auth/username/sign-in-username.d.ts +1 -1
- package/dist/index.js +446 -447
- package/dist/lib/auth/auth-plugin.d.ts +4 -2
- package/dist/plugins.js +925 -927
- package/package.json +3 -3
- package/src/components/auth/auth.tsx +11 -6
- package/src/components/auth/forgot-password.tsx +1 -6
- package/src/components/auth/magic-link/magic-link.tsx +2 -4
- package/src/components/auth/reset-password.tsx +1 -6
- package/src/components/auth/sign-in.tsx +2 -4
- package/src/components/auth/sign-up.tsx +2 -4
- package/src/components/auth/user/user-button.tsx +2 -2
- package/src/components/auth/username/sign-in-username.tsx +2 -4
- package/src/lib/auth/auth-plugin.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as e, i as t, n, r, t as i } from "./user-view--47tVtJ3.js";
|
|
3
3
|
import { authMutationKeys as a, authQueryKeys as o, fileToBase64 as s, getProviderName as c, parseAdditionalFieldValue as l, resolveInputType as u } from "@better-auth-ui/core";
|
|
4
|
-
import { AuthProvider as d, providerIcons as f, useAccountInfo as p, useAuth as m, useAuthenticate as h, useChangeEmail as g, useChangePassword as _, useFetchOptions as v, useLinkSocial as y, useListAccounts as
|
|
5
|
-
import { ArrowRightFromSquare as
|
|
6
|
-
import { Button as
|
|
4
|
+
import { AuthProvider as d, providerIcons as f, useAccountInfo as p, useAuth as m, useAuthenticate as h, useChangeEmail as g, useChangePassword as _, useFetchOptions as v, useLinkSocial as y, useListAccounts as ee, useListSessions as te, useRequestPasswordReset as b, useResetPassword as x, useRevokeSession as ne, useSendVerificationEmail as re, useSession as S, useSignInEmail as ie, useSignOut as C, useSignUpEmail as ae, useUnlinkAccount as oe, useUpdateUser as w } from "@better-auth-ui/react";
|
|
5
|
+
import { ArrowRightFromSquare as se, ArrowRightToSquare as T, Check as ce, ChevronsExpandVertical as le, CloudArrowUpIn as ue, Copy as de, Display as fe, Eye as E, EyeSlash as D, Gear as pe, Link as me, LinkSlash as he, Person as ge, PersonPlus as _e, PlugConnection as ve, Shield as ye, Smartphone as be, TrashBin as xe, Xmark as Se } from "@gravity-ui/icons";
|
|
6
|
+
import { Button as O, Calendar as k, Card as A, Checkbox as j, Chip as Ce, ComboBox as we, DateField as Te, DatePicker as Ee, Description as De, Dropdown as M, FieldError as N, Fieldset as P, Form as F, Input as I, InputGroup as L, Label as R, Link as z, ListBox as B, NumberField as V, RouterProvider as Oe, Select as H, Skeleton as U, Slider as W, Spinner as G, Switch as ke, Tabs as K, TextArea as Ae, TextField as q, TimeField as je, cn as J, toast as Y } from "@heroui/react";
|
|
7
7
|
import { fromDate as Me, getLocalTimeZone as Ne, parseDate as Pe, parseDateTime as Fe, toCalendarDate as Ie, toCalendarDateTime as Le } from "@internationalized/date";
|
|
8
8
|
import { isValidElement as Re, useEffect as ze, useMemo as Be, useRef as Ve, useState as X } from "react";
|
|
9
9
|
import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
@@ -36,14 +36,14 @@ function Ye({ getValue: e, isDisabled: t }) {
|
|
|
36
36
|
Y.danger(e instanceof Error ? e.message : String(e));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
return /* @__PURE__ */ Q(
|
|
39
|
+
return /* @__PURE__ */ Q(O, {
|
|
40
40
|
isIconOnly: !0,
|
|
41
41
|
"aria-label": n.settings.copyToClipboard,
|
|
42
42
|
size: "sm",
|
|
43
43
|
variant: "ghost",
|
|
44
44
|
isDisabled: t,
|
|
45
45
|
onPress: a,
|
|
46
|
-
children: Q(r ?
|
|
46
|
+
children: Q(r ? ce : de, { className: "size-4" })
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
@@ -65,18 +65,18 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
65
65
|
isDisabled: n,
|
|
66
66
|
isReadOnly: t.readOnly,
|
|
67
67
|
children: [
|
|
68
|
-
/* @__PURE__ */ Q(
|
|
68
|
+
/* @__PURE__ */ Q(R, { children: t.label }),
|
|
69
69
|
/* @__PURE__ */ Q(Ae, {
|
|
70
70
|
placeholder: t.placeholder,
|
|
71
71
|
required: t.required,
|
|
72
72
|
variant: o
|
|
73
73
|
}),
|
|
74
|
-
/* @__PURE__ */ Q(
|
|
74
|
+
/* @__PURE__ */ Q(N, {})
|
|
75
75
|
]
|
|
76
76
|
});
|
|
77
77
|
if (a === "number") {
|
|
78
78
|
let r = t.formatOptions?.maximumFractionDigits;
|
|
79
|
-
return /* @__PURE__ */ $(
|
|
79
|
+
return /* @__PURE__ */ $(V, {
|
|
80
80
|
name: e,
|
|
81
81
|
defaultValue: typeof t.defaultValue == "number" ? t.defaultValue : t.defaultValue != null && t.defaultValue !== "" ? Number(t.defaultValue) : void 0,
|
|
82
82
|
minValue: t.min,
|
|
@@ -87,22 +87,22 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
87
87
|
isReadOnly: t.readOnly,
|
|
88
88
|
variant: o,
|
|
89
89
|
children: [
|
|
90
|
-
/* @__PURE__ */ Q(
|
|
91
|
-
/* @__PURE__ */ $(
|
|
92
|
-
/* @__PURE__ */ Q(
|
|
93
|
-
/* @__PURE__ */ Q(
|
|
90
|
+
/* @__PURE__ */ Q(R, { children: t.label }),
|
|
91
|
+
/* @__PURE__ */ $(V.Group, { children: [
|
|
92
|
+
/* @__PURE__ */ Q(V.DecrementButton, {}),
|
|
93
|
+
/* @__PURE__ */ Q(V.Input, {
|
|
94
94
|
placeholder: t.placeholder,
|
|
95
95
|
required: t.required
|
|
96
96
|
}),
|
|
97
|
-
/* @__PURE__ */ Q(
|
|
97
|
+
/* @__PURE__ */ Q(V.IncrementButton, {})
|
|
98
98
|
] }),
|
|
99
|
-
/* @__PURE__ */ Q(
|
|
99
|
+
/* @__PURE__ */ Q(N, {})
|
|
100
100
|
]
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
if (a === "slider") {
|
|
104
104
|
let r = t.formatOptions?.maximumFractionDigits;
|
|
105
|
-
return /* @__PURE__ */ $(
|
|
105
|
+
return /* @__PURE__ */ $(W, {
|
|
106
106
|
defaultValue: typeof t.defaultValue == "number" ? t.defaultValue : t.defaultValue == null ? void 0 : Number(t.defaultValue),
|
|
107
107
|
minValue: t.min ?? 0,
|
|
108
108
|
maxValue: t.max ?? 100,
|
|
@@ -112,8 +112,8 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
112
112
|
className: "flex flex-col gap-2",
|
|
113
113
|
children: [/* @__PURE__ */ $("div", {
|
|
114
114
|
className: "flex items-center justify-between gap-2",
|
|
115
|
-
children: [/* @__PURE__ */ Q(
|
|
116
|
-
}), /* @__PURE__ */ $(
|
|
115
|
+
children: [/* @__PURE__ */ Q(R, { children: t.label }), /* @__PURE__ */ Q(W.Output, { className: "text-sm text-muted" })]
|
|
116
|
+
}), /* @__PURE__ */ $(W.Track, { children: [/* @__PURE__ */ Q(W.Fill, {}), /* @__PURE__ */ Q(W.Thumb, { name: e })] })]
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
if (a === "switch") return /* @__PURE__ */ $(ke, {
|
|
@@ -121,18 +121,18 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
121
121
|
defaultSelected: t.defaultValue === !0 || t.defaultValue === "true",
|
|
122
122
|
isDisabled: n,
|
|
123
123
|
isReadOnly: t.readOnly,
|
|
124
|
-
children: [/* @__PURE__ */ Q(ke.Control, { children: /* @__PURE__ */ Q(ke.Thumb, {}) }), /* @__PURE__ */ Q(
|
|
124
|
+
children: [/* @__PURE__ */ Q(ke.Control, { children: /* @__PURE__ */ Q(ke.Thumb, {}) }), /* @__PURE__ */ Q(R, { children: t.label })]
|
|
125
125
|
});
|
|
126
|
-
if (a === "checkbox") return /* @__PURE__ */ $(
|
|
126
|
+
if (a === "checkbox") return /* @__PURE__ */ $(j, {
|
|
127
127
|
name: e,
|
|
128
128
|
defaultSelected: t.defaultValue === !0 || t.defaultValue === "true",
|
|
129
129
|
isDisabled: n,
|
|
130
130
|
isReadOnly: t.readOnly,
|
|
131
131
|
isRequired: t.required,
|
|
132
132
|
variant: o,
|
|
133
|
-
children: [/* @__PURE__ */ Q(
|
|
133
|
+
children: [/* @__PURE__ */ Q(j.Control, { children: /* @__PURE__ */ Q(j.Indicator, {}) }), /* @__PURE__ */ Q(j.Content, { children: /* @__PURE__ */ Q(R, { children: t.label }) })]
|
|
134
134
|
});
|
|
135
|
-
if (a === "select") return /* @__PURE__ */ $(
|
|
135
|
+
if (a === "select") return /* @__PURE__ */ $(H, {
|
|
136
136
|
className: "[&[data-required=true]>.label]:after:content-none",
|
|
137
137
|
name: e,
|
|
138
138
|
defaultValue: t.defaultValue == null ? void 0 : String(t.defaultValue),
|
|
@@ -142,17 +142,17 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
142
142
|
variant: o,
|
|
143
143
|
fullWidth: !0,
|
|
144
144
|
children: [
|
|
145
|
-
/* @__PURE__ */ Q(
|
|
146
|
-
/* @__PURE__ */ $(
|
|
147
|
-
/* @__PURE__ */ Q(
|
|
145
|
+
/* @__PURE__ */ Q(R, { children: t.label }),
|
|
146
|
+
/* @__PURE__ */ $(H.Trigger, { children: [/* @__PURE__ */ Q(H.Value, {}), /* @__PURE__ */ Q(H.Indicator, {})] }),
|
|
147
|
+
/* @__PURE__ */ Q(H.Popover, { children: /* @__PURE__ */ Q(B, { children: t.options?.map((e) => /* @__PURE__ */ $(B.Item, {
|
|
148
148
|
id: e.value,
|
|
149
149
|
textValue: typeof e.label == "string" ? e.label : e.value,
|
|
150
|
-
children: [e.label, /* @__PURE__ */ Q(
|
|
150
|
+
children: [e.label, /* @__PURE__ */ Q(B.ItemIndicator, {})]
|
|
151
151
|
}, e.value)) }) }),
|
|
152
|
-
/* @__PURE__ */ Q(
|
|
152
|
+
/* @__PURE__ */ Q(N, {})
|
|
153
153
|
]
|
|
154
154
|
});
|
|
155
|
-
if (a === "combobox") return /* @__PURE__ */ $(
|
|
155
|
+
if (a === "combobox") return /* @__PURE__ */ $(we, {
|
|
156
156
|
className: "[&[data-required=true]>.label]:after:content-none",
|
|
157
157
|
name: e,
|
|
158
158
|
defaultSelectedKey: t.defaultValue == null ? void 0 : String(t.defaultValue),
|
|
@@ -162,19 +162,19 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
162
162
|
variant: o,
|
|
163
163
|
fullWidth: !0,
|
|
164
164
|
children: [
|
|
165
|
-
/* @__PURE__ */ Q(
|
|
166
|
-
/* @__PURE__ */ $(
|
|
167
|
-
/* @__PURE__ */ Q(
|
|
165
|
+
/* @__PURE__ */ Q(R, { children: t.label }),
|
|
166
|
+
/* @__PURE__ */ $(we.InputGroup, { children: [/* @__PURE__ */ Q(I, { placeholder: t.placeholder }), /* @__PURE__ */ Q(we.Trigger, {})] }),
|
|
167
|
+
/* @__PURE__ */ Q(we.Popover, { children: /* @__PURE__ */ Q(B, { children: t.options?.map((e) => /* @__PURE__ */ $(B.Item, {
|
|
168
168
|
id: e.value,
|
|
169
169
|
textValue: typeof e.label == "string" ? e.label : e.value,
|
|
170
|
-
children: [e.label, /* @__PURE__ */ Q(
|
|
170
|
+
children: [e.label, /* @__PURE__ */ Q(B.ItemIndicator, {})]
|
|
171
171
|
}, e.value)) }) }),
|
|
172
|
-
/* @__PURE__ */ Q(
|
|
172
|
+
/* @__PURE__ */ Q(N, {})
|
|
173
173
|
]
|
|
174
174
|
});
|
|
175
175
|
if (a === "date" || a === "datetime") {
|
|
176
176
|
let r = a === "datetime";
|
|
177
|
-
return /* @__PURE__ */ Q(
|
|
177
|
+
return /* @__PURE__ */ Q(Ee, {
|
|
178
178
|
className: "w-full [&[data-required=true]>.label]:after:content-none",
|
|
179
179
|
name: e,
|
|
180
180
|
defaultValue: r ? Je(t.defaultValue) : qe(t.defaultValue),
|
|
@@ -183,29 +183,29 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
183
183
|
isReadOnly: t.readOnly,
|
|
184
184
|
isRequired: t.required,
|
|
185
185
|
children: ({ state: n }) => /* @__PURE__ */ $(Z, { children: [
|
|
186
|
-
/* @__PURE__ */ Q(
|
|
187
|
-
/* @__PURE__ */ $(
|
|
186
|
+
/* @__PURE__ */ Q(R, { children: t.label }),
|
|
187
|
+
/* @__PURE__ */ $(Te.Group, {
|
|
188
188
|
variant: o,
|
|
189
189
|
fullWidth: !0,
|
|
190
|
-
children: [/* @__PURE__ */ Q(
|
|
190
|
+
children: [/* @__PURE__ */ Q(Te.Input, { children: (e) => /* @__PURE__ */ Q(Te.Segment, { segment: e }) }), /* @__PURE__ */ Q(Te.Suffix, { children: /* @__PURE__ */ Q(Ee.Trigger, { children: /* @__PURE__ */ Q(Ee.TriggerIndicator, {}) }) })]
|
|
191
191
|
}),
|
|
192
|
-
/* @__PURE__ */ Q(
|
|
193
|
-
/* @__PURE__ */ $(
|
|
192
|
+
/* @__PURE__ */ Q(N, {}),
|
|
193
|
+
/* @__PURE__ */ $(Ee.Popover, {
|
|
194
194
|
className: "flex flex-col gap-3",
|
|
195
|
-
children: [/* @__PURE__ */ $(
|
|
195
|
+
children: [/* @__PURE__ */ $(k, {
|
|
196
196
|
"aria-label": typeof t.label == "string" ? t.label : e,
|
|
197
197
|
children: [
|
|
198
|
-
/* @__PURE__ */ $(
|
|
199
|
-
/* @__PURE__ */ $(
|
|
200
|
-
/* @__PURE__ */ Q(
|
|
201
|
-
/* @__PURE__ */ Q(
|
|
198
|
+
/* @__PURE__ */ $(k.Header, { children: [
|
|
199
|
+
/* @__PURE__ */ $(k.YearPickerTrigger, { children: [/* @__PURE__ */ Q(k.YearPickerTriggerHeading, {}), /* @__PURE__ */ Q(k.YearPickerTriggerIndicator, {})] }),
|
|
200
|
+
/* @__PURE__ */ Q(k.NavButton, { slot: "previous" }),
|
|
201
|
+
/* @__PURE__ */ Q(k.NavButton, { slot: "next" })
|
|
202
202
|
] }),
|
|
203
|
-
/* @__PURE__ */ $(
|
|
204
|
-
/* @__PURE__ */ Q(
|
|
203
|
+
/* @__PURE__ */ $(k.Grid, { children: [/* @__PURE__ */ Q(k.GridHeader, { children: (e) => /* @__PURE__ */ Q(k.HeaderCell, { children: e }) }), /* @__PURE__ */ Q(k.GridBody, { children: (e) => /* @__PURE__ */ Q(k.Cell, { date: e }) })] }),
|
|
204
|
+
/* @__PURE__ */ Q(k.YearPickerGrid, { children: /* @__PURE__ */ Q(k.YearPickerGridBody, { children: ({ year: e }) => /* @__PURE__ */ Q(k.YearPickerCell, { year: e }) }) })
|
|
205
205
|
]
|
|
206
206
|
}), r && /* @__PURE__ */ $("div", {
|
|
207
207
|
className: "flex items-center justify-between",
|
|
208
|
-
children: [/* @__PURE__ */ Q(
|
|
208
|
+
children: [/* @__PURE__ */ Q(R, { children: i.settings.time }), /* @__PURE__ */ Q(je, {
|
|
209
209
|
"aria-label": i.settings.time,
|
|
210
210
|
granularity: "minute",
|
|
211
211
|
value: n.timeValue,
|
|
@@ -227,12 +227,12 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
227
227
|
isDisabled: n,
|
|
228
228
|
isReadOnly: t.readOnly,
|
|
229
229
|
children: [
|
|
230
|
-
/* @__PURE__ */ Q(
|
|
231
|
-
/* @__PURE__ */ $(
|
|
230
|
+
/* @__PURE__ */ Q(R, { children: t.label }),
|
|
231
|
+
/* @__PURE__ */ $(L, {
|
|
232
232
|
variant: o,
|
|
233
233
|
children: [
|
|
234
|
-
c && /* @__PURE__ */ Q(
|
|
235
|
-
/* @__PURE__ */ Q(
|
|
234
|
+
c && /* @__PURE__ */ Q(L.Prefix, { children: t.prefix }),
|
|
235
|
+
/* @__PURE__ */ Q(L.Input, {
|
|
236
236
|
ref: s,
|
|
237
237
|
placeholder: t.placeholder,
|
|
238
238
|
required: t.required,
|
|
@@ -240,16 +240,16 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
240
240
|
inputMode: h,
|
|
241
241
|
step: g
|
|
242
242
|
}),
|
|
243
|
-
t.copyable ? /* @__PURE__ */ Q(
|
|
243
|
+
t.copyable ? /* @__PURE__ */ Q(L.Suffix, {
|
|
244
244
|
className: "px-0",
|
|
245
245
|
children: /* @__PURE__ */ Q(Ye, {
|
|
246
246
|
getValue: () => s.current?.value,
|
|
247
247
|
isDisabled: n
|
|
248
248
|
})
|
|
249
|
-
}) : t.suffix != null && /* @__PURE__ */ Q(
|
|
249
|
+
}) : t.suffix != null && /* @__PURE__ */ Q(L.Suffix, { children: t.suffix })
|
|
250
250
|
]
|
|
251
251
|
}),
|
|
252
|
-
/* @__PURE__ */ Q(
|
|
252
|
+
/* @__PURE__ */ Q(N, {})
|
|
253
253
|
]
|
|
254
254
|
}) : /* @__PURE__ */ $(q, {
|
|
255
255
|
name: e,
|
|
@@ -257,8 +257,8 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
257
257
|
isDisabled: n,
|
|
258
258
|
isReadOnly: t.readOnly,
|
|
259
259
|
children: [
|
|
260
|
-
/* @__PURE__ */ Q(
|
|
261
|
-
/* @__PURE__ */ Q(
|
|
260
|
+
/* @__PURE__ */ Q(R, { children: t.label }),
|
|
261
|
+
/* @__PURE__ */ Q(I, {
|
|
262
262
|
placeholder: t.placeholder,
|
|
263
263
|
required: t.required,
|
|
264
264
|
variant: o,
|
|
@@ -266,93 +266,92 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
266
266
|
inputMode: h,
|
|
267
267
|
step: g
|
|
268
268
|
}),
|
|
269
|
-
/* @__PURE__ */ Q(
|
|
269
|
+
/* @__PURE__ */ Q(N, {})
|
|
270
270
|
]
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
//#endregion
|
|
274
274
|
//#region src/components/auth/forgot-password.tsx
|
|
275
|
-
function Ze({ className: e, variant: t
|
|
276
|
-
let { authClient:
|
|
275
|
+
function Ze({ className: e, variant: t }) {
|
|
276
|
+
let { authClient: n, baseURL: r, basePaths: i, localization: a, viewPaths: o, navigate: s, plugins: c } = m(), { fetchOptions: l, resetFetchOptions: u } = v(), { mutate: d, isPending: f } = b(n, {
|
|
277
277
|
onError: () => {
|
|
278
|
-
|
|
278
|
+
u();
|
|
279
279
|
},
|
|
280
280
|
onSuccess: () => {
|
|
281
|
-
Y.success(
|
|
281
|
+
Y.success(a.auth.passwordResetEmailSent), s({ to: `${i.auth}/${o.auth.signIn}` });
|
|
282
282
|
}
|
|
283
283
|
});
|
|
284
|
-
function
|
|
285
|
-
e.preventDefault(),
|
|
284
|
+
function p(e) {
|
|
285
|
+
e.preventDefault(), d({
|
|
286
286
|
email: new FormData(e.currentTarget).get("email"),
|
|
287
|
-
redirectTo: `${
|
|
288
|
-
fetchOptions:
|
|
287
|
+
redirectTo: `${r}${i.auth}/${o.auth.resetPassword}`,
|
|
288
|
+
fetchOptions: l
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
let
|
|
292
|
-
return /* @__PURE__ */ $(
|
|
291
|
+
let h = c.find((e) => e.captchaComponent)?.captchaComponent;
|
|
292
|
+
return /* @__PURE__ */ $(A, {
|
|
293
293
|
className: J("w-full max-w-sm gap-4 md:p-6", e),
|
|
294
294
|
variant: t,
|
|
295
|
-
...n,
|
|
296
295
|
children: [
|
|
297
|
-
/* @__PURE__ */ Q(
|
|
296
|
+
/* @__PURE__ */ Q(A.Header, { children: /* @__PURE__ */ Q(A.Title, {
|
|
298
297
|
className: "text-xl font-semibold mb-1",
|
|
299
|
-
children:
|
|
298
|
+
children: a.auth.forgotPassword
|
|
300
299
|
}) }),
|
|
301
|
-
/* @__PURE__ */ Q(
|
|
300
|
+
/* @__PURE__ */ Q(A.Content, {
|
|
302
301
|
className: "gap-4",
|
|
303
|
-
children: /* @__PURE__ */ $(
|
|
304
|
-
onSubmit:
|
|
302
|
+
children: /* @__PURE__ */ $(F, {
|
|
303
|
+
onSubmit: p,
|
|
305
304
|
className: "flex flex-col gap-4",
|
|
306
305
|
children: [
|
|
307
306
|
/* @__PURE__ */ $(q, {
|
|
308
307
|
name: "email",
|
|
309
308
|
type: "email",
|
|
310
309
|
autoComplete: "email",
|
|
311
|
-
isDisabled:
|
|
310
|
+
isDisabled: f,
|
|
312
311
|
validate: (e) => {
|
|
313
|
-
if (!e) return
|
|
314
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return
|
|
312
|
+
if (!e) return a.auth.fieldRequired;
|
|
313
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return a.auth.invalidEmail;
|
|
315
314
|
},
|
|
316
315
|
children: [
|
|
317
|
-
/* @__PURE__ */ Q(
|
|
318
|
-
/* @__PURE__ */ Q(
|
|
319
|
-
placeholder:
|
|
316
|
+
/* @__PURE__ */ Q(R, { children: a.auth.email }),
|
|
317
|
+
/* @__PURE__ */ Q(I, {
|
|
318
|
+
placeholder: a.auth.emailPlaceholder,
|
|
320
319
|
required: !0,
|
|
321
320
|
variant: t === "transparent" ? "primary" : "secondary"
|
|
322
321
|
}),
|
|
323
|
-
/* @__PURE__ */ Q(
|
|
322
|
+
/* @__PURE__ */ Q(N, {})
|
|
324
323
|
]
|
|
325
324
|
}),
|
|
326
|
-
|
|
325
|
+
h && /* @__PURE__ */ Q("div", {
|
|
327
326
|
className: "flex justify-center",
|
|
328
|
-
children:
|
|
327
|
+
children: h
|
|
329
328
|
}),
|
|
330
329
|
/* @__PURE__ */ Q("div", {
|
|
331
330
|
className: "flex flex-col gap-3",
|
|
332
|
-
children: /* @__PURE__ */ $(
|
|
331
|
+
children: /* @__PURE__ */ $(O, {
|
|
333
332
|
type: "submit",
|
|
334
333
|
className: "w-full",
|
|
335
|
-
isPending:
|
|
336
|
-
children: [
|
|
334
|
+
isPending: f,
|
|
335
|
+
children: [f && /* @__PURE__ */ Q(G, {
|
|
337
336
|
color: "current",
|
|
338
337
|
size: "sm"
|
|
339
|
-
}),
|
|
338
|
+
}), a.auth.sendResetLink]
|
|
340
339
|
})
|
|
341
340
|
})
|
|
342
341
|
]
|
|
343
342
|
})
|
|
344
343
|
}),
|
|
345
|
-
/* @__PURE__ */ Q(
|
|
344
|
+
/* @__PURE__ */ Q(A.Footer, {
|
|
346
345
|
className: "flex-col gap-3",
|
|
347
|
-
children: /* @__PURE__ */ $(
|
|
346
|
+
children: /* @__PURE__ */ $(De, {
|
|
348
347
|
className: "text-sm",
|
|
349
348
|
children: [
|
|
350
|
-
|
|
349
|
+
a.auth.rememberYourPassword,
|
|
351
350
|
" ",
|
|
352
|
-
/* @__PURE__ */ Q(
|
|
353
|
-
href: `${
|
|
351
|
+
/* @__PURE__ */ Q(z, {
|
|
352
|
+
href: `${i.auth}/${o.auth.signIn}`,
|
|
354
353
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
355
|
-
children:
|
|
354
|
+
children: a.auth.signIn
|
|
356
355
|
})
|
|
357
356
|
]
|
|
358
357
|
})
|
|
@@ -362,150 +361,149 @@ function Ze({ className: e, variant: t, ...n }) {
|
|
|
362
361
|
}
|
|
363
362
|
//#endregion
|
|
364
363
|
//#region src/components/auth/reset-password.tsx
|
|
365
|
-
function Qe({ className: e, variant: t
|
|
366
|
-
let { authClient:
|
|
367
|
-
Y.success(
|
|
368
|
-
} }), [
|
|
364
|
+
function Qe({ className: e, variant: t }) {
|
|
365
|
+
let { authClient: n, basePaths: r, emailAndPassword: i, localization: a, viewPaths: o, navigate: s } = m(), { mutate: c, isPending: l } = x(n, { onSuccess: () => {
|
|
366
|
+
Y.success(a.auth.passwordResetSuccess), s({ to: `${r.auth}/${o.auth.signIn}` });
|
|
367
|
+
} }), [u, d] = X(!1), [f, p] = X(!1);
|
|
369
368
|
ze(() => {
|
|
370
|
-
new URLSearchParams(window.location.search).get("token") || (Y.danger(
|
|
369
|
+
new URLSearchParams(window.location.search).get("token") || (Y.danger(a.auth.invalidResetPasswordToken), s({ to: `${r.auth}/${o.auth.signIn}` }));
|
|
371
370
|
}, [
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
371
|
+
r.auth,
|
|
372
|
+
a.auth.invalidResetPasswordToken,
|
|
373
|
+
o.auth.signIn,
|
|
374
|
+
s
|
|
376
375
|
]);
|
|
377
|
-
function
|
|
376
|
+
function h(e) {
|
|
378
377
|
e.preventDefault();
|
|
379
378
|
let t = new URLSearchParams(window.location.search).get("token");
|
|
380
379
|
if (!t) {
|
|
381
|
-
Y.danger(
|
|
380
|
+
Y.danger(a.auth.invalidResetPasswordToken), s({ to: `${r.auth}/${o.auth.signIn}` });
|
|
382
381
|
return;
|
|
383
382
|
}
|
|
384
|
-
let n = new FormData(e.currentTarget),
|
|
385
|
-
if (
|
|
386
|
-
Y.danger(
|
|
383
|
+
let n = new FormData(e.currentTarget), l = n.get("password"), u = n.get("confirmPassword");
|
|
384
|
+
if (i?.confirmPassword && l !== u) {
|
|
385
|
+
Y.danger(a.auth.passwordsDoNotMatch);
|
|
387
386
|
return;
|
|
388
387
|
}
|
|
389
|
-
|
|
388
|
+
c({
|
|
390
389
|
token: t,
|
|
391
|
-
newPassword:
|
|
390
|
+
newPassword: l
|
|
392
391
|
});
|
|
393
392
|
}
|
|
394
|
-
return /* @__PURE__ */ $(
|
|
393
|
+
return /* @__PURE__ */ $(A, {
|
|
395
394
|
className: J("w-full max-w-sm gap-4 md:p-6", e),
|
|
396
395
|
variant: t,
|
|
397
|
-
...n,
|
|
398
396
|
children: [
|
|
399
|
-
/* @__PURE__ */ Q(
|
|
397
|
+
/* @__PURE__ */ Q(A.Header, { children: /* @__PURE__ */ Q(A.Title, {
|
|
400
398
|
className: "text-xl font-semibold mb-1",
|
|
401
|
-
children:
|
|
399
|
+
children: a.auth.resetPassword
|
|
402
400
|
}) }),
|
|
403
|
-
/* @__PURE__ */ Q(
|
|
401
|
+
/* @__PURE__ */ Q(A.Content, {
|
|
404
402
|
className: "gap-4",
|
|
405
|
-
children: /* @__PURE__ */ $(
|
|
406
|
-
onSubmit:
|
|
403
|
+
children: /* @__PURE__ */ $(F, {
|
|
404
|
+
onSubmit: h,
|
|
407
405
|
className: "flex flex-col gap-4",
|
|
408
406
|
children: [
|
|
409
407
|
/* @__PURE__ */ $(q, {
|
|
410
|
-
minLength:
|
|
411
|
-
maxLength:
|
|
408
|
+
minLength: i?.minPasswordLength,
|
|
409
|
+
maxLength: i?.maxPasswordLength,
|
|
412
410
|
name: "password",
|
|
413
411
|
autoComplete: "new-password",
|
|
414
|
-
isDisabled:
|
|
412
|
+
isDisabled: l,
|
|
415
413
|
validate: (e) => {
|
|
416
|
-
if (!e) return
|
|
417
|
-
let t =
|
|
418
|
-
if (t && e.length < t) return
|
|
419
|
-
if (n && e.length > n) return
|
|
414
|
+
if (!e) return a.auth.fieldRequired;
|
|
415
|
+
let t = i?.minPasswordLength, n = i?.maxPasswordLength;
|
|
416
|
+
if (t && e.length < t) return a.auth.tooShort.replace("{{min}}", String(t));
|
|
417
|
+
if (n && e.length > n) return a.auth.tooLong.replace("{{max}}", String(n));
|
|
420
418
|
},
|
|
421
419
|
children: [
|
|
422
|
-
/* @__PURE__ */ Q(
|
|
423
|
-
/* @__PURE__ */ $(
|
|
420
|
+
/* @__PURE__ */ Q(R, { children: a.auth.password }),
|
|
421
|
+
/* @__PURE__ */ $(L, {
|
|
424
422
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
425
|
-
children: [/* @__PURE__ */ Q(
|
|
423
|
+
children: [/* @__PURE__ */ Q(L.Input, {
|
|
426
424
|
name: "password",
|
|
427
|
-
placeholder:
|
|
428
|
-
type:
|
|
425
|
+
placeholder: a.auth.newPasswordPlaceholder,
|
|
426
|
+
type: u ? "text" : "password",
|
|
429
427
|
required: !0
|
|
430
|
-
}), /* @__PURE__ */ Q(
|
|
428
|
+
}), /* @__PURE__ */ Q(L.Suffix, {
|
|
431
429
|
className: "px-0",
|
|
432
|
-
children: /* @__PURE__ */ Q(
|
|
430
|
+
children: /* @__PURE__ */ Q(O, {
|
|
433
431
|
isIconOnly: !0,
|
|
434
|
-
"aria-label":
|
|
432
|
+
"aria-label": u ? a.auth.hidePassword : a.auth.showPassword,
|
|
435
433
|
size: "sm",
|
|
436
434
|
variant: "ghost",
|
|
437
|
-
onPress: () =>
|
|
438
|
-
isDisabled:
|
|
439
|
-
children: Q(
|
|
435
|
+
onPress: () => d(!u),
|
|
436
|
+
isDisabled: l,
|
|
437
|
+
children: Q(u ? D : E, {})
|
|
440
438
|
})
|
|
441
439
|
})]
|
|
442
440
|
}),
|
|
443
|
-
/* @__PURE__ */ Q(
|
|
441
|
+
/* @__PURE__ */ Q(N, {})
|
|
444
442
|
]
|
|
445
443
|
}),
|
|
446
|
-
|
|
447
|
-
minLength:
|
|
448
|
-
maxLength:
|
|
444
|
+
i?.confirmPassword && /* @__PURE__ */ $(q, {
|
|
445
|
+
minLength: i?.minPasswordLength,
|
|
446
|
+
maxLength: i?.maxPasswordLength,
|
|
449
447
|
name: "confirmPassword",
|
|
450
448
|
autoComplete: "new-password",
|
|
451
|
-
isDisabled:
|
|
449
|
+
isDisabled: l,
|
|
452
450
|
validate: (e) => {
|
|
453
|
-
if (!e) return
|
|
454
|
-
let t =
|
|
455
|
-
if (t && e.length < t) return
|
|
456
|
-
if (n && e.length > n) return
|
|
451
|
+
if (!e) return a.auth.fieldRequired;
|
|
452
|
+
let t = i?.minPasswordLength, n = i?.maxPasswordLength;
|
|
453
|
+
if (t && e.length < t) return a.auth.tooShort.replace("{{min}}", String(t));
|
|
454
|
+
if (n && e.length > n) return a.auth.tooLong.replace("{{max}}", String(n));
|
|
457
455
|
},
|
|
458
456
|
children: [
|
|
459
|
-
/* @__PURE__ */ Q(
|
|
460
|
-
/* @__PURE__ */ $(
|
|
457
|
+
/* @__PURE__ */ Q(R, { children: a.auth.confirmPassword }),
|
|
458
|
+
/* @__PURE__ */ $(L, {
|
|
461
459
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
462
|
-
children: [/* @__PURE__ */ Q(
|
|
463
|
-
placeholder:
|
|
464
|
-
type:
|
|
460
|
+
children: [/* @__PURE__ */ Q(L.Input, {
|
|
461
|
+
placeholder: a.auth.confirmPasswordPlaceholder,
|
|
462
|
+
type: f ? "text" : "password",
|
|
465
463
|
required: !0,
|
|
466
464
|
name: "confirmPassword"
|
|
467
|
-
}), /* @__PURE__ */ Q(
|
|
465
|
+
}), /* @__PURE__ */ Q(L.Suffix, {
|
|
468
466
|
className: "px-0",
|
|
469
|
-
children: /* @__PURE__ */ Q(
|
|
467
|
+
children: /* @__PURE__ */ Q(O, {
|
|
470
468
|
isIconOnly: !0,
|
|
471
|
-
"aria-label":
|
|
469
|
+
"aria-label": f ? a.auth.hidePassword : a.auth.showPassword,
|
|
472
470
|
size: "sm",
|
|
473
471
|
variant: "ghost",
|
|
474
|
-
onPress: () =>
|
|
475
|
-
isDisabled:
|
|
476
|
-
children: Q(
|
|
472
|
+
onPress: () => p(!f),
|
|
473
|
+
isDisabled: l,
|
|
474
|
+
children: Q(f ? D : E, {})
|
|
477
475
|
})
|
|
478
476
|
})]
|
|
479
477
|
}),
|
|
480
|
-
/* @__PURE__ */ Q(
|
|
478
|
+
/* @__PURE__ */ Q(N, {})
|
|
481
479
|
]
|
|
482
480
|
}),
|
|
483
481
|
/* @__PURE__ */ Q("div", {
|
|
484
482
|
className: "flex flex-col gap-3",
|
|
485
|
-
children: /* @__PURE__ */ $(
|
|
483
|
+
children: /* @__PURE__ */ $(O, {
|
|
486
484
|
type: "submit",
|
|
487
485
|
className: "w-full",
|
|
488
|
-
isPending:
|
|
489
|
-
children: [
|
|
486
|
+
isPending: l,
|
|
487
|
+
children: [l && /* @__PURE__ */ Q(G, {
|
|
490
488
|
color: "current",
|
|
491
489
|
size: "sm"
|
|
492
|
-
}),
|
|
490
|
+
}), a.auth.resetPassword]
|
|
493
491
|
})
|
|
494
492
|
})
|
|
495
493
|
]
|
|
496
494
|
})
|
|
497
495
|
}),
|
|
498
|
-
/* @__PURE__ */ Q(
|
|
496
|
+
/* @__PURE__ */ Q(A.Footer, {
|
|
499
497
|
className: "flex-col gap-3",
|
|
500
|
-
children: /* @__PURE__ */ $(
|
|
498
|
+
children: /* @__PURE__ */ $(De, {
|
|
501
499
|
className: "text-sm",
|
|
502
500
|
children: [
|
|
503
|
-
|
|
501
|
+
a.auth.rememberYourPassword,
|
|
504
502
|
" ",
|
|
505
|
-
/* @__PURE__ */ Q(
|
|
506
|
-
href: `${
|
|
503
|
+
/* @__PURE__ */ Q(z, {
|
|
504
|
+
href: `${r.auth}/${o.auth.signIn}`,
|
|
507
505
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
508
|
-
children:
|
|
506
|
+
children: a.auth.signIn
|
|
509
507
|
})
|
|
510
508
|
]
|
|
511
509
|
})
|
|
@@ -515,94 +513,93 @@ function Qe({ className: e, variant: t, ...n }) {
|
|
|
515
513
|
}
|
|
516
514
|
//#endregion
|
|
517
515
|
//#region src/components/auth/sign-in.tsx
|
|
518
|
-
function $e({ className: t, socialLayout: n, socialPosition: i = "bottom", variant: o
|
|
519
|
-
let { authClient:
|
|
516
|
+
function $e({ className: t, socialLayout: n, socialPosition: i = "bottom", variant: o }) {
|
|
517
|
+
let { authClient: s, basePaths: c, baseURL: l, emailAndPassword: u, localization: d, plugins: f, redirectTo: p, socialProviders: h, viewPaths: g, navigate: _ } = m(), { fetchOptions: y, resetFetchOptions: ee } = v(), [te, b] = X(""), { mutate: x } = re(s, { onSuccess: () => Y.success(d.auth.verificationEmailSent) }), { mutate: ne, isPending: S } = ie(s, {
|
|
520
518
|
onError: (e, { email: t }) => {
|
|
521
|
-
|
|
522
|
-
children:
|
|
523
|
-
onClick: () =>
|
|
519
|
+
b(""), e.error?.code === "EMAIL_NOT_VERIFIED" && Y.danger(e.error?.message || e.message, { actionProps: {
|
|
520
|
+
children: d.auth.resend,
|
|
521
|
+
onClick: () => x({
|
|
524
522
|
email: t,
|
|
525
|
-
callbackURL: `${
|
|
523
|
+
callbackURL: `${l}${p}`
|
|
526
524
|
})
|
|
527
525
|
} }), ee();
|
|
528
526
|
},
|
|
529
|
-
onSuccess: () =>
|
|
530
|
-
}),
|
|
527
|
+
onSuccess: () => _({ to: p })
|
|
528
|
+
}), C = (e) => {
|
|
531
529
|
e.preventDefault();
|
|
532
530
|
let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
|
|
533
|
-
|
|
531
|
+
ne({
|
|
534
532
|
email: n,
|
|
535
|
-
password:
|
|
536
|
-
...
|
|
537
|
-
fetchOptions:
|
|
533
|
+
password: te,
|
|
534
|
+
...u?.rememberMe ? { rememberMe: r } : {},
|
|
535
|
+
fetchOptions: y
|
|
538
536
|
});
|
|
539
|
-
},
|
|
540
|
-
return /* @__PURE__ */ $(
|
|
537
|
+
}, ae = We({ mutationKey: a.signIn.all }) + We({ mutationKey: a.signUp.all }) > 0, oe = f.find((e) => e.captchaComponent)?.captchaComponent, w = u?.enabled && !!h?.length;
|
|
538
|
+
return /* @__PURE__ */ $(A, {
|
|
541
539
|
className: J("w-full max-w-sm gap-4 md:p-6", t),
|
|
542
540
|
variant: o,
|
|
543
|
-
...s,
|
|
544
541
|
children: [
|
|
545
|
-
/* @__PURE__ */ Q(
|
|
542
|
+
/* @__PURE__ */ Q(A.Header, { children: /* @__PURE__ */ Q(A.Title, {
|
|
546
543
|
className: "text-xl font-semibold mb-1",
|
|
547
|
-
children:
|
|
544
|
+
children: d.auth.signIn
|
|
548
545
|
}) }),
|
|
549
|
-
/* @__PURE__ */ $(
|
|
546
|
+
/* @__PURE__ */ $(A.Content, {
|
|
550
547
|
className: "gap-4",
|
|
551
548
|
children: [
|
|
552
|
-
i === "top" && /* @__PURE__ */ $(Z, { children: [!!
|
|
553
|
-
|
|
554
|
-
onSubmit:
|
|
549
|
+
i === "top" && /* @__PURE__ */ $(Z, { children: [!!h?.length && /* @__PURE__ */ Q(r, { socialLayout: n }), w && /* @__PURE__ */ Q(e, { children: d.auth.or })] }),
|
|
550
|
+
u?.enabled && /* @__PURE__ */ $(F, {
|
|
551
|
+
onSubmit: C,
|
|
555
552
|
className: "flex flex-col gap-4",
|
|
556
553
|
children: [
|
|
557
554
|
/* @__PURE__ */ $(q, {
|
|
558
555
|
name: "email",
|
|
559
556
|
type: "email",
|
|
560
557
|
autoComplete: "email",
|
|
561
|
-
isDisabled:
|
|
558
|
+
isDisabled: ae,
|
|
562
559
|
validate: (e) => {
|
|
563
|
-
if (!e) return
|
|
564
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return
|
|
560
|
+
if (!e) return d.auth.fieldRequired;
|
|
561
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return d.auth.invalidEmail;
|
|
565
562
|
},
|
|
566
563
|
children: [
|
|
567
|
-
/* @__PURE__ */ Q(
|
|
568
|
-
/* @__PURE__ */ Q(
|
|
569
|
-
placeholder:
|
|
564
|
+
/* @__PURE__ */ Q(R, { children: d.auth.email }),
|
|
565
|
+
/* @__PURE__ */ Q(I, {
|
|
566
|
+
placeholder: d.auth.emailPlaceholder,
|
|
570
567
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
571
568
|
required: !0
|
|
572
569
|
}),
|
|
573
|
-
/* @__PURE__ */ Q(
|
|
570
|
+
/* @__PURE__ */ Q(N, {})
|
|
574
571
|
]
|
|
575
572
|
}),
|
|
576
573
|
/* @__PURE__ */ $(q, {
|
|
577
|
-
minLength:
|
|
578
|
-
maxLength:
|
|
574
|
+
minLength: u?.minPasswordLength,
|
|
575
|
+
maxLength: u?.maxPasswordLength,
|
|
579
576
|
name: "password",
|
|
580
577
|
type: "password",
|
|
581
578
|
autoComplete: "current-password",
|
|
582
|
-
isDisabled:
|
|
583
|
-
value:
|
|
584
|
-
onChange:
|
|
579
|
+
isDisabled: ae,
|
|
580
|
+
value: te,
|
|
581
|
+
onChange: b,
|
|
585
582
|
validate: (e) => {
|
|
586
|
-
if (!e) return
|
|
587
|
-
let t =
|
|
588
|
-
if (t && e.length < t) return
|
|
589
|
-
if (n && e.length > n) return
|
|
583
|
+
if (!e) return d.auth.fieldRequired;
|
|
584
|
+
let t = u?.minPasswordLength, n = u?.maxPasswordLength;
|
|
585
|
+
if (t && e.length < t) return d.auth.tooShort.replace("{{min}}", String(t));
|
|
586
|
+
if (n && e.length > n) return d.auth.tooLong.replace("{{max}}", String(n));
|
|
590
587
|
},
|
|
591
588
|
children: [
|
|
592
|
-
/* @__PURE__ */ Q(
|
|
593
|
-
/* @__PURE__ */ Q(
|
|
594
|
-
placeholder:
|
|
589
|
+
/* @__PURE__ */ Q(R, { children: d.auth.password }),
|
|
590
|
+
/* @__PURE__ */ Q(I, {
|
|
591
|
+
placeholder: d.auth.passwordPlaceholder,
|
|
595
592
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
596
593
|
required: !0
|
|
597
594
|
}),
|
|
598
|
-
/* @__PURE__ */ Q(
|
|
595
|
+
/* @__PURE__ */ Q(N, {})
|
|
599
596
|
]
|
|
600
597
|
}),
|
|
601
|
-
|
|
598
|
+
u?.rememberMe && /* @__PURE__ */ $(j, {
|
|
602
599
|
name: "rememberMe",
|
|
603
|
-
isDisabled:
|
|
600
|
+
isDisabled: ae,
|
|
604
601
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
605
|
-
children: [/* @__PURE__ */ Q(
|
|
602
|
+
children: [/* @__PURE__ */ Q(j.Control, { children: /* @__PURE__ */ Q(j.Indicator, {}) }), /* @__PURE__ */ Q(j.Content, { children: /* @__PURE__ */ Q(R, { children: d.auth.rememberMe }) })]
|
|
606
603
|
}),
|
|
607
604
|
oe && /* @__PURE__ */ Q("div", {
|
|
608
605
|
className: "flex justify-center",
|
|
@@ -610,36 +607,36 @@ function $e({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
610
607
|
}),
|
|
611
608
|
/* @__PURE__ */ $("div", {
|
|
612
609
|
className: "flex flex-col gap-3",
|
|
613
|
-
children: [/* @__PURE__ */ $(
|
|
610
|
+
children: [/* @__PURE__ */ $(O, {
|
|
614
611
|
type: "submit",
|
|
615
612
|
className: "w-full",
|
|
616
|
-
isPending:
|
|
617
|
-
children: [
|
|
613
|
+
isPending: ae,
|
|
614
|
+
children: [S && /* @__PURE__ */ Q(G, {
|
|
618
615
|
color: "current",
|
|
619
616
|
size: "sm"
|
|
620
|
-
}),
|
|
621
|
-
}),
|
|
617
|
+
}), d.auth.signIn]
|
|
618
|
+
}), f.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ Q(t, { view: "signIn" }, `${e.id}-${n.toString()}`)))]
|
|
622
619
|
})
|
|
623
620
|
]
|
|
624
621
|
}),
|
|
625
|
-
i === "bottom" && /* @__PURE__ */ $(Z, { children: [
|
|
622
|
+
i === "bottom" && /* @__PURE__ */ $(Z, { children: [w && /* @__PURE__ */ Q(e, { children: d.auth.or }), !!h?.length && /* @__PURE__ */ Q(r, { socialLayout: n })] })
|
|
626
623
|
]
|
|
627
624
|
}),
|
|
628
|
-
/* @__PURE__ */ $(
|
|
625
|
+
/* @__PURE__ */ $(A.Footer, {
|
|
629
626
|
className: "flex-col gap-3",
|
|
630
|
-
children: [
|
|
631
|
-
href: `${
|
|
627
|
+
children: [u?.enabled && u?.forgotPassword && /* @__PURE__ */ Q(z, {
|
|
628
|
+
href: `${c.auth}/${g.auth.forgotPassword}`,
|
|
632
629
|
className: "no-underline hover:underline",
|
|
633
|
-
children:
|
|
634
|
-
}),
|
|
630
|
+
children: d.auth.forgotPasswordLink
|
|
631
|
+
}), u?.enabled && /* @__PURE__ */ $(De, {
|
|
635
632
|
className: "text-sm",
|
|
636
633
|
children: [
|
|
637
|
-
|
|
634
|
+
d.auth.needToCreateAnAccount,
|
|
638
635
|
" ",
|
|
639
|
-
/* @__PURE__ */ Q(
|
|
640
|
-
href: `${
|
|
636
|
+
/* @__PURE__ */ Q(z, {
|
|
637
|
+
href: `${c.auth}/${g.auth.signUp}`,
|
|
641
638
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
642
|
-
children:
|
|
639
|
+
children: d.auth.signUp
|
|
643
640
|
})
|
|
644
641
|
]
|
|
645
642
|
})]
|
|
@@ -650,7 +647,7 @@ function $e({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
650
647
|
//#endregion
|
|
651
648
|
//#region src/components/auth/sign-out.tsx
|
|
652
649
|
function et({ className: e }) {
|
|
653
|
-
let { authClient: t, basePaths: n, navigate: r, viewPaths: i } = m(), { mutate: a } =
|
|
650
|
+
let { authClient: t, basePaths: n, navigate: r, viewPaths: i } = m(), { mutate: a } = C(t, {
|
|
654
651
|
onError: () => {
|
|
655
652
|
r({
|
|
656
653
|
to: `${n.auth}/${i.auth.signIn}`,
|
|
@@ -671,23 +668,23 @@ function et({ className: e }) {
|
|
|
671
668
|
}
|
|
672
669
|
//#endregion
|
|
673
670
|
//#region src/components/auth/sign-up.tsx
|
|
674
|
-
function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", variant: o
|
|
675
|
-
let { additionalFields:
|
|
671
|
+
function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", variant: o }) {
|
|
672
|
+
let { additionalFields: s, authClient: c, basePaths: u, emailAndPassword: d, localization: f, plugins: p, redirectTo: h, socialProviders: g, viewPaths: _, navigate: y } = m(), { fetchOptions: ee, resetFetchOptions: te } = v(), [b, x] = X(""), [ne, re] = X(""), { mutate: S, isPending: ie } = ae(c, {
|
|
676
673
|
onError: () => {
|
|
677
|
-
|
|
674
|
+
x(""), re(""), te();
|
|
678
675
|
},
|
|
679
676
|
onSuccess: () => {
|
|
680
|
-
|
|
677
|
+
d?.requireEmailVerification ? (Y.success(f.auth.verifyYourEmail), y({ to: `${u.auth}/${_.auth.signIn}` })) : y({ to: h });
|
|
681
678
|
}
|
|
682
|
-
}), [
|
|
679
|
+
}), [C, oe] = X(!1), [w, se] = X(!1), T = We({ mutationKey: a.signIn.all }) + We({ mutationKey: a.signUp.all }) > 0, ce = p.find((e) => e.captchaComponent)?.captchaComponent, le = async (e) => {
|
|
683
680
|
e.preventDefault();
|
|
684
681
|
let t = new FormData(e.currentTarget), n = t.get("name") ?? "", r = t.get("email");
|
|
685
|
-
if (
|
|
686
|
-
Y.danger(
|
|
682
|
+
if (d?.confirmPassword && b !== ne) {
|
|
683
|
+
Y.danger(f.auth.passwordsDoNotMatch), x(""), re("");
|
|
687
684
|
return;
|
|
688
685
|
}
|
|
689
686
|
let i = {};
|
|
690
|
-
for (let e of
|
|
687
|
+
for (let e of s ?? []) {
|
|
691
688
|
if (!e.signUp || e.readOnly) continue;
|
|
692
689
|
let n = l(e, t.get(e.name));
|
|
693
690
|
if (e.validate) try {
|
|
@@ -698,156 +695,155 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
698
695
|
}
|
|
699
696
|
n !== void 0 && (i[e.name] = n);
|
|
700
697
|
}
|
|
701
|
-
|
|
698
|
+
S({
|
|
702
699
|
name: n,
|
|
703
700
|
email: r,
|
|
704
|
-
password:
|
|
701
|
+
password: b,
|
|
705
702
|
...i,
|
|
706
703
|
fetchOptions: ee
|
|
707
704
|
});
|
|
708
|
-
}, ue =
|
|
709
|
-
return /* @__PURE__ */ $(
|
|
705
|
+
}, ue = d?.enabled && !!g?.length;
|
|
706
|
+
return /* @__PURE__ */ $(A, {
|
|
710
707
|
className: J("w-full max-w-sm gap-4 md:p-6", t),
|
|
711
708
|
variant: o,
|
|
712
|
-
...s,
|
|
713
709
|
children: [
|
|
714
|
-
/* @__PURE__ */ Q(
|
|
710
|
+
/* @__PURE__ */ Q(A.Header, { children: /* @__PURE__ */ Q(A.Title, {
|
|
715
711
|
className: "text-xl font-semibold mb-1",
|
|
716
|
-
children:
|
|
712
|
+
children: f.auth.signUp
|
|
717
713
|
}) }),
|
|
718
|
-
/* @__PURE__ */ $(
|
|
714
|
+
/* @__PURE__ */ $(A.Content, {
|
|
719
715
|
className: "gap-4",
|
|
720
716
|
children: [
|
|
721
|
-
i === "top" && /* @__PURE__ */ $(Z, { children: [!!
|
|
722
|
-
|
|
717
|
+
i === "top" && /* @__PURE__ */ $(Z, { children: [!!g?.length && /* @__PURE__ */ Q(r, { socialLayout: n }), ue && /* @__PURE__ */ Q(e, { children: f.auth.or })] }),
|
|
718
|
+
d?.enabled && /* @__PURE__ */ $(F, {
|
|
723
719
|
onSubmit: le,
|
|
724
720
|
className: "flex flex-col gap-4",
|
|
725
721
|
children: [
|
|
726
|
-
|
|
722
|
+
d.name !== !1 && /* @__PURE__ */ $(q, {
|
|
727
723
|
name: "name",
|
|
728
724
|
type: "text",
|
|
729
725
|
autoComplete: "name",
|
|
730
|
-
isDisabled:
|
|
726
|
+
isDisabled: T,
|
|
731
727
|
validate: (e) => {
|
|
732
|
-
if (!e) return
|
|
728
|
+
if (!e) return f.auth.fieldRequired;
|
|
733
729
|
},
|
|
734
730
|
children: [
|
|
735
|
-
/* @__PURE__ */ Q(
|
|
736
|
-
/* @__PURE__ */ Q(
|
|
737
|
-
placeholder:
|
|
731
|
+
/* @__PURE__ */ Q(R, { children: f.auth.name }),
|
|
732
|
+
/* @__PURE__ */ Q(I, {
|
|
733
|
+
placeholder: f.auth.namePlaceholder,
|
|
738
734
|
required: !0,
|
|
739
735
|
variant: o === "transparent" ? "primary" : "secondary"
|
|
740
736
|
}),
|
|
741
|
-
/* @__PURE__ */ Q(
|
|
737
|
+
/* @__PURE__ */ Q(N, {})
|
|
742
738
|
]
|
|
743
739
|
}),
|
|
744
740
|
/* @__PURE__ */ $(q, {
|
|
745
741
|
name: "email",
|
|
746
742
|
type: "email",
|
|
747
743
|
autoComplete: "email",
|
|
748
|
-
isDisabled:
|
|
744
|
+
isDisabled: T,
|
|
749
745
|
validate: (e) => {
|
|
750
|
-
if (!e) return
|
|
751
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return
|
|
746
|
+
if (!e) return f.auth.fieldRequired;
|
|
747
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) return f.auth.invalidEmail;
|
|
752
748
|
},
|
|
753
749
|
children: [
|
|
754
|
-
/* @__PURE__ */ Q(
|
|
755
|
-
/* @__PURE__ */ Q(
|
|
756
|
-
placeholder:
|
|
750
|
+
/* @__PURE__ */ Q(R, { children: f.auth.email }),
|
|
751
|
+
/* @__PURE__ */ Q(I, {
|
|
752
|
+
placeholder: f.auth.emailPlaceholder,
|
|
757
753
|
required: !0,
|
|
758
754
|
variant: o === "transparent" ? "primary" : "secondary"
|
|
759
755
|
}),
|
|
760
|
-
/* @__PURE__ */ Q(
|
|
756
|
+
/* @__PURE__ */ Q(N, {})
|
|
761
757
|
]
|
|
762
758
|
}),
|
|
763
|
-
|
|
759
|
+
s?.map((e) => e.signUp === "above" && /* @__PURE__ */ Q(Xe, {
|
|
764
760
|
name: e.name,
|
|
765
761
|
field: e,
|
|
766
|
-
isPending:
|
|
762
|
+
isPending: T,
|
|
767
763
|
variant: o
|
|
768
764
|
}, e.name)),
|
|
769
765
|
/* @__PURE__ */ $(q, {
|
|
770
|
-
minLength:
|
|
771
|
-
maxLength:
|
|
766
|
+
minLength: d?.minPasswordLength,
|
|
767
|
+
maxLength: d?.maxPasswordLength,
|
|
772
768
|
name: "password",
|
|
773
769
|
autoComplete: "new-password",
|
|
774
|
-
isDisabled:
|
|
775
|
-
value:
|
|
776
|
-
onChange:
|
|
770
|
+
isDisabled: T,
|
|
771
|
+
value: b,
|
|
772
|
+
onChange: x,
|
|
777
773
|
validate: (e) => {
|
|
778
|
-
if (!e) return
|
|
779
|
-
let t =
|
|
780
|
-
if (t && e.length < t) return
|
|
781
|
-
if (n && e.length > n) return
|
|
774
|
+
if (!e) return f.auth.fieldRequired;
|
|
775
|
+
let t = d?.minPasswordLength, n = d?.maxPasswordLength;
|
|
776
|
+
if (t && e.length < t) return f.auth.tooShort.replace("{{min}}", String(t));
|
|
777
|
+
if (n && e.length > n) return f.auth.tooLong.replace("{{max}}", String(n));
|
|
782
778
|
},
|
|
783
779
|
children: [
|
|
784
|
-
/* @__PURE__ */ Q(
|
|
785
|
-
/* @__PURE__ */ $(
|
|
780
|
+
/* @__PURE__ */ Q(R, { children: f.auth.password }),
|
|
781
|
+
/* @__PURE__ */ $(L, {
|
|
786
782
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
787
|
-
children: [/* @__PURE__ */ Q(
|
|
788
|
-
placeholder:
|
|
789
|
-
type:
|
|
783
|
+
children: [/* @__PURE__ */ Q(L.Input, {
|
|
784
|
+
placeholder: f.auth.passwordPlaceholder,
|
|
785
|
+
type: C ? "text" : "password",
|
|
790
786
|
name: "password",
|
|
791
787
|
required: !0
|
|
792
|
-
}), /* @__PURE__ */ Q(
|
|
788
|
+
}), /* @__PURE__ */ Q(L.Suffix, {
|
|
793
789
|
className: "px-0",
|
|
794
|
-
children: /* @__PURE__ */ Q(
|
|
790
|
+
children: /* @__PURE__ */ Q(O, {
|
|
795
791
|
isIconOnly: !0,
|
|
796
|
-
"aria-label":
|
|
792
|
+
"aria-label": C ? f.auth.hidePassword : f.auth.showPassword,
|
|
797
793
|
size: "sm",
|
|
798
794
|
variant: "ghost",
|
|
799
|
-
onPress: () => oe(!
|
|
800
|
-
isDisabled:
|
|
801
|
-
children: Q(
|
|
795
|
+
onPress: () => oe(!C),
|
|
796
|
+
isDisabled: T,
|
|
797
|
+
children: Q(C ? D : E, {})
|
|
802
798
|
})
|
|
803
799
|
})]
|
|
804
800
|
}),
|
|
805
|
-
/* @__PURE__ */ Q(
|
|
801
|
+
/* @__PURE__ */ Q(N, {})
|
|
806
802
|
]
|
|
807
803
|
}),
|
|
808
|
-
|
|
809
|
-
minLength:
|
|
810
|
-
maxLength:
|
|
804
|
+
d?.confirmPassword && /* @__PURE__ */ $(q, {
|
|
805
|
+
minLength: d?.minPasswordLength,
|
|
806
|
+
maxLength: d?.maxPasswordLength,
|
|
811
807
|
name: "confirmPassword",
|
|
812
808
|
autoComplete: "new-password",
|
|
813
|
-
isDisabled:
|
|
809
|
+
isDisabled: T,
|
|
814
810
|
value: ne,
|
|
815
|
-
onChange:
|
|
811
|
+
onChange: re,
|
|
816
812
|
validate: (e) => {
|
|
817
|
-
if (!e) return
|
|
818
|
-
let t =
|
|
819
|
-
if (t && e.length < t) return
|
|
820
|
-
if (n && e.length > n) return
|
|
813
|
+
if (!e) return f.auth.fieldRequired;
|
|
814
|
+
let t = d?.minPasswordLength, n = d?.maxPasswordLength;
|
|
815
|
+
if (t && e.length < t) return f.auth.tooShort.replace("{{min}}", String(t));
|
|
816
|
+
if (n && e.length > n) return f.auth.tooLong.replace("{{max}}", String(n));
|
|
821
817
|
},
|
|
822
818
|
children: [
|
|
823
|
-
/* @__PURE__ */ Q(
|
|
824
|
-
/* @__PURE__ */ $(
|
|
819
|
+
/* @__PURE__ */ Q(R, { children: f.auth.confirmPassword }),
|
|
820
|
+
/* @__PURE__ */ $(L, {
|
|
825
821
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
826
|
-
children: [/* @__PURE__ */ Q(
|
|
822
|
+
children: [/* @__PURE__ */ Q(L.Input, {
|
|
827
823
|
name: "confirmPassword",
|
|
828
|
-
placeholder:
|
|
829
|
-
type:
|
|
824
|
+
placeholder: f.auth.confirmPasswordPlaceholder,
|
|
825
|
+
type: w ? "text" : "password",
|
|
830
826
|
required: !0
|
|
831
|
-
}), /* @__PURE__ */ Q(
|
|
827
|
+
}), /* @__PURE__ */ Q(L.Suffix, {
|
|
832
828
|
className: "px-0",
|
|
833
|
-
children: /* @__PURE__ */ Q(
|
|
829
|
+
children: /* @__PURE__ */ Q(O, {
|
|
834
830
|
isIconOnly: !0,
|
|
835
|
-
"aria-label":
|
|
831
|
+
"aria-label": w ? f.auth.hidePassword : f.auth.showPassword,
|
|
836
832
|
size: "sm",
|
|
837
833
|
variant: "ghost",
|
|
838
|
-
onPress: () => se(!
|
|
839
|
-
isDisabled:
|
|
840
|
-
children: Q(
|
|
834
|
+
onPress: () => se(!w),
|
|
835
|
+
isDisabled: T,
|
|
836
|
+
children: Q(w ? D : E, {})
|
|
841
837
|
})
|
|
842
838
|
})]
|
|
843
839
|
}),
|
|
844
|
-
/* @__PURE__ */ Q(
|
|
840
|
+
/* @__PURE__ */ Q(N, {})
|
|
845
841
|
]
|
|
846
842
|
}),
|
|
847
|
-
|
|
843
|
+
s?.map((e) => e.signUp && e.signUp !== "above" && /* @__PURE__ */ Q(Xe, {
|
|
848
844
|
name: e.name,
|
|
849
845
|
field: e,
|
|
850
|
-
isPending:
|
|
846
|
+
isPending: T,
|
|
851
847
|
variant: o
|
|
852
848
|
}, e.name)),
|
|
853
849
|
ce && /* @__PURE__ */ Q("div", {
|
|
@@ -856,32 +852,32 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
856
852
|
}),
|
|
857
853
|
/* @__PURE__ */ $("div", {
|
|
858
854
|
className: "flex flex-col gap-3",
|
|
859
|
-
children: [/* @__PURE__ */ $(
|
|
855
|
+
children: [/* @__PURE__ */ $(O, {
|
|
860
856
|
type: "submit",
|
|
861
857
|
className: "w-full",
|
|
862
|
-
isPending:
|
|
858
|
+
isPending: T,
|
|
863
859
|
children: [ie && /* @__PURE__ */ Q(G, {
|
|
864
860
|
color: "current",
|
|
865
861
|
size: "sm"
|
|
866
|
-
}),
|
|
867
|
-
}),
|
|
862
|
+
}), f.auth.signUp]
|
|
863
|
+
}), p.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ Q(t, { view: "signUp" }, `${e.id}-${n.toString()}`)))]
|
|
868
864
|
})
|
|
869
865
|
]
|
|
870
866
|
}),
|
|
871
|
-
i === "bottom" && /* @__PURE__ */ $(Z, { children: [ue && /* @__PURE__ */ Q(e, { children:
|
|
867
|
+
i === "bottom" && /* @__PURE__ */ $(Z, { children: [ue && /* @__PURE__ */ Q(e, { children: f.auth.or }), !!g?.length && /* @__PURE__ */ Q(r, { socialLayout: n })] })
|
|
872
868
|
]
|
|
873
869
|
}),
|
|
874
|
-
/* @__PURE__ */ Q(
|
|
870
|
+
/* @__PURE__ */ Q(A.Footer, {
|
|
875
871
|
className: "flex-col gap-3",
|
|
876
|
-
children: /* @__PURE__ */ $(
|
|
872
|
+
children: /* @__PURE__ */ $(De, {
|
|
877
873
|
className: "text-sm",
|
|
878
874
|
children: [
|
|
879
|
-
|
|
875
|
+
f.auth.alreadyHaveAnAccount,
|
|
880
876
|
" ",
|
|
881
|
-
/* @__PURE__ */ Q(
|
|
882
|
-
href: `${
|
|
877
|
+
/* @__PURE__ */ Q(z, {
|
|
878
|
+
href: `${u.auth}/${_.auth.signIn}`,
|
|
883
879
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
884
|
-
children:
|
|
880
|
+
children: f.auth.signIn
|
|
885
881
|
})
|
|
886
882
|
]
|
|
887
883
|
})
|
|
@@ -902,45 +898,48 @@ var nt = [
|
|
|
902
898
|
forgotPassword: Ze,
|
|
903
899
|
resetPassword: Qe
|
|
904
900
|
};
|
|
905
|
-
function it({
|
|
906
|
-
let { basePaths:
|
|
907
|
-
if (!
|
|
908
|
-
let
|
|
901
|
+
function it({ className: e, path: t, socialLayout: n, socialPosition: r, variant: i, view: a }) {
|
|
902
|
+
let { basePaths: o, emailAndPassword: s, plugins: c, viewPaths: l, navigate: u } = m();
|
|
903
|
+
if (!a && !t) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
|
|
904
|
+
let d = a || Object.keys(l.auth).find((e) => l.auth[e] === t), f = !s?.enabled && d && nt.includes(d);
|
|
909
905
|
if (ze(() => {
|
|
910
|
-
|
|
911
|
-
to: `${
|
|
906
|
+
f && u({
|
|
907
|
+
to: `${o.auth}/${l.auth.signIn}`,
|
|
912
908
|
replace: !0
|
|
913
909
|
});
|
|
914
910
|
}, [
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
]),
|
|
920
|
-
for (let
|
|
921
|
-
let
|
|
922
|
-
if (!
|
|
923
|
-
let
|
|
924
|
-
if (
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
911
|
+
f,
|
|
912
|
+
u,
|
|
913
|
+
o.auth,
|
|
914
|
+
l.auth.signIn
|
|
915
|
+
]), f) return null;
|
|
916
|
+
for (let o of c) {
|
|
917
|
+
let s = o.viewPaths?.auth, c = a ?? d ?? (s && Object.keys(s).find((e) => s[e] === t));
|
|
918
|
+
if (!c) continue;
|
|
919
|
+
let l = o.views?.auth?.[c];
|
|
920
|
+
if (l) return /* @__PURE__ */ Q(l, {
|
|
921
|
+
className: e,
|
|
922
|
+
socialLayout: n,
|
|
923
|
+
socialPosition: r,
|
|
924
|
+
variant: i
|
|
928
925
|
});
|
|
929
926
|
}
|
|
930
|
-
if (
|
|
931
|
-
let
|
|
932
|
-
if (
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
927
|
+
if (d === "signIn" && !s?.enabled) {
|
|
928
|
+
let t = c.find((e) => e.fallbackViews?.auth?.signIn)?.fallbackViews?.auth?.signIn;
|
|
929
|
+
if (t) return /* @__PURE__ */ Q(t, {
|
|
930
|
+
className: e,
|
|
931
|
+
socialLayout: n,
|
|
932
|
+
socialPosition: r,
|
|
933
|
+
variant: i
|
|
936
934
|
});
|
|
937
935
|
}
|
|
938
|
-
let
|
|
939
|
-
if (!
|
|
940
|
-
return /* @__PURE__ */ Q(
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
936
|
+
let p = d ? rt[d] : void 0;
|
|
937
|
+
if (!p) throw Error(`[Better Auth UI] Unknown view "${d}". Valid views are: ${Object.keys(rt).join(", ")}`);
|
|
938
|
+
return /* @__PURE__ */ Q(p, {
|
|
939
|
+
className: e,
|
|
940
|
+
socialLayout: n,
|
|
941
|
+
socialPosition: r,
|
|
942
|
+
variant: i
|
|
944
943
|
});
|
|
945
944
|
}
|
|
946
945
|
//#endregion
|
|
@@ -970,7 +969,7 @@ function ot({ children: e, navigate: t, ...n }) {
|
|
|
970
969
|
return /* @__PURE__ */ Q(d, {
|
|
971
970
|
navigate: t,
|
|
972
971
|
...n,
|
|
973
|
-
children: /* @__PURE__ */ $(
|
|
972
|
+
children: /* @__PURE__ */ $(Oe, {
|
|
974
973
|
navigate: (e) => t({ to: e }),
|
|
975
974
|
children: [e, /* @__PURE__ */ Q(at, {})]
|
|
976
975
|
})
|
|
@@ -979,7 +978,7 @@ function ot({ children: e, navigate: t, ...n }) {
|
|
|
979
978
|
//#endregion
|
|
980
979
|
//#region src/components/auth/settings/account/change-email.tsx
|
|
981
980
|
function st({ className: e, variant: t, ...n }) {
|
|
982
|
-
let { authClient: r, localization: i, baseURL: a, viewPaths: o } = m(), { data: s } =
|
|
981
|
+
let { authClient: r, localization: i, baseURL: a, viewPaths: o } = m(), { data: s } = S(r), { mutate: c, isPending: l } = g(r, { onSuccess: () => Y.success(i.settings.changeEmailSuccess) });
|
|
983
982
|
function u(e) {
|
|
984
983
|
e.preventDefault(), c({
|
|
985
984
|
newEmail: new FormData(e.currentTarget).get("email"),
|
|
@@ -989,30 +988,30 @@ function st({ className: e, variant: t, ...n }) {
|
|
|
989
988
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
990
989
|
className: J("text-sm font-semibold mb-3"),
|
|
991
990
|
children: i.settings.changeEmail
|
|
992
|
-
}), /* @__PURE__ */ Q(
|
|
991
|
+
}), /* @__PURE__ */ Q(A, {
|
|
993
992
|
className: J("p-4 gap-4", e),
|
|
994
993
|
variant: t,
|
|
995
994
|
...n,
|
|
996
|
-
children: /* @__PURE__ */ Q(
|
|
995
|
+
children: /* @__PURE__ */ Q(A.Content, { children: /* @__PURE__ */ Q(F, {
|
|
997
996
|
onSubmit: u,
|
|
998
|
-
children: /* @__PURE__ */ $(
|
|
997
|
+
children: /* @__PURE__ */ $(P, {
|
|
999
998
|
className: "w-full gap-4",
|
|
1000
|
-
children: [/* @__PURE__ */ Q(
|
|
999
|
+
children: [/* @__PURE__ */ Q(P.Group, { children: /* @__PURE__ */ $(q, {
|
|
1001
1000
|
name: "email",
|
|
1002
1001
|
type: "email",
|
|
1003
1002
|
defaultValue: s?.user.email,
|
|
1004
1003
|
isDisabled: l || !s,
|
|
1005
1004
|
children: [
|
|
1006
|
-
/* @__PURE__ */ Q(
|
|
1007
|
-
s ? /* @__PURE__ */ Q(
|
|
1005
|
+
/* @__PURE__ */ Q(R, { children: i.auth.email }),
|
|
1006
|
+
s ? /* @__PURE__ */ Q(I, {
|
|
1008
1007
|
required: !0,
|
|
1009
1008
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
1010
1009
|
autoComplete: "email",
|
|
1011
1010
|
placeholder: i.auth.emailPlaceholder
|
|
1012
|
-
}) : /* @__PURE__ */ Q(
|
|
1013
|
-
/* @__PURE__ */ Q(
|
|
1011
|
+
}) : /* @__PURE__ */ Q(U, { className: "h-10 md:h-9 w-full rounded-xl" }),
|
|
1012
|
+
/* @__PURE__ */ Q(N, {})
|
|
1014
1013
|
]
|
|
1015
|
-
}, `${s?.user.id}-${s?.user.email}-email`) }), /* @__PURE__ */ Q(
|
|
1014
|
+
}, `${s?.user.id}-${s?.user.email}-email`) }), /* @__PURE__ */ Q(P.Actions, { children: /* @__PURE__ */ $(O, {
|
|
1016
1015
|
type: "submit",
|
|
1017
1016
|
isPending: l,
|
|
1018
1017
|
isDisabled: !s,
|
|
@@ -1029,7 +1028,7 @@ function st({ className: e, variant: t, ...n }) {
|
|
|
1029
1028
|
//#endregion
|
|
1030
1029
|
//#region src/components/auth/settings/account/change-avatar.tsx
|
|
1031
1030
|
function ct({ className: e }) {
|
|
1032
|
-
let { authClient: t, localization: r, avatar: i } = m(), { data: a } =
|
|
1031
|
+
let { authClient: t, localization: r, avatar: i } = m(), { data: a } = S(t), { mutate: o, isPending: c } = w(t), l = Ve(null), [u, d] = X(!1), [f, p] = X(!1), h = c || u || f;
|
|
1033
1032
|
async function g(e) {
|
|
1034
1033
|
let t = e.target.files?.[0];
|
|
1035
1034
|
if (t) {
|
|
@@ -1060,7 +1059,7 @@ function ct({ className: e }) {
|
|
|
1060
1059
|
return /* @__PURE__ */ $("div", {
|
|
1061
1060
|
className: J("flex flex-col gap-1", e),
|
|
1062
1061
|
children: [
|
|
1063
|
-
/* @__PURE__ */ Q(
|
|
1062
|
+
/* @__PURE__ */ Q(R, {
|
|
1064
1063
|
isDisabled: !a,
|
|
1065
1064
|
children: r.settings.avatar
|
|
1066
1065
|
}),
|
|
@@ -1073,7 +1072,7 @@ function ct({ className: e }) {
|
|
|
1073
1072
|
}),
|
|
1074
1073
|
/* @__PURE__ */ $("div", {
|
|
1075
1074
|
className: "flex items-center gap-4",
|
|
1076
|
-
children: [/* @__PURE__ */ Q(
|
|
1075
|
+
children: [/* @__PURE__ */ Q(O, {
|
|
1077
1076
|
type: "button",
|
|
1078
1077
|
isIconOnly: !0,
|
|
1079
1078
|
variant: "ghost",
|
|
@@ -1084,23 +1083,23 @@ function ct({ className: e }) {
|
|
|
1084
1083
|
size: "lg",
|
|
1085
1084
|
isPending: h
|
|
1086
1085
|
})
|
|
1087
|
-
}), /* @__PURE__ */ $(
|
|
1086
|
+
}), /* @__PURE__ */ $(M, { children: [/* @__PURE__ */ $(O, {
|
|
1088
1087
|
isDisabled: !a || h,
|
|
1089
1088
|
size: "sm",
|
|
1090
1089
|
variant: "secondary",
|
|
1091
1090
|
children: [h && /* @__PURE__ */ Q(G, { size: "sm" }), r.settings.changeAvatar]
|
|
1092
|
-
}), /* @__PURE__ */ Q(
|
|
1091
|
+
}), /* @__PURE__ */ Q(M.Popover, {
|
|
1093
1092
|
className: "min-w-fit",
|
|
1094
|
-
children: /* @__PURE__ */ $(
|
|
1093
|
+
children: /* @__PURE__ */ $(M.Menu, { children: [/* @__PURE__ */ $(M.Item, {
|
|
1095
1094
|
textValue: r.settings.uploadAvatar,
|
|
1096
1095
|
onAction: () => l.current?.click(),
|
|
1097
|
-
children: [/* @__PURE__ */ Q(
|
|
1098
|
-
}), /* @__PURE__ */ $(
|
|
1096
|
+
children: [/* @__PURE__ */ Q(ue, { className: "text-muted" }), /* @__PURE__ */ Q(R, { children: r.settings.uploadAvatar })]
|
|
1097
|
+
}), /* @__PURE__ */ $(M.Item, {
|
|
1099
1098
|
textValue: r.settings.deleteAvatar,
|
|
1100
1099
|
isDisabled: !a?.user.image,
|
|
1101
1100
|
onAction: _,
|
|
1102
1101
|
variant: "danger",
|
|
1103
|
-
children: [/* @__PURE__ */ Q(
|
|
1102
|
+
children: [/* @__PURE__ */ Q(xe, { className: "text-danger" }), /* @__PURE__ */ Q(R, { children: r.settings.deleteAvatar })]
|
|
1104
1103
|
})] })
|
|
1105
1104
|
})] })]
|
|
1106
1105
|
})
|
|
@@ -1110,7 +1109,7 @@ function ct({ className: e }) {
|
|
|
1110
1109
|
//#endregion
|
|
1111
1110
|
//#region src/components/auth/settings/account/user-profile.tsx
|
|
1112
1111
|
function lt({ className: e, variant: t, ...n }) {
|
|
1113
|
-
let { additionalFields: r, authClient: i, localization: a } = m(), { data: o } =
|
|
1112
|
+
let { additionalFields: r, authClient: i, localization: a } = m(), { data: o } = S(i), { mutate: s, isPending: c } = w(i, { onSuccess: () => Y.success(a.settings.profileUpdatedSuccess) });
|
|
1114
1113
|
async function u(e) {
|
|
1115
1114
|
e.preventDefault();
|
|
1116
1115
|
let t = new FormData(e.currentTarget), n = t.get("name"), i = {};
|
|
@@ -1133,11 +1132,11 @@ function lt({ className: e, variant: t, ...n }) {
|
|
|
1133
1132
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1134
1133
|
className: J("text-sm font-semibold mb-3"),
|
|
1135
1134
|
children: a.settings.userProfile
|
|
1136
|
-
}), /* @__PURE__ */ Q(
|
|
1135
|
+
}), /* @__PURE__ */ Q(A, {
|
|
1137
1136
|
className: J("p-4 gap-4", e),
|
|
1138
1137
|
variant: t,
|
|
1139
1138
|
...n,
|
|
1140
|
-
children: /* @__PURE__ */ Q(
|
|
1139
|
+
children: /* @__PURE__ */ Q(A.Content, { children: /* @__PURE__ */ $(F, {
|
|
1141
1140
|
onSubmit: u,
|
|
1142
1141
|
className: "flex flex-col gap-4",
|
|
1143
1142
|
children: [
|
|
@@ -1147,19 +1146,19 @@ function lt({ className: e, variant: t, ...n }) {
|
|
|
1147
1146
|
defaultValue: o?.user.name,
|
|
1148
1147
|
isDisabled: c || !o,
|
|
1149
1148
|
children: [
|
|
1150
|
-
/* @__PURE__ */ Q(
|
|
1151
|
-
/* @__PURE__ */ Q(
|
|
1149
|
+
/* @__PURE__ */ Q(R, { children: a.auth.name }),
|
|
1150
|
+
/* @__PURE__ */ Q(I, {
|
|
1152
1151
|
className: J(!o && "hidden"),
|
|
1153
1152
|
autoComplete: "name",
|
|
1154
1153
|
placeholder: a.auth.name,
|
|
1155
1154
|
variant: t === "transparent" ? "primary" : "secondary"
|
|
1156
1155
|
}),
|
|
1157
|
-
!o && /* @__PURE__ */ Q(
|
|
1158
|
-
/* @__PURE__ */ Q(
|
|
1156
|
+
!o && /* @__PURE__ */ Q(U, { className: "h-10 md:h-9 w-full rounded-xl" }),
|
|
1157
|
+
/* @__PURE__ */ Q(N, {})
|
|
1159
1158
|
]
|
|
1160
1159
|
}, `${o?.user?.id}-${o?.user?.name}-name`),
|
|
1161
1160
|
r?.filter((e) => e.profile !== !1).map((e) => {
|
|
1162
|
-
if (!o) return e.inputType === "hidden" ? null : /* @__PURE__ */ Q(
|
|
1161
|
+
if (!o) return e.inputType === "hidden" ? null : /* @__PURE__ */ Q(U, { className: "h-10 md:h-9 w-full rounded-xl" }, e.name);
|
|
1163
1162
|
let n = o.user[e.name], r = `${o.user.id}-${e.name}-${n instanceof Date ? n.toISOString() : String(n ?? "")}`;
|
|
1164
1163
|
return /* @__PURE__ */ Q(Xe, {
|
|
1165
1164
|
name: e.name,
|
|
@@ -1171,7 +1170,7 @@ function lt({ className: e, variant: t, ...n }) {
|
|
|
1171
1170
|
variant: t
|
|
1172
1171
|
}, r);
|
|
1173
1172
|
}),
|
|
1174
|
-
/* @__PURE__ */ $(
|
|
1173
|
+
/* @__PURE__ */ $(O, {
|
|
1175
1174
|
type: "submit",
|
|
1176
1175
|
isPending: c,
|
|
1177
1176
|
isDisabled: !o,
|
|
@@ -1216,20 +1215,20 @@ function dt(e) {
|
|
|
1216
1215
|
return n.format(0, "second");
|
|
1217
1216
|
}
|
|
1218
1217
|
function ft({ activeSession: e }) {
|
|
1219
|
-
let { authClient: t, basePaths: n, localization: r, viewPaths: i, navigate: a } = m(), { data: o } =
|
|
1218
|
+
let { authClient: t, basePaths: n, localization: r, viewPaths: i, navigate: a } = m(), { data: o } = S(t, { refetchOnMount: !1 }), { mutate: s, isPending: c } = ne(t, { onSuccess: () => Y.success(r.settings.revokeSessionSuccess) }), l = e.token === o?.session.token, u = Ke.parse(e.userAgent || "");
|
|
1220
1219
|
return /* @__PURE__ */ $("div", {
|
|
1221
1220
|
className: "flex items-center gap-3",
|
|
1222
1221
|
children: [
|
|
1223
1222
|
/* @__PURE__ */ Q("div", {
|
|
1224
1223
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
1225
|
-
children: u.platform.type === "mobile" || u.platform.type === "tablet" ? /* @__PURE__ */ Q(
|
|
1224
|
+
children: u.platform.type === "mobile" || u.platform.type === "tablet" ? /* @__PURE__ */ Q(be, { className: "size-4.5" }) : /* @__PURE__ */ Q(fe, { className: "size-4.5" })
|
|
1226
1225
|
}),
|
|
1227
1226
|
/* @__PURE__ */ $("div", {
|
|
1228
1227
|
className: "flex flex-col min-w-0",
|
|
1229
1228
|
children: [/* @__PURE__ */ $("span", {
|
|
1230
1229
|
className: "text-sm font-medium truncate",
|
|
1231
1230
|
children: [u.browser.name || "Unknown Browser", u.os.name ? `, ${u.os.name}` : ""]
|
|
1232
|
-
}), l ? /* @__PURE__ */ Q(
|
|
1231
|
+
}), l ? /* @__PURE__ */ Q(Ce, {
|
|
1233
1232
|
color: "accent",
|
|
1234
1233
|
size: "sm",
|
|
1235
1234
|
children: r.settings.currentSession
|
|
@@ -1238,7 +1237,7 @@ function ft({ activeSession: e }) {
|
|
|
1238
1237
|
children: dt(e.createdAt)
|
|
1239
1238
|
})]
|
|
1240
1239
|
}),
|
|
1241
|
-
/* @__PURE__ */ $(
|
|
1240
|
+
/* @__PURE__ */ $(O, {
|
|
1242
1241
|
className: "ml-auto shrink-0",
|
|
1243
1242
|
variant: "outline",
|
|
1244
1243
|
size: "sm",
|
|
@@ -1248,7 +1247,7 @@ function ft({ activeSession: e }) {
|
|
|
1248
1247
|
children: [c ? /* @__PURE__ */ Q(G, {
|
|
1249
1248
|
color: "current",
|
|
1250
1249
|
size: "sm"
|
|
1251
|
-
}) : Q(l ?
|
|
1250
|
+
}) : Q(l ? se : Se, {}), l ? r.auth.signOut : r.settings.revoke]
|
|
1252
1251
|
})
|
|
1253
1252
|
]
|
|
1254
1253
|
});
|
|
@@ -1256,15 +1255,15 @@ function ft({ activeSession: e }) {
|
|
|
1256
1255
|
//#endregion
|
|
1257
1256
|
//#region src/components/auth/settings/security/active-sessions.tsx
|
|
1258
1257
|
function pt({ className: e, variant: t, ...n }) {
|
|
1259
|
-
let { authClient: r, localization: i } = m(), { data: a } =
|
|
1258
|
+
let { authClient: r, localization: i } = m(), { data: a } = S(r), { data: o, isPending: s } = te(r), c = o && [...o].sort((e, t) => e.id === a?.session.id ? -1 : +(t.id === a?.session.id));
|
|
1260
1259
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1261
1260
|
className: J("text-sm font-semibold mb-3"),
|
|
1262
1261
|
children: i.settings.activeSessions
|
|
1263
|
-
}), /* @__PURE__ */ Q(
|
|
1262
|
+
}), /* @__PURE__ */ Q(A, {
|
|
1264
1263
|
className: J(e),
|
|
1265
1264
|
variant: t,
|
|
1266
1265
|
...n,
|
|
1267
|
-
children: /* @__PURE__ */ Q(
|
|
1266
|
+
children: /* @__PURE__ */ Q(A.Content, {
|
|
1268
1267
|
className: "gap-0",
|
|
1269
1268
|
children: s ? /* @__PURE__ */ Q(mt, {}) : c?.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(ft, { activeSession: e })] }, e.id))
|
|
1270
1269
|
})
|
|
@@ -1275,9 +1274,9 @@ function mt() {
|
|
|
1275
1274
|
className: "flex items-center justify-between",
|
|
1276
1275
|
children: /* @__PURE__ */ $("div", {
|
|
1277
1276
|
className: "flex items-center gap-3",
|
|
1278
|
-
children: [/* @__PURE__ */ Q(
|
|
1277
|
+
children: [/* @__PURE__ */ Q(U, { className: "size-10 rounded-xl" }), /* @__PURE__ */ $("div", {
|
|
1279
1278
|
className: "flex flex-col gap-1",
|
|
1280
|
-
children: [/* @__PURE__ */ Q(
|
|
1279
|
+
children: [/* @__PURE__ */ Q(U, { className: "h-4 w-32 rounded-lg" }), /* @__PURE__ */ Q(U, { className: "h-3 w-24 rounded-lg" })]
|
|
1281
1280
|
})]
|
|
1282
1281
|
})
|
|
1283
1282
|
});
|
|
@@ -1285,7 +1284,7 @@ function mt() {
|
|
|
1285
1284
|
//#endregion
|
|
1286
1285
|
//#region src/components/auth/settings/security/change-password.tsx
|
|
1287
1286
|
function ht({ className: e, variant: t, ...n }) {
|
|
1288
|
-
let { authClient: r, emailAndPassword: i, localization: a } = m(), { data: o } =
|
|
1287
|
+
let { authClient: r, emailAndPassword: i, localization: a } = m(), { data: o } = S(r), { data: s, isPending: c } = ee(r), l = s?.some((e) => e.providerId === "credential");
|
|
1289
1288
|
return !c && !l ? /* @__PURE__ */ Q(gt, {
|
|
1290
1289
|
className: e,
|
|
1291
1290
|
variant: t,
|
|
@@ -1300,7 +1299,7 @@ function ht({ className: e, variant: t, ...n }) {
|
|
|
1300
1299
|
});
|
|
1301
1300
|
}
|
|
1302
1301
|
function gt({ className: e, variant: t, ...n }) {
|
|
1303
|
-
let { authClient: r, localization: i, plugins: a } = m(), { data: o } =
|
|
1302
|
+
let { authClient: r, localization: i, plugins: a } = m(), { data: o } = S(r), { fetchOptions: s, resetFetchOptions: c } = v(), { mutate: l, isPending: u } = b(r, {
|
|
1304
1303
|
onError: () => {
|
|
1305
1304
|
c();
|
|
1306
1305
|
},
|
|
@@ -1314,11 +1313,11 @@ function gt({ className: e, variant: t, ...n }) {
|
|
|
1314
1313
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1315
1314
|
className: J("text-sm font-semibold mb-3"),
|
|
1316
1315
|
children: i.settings.changePassword
|
|
1317
|
-
}), /* @__PURE__ */ Q(
|
|
1316
|
+
}), /* @__PURE__ */ Q(A, {
|
|
1318
1317
|
className: J(e),
|
|
1319
1318
|
variant: t,
|
|
1320
1319
|
...n,
|
|
1321
|
-
children: /* @__PURE__ */ $(
|
|
1320
|
+
children: /* @__PURE__ */ $(A.Content, {
|
|
1322
1321
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1323
1322
|
children: [/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("p", {
|
|
1324
1323
|
className: "text-sm font-medium leading-tight",
|
|
@@ -1328,7 +1327,7 @@ function gt({ className: e, variant: t, ...n }) {
|
|
|
1328
1327
|
children: i.settings.setPasswordDescription
|
|
1329
1328
|
})] }), /* @__PURE__ */ $("div", {
|
|
1330
1329
|
className: "flex flex-col gap-3 items-start sm:items-end",
|
|
1331
|
-
children: [d && /* @__PURE__ */ Q("div", { children: d }), /* @__PURE__ */ $(
|
|
1330
|
+
children: [d && /* @__PURE__ */ Q("div", { children: d }), /* @__PURE__ */ $(O, {
|
|
1332
1331
|
size: "sm",
|
|
1333
1332
|
isPending: u,
|
|
1334
1333
|
isDisabled: !o?.user.email,
|
|
@@ -1350,7 +1349,7 @@ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1350
1349
|
onSuccess: () => {
|
|
1351
1350
|
c(""), u(""), f(""), Y.success(r.settings.changePasswordSuccess);
|
|
1352
1351
|
}
|
|
1353
|
-
}), [g, v] = X(!1), [y,
|
|
1352
|
+
}), [g, v] = X(!1), [y, ee] = X(!1), te = (e) => {
|
|
1354
1353
|
if (e.preventDefault(), n?.confirmPassword && l !== d) {
|
|
1355
1354
|
c(""), u(""), f(""), Y.danger(r.auth.passwordsDoNotMatch);
|
|
1356
1355
|
return;
|
|
@@ -1364,15 +1363,15 @@ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1364
1363
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1365
1364
|
className: J("text-sm font-semibold mb-3"),
|
|
1366
1365
|
children: r.settings.changePassword
|
|
1367
|
-
}), /* @__PURE__ */ Q(
|
|
1366
|
+
}), /* @__PURE__ */ Q(A, {
|
|
1368
1367
|
className: J("p-4 gap-4", e),
|
|
1369
1368
|
variant: t,
|
|
1370
1369
|
...a,
|
|
1371
|
-
children: /* @__PURE__ */ Q(
|
|
1372
|
-
onSubmit:
|
|
1373
|
-
children: /* @__PURE__ */ $(
|
|
1370
|
+
children: /* @__PURE__ */ Q(A.Content, { children: /* @__PURE__ */ Q(F, {
|
|
1371
|
+
onSubmit: te,
|
|
1372
|
+
children: /* @__PURE__ */ $(P, {
|
|
1374
1373
|
className: "w-full gap-4",
|
|
1375
|
-
children: [/* @__PURE__ */ $(
|
|
1374
|
+
children: [/* @__PURE__ */ $(P.Group, { children: [
|
|
1376
1375
|
/* @__PURE__ */ $(q, {
|
|
1377
1376
|
name: "currentPassword",
|
|
1378
1377
|
type: "password",
|
|
@@ -1381,16 +1380,16 @@ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1381
1380
|
value: s,
|
|
1382
1381
|
onChange: c,
|
|
1383
1382
|
children: [
|
|
1384
|
-
/* @__PURE__ */ Q(
|
|
1385
|
-
/* @__PURE__ */ Q(
|
|
1383
|
+
/* @__PURE__ */ Q(R, { children: r.settings.currentPassword }),
|
|
1384
|
+
/* @__PURE__ */ Q(I, {
|
|
1386
1385
|
className: J(!i && "hidden"),
|
|
1387
1386
|
autoComplete: "current-password",
|
|
1388
1387
|
placeholder: r.settings.currentPasswordPlaceholder,
|
|
1389
1388
|
required: !0,
|
|
1390
1389
|
variant: t === "transparent" ? "primary" : "secondary"
|
|
1391
1390
|
}),
|
|
1392
|
-
!i && /* @__PURE__ */ Q(
|
|
1393
|
-
/* @__PURE__ */ Q(
|
|
1391
|
+
!i && /* @__PURE__ */ Q(U, { className: "h-10 md:h-9 w-full rounded-xl" }),
|
|
1392
|
+
/* @__PURE__ */ Q(N, {})
|
|
1394
1393
|
]
|
|
1395
1394
|
}),
|
|
1396
1395
|
/* @__PURE__ */ $(q, {
|
|
@@ -1400,31 +1399,31 @@ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1400
1399
|
value: l,
|
|
1401
1400
|
onChange: u,
|
|
1402
1401
|
children: [
|
|
1403
|
-
/* @__PURE__ */ Q(
|
|
1404
|
-
/* @__PURE__ */ $(
|
|
1402
|
+
/* @__PURE__ */ Q(R, { children: r.auth.newPassword }),
|
|
1403
|
+
/* @__PURE__ */ $(L, {
|
|
1405
1404
|
className: J(!i && "hidden"),
|
|
1406
1405
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
1407
|
-
children: [/* @__PURE__ */ Q(
|
|
1406
|
+
children: [/* @__PURE__ */ Q(L.Input, {
|
|
1408
1407
|
name: "newPassword",
|
|
1409
1408
|
type: g ? "text" : "password",
|
|
1410
1409
|
autoComplete: "new-password",
|
|
1411
1410
|
placeholder: r.auth.newPasswordPlaceholder,
|
|
1412
1411
|
required: !0
|
|
1413
|
-
}), /* @__PURE__ */ Q(
|
|
1412
|
+
}), /* @__PURE__ */ Q(L.Suffix, {
|
|
1414
1413
|
className: "px-0",
|
|
1415
|
-
children: /* @__PURE__ */ Q(
|
|
1414
|
+
children: /* @__PURE__ */ Q(O, {
|
|
1416
1415
|
isIconOnly: !0,
|
|
1417
1416
|
"aria-label": g ? r.auth.hidePassword : r.auth.showPassword,
|
|
1418
1417
|
size: "sm",
|
|
1419
1418
|
variant: "ghost",
|
|
1420
1419
|
onPress: () => v(!g),
|
|
1421
1420
|
isDisabled: h,
|
|
1422
|
-
children: Q(g ?
|
|
1421
|
+
children: Q(g ? D : E, {})
|
|
1423
1422
|
})
|
|
1424
1423
|
})]
|
|
1425
1424
|
}),
|
|
1426
|
-
!i && /* @__PURE__ */ Q(
|
|
1427
|
-
/* @__PURE__ */ Q(
|
|
1425
|
+
!i && /* @__PURE__ */ Q(U, { className: "h-10 md:h-9 w-full rounded-xl" }),
|
|
1426
|
+
/* @__PURE__ */ Q(N, {})
|
|
1428
1427
|
]
|
|
1429
1428
|
}),
|
|
1430
1429
|
n?.confirmPassword && /* @__PURE__ */ $(q, {
|
|
@@ -1435,34 +1434,34 @@ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1435
1434
|
value: d,
|
|
1436
1435
|
onChange: f,
|
|
1437
1436
|
children: [
|
|
1438
|
-
/* @__PURE__ */ Q(
|
|
1439
|
-
/* @__PURE__ */ $(
|
|
1437
|
+
/* @__PURE__ */ Q(R, { children: r.auth.confirmPassword }),
|
|
1438
|
+
/* @__PURE__ */ $(L, {
|
|
1440
1439
|
className: J(!i && "hidden"),
|
|
1441
1440
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
1442
|
-
children: [/* @__PURE__ */ Q(
|
|
1441
|
+
children: [/* @__PURE__ */ Q(L.Input, {
|
|
1443
1442
|
name: "confirmPassword",
|
|
1444
1443
|
type: y ? "text" : "password",
|
|
1445
1444
|
autoComplete: "new-password",
|
|
1446
1445
|
placeholder: r.auth.confirmPasswordPlaceholder,
|
|
1447
1446
|
required: !0
|
|
1448
|
-
}), /* @__PURE__ */ Q(
|
|
1447
|
+
}), /* @__PURE__ */ Q(L.Suffix, {
|
|
1449
1448
|
className: "px-0",
|
|
1450
|
-
children: /* @__PURE__ */ Q(
|
|
1449
|
+
children: /* @__PURE__ */ Q(O, {
|
|
1451
1450
|
isIconOnly: !0,
|
|
1452
1451
|
"aria-label": y ? r.auth.hidePassword : r.auth.showPassword,
|
|
1453
1452
|
size: "sm",
|
|
1454
1453
|
variant: "ghost",
|
|
1455
|
-
onPress: () =>
|
|
1454
|
+
onPress: () => ee(!y),
|
|
1456
1455
|
isDisabled: h,
|
|
1457
|
-
children: Q(y ?
|
|
1456
|
+
children: Q(y ? D : E, {})
|
|
1458
1457
|
})
|
|
1459
1458
|
})]
|
|
1460
1459
|
}),
|
|
1461
|
-
!i && /* @__PURE__ */ Q(
|
|
1462
|
-
/* @__PURE__ */ Q(
|
|
1460
|
+
!i && /* @__PURE__ */ Q(U, { className: "h-10 md:h-9 w-full rounded-xl" }),
|
|
1461
|
+
/* @__PURE__ */ Q(N, {})
|
|
1463
1462
|
]
|
|
1464
1463
|
})
|
|
1465
|
-
] }), /* @__PURE__ */ Q(
|
|
1464
|
+
] }), /* @__PURE__ */ Q(P.Actions, { children: /* @__PURE__ */ $(O, {
|
|
1466
1465
|
type: "submit",
|
|
1467
1466
|
isPending: h,
|
|
1468
1467
|
isDisabled: !i,
|
|
@@ -1479,25 +1478,25 @@ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1479
1478
|
//#endregion
|
|
1480
1479
|
//#region src/components/auth/settings/security/linked-account.tsx
|
|
1481
1480
|
function vt({ account: e, provider: t }) {
|
|
1482
|
-
let { authClient: n, baseURL: r, localization: i } = m(), { data: a, isPending: o } = p(n, { query: { accountId: e?.accountId } }), { mutate: s, isPending: l } = y(n), { mutate: u, isPending: d } =
|
|
1481
|
+
let { authClient: n, baseURL: r, localization: i } = m(), { data: a, isPending: o } = p(n, { query: { accountId: e?.accountId } }), { mutate: s, isPending: l } = y(n), { mutate: u, isPending: d } = oe(n, { onSuccess: () => Y.success(i.settings.accountUnlinked) }), h = f[t], g = c(t), _ = a?.data?.login || a?.data?.username || a?.user?.email || a?.user?.name || e?.accountId;
|
|
1483
1482
|
return /* @__PURE__ */ $("div", {
|
|
1484
1483
|
className: "flex items-center gap-3",
|
|
1485
1484
|
children: [
|
|
1486
1485
|
/* @__PURE__ */ Q("div", {
|
|
1487
1486
|
className: J("flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary"),
|
|
1488
|
-
children: Q(h ||
|
|
1487
|
+
children: Q(h || ve, { className: "size-4.5" })
|
|
1489
1488
|
}),
|
|
1490
1489
|
/* @__PURE__ */ $("div", {
|
|
1491
1490
|
className: "flex flex-col min-w-0",
|
|
1492
1491
|
children: [/* @__PURE__ */ Q("span", {
|
|
1493
1492
|
className: "text-sm font-medium leading-tight",
|
|
1494
1493
|
children: g
|
|
1495
|
-
}), e && o ? /* @__PURE__ */ Q(
|
|
1494
|
+
}), e && o ? /* @__PURE__ */ Q(U, { className: "h-3 w-24 my-0.5 rounded-lg" }) : /* @__PURE__ */ Q("span", {
|
|
1496
1495
|
className: "text-xs text-muted truncate",
|
|
1497
1496
|
children: e ? _ : i.settings.linkProvider.replace("{{provider}}", g)
|
|
1498
1497
|
})]
|
|
1499
1498
|
}),
|
|
1500
|
-
e ? /* @__PURE__ */ $(
|
|
1499
|
+
e ? /* @__PURE__ */ $(O, {
|
|
1501
1500
|
className: "ml-auto shrink-0",
|
|
1502
1501
|
variant: "outline",
|
|
1503
1502
|
size: "sm",
|
|
@@ -1507,8 +1506,8 @@ function vt({ account: e, provider: t }) {
|
|
|
1507
1506
|
children: [d ? /* @__PURE__ */ Q(G, {
|
|
1508
1507
|
color: "current",
|
|
1509
1508
|
size: "sm"
|
|
1510
|
-
}) : /* @__PURE__ */ Q(
|
|
1511
|
-
}) : /* @__PURE__ */ $(
|
|
1509
|
+
}) : /* @__PURE__ */ Q(he, {}), i.settings.unlinkProvider.replace("{{provider}}", "").trim()]
|
|
1510
|
+
}) : /* @__PURE__ */ $(O, {
|
|
1512
1511
|
className: "ml-auto shrink-0",
|
|
1513
1512
|
variant: "outline",
|
|
1514
1513
|
size: "sm",
|
|
@@ -1521,7 +1520,7 @@ function vt({ account: e, provider: t }) {
|
|
|
1521
1520
|
children: [l ? /* @__PURE__ */ Q(G, {
|
|
1522
1521
|
color: "current",
|
|
1523
1522
|
size: "sm"
|
|
1524
|
-
}) : /* @__PURE__ */ Q(
|
|
1523
|
+
}) : /* @__PURE__ */ Q(me, {}), i.settings.link]
|
|
1525
1524
|
})
|
|
1526
1525
|
]
|
|
1527
1526
|
});
|
|
@@ -1529,7 +1528,7 @@ function vt({ account: e, provider: t }) {
|
|
|
1529
1528
|
//#endregion
|
|
1530
1529
|
//#region src/components/auth/settings/security/linked-accounts.tsx
|
|
1531
1530
|
function yt({ className: e, variant: t, ...n }) {
|
|
1532
|
-
let { authClient: r, localization: i, multipleAccountsPerProvider: a, socialProviders: o } = m(), { data: s, isPending: c } =
|
|
1531
|
+
let { authClient: r, localization: i, multipleAccountsPerProvider: a, socialProviders: o } = m(), { data: s, isPending: c } = ee(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) => ({
|
|
1533
1532
|
key: e.id,
|
|
1534
1533
|
account: e,
|
|
1535
1534
|
provider: e.providerId
|
|
@@ -1541,11 +1540,11 @@ function yt({ className: e, variant: t, ...n }) {
|
|
|
1541
1540
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1542
1541
|
className: J("text-sm font-semibold mb-3"),
|
|
1543
1542
|
children: i.settings.linkedAccounts
|
|
1544
|
-
}), /* @__PURE__ */ Q(
|
|
1543
|
+
}), /* @__PURE__ */ Q(A, {
|
|
1545
1544
|
className: J(e),
|
|
1546
1545
|
variant: t,
|
|
1547
1546
|
...n,
|
|
1548
|
-
children: /* @__PURE__ */ Q(
|
|
1547
|
+
children: /* @__PURE__ */ Q(A.Content, {
|
|
1549
1548
|
className: "gap-0",
|
|
1550
1549
|
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(bt, {})] }, e)) : f.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(vt, {
|
|
1551
1550
|
account: e.account,
|
|
@@ -1559,9 +1558,9 @@ function bt() {
|
|
|
1559
1558
|
className: "flex items-center justify-between",
|
|
1560
1559
|
children: /* @__PURE__ */ $("div", {
|
|
1561
1560
|
className: "flex items-center gap-3",
|
|
1562
|
-
children: [/* @__PURE__ */ Q(
|
|
1561
|
+
children: [/* @__PURE__ */ Q(U, { className: "size-10 rounded-xl" }), /* @__PURE__ */ $("div", {
|
|
1563
1562
|
className: "flex flex-col gap-1",
|
|
1564
|
-
children: [/* @__PURE__ */ Q(
|
|
1563
|
+
children: [/* @__PURE__ */ Q(U, { className: "h-4 w-20 rounded-lg" }), /* @__PURE__ */ Q(U, { className: "h-3 w-32 rounded-lg" })]
|
|
1565
1564
|
})]
|
|
1566
1565
|
})
|
|
1567
1566
|
});
|
|
@@ -1619,7 +1618,7 @@ function St({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
1619
1618
|
inline: "center"
|
|
1620
1619
|
}),
|
|
1621
1620
|
children: [
|
|
1622
|
-
/* @__PURE__ */ Q(
|
|
1621
|
+
/* @__PURE__ */ Q(ge, { className: "text-muted" }),
|
|
1623
1622
|
c.settings.account,
|
|
1624
1623
|
/* @__PURE__ */ Q(K.Indicator, {})
|
|
1625
1624
|
]
|
|
@@ -1633,7 +1632,7 @@ function St({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
1633
1632
|
inline: "center"
|
|
1634
1633
|
}),
|
|
1635
1634
|
children: [
|
|
1636
|
-
/* @__PURE__ */ Q(
|
|
1635
|
+
/* @__PURE__ */ Q(ye, { className: "text-muted" }),
|
|
1637
1636
|
c.settings.security,
|
|
1638
1637
|
/* @__PURE__ */ Q(K.Indicator, {})
|
|
1639
1638
|
]
|
|
@@ -1673,25 +1672,25 @@ function St({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
1673
1672
|
function Ct(e, t) {
|
|
1674
1673
|
if (Re(e)) return e;
|
|
1675
1674
|
let { label: n, href: r, icon: i, variant: a } = e;
|
|
1676
|
-
return /* @__PURE__ */ $(
|
|
1675
|
+
return /* @__PURE__ */ $(M.Item, {
|
|
1677
1676
|
href: r,
|
|
1678
1677
|
variant: a,
|
|
1679
1678
|
textValue: typeof n == "string" ? n : void 0,
|
|
1680
|
-
children: [i, /* @__PURE__ */ Q(
|
|
1679
|
+
children: [i, /* @__PURE__ */ Q(R, { children: n })]
|
|
1681
1680
|
}, t);
|
|
1682
1681
|
}
|
|
1683
1682
|
function wt({ className: e, placement: t, size: r = "default", variant: a = "ghost", links: o, hideSettings: s, hideSubtitle: c }) {
|
|
1684
|
-
let { authClient: l, basePaths: u, viewPaths: d, localization: f, plugins: p } = m(), { data: h, isPending: g } =
|
|
1683
|
+
let { authClient: l, basePaths: u, viewPaths: d, localization: f, plugins: p } = m(), { data: h, isPending: g } = S(l), _ = p.flatMap((e) => e.userMenuItems?.map((t, n) => /* @__PURE__ */ Q(t, { hideSubtitle: c }, `${e.id}-${n.toString()}`)) ?? []), v = o?.flatMap((e, t) => {
|
|
1685
1684
|
if (!Re(e)) {
|
|
1686
1685
|
let t = e.visibility ?? "always";
|
|
1687
1686
|
if (t === "authenticated" && !h || t === "unauthenticated" && h) return [];
|
|
1688
1687
|
}
|
|
1689
1688
|
return [Ct(e, `user-button-link-${t.toString()}`)];
|
|
1690
1689
|
});
|
|
1691
|
-
return /* @__PURE__ */ $(
|
|
1692
|
-
className: J("rounded-full"
|
|
1693
|
-
children: /* @__PURE__ */ Q(n, {})
|
|
1694
|
-
}) : /* @__PURE__ */ $(
|
|
1690
|
+
return /* @__PURE__ */ $(M, { children: [r === "icon" ? /* @__PURE__ */ Q(M.Trigger, {
|
|
1691
|
+
className: J("rounded-full"),
|
|
1692
|
+
children: /* @__PURE__ */ Q(n, { className: e })
|
|
1693
|
+
}) : /* @__PURE__ */ $(O, {
|
|
1695
1694
|
variant: a,
|
|
1696
1695
|
className: J("h-auto font-normal justify-start px-2 py-2 text-left", e),
|
|
1697
1696
|
children: [h || g ? /* @__PURE__ */ Q(i, {
|
|
@@ -1700,38 +1699,38 @@ function wt({ className: e, placement: t, size: r = "default", variant: a = "gho
|
|
|
1700
1699
|
}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(n, {}), /* @__PURE__ */ Q("p", {
|
|
1701
1700
|
className: "text-sm font-medium",
|
|
1702
1701
|
children: f.auth.account
|
|
1703
|
-
})] }), /* @__PURE__ */ Q(
|
|
1704
|
-
}), /* @__PURE__ */ $(
|
|
1702
|
+
})] }), /* @__PURE__ */ Q(le, { className: "ml-auto size-3 text-muted" })]
|
|
1703
|
+
}), /* @__PURE__ */ $(M.Popover, {
|
|
1705
1704
|
placement: t,
|
|
1706
1705
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
1707
1706
|
children: [h && /* @__PURE__ */ Q("div", {
|
|
1708
1707
|
className: "px-3 pt-3 pb-1",
|
|
1709
1708
|
children: /* @__PURE__ */ Q(i, { hideSubtitle: c })
|
|
1710
|
-
}), /* @__PURE__ */ Q(
|
|
1709
|
+
}), /* @__PURE__ */ Q(M.Menu, { children: h ? /* @__PURE__ */ $(Z, { children: [
|
|
1711
1710
|
v,
|
|
1712
|
-
!s && /* @__PURE__ */ $(
|
|
1711
|
+
!s && /* @__PURE__ */ $(M.Item, {
|
|
1713
1712
|
textValue: f.settings.settings,
|
|
1714
1713
|
href: `${u.settings}/${d.settings.account}`,
|
|
1715
|
-
children: [/* @__PURE__ */ Q(
|
|
1714
|
+
children: [/* @__PURE__ */ Q(pe, { className: "text-muted" }), /* @__PURE__ */ Q(R, { children: f.settings.settings })]
|
|
1716
1715
|
}),
|
|
1717
1716
|
_,
|
|
1718
|
-
/* @__PURE__ */ $(
|
|
1717
|
+
/* @__PURE__ */ $(M.Item, {
|
|
1719
1718
|
textValue: f.auth.signOut,
|
|
1720
1719
|
href: `${u.auth}/${d.auth.signOut}`,
|
|
1721
1720
|
variant: "danger",
|
|
1722
|
-
children: [/* @__PURE__ */ Q(
|
|
1721
|
+
children: [/* @__PURE__ */ Q(se, { className: "text-danger" }), /* @__PURE__ */ Q(R, { children: f.auth.signOut })]
|
|
1723
1722
|
})
|
|
1724
1723
|
] }) : /* @__PURE__ */ $(Z, { children: [
|
|
1725
1724
|
v,
|
|
1726
|
-
/* @__PURE__ */ $(
|
|
1725
|
+
/* @__PURE__ */ $(M.Item, {
|
|
1727
1726
|
textValue: f.auth.signIn,
|
|
1728
1727
|
href: `${u.auth}/${d.auth.signIn}`,
|
|
1729
|
-
children: [/* @__PURE__ */ Q(
|
|
1728
|
+
children: [/* @__PURE__ */ Q(T, { className: "text-muted" }), /* @__PURE__ */ Q(R, { children: f.auth.signIn })]
|
|
1730
1729
|
}),
|
|
1731
|
-
/* @__PURE__ */ $(
|
|
1730
|
+
/* @__PURE__ */ $(M.Item, {
|
|
1732
1731
|
textValue: f.auth.signUp,
|
|
1733
1732
|
href: `${u.auth}/${d.auth.signUp}`,
|
|
1734
|
-
children: [/* @__PURE__ */ Q(
|
|
1733
|
+
children: [/* @__PURE__ */ Q(_e, { className: "text-muted" }), /* @__PURE__ */ Q(R, { children: f.auth.signUp })]
|
|
1735
1734
|
}),
|
|
1736
1735
|
_
|
|
1737
1736
|
] }) })]
|