@better-auth-ui/heroui 1.6.27 → 1.6.28
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/forgot-password.d.ts +3 -1
- package/dist/components/auth/magic-link/magic-link-sent.d.ts +20 -0
- package/dist/components/auth/reset-link-sent.d.ts +20 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +271 -230
- package/dist/lib/auth/magic-link-plugin.d.ts +4 -0
- package/dist/plugins.d.ts +1 -0
- package/dist/plugins.js +423 -380
- package/dist/user-view-CxSDufx_.js +126 -0
- package/package.json +1 -1
- package/src/components/auth/auth.tsx +8 -1
- package/src/components/auth/forgot-password.tsx +9 -6
- package/src/components/auth/magic-link/magic-link-sent.tsx +84 -0
- package/src/components/auth/magic-link/magic-link.tsx +10 -6
- package/src/components/auth/reset-link-sent.tsx +80 -0
- package/src/components/auth/settings/security/change-password.tsx +32 -14
- package/src/index.tsx +1 -0
- package/src/lib/auth/magic-link-plugin.ts +2 -1
- package/src/plugins.ts +1 -0
- package/dist/user-view--47tVtJ3.js +0 -113
package/dist/plugins.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as e,
|
|
3
|
-
import { authMutationKeys as
|
|
4
|
-
import { ThemePreviewDark as
|
|
5
|
-
import { ArrowRightArrowLeft as
|
|
6
|
-
import { AlertDialog as O, Avatar as
|
|
7
|
-
import { useEffect as
|
|
2
|
+
import { a as e, o as t, r as n, t as r } from "./user-view-CxSDufx_.js";
|
|
3
|
+
import { authMutationKeys as i, authQueryKeys as a, createAuthPlugin as o, fileToBase64 as s } from "@better-auth-ui/core";
|
|
4
|
+
import { ThemePreviewDark as c, ThemePreviewLight as l, ThemePreviewSystem as u, useAcceptInvitation as d, useActiveOrganization as f, useAddPasskey as p, useAuth as m, useAuthPlugin as h, useAuthenticate as g, useCancelInvitation as _, useCheckSlug as v, useCreateApiKey as y, useCreateOrganization as b, useDeleteApiKey as x, useDeleteOrganization as S, useDeletePasskey as C, useDeleteUser as ee, useFetchOptions as w, useHasPermission as T, useInviteMember as te, useIsUsernameAvailable as ne, useLeaveOrganization as re, useListAccounts as ie, useListApiKeys as ae, useListDeviceSessions as oe, useListOrganizationInvitations as se, useListOrganizationMembers as ce, useListOrganizations as le, useListPasskeys as ue, useListUserInvitations as de, useRejectInvitation as fe, useRemoveMember as pe, useRevokeMultiSession as me, useSession as E, useSetActiveOrganization as he, useSetActiveSession as ge, useSignInEmail as _e, useSignInMagicLink as ve, useSignInPasskey as ye, useSignInUsername as be, useUpdateMemberRole as xe, useUpdateOrganization as Se, useUser as Ce } from "@better-auth-ui/react";
|
|
5
|
+
import { ArrowRightArrowLeft as we, ArrowRightFromSquare as Te, Briefcase as Ee, Check as De, ChevronsExpandVertical as Oe, CirclePlus as ke, Clock as Ae, CloudArrowUpIn as je, Copy as Me, Display as Ne, Ellipsis as Pe, Envelope as Fe, Fingerprint as Ie, Funnel as Le, Gear as Re, Key as ze, Lock as Be, Moon as Ve, Palette as He, PaperPlane as Ue, Pencil as We, Person as Ge, PersonPlus as Ke, Sun as qe, TrashBin as Je, TriangleExclamation as Ye, Xmark as D } from "@gravity-ui/icons";
|
|
6
|
+
import { AlertDialog as O, Avatar as Xe, Button as k, Card as A, Checkbox as Ze, Chip as j, Description as Qe, Dropdown as M, EmptyState as $e, FieldError as N, Form as P, Input as F, InputGroup as I, Label as L, Link as et, ListBox as tt, Radio as R, RadioGroup as nt, SearchField as z, Select as rt, Skeleton as B, Spinner as V, Table as H, Tabs as U, TextField as W, cn as G, toast as K, useIsHydrated as it } from "@heroui/react";
|
|
7
|
+
import { useEffect as at, useMemo as ot, useRef as st, useState as q } from "react";
|
|
8
8
|
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
9
|
-
import { useIsMutating as Z, useQueryClient as st } from "@tanstack/react-query";
|
|
10
9
|
import { buttonVariants as ct } from "@heroui/styles";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { useIsMutating as Z, useQueryClient as lt } from "@tanstack/react-query";
|
|
11
|
+
import { apiKeyPlugin as ut, deleteUserPlugin as dt, magicLinkPlugin as ft, multiSessionPlugin as pt, organizationPlugin as mt, passkeyPlugin as ht, themePlugin as gt, usernamePlugin as _t } from "@better-auth-ui/core/plugins";
|
|
12
|
+
import { useDebouncer as vt } from "@tanstack/react-pacer";
|
|
13
13
|
//#region src/components/auth/api-key/organization-api-keys.tsx
|
|
14
|
-
function
|
|
15
|
-
let { authClient: n } =
|
|
16
|
-
return o?.members.some((e) => e.role === "owner" && e.userId === r?.user.id) ? /* @__PURE__ */ Y(
|
|
14
|
+
function yt({ className: e, variant: t }) {
|
|
15
|
+
let { authClient: n } = m(), { data: r } = E(n), { data: i, isPending: a } = f(n), { data: o } = ce(n);
|
|
16
|
+
return o?.members.some((e) => e.role === "owner" && e.userId === r?.user.id) ? /* @__PURE__ */ Y(Dt, {
|
|
17
17
|
className: e,
|
|
18
18
|
variant: t,
|
|
19
19
|
organizationId: i?.id,
|
|
@@ -22,18 +22,18 @@ function vt({ className: e, variant: t }) {
|
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/lib/auth/api-key-plugin.ts
|
|
25
|
-
var
|
|
26
|
-
let t =
|
|
25
|
+
var bt = o(ut.id, (e = {}) => {
|
|
26
|
+
let t = ut(e);
|
|
27
27
|
return {
|
|
28
28
|
...t,
|
|
29
|
-
securityCards: [
|
|
30
|
-
...t.organization ? { organizationCards: [
|
|
29
|
+
securityCards: [Dt],
|
|
30
|
+
...t.organization ? { organizationCards: [yt] } : {}
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/components/auth/api-key/delete-api-key-dialog.tsx
|
|
35
|
-
function
|
|
36
|
-
let { authClient: i, localization: a } =
|
|
35
|
+
function xt({ isOpen: e, onOpenChange: t, apiKey: n, organizationId: r }) {
|
|
36
|
+
let { authClient: i, localization: a } = m(), { localization: o } = h(bt), s = `${n.start}${"*".repeat(16)}`, { mutate: c, isPending: l } = x(i, { onSuccess: () => t(!1) });
|
|
37
37
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
38
38
|
isOpen: e,
|
|
39
39
|
onOpenChange: t,
|
|
@@ -41,7 +41,7 @@ function bt({ isOpen: e, onOpenChange: t, apiKey: n, organizationId: r }) {
|
|
|
41
41
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
42
42
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
43
43
|
status: "danger",
|
|
44
|
-
children: /* @__PURE__ */ Y(
|
|
44
|
+
children: /* @__PURE__ */ Y(ze, {})
|
|
45
45
|
}), /* @__PURE__ */ Y(O.Heading, { children: o.deleteApiKey })] }),
|
|
46
46
|
/* @__PURE__ */ X(O.Body, {
|
|
47
47
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -80,14 +80,14 @@ function bt({ isOpen: e, onOpenChange: t, apiKey: n, organizationId: r }) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/components/auth/api-key/api-key.tsx
|
|
83
|
-
function
|
|
84
|
-
let { localization: r } =
|
|
83
|
+
function St({ apiKey: e, hideDelete: t, organizationId: n }) {
|
|
84
|
+
let { localization: r } = m(), { localization: i } = h(bt), [a, o] = q(!1), s = `${e.start}${"*".repeat(16)}`;
|
|
85
85
|
return /* @__PURE__ */ X("div", {
|
|
86
86
|
className: "flex items-center gap-3",
|
|
87
87
|
children: [
|
|
88
88
|
/* @__PURE__ */ Y("div", {
|
|
89
89
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
90
|
-
children: /* @__PURE__ */ Y(
|
|
90
|
+
children: /* @__PURE__ */ Y(ze, { className: "size-4.5" })
|
|
91
91
|
}),
|
|
92
92
|
/* @__PURE__ */ X("div", {
|
|
93
93
|
className: "flex flex-col min-w-0",
|
|
@@ -116,7 +116,7 @@ function xt({ apiKey: e, hideDelete: t, organizationId: n }) {
|
|
|
116
116
|
onPress: () => o(!0),
|
|
117
117
|
"aria-label": i.deleteApiKey,
|
|
118
118
|
children: [/* @__PURE__ */ Y(D, {}), r.settings.delete]
|
|
119
|
-
}), /* @__PURE__ */ Y(
|
|
119
|
+
}), /* @__PURE__ */ Y(xt, {
|
|
120
120
|
isOpen: a,
|
|
121
121
|
onOpenChange: o,
|
|
122
122
|
apiKey: e,
|
|
@@ -127,7 +127,7 @@ function xt({ apiKey: e, hideDelete: t, organizationId: n }) {
|
|
|
127
127
|
}
|
|
128
128
|
//#endregion
|
|
129
129
|
//#region src/components/auth/api-key/api-key-skeleton.tsx
|
|
130
|
-
function
|
|
130
|
+
function Ct() {
|
|
131
131
|
return /* @__PURE__ */ Y("div", {
|
|
132
132
|
className: "flex items-center justify-between",
|
|
133
133
|
children: /* @__PURE__ */ X("div", {
|
|
@@ -145,14 +145,14 @@ function St() {
|
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/components/auth/api-key/api-keys-empty.tsx
|
|
148
|
-
function
|
|
149
|
-
let { localization: n } =
|
|
148
|
+
function wt({ onCreatePress: e, hideCreate: t }) {
|
|
149
|
+
let { localization: n } = h(bt);
|
|
150
150
|
return /* @__PURE__ */ X("div", {
|
|
151
151
|
className: "flex flex-col items-center justify-center gap-4",
|
|
152
152
|
children: [
|
|
153
153
|
/* @__PURE__ */ Y("div", {
|
|
154
154
|
className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
|
|
155
|
-
children: /* @__PURE__ */ Y(
|
|
155
|
+
children: /* @__PURE__ */ Y(ze, { className: "size-4.5" })
|
|
156
156
|
}),
|
|
157
157
|
/* @__PURE__ */ X("div", {
|
|
158
158
|
className: "flex flex-col items-center justify-center gap-1 text-center",
|
|
@@ -174,8 +174,8 @@ function Ct({ onCreatePress: e, hideCreate: t }) {
|
|
|
174
174
|
}
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/components/auth/api-key/new-api-key-dialog.tsx
|
|
177
|
-
function
|
|
178
|
-
let { localization: i } =
|
|
177
|
+
function Tt({ isOpen: e, onOpenChange: t, name: n, secretKey: r }) {
|
|
178
|
+
let { localization: i } = m(), { localization: a } = h(bt), [o, s] = q(!1);
|
|
179
179
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
180
180
|
isOpen: e,
|
|
181
181
|
onOpenChange: t,
|
|
@@ -183,7 +183,7 @@ function wt({ isOpen: e, onOpenChange: t, name: n, secretKey: r }) {
|
|
|
183
183
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
184
184
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
185
185
|
status: "warning",
|
|
186
|
-
children: /* @__PURE__ */ Y(
|
|
186
|
+
children: /* @__PURE__ */ Y(ze, {})
|
|
187
187
|
}), /* @__PURE__ */ Y(O.Heading, { children: a.newApiKey })] }),
|
|
188
188
|
/* @__PURE__ */ X(O.Body, {
|
|
189
189
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -212,7 +212,7 @@ function wt({ isOpen: e, onOpenChange: t, name: n, secretKey: r }) {
|
|
|
212
212
|
K.danger(e instanceof Error ? e.message : String(e));
|
|
213
213
|
}
|
|
214
214
|
},
|
|
215
|
-
children: Y(o ?
|
|
215
|
+
children: Y(o ? De : Me, {})
|
|
216
216
|
})
|
|
217
217
|
})]
|
|
218
218
|
})]
|
|
@@ -227,9 +227,9 @@ function wt({ isOpen: e, onOpenChange: t, name: n, secretKey: r }) {
|
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/components/auth/api-key/create-api-key-dialog.tsx
|
|
230
|
-
function
|
|
231
|
-
let { authClient: r, localization: i } =
|
|
232
|
-
e || (d(null),
|
|
230
|
+
function Et({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
231
|
+
let { authClient: r, localization: i } = m(), { localization: a } = h(bt), { mutate: o, isPending: s } = y(r), [c, l] = q(!1), [u, d] = q(null), [f, p] = q(null), g = (e) => {
|
|
232
|
+
e || (d(null), p(null)), t(e);
|
|
233
233
|
};
|
|
234
234
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(O.Backdrop, {
|
|
235
235
|
isOpen: e,
|
|
@@ -245,14 +245,14 @@ function Tt({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
|
245
245
|
configId: "organization"
|
|
246
246
|
} : {}
|
|
247
247
|
} : void 0, { onSuccess: (e) => {
|
|
248
|
-
g(!1), d(t),
|
|
248
|
+
g(!1), d(t), p(e.key), l(!0);
|
|
249
249
|
} });
|
|
250
250
|
},
|
|
251
251
|
children: [
|
|
252
252
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
253
253
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
254
254
|
status: "default",
|
|
255
|
-
children: /* @__PURE__ */ Y(
|
|
255
|
+
children: /* @__PURE__ */ Y(ze, {})
|
|
256
256
|
}), /* @__PURE__ */ Y(O.Heading, { children: a.createApiKey })] }),
|
|
257
257
|
/* @__PURE__ */ X(O.Body, {
|
|
258
258
|
className: "overflow-visible",
|
|
@@ -290,7 +290,7 @@ function Tt({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
|
290
290
|
})] })
|
|
291
291
|
]
|
|
292
292
|
}) }) })
|
|
293
|
-
}), /* @__PURE__ */ Y(
|
|
293
|
+
}), /* @__PURE__ */ Y(Tt, {
|
|
294
294
|
isOpen: c,
|
|
295
295
|
onOpenChange: l,
|
|
296
296
|
secretKey: f,
|
|
@@ -299,8 +299,8 @@ function Tt({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region src/components/auth/api-key/api-keys.tsx
|
|
302
|
-
function
|
|
303
|
-
let { authClient: o } =
|
|
302
|
+
function Dt({ className: e, variant: t, organizationId: n, isPending: r, hideCreate: i, hideDelete: a }) {
|
|
303
|
+
let { authClient: o } = m(), { localization: s } = h(bt), { data: c, isPending: l } = ae(o, {
|
|
304
304
|
enabled: !r,
|
|
305
305
|
...n ? { query: {
|
|
306
306
|
organizationId: n,
|
|
@@ -325,16 +325,16 @@ function Et({ className: e, variant: t, organizationId: n, isPending: r, hideCre
|
|
|
325
325
|
}),
|
|
326
326
|
/* @__PURE__ */ Y(A, {
|
|
327
327
|
variant: t,
|
|
328
|
-
children: /* @__PURE__ */ Y(A.Content, { children: u ? /* @__PURE__ */ Y(
|
|
328
|
+
children: /* @__PURE__ */ Y(A.Content, { children: u ? /* @__PURE__ */ Y(Ct, {}) : c?.apiKeys.length ? c?.apiKeys.map((e, t) => /* @__PURE__ */ X("div", { children: [t > 0 && /* @__PURE__ */ Y("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Y(St, {
|
|
329
329
|
apiKey: e,
|
|
330
330
|
hideDelete: a,
|
|
331
331
|
organizationId: n
|
|
332
|
-
})] }, e.id)) : /* @__PURE__ */ Y(
|
|
332
|
+
})] }, e.id)) : /* @__PURE__ */ Y(wt, {
|
|
333
333
|
onCreatePress: () => f(!0),
|
|
334
334
|
hideCreate: i
|
|
335
335
|
}) })
|
|
336
336
|
}),
|
|
337
|
-
!i && /* @__PURE__ */ Y(
|
|
337
|
+
!i && /* @__PURE__ */ Y(Et, {
|
|
338
338
|
isOpen: d,
|
|
339
339
|
onOpenChange: f,
|
|
340
340
|
organizationId: n
|
|
@@ -344,19 +344,19 @@ function Et({ className: e, variant: t, organizationId: n, isPending: r, hideCre
|
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/lib/auth/delete-user-plugin.ts
|
|
347
|
-
var
|
|
348
|
-
...
|
|
349
|
-
securityCards: [
|
|
347
|
+
var Ot = o(dt.id, (e = {}) => ({
|
|
348
|
+
...dt(e),
|
|
349
|
+
securityCards: [At]
|
|
350
350
|
}));
|
|
351
351
|
//#endregion
|
|
352
352
|
//#region src/components/auth/delete-user/delete-account.tsx
|
|
353
|
-
function
|
|
354
|
-
let { authClient: r, basePaths:
|
|
353
|
+
function kt({ className: e, variant: t, ...n }) {
|
|
354
|
+
let { authClient: r, basePaths: i, localization: o, navigate: s, viewPaths: c } = m(), { localization: l, sendDeleteAccountVerification: u } = h(Ot), { data: d } = ie(r), f = lt(), [p, g] = q(!1), [_, v] = q(""), y = d?.some((e) => e.providerId === "credential"), b = !u && y, { mutate: x, isPending: S } = ee(r), C = (e) => {
|
|
355
355
|
g(e), v("");
|
|
356
356
|
}, w = async (e) => {
|
|
357
357
|
e.preventDefault(), x({ ...b ? { password: _ } : {} }, { onSuccess: () => {
|
|
358
|
-
g(!1), v(""), u ? K.success(l.deleteUserVerificationSent) : (K.success(l.deleteUserSuccess), f.removeQueries({ queryKey:
|
|
359
|
-
to: `${
|
|
358
|
+
g(!1), v(""), u ? K.success(l.deleteUserVerificationSent) : (K.success(l.deleteUserSuccess), f.removeQueries({ queryKey: a.all }), s({
|
|
359
|
+
to: `${i.auth}/${c.auth.signIn}`,
|
|
360
360
|
replace: !0
|
|
361
361
|
}));
|
|
362
362
|
} });
|
|
@@ -380,15 +380,15 @@ function Ot({ className: e, variant: t, ...n }) {
|
|
|
380
380
|
onPress: () => g(!0),
|
|
381
381
|
children: l.deleteAccount
|
|
382
382
|
}), /* @__PURE__ */ Y(O.Backdrop, {
|
|
383
|
-
isOpen:
|
|
384
|
-
onOpenChange:
|
|
383
|
+
isOpen: p,
|
|
384
|
+
onOpenChange: C,
|
|
385
385
|
children: /* @__PURE__ */ Y(O.Container, { children: /* @__PURE__ */ Y(O.Dialog, { children: /* @__PURE__ */ X(P, {
|
|
386
386
|
onSubmit: w,
|
|
387
387
|
children: [
|
|
388
388
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
389
389
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
390
390
|
status: "danger",
|
|
391
|
-
children: /* @__PURE__ */ Y(
|
|
391
|
+
children: /* @__PURE__ */ Y(Ye, {})
|
|
392
392
|
}), /* @__PURE__ */ Y(O.Heading, { children: l.deleteAccount })] }),
|
|
393
393
|
/* @__PURE__ */ X(O.Body, {
|
|
394
394
|
className: "overflow-visible",
|
|
@@ -436,49 +436,92 @@ function Ot({ className: e, variant: t, ...n }) {
|
|
|
436
436
|
}
|
|
437
437
|
//#endregion
|
|
438
438
|
//#region src/components/auth/delete-user/danger-zone.tsx
|
|
439
|
-
function
|
|
440
|
-
let { localization: r } =
|
|
439
|
+
function At({ className: e, variant: t, ...n }) {
|
|
440
|
+
let { localization: r } = m();
|
|
441
441
|
return /* @__PURE__ */ X("div", {
|
|
442
442
|
className: G("flex w-full flex-col", e),
|
|
443
443
|
...n,
|
|
444
444
|
children: [/* @__PURE__ */ Y("h2", {
|
|
445
445
|
className: G("text-sm font-semibold mb-3 text-danger"),
|
|
446
446
|
children: r.settings.dangerZone
|
|
447
|
-
}), /* @__PURE__ */ Y(
|
|
447
|
+
}), /* @__PURE__ */ Y(kt, { variant: t })]
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
//#endregion
|
|
451
451
|
//#region src/components/auth/magic-link/magic-link-button.tsx
|
|
452
|
-
function
|
|
453
|
-
let { basePaths: t, emailAndPassword: n, viewPaths:
|
|
454
|
-
return l && !n?.enabled ? null : /* @__PURE__ */ X(
|
|
455
|
-
href: `${t.auth}/${l ?
|
|
452
|
+
function jt({ view: e }) {
|
|
453
|
+
let { basePaths: t, emailAndPassword: n, viewPaths: r, localization: a } = m(), o = Z({ mutationKey: i.signIn.all }) + Z({ mutationKey: i.signUp.all }) > 0, { localization: s, viewPaths: c } = h(Pt), l = e === "magicLink";
|
|
454
|
+
return l && !n?.enabled ? null : /* @__PURE__ */ X(et, {
|
|
455
|
+
href: `${t.auth}/${l ? r.auth.signIn : c.auth.magicLink}`,
|
|
456
456
|
isDisabled: o,
|
|
457
457
|
className: G(ct({ variant: "tertiary" }), "w-full gap-2", o && "status-disabled"),
|
|
458
|
-
children: [Y(l ?
|
|
458
|
+
children: [Y(l ? Be : Fe, {}), a.auth.continueWith.replace("{{provider}}", l ? a.auth.password : s.magicLink)]
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/components/auth/magic-link/magic-link-sent.tsx
|
|
463
|
+
var Mt = "better-auth-ui.magic-link-sent";
|
|
464
|
+
function Nt({ className: e, variant: n }) {
|
|
465
|
+
let { basePaths: r, emailAndPassword: i, localization: a, viewPaths: o } = m(), { localization: s } = h(Pt), [c, l] = q(it() && sessionStorage.getItem("better-auth-ui.magic-link-sent") || "");
|
|
466
|
+
return at(() => {
|
|
467
|
+
l(sessionStorage.getItem("better-auth-ui.magic-link-sent") ?? "");
|
|
468
|
+
}, []), /* @__PURE__ */ X(A, {
|
|
469
|
+
className: G("w-full max-w-sm gap-4 md:p-6", e),
|
|
470
|
+
variant: n,
|
|
471
|
+
children: [
|
|
472
|
+
/* @__PURE__ */ Y(A.Header, { children: /* @__PURE__ */ Y(A.Title, {
|
|
473
|
+
className: "text-xl font-semibold mb-1",
|
|
474
|
+
children: a.auth.checkYourEmailTitle
|
|
475
|
+
}) }),
|
|
476
|
+
/* @__PURE__ */ X(A.Content, {
|
|
477
|
+
className: "gap-4",
|
|
478
|
+
children: [/* @__PURE__ */ Y(Qe, {
|
|
479
|
+
className: "text-sm",
|
|
480
|
+
children: c ? s.magicLinkSentTo.replace("{{email}}", c) : s.magicLinkSent
|
|
481
|
+
}), c && /* @__PURE__ */ Y(t, { email: c })]
|
|
482
|
+
}),
|
|
483
|
+
i?.enabled && /* @__PURE__ */ Y(A.Footer, {
|
|
484
|
+
className: "flex-col gap-3",
|
|
485
|
+
children: /* @__PURE__ */ X(Qe, {
|
|
486
|
+
className: "text-sm",
|
|
487
|
+
children: [
|
|
488
|
+
a.auth.needToCreateAnAccount,
|
|
489
|
+
" ",
|
|
490
|
+
/* @__PURE__ */ Y(et, {
|
|
491
|
+
href: `${r.auth}/${o.auth.signUp}`,
|
|
492
|
+
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
493
|
+
children: a.auth.signUp
|
|
494
|
+
})
|
|
495
|
+
]
|
|
496
|
+
})
|
|
497
|
+
})
|
|
498
|
+
]
|
|
459
499
|
});
|
|
460
500
|
}
|
|
461
501
|
//#endregion
|
|
462
502
|
//#region src/lib/auth/magic-link-plugin.ts
|
|
463
|
-
var
|
|
464
|
-
...
|
|
465
|
-
authButtons: [
|
|
466
|
-
views: { auth: {
|
|
467
|
-
|
|
503
|
+
var Pt = o(ft.id, (e = {}) => ({
|
|
504
|
+
...ft(e),
|
|
505
|
+
authButtons: [jt],
|
|
506
|
+
views: { auth: {
|
|
507
|
+
magicLink: Ft,
|
|
508
|
+
magicLinkSent: Nt
|
|
509
|
+
} },
|
|
510
|
+
fallbackViews: { auth: { signIn: Ft } }
|
|
468
511
|
}));
|
|
469
512
|
//#endregion
|
|
470
513
|
//#region src/components/auth/magic-link/magic-link.tsx
|
|
471
|
-
function
|
|
472
|
-
let { authClient: s, basePaths: c, baseURL: l, emailAndPassword: u, localization: d,
|
|
473
|
-
|
|
474
|
-
} }),
|
|
475
|
-
e.preventDefault(),
|
|
476
|
-
email:
|
|
477
|
-
callbackURL: `${l}${
|
|
514
|
+
function Ft({ className: t, socialLayout: r, socialPosition: a = "bottom", variant: o }) {
|
|
515
|
+
let { authClient: s, basePaths: c, baseURL: l, emailAndPassword: u, localization: d, navigate: f, plugins: p, redirectTo: g, socialProviders: _, viewPaths: v } = m(), { localization: y, viewPaths: b } = h(Pt), [x, S] = q(""), { mutate: C, isPending: ee } = ve(s, { onSuccess: (e, t) => {
|
|
516
|
+
sessionStorage.setItem(Mt, t.email), f({ to: `${c.auth}/${b.auth.magicLinkSent}` });
|
|
517
|
+
} }), w = Z({ mutationKey: i.signIn.all }) + Z({ mutationKey: i.signUp.all }) > 0, T = (e) => {
|
|
518
|
+
e.preventDefault(), C({
|
|
519
|
+
email: x,
|
|
520
|
+
callbackURL: `${l}${g}`
|
|
478
521
|
});
|
|
479
|
-
},
|
|
522
|
+
}, te = !!_?.length;
|
|
480
523
|
return /* @__PURE__ */ X(A, {
|
|
481
|
-
className: G("w-full max-w-sm gap-4 md:p-6",
|
|
524
|
+
className: G("w-full max-w-sm gap-4 md:p-6", t),
|
|
482
525
|
variant: o,
|
|
483
526
|
children: [
|
|
484
527
|
/* @__PURE__ */ Y(A.Header, { children: /* @__PURE__ */ Y(A.Title, {
|
|
@@ -488,17 +531,17 @@ function Mt({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
488
531
|
/* @__PURE__ */ X(A.Content, {
|
|
489
532
|
className: "gap-4",
|
|
490
533
|
children: [
|
|
491
|
-
a === "top" && /* @__PURE__ */ X(J, { children: [!!
|
|
534
|
+
a === "top" && /* @__PURE__ */ X(J, { children: [!!_?.length && /* @__PURE__ */ Y(n, { socialLayout: r }), te && /* @__PURE__ */ Y(e, { children: d.auth.or })] }),
|
|
492
535
|
/* @__PURE__ */ X(P, {
|
|
493
|
-
onSubmit:
|
|
536
|
+
onSubmit: T,
|
|
494
537
|
className: "flex flex-col gap-4",
|
|
495
538
|
children: [/* @__PURE__ */ X(W, {
|
|
496
539
|
name: "email",
|
|
497
540
|
type: "email",
|
|
498
541
|
autoComplete: "email",
|
|
499
|
-
isDisabled:
|
|
500
|
-
value:
|
|
501
|
-
onChange:
|
|
542
|
+
isDisabled: w,
|
|
543
|
+
value: x,
|
|
544
|
+
onChange: S,
|
|
502
545
|
children: [
|
|
503
546
|
/* @__PURE__ */ Y(L, { children: d.auth.email }),
|
|
504
547
|
/* @__PURE__ */ Y(F, {
|
|
@@ -513,26 +556,26 @@ function Mt({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
513
556
|
children: [/* @__PURE__ */ X(k, {
|
|
514
557
|
type: "submit",
|
|
515
558
|
className: "w-full",
|
|
516
|
-
isPending:
|
|
517
|
-
children: [
|
|
559
|
+
isPending: w,
|
|
560
|
+
children: [ee && /* @__PURE__ */ Y(V, {
|
|
518
561
|
color: "current",
|
|
519
562
|
size: "sm"
|
|
520
|
-
}),
|
|
521
|
-
}),
|
|
563
|
+
}), y.sendMagicLink]
|
|
564
|
+
}), p.flatMap((e) => (e.authButtons ?? []).map((t, n) => /* @__PURE__ */ Y(t, { view: "magicLink" }, `${e.id}-${n.toString()}`)))]
|
|
522
565
|
})]
|
|
523
566
|
}),
|
|
524
|
-
a === "bottom" && /* @__PURE__ */ X(J, { children: [
|
|
567
|
+
a === "bottom" && /* @__PURE__ */ X(J, { children: [te && /* @__PURE__ */ Y(e, { children: d.auth.or }), !!_?.length && /* @__PURE__ */ Y(n, { socialLayout: r })] })
|
|
525
568
|
]
|
|
526
569
|
}),
|
|
527
570
|
u?.enabled && /* @__PURE__ */ Y(A.Footer, {
|
|
528
571
|
className: "flex-col gap-3",
|
|
529
|
-
children: /* @__PURE__ */ X(
|
|
572
|
+
children: /* @__PURE__ */ X(Qe, {
|
|
530
573
|
className: "text-sm",
|
|
531
574
|
children: [
|
|
532
575
|
d.auth.needToCreateAnAccount,
|
|
533
576
|
" ",
|
|
534
|
-
/* @__PURE__ */ Y(
|
|
535
|
-
href: `${c.auth}/${
|
|
577
|
+
/* @__PURE__ */ Y(et, {
|
|
578
|
+
href: `${c.auth}/${v.auth.signUp}`,
|
|
536
579
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
537
580
|
children: d.auth.signUp
|
|
538
581
|
})
|
|
@@ -544,8 +587,8 @@ function Mt({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
544
587
|
}
|
|
545
588
|
//#endregion
|
|
546
589
|
//#region src/components/auth/multi-session/manage-accounts.tsx
|
|
547
|
-
function
|
|
548
|
-
let { authClient: r } =
|
|
590
|
+
function It({ className: e, variant: t, ...n }) {
|
|
591
|
+
let { authClient: r } = m(), { localization: i } = h(Bt), { data: a } = E(r), { data: o, isPending: s } = oe(r), c = o?.filter((e) => e.session.id !== a?.session.id), l = [{
|
|
549
592
|
key: a?.session.id ?? "current",
|
|
550
593
|
deviceSession: s ? null : a,
|
|
551
594
|
isPending: s
|
|
@@ -563,7 +606,7 @@ function Nt({ className: e, variant: t, ...n }) {
|
|
|
563
606
|
...n,
|
|
564
607
|
children: /* @__PURE__ */ Y(A.Content, {
|
|
565
608
|
className: "gap-0",
|
|
566
|
-
children: l.map((e, t) => /* @__PURE__ */ X("div", { children: [t > 0 && /* @__PURE__ */ Y("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Y(
|
|
609
|
+
children: l.map((e, t) => /* @__PURE__ */ X("div", { children: [t > 0 && /* @__PURE__ */ Y("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Y(Vt, {
|
|
567
610
|
deviceSession: e.deviceSession,
|
|
568
611
|
isPending: e.isPending
|
|
569
612
|
})] }, e.key))
|
|
@@ -572,13 +615,13 @@ function Nt({ className: e, variant: t, ...n }) {
|
|
|
572
615
|
}
|
|
573
616
|
//#endregion
|
|
574
617
|
//#region src/components/auth/multi-session/switch-account-submenu-item.tsx
|
|
575
|
-
function
|
|
576
|
-
let { authClient:
|
|
618
|
+
function Lt({ deviceSession: e, hideSubtitle: t }) {
|
|
619
|
+
let { authClient: n } = m(), { mutate: i, isPending: a } = ge(n, { onSuccess: () => window.scrollTo({ top: 0 }) });
|
|
577
620
|
return /* @__PURE__ */ X(M.Item, {
|
|
578
621
|
className: "px-2",
|
|
579
622
|
isDisabled: a,
|
|
580
623
|
onPress: () => i({ sessionToken: e.session.token }),
|
|
581
|
-
children: [/* @__PURE__ */ Y(
|
|
624
|
+
children: [/* @__PURE__ */ Y(r, {
|
|
582
625
|
user: e.user,
|
|
583
626
|
hideSubtitle: t
|
|
584
627
|
}), a && /* @__PURE__ */ Y(V, {
|
|
@@ -590,62 +633,62 @@ function Pt({ deviceSession: e, hideSubtitle: t }) {
|
|
|
590
633
|
}
|
|
591
634
|
//#endregion
|
|
592
635
|
//#region src/components/auth/multi-session/switch-account-submenu-content.tsx
|
|
593
|
-
function
|
|
594
|
-
let { authClient: t, basePaths:
|
|
636
|
+
function Rt({ hideSubtitle: e }) {
|
|
637
|
+
let { authClient: t, basePaths: n, viewPaths: i } = m(), { localization: a } = h(Bt), { data: o } = E(t), { data: s, isPending: c } = oe(t);
|
|
595
638
|
return /* @__PURE__ */ Y(M.Popover, {
|
|
596
639
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
597
640
|
children: /* @__PURE__ */ X(M.Menu, { children: [
|
|
598
641
|
/* @__PURE__ */ X(M.Item, {
|
|
599
642
|
className: "px-2",
|
|
600
|
-
children: [/* @__PURE__ */ Y(
|
|
643
|
+
children: [/* @__PURE__ */ Y(r, {
|
|
601
644
|
isPending: c,
|
|
602
645
|
hideSubtitle: e
|
|
603
|
-
}), !c && /* @__PURE__ */ Y(
|
|
646
|
+
}), !c && /* @__PURE__ */ Y(De, { className: "ml-auto" })]
|
|
604
647
|
}),
|
|
605
|
-
s?.filter((e) => e.session.id !== o?.session?.id).map((t) => /* @__PURE__ */ Y(
|
|
648
|
+
s?.filter((e) => e.session.id !== o?.session?.id).map((t) => /* @__PURE__ */ Y(Lt, {
|
|
606
649
|
deviceSession: t,
|
|
607
650
|
hideSubtitle: e
|
|
608
651
|
}, t.session.id)),
|
|
609
652
|
/* @__PURE__ */ X(M.Item, {
|
|
610
653
|
textValue: a.addAccount,
|
|
611
|
-
href: `${
|
|
612
|
-
children: [/* @__PURE__ */ Y(
|
|
654
|
+
href: `${n.auth}/${i.auth.signIn}`,
|
|
655
|
+
children: [/* @__PURE__ */ Y(ke, { className: "text-muted" }), /* @__PURE__ */ Y(L, { children: a.addAccount })]
|
|
613
656
|
})
|
|
614
657
|
] })
|
|
615
658
|
});
|
|
616
659
|
}
|
|
617
660
|
//#endregion
|
|
618
661
|
//#region src/components/auth/multi-session/switch-account-submenu.tsx
|
|
619
|
-
function
|
|
620
|
-
let { authClient: n } =
|
|
662
|
+
function zt({ className: e, hideSubtitle: t }) {
|
|
663
|
+
let { authClient: n } = m(), { data: r } = E(n), { localization: i } = h(Bt);
|
|
621
664
|
return r ? /* @__PURE__ */ X(M.SubmenuTrigger, { children: [/* @__PURE__ */ X(M.Item, {
|
|
622
665
|
className: e,
|
|
623
666
|
textValue: i.switchAccount,
|
|
624
667
|
children: [
|
|
625
|
-
/* @__PURE__ */ Y(
|
|
668
|
+
/* @__PURE__ */ Y(we, { className: "text-muted" }),
|
|
626
669
|
/* @__PURE__ */ Y(L, { children: i.switchAccount }),
|
|
627
670
|
/* @__PURE__ */ Y(M.SubmenuIndicator, {})
|
|
628
671
|
]
|
|
629
672
|
}), /* @__PURE__ */ Y(M.Popover, {
|
|
630
673
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
631
|
-
children: /* @__PURE__ */ Y(
|
|
674
|
+
children: /* @__PURE__ */ Y(Rt, { hideSubtitle: t })
|
|
632
675
|
})] }) : null;
|
|
633
676
|
}
|
|
634
677
|
//#endregion
|
|
635
678
|
//#region src/lib/auth/multi-session-plugin.ts
|
|
636
|
-
var
|
|
637
|
-
...
|
|
638
|
-
accountCards: [
|
|
639
|
-
userMenuItems: [
|
|
679
|
+
var Bt = o(pt.id, (e = {}) => ({
|
|
680
|
+
...pt(e),
|
|
681
|
+
accountCards: [It],
|
|
682
|
+
userMenuItems: [zt]
|
|
640
683
|
}));
|
|
641
684
|
//#endregion
|
|
642
685
|
//#region src/components/auth/multi-session/manage-account.tsx
|
|
643
|
-
function
|
|
644
|
-
let { authClient:
|
|
686
|
+
function Vt({ deviceSession: e, isPending: t }) {
|
|
687
|
+
let { authClient: n, localization: i } = m(), { localization: a } = h(Bt), { data: o } = Ce(n), { mutate: s, isPending: c } = ge(n, { onSuccess: () => window.scrollTo({ top: 0 }) }), { mutate: l, isPending: u } = me(n, { onSuccess: () => K.success(i.settings.revokeSessionSuccess) }), d = e?.session.userId === o?.id, f = c || u;
|
|
645
688
|
return /* @__PURE__ */ X("div", {
|
|
646
689
|
className: "flex items-center justify-between gap-3",
|
|
647
690
|
children: [
|
|
648
|
-
/* @__PURE__ */ Y(
|
|
691
|
+
/* @__PURE__ */ Y(r, {
|
|
649
692
|
user: e?.user,
|
|
650
693
|
isPending: t,
|
|
651
694
|
size: "md"
|
|
@@ -659,7 +702,7 @@ function Rt({ deviceSession: e, isPending: t }) {
|
|
|
659
702
|
children: [u ? /* @__PURE__ */ Y(V, {
|
|
660
703
|
color: "current",
|
|
661
704
|
size: "sm"
|
|
662
|
-
}) : /* @__PURE__ */ Y(
|
|
705
|
+
}) : /* @__PURE__ */ Y(Te, {}), i.auth.signOut]
|
|
663
706
|
}),
|
|
664
707
|
e && !d && /* @__PURE__ */ X(M, { children: [/* @__PURE__ */ Y(k, {
|
|
665
708
|
isIconOnly: !0,
|
|
@@ -667,45 +710,45 @@ function Rt({ deviceSession: e, isPending: t }) {
|
|
|
667
710
|
className: "shrink-0",
|
|
668
711
|
size: "sm",
|
|
669
712
|
isDisabled: f,
|
|
670
|
-
children: /* @__PURE__ */ Y(
|
|
713
|
+
children: /* @__PURE__ */ Y(Pe, {})
|
|
671
714
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, { children: [/* @__PURE__ */ X(M.Item, {
|
|
672
715
|
textValue: a.switchAccount,
|
|
673
716
|
onAction: () => s({ sessionToken: e.session.token }),
|
|
674
|
-
children: [/* @__PURE__ */ Y(
|
|
717
|
+
children: [/* @__PURE__ */ Y(we, { className: "text-muted" }), a.switchAccount]
|
|
675
718
|
}), /* @__PURE__ */ X(M.Item, {
|
|
676
719
|
textValue: i.auth.signOut,
|
|
677
720
|
onAction: () => l({ sessionToken: e.session.token }),
|
|
678
|
-
children: [/* @__PURE__ */ Y(
|
|
721
|
+
children: [/* @__PURE__ */ Y(Te, { className: "text-muted" }), i.auth.signOut]
|
|
679
722
|
})] }) })] })
|
|
680
723
|
]
|
|
681
724
|
});
|
|
682
725
|
}
|
|
683
726
|
//#endregion
|
|
684
727
|
//#region src/components/auth/organization/slug-field.tsx
|
|
685
|
-
function
|
|
728
|
+
function Ht(e) {
|
|
686
729
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
687
730
|
}
|
|
688
|
-
function
|
|
689
|
-
let { authClient: a, localization: o } =
|
|
731
|
+
function Ut({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
732
|
+
let { authClient: a, localization: o } = m(), { localization: s, checkSlug: c, slugPrefix: l } = h($), { mutate: u, data: d, error: f, reset: p } = v(a), g = vt((e) => {
|
|
690
733
|
!c || !e.trim() || e.trim() === n || u({ slug: e.trim() });
|
|
691
734
|
}, { wait: 500 });
|
|
692
|
-
|
|
693
|
-
c && (
|
|
735
|
+
at(() => {
|
|
736
|
+
c && (p(), g.maybeExecute(e));
|
|
694
737
|
}, [
|
|
695
738
|
c,
|
|
696
739
|
e,
|
|
697
740
|
g.maybeExecute,
|
|
698
|
-
|
|
741
|
+
p
|
|
699
742
|
]);
|
|
700
|
-
let
|
|
701
|
-
t(
|
|
743
|
+
let _ = (e) => {
|
|
744
|
+
t(Ht(e));
|
|
702
745
|
};
|
|
703
746
|
return /* @__PURE__ */ X(W, {
|
|
704
747
|
id: "slug",
|
|
705
748
|
name: "slug",
|
|
706
749
|
...i,
|
|
707
750
|
value: e,
|
|
708
|
-
onChange:
|
|
751
|
+
onChange: _,
|
|
709
752
|
validate: (e) => {
|
|
710
753
|
if (!e) return o.auth.fieldRequired;
|
|
711
754
|
},
|
|
@@ -724,7 +767,7 @@ function Bt({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
|
724
767
|
}),
|
|
725
768
|
c && !!e.trim() && e.trim() !== n && /* @__PURE__ */ Y(I.Suffix, {
|
|
726
769
|
className: "px-2",
|
|
727
|
-
children: d?.status ? /* @__PURE__ */ Y(
|
|
770
|
+
children: d?.status ? /* @__PURE__ */ Y(De, { className: "text-success" }) : f ? /* @__PURE__ */ Y(D, { className: "text-danger" }) : /* @__PURE__ */ Y(V, {
|
|
728
771
|
size: "sm",
|
|
729
772
|
color: "current"
|
|
730
773
|
})
|
|
@@ -737,12 +780,12 @@ function Bt({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
|
737
780
|
}
|
|
738
781
|
//#endregion
|
|
739
782
|
//#region src/components/auth/organization/create-organization-dialog.tsx
|
|
740
|
-
function
|
|
741
|
-
let { authClient: n, localization: r } =
|
|
742
|
-
return
|
|
783
|
+
function Wt({ isOpen: e, onOpenChange: t }) {
|
|
784
|
+
let { authClient: n, localization: r } = m(), { localization: i } = h($), [a, o] = q(""), [s, c] = q(""), [l, u] = q(!1), { mutate: d, isPending: f } = b(n, { onSuccess: () => t(!1) });
|
|
785
|
+
return at(() => {
|
|
743
786
|
e || (c(""), o(""), u(!1));
|
|
744
|
-
}, [e]),
|
|
745
|
-
l || c(
|
|
787
|
+
}, [e]), at(() => {
|
|
788
|
+
l || c(Ht(a));
|
|
746
789
|
}, [a, l]), /* @__PURE__ */ Y(O.Backdrop, {
|
|
747
790
|
isOpen: e,
|
|
748
791
|
onOpenChange: t,
|
|
@@ -757,7 +800,7 @@ function Vt({ isOpen: e, onOpenChange: t }) {
|
|
|
757
800
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
758
801
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
759
802
|
status: "default",
|
|
760
|
-
children: /* @__PURE__ */ Y(
|
|
803
|
+
children: /* @__PURE__ */ Y(Ee, {})
|
|
761
804
|
}), /* @__PURE__ */ Y(O.Heading, { children: i.createOrganization })] }),
|
|
762
805
|
/* @__PURE__ */ X(O.Body, {
|
|
763
806
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -786,7 +829,7 @@ function Vt({ isOpen: e, onOpenChange: t }) {
|
|
|
786
829
|
/* @__PURE__ */ Y(N, {})
|
|
787
830
|
]
|
|
788
831
|
}),
|
|
789
|
-
/* @__PURE__ */ Y(
|
|
832
|
+
/* @__PURE__ */ Y(Ut, {
|
|
790
833
|
value: s,
|
|
791
834
|
onChange: (e) => {
|
|
792
835
|
c(e), u(!0);
|
|
@@ -815,34 +858,34 @@ function Vt({ isOpen: e, onOpenChange: t }) {
|
|
|
815
858
|
}
|
|
816
859
|
//#endregion
|
|
817
860
|
//#region src/components/auth/organization/organization-logo.tsx
|
|
818
|
-
function
|
|
861
|
+
function Gt({ className: e, fallback: t, isPending: n, organization: r, size: i = "sm", style: a, ...o }) {
|
|
819
862
|
if (n && !r) return /* @__PURE__ */ Y(B, {
|
|
820
863
|
className: G("rounded-full", i === "sm" ? "size-8" : i === "md" ? "size-10" : "size-12", e),
|
|
821
864
|
style: a
|
|
822
865
|
});
|
|
823
866
|
let s = r?.name?.slice(0, 2).toUpperCase();
|
|
824
|
-
return /* @__PURE__ */ X(
|
|
867
|
+
return /* @__PURE__ */ X(Xe, {
|
|
825
868
|
size: i,
|
|
826
869
|
className: G("rounded-full", e),
|
|
827
870
|
style: a,
|
|
828
871
|
...o,
|
|
829
|
-
children: [/* @__PURE__ */ Y(
|
|
872
|
+
children: [/* @__PURE__ */ Y(Xe.Image, {
|
|
830
873
|
alt: r?.name ?? "Organization",
|
|
831
874
|
src: r?.logo ?? void 0
|
|
832
|
-
}), /* @__PURE__ */ Y(
|
|
875
|
+
}), /* @__PURE__ */ Y(Xe.Fallback, {
|
|
833
876
|
className: G(i === "lg" ? "text-xl" : i === "md" ? "text-base" : "text-sm"),
|
|
834
877
|
delayMs: r?.logo ? 600 : void 0,
|
|
835
|
-
children: t || s || /* @__PURE__ */ Y(
|
|
878
|
+
children: t || s || /* @__PURE__ */ Y(Ee, { className: "size-4" })
|
|
836
879
|
})]
|
|
837
880
|
});
|
|
838
881
|
}
|
|
839
882
|
//#endregion
|
|
840
883
|
//#region src/components/auth/organization/organization-view-skeleton.tsx
|
|
841
|
-
function
|
|
884
|
+
function Kt({ className: e, hideSlug: t, size: n = "md", ...r }) {
|
|
842
885
|
return /* @__PURE__ */ X("div", {
|
|
843
886
|
className: G("flex min-w-0 items-center gap-2", e),
|
|
844
887
|
...r,
|
|
845
|
-
children: [/* @__PURE__ */ Y(
|
|
888
|
+
children: [/* @__PURE__ */ Y(Gt, {
|
|
846
889
|
isPending: !0,
|
|
847
890
|
className: n === "sm" ? "size-5" : void 0,
|
|
848
891
|
size: n === "lg" ? "md" : "sm"
|
|
@@ -855,11 +898,11 @@ function Ut({ className: e, hideSlug: t, size: n = "md", ...r }) {
|
|
|
855
898
|
//#endregion
|
|
856
899
|
//#region src/components/auth/organization/organization-view.tsx
|
|
857
900
|
function Q({ className: e, isPending: t, size: n = "md", hideSlug: r, hideRole: i, organization: a, ...o }) {
|
|
858
|
-
let { authClient: s } =
|
|
901
|
+
let { authClient: s } = m(), { roles: c, slugPrefix: l } = h($), { data: u } = E(s), { data: d, isPending: p } = f(s, { enabled: !a && !t }), g = a ?? d, { data: _, isPending: v } = ce(s, {
|
|
859
902
|
query: { organizationId: g?.id },
|
|
860
903
|
enabled: !!g?.id && !i
|
|
861
904
|
}), y = _?.members?.find((e) => e.userId === u?.user.id);
|
|
862
|
-
return t || !a &&
|
|
905
|
+
return t || !a && p || !i && g?.id && v ? /* @__PURE__ */ Y(Kt, {
|
|
863
906
|
className: e,
|
|
864
907
|
hideSlug: r,
|
|
865
908
|
size: n,
|
|
@@ -867,7 +910,7 @@ function Q({ className: e, isPending: t, size: n = "md", hideSlug: r, hideRole:
|
|
|
867
910
|
}) : /* @__PURE__ */ X("div", {
|
|
868
911
|
className: G("flex min-w-0 items-center gap-2", e),
|
|
869
912
|
...o,
|
|
870
|
-
children: [/* @__PURE__ */ Y(
|
|
913
|
+
children: [/* @__PURE__ */ Y(Gt, {
|
|
871
914
|
organization: g,
|
|
872
915
|
className: n === "sm" ? "size-5 [&>span]:text-xs" : void 0,
|
|
873
916
|
size: n === "lg" ? "md" : "sm"
|
|
@@ -892,8 +935,8 @@ function Q({ className: e, isPending: t, size: n = "md", hideSlug: r, hideRole:
|
|
|
892
935
|
}
|
|
893
936
|
//#endregion
|
|
894
937
|
//#region src/components/auth/organization/organization-row.tsx
|
|
895
|
-
function
|
|
896
|
-
let { authClient: t, basePaths: n, navigate: r } =
|
|
938
|
+
function qt({ organization: e }) {
|
|
939
|
+
let { authClient: t, basePaths: n, navigate: r } = m(), { localization: i, viewPaths: a, slug: o, slugPrefix: s } = h($), { mutate: c, isPending: l } = he(t, { onSuccess: () => {
|
|
897
940
|
r({ to: `${n.organization}/${a.organization.settings}` });
|
|
898
941
|
} });
|
|
899
942
|
function u() {
|
|
@@ -911,20 +954,20 @@ function Wt({ organization: e }) {
|
|
|
911
954
|
children: [l ? /* @__PURE__ */ Y(V, {
|
|
912
955
|
color: "current",
|
|
913
956
|
size: "sm"
|
|
914
|
-
}) : /* @__PURE__ */ Y(
|
|
957
|
+
}) : /* @__PURE__ */ Y(Re, {}), i.manage]
|
|
915
958
|
})]
|
|
916
959
|
});
|
|
917
960
|
}
|
|
918
961
|
//#endregion
|
|
919
962
|
//#region src/components/auth/organization/organizations-empty.tsx
|
|
920
|
-
function
|
|
921
|
-
let { localization: t } =
|
|
922
|
-
return /* @__PURE__ */ X(
|
|
963
|
+
function Jt({ onCreatePress: e }) {
|
|
964
|
+
let { localization: t } = h($);
|
|
965
|
+
return /* @__PURE__ */ X($e, {
|
|
923
966
|
className: "flex flex-col items-center gap-4 text-center",
|
|
924
967
|
children: [
|
|
925
968
|
/* @__PURE__ */ Y("div", {
|
|
926
969
|
className: "flex size-12 items-center justify-center rounded-full bg-surface-secondary",
|
|
927
|
-
children: /* @__PURE__ */ Y(
|
|
970
|
+
children: /* @__PURE__ */ Y(Ee, { className: "size-5" })
|
|
928
971
|
}),
|
|
929
972
|
/* @__PURE__ */ X("div", {
|
|
930
973
|
className: "flex flex-col gap-2",
|
|
@@ -946,8 +989,8 @@ function Gt({ onCreatePress: e }) {
|
|
|
946
989
|
}
|
|
947
990
|
//#endregion
|
|
948
991
|
//#region src/components/auth/organization/organizations.tsx
|
|
949
|
-
function
|
|
950
|
-
let { authClient: t } =
|
|
992
|
+
function Yt({ variant: e }) {
|
|
993
|
+
let { authClient: t } = m(), { localization: n } = h($), [r, i] = q(!1), { data: a, isPending: o } = le(t);
|
|
951
994
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X("div", {
|
|
952
995
|
className: "flex flex-col gap-3",
|
|
953
996
|
children: [/* @__PURE__ */ X("div", {
|
|
@@ -966,24 +1009,24 @@ function Kt({ variant: e }) {
|
|
|
966
1009
|
variant: e,
|
|
967
1010
|
children: /* @__PURE__ */ Y(A.Content, {
|
|
968
1011
|
className: "gap-0",
|
|
969
|
-
children: o ? /* @__PURE__ */ Y(
|
|
1012
|
+
children: o ? /* @__PURE__ */ Y(Kt, {}) : a?.length ? a.map((e, t) => /* @__PURE__ */ X("div", { children: [t > 0 && /* @__PURE__ */ Y("div", { className: "-mx-4 my-4 border-b border-dashed" }), /* @__PURE__ */ Y(qt, { organization: e })] }, e.id)) : /* @__PURE__ */ Y(Jt, { onCreatePress: () => i(!0) })
|
|
970
1013
|
})
|
|
971
1014
|
})]
|
|
972
|
-
}), /* @__PURE__ */ Y(
|
|
1015
|
+
}), /* @__PURE__ */ Y(Wt, {
|
|
973
1016
|
isOpen: r,
|
|
974
1017
|
onOpenChange: i
|
|
975
1018
|
})] });
|
|
976
1019
|
}
|
|
977
1020
|
//#endregion
|
|
978
1021
|
//#region src/components/auth/organization/user-invitation-row.tsx
|
|
979
|
-
function
|
|
980
|
-
let { authClient: t } =
|
|
1022
|
+
function Xt({ invitation: e }) {
|
|
1023
|
+
let { authClient: t } = m(), { localization: n, roles: r } = h($), { mutate: i, isPending: a } = d(t), { mutate: o, isPending: s } = fe(t);
|
|
981
1024
|
return /* @__PURE__ */ X("div", {
|
|
982
1025
|
className: "flex items-center gap-3",
|
|
983
1026
|
children: [
|
|
984
1027
|
/* @__PURE__ */ Y("div", {
|
|
985
1028
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
986
|
-
children: /* @__PURE__ */ Y(
|
|
1029
|
+
children: /* @__PURE__ */ Y(Ae, { className: "size-4.5" })
|
|
987
1030
|
}),
|
|
988
1031
|
/* @__PURE__ */ X("div", {
|
|
989
1032
|
className: "flex flex-col",
|
|
@@ -1015,7 +1058,7 @@ function qt({ invitation: e }) {
|
|
|
1015
1058
|
children: [a ? /* @__PURE__ */ Y(V, {
|
|
1016
1059
|
color: "current",
|
|
1017
1060
|
size: "sm"
|
|
1018
|
-
}) : /* @__PURE__ */ Y(
|
|
1061
|
+
}) : /* @__PURE__ */ Y(De, {}), n.accept]
|
|
1019
1062
|
}), /* @__PURE__ */ Y(k, {
|
|
1020
1063
|
variant: "danger-soft",
|
|
1021
1064
|
size: "sm",
|
|
@@ -1035,7 +1078,7 @@ function qt({ invitation: e }) {
|
|
|
1035
1078
|
}
|
|
1036
1079
|
//#endregion
|
|
1037
1080
|
//#region src/components/auth/organization/user-invitation-row-skeleton.tsx
|
|
1038
|
-
function
|
|
1081
|
+
function Zt() {
|
|
1039
1082
|
return /* @__PURE__ */ X("div", {
|
|
1040
1083
|
className: "flex items-center gap-3",
|
|
1041
1084
|
children: [/* @__PURE__ */ Y(B, { className: "size-10 shrink-0 rounded-xl" }), /* @__PURE__ */ X("div", {
|
|
@@ -1046,13 +1089,13 @@ function Jt() {
|
|
|
1046
1089
|
}
|
|
1047
1090
|
//#endregion
|
|
1048
1091
|
//#region src/components/auth/organization/user-invitations-empty.tsx
|
|
1049
|
-
function
|
|
1050
|
-
let { localization: e } =
|
|
1051
|
-
return /* @__PURE__ */ X(
|
|
1092
|
+
function Qt() {
|
|
1093
|
+
let { localization: e } = h($);
|
|
1094
|
+
return /* @__PURE__ */ X($e, {
|
|
1052
1095
|
className: "flex flex-col items-center gap-4 text-center",
|
|
1053
1096
|
children: [/* @__PURE__ */ Y("div", {
|
|
1054
1097
|
className: "flex size-12 items-center justify-center rounded-full bg-surface-secondary",
|
|
1055
|
-
children: /* @__PURE__ */ Y(
|
|
1098
|
+
children: /* @__PURE__ */ Y(Ue, { className: "size-5" })
|
|
1056
1099
|
}), /* @__PURE__ */ X("div", {
|
|
1057
1100
|
className: "flex flex-col gap-2",
|
|
1058
1101
|
children: [/* @__PURE__ */ Y("p", {
|
|
@@ -1067,8 +1110,8 @@ function Yt() {
|
|
|
1067
1110
|
}
|
|
1068
1111
|
//#endregion
|
|
1069
1112
|
//#region src/components/auth/organization/user-invitations.tsx
|
|
1070
|
-
function
|
|
1071
|
-
let { authClient: t } =
|
|
1113
|
+
function $t({ variant: e }) {
|
|
1114
|
+
let { authClient: t } = m(), { localization: n } = h($), { data: r, isPending: i } = de(t);
|
|
1072
1115
|
return /* @__PURE__ */ X("div", {
|
|
1073
1116
|
className: "flex flex-col gap-3",
|
|
1074
1117
|
children: [/* @__PURE__ */ Y("h2", {
|
|
@@ -1076,55 +1119,55 @@ function Xt({ variant: e }) {
|
|
|
1076
1119
|
children: n.invitations
|
|
1077
1120
|
}), /* @__PURE__ */ Y(A, {
|
|
1078
1121
|
variant: e,
|
|
1079
|
-
children: /* @__PURE__ */ Y(A.Content, { children: i ? /* @__PURE__ */ Y(
|
|
1122
|
+
children: /* @__PURE__ */ Y(A.Content, { children: i ? /* @__PURE__ */ Y(Zt, {}) : r?.length ? r?.map((e, t) => /* @__PURE__ */ X("div", { children: [t > 0 && /* @__PURE__ */ Y("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Y(Xt, { invitation: e })] }, e.id)) : /* @__PURE__ */ Y(Qt, {}) })
|
|
1080
1123
|
})]
|
|
1081
1124
|
});
|
|
1082
1125
|
}
|
|
1083
1126
|
//#endregion
|
|
1084
1127
|
//#region src/components/auth/organization/organizations-settings.tsx
|
|
1085
|
-
function
|
|
1128
|
+
function en({ className: e, variant: t, ...n }) {
|
|
1086
1129
|
return /* @__PURE__ */ X("div", {
|
|
1087
1130
|
className: G("flex w-full flex-col gap-4 md:gap-6", e),
|
|
1088
1131
|
...n,
|
|
1089
|
-
children: [/* @__PURE__ */ Y(
|
|
1132
|
+
children: [/* @__PURE__ */ Y(Yt, { variant: t }), /* @__PURE__ */ Y($t, { variant: t })]
|
|
1090
1133
|
});
|
|
1091
1134
|
}
|
|
1092
1135
|
//#endregion
|
|
1093
1136
|
//#region src/lib/auth/organization-plugin.tsx
|
|
1094
|
-
var $ =
|
|
1095
|
-
let t =
|
|
1137
|
+
var $ = o(mt.id, (e = {}) => {
|
|
1138
|
+
let t = mt(e);
|
|
1096
1139
|
return {
|
|
1097
1140
|
...t,
|
|
1098
1141
|
localization: t.localization,
|
|
1099
1142
|
settingsTabs: [{
|
|
1100
1143
|
view: "organizations",
|
|
1101
|
-
label: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(
|
|
1102
|
-
component:
|
|
1144
|
+
label: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(Ee, { className: "text-muted" }), t.localization.organizations] }),
|
|
1145
|
+
component: en
|
|
1103
1146
|
}]
|
|
1104
1147
|
};
|
|
1105
1148
|
});
|
|
1106
1149
|
//#endregion
|
|
1107
1150
|
//#region src/components/auth/organization/change-organization-logo.tsx
|
|
1108
|
-
function
|
|
1109
|
-
let { authClient: t } =
|
|
1151
|
+
function tn({ className: e }) {
|
|
1152
|
+
let { authClient: t } = m(), { logo: n, localization: r } = h($), { data: i, isPending: a } = f(t), { mutate: o, isPending: c } = Se(t), l = st(null), [u, d] = q(!1), [p, g] = q(!1), _ = c || u || p;
|
|
1110
1153
|
async function v(e) {
|
|
1111
1154
|
let t = e.target.files?.[0];
|
|
1112
1155
|
if (!(!t || !i)) {
|
|
1113
|
-
e.target.value = "",
|
|
1156
|
+
e.target.value = "", d(!0);
|
|
1114
1157
|
try {
|
|
1115
1158
|
let e = await n.resize?.(t, n.size, n.extension) || t;
|
|
1116
|
-
|
|
1159
|
+
o({ data: { logo: await n.upload?.(e) || await s(e) } }, {
|
|
1117
1160
|
onSuccess: () => K.success(r.logoChangedSuccess),
|
|
1118
|
-
onSettled: () =>
|
|
1161
|
+
onSettled: () => d(!1)
|
|
1119
1162
|
});
|
|
1120
1163
|
} catch (e) {
|
|
1121
|
-
|
|
1164
|
+
d(!1), e instanceof Error && K.danger(e.message);
|
|
1122
1165
|
}
|
|
1123
1166
|
}
|
|
1124
1167
|
}
|
|
1125
1168
|
async function y() {
|
|
1126
1169
|
let e = i?.logo;
|
|
1127
|
-
|
|
1170
|
+
o({ data: { logo: "" } }, { onSuccess: async () => {
|
|
1128
1171
|
if (!e) {
|
|
1129
1172
|
K.success(r.logoDeletedSuccess);
|
|
1130
1173
|
return;
|
|
@@ -1162,7 +1205,7 @@ function Qt({ className: e }) {
|
|
|
1162
1205
|
className: "p-0 h-auto w-auto rounded-full",
|
|
1163
1206
|
isDisabled: !i || _,
|
|
1164
1207
|
onPress: () => l.current?.click(),
|
|
1165
|
-
children: /* @__PURE__ */ Y(
|
|
1208
|
+
children: /* @__PURE__ */ Y(Gt, {
|
|
1166
1209
|
size: "lg",
|
|
1167
1210
|
isPending: a,
|
|
1168
1211
|
organization: i
|
|
@@ -1177,13 +1220,13 @@ function Qt({ className: e }) {
|
|
|
1177
1220
|
children: /* @__PURE__ */ X(M.Menu, { children: [/* @__PURE__ */ X(M.Item, {
|
|
1178
1221
|
textValue: r.uploadLogo,
|
|
1179
1222
|
onAction: () => l.current?.click(),
|
|
1180
|
-
children: [/* @__PURE__ */ Y(
|
|
1223
|
+
children: [/* @__PURE__ */ Y(je, { className: "text-muted" }), /* @__PURE__ */ Y(L, { children: r.uploadLogo })]
|
|
1181
1224
|
}), /* @__PURE__ */ X(M.Item, {
|
|
1182
1225
|
textValue: r.deleteLogo,
|
|
1183
1226
|
isDisabled: !i?.logo,
|
|
1184
1227
|
onAction: y,
|
|
1185
1228
|
variant: "danger",
|
|
1186
|
-
children: [/* @__PURE__ */ Y(
|
|
1229
|
+
children: [/* @__PURE__ */ Y(Je, { className: "text-danger" }), /* @__PURE__ */ Y(L, { children: r.deleteLogo })]
|
|
1187
1230
|
})] })
|
|
1188
1231
|
})] })]
|
|
1189
1232
|
})
|
|
@@ -1192,8 +1235,8 @@ function Qt({ className: e }) {
|
|
|
1192
1235
|
}
|
|
1193
1236
|
//#endregion
|
|
1194
1237
|
//#region src/components/auth/organization/delete-organization-dialog.tsx
|
|
1195
|
-
function
|
|
1196
|
-
let { authClient: r, basePaths: i, localization: a, navigate: o } =
|
|
1238
|
+
function nn({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
1239
|
+
let { authClient: r, basePaths: i, localization: a, navigate: o } = m(), { localization: s, viewPaths: c } = h($), { mutate: l, isPending: u } = S(r, { onSuccess: () => {
|
|
1197
1240
|
t(!1), K.success(s.organizationDeleted), o({
|
|
1198
1241
|
to: `${i.settings}/${c.settings.organizations}`,
|
|
1199
1242
|
replace: !0
|
|
@@ -1211,7 +1254,7 @@ function $t({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1211
1254
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1212
1255
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1213
1256
|
status: "danger",
|
|
1214
|
-
children: /* @__PURE__ */ Y(
|
|
1257
|
+
children: /* @__PURE__ */ Y(Ye, {})
|
|
1215
1258
|
}), /* @__PURE__ */ Y(O.Heading, { children: s.deleteOrganization })] }),
|
|
1216
1259
|
/* @__PURE__ */ X(O.Body, {
|
|
1217
1260
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1246,7 +1289,7 @@ function $t({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1246
1289
|
}
|
|
1247
1290
|
//#endregion
|
|
1248
1291
|
//#region src/components/auth/organization/delete-organization-skeleton.tsx
|
|
1249
|
-
function
|
|
1292
|
+
function rn() {
|
|
1250
1293
|
return /* @__PURE__ */ X("div", {
|
|
1251
1294
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1252
1295
|
children: [/* @__PURE__ */ X("div", {
|
|
@@ -1257,9 +1300,9 @@ function en() {
|
|
|
1257
1300
|
}
|
|
1258
1301
|
//#endregion
|
|
1259
1302
|
//#region src/components/auth/organization/delete-organization.tsx
|
|
1260
|
-
function
|
|
1261
|
-
let { authClient: e } =
|
|
1262
|
-
return i ? /* @__PURE__ */ Y(
|
|
1303
|
+
function an() {
|
|
1304
|
+
let { authClient: e } = m(), { localization: t } = h($), { data: n } = f(e), { data: r, isPending: i } = T(e, { permissions: { organization: ["delete"] } }), [a, o] = q(!1);
|
|
1305
|
+
return i ? /* @__PURE__ */ Y(rn, {}) : r?.success ? /* @__PURE__ */ X("div", {
|
|
1263
1306
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1264
1307
|
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("p", {
|
|
1265
1308
|
className: "text-sm font-medium leading-tight",
|
|
@@ -1273,7 +1316,7 @@ function tn() {
|
|
|
1273
1316
|
variant: "danger-soft",
|
|
1274
1317
|
onPress: () => o(!0),
|
|
1275
1318
|
children: t.deleteOrganization
|
|
1276
|
-
}), n && /* @__PURE__ */ Y(
|
|
1319
|
+
}), n && /* @__PURE__ */ Y(nn, {
|
|
1277
1320
|
isOpen: a,
|
|
1278
1321
|
onOpenChange: o,
|
|
1279
1322
|
organization: n
|
|
@@ -1282,16 +1325,16 @@ function tn() {
|
|
|
1282
1325
|
}
|
|
1283
1326
|
//#endregion
|
|
1284
1327
|
//#region src/components/auth/organization/invite-member-dialog.tsx
|
|
1285
|
-
var
|
|
1286
|
-
function
|
|
1287
|
-
let { authClient: n, localization: r } =
|
|
1288
|
-
|
|
1328
|
+
var on = (e) => e.includes("member") ? "member" : e.at(-1) ?? "";
|
|
1329
|
+
function sn({ isOpen: e, onOpenChange: t }) {
|
|
1330
|
+
let { authClient: n, localization: r } = m(), { localization: i, roles: a } = h($), [o, s] = q(() => on(Object.keys(a)));
|
|
1331
|
+
at(() => {
|
|
1289
1332
|
s((e) => {
|
|
1290
1333
|
let t = Object.keys(a);
|
|
1291
|
-
return t.includes(e) ? e :
|
|
1334
|
+
return t.includes(e) ? e : on(t);
|
|
1292
1335
|
});
|
|
1293
1336
|
}, [a]);
|
|
1294
|
-
let { mutate: c, isPending: l } =
|
|
1337
|
+
let { mutate: c, isPending: l } = te(n, { onSuccess: () => {
|
|
1295
1338
|
t(!1), K.success(i.inviteMemberSuccess);
|
|
1296
1339
|
} }), u = Object.keys(a).includes(o);
|
|
1297
1340
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
@@ -1308,7 +1351,7 @@ function rn({ isOpen: e, onOpenChange: t }) {
|
|
|
1308
1351
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1309
1352
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1310
1353
|
status: "default",
|
|
1311
|
-
children: /* @__PURE__ */ Y(
|
|
1354
|
+
children: /* @__PURE__ */ Y(Ke, {})
|
|
1312
1355
|
}), /* @__PURE__ */ Y(O.Heading, { children: i.inviteMember })] }),
|
|
1313
1356
|
/* @__PURE__ */ X(O.Body, {
|
|
1314
1357
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1337,7 +1380,7 @@ function rn({ isOpen: e, onOpenChange: t }) {
|
|
|
1337
1380
|
/* @__PURE__ */ Y(N, {})
|
|
1338
1381
|
]
|
|
1339
1382
|
}),
|
|
1340
|
-
/* @__PURE__ */ X(
|
|
1383
|
+
/* @__PURE__ */ X(rt, {
|
|
1341
1384
|
name: "role",
|
|
1342
1385
|
value: o,
|
|
1343
1386
|
onChange: (e) => {
|
|
@@ -1348,11 +1391,11 @@ function rn({ isOpen: e, onOpenChange: t }) {
|
|
|
1348
1391
|
fullWidth: !0,
|
|
1349
1392
|
children: [
|
|
1350
1393
|
/* @__PURE__ */ Y(L, { children: i.role }),
|
|
1351
|
-
/* @__PURE__ */ X(
|
|
1352
|
-
/* @__PURE__ */ Y(
|
|
1394
|
+
/* @__PURE__ */ X(rt.Trigger, { children: [/* @__PURE__ */ Y(rt.Value, {}), /* @__PURE__ */ Y(rt.Indicator, {})] }),
|
|
1395
|
+
/* @__PURE__ */ Y(rt.Popover, { children: /* @__PURE__ */ Y(tt, { children: Object.entries(a).map(([e, t]) => /* @__PURE__ */ X(tt.Item, {
|
|
1353
1396
|
id: e,
|
|
1354
1397
|
textValue: t,
|
|
1355
|
-
children: [t, /* @__PURE__ */ Y(
|
|
1398
|
+
children: [t, /* @__PURE__ */ Y(tt.ItemIndicator, {})]
|
|
1356
1399
|
}, e)) }) }),
|
|
1357
1400
|
/* @__PURE__ */ Y(N, {})
|
|
1358
1401
|
]
|
|
@@ -1379,8 +1422,8 @@ function rn({ isOpen: e, onOpenChange: t }) {
|
|
|
1379
1422
|
}
|
|
1380
1423
|
//#endregion
|
|
1381
1424
|
//#region src/components/auth/organization/leave-organization-dialog.tsx
|
|
1382
|
-
function
|
|
1383
|
-
let { authClient: r, basePaths: i, localization: a, navigate: o } =
|
|
1425
|
+
function cn({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
1426
|
+
let { authClient: r, basePaths: i, localization: a, navigate: o } = m(), { localization: s, viewPaths: c } = h($), { mutate: l, isPending: u } = re(r, { onSuccess: () => {
|
|
1384
1427
|
t(!1), K.success(s.leftOrganization), o({
|
|
1385
1428
|
to: `${i.settings}/${c.settings.organizations}`,
|
|
1386
1429
|
replace: !0
|
|
@@ -1393,7 +1436,7 @@ function an({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1393
1436
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1394
1437
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1395
1438
|
status: "danger",
|
|
1396
|
-
children: /* @__PURE__ */ Y(
|
|
1439
|
+
children: /* @__PURE__ */ Y(Te, {})
|
|
1397
1440
|
}), /* @__PURE__ */ Y(O.Heading, { children: s.leaveOrganization })] }),
|
|
1398
1441
|
/* @__PURE__ */ X(O.Body, {
|
|
1399
1442
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1427,8 +1470,8 @@ function an({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1427
1470
|
}
|
|
1428
1471
|
//#endregion
|
|
1429
1472
|
//#region src/components/auth/organization/leave-organization.tsx
|
|
1430
|
-
function
|
|
1431
|
-
let { authClient: e } =
|
|
1473
|
+
function ln() {
|
|
1474
|
+
let { authClient: e } = m(), { localization: t } = h($), { data: n } = f(e), [r, i] = q(!1);
|
|
1432
1475
|
return /* @__PURE__ */ X("div", {
|
|
1433
1476
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1434
1477
|
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("p", {
|
|
@@ -1443,7 +1486,7 @@ function on() {
|
|
|
1443
1486
|
variant: "danger-soft",
|
|
1444
1487
|
onPress: () => i(!0),
|
|
1445
1488
|
children: t.leaveOrganization
|
|
1446
|
-
}), n && /* @__PURE__ */ Y(
|
|
1489
|
+
}), n && /* @__PURE__ */ Y(cn, {
|
|
1447
1490
|
isOpen: r,
|
|
1448
1491
|
onOpenChange: i,
|
|
1449
1492
|
organization: n
|
|
@@ -1452,7 +1495,7 @@ function on() {
|
|
|
1452
1495
|
}
|
|
1453
1496
|
//#endregion
|
|
1454
1497
|
//#region src/components/auth/organization/organization-invitation-row-skeleton.tsx
|
|
1455
|
-
function
|
|
1498
|
+
function un() {
|
|
1456
1499
|
return /* @__PURE__ */ X(H.Row, { children: [
|
|
1457
1500
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(B, { className: "h-4 w-48 rounded-lg" }) }),
|
|
1458
1501
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(B, { className: "h-4 w-36 rounded-lg" }) }),
|
|
@@ -1463,9 +1506,9 @@ function sn() {
|
|
|
1463
1506
|
}
|
|
1464
1507
|
//#endregion
|
|
1465
1508
|
//#region src/components/auth/organization/organization-invitation-row.tsx
|
|
1466
|
-
function
|
|
1467
|
-
let { authClient: t } =
|
|
1468
|
-
return a ? /* @__PURE__ */ Y(
|
|
1509
|
+
function dn({ invitation: e }) {
|
|
1510
|
+
let { authClient: t } = m(), { localization: n, roles: r } = h($), { data: i, isPending: a } = T(t, { permissions: { invitation: ["cancel"] } }), { mutate: o, isPending: s } = _(t), c = r?.[e.role] ?? e.role, l = n[e.status] ?? e.status, u = e.status === "pending" ? "warning" : e.status === "accepted" ? "success" : e.status === "rejected" ? "danger" : "default";
|
|
1511
|
+
return a ? /* @__PURE__ */ Y(un, {}) : /* @__PURE__ */ X(H.Row, { children: [
|
|
1469
1512
|
/* @__PURE__ */ Y(H.Cell, {
|
|
1470
1513
|
className: "font-medium text-sm",
|
|
1471
1514
|
children: e.email
|
|
@@ -1509,12 +1552,12 @@ function cn({ invitation: e }) {
|
|
|
1509
1552
|
}
|
|
1510
1553
|
//#endregion
|
|
1511
1554
|
//#region src/components/auth/organization/organization-invitations-empty.tsx
|
|
1512
|
-
function
|
|
1513
|
-
let { localization: t } =
|
|
1514
|
-
return /* @__PURE__ */ X(
|
|
1555
|
+
function fn({ onInvitePress: e }) {
|
|
1556
|
+
let { localization: t } = h($);
|
|
1557
|
+
return /* @__PURE__ */ X($e, {
|
|
1515
1558
|
className: "flex flex-col items-center gap-4 text-center p-4",
|
|
1516
1559
|
children: [
|
|
1517
|
-
/* @__PURE__ */ Y(
|
|
1560
|
+
/* @__PURE__ */ Y(Ue, { className: "size-6 text-muted" }),
|
|
1518
1561
|
/* @__PURE__ */ X("div", {
|
|
1519
1562
|
className: "flex flex-col gap-2",
|
|
1520
1563
|
children: [/* @__PURE__ */ Y("p", {
|
|
@@ -1535,13 +1578,13 @@ function ln({ onInvitePress: e }) {
|
|
|
1535
1578
|
}
|
|
1536
1579
|
//#endregion
|
|
1537
1580
|
//#region src/components/auth/organization/organization-invitations.tsx
|
|
1538
|
-
function
|
|
1539
|
-
let { authClient: n, localization: r } =
|
|
1581
|
+
function pn({ className: e, ...t }) {
|
|
1582
|
+
let { authClient: n, localization: r } = m(), { localization: i, roles: a } = h($), { data: o, isPending: s } = se(n), { isPending: c } = T(n, { permissions: { invitation: ["cancel"] } }), l = s || c, [u, d] = q(), [f, p] = q("all"), [g, _] = q("all"), [v, y] = q(""), b = ot(() => o?.filter((e) => (f === "all" || e.role === f) && (g === "all" || e.status === g) && e.email.toLowerCase().includes(v.toLowerCase())), [
|
|
1540
1583
|
v,
|
|
1541
1584
|
o,
|
|
1542
1585
|
f,
|
|
1543
1586
|
g
|
|
1544
|
-
]), x =
|
|
1587
|
+
]), x = ot(() => !u || !b ? b : [...b].sort((e, t) => {
|
|
1545
1588
|
let n = u.column, r = 0;
|
|
1546
1589
|
return r = n === "createdAt" ? new Date(e.createdAt).getTime() - new Date(t.createdAt).getTime() : String(e[n]).localeCompare(String(t[n])), u.direction === "descending" && (r *= -1), r;
|
|
1547
1590
|
}), [u, b]), [S, C] = q(!1);
|
|
@@ -1578,13 +1621,13 @@ function un({ className: e, ...t }) {
|
|
|
1578
1621
|
size: "sm",
|
|
1579
1622
|
variant: "secondary",
|
|
1580
1623
|
isDisabled: l,
|
|
1581
|
-
children: [/* @__PURE__ */ Y(
|
|
1624
|
+
children: [/* @__PURE__ */ Y(Le, {}), i.role]
|
|
1582
1625
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, {
|
|
1583
1626
|
selectionMode: "single",
|
|
1584
1627
|
selectedKeys: new Set([f]),
|
|
1585
1628
|
onSelectionChange: (e) => {
|
|
1586
1629
|
let t = [...e][0];
|
|
1587
|
-
|
|
1630
|
+
p(t ?? "all");
|
|
1588
1631
|
},
|
|
1589
1632
|
children: [/* @__PURE__ */ X(M.Item, {
|
|
1590
1633
|
id: "all",
|
|
@@ -1600,7 +1643,7 @@ function un({ className: e, ...t }) {
|
|
|
1600
1643
|
size: "sm",
|
|
1601
1644
|
variant: "secondary",
|
|
1602
1645
|
isDisabled: l,
|
|
1603
|
-
children: [/* @__PURE__ */ Y(
|
|
1646
|
+
children: [/* @__PURE__ */ Y(Le, {}), i.status]
|
|
1604
1647
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, {
|
|
1605
1648
|
selectionMode: "single",
|
|
1606
1649
|
selectedKeys: new Set([g]),
|
|
@@ -1643,7 +1686,7 @@ function un({ className: e, ...t }) {
|
|
|
1643
1686
|
type: "button",
|
|
1644
1687
|
"aria-label": i.clear,
|
|
1645
1688
|
className: "text-muted hover:text-foreground inline-flex cursor-pointer items-center",
|
|
1646
|
-
onClick: () =>
|
|
1689
|
+
onClick: () => p("all"),
|
|
1647
1690
|
children: /* @__PURE__ */ Y(D, { className: "size-3" })
|
|
1648
1691
|
})]
|
|
1649
1692
|
}), g !== "all" && /* @__PURE__ */ X(j, {
|
|
@@ -1709,13 +1752,13 @@ function un({ className: e, ...t }) {
|
|
|
1709
1752
|
children: i.actions
|
|
1710
1753
|
})
|
|
1711
1754
|
] }), /* @__PURE__ */ Y(H.Body, {
|
|
1712
|
-
renderEmptyState: () => /* @__PURE__ */ Y(
|
|
1713
|
-
children: l ? /* @__PURE__ */ Y(
|
|
1755
|
+
renderEmptyState: () => /* @__PURE__ */ Y(fn, { onInvitePress: () => C(!0) }),
|
|
1756
|
+
children: l ? /* @__PURE__ */ Y(un, {}) : x?.map((e) => /* @__PURE__ */ Y(dn, { invitation: e }, e.id))
|
|
1714
1757
|
})]
|
|
1715
1758
|
}) }) })
|
|
1716
1759
|
]
|
|
1717
1760
|
}),
|
|
1718
|
-
/* @__PURE__ */ Y(
|
|
1761
|
+
/* @__PURE__ */ Y(sn, {
|
|
1719
1762
|
isOpen: S,
|
|
1720
1763
|
onOpenChange: C
|
|
1721
1764
|
})
|
|
@@ -1724,9 +1767,9 @@ function un({ className: e, ...t }) {
|
|
|
1724
1767
|
}
|
|
1725
1768
|
//#endregion
|
|
1726
1769
|
//#region src/components/auth/organization/organization-member-row-skeleton.tsx
|
|
1727
|
-
function
|
|
1770
|
+
function mn() {
|
|
1728
1771
|
return /* @__PURE__ */ X(H.Row, { children: [
|
|
1729
|
-
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(
|
|
1772
|
+
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(r, { isPending: !0 }) }),
|
|
1730
1773
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(B, { className: "h-4 w-18 rounded-lg" }) }),
|
|
1731
1774
|
/* @__PURE__ */ Y(H.Cell, {
|
|
1732
1775
|
className: "flex justify-end",
|
|
@@ -1736,8 +1779,8 @@ function dn() {
|
|
|
1736
1779
|
}
|
|
1737
1780
|
//#endregion
|
|
1738
1781
|
//#region src/components/auth/organization/remove-member-dialog.tsx
|
|
1739
|
-
function
|
|
1740
|
-
let { authClient: i, localization: a } =
|
|
1782
|
+
function hn({ isOpen: e, onOpenChange: t, member: n }) {
|
|
1783
|
+
let { authClient: i, localization: a } = m(), { localization: o, roles: s } = h($), { mutate: c, isPending: l } = pe(i, { onSuccess: () => {
|
|
1741
1784
|
t(!1), K.success(o.memberRemoved);
|
|
1742
1785
|
} });
|
|
1743
1786
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
@@ -1747,7 +1790,7 @@ function fn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
|
1747
1790
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1748
1791
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1749
1792
|
status: "danger",
|
|
1750
|
-
children: /* @__PURE__ */ Y(
|
|
1793
|
+
children: /* @__PURE__ */ Y(Je, {})
|
|
1751
1794
|
}), /* @__PURE__ */ Y(O.Heading, { children: o.removeMember })] }),
|
|
1752
1795
|
/* @__PURE__ */ X(O.Body, {
|
|
1753
1796
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1758,10 +1801,10 @@ function fn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
|
1758
1801
|
variant: "secondary",
|
|
1759
1802
|
children: /* @__PURE__ */ X(A.Content, {
|
|
1760
1803
|
className: "justify-between flex-row items-center gap-2",
|
|
1761
|
-
children: [/* @__PURE__ */ Y(
|
|
1804
|
+
children: [/* @__PURE__ */ Y(r, { user: n.user }), /* @__PURE__ */ Y(j, {
|
|
1762
1805
|
size: "sm",
|
|
1763
1806
|
variant: "tertiary",
|
|
1764
|
-
children: /* @__PURE__ */ Y(j.Label, { children: s?.[
|
|
1807
|
+
children: /* @__PURE__ */ Y(j.Label, { children: s?.[n.role] ?? n.role })
|
|
1765
1808
|
})]
|
|
1766
1809
|
})
|
|
1767
1810
|
})]
|
|
@@ -1775,8 +1818,8 @@ function fn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
|
1775
1818
|
variant: "danger",
|
|
1776
1819
|
isPending: l,
|
|
1777
1820
|
onPress: () => c({
|
|
1778
|
-
memberIdOrEmail:
|
|
1779
|
-
organizationId:
|
|
1821
|
+
memberIdOrEmail: n.id,
|
|
1822
|
+
organizationId: n.organizationId
|
|
1780
1823
|
}),
|
|
1781
1824
|
children: [l && /* @__PURE__ */ Y(V, {
|
|
1782
1825
|
color: "current",
|
|
@@ -1788,10 +1831,10 @@ function fn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
|
1788
1831
|
}
|
|
1789
1832
|
//#endregion
|
|
1790
1833
|
//#region src/components/auth/organization/organization-member-row.tsx
|
|
1791
|
-
function
|
|
1792
|
-
let { authClient: i } =
|
|
1793
|
-
return f ? /* @__PURE__ */ Y(
|
|
1794
|
-
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(
|
|
1834
|
+
function gn({ member: e, isOwner: t, organization: n }) {
|
|
1835
|
+
let { authClient: i } = m(), { localization: a, roles: o } = h($), { data: s } = E(i), { data: c, isPending: l } = T(i, { permissions: { member: ["update"] } }), { data: u, isPending: d } = T(i, { permissions: { member: ["delete"] } }), f = l || d, { mutate: p, isPending: g } = xe(i, { onSuccess: () => K.success(a.memberRoleUpdated) }), _ = o?.[e.role] ?? e.role, v = Object.entries(o).filter(([e]) => t || e !== "owner"), y = s?.user.id === e.userId, [b, x] = q(!1), [S, C] = q(!1);
|
|
1836
|
+
return f ? /* @__PURE__ */ Y(mn, {}) : /* @__PURE__ */ X(H.Row, { children: [
|
|
1837
|
+
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(r, { user: e.user }) }),
|
|
1795
1838
|
/* @__PURE__ */ Y(H.Cell, { children: _ }),
|
|
1796
1839
|
/* @__PURE__ */ X(H.Cell, { children: [/* @__PURE__ */ X("div", {
|
|
1797
1840
|
className: "flex items-center justify-end gap-1",
|
|
@@ -1804,13 +1847,13 @@ function pn({ member: e, isOwner: t, organization: r }) {
|
|
|
1804
1847
|
children: g ? /* @__PURE__ */ Y(V, {
|
|
1805
1848
|
color: "current",
|
|
1806
1849
|
size: "sm"
|
|
1807
|
-
}) : /* @__PURE__ */ Y(
|
|
1850
|
+
}) : /* @__PURE__ */ Y(We, {})
|
|
1808
1851
|
}), /* @__PURE__ */ Y(M.Popover, {
|
|
1809
1852
|
className: "min-w-fit",
|
|
1810
1853
|
children: /* @__PURE__ */ Y(M.Menu, { children: v.map(([t, n]) => /* @__PURE__ */ Y(M.Item, {
|
|
1811
1854
|
textValue: n,
|
|
1812
1855
|
isDisabled: e.role === t,
|
|
1813
|
-
onAction: () =>
|
|
1856
|
+
onAction: () => p({
|
|
1814
1857
|
memberId: e.id,
|
|
1815
1858
|
role: t
|
|
1816
1859
|
}),
|
|
@@ -1822,20 +1865,20 @@ function pn({ member: e, isOwner: t, organization: r }) {
|
|
|
1822
1865
|
variant: "danger-soft",
|
|
1823
1866
|
"aria-label": a.leaveOrganization,
|
|
1824
1867
|
onPress: () => C(!0),
|
|
1825
|
-
children: /* @__PURE__ */ Y(
|
|
1868
|
+
children: /* @__PURE__ */ Y(Te, {})
|
|
1826
1869
|
}) : u?.success && /* @__PURE__ */ Y(k, {
|
|
1827
1870
|
isIconOnly: !0,
|
|
1828
1871
|
size: "sm",
|
|
1829
1872
|
variant: "danger-soft",
|
|
1830
1873
|
"aria-label": a.removeMember,
|
|
1831
1874
|
onPress: () => x(!0),
|
|
1832
|
-
children: /* @__PURE__ */ Y(
|
|
1875
|
+
children: /* @__PURE__ */ Y(Je, {})
|
|
1833
1876
|
})]
|
|
1834
|
-
}), y &&
|
|
1877
|
+
}), y && n ? /* @__PURE__ */ Y(cn, {
|
|
1835
1878
|
isOpen: S,
|
|
1836
1879
|
onOpenChange: C,
|
|
1837
|
-
organization:
|
|
1838
|
-
}) : u?.success && /* @__PURE__ */ Y(
|
|
1880
|
+
organization: n
|
|
1881
|
+
}) : u?.success && /* @__PURE__ */ Y(hn, {
|
|
1839
1882
|
isOpen: b,
|
|
1840
1883
|
onOpenChange: x,
|
|
1841
1884
|
member: e
|
|
@@ -1844,15 +1887,15 @@ function pn({ member: e, isOwner: t, organization: r }) {
|
|
|
1844
1887
|
}
|
|
1845
1888
|
//#endregion
|
|
1846
1889
|
//#region src/components/auth/organization/organization-members.tsx
|
|
1847
|
-
function
|
|
1848
|
-
let { authClient: n } =
|
|
1890
|
+
function _n({ className: e, ...t }) {
|
|
1891
|
+
let { authClient: n } = m(), { localization: r, roles: i } = h($), { data: a } = E(n), { data: o, isPending: s } = f(n), { data: c, isPending: l } = ce(n), { isPending: u } = T(n, { permissions: { member: ["update"] } }), { isPending: d } = T(n, { permissions: { member: ["delete"] } }), p = s || l || u || d, [g, _] = q(), [v, y] = q("all"), [b, x] = q(""), S = ot(() => c?.members.filter((e) => (v === "all" || e.role === v) && (e.user.name.toLowerCase().includes(b.toLowerCase()) || e.user.email.toLowerCase().includes(b.toLowerCase()))), [
|
|
1849
1892
|
b,
|
|
1850
1893
|
c?.members,
|
|
1851
1894
|
v
|
|
1852
|
-
]), C =
|
|
1895
|
+
]), C = ot(() => !g || !S ? S : [...S].sort((e, t) => {
|
|
1853
1896
|
let n = g.column, r = n === "user" ? e.user.name || e.user.email : String(e[n]), i = n === "user" ? t.user.name || t.user.email : String(t[n]), a = r.localeCompare(i);
|
|
1854
1897
|
return g.direction === "descending" && (a *= -1), a;
|
|
1855
|
-
}), [g, S]), [ee,
|
|
1898
|
+
}), [g, S]), [ee, w] = q(!1), te = c?.members.some((e) => e.role === "owner" && e.userId === a?.user.id);
|
|
1856
1899
|
return /* @__PURE__ */ X("div", {
|
|
1857
1900
|
className: G("flex flex-col gap-3", e),
|
|
1858
1901
|
...t,
|
|
@@ -1865,8 +1908,8 @@ function mn({ className: e, ...t }) {
|
|
|
1865
1908
|
}), /* @__PURE__ */ Y(k, {
|
|
1866
1909
|
className: "shrink-0",
|
|
1867
1910
|
size: "sm",
|
|
1868
|
-
isDisabled:
|
|
1869
|
-
onPress: () =>
|
|
1911
|
+
isDisabled: p,
|
|
1912
|
+
onPress: () => w(!0),
|
|
1870
1913
|
children: r.inviteMember
|
|
1871
1914
|
})]
|
|
1872
1915
|
}),
|
|
@@ -1880,7 +1923,7 @@ function mn({ className: e, ...t }) {
|
|
|
1880
1923
|
"aria-label": r.search,
|
|
1881
1924
|
value: b,
|
|
1882
1925
|
onChange: x,
|
|
1883
|
-
isDisabled:
|
|
1926
|
+
isDisabled: p,
|
|
1884
1927
|
children: /* @__PURE__ */ X(z.Group, { children: [
|
|
1885
1928
|
/* @__PURE__ */ Y(z.SearchIcon, {}),
|
|
1886
1929
|
/* @__PURE__ */ Y(z.Input, {
|
|
@@ -1892,8 +1935,8 @@ function mn({ className: e, ...t }) {
|
|
|
1892
1935
|
}), /* @__PURE__ */ X(M, { children: [/* @__PURE__ */ X(k, {
|
|
1893
1936
|
size: "sm",
|
|
1894
1937
|
variant: "secondary",
|
|
1895
|
-
isDisabled:
|
|
1896
|
-
children: [/* @__PURE__ */ Y(
|
|
1938
|
+
isDisabled: p,
|
|
1939
|
+
children: [/* @__PURE__ */ Y(Le, {}), r.role]
|
|
1897
1940
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, {
|
|
1898
1941
|
selectionMode: "single",
|
|
1899
1942
|
selectedKeys: new Set([v]),
|
|
@@ -1960,7 +2003,7 @@ function mn({ className: e, ...t }) {
|
|
|
1960
2003
|
className: "text-end",
|
|
1961
2004
|
children: r.actions
|
|
1962
2005
|
})
|
|
1963
|
-
] }), /* @__PURE__ */ Y(H.Body, { children:
|
|
2006
|
+
] }), /* @__PURE__ */ Y(H.Body, { children: p ? /* @__PURE__ */ Y(mn, {}) : !!o && C?.map((e) => /* @__PURE__ */ Y(gn, {
|
|
1964
2007
|
member: e,
|
|
1965
2008
|
isOwner: te,
|
|
1966
2009
|
organization: o
|
|
@@ -1968,26 +2011,26 @@ function mn({ className: e, ...t }) {
|
|
|
1968
2011
|
}) }) })
|
|
1969
2012
|
]
|
|
1970
2013
|
}),
|
|
1971
|
-
/* @__PURE__ */ Y(
|
|
2014
|
+
/* @__PURE__ */ Y(sn, {
|
|
1972
2015
|
isOpen: ee,
|
|
1973
|
-
onOpenChange:
|
|
2016
|
+
onOpenChange: w
|
|
1974
2017
|
})
|
|
1975
2018
|
]
|
|
1976
2019
|
});
|
|
1977
2020
|
}
|
|
1978
2021
|
//#endregion
|
|
1979
2022
|
//#region src/components/auth/organization/organization-people.tsx
|
|
1980
|
-
function
|
|
2023
|
+
function vn({ className: e, ...t }) {
|
|
1981
2024
|
return /* @__PURE__ */ X("div", {
|
|
1982
2025
|
className: G("flex flex-col gap-4 md:gap-6", e),
|
|
1983
2026
|
...t,
|
|
1984
|
-
children: [/* @__PURE__ */ Y(
|
|
2027
|
+
children: [/* @__PURE__ */ Y(_n, {}), /* @__PURE__ */ Y(pn, {})]
|
|
1985
2028
|
});
|
|
1986
2029
|
}
|
|
1987
2030
|
//#endregion
|
|
1988
2031
|
//#region src/components/auth/organization/organization-danger-zone.tsx
|
|
1989
|
-
function
|
|
1990
|
-
let { authClient: r, localization: i } =
|
|
2032
|
+
function yn({ className: e, variant: t, ...n }) {
|
|
2033
|
+
let { authClient: r, localization: i } = m(), { data: a, isPending: o } = T(r, { permissions: { organization: ["delete"] } }), s = !!a?.success;
|
|
1991
2034
|
return /* @__PURE__ */ X("div", {
|
|
1992
2035
|
className: G("flex w-full flex-col", e),
|
|
1993
2036
|
...n,
|
|
@@ -1998,26 +2041,26 @@ function gn({ className: e, variant: t, ...n }) {
|
|
|
1998
2041
|
variant: t,
|
|
1999
2042
|
children: /* @__PURE__ */ Y(A.Content, {
|
|
2000
2043
|
className: "gap-0",
|
|
2001
|
-
children: o ? /* @__PURE__ */ Y(
|
|
2044
|
+
children: o ? /* @__PURE__ */ Y(rn, {}) : /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(ln, {}), s && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Y(an, {})] })] })
|
|
2002
2045
|
})
|
|
2003
2046
|
})]
|
|
2004
2047
|
});
|
|
2005
2048
|
}
|
|
2006
2049
|
//#endregion
|
|
2007
2050
|
//#region src/components/auth/organization/organization-profile.tsx
|
|
2008
|
-
function
|
|
2009
|
-
let { authClient: r, localization: i } =
|
|
2010
|
-
|
|
2051
|
+
function bn({ className: e, variant: t, ...n }) {
|
|
2052
|
+
let { authClient: r, localization: i } = m(), { localization: a } = h($), { data: o } = f(r), [s, c] = q(o?.slug ?? "");
|
|
2053
|
+
at(() => {
|
|
2011
2054
|
c(o?.slug ?? "");
|
|
2012
2055
|
}, [o?.slug]);
|
|
2013
|
-
let { mutate: l, isPending: u } =
|
|
2014
|
-
function
|
|
2056
|
+
let { mutate: l, isPending: u } = Se(r, { onSuccess: () => K.success(a.organizationUpdatedSuccess) });
|
|
2057
|
+
function d(e) {
|
|
2015
2058
|
e.preventDefault(), o && l({ data: {
|
|
2016
2059
|
name: new FormData(e.currentTarget).get("name"),
|
|
2017
2060
|
slug: s
|
|
2018
2061
|
} });
|
|
2019
2062
|
}
|
|
2020
|
-
let
|
|
2063
|
+
let p = t === "transparent" ? "primary" : "secondary";
|
|
2021
2064
|
return /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("h2", {
|
|
2022
2065
|
className: G("mb-3 text-sm font-semibold"),
|
|
2023
2066
|
children: a.organizationProfile
|
|
@@ -2026,10 +2069,10 @@ function _n({ className: e, variant: t, ...n }) {
|
|
|
2026
2069
|
variant: t,
|
|
2027
2070
|
...n,
|
|
2028
2071
|
children: /* @__PURE__ */ Y(A.Content, { children: /* @__PURE__ */ X(P, {
|
|
2029
|
-
onSubmit:
|
|
2072
|
+
onSubmit: d,
|
|
2030
2073
|
className: "flex flex-col gap-4",
|
|
2031
2074
|
children: [
|
|
2032
|
-
/* @__PURE__ */ Y(
|
|
2075
|
+
/* @__PURE__ */ Y(tn, {}),
|
|
2033
2076
|
/* @__PURE__ */ X(W, {
|
|
2034
2077
|
name: "name",
|
|
2035
2078
|
defaultValue: o?.name,
|
|
@@ -2040,18 +2083,18 @@ function _n({ className: e, variant: t, ...n }) {
|
|
|
2040
2083
|
className: G(!o && "hidden"),
|
|
2041
2084
|
autoComplete: "organization",
|
|
2042
2085
|
placeholder: a.namePlaceholder,
|
|
2043
|
-
variant:
|
|
2086
|
+
variant: p
|
|
2044
2087
|
}),
|
|
2045
2088
|
!o && /* @__PURE__ */ Y(B, { className: "h-10 w-full rounded-xl md:h-9" }),
|
|
2046
2089
|
/* @__PURE__ */ Y(N, {})
|
|
2047
2090
|
]
|
|
2048
2091
|
}, `${o?.id}-${o?.name}-name`),
|
|
2049
|
-
o ? /* @__PURE__ */ Y(
|
|
2092
|
+
o ? /* @__PURE__ */ Y(Ut, {
|
|
2050
2093
|
value: s,
|
|
2051
2094
|
onChange: c,
|
|
2052
2095
|
currentSlug: o.slug,
|
|
2053
2096
|
isDisabled: u,
|
|
2054
|
-
variant:
|
|
2097
|
+
variant: p
|
|
2055
2098
|
}) : /* @__PURE__ */ X(W, {
|
|
2056
2099
|
isDisabled: !0,
|
|
2057
2100
|
children: [/* @__PURE__ */ Y(L, { children: a.slug }), /* @__PURE__ */ Y(B, { className: "h-10 w-full rounded-xl md:h-9" })]
|
|
@@ -2073,44 +2116,44 @@ function _n({ className: e, variant: t, ...n }) {
|
|
|
2073
2116
|
}
|
|
2074
2117
|
//#endregion
|
|
2075
2118
|
//#region src/components/auth/organization/organization-settings.tsx
|
|
2076
|
-
function
|
|
2077
|
-
let { plugins: r } =
|
|
2119
|
+
function xn({ className: e, variant: t, ...n }) {
|
|
2120
|
+
let { plugins: r } = m();
|
|
2078
2121
|
return /* @__PURE__ */ X("div", {
|
|
2079
2122
|
className: G("flex flex-col gap-4 md:gap-6", e),
|
|
2080
2123
|
...n,
|
|
2081
2124
|
children: [
|
|
2082
|
-
/* @__PURE__ */ Y(
|
|
2125
|
+
/* @__PURE__ */ Y(bn, { variant: t }),
|
|
2083
2126
|
r.flatMap((e) => e.organizationCards?.map((n, r) => /* @__PURE__ */ Y(n, { variant: t }, `${e.id}-${r.toString()}`))),
|
|
2084
|
-
/* @__PURE__ */ Y(
|
|
2127
|
+
/* @__PURE__ */ Y(yn, { variant: t })
|
|
2085
2128
|
]
|
|
2086
2129
|
});
|
|
2087
2130
|
}
|
|
2088
2131
|
//#endregion
|
|
2089
2132
|
//#region src/components/auth/organization/organization.tsx
|
|
2090
|
-
function
|
|
2133
|
+
function Sn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
2091
2134
|
if (!i && !n) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
|
|
2092
|
-
let { authClient: o, basePaths: s, localization: c, navigate: l } =
|
|
2093
|
-
|
|
2094
|
-
let { localization: u, viewPaths:
|
|
2095
|
-
|
|
2135
|
+
let { authClient: o, basePaths: s, localization: c, navigate: l } = m();
|
|
2136
|
+
g(o);
|
|
2137
|
+
let { localization: u, viewPaths: d, slug: p, slugPrefix: _ } = h($), { data: v, isPending: y } = f(o);
|
|
2138
|
+
at(() => {
|
|
2096
2139
|
!y && !v && l({
|
|
2097
|
-
to: `${s.settings}/${
|
|
2140
|
+
to: `${s.settings}/${d.settings?.organizations}`,
|
|
2098
2141
|
replace: !0
|
|
2099
2142
|
});
|
|
2100
2143
|
}, [
|
|
2101
2144
|
s.settings,
|
|
2102
2145
|
y,
|
|
2103
2146
|
l,
|
|
2104
|
-
|
|
2147
|
+
d.settings?.organizations,
|
|
2105
2148
|
v
|
|
2106
2149
|
]);
|
|
2107
|
-
let b =
|
|
2150
|
+
let b = ot(() => i || Object.entries(d.organization).find(([, e]) => e === n)?.[0], [
|
|
2108
2151
|
i,
|
|
2109
2152
|
n,
|
|
2110
|
-
|
|
2153
|
+
d.organization
|
|
2111
2154
|
]);
|
|
2112
2155
|
if (!b) {
|
|
2113
|
-
let e = Object.values(
|
|
2156
|
+
let e = Object.values(d.organization).join(", ");
|
|
2114
2157
|
throw Error(`[Better Auth UI] Unknown organization path "${n}". Valid paths are: ${e}`);
|
|
2115
2158
|
}
|
|
2116
2159
|
return !y && !v ? null : /* @__PURE__ */ X(U, {
|
|
@@ -2124,27 +2167,27 @@ function yn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
2124
2167
|
className: "max-w-fit overflow-x-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
2125
2168
|
children: [/* @__PURE__ */ X(U.Tab, {
|
|
2126
2169
|
id: "settings",
|
|
2127
|
-
href:
|
|
2170
|
+
href: p ? `${s.organization}/${_}${p}/${d.organization.settings}` : `${s.organization}/${d.organization.settings}`,
|
|
2128
2171
|
className: "gap-2",
|
|
2129
2172
|
onPress: (e) => e.target.scrollIntoView({
|
|
2130
2173
|
behavior: "smooth",
|
|
2131
2174
|
inline: "center"
|
|
2132
2175
|
}),
|
|
2133
2176
|
children: [
|
|
2134
|
-
/* @__PURE__ */ Y(
|
|
2177
|
+
/* @__PURE__ */ Y(Re, { className: "text-muted" }),
|
|
2135
2178
|
c.settings.settings,
|
|
2136
2179
|
/* @__PURE__ */ Y(U.Indicator, {})
|
|
2137
2180
|
]
|
|
2138
2181
|
}), /* @__PURE__ */ X(U.Tab, {
|
|
2139
2182
|
id: "people",
|
|
2140
|
-
href:
|
|
2183
|
+
href: p ? `${s.organization}/${_}${p}/${d.organization.people}` : `${s.organization}/${d.organization.people}`,
|
|
2141
2184
|
className: "gap-2",
|
|
2142
2185
|
onPress: (e) => e.target.scrollIntoView({
|
|
2143
2186
|
behavior: "smooth",
|
|
2144
2187
|
inline: "center"
|
|
2145
2188
|
}),
|
|
2146
2189
|
children: [
|
|
2147
|
-
/* @__PURE__ */ Y(
|
|
2190
|
+
/* @__PURE__ */ Y(Ge, { className: "text-muted" }),
|
|
2148
2191
|
u.people,
|
|
2149
2192
|
/* @__PURE__ */ Y(U.Indicator, {})
|
|
2150
2193
|
]
|
|
@@ -2153,32 +2196,32 @@ function yn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
2153
2196
|
/* @__PURE__ */ Y(U.Panel, {
|
|
2154
2197
|
id: "settings",
|
|
2155
2198
|
className: "px-0",
|
|
2156
|
-
children: /* @__PURE__ */ Y(
|
|
2199
|
+
children: /* @__PURE__ */ Y(xn, { variant: r })
|
|
2157
2200
|
}),
|
|
2158
2201
|
/* @__PURE__ */ Y(U.Panel, {
|
|
2159
2202
|
id: "people",
|
|
2160
2203
|
className: "px-0",
|
|
2161
|
-
children: /* @__PURE__ */ Y(
|
|
2204
|
+
children: /* @__PURE__ */ Y(vn, {})
|
|
2162
2205
|
})
|
|
2163
2206
|
]
|
|
2164
2207
|
});
|
|
2165
2208
|
}
|
|
2166
2209
|
//#endregion
|
|
2167
2210
|
//#region src/components/auth/organization/organization-switcher.tsx
|
|
2168
|
-
function
|
|
2169
|
-
let { authClient:
|
|
2211
|
+
function Cn({ className: e, hideCreate: t, hidePersonal: n, hideSettings: i, hideSlug: a = !0, setActive: o, placement: s, variant: c = "ghost", size: l = "md", trigger: u, ...d }) {
|
|
2212
|
+
let { authClient: p, navigate: g, basePaths: _, localization: v, viewPaths: y } = m(), { data: b, isPending: x } = E(p), { localization: S, viewPaths: C, slug: ee, slugPrefix: w } = h($), { data: T, isPending: te } = f(p), { data: ne, isPending: re } = le(p), { mutate: ie } = he(p), ae = x || !!b && (re || te), [oe, se] = q(!1), [ce, ue] = q(!1);
|
|
2170
2213
|
function de(e) {
|
|
2171
2214
|
o ? o(e) : ee === void 0 ? ie({ organizationId: e?.id ?? null }) : g({ to: e ? `${_.organization}/${w}${e.slug}/${C.organization.settings}` : `${_.settings}/${y.settings.account}` });
|
|
2172
2215
|
}
|
|
2173
2216
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X(M, {
|
|
2174
|
-
isOpen:
|
|
2217
|
+
isOpen: ce,
|
|
2175
2218
|
onOpenChange: ue,
|
|
2176
2219
|
children: [u ? /* @__PURE__ */ Y(M.Trigger, { children: u }) : /* @__PURE__ */ X(k, {
|
|
2177
2220
|
variant: c,
|
|
2178
2221
|
className: G("h-auto px-2 py-2 text-left", e),
|
|
2179
2222
|
isDisabled: !b || ae,
|
|
2180
2223
|
"aria-label": S.organization,
|
|
2181
|
-
...
|
|
2224
|
+
...d,
|
|
2182
2225
|
children: [ae ? /* @__PURE__ */ Y(Q, {
|
|
2183
2226
|
size: l,
|
|
2184
2227
|
isPending: !0,
|
|
@@ -2188,7 +2231,7 @@ function bn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hid
|
|
|
2188
2231
|
size: l,
|
|
2189
2232
|
hideRole: !0,
|
|
2190
2233
|
hideSlug: a
|
|
2191
|
-
}) : b && !
|
|
2234
|
+
}) : b && !n ? /* @__PURE__ */ Y(r, {
|
|
2192
2235
|
size: l,
|
|
2193
2236
|
hideSubtitle: a
|
|
2194
2237
|
}) : /* @__PURE__ */ Y(Q, {
|
|
@@ -2196,7 +2239,7 @@ function bn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hid
|
|
|
2196
2239
|
hideRole: !0,
|
|
2197
2240
|
hideSlug: a,
|
|
2198
2241
|
organization: { name: S.organization }
|
|
2199
|
-
}), /* @__PURE__ */ Y(
|
|
2242
|
+
}), /* @__PURE__ */ Y(Oe, { className: "size-3 shrink-0 text-muted" })]
|
|
2200
2243
|
}), /* @__PURE__ */ X(M.Popover, {
|
|
2201
2244
|
placement: s,
|
|
2202
2245
|
className: "max-w-svw",
|
|
@@ -2206,31 +2249,31 @@ function bn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hid
|
|
|
2206
2249
|
hideRole: !0,
|
|
2207
2250
|
hideSlug: a,
|
|
2208
2251
|
organization: T
|
|
2209
|
-
}), !i && /* @__PURE__ */ X(
|
|
2252
|
+
}), !i && /* @__PURE__ */ X(et, {
|
|
2210
2253
|
href: ee ? `${_.organization}/${w}${ee}/${C.organization.settings}` : `${_.organization}/${C.organization.settings}`,
|
|
2211
2254
|
className: G(ct({
|
|
2212
2255
|
variant: "outline",
|
|
2213
2256
|
size: "sm"
|
|
2214
2257
|
}), "shrink-0 gap-2"),
|
|
2215
2258
|
onPress: () => ue(!1),
|
|
2216
|
-
children: [/* @__PURE__ */ Y(
|
|
2259
|
+
children: [/* @__PURE__ */ Y(Re, { className: "text-muted" }), S.manage]
|
|
2217
2260
|
})]
|
|
2218
|
-
}) : !ae && b?.user && !
|
|
2261
|
+
}) : !ae && b?.user && !n ? /* @__PURE__ */ X("div", {
|
|
2219
2262
|
className: "flex items-center justify-between gap-4 px-4 pt-3",
|
|
2220
|
-
children: [/* @__PURE__ */ Y(
|
|
2263
|
+
children: [/* @__PURE__ */ Y(r, { hideSubtitle: a }), !i && /* @__PURE__ */ X(et, {
|
|
2221
2264
|
href: `${_.settings}/${y.settings.account}`,
|
|
2222
2265
|
className: G(ct({
|
|
2223
2266
|
variant: "outline",
|
|
2224
2267
|
size: "sm"
|
|
2225
2268
|
}), "shrink-0 gap-2"),
|
|
2226
2269
|
onPress: () => ue(!1),
|
|
2227
|
-
children: [/* @__PURE__ */ Y(
|
|
2270
|
+
children: [/* @__PURE__ */ Y(Re, { className: "text-muted" }), v.settings.settings]
|
|
2228
2271
|
})]
|
|
2229
2272
|
}) : null, /* @__PURE__ */ X(M.Menu, { children: [
|
|
2230
|
-
!!T && !
|
|
2273
|
+
!!T && !n && /* @__PURE__ */ Y(M.Item, {
|
|
2231
2274
|
textValue: S.personalAccount,
|
|
2232
2275
|
onPress: () => de(null),
|
|
2233
|
-
children: /* @__PURE__ */ Y(
|
|
2276
|
+
children: /* @__PURE__ */ Y(r, { hideSubtitle: a })
|
|
2234
2277
|
}),
|
|
2235
2278
|
ne?.filter((e) => e.id !== T?.id)?.map((e) => /* @__PURE__ */ Y(M.Item, {
|
|
2236
2279
|
textValue: e.name,
|
|
@@ -2244,19 +2287,19 @@ function bn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hid
|
|
|
2244
2287
|
!t && /* @__PURE__ */ X(M.Item, {
|
|
2245
2288
|
textValue: S.createOrganization,
|
|
2246
2289
|
onPress: () => se(!0),
|
|
2247
|
-
children: [/* @__PURE__ */ Y(
|
|
2290
|
+
children: [/* @__PURE__ */ Y(ke, { className: "text-muted" }), /* @__PURE__ */ Y(L, { children: S.createOrganization })]
|
|
2248
2291
|
})
|
|
2249
2292
|
] })]
|
|
2250
2293
|
})]
|
|
2251
|
-
}), /* @__PURE__ */ Y(
|
|
2294
|
+
}), /* @__PURE__ */ Y(Wt, {
|
|
2252
2295
|
isOpen: oe,
|
|
2253
2296
|
onOpenChange: se
|
|
2254
2297
|
})] });
|
|
2255
2298
|
}
|
|
2256
2299
|
//#endregion
|
|
2257
2300
|
//#region src/components/auth/passkey/passkey-button.tsx
|
|
2258
|
-
function
|
|
2259
|
-
let { authClient: t, localization: n, redirectTo:
|
|
2301
|
+
function wn({ view: e }) {
|
|
2302
|
+
let { authClient: t, localization: n, redirectTo: r, navigate: a } = m(), { localization: o } = h(Tn), { mutate: s, isPending: c } = ye(t, { onSuccess: () => a({ to: r }) }), l = Z({ mutationKey: i.signIn.all }) + Z({ mutationKey: i.signUp.all }) > 0;
|
|
2260
2303
|
return e === "signUp" ? null : /* @__PURE__ */ X(k, {
|
|
2261
2304
|
className: "w-full",
|
|
2262
2305
|
variant: "tertiary",
|
|
@@ -2266,20 +2309,20 @@ function xn({ view: e }) {
|
|
|
2266
2309
|
children: [c ? /* @__PURE__ */ Y(V, {
|
|
2267
2310
|
color: "current",
|
|
2268
2311
|
size: "sm"
|
|
2269
|
-
}) : /* @__PURE__ */ Y(
|
|
2312
|
+
}) : /* @__PURE__ */ Y(Ie, {}), n.auth.continueWith.replace("{{provider}}", o.passkey)]
|
|
2270
2313
|
});
|
|
2271
2314
|
}
|
|
2272
2315
|
//#endregion
|
|
2273
2316
|
//#region src/lib/auth/passkey-plugin.ts
|
|
2274
|
-
var
|
|
2275
|
-
...
|
|
2276
|
-
authButtons: [
|
|
2277
|
-
securityCards: [
|
|
2317
|
+
var Tn = o(ht.id, (e = {}) => ({
|
|
2318
|
+
...ht(e),
|
|
2319
|
+
authButtons: [wn],
|
|
2320
|
+
securityCards: [jn]
|
|
2278
2321
|
}));
|
|
2279
2322
|
//#endregion
|
|
2280
2323
|
//#region src/components/auth/passkey/add-passkey-dialog.tsx
|
|
2281
|
-
function
|
|
2282
|
-
let { authClient: n, localization: r } =
|
|
2324
|
+
function En({ isOpen: e, onOpenChange: t }) {
|
|
2325
|
+
let { authClient: n, localization: r } = m(), { localization: i } = h(Tn), { mutate: a, isPending: o } = p(n), s = (e) => {
|
|
2283
2326
|
t(e);
|
|
2284
2327
|
};
|
|
2285
2328
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
@@ -2295,7 +2338,7 @@ function Cn({ isOpen: e, onOpenChange: t }) {
|
|
|
2295
2338
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
2296
2339
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
2297
2340
|
status: "default",
|
|
2298
|
-
children: /* @__PURE__ */ Y(
|
|
2341
|
+
children: /* @__PURE__ */ Y(Ie, {})
|
|
2299
2342
|
}), /* @__PURE__ */ Y(O.Heading, { children: i.addPasskey })] }),
|
|
2300
2343
|
/* @__PURE__ */ X(O.Body, {
|
|
2301
2344
|
className: "overflow-visible",
|
|
@@ -2337,8 +2380,8 @@ function Cn({ isOpen: e, onOpenChange: t }) {
|
|
|
2337
2380
|
}
|
|
2338
2381
|
//#endregion
|
|
2339
2382
|
//#region src/components/auth/passkey/delete-passkey-dialog.tsx
|
|
2340
|
-
function
|
|
2341
|
-
let { authClient: r, localization: i } =
|
|
2383
|
+
function Dn({ isOpen: e, onOpenChange: t, passkey: n }) {
|
|
2384
|
+
let { authClient: r, localization: i } = m(), { localization: a } = h(Tn), o = n.name || a.passkey, { mutate: s, isPending: c } = C(r, { onSuccess: () => t(!1) });
|
|
2342
2385
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
2343
2386
|
isOpen: e,
|
|
2344
2387
|
onOpenChange: t,
|
|
@@ -2346,7 +2389,7 @@ function wn({ isOpen: e, onOpenChange: t, passkey: n }) {
|
|
|
2346
2389
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
2347
2390
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
2348
2391
|
status: "danger",
|
|
2349
|
-
children: /* @__PURE__ */ Y(
|
|
2392
|
+
children: /* @__PURE__ */ Y(Ie, {})
|
|
2350
2393
|
}), /* @__PURE__ */ Y(O.Heading, { children: a.deletePasskeyTitle })] }),
|
|
2351
2394
|
/* @__PURE__ */ X(O.Body, {
|
|
2352
2395
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -2378,14 +2421,14 @@ function wn({ isOpen: e, onOpenChange: t, passkey: n }) {
|
|
|
2378
2421
|
}
|
|
2379
2422
|
//#endregion
|
|
2380
2423
|
//#region src/components/auth/passkey/passkey.tsx
|
|
2381
|
-
function
|
|
2382
|
-
let { localization: t } =
|
|
2424
|
+
function On({ passkey: e }) {
|
|
2425
|
+
let { localization: t } = m(), { localization: n } = h(Tn), [r, i] = q(!1), a = e.name || n.passkey;
|
|
2383
2426
|
return /* @__PURE__ */ X("div", {
|
|
2384
2427
|
className: "flex items-center gap-3",
|
|
2385
2428
|
children: [
|
|
2386
2429
|
/* @__PURE__ */ Y("div", {
|
|
2387
2430
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
2388
|
-
children: /* @__PURE__ */ Y(
|
|
2431
|
+
children: /* @__PURE__ */ Y(Ie, { className: "size-4.5" })
|
|
2389
2432
|
}),
|
|
2390
2433
|
/* @__PURE__ */ X("div", {
|
|
2391
2434
|
className: "flex min-w-0 flex-col",
|
|
@@ -2408,7 +2451,7 @@ function Tn({ passkey: e }) {
|
|
|
2408
2451
|
"aria-label": n.deletePasskey.replace("{{name}}", a),
|
|
2409
2452
|
children: [/* @__PURE__ */ Y(D, {}), t.settings.delete]
|
|
2410
2453
|
}),
|
|
2411
|
-
/* @__PURE__ */ Y(
|
|
2454
|
+
/* @__PURE__ */ Y(Dn, {
|
|
2412
2455
|
isOpen: r,
|
|
2413
2456
|
onOpenChange: i,
|
|
2414
2457
|
passkey: e
|
|
@@ -2418,7 +2461,7 @@ function Tn({ passkey: e }) {
|
|
|
2418
2461
|
}
|
|
2419
2462
|
//#endregion
|
|
2420
2463
|
//#region src/components/auth/passkey/passkey-skeleton.tsx
|
|
2421
|
-
function
|
|
2464
|
+
function kn() {
|
|
2422
2465
|
return /* @__PURE__ */ Y("div", {
|
|
2423
2466
|
className: "flex items-center justify-between",
|
|
2424
2467
|
children: /* @__PURE__ */ X("div", {
|
|
@@ -2432,14 +2475,14 @@ function En() {
|
|
|
2432
2475
|
}
|
|
2433
2476
|
//#endregion
|
|
2434
2477
|
//#region src/components/auth/passkey/passkeys-empty.tsx
|
|
2435
|
-
function
|
|
2436
|
-
let { localization: t } =
|
|
2478
|
+
function An({ onAddPress: e }) {
|
|
2479
|
+
let { localization: t } = h(Tn);
|
|
2437
2480
|
return /* @__PURE__ */ X("div", {
|
|
2438
2481
|
className: "flex flex-col items-center justify-center gap-4",
|
|
2439
2482
|
children: [
|
|
2440
2483
|
/* @__PURE__ */ Y("div", {
|
|
2441
2484
|
className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
|
|
2442
|
-
children: /* @__PURE__ */ Y(
|
|
2485
|
+
children: /* @__PURE__ */ Y(Ie, { className: "size-4.5" })
|
|
2443
2486
|
}),
|
|
2444
2487
|
/* @__PURE__ */ X("div", {
|
|
2445
2488
|
className: "flex flex-col items-center justify-center gap-1 text-center",
|
|
@@ -2461,8 +2504,8 @@ function Dn({ onAddPress: e }) {
|
|
|
2461
2504
|
}
|
|
2462
2505
|
//#endregion
|
|
2463
2506
|
//#region src/components/auth/passkey/passkeys.tsx
|
|
2464
|
-
function
|
|
2465
|
-
let { authClient: r } =
|
|
2507
|
+
function jn({ className: e, variant: t, ...n }) {
|
|
2508
|
+
let { authClient: r } = m(), { localization: i } = h(Tn), { data: a, isPending: o } = ue(r), [s, c] = q(!1);
|
|
2466
2509
|
return /* @__PURE__ */ X("div", {
|
|
2467
2510
|
className: G("flex flex-col gap-3", e),
|
|
2468
2511
|
children: [
|
|
@@ -2482,9 +2525,9 @@ function On({ className: e, variant: t, ...n }) {
|
|
|
2482
2525
|
/* @__PURE__ */ Y(A, {
|
|
2483
2526
|
variant: t,
|
|
2484
2527
|
...n,
|
|
2485
|
-
children: /* @__PURE__ */ Y(A.Content, { children: o ? /* @__PURE__ */ Y(
|
|
2528
|
+
children: /* @__PURE__ */ Y(A.Content, { children: o ? /* @__PURE__ */ Y(kn, {}) : a?.length ? a.map((e, t) => /* @__PURE__ */ X("div", { children: [t > 0 && /* @__PURE__ */ Y("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Y(On, { passkey: e })] }, e.id)) : /* @__PURE__ */ Y(An, { onAddPress: () => c(!0) }) })
|
|
2486
2529
|
}),
|
|
2487
|
-
/* @__PURE__ */ Y(
|
|
2530
|
+
/* @__PURE__ */ Y(En, {
|
|
2488
2531
|
isOpen: s,
|
|
2489
2532
|
onOpenChange: c
|
|
2490
2533
|
})
|
|
@@ -2493,17 +2536,17 @@ function On({ className: e, variant: t, ...n }) {
|
|
|
2493
2536
|
}
|
|
2494
2537
|
//#endregion
|
|
2495
2538
|
//#region src/components/auth/theme/theme-toggle-item.tsx
|
|
2496
|
-
var
|
|
2497
|
-
function
|
|
2498
|
-
let { useTheme: e, localization: t } =
|
|
2539
|
+
var Mn = "[role=\"tab\"][aria-selected=\"true\"]";
|
|
2540
|
+
function Nn() {
|
|
2541
|
+
let { useTheme: e, localization: t } = h(Pn), { theme: n, setTheme: r, themes: i = [] } = e();
|
|
2499
2542
|
return /* @__PURE__ */ X(M.Item, {
|
|
2500
2543
|
className: "py-1 pe-2",
|
|
2501
2544
|
onFocus: (e) => {
|
|
2502
|
-
e.target === e.currentTarget && e.currentTarget.querySelector(
|
|
2545
|
+
e.target === e.currentTarget && e.currentTarget.querySelector(Mn)?.focus({ preventScroll: !0 });
|
|
2503
2546
|
},
|
|
2504
2547
|
shouldCloseOnSelect: !1,
|
|
2505
2548
|
children: [
|
|
2506
|
-
/* @__PURE__ */ Y(
|
|
2549
|
+
/* @__PURE__ */ Y(He, { className: "text-muted" }),
|
|
2507
2550
|
/* @__PURE__ */ Y(L, { children: t.theme }),
|
|
2508
2551
|
/* @__PURE__ */ Y(U, {
|
|
2509
2552
|
className: "ml-auto",
|
|
@@ -2528,17 +2571,17 @@ function An() {
|
|
|
2528
2571
|
i.includes("system") && /* @__PURE__ */ X(U.Tab, {
|
|
2529
2572
|
id: "system",
|
|
2530
2573
|
"aria-label": t.system,
|
|
2531
|
-
children: [/* @__PURE__ */ Y(
|
|
2574
|
+
children: [/* @__PURE__ */ Y(Ne, { className: "size-3" }), /* @__PURE__ */ Y(U.Indicator, {})]
|
|
2532
2575
|
}),
|
|
2533
2576
|
i.includes("light") && /* @__PURE__ */ X(U.Tab, {
|
|
2534
2577
|
id: "light",
|
|
2535
2578
|
"aria-label": t.light,
|
|
2536
|
-
children: [/* @__PURE__ */ Y(
|
|
2579
|
+
children: [/* @__PURE__ */ Y(qe, { className: "size-3" }), /* @__PURE__ */ Y(U.Indicator, {})]
|
|
2537
2580
|
}),
|
|
2538
2581
|
i.includes("dark") && /* @__PURE__ */ X(U.Tab, {
|
|
2539
2582
|
id: "dark",
|
|
2540
2583
|
"aria-label": t.dark,
|
|
2541
|
-
children: [/* @__PURE__ */ Y(
|
|
2584
|
+
children: [/* @__PURE__ */ Y(Ve, { className: "size-3" }), /* @__PURE__ */ Y(U.Indicator, {})]
|
|
2542
2585
|
})
|
|
2543
2586
|
]
|
|
2544
2587
|
})
|
|
@@ -2549,8 +2592,8 @@ function An() {
|
|
|
2549
2592
|
}
|
|
2550
2593
|
//#endregion
|
|
2551
2594
|
//#region src/lib/auth/theme-plugin.ts
|
|
2552
|
-
var
|
|
2553
|
-
let n =
|
|
2595
|
+
var Pn = o(gt.id, ({ useTheme: e, ...t }) => {
|
|
2596
|
+
let n = gt({
|
|
2554
2597
|
setTheme: () => {},
|
|
2555
2598
|
...t
|
|
2556
2599
|
});
|
|
@@ -2561,14 +2604,14 @@ var jn = a(ht.id, ({ useTheme: e, ...t }) => {
|
|
|
2561
2604
|
setTheme: n.setTheme,
|
|
2562
2605
|
themes: n.themes
|
|
2563
2606
|
})),
|
|
2564
|
-
userMenuItems: [
|
|
2565
|
-
accountCards: [
|
|
2607
|
+
userMenuItems: [Nn],
|
|
2608
|
+
accountCards: [Fn]
|
|
2566
2609
|
};
|
|
2567
2610
|
});
|
|
2568
2611
|
//#endregion
|
|
2569
2612
|
//#region src/components/auth/theme/appearance.tsx
|
|
2570
|
-
function
|
|
2571
|
-
let { useTheme: r, localization: i } =
|
|
2613
|
+
function Fn({ className: e, variant: t, ...n }) {
|
|
2614
|
+
let { useTheme: r, localization: i } = h(Pn), { theme: a, setTheme: o, themes: s = [] } = r(), d = it();
|
|
2572
2615
|
return /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("h2", {
|
|
2573
2616
|
className: G("text-sm font-semibold mb-3"),
|
|
2574
2617
|
children: i.appearance
|
|
@@ -2576,7 +2619,7 @@ function Mn({ className: e, variant: t, ...n }) {
|
|
|
2576
2619
|
className: G("p-4 gap-4", e),
|
|
2577
2620
|
variant: t,
|
|
2578
2621
|
...n,
|
|
2579
|
-
children: /* @__PURE__ */ X(A.Content, { children: [/* @__PURE__ */ Y(L, { children: i.theme }), /* @__PURE__ */ Y(
|
|
2622
|
+
children: /* @__PURE__ */ X(A.Content, { children: [/* @__PURE__ */ Y(L, { children: i.theme }), /* @__PURE__ */ Y(nt, {
|
|
2580
2623
|
variant: t === "transparent" ? "secondary" : "primary",
|
|
2581
2624
|
value: d ? a : "",
|
|
2582
2625
|
onChange: o,
|
|
@@ -2584,7 +2627,7 @@ function Mn({ className: e, variant: t, ...n }) {
|
|
|
2584
2627
|
children: /* @__PURE__ */ X("div", {
|
|
2585
2628
|
className: "grid gap-3 grid-cols-2 sm:grid-cols-3",
|
|
2586
2629
|
children: [
|
|
2587
|
-
|
|
2630
|
+
s.includes("system") && /* @__PURE__ */ Y(R, {
|
|
2588
2631
|
value: "system",
|
|
2589
2632
|
className: G("mt-0 px-4 pb-4 pt-3 rounded-xl", "border border-transparent data-[selected=true]:border-accent data-[selected=true]:bg-accent/10", "data-[focus-visible=true]:border-accent data-[focus-visible=true]:bg-accent/10", t === "transparent" ? "bg-surface" : "bg-surface-secondary"),
|
|
2590
2633
|
children: /* @__PURE__ */ X(R.Content, {
|
|
@@ -2593,12 +2636,12 @@ function Mn({ className: e, variant: t, ...n }) {
|
|
|
2593
2636
|
className: "flex gap-2 justify-between",
|
|
2594
2637
|
children: [/* @__PURE__ */ X("span", {
|
|
2595
2638
|
className: "flex gap-2 items-center",
|
|
2596
|
-
children: [/* @__PURE__ */ Y(
|
|
2639
|
+
children: [/* @__PURE__ */ Y(Ne, { className: "text-muted" }), i.system]
|
|
2597
2640
|
}), /* @__PURE__ */ Y(R.Control, { children: /* @__PURE__ */ Y(R.Indicator, {}) })]
|
|
2598
|
-
}), /* @__PURE__ */ Y(
|
|
2641
|
+
}), /* @__PURE__ */ Y(u, { className: "w-full" })]
|
|
2599
2642
|
})
|
|
2600
2643
|
}),
|
|
2601
|
-
|
|
2644
|
+
s.includes("light") && /* @__PURE__ */ Y(R, {
|
|
2602
2645
|
value: "light",
|
|
2603
2646
|
className: G("mt-0 px-4 pb-4 pt-3 rounded-xl", "border border-transparent data-[selected=true]:border-accent data-[selected=true]:bg-accent/10", "data-[focus-visible=true]:border-accent data-[focus-visible=true]:bg-accent/10", t === "transparent" ? "bg-surface" : "bg-surface-secondary"),
|
|
2604
2647
|
children: /* @__PURE__ */ X(R.Content, {
|
|
@@ -2607,12 +2650,12 @@ function Mn({ className: e, variant: t, ...n }) {
|
|
|
2607
2650
|
className: "flex gap-2 justify-between",
|
|
2608
2651
|
children: [/* @__PURE__ */ X("span", {
|
|
2609
2652
|
className: "flex gap-2 items-center",
|
|
2610
|
-
children: [/* @__PURE__ */ Y(
|
|
2653
|
+
children: [/* @__PURE__ */ Y(qe, { className: "text-muted" }), i.light]
|
|
2611
2654
|
}), /* @__PURE__ */ Y(R.Control, { children: /* @__PURE__ */ Y(R.Indicator, {}) })]
|
|
2612
|
-
}), /* @__PURE__ */ Y(
|
|
2655
|
+
}), /* @__PURE__ */ Y(l, { className: "w-full" })]
|
|
2613
2656
|
})
|
|
2614
2657
|
}),
|
|
2615
|
-
|
|
2658
|
+
s.includes("dark") && /* @__PURE__ */ Y(R, {
|
|
2616
2659
|
value: "dark",
|
|
2617
2660
|
className: G("mt-0 px-4 pb-4 pt-3 rounded-xl", "border border-transparent data-[selected=true]:border-accent data-[selected=true]:bg-accent/10", "data-[focus-visible=true]:border-accent data-[focus-visible=true]:bg-accent/10", t === "transparent" ? "bg-surface" : "bg-surface-secondary"),
|
|
2618
2661
|
children: /* @__PURE__ */ X(R.Content, {
|
|
@@ -2621,9 +2664,9 @@ function Mn({ className: e, variant: t, ...n }) {
|
|
|
2621
2664
|
className: "flex gap-2 justify-between",
|
|
2622
2665
|
children: [/* @__PURE__ */ X("span", {
|
|
2623
2666
|
className: "flex gap-2 items-center",
|
|
2624
|
-
children: [/* @__PURE__ */ Y(
|
|
2667
|
+
children: [/* @__PURE__ */ Y(Ve, { className: "text-muted" }), i.dark]
|
|
2625
2668
|
}), /* @__PURE__ */ Y(R.Control, { children: /* @__PURE__ */ Y(R.Indicator, {}) })]
|
|
2626
|
-
}), /* @__PURE__ */ Y(
|
|
2669
|
+
}), /* @__PURE__ */ Y(c, { className: "w-full" })]
|
|
2627
2670
|
})
|
|
2628
2671
|
})
|
|
2629
2672
|
]
|
|
@@ -2633,19 +2676,19 @@ function Mn({ className: e, variant: t, ...n }) {
|
|
|
2633
2676
|
}
|
|
2634
2677
|
//#endregion
|
|
2635
2678
|
//#region src/components/auth/username/username-field.tsx
|
|
2636
|
-
function
|
|
2637
|
-
let { authClient: i } =
|
|
2679
|
+
function In({ name: e, field: t, isPending: n, variant: r }) {
|
|
2680
|
+
let { authClient: i } = m(), { localization: a, minUsernameLength: o, maxUsernameLength: s, isUsernameAvailable: c, usernamePrefix: l } = h(Ln), u = String(t.defaultValue ?? ""), [d, f] = q(u), { mutate: p, data: g, error: _, reset: v } = ne(i, { onError: () => {} }), y = vt((e) => {
|
|
2638
2681
|
let t = e.trim();
|
|
2639
2682
|
if (!t || t === u) {
|
|
2640
2683
|
v();
|
|
2641
2684
|
return;
|
|
2642
2685
|
}
|
|
2643
|
-
|
|
2686
|
+
p({ username: t });
|
|
2644
2687
|
}, { wait: 500 });
|
|
2645
2688
|
function b(e) {
|
|
2646
2689
|
f(e), v(), c && y.maybeExecute(e);
|
|
2647
2690
|
}
|
|
2648
|
-
let x = !!c && !!d.trim() && d.trim() !== u, { localization: S } =
|
|
2691
|
+
let x = !!c && !!d.trim() && d.trim() !== u, { localization: S } = m();
|
|
2649
2692
|
return /* @__PURE__ */ X(W, {
|
|
2650
2693
|
name: e,
|
|
2651
2694
|
type: "text",
|
|
@@ -2677,7 +2720,7 @@ function Nn({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
2677
2720
|
x && /* @__PURE__ */ Y(I.Suffix, {
|
|
2678
2721
|
"aria-label": g?.available ? a.usernameAvailable : g?.available === !1 ? a.usernameTaken : void 0,
|
|
2679
2722
|
className: "px-2",
|
|
2680
|
-
children: g?.available ? /* @__PURE__ */ Y(
|
|
2723
|
+
children: g?.available ? /* @__PURE__ */ Y(De, { className: "text-success" }) : _ || g?.available === !1 ? /* @__PURE__ */ Y(D, { className: "text-danger" }) : /* @__PURE__ */ Y(V, {
|
|
2681
2724
|
size: "sm",
|
|
2682
2725
|
color: "current"
|
|
2683
2726
|
})
|
|
@@ -2690,32 +2733,32 @@ function Nn({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
2690
2733
|
}
|
|
2691
2734
|
//#endregion
|
|
2692
2735
|
//#region src/lib/auth/username-plugin.tsx
|
|
2693
|
-
var
|
|
2694
|
-
let t =
|
|
2736
|
+
var Ln = o(_t.id, (e = {}) => {
|
|
2737
|
+
let t = _t(e);
|
|
2695
2738
|
return {
|
|
2696
2739
|
...t,
|
|
2697
2740
|
additionalFields: t.additionalFields?.map((e) => e.name === "username" ? {
|
|
2698
2741
|
...e,
|
|
2699
|
-
render:
|
|
2742
|
+
render: In
|
|
2700
2743
|
} : e),
|
|
2701
|
-
views: { auth: { signIn:
|
|
2744
|
+
views: { auth: { signIn: Rn } }
|
|
2702
2745
|
};
|
|
2703
2746
|
});
|
|
2704
2747
|
//#endregion
|
|
2705
2748
|
//#region src/components/auth/username/sign-in-username.tsx
|
|
2706
|
-
function
|
|
2707
|
-
let { authClient: s, basePaths: c, emailAndPassword: l, localization: u, plugins: d, redirectTo: f, socialProviders:
|
|
2749
|
+
function Rn({ className: t, socialLayout: r, socialPosition: a = "bottom", variant: o }) {
|
|
2750
|
+
let { authClient: s, basePaths: c, emailAndPassword: l, localization: u, plugins: d, redirectTo: f, socialProviders: p, viewPaths: g, navigate: _ } = m(), { fetchOptions: v, resetFetchOptions: y } = w(), { localization: b } = h(Ln), [x, S] = q("");
|
|
2708
2751
|
function C(e) {
|
|
2709
2752
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
2710
2753
|
}
|
|
2711
|
-
let { mutate:
|
|
2754
|
+
let { mutate: ee, isPending: T } = _e(s, {
|
|
2712
2755
|
onError: (e, { email: t }) => {
|
|
2713
2756
|
S(""), e.error?.code === "EMAIL_NOT_VERIFIED" && (sessionStorage.setItem("better-auth-ui.verify-email", t), _({ to: `${c.auth}/${g.auth.verifyEmail}` })), y();
|
|
2714
2757
|
},
|
|
2715
2758
|
onSuccess: () => {
|
|
2716
2759
|
sessionStorage.removeItem("better-auth-ui.verify-email"), _({ to: f });
|
|
2717
2760
|
}
|
|
2718
|
-
}), { mutate: te, isPending: ne } =
|
|
2761
|
+
}), { mutate: te, isPending: ne } = be(s, {
|
|
2719
2762
|
onError: (e) => {
|
|
2720
2763
|
S(""), e.error?.code === "EMAIL_NOT_VERIFIED" && (sessionStorage.removeItem("better-auth-ui.verify-email"), _({ to: `${c.auth}/${g.auth.verifyEmail}` })), y();
|
|
2721
2764
|
},
|
|
@@ -2725,7 +2768,7 @@ function Fn({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2725
2768
|
}), re = (e) => {
|
|
2726
2769
|
e.preventDefault();
|
|
2727
2770
|
let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
|
|
2728
|
-
C(n) ?
|
|
2771
|
+
C(n) ? ee({
|
|
2729
2772
|
email: n,
|
|
2730
2773
|
password: x,
|
|
2731
2774
|
...l?.rememberMe ? { rememberMe: r } : {},
|
|
@@ -2736,9 +2779,9 @@ function Fn({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2736
2779
|
...l?.rememberMe ? { rememberMe: r } : {},
|
|
2737
2780
|
fetchOptions: v
|
|
2738
2781
|
});
|
|
2739
|
-
}, ie = Z({ mutationKey:
|
|
2782
|
+
}, ie = Z({ mutationKey: i.signIn.all }) + Z({ mutationKey: i.signUp.all }) > 0, ae = T || ne, oe = d.find((e) => e.captchaComponent)?.captchaComponent, se = l?.enabled && !!p?.length;
|
|
2740
2783
|
return /* @__PURE__ */ X(A, {
|
|
2741
|
-
className: G("w-full max-w-sm gap-4 md:p-6",
|
|
2784
|
+
className: G("w-full max-w-sm gap-4 md:p-6", t),
|
|
2742
2785
|
variant: o,
|
|
2743
2786
|
children: [
|
|
2744
2787
|
/* @__PURE__ */ Y(A.Header, { children: /* @__PURE__ */ Y(A.Title, {
|
|
@@ -2748,7 +2791,7 @@ function Fn({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2748
2791
|
/* @__PURE__ */ X(A.Content, {
|
|
2749
2792
|
className: "gap-4",
|
|
2750
2793
|
children: [
|
|
2751
|
-
a === "top" && /* @__PURE__ */ X(J, { children: [!!
|
|
2794
|
+
a === "top" && /* @__PURE__ */ X(J, { children: [!!p?.length && /* @__PURE__ */ Y(n, { socialLayout: r }), se && /* @__PURE__ */ Y(e, { children: u.auth.or })] }),
|
|
2752
2795
|
l?.enabled && /* @__PURE__ */ X(P, {
|
|
2753
2796
|
onSubmit: re,
|
|
2754
2797
|
className: "flex flex-col gap-4",
|
|
@@ -2796,11 +2839,11 @@ function Fn({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2796
2839
|
/* @__PURE__ */ Y(N, {})
|
|
2797
2840
|
]
|
|
2798
2841
|
}),
|
|
2799
|
-
l?.rememberMe && /* @__PURE__ */ Y(
|
|
2842
|
+
l?.rememberMe && /* @__PURE__ */ Y(Ze, {
|
|
2800
2843
|
name: "rememberMe",
|
|
2801
2844
|
isDisabled: ie,
|
|
2802
2845
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
2803
|
-
children: /* @__PURE__ */ X(
|
|
2846
|
+
children: /* @__PURE__ */ X(Ze.Content, { children: [/* @__PURE__ */ Y(Ze.Control, { children: /* @__PURE__ */ Y(Ze.Indicator, {}) }), u.auth.rememberMe] })
|
|
2804
2847
|
}),
|
|
2805
2848
|
oe && /* @__PURE__ */ Y("div", {
|
|
2806
2849
|
className: "flex justify-center",
|
|
@@ -2820,21 +2863,21 @@ function Fn({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2820
2863
|
})
|
|
2821
2864
|
]
|
|
2822
2865
|
}),
|
|
2823
|
-
a === "bottom" && /* @__PURE__ */ X(J, { children: [se && /* @__PURE__ */ Y(e, { children: u.auth.or }), !!
|
|
2866
|
+
a === "bottom" && /* @__PURE__ */ X(J, { children: [se && /* @__PURE__ */ Y(e, { children: u.auth.or }), !!p?.length && /* @__PURE__ */ Y(n, { socialLayout: r })] })
|
|
2824
2867
|
]
|
|
2825
2868
|
}),
|
|
2826
2869
|
/* @__PURE__ */ X(A.Footer, {
|
|
2827
2870
|
className: "flex-col gap-3",
|
|
2828
|
-
children: [l?.enabled && l?.forgotPassword && /* @__PURE__ */ Y(
|
|
2871
|
+
children: [l?.enabled && l?.forgotPassword && /* @__PURE__ */ Y(et, {
|
|
2829
2872
|
href: `${c.auth}/${g.auth.forgotPassword}`,
|
|
2830
2873
|
className: "text-sm no-underline hover:underline",
|
|
2831
2874
|
children: u.auth.forgotPasswordLink
|
|
2832
|
-
}), l?.enabled && /* @__PURE__ */ X(
|
|
2875
|
+
}), l?.enabled && /* @__PURE__ */ X(Qe, {
|
|
2833
2876
|
className: "text-sm",
|
|
2834
2877
|
children: [
|
|
2835
2878
|
u.auth.needToCreateAnAccount,
|
|
2836
2879
|
" ",
|
|
2837
|
-
/* @__PURE__ */ Y(
|
|
2880
|
+
/* @__PURE__ */ Y(et, {
|
|
2838
2881
|
href: `${c.auth}/${g.auth.signUp}`,
|
|
2839
2882
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
2840
2883
|
children: u.auth.signUp
|
|
@@ -2846,4 +2889,4 @@ function Fn({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2846
2889
|
});
|
|
2847
2890
|
}
|
|
2848
2891
|
//#endregion
|
|
2849
|
-
export {
|
|
2892
|
+
export { Dt as ApiKeys, Fn as Appearance, tn as ChangeOrganizationLogo, Wt as CreateOrganizationDialog, At as DangerZone, kt as DeleteAccount, an as DeleteOrganization, rn as DeleteOrganizationSkeleton, sn as InviteMemberDialog, ln as LeaveOrganization, Mt as MAGIC_LINK_SENT_STORAGE_KEY, Ft as MagicLink, Nt as MagicLinkSent, Vt as ManageAccount, It as ManageAccounts, Sn as Organization, yt as OrganizationApiKeys, yn as OrganizationDangerZone, pn as OrganizationInvitations, fn as OrganizationInvitationsEmpty, Gt as OrganizationLogo, _n as OrganizationMembers, vn as OrganizationPeople, bn as OrganizationProfile, qt as OrganizationRow, xn as OrganizationSettings, Cn as OrganizationSwitcher, Q as OrganizationView, Kt as OrganizationViewSkeleton, Yt as Organizations, en as OrganizationsSettings, jn as Passkeys, Rn as SignInUsername, zt as SwitchAccountSubmenu, Rt as SwitchAccountSubmenuContent, Lt as SwitchAccountSubmenuItem, Nn as ThemeToggleItem, $t as UserInvitations, In as UsernameField, bt as apiKeyPlugin, Ot as deleteUserPlugin, Pt as magicLinkPlugin, Bt as multiSessionPlugin, $ as organizationPlugin, Tn as passkeyPlugin, Pn as themePlugin, Ln as usernamePlugin };
|