@better-auth-ui/heroui 1.6.19 → 1.6.21
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 +237 -238
- package/dist/lib/auth/auth-plugin.d.ts +4 -2
- package/dist/plugins.js +908 -922
- package/package.json +10 -10
- package/src/components/auth/additional-field.tsx +11 -9
- 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/organization/organization-invitations.tsx +10 -33
- package/src/components/auth/organization/organization-members.tsx +6 -29
- package/src/components/auth/reset-password.tsx +1 -6
- package/src/components/auth/sign-in.tsx +8 -10
- package/src/components/auth/sign-up.tsx +2 -4
- package/src/components/auth/theme/appearance.tsx +6 -6
- package/src/components/auth/user/user-button.tsx +2 -2
- package/src/components/auth/username/sign-in-username.tsx +8 -10
- package/src/lib/auth/auth-plugin.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 b, useListSessions as
|
|
5
|
-
import { ArrowRightFromSquare 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 b, useListSessions as x, useRequestPasswordReset as S, useResetPassword as ee, useRevokeSession as te, useSendVerificationEmail as ne, useSession as C, useSignInEmail as re, useSignOut as w, useSignUpEmail as ie, useUnlinkAccount as ae, useUpdateUser as T } from "@better-auth-ui/react";
|
|
5
|
+
import { ArrowRightFromSquare as oe, ArrowRightToSquare as E, Check as se, ChevronsExpandVertical as ce, CloudArrowUpIn as le, Copy as ue, Display as de, Eye as D, EyeSlash as O, Gear as fe, Link as pe, LinkSlash as me, Person as he, PersonPlus as ge, PlugConnection as _e, Shield as ve, Smartphone as ye, TrashBin as be, Xmark as xe } from "@gravity-ui/icons";
|
|
6
6
|
import { Button as k, Calendar as A, Card as j, Checkbox as M, Chip as Se, ComboBox as Ce, DateField as we, DatePicker as Te, Description as Ee, Dropdown as N, FieldError as P, Fieldset as F, Form as I, Input as L, InputGroup as R, Label as z, Link as B, ListBox as V, NumberField as H, RouterProvider as De, Select as U, Skeleton as W, Slider as Oe, 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";
|
|
@@ -43,7 +43,7 @@ function Ye({ getValue: e, isDisabled: t }) {
|
|
|
43
43
|
variant: "ghost",
|
|
44
44
|
isDisabled: t,
|
|
45
45
|
onPress: a,
|
|
46
|
-
children: Q(r ?
|
|
46
|
+
children: Q(r ? se : ue, { className: "size-4" })
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
@@ -116,21 +116,21 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
116
116
|
}), /* @__PURE__ */ $(Oe.Track, { children: [/* @__PURE__ */ Q(Oe.Fill, {}), /* @__PURE__ */ Q(Oe.Thumb, { name: e })] })]
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
if (a === "switch") return /* @__PURE__ */
|
|
119
|
+
if (a === "switch") return /* @__PURE__ */ Q(ke, {
|
|
120
120
|
name: e,
|
|
121
121
|
defaultSelected: t.defaultValue === !0 || t.defaultValue === "true",
|
|
122
122
|
isDisabled: n,
|
|
123
123
|
isReadOnly: t.readOnly,
|
|
124
|
-
children:
|
|
124
|
+
children: /* @__PURE__ */ $(ke.Content, { children: [/* @__PURE__ */ Q(ke.Control, { children: /* @__PURE__ */ Q(ke.Thumb, {}) }), t.label] })
|
|
125
125
|
});
|
|
126
|
-
if (a === "checkbox") return /* @__PURE__ */
|
|
126
|
+
if (a === "checkbox") return /* @__PURE__ */ Q(M, {
|
|
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:
|
|
133
|
+
children: /* @__PURE__ */ $(M.Content, { children: [/* @__PURE__ */ Q(M.Control, { children: /* @__PURE__ */ Q(M.Indicator, {}) }), t.label] })
|
|
134
134
|
});
|
|
135
135
|
if (a === "select") return /* @__PURE__ */ $(U, {
|
|
136
136
|
className: "[&[data-required=true]>.label]:after:content-none",
|
|
@@ -272,71 +272,70 @@ function Xe({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
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 } = S(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
|
|
291
|
+
let h = c.find((e) => e.captchaComponent)?.captchaComponent;
|
|
292
292
|
return /* @__PURE__ */ $(j, {
|
|
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
296
|
/* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
|
|
298
297
|
className: "text-xl font-semibold mb-1",
|
|
299
|
-
children:
|
|
298
|
+
children: a.auth.forgotPassword
|
|
300
299
|
}) }),
|
|
301
300
|
/* @__PURE__ */ Q(j.Content, {
|
|
302
301
|
className: "gap-4",
|
|
303
302
|
children: /* @__PURE__ */ $(I, {
|
|
304
|
-
onSubmit:
|
|
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(z, { children:
|
|
316
|
+
/* @__PURE__ */ Q(z, { children: a.auth.email }),
|
|
318
317
|
/* @__PURE__ */ Q(L, {
|
|
319
|
-
placeholder:
|
|
318
|
+
placeholder: a.auth.emailPlaceholder,
|
|
320
319
|
required: !0,
|
|
321
320
|
variant: t === "transparent" ? "primary" : "secondary"
|
|
322
321
|
}),
|
|
323
322
|
/* @__PURE__ */ Q(P, {})
|
|
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
331
|
children: /* @__PURE__ */ $(k, {
|
|
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
|
]
|
|
@@ -347,12 +346,12 @@ function Ze({ className: e, variant: t, ...n }) {
|
|
|
347
346
|
children: /* @__PURE__ */ $(Ee, {
|
|
348
347
|
className: "text-sm",
|
|
349
348
|
children: [
|
|
350
|
-
|
|
349
|
+
a.auth.rememberYourPassword,
|
|
351
350
|
" ",
|
|
352
351
|
/* @__PURE__ */ Q(B, {
|
|
353
|
-
href: `${
|
|
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,118 +361,117 @@ 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 } = ee(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
393
|
return /* @__PURE__ */ $(j, {
|
|
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
397
|
/* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
|
|
400
398
|
className: "text-xl font-semibold mb-1",
|
|
401
|
-
children:
|
|
399
|
+
children: a.auth.resetPassword
|
|
402
400
|
}) }),
|
|
403
401
|
/* @__PURE__ */ Q(j.Content, {
|
|
404
402
|
className: "gap-4",
|
|
405
403
|
children: /* @__PURE__ */ $(I, {
|
|
406
|
-
onSubmit:
|
|
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(z, { children:
|
|
420
|
+
/* @__PURE__ */ Q(z, { children: a.auth.password }),
|
|
423
421
|
/* @__PURE__ */ $(R, {
|
|
424
422
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
425
423
|
children: [/* @__PURE__ */ Q(R.Input, {
|
|
426
424
|
name: "password",
|
|
427
|
-
placeholder:
|
|
428
|
-
type:
|
|
425
|
+
placeholder: a.auth.newPasswordPlaceholder,
|
|
426
|
+
type: u ? "text" : "password",
|
|
429
427
|
required: !0
|
|
430
428
|
}), /* @__PURE__ */ Q(R.Suffix, {
|
|
431
429
|
className: "px-0",
|
|
432
430
|
children: /* @__PURE__ */ Q(k, {
|
|
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 ? O : D, {})
|
|
440
438
|
})
|
|
441
439
|
})]
|
|
442
440
|
}),
|
|
443
441
|
/* @__PURE__ */ Q(P, {})
|
|
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(z, { children:
|
|
457
|
+
/* @__PURE__ */ Q(z, { children: a.auth.confirmPassword }),
|
|
460
458
|
/* @__PURE__ */ $(R, {
|
|
461
459
|
variant: t === "transparent" ? "primary" : "secondary",
|
|
462
460
|
children: [/* @__PURE__ */ Q(R.Input, {
|
|
463
|
-
placeholder:
|
|
464
|
-
type:
|
|
461
|
+
placeholder: a.auth.confirmPasswordPlaceholder,
|
|
462
|
+
type: f ? "text" : "password",
|
|
465
463
|
required: !0,
|
|
466
464
|
name: "confirmPassword"
|
|
467
465
|
}), /* @__PURE__ */ Q(R.Suffix, {
|
|
468
466
|
className: "px-0",
|
|
469
467
|
children: /* @__PURE__ */ Q(k, {
|
|
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 ? O : D, {})
|
|
477
475
|
})
|
|
478
476
|
})]
|
|
479
477
|
}),
|
|
@@ -485,11 +483,11 @@ function Qe({ className: e, variant: t, ...n }) {
|
|
|
485
483
|
children: /* @__PURE__ */ $(k, {
|
|
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
|
]
|
|
@@ -500,12 +498,12 @@ function Qe({ className: e, variant: t, ...n }) {
|
|
|
500
498
|
children: /* @__PURE__ */ $(Ee, {
|
|
501
499
|
className: "text-sm",
|
|
502
500
|
children: [
|
|
503
|
-
|
|
501
|
+
a.auth.rememberYourPassword,
|
|
504
502
|
" ",
|
|
505
503
|
/* @__PURE__ */ Q(B, {
|
|
506
|
-
href: `${
|
|
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,58 +513,57 @@ 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: b } = v(), [x, S] = X(""), { mutate: ee } = ne(s, { onSuccess: () => Y.success(d.auth.verificationEmailSent) }), { mutate: te, isPending: C } = re(s, {
|
|
520
518
|
onError: (e, { email: t }) => {
|
|
521
519
|
S(""), e.error?.code === "EMAIL_NOT_VERIFIED" && Y.danger(e.error?.message || e.message, { actionProps: {
|
|
522
|
-
children:
|
|
523
|
-
onClick: () =>
|
|
520
|
+
children: d.auth.resend,
|
|
521
|
+
onClick: () => ee({
|
|
524
522
|
email: t,
|
|
525
|
-
callbackURL: `${
|
|
523
|
+
callbackURL: `${l}${p}`
|
|
526
524
|
})
|
|
527
|
-
} }),
|
|
525
|
+
} }), b();
|
|
528
526
|
},
|
|
529
|
-
onSuccess: () =>
|
|
530
|
-
}),
|
|
527
|
+
onSuccess: () => _({ to: p })
|
|
528
|
+
}), w = (e) => {
|
|
531
529
|
e.preventDefault();
|
|
532
530
|
let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
|
|
533
|
-
|
|
531
|
+
te({
|
|
534
532
|
email: n,
|
|
535
533
|
password: x,
|
|
536
|
-
...
|
|
537
|
-
fetchOptions:
|
|
534
|
+
...u?.rememberMe ? { rememberMe: r } : {},
|
|
535
|
+
fetchOptions: y
|
|
538
536
|
});
|
|
539
|
-
},
|
|
537
|
+
}, ie = We({ mutationKey: a.signIn.all }) + We({ mutationKey: a.signUp.all }) > 0, ae = f.find((e) => e.captchaComponent)?.captchaComponent, T = u?.enabled && !!h?.length;
|
|
540
538
|
return /* @__PURE__ */ $(j, {
|
|
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
542
|
/* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
|
|
546
543
|
className: "text-xl font-semibold mb-1",
|
|
547
|
-
children:
|
|
544
|
+
children: d.auth.signIn
|
|
548
545
|
}) }),
|
|
549
546
|
/* @__PURE__ */ $(j.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 }), T && /* @__PURE__ */ Q(e, { children: d.auth.or })] }),
|
|
550
|
+
u?.enabled && /* @__PURE__ */ $(I, {
|
|
551
|
+
onSubmit: w,
|
|
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: ie,
|
|
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(z, { children:
|
|
564
|
+
/* @__PURE__ */ Q(z, { children: d.auth.email }),
|
|
568
565
|
/* @__PURE__ */ Q(L, {
|
|
569
|
-
placeholder:
|
|
566
|
+
placeholder: d.auth.emailPlaceholder,
|
|
570
567
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
571
568
|
required: !0
|
|
572
569
|
}),
|
|
@@ -574,72 +571,72 @@ function $e({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
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:
|
|
579
|
+
isDisabled: ie,
|
|
583
580
|
value: x,
|
|
584
581
|
onChange: S,
|
|
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(z, { children:
|
|
589
|
+
/* @__PURE__ */ Q(z, { children: d.auth.password }),
|
|
593
590
|
/* @__PURE__ */ Q(L, {
|
|
594
|
-
placeholder:
|
|
591
|
+
placeholder: d.auth.passwordPlaceholder,
|
|
595
592
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
596
593
|
required: !0
|
|
597
594
|
}),
|
|
598
595
|
/* @__PURE__ */ Q(P, {})
|
|
599
596
|
]
|
|
600
597
|
}),
|
|
601
|
-
|
|
598
|
+
u?.rememberMe && /* @__PURE__ */ Q(M, {
|
|
602
599
|
name: "rememberMe",
|
|
603
|
-
isDisabled:
|
|
600
|
+
isDisabled: ie,
|
|
604
601
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
605
|
-
children:
|
|
602
|
+
children: /* @__PURE__ */ $(M.Content, { children: [/* @__PURE__ */ Q(M.Control, { children: /* @__PURE__ */ Q(M.Indicator, {}) }), d.auth.rememberMe] })
|
|
606
603
|
}),
|
|
607
|
-
|
|
604
|
+
ae && /* @__PURE__ */ Q("div", {
|
|
608
605
|
className: "flex justify-center",
|
|
609
|
-
children:
|
|
606
|
+
children: ae
|
|
610
607
|
}),
|
|
611
608
|
/* @__PURE__ */ $("div", {
|
|
612
609
|
className: "flex flex-col gap-3",
|
|
613
610
|
children: [/* @__PURE__ */ $(k, {
|
|
614
611
|
type: "submit",
|
|
615
612
|
className: "w-full",
|
|
616
|
-
isPending:
|
|
617
|
-
children: [
|
|
613
|
+
isPending: ie,
|
|
614
|
+
children: [C && /* @__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: [T && /* @__PURE__ */ Q(e, { children:
|
|
622
|
+
i === "bottom" && /* @__PURE__ */ $(Z, { children: [T && /* @__PURE__ */ Q(e, { children: d.auth.or }), !!h?.length && /* @__PURE__ */ Q(r, { socialLayout: n })] })
|
|
626
623
|
]
|
|
627
624
|
}),
|
|
628
625
|
/* @__PURE__ */ $(j.Footer, {
|
|
629
626
|
className: "flex-col gap-3",
|
|
630
|
-
children: [
|
|
631
|
-
href: `${
|
|
632
|
-
className: "no-underline hover:underline",
|
|
633
|
-
children:
|
|
634
|
-
}),
|
|
627
|
+
children: [u?.enabled && u?.forgotPassword && /* @__PURE__ */ Q(B, {
|
|
628
|
+
href: `${c.auth}/${g.auth.forgotPassword}`,
|
|
629
|
+
className: "text-sm no-underline hover:underline",
|
|
630
|
+
children: d.auth.forgotPasswordLink
|
|
631
|
+
}), u?.enabled && /* @__PURE__ */ $(Ee, {
|
|
635
632
|
className: "text-sm",
|
|
636
633
|
children: [
|
|
637
|
-
|
|
634
|
+
d.auth.needToCreateAnAccount,
|
|
638
635
|
" ",
|
|
639
636
|
/* @__PURE__ */ Q(B, {
|
|
640
|
-
href: `${
|
|
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 } = w(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: b, resetFetchOptions: x } = v(), [S, ee] = X(""), [te, ne] = X(""), { mutate: C, isPending: re } = ie(c, {
|
|
676
673
|
onError: () => {
|
|
677
|
-
|
|
674
|
+
ee(""), ne(""), x();
|
|
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
|
-
}), [w,
|
|
679
|
+
}), [w, ae] = X(!1), [T, oe] = X(!1), E = We({ mutationKey: a.signIn.all }) + We({ mutationKey: a.signUp.all }) > 0, se = p.find((e) => e.captchaComponent)?.captchaComponent, ce = 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 && S !== te) {
|
|
683
|
+
Y.danger(f.auth.passwordsDoNotMatch), ee(""), ne("");
|
|
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,43 +695,42 @@ 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
|
+
C({
|
|
702
699
|
name: n,
|
|
703
700
|
email: r,
|
|
704
701
|
password: S,
|
|
705
702
|
...i,
|
|
706
|
-
fetchOptions:
|
|
703
|
+
fetchOptions: b
|
|
707
704
|
});
|
|
708
|
-
},
|
|
705
|
+
}, le = d?.enabled && !!g?.length;
|
|
709
706
|
return /* @__PURE__ */ $(j, {
|
|
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
710
|
/* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
|
|
715
711
|
className: "text-xl font-semibold mb-1",
|
|
716
|
-
children:
|
|
712
|
+
children: f.auth.signUp
|
|
717
713
|
}) }),
|
|
718
714
|
/* @__PURE__ */ $(j.Content, {
|
|
719
715
|
className: "gap-4",
|
|
720
716
|
children: [
|
|
721
|
-
i === "top" && /* @__PURE__ */ $(Z, { children: [!!
|
|
722
|
-
|
|
723
|
-
onSubmit:
|
|
717
|
+
i === "top" && /* @__PURE__ */ $(Z, { children: [!!g?.length && /* @__PURE__ */ Q(r, { socialLayout: n }), le && /* @__PURE__ */ Q(e, { children: f.auth.or })] }),
|
|
718
|
+
d?.enabled && /* @__PURE__ */ $(I, {
|
|
719
|
+
onSubmit: ce,
|
|
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
726
|
isDisabled: E,
|
|
731
727
|
validate: (e) => {
|
|
732
|
-
if (!e) return
|
|
728
|
+
if (!e) return f.auth.fieldRequired;
|
|
733
729
|
},
|
|
734
730
|
children: [
|
|
735
|
-
/* @__PURE__ */ Q(z, { children:
|
|
731
|
+
/* @__PURE__ */ Q(z, { children: f.auth.name }),
|
|
736
732
|
/* @__PURE__ */ Q(L, {
|
|
737
|
-
placeholder:
|
|
733
|
+
placeholder: f.auth.namePlaceholder,
|
|
738
734
|
required: !0,
|
|
739
735
|
variant: o === "transparent" ? "primary" : "secondary"
|
|
740
736
|
}),
|
|
@@ -747,45 +743,45 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
747
743
|
autoComplete: "email",
|
|
748
744
|
isDisabled: E,
|
|
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(z, { children:
|
|
750
|
+
/* @__PURE__ */ Q(z, { children: f.auth.email }),
|
|
755
751
|
/* @__PURE__ */ Q(L, {
|
|
756
|
-
placeholder:
|
|
752
|
+
placeholder: f.auth.emailPlaceholder,
|
|
757
753
|
required: !0,
|
|
758
754
|
variant: o === "transparent" ? "primary" : "secondary"
|
|
759
755
|
}),
|
|
760
756
|
/* @__PURE__ */ Q(P, {})
|
|
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
762
|
isPending: E,
|
|
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
770
|
isDisabled: E,
|
|
775
771
|
value: S,
|
|
776
|
-
onChange:
|
|
772
|
+
onChange: ee,
|
|
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(z, { children:
|
|
780
|
+
/* @__PURE__ */ Q(z, { children: f.auth.password }),
|
|
785
781
|
/* @__PURE__ */ $(R, {
|
|
786
782
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
787
783
|
children: [/* @__PURE__ */ Q(R.Input, {
|
|
788
|
-
placeholder:
|
|
784
|
+
placeholder: f.auth.passwordPlaceholder,
|
|
789
785
|
type: w ? "text" : "password",
|
|
790
786
|
name: "password",
|
|
791
787
|
required: !0
|
|
@@ -793,10 +789,10 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
793
789
|
className: "px-0",
|
|
794
790
|
children: /* @__PURE__ */ Q(k, {
|
|
795
791
|
isIconOnly: !0,
|
|
796
|
-
"aria-label": w ?
|
|
792
|
+
"aria-label": w ? f.auth.hidePassword : f.auth.showPassword,
|
|
797
793
|
size: "sm",
|
|
798
794
|
variant: "ghost",
|
|
799
|
-
onPress: () =>
|
|
795
|
+
onPress: () => ae(!w),
|
|
800
796
|
isDisabled: E,
|
|
801
797
|
children: Q(w ? O : D, {})
|
|
802
798
|
})
|
|
@@ -805,37 +801,37 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
805
801
|
/* @__PURE__ */ Q(P, {})
|
|
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
809
|
isDisabled: E,
|
|
814
|
-
value:
|
|
815
|
-
onChange:
|
|
810
|
+
value: te,
|
|
811
|
+
onChange: ne,
|
|
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(z, { children:
|
|
819
|
+
/* @__PURE__ */ Q(z, { children: f.auth.confirmPassword }),
|
|
824
820
|
/* @__PURE__ */ $(R, {
|
|
825
821
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
826
822
|
children: [/* @__PURE__ */ Q(R.Input, {
|
|
827
823
|
name: "confirmPassword",
|
|
828
|
-
placeholder:
|
|
824
|
+
placeholder: f.auth.confirmPasswordPlaceholder,
|
|
829
825
|
type: T ? "text" : "password",
|
|
830
826
|
required: !0
|
|
831
827
|
}), /* @__PURE__ */ Q(R.Suffix, {
|
|
832
828
|
className: "px-0",
|
|
833
829
|
children: /* @__PURE__ */ Q(k, {
|
|
834
830
|
isIconOnly: !0,
|
|
835
|
-
"aria-label": T ?
|
|
831
|
+
"aria-label": T ? f.auth.hidePassword : f.auth.showPassword,
|
|
836
832
|
size: "sm",
|
|
837
833
|
variant: "ghost",
|
|
838
|
-
onPress: () =>
|
|
834
|
+
onPress: () => oe(!T),
|
|
839
835
|
isDisabled: E,
|
|
840
836
|
children: Q(T ? O : D, {})
|
|
841
837
|
})
|
|
@@ -844,15 +840,15 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
844
840
|
/* @__PURE__ */ Q(P, {})
|
|
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
846
|
isPending: E,
|
|
851
847
|
variant: o
|
|
852
848
|
}, e.name)),
|
|
853
|
-
|
|
849
|
+
se && /* @__PURE__ */ Q("div", {
|
|
854
850
|
className: "flex justify-center",
|
|
855
|
-
children:
|
|
851
|
+
children: se
|
|
856
852
|
}),
|
|
857
853
|
/* @__PURE__ */ $("div", {
|
|
858
854
|
className: "flex flex-col gap-3",
|
|
@@ -860,15 +856,15 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
860
856
|
type: "submit",
|
|
861
857
|
className: "w-full",
|
|
862
858
|
isPending: E,
|
|
863
|
-
children: [
|
|
859
|
+
children: [re && /* @__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: [
|
|
867
|
+
i === "bottom" && /* @__PURE__ */ $(Z, { children: [le && /* @__PURE__ */ Q(e, { children: f.auth.or }), !!g?.length && /* @__PURE__ */ Q(r, { socialLayout: n })] })
|
|
872
868
|
]
|
|
873
869
|
}),
|
|
874
870
|
/* @__PURE__ */ Q(j.Footer, {
|
|
@@ -876,12 +872,12 @@ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
876
872
|
children: /* @__PURE__ */ $(Ee, {
|
|
877
873
|
className: "text-sm",
|
|
878
874
|
children: [
|
|
879
|
-
|
|
875
|
+
f.auth.alreadyHaveAnAccount,
|
|
880
876
|
" ",
|
|
881
877
|
/* @__PURE__ */ Q(B, {
|
|
882
|
-
href: `${
|
|
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
|
|
@@ -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 } = C(t), { mutate: o, isPending: c } =
|
|
1031
|
+
let { authClient: t, localization: r, avatar: i } = m(), { data: a } = C(t), { mutate: o, isPending: c } = T(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) {
|
|
@@ -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 } = C(i), { mutate: s, isPending: c } =
|
|
1112
|
+
let { additionalFields: r, authClient: i, localization: a } = m(), { data: o } = C(i), { mutate: s, isPending: c } = T(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 = {};
|
|
@@ -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 ? oe : xe, {}), l ? r.auth.signOut : r.settings.revoke]
|
|
1252
1251
|
})
|
|
1253
1252
|
]
|
|
1254
1253
|
});
|
|
@@ -1256,7 +1255,7 @@ 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 } = C(r), { data: o, isPending: s } =
|
|
1258
|
+
let { authClient: r, localization: i } = m(), { data: a } = C(r), { data: o, isPending: s } = x(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
|
|
@@ -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 } = C(r), { fetchOptions: s, resetFetchOptions: c } = v(), { mutate: l, isPending: u } =
|
|
1302
|
+
let { authClient: r, localization: i, plugins: a } = m(), { data: o } = C(r), { fetchOptions: s, resetFetchOptions: c } = v(), { mutate: l, isPending: u } = S(r, {
|
|
1304
1303
|
onError: () => {
|
|
1305
1304
|
c();
|
|
1306
1305
|
},
|
|
@@ -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, b] = X(!1),
|
|
1352
|
+
}), [g, v] = X(!1), [y, b] = X(!1), x = (e) => {
|
|
1354
1353
|
if (e.preventDefault(), n?.confirmPassword && l !== d) {
|
|
1355
1354
|
c(""), u(""), f(""), Y.danger(r.auth.passwordsDoNotMatch);
|
|
1356
1355
|
return;
|
|
@@ -1369,7 +1368,7 @@ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, se
|
|
|
1369
1368
|
variant: t,
|
|
1370
1369
|
...a,
|
|
1371
1370
|
children: /* @__PURE__ */ Q(j.Content, { children: /* @__PURE__ */ Q(I, {
|
|
1372
|
-
onSubmit:
|
|
1371
|
+
onSubmit: x,
|
|
1373
1372
|
children: /* @__PURE__ */ $(F, {
|
|
1374
1373
|
className: "w-full gap-4",
|
|
1375
1374
|
children: [/* @__PURE__ */ $(F.Group, { children: [
|
|
@@ -1479,7 +1478,7 @@ 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 } = ae(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: [
|
|
@@ -1689,8 +1688,8 @@ function wt({ className: e, placement: t, size: r = "default", variant: a = "gho
|
|
|
1689
1688
|
return [Ct(e, `user-button-link-${t.toString()}`)];
|
|
1690
1689
|
});
|
|
1691
1690
|
return /* @__PURE__ */ $(N, { children: [r === "icon" ? /* @__PURE__ */ Q(N.Trigger, {
|
|
1692
|
-
className: J("rounded-full"
|
|
1693
|
-
children: /* @__PURE__ */ Q(n, {})
|
|
1691
|
+
className: J("rounded-full"),
|
|
1692
|
+
children: /* @__PURE__ */ Q(n, { className: e })
|
|
1694
1693
|
}) : /* @__PURE__ */ $(k, {
|
|
1695
1694
|
variant: a,
|
|
1696
1695
|
className: J("h-auto font-normal justify-start px-2 py-2 text-left", e),
|
|
@@ -1719,14 +1718,14 @@ function wt({ className: e, placement: t, size: r = "default", variant: a = "gho
|
|
|
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(oe, { className: "text-danger" }), /* @__PURE__ */ Q(z, { children: f.auth.signOut })]
|
|
1723
1722
|
})
|
|
1724
1723
|
] }) : /* @__PURE__ */ $(Z, { children: [
|
|
1725
1724
|
v,
|
|
1726
1725
|
/* @__PURE__ */ $(N.Item, {
|
|
1727
1726
|
textValue: f.auth.signIn,
|
|
1728
1727
|
href: `${u.auth}/${d.auth.signIn}`,
|
|
1729
|
-
children: [/* @__PURE__ */ Q(
|
|
1728
|
+
children: [/* @__PURE__ */ Q(E, { className: "text-muted" }), /* @__PURE__ */ Q(z, { children: f.auth.signIn })]
|
|
1730
1729
|
}),
|
|
1731
1730
|
/* @__PURE__ */ $(N.Item, {
|
|
1732
1731
|
textValue: f.auth.signUp,
|