@better-auth-ui/heroui 1.6.23 → 1.6.25
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/open-email-button.d.ts +18 -0
- package/dist/components/auth/verify-email.d.ts +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +530 -447
- package/dist/plugins.js +340 -346
- package/package.json +5 -5
- package/src/components/auth/auth.tsx +3 -1
- package/src/components/auth/open-email-button.tsx +50 -0
- package/src/components/auth/sign-in.tsx +5 -25
- package/src/components/auth/sign-up.tsx +5 -3
- package/src/components/auth/username/sign-in-username.tsx +4 -20
- package/src/components/auth/verify-email.tsx +144 -0
- package/src/index.tsx +2 -0
package/dist/plugins.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as e, r as t, t as n } from "./user-view--47tVtJ3.js";
|
|
3
3
|
import { authMutationKeys as r, authQueryKeys as i, createAuthPlugin as a, fileToBase64 as o } from "@better-auth-ui/core";
|
|
4
|
-
import { ThemePreviewDark as s, ThemePreviewLight as c, ThemePreviewSystem as l, useAcceptInvitation as u, useActiveOrganization as d, useAddPasskey as f, useAuth as p, useAuthPlugin as m, useAuthenticate as h, useCancelInvitation as g, useCheckSlug as _, useCreateApiKey as v, useCreateOrganization as y, useDeleteApiKey as b, useDeleteOrganization as x, useDeletePasskey as S, useDeleteUser as C, useFetchOptions as
|
|
5
|
-
import { ArrowRightArrowLeft as
|
|
6
|
-
import { AlertDialog as O, Avatar as
|
|
7
|
-
import { useEffect as
|
|
4
|
+
import { ThemePreviewDark as s, ThemePreviewLight as c, ThemePreviewSystem as l, useAcceptInvitation as u, useActiveOrganization as d, useAddPasskey as f, useAuth as p, useAuthPlugin as m, useAuthenticate as h, useCancelInvitation as g, useCheckSlug as _, useCreateApiKey as v, useCreateOrganization as y, useDeleteApiKey as b, useDeleteOrganization as x, useDeletePasskey as S, useDeleteUser as C, useFetchOptions as ee, useHasPermission as w, useInviteMember as te, useIsUsernameAvailable as ne, useLeaveOrganization as re, useListAccounts as ie, useListApiKeys as T, useListDeviceSessions as ae, useListOrganizationInvitations as oe, useListOrganizationMembers as se, useListOrganizations as ce, useListPasskeys as le, useListUserInvitations as ue, useRejectInvitation as de, useRemoveMember as fe, useRevokeMultiSession as pe, useSession as E, useSetActiveOrganization as me, useSetActiveSession as he, useSignInEmail as ge, useSignInMagicLink as _e, useSignInPasskey as ve, useSignInUsername as ye, useUpdateMemberRole as be, useUpdateOrganization as xe, useUser as Se } from "@better-auth-ui/react";
|
|
5
|
+
import { ArrowRightArrowLeft as Ce, ArrowRightFromSquare as we, Briefcase as Te, Check as Ee, ChevronsExpandVertical as De, CirclePlus as Oe, Clock as ke, CloudArrowUpIn as Ae, Copy as je, Display as Me, Ellipsis as Ne, Envelope as Pe, Fingerprint as Fe, Funnel as Ie, Gear as Le, Key as Re, Lock as ze, Moon as Be, Palette as Ve, PaperPlane as He, Pencil as Ue, Person as We, PersonPlus as Ge, Sun as Ke, TrashBin as qe, TriangleExclamation as Je, Xmark as D } from "@gravity-ui/icons";
|
|
6
|
+
import { AlertDialog as O, Avatar as Ye, Button as k, Card as A, Checkbox as Xe, Chip as j, Description as Ze, Dropdown as M, EmptyState as Qe, FieldError as N, Form as P, Input as F, InputGroup as I, Label as L, Link as $e, ListBox as et, Radio as R, RadioGroup as tt, SearchField as z, Select as nt, Skeleton as B, Spinner as V, Table as H, Tabs as U, TextField as W, cn as G, toast as K, useIsHydrated as rt } from "@heroui/react";
|
|
7
|
+
import { useEffect as it, useMemo as at, useRef as ot, 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
|
|
9
|
+
import { useIsMutating as Z, useQueryClient as st } from "@tanstack/react-query";
|
|
10
|
+
import { buttonVariants as ct } from "@heroui/styles";
|
|
10
11
|
import { apiKeyPlugin as lt, deleteUserPlugin as ut, magicLinkPlugin as dt, multiSessionPlugin as ft, organizationPlugin as pt, passkeyPlugin as mt, themePlugin as ht, usernamePlugin as gt } from "@better-auth-ui/core/plugins";
|
|
11
|
-
import {
|
|
12
|
-
import { useDebouncer as vt } from "@tanstack/react-pacer";
|
|
12
|
+
import { useDebouncer as _t } from "@tanstack/react-pacer";
|
|
13
13
|
//#region src/components/auth/api-key/organization-api-keys.tsx
|
|
14
|
-
function
|
|
14
|
+
function vt({ className: e, variant: t }) {
|
|
15
15
|
let { authClient: n } = p(), { data: r } = E(n), { data: i, isPending: a } = d(n), { data: o } = se(n);
|
|
16
|
-
return o?.members.some((e) => e.role === "owner" && e.userId === r?.user.id) ? /* @__PURE__ */ Y(
|
|
16
|
+
return o?.members.some((e) => e.role === "owner" && e.userId === r?.user.id) ? /* @__PURE__ */ Y(Et, {
|
|
17
17
|
className: e,
|
|
18
18
|
variant: t,
|
|
19
19
|
organizationId: i?.id,
|
|
@@ -22,18 +22,18 @@ function yt({ className: e, variant: t }) {
|
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/lib/auth/api-key-plugin.ts
|
|
25
|
-
var
|
|
25
|
+
var yt = a(lt.id, (e = {}) => {
|
|
26
26
|
let t = lt(e);
|
|
27
27
|
return {
|
|
28
28
|
...t,
|
|
29
|
-
securityCards: [
|
|
30
|
-
...t.organization ? { organizationCards: [
|
|
29
|
+
securityCards: [Et],
|
|
30
|
+
...t.organization ? { organizationCards: [vt] } : {}
|
|
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 } = p(), { localization: o } = m(
|
|
35
|
+
function bt({ isOpen: e, onOpenChange: t, apiKey: n, organizationId: r }) {
|
|
36
|
+
let { authClient: i, localization: a } = p(), { localization: o } = m(yt), s = `${n.start}${"*".repeat(16)}`, { mutate: c, isPending: l } = b(i, { onSuccess: () => t(!1) });
|
|
37
37
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
38
38
|
isOpen: e,
|
|
39
39
|
onOpenChange: t,
|
|
@@ -41,7 +41,7 @@ function xt({ 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(Re, {})
|
|
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 xt({ 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 } = p(), { localization: i } = m(
|
|
83
|
+
function xt({ apiKey: e, hideDelete: t, organizationId: n }) {
|
|
84
|
+
let { localization: r } = p(), { localization: i } = m(yt), [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(Re, { 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 St({ 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(bt, {
|
|
120
120
|
isOpen: a,
|
|
121
121
|
onOpenChange: o,
|
|
122
122
|
apiKey: e,
|
|
@@ -127,7 +127,7 @@ function St({ 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 St() {
|
|
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 Ct() {
|
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/components/auth/api-key/api-keys-empty.tsx
|
|
148
|
-
function
|
|
149
|
-
let { localization: n } = m(
|
|
148
|
+
function Ct({ onCreatePress: e, hideCreate: t }) {
|
|
149
|
+
let { localization: n } = m(yt);
|
|
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(Re, { 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 wt({ 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 } = p(), { localization: a } = m(
|
|
177
|
+
function wt({ isOpen: e, onOpenChange: t, name: n, secretKey: r }) {
|
|
178
|
+
let { localization: i } = p(), { localization: a } = m(yt), [o, s] = q(!1);
|
|
179
179
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
180
180
|
isOpen: e,
|
|
181
181
|
onOpenChange: t,
|
|
@@ -183,7 +183,7 @@ function Tt({ 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(Re, {})
|
|
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 Tt({ 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 ? Ee : je, {})
|
|
216
216
|
})
|
|
217
217
|
})]
|
|
218
218
|
})]
|
|
@@ -227,8 +227,8 @@ function Tt({ 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 } = p(), { localization: a } = m(
|
|
230
|
+
function Tt({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
231
|
+
let { authClient: r, localization: i } = p(), { localization: a } = m(yt), { mutate: o, isPending: s } = v(r), [c, l] = q(!1), [u, d] = q(null), [f, h] = q(null), g = (e) => {
|
|
232
232
|
e || (d(null), h(null)), t(e);
|
|
233
233
|
};
|
|
234
234
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(O.Backdrop, {
|
|
@@ -252,7 +252,7 @@ function Et({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
|
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(Re, {})
|
|
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 Et({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
|
290
290
|
})] })
|
|
291
291
|
]
|
|
292
292
|
}) }) })
|
|
293
|
-
}), /* @__PURE__ */ Y(
|
|
293
|
+
}), /* @__PURE__ */ Y(wt, {
|
|
294
294
|
isOpen: c,
|
|
295
295
|
onOpenChange: l,
|
|
296
296
|
secretKey: f,
|
|
@@ -299,8 +299,8 @@ function Et({ 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 } = p(), { localization: s } = m(
|
|
302
|
+
function Et({ className: e, variant: t, organizationId: n, isPending: r, hideCreate: i, hideDelete: a }) {
|
|
303
|
+
let { authClient: o } = p(), { localization: s } = m(yt), { data: c, isPending: l } = T(o, {
|
|
304
304
|
enabled: !r,
|
|
305
305
|
...n ? { query: {
|
|
306
306
|
organizationId: n,
|
|
@@ -325,16 +325,16 @@ function Dt({ 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(St, {}) : 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(xt, {
|
|
329
329
|
apiKey: e,
|
|
330
330
|
hideDelete: a,
|
|
331
331
|
organizationId: n
|
|
332
|
-
})] }, e.id)) : /* @__PURE__ */ Y(
|
|
332
|
+
})] }, e.id)) : /* @__PURE__ */ Y(Ct, {
|
|
333
333
|
onCreatePress: () => f(!0),
|
|
334
334
|
hideCreate: i
|
|
335
335
|
}) })
|
|
336
336
|
}),
|
|
337
|
-
!i && /* @__PURE__ */ Y(
|
|
337
|
+
!i && /* @__PURE__ */ Y(Tt, {
|
|
338
338
|
isOpen: d,
|
|
339
339
|
onOpenChange: f,
|
|
340
340
|
organizationId: n
|
|
@@ -344,16 +344,16 @@ function Dt({ 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
|
|
347
|
+
var Dt = a(ut.id, (e = {}) => ({
|
|
348
348
|
...ut(e),
|
|
349
|
-
securityCards: [
|
|
349
|
+
securityCards: [kt]
|
|
350
350
|
}));
|
|
351
351
|
//#endregion
|
|
352
352
|
//#region src/components/auth/delete-user/delete-account.tsx
|
|
353
|
-
function
|
|
354
|
-
let { authClient: r, basePaths: a, localization: o, navigate: s, viewPaths: c } = p(), { localization: l, sendDeleteAccountVerification: u } = m(
|
|
353
|
+
function Ot({ className: e, variant: t, ...n }) {
|
|
354
|
+
let { authClient: r, basePaths: a, localization: o, navigate: s, viewPaths: c } = p(), { localization: l, sendDeleteAccountVerification: u } = m(Dt), { data: d } = ie(r), f = st(), [h, g] = q(!1), [_, v] = q(""), y = d?.some((e) => e.providerId === "credential"), b = !u && y, { mutate: x, isPending: S } = C(r), ee = (e) => {
|
|
355
355
|
g(e), v("");
|
|
356
|
-
},
|
|
356
|
+
}, w = async (e) => {
|
|
357
357
|
e.preventDefault(), x({ ...b ? { password: _ } : {} }, { onSuccess: () => {
|
|
358
358
|
g(!1), v(""), u ? K.success(l.deleteUserVerificationSent) : (K.success(l.deleteUserSuccess), f.removeQueries({ queryKey: i.all }), s({
|
|
359
359
|
to: `${a.auth}/${c.auth.signIn}`,
|
|
@@ -381,14 +381,14 @@ function kt({ className: e, variant: t, ...n }) {
|
|
|
381
381
|
children: l.deleteAccount
|
|
382
382
|
}), /* @__PURE__ */ Y(O.Backdrop, {
|
|
383
383
|
isOpen: h,
|
|
384
|
-
onOpenChange:
|
|
384
|
+
onOpenChange: ee,
|
|
385
385
|
children: /* @__PURE__ */ Y(O.Container, { children: /* @__PURE__ */ Y(O.Dialog, { children: /* @__PURE__ */ X(P, {
|
|
386
|
-
onSubmit:
|
|
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(Je, {})
|
|
392
392
|
}), /* @__PURE__ */ Y(O.Heading, { children: l.deleteAccount })] }),
|
|
393
393
|
/* @__PURE__ */ X(O.Body, {
|
|
394
394
|
className: "overflow-visible",
|
|
@@ -436,7 +436,7 @@ function kt({ className: e, variant: t, ...n }) {
|
|
|
436
436
|
}
|
|
437
437
|
//#endregion
|
|
438
438
|
//#region src/components/auth/delete-user/danger-zone.tsx
|
|
439
|
-
function
|
|
439
|
+
function kt({ className: e, variant: t, ...n }) {
|
|
440
440
|
let { localization: r } = p();
|
|
441
441
|
return /* @__PURE__ */ X("div", {
|
|
442
442
|
className: G("flex w-full flex-col", e),
|
|
@@ -444,39 +444,39 @@ function At({ className: e, variant: t, ...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(Ot, { 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: i, localization: a } = p(), o = Z({ mutationKey: r.signIn.all }) + Z({ mutationKey: r.signUp.all }) > 0, { localization: s, viewPaths: c } = m(
|
|
454
|
-
return l && !n?.enabled ? null : /* @__PURE__ */ X(
|
|
452
|
+
function At({ view: e }) {
|
|
453
|
+
let { basePaths: t, emailAndPassword: n, viewPaths: i, localization: a } = p(), o = Z({ mutationKey: r.signIn.all }) + Z({ mutationKey: r.signUp.all }) > 0, { localization: s, viewPaths: c } = m(jt), l = e === "magicLink";
|
|
454
|
+
return l && !n?.enabled ? null : /* @__PURE__ */ X($e, {
|
|
455
455
|
href: `${t.auth}/${l ? i.auth.signIn : c.auth.magicLink}`,
|
|
456
456
|
isDisabled: o,
|
|
457
|
-
className: G(
|
|
458
|
-
children: [Y(l ?
|
|
457
|
+
className: G(ct({ variant: "tertiary" }), "w-full gap-2", o && "status-disabled"),
|
|
458
|
+
children: [Y(l ? ze : Pe, {}), a.auth.continueWith.replace("{{provider}}", l ? a.auth.password : s.magicLink)]
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
//#endregion
|
|
462
462
|
//#region src/lib/auth/magic-link-plugin.ts
|
|
463
|
-
var
|
|
463
|
+
var jt = a(dt.id, (e = {}) => ({
|
|
464
464
|
...dt(e),
|
|
465
|
-
authButtons: [
|
|
466
|
-
views: { auth: { magicLink:
|
|
467
|
-
fallbackViews: { auth: { signIn:
|
|
465
|
+
authButtons: [At],
|
|
466
|
+
views: { auth: { magicLink: Mt } },
|
|
467
|
+
fallbackViews: { auth: { signIn: Mt } }
|
|
468
468
|
}));
|
|
469
469
|
//#endregion
|
|
470
470
|
//#region src/components/auth/magic-link/magic-link.tsx
|
|
471
|
-
function
|
|
472
|
-
let { authClient: s, basePaths: c, baseURL: l, emailAndPassword: u, localization: d, plugins: f, redirectTo: h, socialProviders: g, viewPaths: _ } = p(), { localization: v } = m(
|
|
471
|
+
function Mt({ className: n, socialLayout: i, socialPosition: a = "bottom", variant: o }) {
|
|
472
|
+
let { authClient: s, basePaths: c, baseURL: l, emailAndPassword: u, localization: d, plugins: f, redirectTo: h, socialProviders: g, viewPaths: _ } = p(), { localization: v } = m(jt), [y, b] = q(""), { mutate: x, isPending: S } = _e(s, { onSuccess: () => {
|
|
473
473
|
b(""), K.success(v.magicLinkSent);
|
|
474
|
-
} }), C = Z({ mutationKey: r.signIn.all }) + Z({ mutationKey: r.signUp.all }) > 0,
|
|
474
|
+
} }), C = Z({ mutationKey: r.signIn.all }) + Z({ mutationKey: r.signUp.all }) > 0, ee = (e) => {
|
|
475
475
|
e.preventDefault(), x({
|
|
476
476
|
email: y,
|
|
477
477
|
callbackURL: `${l}${h}`
|
|
478
478
|
});
|
|
479
|
-
},
|
|
479
|
+
}, w = !!g?.length;
|
|
480
480
|
return /* @__PURE__ */ X(A, {
|
|
481
481
|
className: G("w-full max-w-sm gap-4 md:p-6", n),
|
|
482
482
|
variant: o,
|
|
@@ -488,9 +488,9 @@ function Nt({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
488
488
|
/* @__PURE__ */ X(A.Content, {
|
|
489
489
|
className: "gap-4",
|
|
490
490
|
children: [
|
|
491
|
-
a === "top" && /* @__PURE__ */ X(J, { children: [!!g?.length && /* @__PURE__ */ Y(t, { socialLayout: i }),
|
|
491
|
+
a === "top" && /* @__PURE__ */ X(J, { children: [!!g?.length && /* @__PURE__ */ Y(t, { socialLayout: i }), w && /* @__PURE__ */ Y(e, { children: d.auth.or })] }),
|
|
492
492
|
/* @__PURE__ */ X(P, {
|
|
493
|
-
onSubmit:
|
|
493
|
+
onSubmit: ee,
|
|
494
494
|
className: "flex flex-col gap-4",
|
|
495
495
|
children: [/* @__PURE__ */ X(W, {
|
|
496
496
|
name: "email",
|
|
@@ -521,17 +521,17 @@ function Nt({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
521
521
|
}), f.flatMap((e) => (e.authButtons ?? []).map((t, n) => /* @__PURE__ */ Y(t, { view: "magicLink" }, `${e.id}-${n.toString()}`)))]
|
|
522
522
|
})]
|
|
523
523
|
}),
|
|
524
|
-
a === "bottom" && /* @__PURE__ */ X(J, { children: [
|
|
524
|
+
a === "bottom" && /* @__PURE__ */ X(J, { children: [w && /* @__PURE__ */ Y(e, { children: d.auth.or }), !!g?.length && /* @__PURE__ */ Y(t, { socialLayout: i })] })
|
|
525
525
|
]
|
|
526
526
|
}),
|
|
527
527
|
u?.enabled && /* @__PURE__ */ Y(A.Footer, {
|
|
528
528
|
className: "flex-col gap-3",
|
|
529
|
-
children: /* @__PURE__ */ X(
|
|
529
|
+
children: /* @__PURE__ */ X(Ze, {
|
|
530
530
|
className: "text-sm",
|
|
531
531
|
children: [
|
|
532
532
|
d.auth.needToCreateAnAccount,
|
|
533
533
|
" ",
|
|
534
|
-
/* @__PURE__ */ Y(
|
|
534
|
+
/* @__PURE__ */ Y($e, {
|
|
535
535
|
href: `${c.auth}/${_.auth.signUp}`,
|
|
536
536
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
537
537
|
children: d.auth.signUp
|
|
@@ -544,8 +544,8 @@ function Nt({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
544
544
|
}
|
|
545
545
|
//#endregion
|
|
546
546
|
//#region src/components/auth/multi-session/manage-accounts.tsx
|
|
547
|
-
function
|
|
548
|
-
let { authClient: r } = p(), { localization: i } = m(
|
|
547
|
+
function Nt({ className: e, variant: t, ...n }) {
|
|
548
|
+
let { authClient: r } = p(), { localization: i } = m(Lt), { data: a } = E(r), { data: o, isPending: s } = ae(r), c = o?.filter((e) => e.session.id !== a?.session.id), l = [{
|
|
549
549
|
key: a?.session.id ?? "current",
|
|
550
550
|
deviceSession: s ? null : a,
|
|
551
551
|
isPending: s
|
|
@@ -563,7 +563,7 @@ function Pt({ className: e, variant: t, ...n }) {
|
|
|
563
563
|
...n,
|
|
564
564
|
children: /* @__PURE__ */ Y(A.Content, {
|
|
565
565
|
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(
|
|
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(Rt, {
|
|
567
567
|
deviceSession: e.deviceSession,
|
|
568
568
|
isPending: e.isPending
|
|
569
569
|
})] }, e.key))
|
|
@@ -572,8 +572,8 @@ function Pt({ className: e, variant: t, ...n }) {
|
|
|
572
572
|
}
|
|
573
573
|
//#endregion
|
|
574
574
|
//#region src/components/auth/multi-session/switch-account-submenu-item.tsx
|
|
575
|
-
function
|
|
576
|
-
let { authClient: r } = p(), { mutate: i, isPending: a } =
|
|
575
|
+
function Pt({ deviceSession: e, hideSubtitle: t }) {
|
|
576
|
+
let { authClient: r } = p(), { mutate: i, isPending: a } = he(r, { onSuccess: () => window.scrollTo({ top: 0 }) });
|
|
577
577
|
return /* @__PURE__ */ X(M.Item, {
|
|
578
578
|
className: "px-2",
|
|
579
579
|
isDisabled: a,
|
|
@@ -590,8 +590,8 @@ function Ft({ deviceSession: e, hideSubtitle: t }) {
|
|
|
590
590
|
}
|
|
591
591
|
//#endregion
|
|
592
592
|
//#region src/components/auth/multi-session/switch-account-submenu-content.tsx
|
|
593
|
-
function
|
|
594
|
-
let { authClient: t, basePaths: r, viewPaths: i } = p(), { localization: a } = m(
|
|
593
|
+
function Ft({ hideSubtitle: e }) {
|
|
594
|
+
let { authClient: t, basePaths: r, viewPaths: i } = p(), { localization: a } = m(Lt), { data: o } = E(t), { data: s, isPending: c } = ae(t);
|
|
595
595
|
return /* @__PURE__ */ Y(M.Popover, {
|
|
596
596
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
597
597
|
children: /* @__PURE__ */ X(M.Menu, { children: [
|
|
@@ -600,48 +600,48 @@ function It({ hideSubtitle: e }) {
|
|
|
600
600
|
children: [/* @__PURE__ */ Y(n, {
|
|
601
601
|
isPending: c,
|
|
602
602
|
hideSubtitle: e
|
|
603
|
-
}), !c && /* @__PURE__ */ Y(
|
|
603
|
+
}), !c && /* @__PURE__ */ Y(Ee, { className: "ml-auto" })]
|
|
604
604
|
}),
|
|
605
|
-
s?.filter((e) => e.session.id !== o?.session?.id).map((t) => /* @__PURE__ */ Y(
|
|
605
|
+
s?.filter((e) => e.session.id !== o?.session?.id).map((t) => /* @__PURE__ */ Y(Pt, {
|
|
606
606
|
deviceSession: t,
|
|
607
607
|
hideSubtitle: e
|
|
608
608
|
}, t.session.id)),
|
|
609
609
|
/* @__PURE__ */ X(M.Item, {
|
|
610
610
|
textValue: a.addAccount,
|
|
611
611
|
href: `${r.auth}/${i.auth.signIn}`,
|
|
612
|
-
children: [/* @__PURE__ */ Y(
|
|
612
|
+
children: [/* @__PURE__ */ Y(Oe, { className: "text-muted" }), /* @__PURE__ */ Y(L, { children: a.addAccount })]
|
|
613
613
|
})
|
|
614
614
|
] })
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
617
|
//#endregion
|
|
618
618
|
//#region src/components/auth/multi-session/switch-account-submenu.tsx
|
|
619
|
-
function
|
|
620
|
-
let { authClient: n } = p(), { data: r } = E(n), { localization: i } = m(
|
|
619
|
+
function It({ className: e, hideSubtitle: t }) {
|
|
620
|
+
let { authClient: n } = p(), { data: r } = E(n), { localization: i } = m(Lt);
|
|
621
621
|
return r ? /* @__PURE__ */ X(M.SubmenuTrigger, { children: [/* @__PURE__ */ X(M.Item, {
|
|
622
622
|
className: e,
|
|
623
623
|
textValue: i.switchAccount,
|
|
624
624
|
children: [
|
|
625
|
-
/* @__PURE__ */ Y(
|
|
625
|
+
/* @__PURE__ */ Y(Ce, { className: "text-muted" }),
|
|
626
626
|
/* @__PURE__ */ Y(L, { children: i.switchAccount }),
|
|
627
627
|
/* @__PURE__ */ Y(M.SubmenuIndicator, {})
|
|
628
628
|
]
|
|
629
629
|
}), /* @__PURE__ */ Y(M.Popover, {
|
|
630
630
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
631
|
-
children: /* @__PURE__ */ Y(
|
|
631
|
+
children: /* @__PURE__ */ Y(Ft, { hideSubtitle: t })
|
|
632
632
|
})] }) : null;
|
|
633
633
|
}
|
|
634
634
|
//#endregion
|
|
635
635
|
//#region src/lib/auth/multi-session-plugin.ts
|
|
636
|
-
var
|
|
636
|
+
var Lt = a(ft.id, (e = {}) => ({
|
|
637
637
|
...ft(e),
|
|
638
|
-
accountCards: [
|
|
639
|
-
userMenuItems: [
|
|
638
|
+
accountCards: [Nt],
|
|
639
|
+
userMenuItems: [It]
|
|
640
640
|
}));
|
|
641
641
|
//#endregion
|
|
642
642
|
//#region src/components/auth/multi-session/manage-account.tsx
|
|
643
|
-
function
|
|
644
|
-
let { authClient: r, localization: i } = p(), { localization: a } = m(
|
|
643
|
+
function Rt({ deviceSession: e, isPending: t }) {
|
|
644
|
+
let { authClient: r, localization: i } = p(), { localization: a } = m(Lt), { data: o } = Se(r), { mutate: s, isPending: c } = he(r, { onSuccess: () => window.scrollTo({ top: 0 }) }), { mutate: l, isPending: u } = pe(r, { onSuccess: () => K.success(i.settings.revokeSessionSuccess) }), d = e?.session.userId === o?.id, f = c || u;
|
|
645
645
|
return /* @__PURE__ */ X("div", {
|
|
646
646
|
className: "flex items-center justify-between gap-3",
|
|
647
647
|
children: [
|
|
@@ -659,7 +659,7 @@ function zt({ deviceSession: e, isPending: t }) {
|
|
|
659
659
|
children: [u ? /* @__PURE__ */ Y(V, {
|
|
660
660
|
color: "current",
|
|
661
661
|
size: "sm"
|
|
662
|
-
}) : /* @__PURE__ */ Y(
|
|
662
|
+
}) : /* @__PURE__ */ Y(we, {}), i.auth.signOut]
|
|
663
663
|
}),
|
|
664
664
|
e && !d && /* @__PURE__ */ X(M, { children: [/* @__PURE__ */ Y(k, {
|
|
665
665
|
isIconOnly: !0,
|
|
@@ -667,29 +667,29 @@ function zt({ deviceSession: e, isPending: t }) {
|
|
|
667
667
|
className: "shrink-0",
|
|
668
668
|
size: "sm",
|
|
669
669
|
isDisabled: f,
|
|
670
|
-
children: /* @__PURE__ */ Y(
|
|
670
|
+
children: /* @__PURE__ */ Y(Ne, {})
|
|
671
671
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, { children: [/* @__PURE__ */ X(M.Item, {
|
|
672
672
|
textValue: a.switchAccount,
|
|
673
673
|
onAction: () => s({ sessionToken: e.session.token }),
|
|
674
|
-
children: [/* @__PURE__ */ Y(
|
|
674
|
+
children: [/* @__PURE__ */ Y(Ce, { className: "text-muted" }), a.switchAccount]
|
|
675
675
|
}), /* @__PURE__ */ X(M.Item, {
|
|
676
676
|
textValue: i.auth.signOut,
|
|
677
677
|
onAction: () => l({ sessionToken: e.session.token }),
|
|
678
|
-
children: [/* @__PURE__ */ Y(
|
|
678
|
+
children: [/* @__PURE__ */ Y(we, { className: "text-muted" }), i.auth.signOut]
|
|
679
679
|
})] }) })] })
|
|
680
680
|
]
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
683
|
//#endregion
|
|
684
684
|
//#region src/components/auth/organization/slug-field.tsx
|
|
685
|
-
function
|
|
685
|
+
function zt(e) {
|
|
686
686
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
let { authClient: a, localization: o } = p(), { localization: s, checkSlug: c } = m($), { mutate: l, data: u, error: d, reset: f } = _(a), h =
|
|
688
|
+
function Bt({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
689
|
+
let { authClient: a, localization: o } = p(), { localization: s, checkSlug: c } = m($), { mutate: l, data: u, error: d, reset: f } = _(a), h = _t((e) => {
|
|
690
690
|
!c || !e.trim() || e.trim() === n || l({ slug: e.trim() });
|
|
691
691
|
}, { wait: 500 });
|
|
692
|
-
|
|
692
|
+
it(() => {
|
|
693
693
|
c && (f(), h.maybeExecute(e));
|
|
694
694
|
}, [
|
|
695
695
|
c,
|
|
@@ -698,7 +698,7 @@ function Vt({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
|
698
698
|
f
|
|
699
699
|
]);
|
|
700
700
|
let g = (e) => {
|
|
701
|
-
t(
|
|
701
|
+
t(zt(e));
|
|
702
702
|
};
|
|
703
703
|
return /* @__PURE__ */ X(W, {
|
|
704
704
|
id: "slug",
|
|
@@ -718,7 +718,7 @@ function Vt({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
|
718
718
|
required: !0
|
|
719
719
|
}), c && !!e.trim() && e.trim() !== n && /* @__PURE__ */ Y(I.Suffix, {
|
|
720
720
|
className: "px-2",
|
|
721
|
-
children: u?.status ? /* @__PURE__ */ Y(
|
|
721
|
+
children: u?.status ? /* @__PURE__ */ Y(Ee, { className: "text-success" }) : d ? /* @__PURE__ */ Y(D, { className: "text-danger" }) : /* @__PURE__ */ Y(V, {
|
|
722
722
|
size: "sm",
|
|
723
723
|
color: "current"
|
|
724
724
|
})
|
|
@@ -730,12 +730,12 @@ function Vt({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
|
730
730
|
}
|
|
731
731
|
//#endregion
|
|
732
732
|
//#region src/components/auth/organization/create-organization-dialog.tsx
|
|
733
|
-
function
|
|
733
|
+
function Vt({ isOpen: e, onOpenChange: t }) {
|
|
734
734
|
let { authClient: n, localization: r } = p(), { localization: i } = m($), [a, o] = q(""), [s, c] = q(""), [l, u] = q(!1), { mutate: d, isPending: f } = y(n, { onSuccess: () => t(!1) });
|
|
735
|
-
return
|
|
735
|
+
return it(() => {
|
|
736
736
|
e || (c(""), o(""), u(!1));
|
|
737
|
-
}, [e]),
|
|
738
|
-
l || c(
|
|
737
|
+
}, [e]), it(() => {
|
|
738
|
+
l || c(zt(a));
|
|
739
739
|
}, [a, l]), /* @__PURE__ */ Y(O.Backdrop, {
|
|
740
740
|
isOpen: e,
|
|
741
741
|
onOpenChange: t,
|
|
@@ -750,7 +750,7 @@ function Ht({ isOpen: e, onOpenChange: t }) {
|
|
|
750
750
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
751
751
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
752
752
|
status: "default",
|
|
753
|
-
children: /* @__PURE__ */ Y(
|
|
753
|
+
children: /* @__PURE__ */ Y(Te, {})
|
|
754
754
|
}), /* @__PURE__ */ Y(O.Heading, { children: i.createOrganization })] }),
|
|
755
755
|
/* @__PURE__ */ X(O.Body, {
|
|
756
756
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -779,7 +779,7 @@ function Ht({ isOpen: e, onOpenChange: t }) {
|
|
|
779
779
|
/* @__PURE__ */ Y(N, {})
|
|
780
780
|
]
|
|
781
781
|
}),
|
|
782
|
-
/* @__PURE__ */ Y(
|
|
782
|
+
/* @__PURE__ */ Y(Bt, {
|
|
783
783
|
value: s,
|
|
784
784
|
onChange: (e) => {
|
|
785
785
|
c(e), u(!0);
|
|
@@ -808,34 +808,34 @@ function Ht({ isOpen: e, onOpenChange: t }) {
|
|
|
808
808
|
}
|
|
809
809
|
//#endregion
|
|
810
810
|
//#region src/components/auth/organization/organization-logo.tsx
|
|
811
|
-
function
|
|
811
|
+
function Ht({ className: e, fallback: t, isPending: n, organization: r, size: i = "sm", style: a, ...o }) {
|
|
812
812
|
if (n && !r) return /* @__PURE__ */ Y(B, {
|
|
813
813
|
className: G("rounded-full", i === "sm" ? "size-8" : i === "md" ? "size-10" : "size-12", e),
|
|
814
814
|
style: a
|
|
815
815
|
});
|
|
816
816
|
let s = r?.name?.slice(0, 2).toUpperCase();
|
|
817
|
-
return /* @__PURE__ */ X(
|
|
817
|
+
return /* @__PURE__ */ X(Ye, {
|
|
818
818
|
size: i,
|
|
819
819
|
className: G("rounded-full", e),
|
|
820
820
|
style: a,
|
|
821
821
|
...o,
|
|
822
|
-
children: [/* @__PURE__ */ Y(
|
|
822
|
+
children: [/* @__PURE__ */ Y(Ye.Image, {
|
|
823
823
|
alt: r?.name ?? "Organization",
|
|
824
824
|
src: r?.logo ?? void 0
|
|
825
|
-
}), /* @__PURE__ */ Y(
|
|
825
|
+
}), /* @__PURE__ */ Y(Ye.Fallback, {
|
|
826
826
|
className: G(i === "lg" ? "text-xl" : i === "md" ? "text-base" : "text-sm"),
|
|
827
827
|
delayMs: r?.logo ? 600 : void 0,
|
|
828
|
-
children: t || s || /* @__PURE__ */ Y(
|
|
828
|
+
children: t || s || /* @__PURE__ */ Y(Te, { className: "size-4" })
|
|
829
829
|
})]
|
|
830
830
|
});
|
|
831
831
|
}
|
|
832
832
|
//#endregion
|
|
833
833
|
//#region src/components/auth/organization/organization-view-skeleton.tsx
|
|
834
|
-
function
|
|
834
|
+
function Ut({ className: e, hideSlug: t, size: n = "md", ...r }) {
|
|
835
835
|
return /* @__PURE__ */ X("div", {
|
|
836
836
|
className: G("flex min-w-0 items-center gap-2", e),
|
|
837
837
|
...r,
|
|
838
|
-
children: [/* @__PURE__ */ Y(
|
|
838
|
+
children: [/* @__PURE__ */ Y(Ht, {
|
|
839
839
|
isPending: !0,
|
|
840
840
|
className: n === "sm" ? "size-5" : void 0,
|
|
841
841
|
size: n === "lg" ? "md" : "sm"
|
|
@@ -852,7 +852,7 @@ function Q({ className: e, isPending: t, size: n = "md", hideSlug: r, hideRole:
|
|
|
852
852
|
query: { organizationId: h?.id },
|
|
853
853
|
enabled: !!h?.id && !i
|
|
854
854
|
}), v = g?.members?.find((e) => e.userId === l?.user.id);
|
|
855
|
-
return t || !a && f || !i && h?.id && _ ? /* @__PURE__ */ Y(
|
|
855
|
+
return t || !a && f || !i && h?.id && _ ? /* @__PURE__ */ Y(Ut, {
|
|
856
856
|
className: e,
|
|
857
857
|
hideSlug: r,
|
|
858
858
|
size: n,
|
|
@@ -860,7 +860,7 @@ function Q({ className: e, isPending: t, size: n = "md", hideSlug: r, hideRole:
|
|
|
860
860
|
}) : /* @__PURE__ */ X("div", {
|
|
861
861
|
className: G("flex min-w-0 items-center gap-2", e),
|
|
862
862
|
...o,
|
|
863
|
-
children: [/* @__PURE__ */ Y(
|
|
863
|
+
children: [/* @__PURE__ */ Y(Ht, {
|
|
864
864
|
organization: h,
|
|
865
865
|
className: n === "sm" ? "size-5 [&>span]:text-xs" : void 0,
|
|
866
866
|
size: n === "lg" ? "md" : "sm"
|
|
@@ -885,8 +885,8 @@ function Q({ className: e, isPending: t, size: n = "md", hideSlug: r, hideRole:
|
|
|
885
885
|
}
|
|
886
886
|
//#endregion
|
|
887
887
|
//#region src/components/auth/organization/organization-row.tsx
|
|
888
|
-
function
|
|
889
|
-
let { authClient: t, basePaths: n, navigate: r } = p(), { localization: i, viewPaths: a, slug: o } = m($), { mutate: s, isPending: c } =
|
|
888
|
+
function Wt({ organization: e }) {
|
|
889
|
+
let { authClient: t, basePaths: n, navigate: r } = p(), { localization: i, viewPaths: a, slug: o } = m($), { mutate: s, isPending: c } = me(t, { onSuccess: () => {
|
|
890
890
|
r({ to: `${n.organization}/${a.organization.settings}` });
|
|
891
891
|
} });
|
|
892
892
|
function l() {
|
|
@@ -904,20 +904,20 @@ function Gt({ organization: e }) {
|
|
|
904
904
|
children: [c ? /* @__PURE__ */ Y(V, {
|
|
905
905
|
color: "current",
|
|
906
906
|
size: "sm"
|
|
907
|
-
}) : /* @__PURE__ */ Y(
|
|
907
|
+
}) : /* @__PURE__ */ Y(Le, {}), i.manage]
|
|
908
908
|
})]
|
|
909
909
|
});
|
|
910
910
|
}
|
|
911
911
|
//#endregion
|
|
912
912
|
//#region src/components/auth/organization/organizations-empty.tsx
|
|
913
|
-
function
|
|
913
|
+
function Gt({ onCreatePress: e }) {
|
|
914
914
|
let { localization: t } = m($);
|
|
915
|
-
return /* @__PURE__ */ X(
|
|
915
|
+
return /* @__PURE__ */ X(Qe, {
|
|
916
916
|
className: "flex flex-col items-center gap-4 text-center",
|
|
917
917
|
children: [
|
|
918
918
|
/* @__PURE__ */ Y("div", {
|
|
919
919
|
className: "flex size-12 items-center justify-center rounded-full bg-surface-secondary",
|
|
920
|
-
children: /* @__PURE__ */ Y(
|
|
920
|
+
children: /* @__PURE__ */ Y(Te, { className: "size-5" })
|
|
921
921
|
}),
|
|
922
922
|
/* @__PURE__ */ X("div", {
|
|
923
923
|
className: "flex flex-col gap-2",
|
|
@@ -939,7 +939,7 @@ function Kt({ onCreatePress: e }) {
|
|
|
939
939
|
}
|
|
940
940
|
//#endregion
|
|
941
941
|
//#region src/components/auth/organization/organizations.tsx
|
|
942
|
-
function
|
|
942
|
+
function Kt({ variant: e }) {
|
|
943
943
|
let { authClient: t } = p(), { localization: n } = m($), [r, i] = q(!1), { data: a, isPending: o } = ce(t);
|
|
944
944
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X("div", {
|
|
945
945
|
className: "flex flex-col gap-3",
|
|
@@ -959,24 +959,24 @@ function qt({ variant: e }) {
|
|
|
959
959
|
variant: e,
|
|
960
960
|
children: /* @__PURE__ */ Y(A.Content, {
|
|
961
961
|
className: "gap-0",
|
|
962
|
-
children: o ? /* @__PURE__ */ Y(
|
|
962
|
+
children: o ? /* @__PURE__ */ Y(Ut, {}) : 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(Wt, { organization: e })] }, e.id)) : /* @__PURE__ */ Y(Gt, { onCreatePress: () => i(!0) })
|
|
963
963
|
})
|
|
964
964
|
})]
|
|
965
|
-
}), /* @__PURE__ */ Y(
|
|
965
|
+
}), /* @__PURE__ */ Y(Vt, {
|
|
966
966
|
isOpen: r,
|
|
967
967
|
onOpenChange: i
|
|
968
968
|
})] });
|
|
969
969
|
}
|
|
970
970
|
//#endregion
|
|
971
971
|
//#region src/components/auth/organization/user-invitation-row.tsx
|
|
972
|
-
function
|
|
972
|
+
function qt({ invitation: e }) {
|
|
973
973
|
let { authClient: t } = p(), { localization: n, roles: r } = m($), { mutate: i, isPending: a } = u(t), { mutate: o, isPending: s } = de(t);
|
|
974
974
|
return /* @__PURE__ */ X("div", {
|
|
975
975
|
className: "flex items-center gap-3",
|
|
976
976
|
children: [
|
|
977
977
|
/* @__PURE__ */ Y("div", {
|
|
978
978
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
979
|
-
children: /* @__PURE__ */ Y(
|
|
979
|
+
children: /* @__PURE__ */ Y(ke, { className: "size-4.5" })
|
|
980
980
|
}),
|
|
981
981
|
/* @__PURE__ */ X("div", {
|
|
982
982
|
className: "flex flex-col",
|
|
@@ -1008,7 +1008,7 @@ function Jt({ invitation: e }) {
|
|
|
1008
1008
|
children: [a ? /* @__PURE__ */ Y(V, {
|
|
1009
1009
|
color: "current",
|
|
1010
1010
|
size: "sm"
|
|
1011
|
-
}) : /* @__PURE__ */ Y(
|
|
1011
|
+
}) : /* @__PURE__ */ Y(Ee, {}), n.accept]
|
|
1012
1012
|
}), /* @__PURE__ */ Y(k, {
|
|
1013
1013
|
variant: "danger-soft",
|
|
1014
1014
|
size: "sm",
|
|
@@ -1028,7 +1028,7 @@ function Jt({ invitation: e }) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
//#endregion
|
|
1030
1030
|
//#region src/components/auth/organization/user-invitation-row-skeleton.tsx
|
|
1031
|
-
function
|
|
1031
|
+
function Jt() {
|
|
1032
1032
|
return /* @__PURE__ */ X("div", {
|
|
1033
1033
|
className: "flex items-center gap-3",
|
|
1034
1034
|
children: [/* @__PURE__ */ Y(B, { className: "size-10 shrink-0 rounded-xl" }), /* @__PURE__ */ X("div", {
|
|
@@ -1039,13 +1039,13 @@ function Yt() {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
//#endregion
|
|
1041
1041
|
//#region src/components/auth/organization/user-invitations-empty.tsx
|
|
1042
|
-
function
|
|
1042
|
+
function Yt() {
|
|
1043
1043
|
let { localization: e } = m($);
|
|
1044
|
-
return /* @__PURE__ */ X(
|
|
1044
|
+
return /* @__PURE__ */ X(Qe, {
|
|
1045
1045
|
className: "flex flex-col items-center gap-4 text-center",
|
|
1046
1046
|
children: [/* @__PURE__ */ Y("div", {
|
|
1047
1047
|
className: "flex size-12 items-center justify-center rounded-full bg-surface-secondary",
|
|
1048
|
-
children: /* @__PURE__ */ Y(
|
|
1048
|
+
children: /* @__PURE__ */ Y(He, { className: "size-5" })
|
|
1049
1049
|
}), /* @__PURE__ */ X("div", {
|
|
1050
1050
|
className: "flex flex-col gap-2",
|
|
1051
1051
|
children: [/* @__PURE__ */ Y("p", {
|
|
@@ -1060,7 +1060,7 @@ function Xt() {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
//#endregion
|
|
1062
1062
|
//#region src/components/auth/organization/user-invitations.tsx
|
|
1063
|
-
function
|
|
1063
|
+
function Xt({ variant: e }) {
|
|
1064
1064
|
let { authClient: t } = p(), { localization: n } = m($), { data: r, isPending: i } = ue(t);
|
|
1065
1065
|
return /* @__PURE__ */ X("div", {
|
|
1066
1066
|
className: "flex flex-col gap-3",
|
|
@@ -1069,17 +1069,17 @@ function Zt({ variant: e }) {
|
|
|
1069
1069
|
children: n.invitations
|
|
1070
1070
|
}), /* @__PURE__ */ Y(A, {
|
|
1071
1071
|
variant: e,
|
|
1072
|
-
children: /* @__PURE__ */ Y(A.Content, { children: i ? /* @__PURE__ */ Y(
|
|
1072
|
+
children: /* @__PURE__ */ Y(A.Content, { children: i ? /* @__PURE__ */ Y(Jt, {}) : 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(qt, { invitation: e })] }, e.id)) : /* @__PURE__ */ Y(Yt, {}) })
|
|
1073
1073
|
})]
|
|
1074
1074
|
});
|
|
1075
1075
|
}
|
|
1076
1076
|
//#endregion
|
|
1077
1077
|
//#region src/components/auth/organization/organizations-settings.tsx
|
|
1078
|
-
function
|
|
1078
|
+
function Zt({ className: e, variant: t, ...n }) {
|
|
1079
1079
|
return /* @__PURE__ */ X("div", {
|
|
1080
1080
|
className: G("flex w-full flex-col gap-4 md:gap-6", e),
|
|
1081
1081
|
...n,
|
|
1082
|
-
children: [/* @__PURE__ */ Y(
|
|
1082
|
+
children: [/* @__PURE__ */ Y(Kt, { variant: t }), /* @__PURE__ */ Y(Xt, { variant: t })]
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
1085
|
//#endregion
|
|
@@ -1091,15 +1091,15 @@ var $ = a(pt.id, (e = {}) => {
|
|
|
1091
1091
|
localization: t.localization,
|
|
1092
1092
|
settingsTabs: [{
|
|
1093
1093
|
view: "organizations",
|
|
1094
|
-
label: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(
|
|
1095
|
-
component:
|
|
1094
|
+
label: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(Te, { className: "text-muted" }), t.localization.organizations] }),
|
|
1095
|
+
component: Zt
|
|
1096
1096
|
}]
|
|
1097
1097
|
};
|
|
1098
1098
|
});
|
|
1099
1099
|
//#endregion
|
|
1100
1100
|
//#region src/components/auth/organization/change-organization-logo.tsx
|
|
1101
|
-
function
|
|
1102
|
-
let { authClient: t } = p(), { logo: n, localization: r } = m($), { data: i, isPending: a } = d(t), { mutate: s, isPending: c } =
|
|
1101
|
+
function Qt({ className: e }) {
|
|
1102
|
+
let { authClient: t } = p(), { logo: n, localization: r } = m($), { data: i, isPending: a } = d(t), { mutate: s, isPending: c } = xe(t), l = ot(null), [u, f] = q(!1), [h, g] = q(!1), _ = c || u || h;
|
|
1103
1103
|
async function v(e) {
|
|
1104
1104
|
let t = e.target.files?.[0];
|
|
1105
1105
|
if (!(!t || !i)) {
|
|
@@ -1155,7 +1155,7 @@ function $t({ className: e }) {
|
|
|
1155
1155
|
className: "p-0 h-auto w-auto rounded-full",
|
|
1156
1156
|
isDisabled: !i || _,
|
|
1157
1157
|
onPress: () => l.current?.click(),
|
|
1158
|
-
children: /* @__PURE__ */ Y(
|
|
1158
|
+
children: /* @__PURE__ */ Y(Ht, {
|
|
1159
1159
|
size: "lg",
|
|
1160
1160
|
isPending: a,
|
|
1161
1161
|
organization: i
|
|
@@ -1170,13 +1170,13 @@ function $t({ className: e }) {
|
|
|
1170
1170
|
children: /* @__PURE__ */ X(M.Menu, { children: [/* @__PURE__ */ X(M.Item, {
|
|
1171
1171
|
textValue: r.uploadLogo,
|
|
1172
1172
|
onAction: () => l.current?.click(),
|
|
1173
|
-
children: [/* @__PURE__ */ Y(
|
|
1173
|
+
children: [/* @__PURE__ */ Y(Ae, { className: "text-muted" }), /* @__PURE__ */ Y(L, { children: r.uploadLogo })]
|
|
1174
1174
|
}), /* @__PURE__ */ X(M.Item, {
|
|
1175
1175
|
textValue: r.deleteLogo,
|
|
1176
1176
|
isDisabled: !i?.logo,
|
|
1177
1177
|
onAction: y,
|
|
1178
1178
|
variant: "danger",
|
|
1179
|
-
children: [/* @__PURE__ */ Y(
|
|
1179
|
+
children: [/* @__PURE__ */ Y(qe, { className: "text-danger" }), /* @__PURE__ */ Y(L, { children: r.deleteLogo })]
|
|
1180
1180
|
})] })
|
|
1181
1181
|
})] })]
|
|
1182
1182
|
})
|
|
@@ -1185,7 +1185,7 @@ function $t({ className: e }) {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
//#endregion
|
|
1187
1187
|
//#region src/components/auth/organization/delete-organization-dialog.tsx
|
|
1188
|
-
function
|
|
1188
|
+
function $t({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
1189
1189
|
let { authClient: r, basePaths: i, localization: a, navigate: o } = p(), { localization: s, viewPaths: c } = m($), { mutate: l, isPending: u } = x(r, { onSuccess: () => {
|
|
1190
1190
|
t(!1), K.success(s.organizationDeleted), o({
|
|
1191
1191
|
to: `${i.settings}/${c.settings.organizations}`,
|
|
@@ -1204,7 +1204,7 @@ function en({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1204
1204
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1205
1205
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1206
1206
|
status: "danger",
|
|
1207
|
-
children: /* @__PURE__ */ Y(
|
|
1207
|
+
children: /* @__PURE__ */ Y(Je, {})
|
|
1208
1208
|
}), /* @__PURE__ */ Y(O.Heading, { children: s.deleteOrganization })] }),
|
|
1209
1209
|
/* @__PURE__ */ X(O.Body, {
|
|
1210
1210
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1239,7 +1239,7 @@ function en({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
//#endregion
|
|
1241
1241
|
//#region src/components/auth/organization/delete-organization-skeleton.tsx
|
|
1242
|
-
function
|
|
1242
|
+
function en() {
|
|
1243
1243
|
return /* @__PURE__ */ X("div", {
|
|
1244
1244
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1245
1245
|
children: [/* @__PURE__ */ X("div", {
|
|
@@ -1250,9 +1250,9 @@ function tn() {
|
|
|
1250
1250
|
}
|
|
1251
1251
|
//#endregion
|
|
1252
1252
|
//#region src/components/auth/organization/delete-organization.tsx
|
|
1253
|
-
function
|
|
1254
|
-
let { authClient: e } = p(), { localization: t } = m($), { data: n } = d(e), { data: r, isPending: i } =
|
|
1255
|
-
return i ? /* @__PURE__ */ Y(
|
|
1253
|
+
function tn() {
|
|
1254
|
+
let { authClient: e } = p(), { localization: t } = m($), { data: n } = d(e), { data: r, isPending: i } = w(e, { permissions: { organization: ["delete"] } }), [a, o] = q(!1);
|
|
1255
|
+
return i ? /* @__PURE__ */ Y(en, {}) : r?.success ? /* @__PURE__ */ X("div", {
|
|
1256
1256
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1257
1257
|
children: [/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("p", {
|
|
1258
1258
|
className: "text-sm font-medium leading-tight",
|
|
@@ -1266,7 +1266,7 @@ function nn() {
|
|
|
1266
1266
|
variant: "danger-soft",
|
|
1267
1267
|
onPress: () => o(!0),
|
|
1268
1268
|
children: t.deleteOrganization
|
|
1269
|
-
}), n && /* @__PURE__ */ Y(
|
|
1269
|
+
}), n && /* @__PURE__ */ Y($t, {
|
|
1270
1270
|
isOpen: a,
|
|
1271
1271
|
onOpenChange: o,
|
|
1272
1272
|
organization: n
|
|
@@ -1275,16 +1275,16 @@ function nn() {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
//#endregion
|
|
1277
1277
|
//#region src/components/auth/organization/invite-member-dialog.tsx
|
|
1278
|
-
var
|
|
1279
|
-
function
|
|
1280
|
-
let { authClient: n, localization: r } = p(), { localization: i, roles: a } = m($), [o, s] = q(() =>
|
|
1281
|
-
|
|
1278
|
+
var nn = (e) => e.includes("member") ? "member" : e.at(-1) ?? "";
|
|
1279
|
+
function rn({ isOpen: e, onOpenChange: t }) {
|
|
1280
|
+
let { authClient: n, localization: r } = p(), { localization: i, roles: a } = m($), [o, s] = q(() => nn(Object.keys(a)));
|
|
1281
|
+
it(() => {
|
|
1282
1282
|
s((e) => {
|
|
1283
1283
|
let t = Object.keys(a);
|
|
1284
|
-
return t.includes(e) ? e :
|
|
1284
|
+
return t.includes(e) ? e : nn(t);
|
|
1285
1285
|
});
|
|
1286
1286
|
}, [a]);
|
|
1287
|
-
let { mutate: c, isPending: l } =
|
|
1287
|
+
let { mutate: c, isPending: l } = te(n, { onSuccess: () => {
|
|
1288
1288
|
t(!1), K.success(i.inviteMemberSuccess);
|
|
1289
1289
|
} }), u = Object.keys(a).includes(o);
|
|
1290
1290
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
@@ -1301,7 +1301,7 @@ function an({ isOpen: e, onOpenChange: t }) {
|
|
|
1301
1301
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1302
1302
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1303
1303
|
status: "default",
|
|
1304
|
-
children: /* @__PURE__ */ Y(
|
|
1304
|
+
children: /* @__PURE__ */ Y(Ge, {})
|
|
1305
1305
|
}), /* @__PURE__ */ Y(O.Heading, { children: i.inviteMember })] }),
|
|
1306
1306
|
/* @__PURE__ */ X(O.Body, {
|
|
1307
1307
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1330,7 +1330,7 @@ function an({ isOpen: e, onOpenChange: t }) {
|
|
|
1330
1330
|
/* @__PURE__ */ Y(N, {})
|
|
1331
1331
|
]
|
|
1332
1332
|
}),
|
|
1333
|
-
/* @__PURE__ */ X(
|
|
1333
|
+
/* @__PURE__ */ X(nt, {
|
|
1334
1334
|
name: "role",
|
|
1335
1335
|
value: o,
|
|
1336
1336
|
onChange: (e) => {
|
|
@@ -1341,11 +1341,11 @@ function an({ isOpen: e, onOpenChange: t }) {
|
|
|
1341
1341
|
fullWidth: !0,
|
|
1342
1342
|
children: [
|
|
1343
1343
|
/* @__PURE__ */ Y(L, { children: i.role }),
|
|
1344
|
-
/* @__PURE__ */ X(
|
|
1345
|
-
/* @__PURE__ */ Y(
|
|
1344
|
+
/* @__PURE__ */ X(nt.Trigger, { children: [/* @__PURE__ */ Y(nt.Value, {}), /* @__PURE__ */ Y(nt.Indicator, {})] }),
|
|
1345
|
+
/* @__PURE__ */ Y(nt.Popover, { children: /* @__PURE__ */ Y(et, { children: Object.entries(a).map(([e, t]) => /* @__PURE__ */ X(et.Item, {
|
|
1346
1346
|
id: e,
|
|
1347
1347
|
textValue: t,
|
|
1348
|
-
children: [t, /* @__PURE__ */ Y(
|
|
1348
|
+
children: [t, /* @__PURE__ */ Y(et.ItemIndicator, {})]
|
|
1349
1349
|
}, e)) }) }),
|
|
1350
1350
|
/* @__PURE__ */ Y(N, {})
|
|
1351
1351
|
]
|
|
@@ -1372,8 +1372,8 @@ function an({ isOpen: e, onOpenChange: t }) {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
//#endregion
|
|
1374
1374
|
//#region src/components/auth/organization/leave-organization-dialog.tsx
|
|
1375
|
-
function
|
|
1376
|
-
let { authClient: r, basePaths: i, localization: a, navigate: o } = p(), { localization: s, viewPaths: c } = m($), { mutate: l, isPending: u } =
|
|
1375
|
+
function an({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
1376
|
+
let { authClient: r, basePaths: i, localization: a, navigate: o } = p(), { localization: s, viewPaths: c } = m($), { mutate: l, isPending: u } = re(r, { onSuccess: () => {
|
|
1377
1377
|
t(!1), K.success(s.leftOrganization), o({
|
|
1378
1378
|
to: `${i.settings}/${c.settings.organizations}`,
|
|
1379
1379
|
replace: !0
|
|
@@ -1386,7 +1386,7 @@ function on({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1386
1386
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1387
1387
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1388
1388
|
status: "danger",
|
|
1389
|
-
children: /* @__PURE__ */ Y(
|
|
1389
|
+
children: /* @__PURE__ */ Y(we, {})
|
|
1390
1390
|
}), /* @__PURE__ */ Y(O.Heading, { children: s.leaveOrganization })] }),
|
|
1391
1391
|
/* @__PURE__ */ X(O.Body, {
|
|
1392
1392
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1420,7 +1420,7 @@ function on({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
//#endregion
|
|
1422
1422
|
//#region src/components/auth/organization/leave-organization.tsx
|
|
1423
|
-
function
|
|
1423
|
+
function on() {
|
|
1424
1424
|
let { authClient: e } = p(), { localization: t } = m($), { data: n } = d(e), [r, i] = q(!1);
|
|
1425
1425
|
return /* @__PURE__ */ X("div", {
|
|
1426
1426
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
@@ -1436,7 +1436,7 @@ function sn() {
|
|
|
1436
1436
|
variant: "danger-soft",
|
|
1437
1437
|
onPress: () => i(!0),
|
|
1438
1438
|
children: t.leaveOrganization
|
|
1439
|
-
}), n && /* @__PURE__ */ Y(
|
|
1439
|
+
}), n && /* @__PURE__ */ Y(an, {
|
|
1440
1440
|
isOpen: r,
|
|
1441
1441
|
onOpenChange: i,
|
|
1442
1442
|
organization: n
|
|
@@ -1445,7 +1445,7 @@ function sn() {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
//#endregion
|
|
1447
1447
|
//#region src/components/auth/organization/organization-invitation-row-skeleton.tsx
|
|
1448
|
-
function
|
|
1448
|
+
function sn() {
|
|
1449
1449
|
return /* @__PURE__ */ X(H.Row, { children: [
|
|
1450
1450
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(B, { className: "h-4 w-48 rounded-lg" }) }),
|
|
1451
1451
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(B, { className: "h-4 w-36 rounded-lg" }) }),
|
|
@@ -1456,9 +1456,9 @@ function cn() {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
//#endregion
|
|
1458
1458
|
//#region src/components/auth/organization/organization-invitation-row.tsx
|
|
1459
|
-
function
|
|
1460
|
-
let { authClient: t } = p(), { localization: n, roles: r } = m($), { data: i, isPending: a } =
|
|
1461
|
-
return a ? /* @__PURE__ */ Y(
|
|
1459
|
+
function cn({ invitation: e }) {
|
|
1460
|
+
let { authClient: t } = p(), { localization: n, roles: r } = m($), { data: i, isPending: a } = w(t, { permissions: { invitation: ["cancel"] } }), { mutate: o, isPending: s } = g(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";
|
|
1461
|
+
return a ? /* @__PURE__ */ Y(sn, {}) : /* @__PURE__ */ X(H.Row, { children: [
|
|
1462
1462
|
/* @__PURE__ */ Y(H.Cell, {
|
|
1463
1463
|
className: "font-medium text-sm",
|
|
1464
1464
|
children: e.email
|
|
@@ -1502,12 +1502,12 @@ function ln({ invitation: e }) {
|
|
|
1502
1502
|
}
|
|
1503
1503
|
//#endregion
|
|
1504
1504
|
//#region src/components/auth/organization/organization-invitations-empty.tsx
|
|
1505
|
-
function
|
|
1505
|
+
function ln({ onInvitePress: e }) {
|
|
1506
1506
|
let { localization: t } = m($);
|
|
1507
|
-
return /* @__PURE__ */ X(
|
|
1507
|
+
return /* @__PURE__ */ X(Qe, {
|
|
1508
1508
|
className: "flex flex-col items-center gap-4 text-center p-4",
|
|
1509
1509
|
children: [
|
|
1510
|
-
/* @__PURE__ */ Y(
|
|
1510
|
+
/* @__PURE__ */ Y(He, { className: "size-6 text-muted" }),
|
|
1511
1511
|
/* @__PURE__ */ X("div", {
|
|
1512
1512
|
className: "flex flex-col gap-2",
|
|
1513
1513
|
children: [/* @__PURE__ */ Y("p", {
|
|
@@ -1528,13 +1528,13 @@ function un({ onInvitePress: e }) {
|
|
|
1528
1528
|
}
|
|
1529
1529
|
//#endregion
|
|
1530
1530
|
//#region src/components/auth/organization/organization-invitations.tsx
|
|
1531
|
-
function
|
|
1532
|
-
let { authClient: n, localization: r } = p(), { localization: i, roles: a } = m($), { data: o, isPending: s } = oe(n), { isPending: c } =
|
|
1531
|
+
function un({ className: e, ...t }) {
|
|
1532
|
+
let { authClient: n, localization: r } = p(), { localization: i, roles: a } = m($), { data: o, isPending: s } = oe(n), { isPending: c } = w(n, { permissions: { invitation: ["cancel"] } }), l = s || c, [u, d] = q(), [f, h] = q("all"), [g, _] = q("all"), [v, y] = q(""), b = at(() => o?.filter((e) => (f === "all" || e.role === f) && (g === "all" || e.status === g) && e.email.toLowerCase().includes(v.toLowerCase())), [
|
|
1533
1533
|
v,
|
|
1534
1534
|
o,
|
|
1535
1535
|
f,
|
|
1536
1536
|
g
|
|
1537
|
-
]), x =
|
|
1537
|
+
]), x = at(() => !u || !b ? b : [...b].sort((e, t) => {
|
|
1538
1538
|
let n = u.column, r = 0;
|
|
1539
1539
|
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;
|
|
1540
1540
|
}), [u, b]), [S, C] = q(!1);
|
|
@@ -1571,7 +1571,7 @@ function dn({ className: e, ...t }) {
|
|
|
1571
1571
|
size: "sm",
|
|
1572
1572
|
variant: "secondary",
|
|
1573
1573
|
isDisabled: l,
|
|
1574
|
-
children: [/* @__PURE__ */ Y(
|
|
1574
|
+
children: [/* @__PURE__ */ Y(Ie, {}), i.role]
|
|
1575
1575
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, {
|
|
1576
1576
|
selectionMode: "single",
|
|
1577
1577
|
selectedKeys: new Set([f]),
|
|
@@ -1593,7 +1593,7 @@ function dn({ className: e, ...t }) {
|
|
|
1593
1593
|
size: "sm",
|
|
1594
1594
|
variant: "secondary",
|
|
1595
1595
|
isDisabled: l,
|
|
1596
|
-
children: [/* @__PURE__ */ Y(
|
|
1596
|
+
children: [/* @__PURE__ */ Y(Ie, {}), i.status]
|
|
1597
1597
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, {
|
|
1598
1598
|
selectionMode: "single",
|
|
1599
1599
|
selectedKeys: new Set([g]),
|
|
@@ -1702,13 +1702,13 @@ function dn({ className: e, ...t }) {
|
|
|
1702
1702
|
children: i.actions
|
|
1703
1703
|
})
|
|
1704
1704
|
] }), /* @__PURE__ */ Y(H.Body, {
|
|
1705
|
-
renderEmptyState: () => /* @__PURE__ */ Y(
|
|
1706
|
-
children: l ? /* @__PURE__ */ Y(
|
|
1705
|
+
renderEmptyState: () => /* @__PURE__ */ Y(ln, { onInvitePress: () => C(!0) }),
|
|
1706
|
+
children: l ? /* @__PURE__ */ Y(sn, {}) : x?.map((e) => /* @__PURE__ */ Y(cn, { invitation: e }, e.id))
|
|
1707
1707
|
})]
|
|
1708
1708
|
}) }) })
|
|
1709
1709
|
]
|
|
1710
1710
|
}),
|
|
1711
|
-
/* @__PURE__ */ Y(
|
|
1711
|
+
/* @__PURE__ */ Y(rn, {
|
|
1712
1712
|
isOpen: S,
|
|
1713
1713
|
onOpenChange: C
|
|
1714
1714
|
})
|
|
@@ -1717,7 +1717,7 @@ function dn({ className: e, ...t }) {
|
|
|
1717
1717
|
}
|
|
1718
1718
|
//#endregion
|
|
1719
1719
|
//#region src/components/auth/organization/organization-member-row-skeleton.tsx
|
|
1720
|
-
function
|
|
1720
|
+
function dn() {
|
|
1721
1721
|
return /* @__PURE__ */ X(H.Row, { children: [
|
|
1722
1722
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(n, { isPending: !0 }) }),
|
|
1723
1723
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(B, { className: "h-4 w-18 rounded-lg" }) }),
|
|
@@ -1729,7 +1729,7 @@ function fn() {
|
|
|
1729
1729
|
}
|
|
1730
1730
|
//#endregion
|
|
1731
1731
|
//#region src/components/auth/organization/remove-member-dialog.tsx
|
|
1732
|
-
function
|
|
1732
|
+
function fn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
1733
1733
|
let { authClient: i, localization: a } = p(), { localization: o, roles: s } = m($), { mutate: c, isPending: l } = fe(i, { onSuccess: () => {
|
|
1734
1734
|
t(!1), K.success(o.memberRemoved);
|
|
1735
1735
|
} });
|
|
@@ -1740,7 +1740,7 @@ function pn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
|
1740
1740
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
1741
1741
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
1742
1742
|
status: "danger",
|
|
1743
|
-
children: /* @__PURE__ */ Y(
|
|
1743
|
+
children: /* @__PURE__ */ Y(qe, {})
|
|
1744
1744
|
}), /* @__PURE__ */ Y(O.Heading, { children: o.removeMember })] }),
|
|
1745
1745
|
/* @__PURE__ */ X(O.Body, {
|
|
1746
1746
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -1781,9 +1781,9 @@ function pn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
|
1781
1781
|
}
|
|
1782
1782
|
//#endregion
|
|
1783
1783
|
//#region src/components/auth/organization/organization-member-row.tsx
|
|
1784
|
-
function
|
|
1785
|
-
let { authClient: i } = p(), { localization: a, roles: o } = m($), { data: s } = E(i), { data: c, isPending: l } =
|
|
1786
|
-
return f ? /* @__PURE__ */ Y(
|
|
1784
|
+
function pn({ member: e, isOwner: t, organization: r }) {
|
|
1785
|
+
let { authClient: i } = p(), { localization: a, roles: o } = m($), { data: s } = E(i), { data: c, isPending: l } = w(i, { permissions: { member: ["update"] } }), { data: u, isPending: d } = w(i, { permissions: { member: ["delete"] } }), f = l || d, { mutate: h, isPending: g } = be(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);
|
|
1786
|
+
return f ? /* @__PURE__ */ Y(dn, {}) : /* @__PURE__ */ X(H.Row, { children: [
|
|
1787
1787
|
/* @__PURE__ */ Y(H.Cell, { children: /* @__PURE__ */ Y(n, { user: e.user }) }),
|
|
1788
1788
|
/* @__PURE__ */ Y(H.Cell, { children: _ }),
|
|
1789
1789
|
/* @__PURE__ */ X(H.Cell, { children: [/* @__PURE__ */ X("div", {
|
|
@@ -1797,7 +1797,7 @@ function mn({ member: e, isOwner: t, organization: r }) {
|
|
|
1797
1797
|
children: g ? /* @__PURE__ */ Y(V, {
|
|
1798
1798
|
color: "current",
|
|
1799
1799
|
size: "sm"
|
|
1800
|
-
}) : /* @__PURE__ */ Y(
|
|
1800
|
+
}) : /* @__PURE__ */ Y(Ue, {})
|
|
1801
1801
|
}), /* @__PURE__ */ Y(M.Popover, {
|
|
1802
1802
|
className: "min-w-fit",
|
|
1803
1803
|
children: /* @__PURE__ */ Y(M.Menu, { children: v.map(([t, n]) => /* @__PURE__ */ Y(M.Item, {
|
|
@@ -1815,20 +1815,20 @@ function mn({ member: e, isOwner: t, organization: r }) {
|
|
|
1815
1815
|
variant: "danger-soft",
|
|
1816
1816
|
"aria-label": a.leaveOrganization,
|
|
1817
1817
|
onPress: () => C(!0),
|
|
1818
|
-
children: /* @__PURE__ */ Y(
|
|
1818
|
+
children: /* @__PURE__ */ Y(we, {})
|
|
1819
1819
|
}) : u?.success && /* @__PURE__ */ Y(k, {
|
|
1820
1820
|
isIconOnly: !0,
|
|
1821
1821
|
size: "sm",
|
|
1822
1822
|
variant: "danger-soft",
|
|
1823
1823
|
"aria-label": a.removeMember,
|
|
1824
1824
|
onPress: () => x(!0),
|
|
1825
|
-
children: /* @__PURE__ */ Y(
|
|
1825
|
+
children: /* @__PURE__ */ Y(qe, {})
|
|
1826
1826
|
})]
|
|
1827
|
-
}), y && r ? /* @__PURE__ */ Y(
|
|
1827
|
+
}), y && r ? /* @__PURE__ */ Y(an, {
|
|
1828
1828
|
isOpen: S,
|
|
1829
1829
|
onOpenChange: C,
|
|
1830
1830
|
organization: r
|
|
1831
|
-
}) : u?.success && /* @__PURE__ */ Y(
|
|
1831
|
+
}) : u?.success && /* @__PURE__ */ Y(fn, {
|
|
1832
1832
|
isOpen: b,
|
|
1833
1833
|
onOpenChange: x,
|
|
1834
1834
|
member: e
|
|
@@ -1837,15 +1837,15 @@ function mn({ member: e, isOwner: t, organization: r }) {
|
|
|
1837
1837
|
}
|
|
1838
1838
|
//#endregion
|
|
1839
1839
|
//#region src/components/auth/organization/organization-members.tsx
|
|
1840
|
-
function
|
|
1841
|
-
let { authClient: n } = p(), { localization: r, roles: i } = m($), { data: a } = E(n), { data: o, isPending: s } = d(n), { data: c, isPending: l } = se(n), { isPending: u } =
|
|
1840
|
+
function mn({ className: e, ...t }) {
|
|
1841
|
+
let { authClient: n } = p(), { localization: r, roles: i } = m($), { data: a } = E(n), { data: o, isPending: s } = d(n), { data: c, isPending: l } = se(n), { isPending: u } = w(n, { permissions: { member: ["update"] } }), { isPending: f } = w(n, { permissions: { member: ["delete"] } }), h = s || l || u || f, [g, _] = q(), [v, y] = q("all"), [b, x] = q(""), S = at(() => c?.members.filter((e) => (v === "all" || e.role === v) && (e.user.name.toLowerCase().includes(b.toLowerCase()) || e.user.email.toLowerCase().includes(b.toLowerCase()))), [
|
|
1842
1842
|
b,
|
|
1843
1843
|
c?.members,
|
|
1844
1844
|
v
|
|
1845
|
-
]), C =
|
|
1845
|
+
]), C = at(() => !g || !S ? S : [...S].sort((e, t) => {
|
|
1846
1846
|
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);
|
|
1847
1847
|
return g.direction === "descending" && (a *= -1), a;
|
|
1848
|
-
}), [g, S]), [
|
|
1848
|
+
}), [g, S]), [ee, te] = q(!1), ne = c?.members.some((e) => e.role === "owner" && e.userId === a?.user.id);
|
|
1849
1849
|
return /* @__PURE__ */ X("div", {
|
|
1850
1850
|
className: G("flex flex-col gap-3", e),
|
|
1851
1851
|
...t,
|
|
@@ -1859,7 +1859,7 @@ function hn({ className: e, ...t }) {
|
|
|
1859
1859
|
className: "shrink-0",
|
|
1860
1860
|
size: "sm",
|
|
1861
1861
|
isDisabled: h,
|
|
1862
|
-
onPress: () =>
|
|
1862
|
+
onPress: () => te(!0),
|
|
1863
1863
|
children: r.inviteMember
|
|
1864
1864
|
})]
|
|
1865
1865
|
}),
|
|
@@ -1886,7 +1886,7 @@ function hn({ className: e, ...t }) {
|
|
|
1886
1886
|
size: "sm",
|
|
1887
1887
|
variant: "secondary",
|
|
1888
1888
|
isDisabled: h,
|
|
1889
|
-
children: [/* @__PURE__ */ Y(
|
|
1889
|
+
children: [/* @__PURE__ */ Y(Ie, {}), r.role]
|
|
1890
1890
|
}), /* @__PURE__ */ Y(M.Popover, { children: /* @__PURE__ */ X(M.Menu, {
|
|
1891
1891
|
selectionMode: "single",
|
|
1892
1892
|
selectedKeys: new Set([v]),
|
|
@@ -1953,34 +1953,34 @@ function hn({ className: e, ...t }) {
|
|
|
1953
1953
|
className: "text-end",
|
|
1954
1954
|
children: r.actions
|
|
1955
1955
|
})
|
|
1956
|
-
] }), /* @__PURE__ */ Y(H.Body, { children: h ? /* @__PURE__ */ Y(
|
|
1956
|
+
] }), /* @__PURE__ */ Y(H.Body, { children: h ? /* @__PURE__ */ Y(dn, {}) : !!o && C?.map((e) => /* @__PURE__ */ Y(pn, {
|
|
1957
1957
|
member: e,
|
|
1958
|
-
isOwner:
|
|
1958
|
+
isOwner: ne,
|
|
1959
1959
|
organization: o
|
|
1960
1960
|
}, e.id)) })]
|
|
1961
1961
|
}) }) })
|
|
1962
1962
|
]
|
|
1963
1963
|
}),
|
|
1964
|
-
/* @__PURE__ */ Y(
|
|
1965
|
-
isOpen:
|
|
1966
|
-
onOpenChange:
|
|
1964
|
+
/* @__PURE__ */ Y(rn, {
|
|
1965
|
+
isOpen: ee,
|
|
1966
|
+
onOpenChange: te
|
|
1967
1967
|
})
|
|
1968
1968
|
]
|
|
1969
1969
|
});
|
|
1970
1970
|
}
|
|
1971
1971
|
//#endregion
|
|
1972
1972
|
//#region src/components/auth/organization/organization-people.tsx
|
|
1973
|
-
function
|
|
1973
|
+
function hn({ className: e, ...t }) {
|
|
1974
1974
|
return /* @__PURE__ */ X("div", {
|
|
1975
1975
|
className: G("flex flex-col gap-4 md:gap-6", e),
|
|
1976
1976
|
...t,
|
|
1977
|
-
children: [/* @__PURE__ */ Y(
|
|
1977
|
+
children: [/* @__PURE__ */ Y(mn, {}), /* @__PURE__ */ Y(un, {})]
|
|
1978
1978
|
});
|
|
1979
1979
|
}
|
|
1980
1980
|
//#endregion
|
|
1981
1981
|
//#region src/components/auth/organization/organization-danger-zone.tsx
|
|
1982
|
-
function
|
|
1983
|
-
let { authClient: r, localization: i } = p(), { data: a, isPending: o } =
|
|
1982
|
+
function gn({ className: e, variant: t, ...n }) {
|
|
1983
|
+
let { authClient: r, localization: i } = p(), { data: a, isPending: o } = w(r, { permissions: { organization: ["delete"] } }), s = !!a?.success;
|
|
1984
1984
|
return /* @__PURE__ */ X("div", {
|
|
1985
1985
|
className: G("flex w-full flex-col", e),
|
|
1986
1986
|
...n,
|
|
@@ -1991,19 +1991,19 @@ function _n({ className: e, variant: t, ...n }) {
|
|
|
1991
1991
|
variant: t,
|
|
1992
1992
|
children: /* @__PURE__ */ Y(A.Content, {
|
|
1993
1993
|
className: "gap-0",
|
|
1994
|
-
children: o ? /* @__PURE__ */ Y(
|
|
1994
|
+
children: o ? /* @__PURE__ */ Y(en, {}) : /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(on, {}), s && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Y(tn, {})] })] })
|
|
1995
1995
|
})
|
|
1996
1996
|
})]
|
|
1997
1997
|
});
|
|
1998
1998
|
}
|
|
1999
1999
|
//#endregion
|
|
2000
2000
|
//#region src/components/auth/organization/organization-profile.tsx
|
|
2001
|
-
function
|
|
2001
|
+
function _n({ className: e, variant: t, ...n }) {
|
|
2002
2002
|
let { authClient: r, localization: i } = p(), { localization: a } = m($), { data: o } = d(r), [s, c] = q(o?.slug ?? "");
|
|
2003
|
-
|
|
2003
|
+
it(() => {
|
|
2004
2004
|
c(o?.slug ?? "");
|
|
2005
2005
|
}, [o?.slug]);
|
|
2006
|
-
let { mutate: l, isPending: u } =
|
|
2006
|
+
let { mutate: l, isPending: u } = xe(r, { onSuccess: () => K.success(a.organizationUpdatedSuccess) });
|
|
2007
2007
|
function f(e) {
|
|
2008
2008
|
e.preventDefault(), o && l({ data: {
|
|
2009
2009
|
name: new FormData(e.currentTarget).get("name"),
|
|
@@ -2022,7 +2022,7 @@ function vn({ className: e, variant: t, ...n }) {
|
|
|
2022
2022
|
onSubmit: f,
|
|
2023
2023
|
className: "flex flex-col gap-4",
|
|
2024
2024
|
children: [
|
|
2025
|
-
/* @__PURE__ */ Y(
|
|
2025
|
+
/* @__PURE__ */ Y(Qt, {}),
|
|
2026
2026
|
/* @__PURE__ */ X(W, {
|
|
2027
2027
|
name: "name",
|
|
2028
2028
|
defaultValue: o?.name,
|
|
@@ -2039,7 +2039,7 @@ function vn({ className: e, variant: t, ...n }) {
|
|
|
2039
2039
|
/* @__PURE__ */ Y(N, {})
|
|
2040
2040
|
]
|
|
2041
2041
|
}, `${o?.id}-${o?.name}-name`),
|
|
2042
|
-
o ? /* @__PURE__ */ Y(
|
|
2042
|
+
o ? /* @__PURE__ */ Y(Bt, {
|
|
2043
2043
|
value: s,
|
|
2044
2044
|
onChange: c,
|
|
2045
2045
|
currentSlug: o.slug,
|
|
@@ -2066,26 +2066,26 @@ function vn({ className: e, variant: t, ...n }) {
|
|
|
2066
2066
|
}
|
|
2067
2067
|
//#endregion
|
|
2068
2068
|
//#region src/components/auth/organization/organization-settings.tsx
|
|
2069
|
-
function
|
|
2069
|
+
function vn({ className: e, variant: t, ...n }) {
|
|
2070
2070
|
let { plugins: r } = p();
|
|
2071
2071
|
return /* @__PURE__ */ X("div", {
|
|
2072
2072
|
className: G("flex flex-col gap-4 md:gap-6", e),
|
|
2073
2073
|
...n,
|
|
2074
2074
|
children: [
|
|
2075
|
-
/* @__PURE__ */ Y(
|
|
2075
|
+
/* @__PURE__ */ Y(_n, { variant: t }),
|
|
2076
2076
|
r.flatMap((e) => e.organizationCards?.map((n, r) => /* @__PURE__ */ Y(n, { variant: t }, `${e.id}-${r.toString()}`))),
|
|
2077
|
-
/* @__PURE__ */ Y(
|
|
2077
|
+
/* @__PURE__ */ Y(gn, { variant: t })
|
|
2078
2078
|
]
|
|
2079
2079
|
});
|
|
2080
2080
|
}
|
|
2081
2081
|
//#endregion
|
|
2082
2082
|
//#region src/components/auth/organization/organization.tsx
|
|
2083
|
-
function
|
|
2083
|
+
function yn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
2084
2084
|
if (!i && !n) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
|
|
2085
2085
|
let { authClient: o, basePaths: s, localization: c, navigate: l } = p();
|
|
2086
2086
|
h(o);
|
|
2087
2087
|
let { localization: u, viewPaths: f, slug: g } = m($), { data: _, isPending: v } = d(o);
|
|
2088
|
-
|
|
2088
|
+
it(() => {
|
|
2089
2089
|
!v && !_ && l({
|
|
2090
2090
|
to: `${s.settings}/${f.settings?.organizations}`,
|
|
2091
2091
|
replace: !0
|
|
@@ -2097,7 +2097,7 @@ function bn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
2097
2097
|
f.settings?.organizations,
|
|
2098
2098
|
_
|
|
2099
2099
|
]);
|
|
2100
|
-
let y =
|
|
2100
|
+
let y = at(() => i || Object.entries(f.organization).find(([, e]) => e === n)?.[0], [
|
|
2101
2101
|
i,
|
|
2102
2102
|
n,
|
|
2103
2103
|
f.organization
|
|
@@ -2124,7 +2124,7 @@ function bn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
2124
2124
|
inline: "center"
|
|
2125
2125
|
}),
|
|
2126
2126
|
children: [
|
|
2127
|
-
/* @__PURE__ */ Y(
|
|
2127
|
+
/* @__PURE__ */ Y(Le, { className: "text-muted" }),
|
|
2128
2128
|
c.settings.settings,
|
|
2129
2129
|
/* @__PURE__ */ Y(U.Indicator, {})
|
|
2130
2130
|
]
|
|
@@ -2137,7 +2137,7 @@ function bn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
2137
2137
|
inline: "center"
|
|
2138
2138
|
}),
|
|
2139
2139
|
children: [
|
|
2140
|
-
/* @__PURE__ */ Y(
|
|
2140
|
+
/* @__PURE__ */ Y(We, { className: "text-muted" }),
|
|
2141
2141
|
u.people,
|
|
2142
2142
|
/* @__PURE__ */ Y(U.Indicator, {})
|
|
2143
2143
|
]
|
|
@@ -2146,22 +2146,22 @@ function bn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
|
2146
2146
|
/* @__PURE__ */ Y(U.Panel, {
|
|
2147
2147
|
id: "settings",
|
|
2148
2148
|
className: "px-0",
|
|
2149
|
-
children: /* @__PURE__ */ Y(
|
|
2149
|
+
children: /* @__PURE__ */ Y(vn, { variant: r })
|
|
2150
2150
|
}),
|
|
2151
2151
|
/* @__PURE__ */ Y(U.Panel, {
|
|
2152
2152
|
id: "people",
|
|
2153
2153
|
className: "px-0",
|
|
2154
|
-
children: /* @__PURE__ */ Y(
|
|
2154
|
+
children: /* @__PURE__ */ Y(hn, {})
|
|
2155
2155
|
})
|
|
2156
2156
|
]
|
|
2157
2157
|
});
|
|
2158
2158
|
}
|
|
2159
2159
|
//#endregion
|
|
2160
2160
|
//#region src/components/auth/organization/organization-switcher.tsx
|
|
2161
|
-
function
|
|
2162
|
-
let { authClient: h, navigate: g, basePaths: _, localization: v, viewPaths: y } = p(), { data: b, isPending: x } = E(h), { localization: S, viewPaths: C, slug:
|
|
2161
|
+
function bn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hideSlug: a = !0, setActive: o, placement: s, variant: c = "ghost", size: l = "md", trigger: u, ...f }) {
|
|
2162
|
+
let { authClient: h, navigate: g, basePaths: _, localization: v, viewPaths: y } = p(), { data: b, isPending: x } = E(h), { localization: S, viewPaths: C, slug: ee } = m($), { data: w, isPending: te } = d(h), { data: ne, isPending: re } = ce(h), { mutate: ie } = me(h), T = x || !!b && (re || te), [ae, oe] = q(!1), [se, le] = q(!1);
|
|
2163
2163
|
function ue(e) {
|
|
2164
|
-
o ? o(e) :
|
|
2164
|
+
o ? o(e) : ee === void 0 ? ie({ organizationId: e?.id ?? null }) : g({ to: e ? `${_.organization}/${e.slug}/${C.organization.settings}` : `${_.settings}/${y.settings.account}` });
|
|
2165
2165
|
}
|
|
2166
2166
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X(M, {
|
|
2167
2167
|
isOpen: se,
|
|
@@ -2169,15 +2169,15 @@ function xn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hid
|
|
|
2169
2169
|
children: [u ? /* @__PURE__ */ Y(M.Trigger, { children: u }) : /* @__PURE__ */ X(k, {
|
|
2170
2170
|
variant: c,
|
|
2171
2171
|
className: G("h-auto px-2 py-2 text-left", e),
|
|
2172
|
-
isDisabled: !b ||
|
|
2172
|
+
isDisabled: !b || T,
|
|
2173
2173
|
"aria-label": S.organization,
|
|
2174
2174
|
...f,
|
|
2175
|
-
children: [
|
|
2175
|
+
children: [T ? /* @__PURE__ */ Y(Q, {
|
|
2176
2176
|
size: l,
|
|
2177
2177
|
isPending: !0,
|
|
2178
2178
|
hideRole: !0,
|
|
2179
2179
|
hideSlug: a
|
|
2180
|
-
}) :
|
|
2180
|
+
}) : w ? /* @__PURE__ */ Y(Q, {
|
|
2181
2181
|
size: l,
|
|
2182
2182
|
hideRole: !0,
|
|
2183
2183
|
hideSlug: a
|
|
@@ -2189,43 +2189,43 @@ function xn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hid
|
|
|
2189
2189
|
hideRole: !0,
|
|
2190
2190
|
hideSlug: a,
|
|
2191
2191
|
organization: { name: S.organization }
|
|
2192
|
-
}), /* @__PURE__ */ Y(
|
|
2192
|
+
}), /* @__PURE__ */ Y(De, { className: "size-3 shrink-0 text-muted" })]
|
|
2193
2193
|
}), /* @__PURE__ */ X(M.Popover, {
|
|
2194
2194
|
placement: s,
|
|
2195
2195
|
className: "max-w-svw",
|
|
2196
|
-
children: [
|
|
2196
|
+
children: [w ? /* @__PURE__ */ X("div", {
|
|
2197
2197
|
className: "flex items-center justify-between gap-4 px-4 pt-3",
|
|
2198
2198
|
children: [/* @__PURE__ */ Y(Q, {
|
|
2199
2199
|
hideRole: !0,
|
|
2200
2200
|
hideSlug: a,
|
|
2201
|
-
organization:
|
|
2202
|
-
}), !i && /* @__PURE__ */ X(
|
|
2203
|
-
href:
|
|
2204
|
-
className: G(
|
|
2201
|
+
organization: w
|
|
2202
|
+
}), !i && /* @__PURE__ */ X($e, {
|
|
2203
|
+
href: ee ? `${_.organization}/${ee}/${C.organization.settings}` : `${_.organization}/${C.organization.settings}`,
|
|
2204
|
+
className: G(ct({
|
|
2205
2205
|
variant: "outline",
|
|
2206
2206
|
size: "sm"
|
|
2207
2207
|
}), "shrink-0 gap-2"),
|
|
2208
2208
|
onPress: () => le(!1),
|
|
2209
|
-
children: [/* @__PURE__ */ Y(
|
|
2209
|
+
children: [/* @__PURE__ */ Y(Le, { className: "text-muted" }), S.manage]
|
|
2210
2210
|
})]
|
|
2211
|
-
}) : !
|
|
2211
|
+
}) : !T && b?.user && !r ? /* @__PURE__ */ X("div", {
|
|
2212
2212
|
className: "flex items-center justify-between gap-4 px-4 pt-3",
|
|
2213
|
-
children: [/* @__PURE__ */ Y(n, { hideSubtitle: a }), !i && /* @__PURE__ */ X(
|
|
2213
|
+
children: [/* @__PURE__ */ Y(n, { hideSubtitle: a }), !i && /* @__PURE__ */ X($e, {
|
|
2214
2214
|
href: `${_.settings}/${y.settings.account}`,
|
|
2215
|
-
className: G(
|
|
2215
|
+
className: G(ct({
|
|
2216
2216
|
variant: "outline",
|
|
2217
2217
|
size: "sm"
|
|
2218
2218
|
}), "shrink-0 gap-2"),
|
|
2219
2219
|
onPress: () => le(!1),
|
|
2220
|
-
children: [/* @__PURE__ */ Y(
|
|
2220
|
+
children: [/* @__PURE__ */ Y(Le, { className: "text-muted" }), v.settings.settings]
|
|
2221
2221
|
})]
|
|
2222
2222
|
}) : null, /* @__PURE__ */ X(M.Menu, { children: [
|
|
2223
|
-
!!
|
|
2223
|
+
!!w && !r && /* @__PURE__ */ Y(M.Item, {
|
|
2224
2224
|
textValue: S.personalAccount,
|
|
2225
2225
|
onPress: () => ue(null),
|
|
2226
2226
|
children: /* @__PURE__ */ Y(n, { hideSubtitle: a })
|
|
2227
2227
|
}),
|
|
2228
|
-
|
|
2228
|
+
ne?.filter((e) => e.id !== w?.id)?.map((e) => /* @__PURE__ */ Y(M.Item, {
|
|
2229
2229
|
textValue: e.name,
|
|
2230
2230
|
onPress: () => ue(e),
|
|
2231
2231
|
children: /* @__PURE__ */ Y(Q, {
|
|
@@ -2237,19 +2237,19 @@ function xn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hid
|
|
|
2237
2237
|
!t && /* @__PURE__ */ X(M.Item, {
|
|
2238
2238
|
textValue: S.createOrganization,
|
|
2239
2239
|
onPress: () => oe(!0),
|
|
2240
|
-
children: [/* @__PURE__ */ Y(
|
|
2240
|
+
children: [/* @__PURE__ */ Y(Oe, { className: "text-muted" }), /* @__PURE__ */ Y(L, { children: S.createOrganization })]
|
|
2241
2241
|
})
|
|
2242
2242
|
] })]
|
|
2243
2243
|
})]
|
|
2244
|
-
}), /* @__PURE__ */ Y(
|
|
2244
|
+
}), /* @__PURE__ */ Y(Vt, {
|
|
2245
2245
|
isOpen: ae,
|
|
2246
2246
|
onOpenChange: oe
|
|
2247
2247
|
})] });
|
|
2248
2248
|
}
|
|
2249
2249
|
//#endregion
|
|
2250
2250
|
//#region src/components/auth/passkey/passkey-button.tsx
|
|
2251
|
-
function
|
|
2252
|
-
let { authClient: t, localization: n, redirectTo: i, navigate: a } = p(), { localization: o } = m(
|
|
2251
|
+
function xn({ view: e }) {
|
|
2252
|
+
let { authClient: t, localization: n, redirectTo: i, navigate: a } = p(), { localization: o } = m(Sn), { mutate: s, isPending: c } = ve(t, { onSuccess: () => a({ to: i }) }), l = Z({ mutationKey: r.signIn.all }) + Z({ mutationKey: r.signUp.all }) > 0;
|
|
2253
2253
|
return e === "signUp" ? null : /* @__PURE__ */ X(k, {
|
|
2254
2254
|
className: "w-full",
|
|
2255
2255
|
variant: "tertiary",
|
|
@@ -2259,20 +2259,20 @@ function Sn({ view: e }) {
|
|
|
2259
2259
|
children: [c ? /* @__PURE__ */ Y(V, {
|
|
2260
2260
|
color: "current",
|
|
2261
2261
|
size: "sm"
|
|
2262
|
-
}) : /* @__PURE__ */ Y(
|
|
2262
|
+
}) : /* @__PURE__ */ Y(Fe, {}), n.auth.continueWith.replace("{{provider}}", o.passkey)]
|
|
2263
2263
|
});
|
|
2264
2264
|
}
|
|
2265
2265
|
//#endregion
|
|
2266
2266
|
//#region src/lib/auth/passkey-plugin.ts
|
|
2267
|
-
var
|
|
2267
|
+
var Sn = a(mt.id, (e = {}) => ({
|
|
2268
2268
|
...mt(e),
|
|
2269
|
-
authButtons: [
|
|
2270
|
-
securityCards: [
|
|
2269
|
+
authButtons: [xn],
|
|
2270
|
+
securityCards: [On]
|
|
2271
2271
|
}));
|
|
2272
2272
|
//#endregion
|
|
2273
2273
|
//#region src/components/auth/passkey/add-passkey-dialog.tsx
|
|
2274
|
-
function
|
|
2275
|
-
let { authClient: n, localization: r } = p(), { localization: i } = m(
|
|
2274
|
+
function Cn({ isOpen: e, onOpenChange: t }) {
|
|
2275
|
+
let { authClient: n, localization: r } = p(), { localization: i } = m(Sn), { mutate: a, isPending: o } = f(n), s = (e) => {
|
|
2276
2276
|
t(e);
|
|
2277
2277
|
};
|
|
2278
2278
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
@@ -2288,7 +2288,7 @@ function wn({ isOpen: e, onOpenChange: t }) {
|
|
|
2288
2288
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
2289
2289
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
2290
2290
|
status: "default",
|
|
2291
|
-
children: /* @__PURE__ */ Y(
|
|
2291
|
+
children: /* @__PURE__ */ Y(Fe, {})
|
|
2292
2292
|
}), /* @__PURE__ */ Y(O.Heading, { children: i.addPasskey })] }),
|
|
2293
2293
|
/* @__PURE__ */ X(O.Body, {
|
|
2294
2294
|
className: "overflow-visible",
|
|
@@ -2330,8 +2330,8 @@ function wn({ isOpen: e, onOpenChange: t }) {
|
|
|
2330
2330
|
}
|
|
2331
2331
|
//#endregion
|
|
2332
2332
|
//#region src/components/auth/passkey/delete-passkey-dialog.tsx
|
|
2333
|
-
function
|
|
2334
|
-
let { authClient: r, localization: i } = p(), { localization: a } = m(
|
|
2333
|
+
function wn({ isOpen: e, onOpenChange: t, passkey: n }) {
|
|
2334
|
+
let { authClient: r, localization: i } = p(), { localization: a } = m(Sn), o = n.name || a.passkey, { mutate: s, isPending: c } = S(r, { onSuccess: () => t(!1) });
|
|
2335
2335
|
return /* @__PURE__ */ Y(O.Backdrop, {
|
|
2336
2336
|
isOpen: e,
|
|
2337
2337
|
onOpenChange: t,
|
|
@@ -2339,7 +2339,7 @@ function Tn({ isOpen: e, onOpenChange: t, passkey: n }) {
|
|
|
2339
2339
|
/* @__PURE__ */ Y(O.CloseTrigger, {}),
|
|
2340
2340
|
/* @__PURE__ */ X(O.Header, { children: [/* @__PURE__ */ Y(O.Icon, {
|
|
2341
2341
|
status: "danger",
|
|
2342
|
-
children: /* @__PURE__ */ Y(
|
|
2342
|
+
children: /* @__PURE__ */ Y(Fe, {})
|
|
2343
2343
|
}), /* @__PURE__ */ Y(O.Heading, { children: a.deletePasskeyTitle })] }),
|
|
2344
2344
|
/* @__PURE__ */ X(O.Body, {
|
|
2345
2345
|
className: "flex flex-col gap-4 overflow-visible",
|
|
@@ -2371,14 +2371,14 @@ function Tn({ isOpen: e, onOpenChange: t, passkey: n }) {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
//#endregion
|
|
2373
2373
|
//#region src/components/auth/passkey/passkey.tsx
|
|
2374
|
-
function
|
|
2375
|
-
let { localization: t } = p(), { localization: n } = m(
|
|
2374
|
+
function Tn({ passkey: e }) {
|
|
2375
|
+
let { localization: t } = p(), { localization: n } = m(Sn), [r, i] = q(!1), a = e.name || n.passkey;
|
|
2376
2376
|
return /* @__PURE__ */ X("div", {
|
|
2377
2377
|
className: "flex items-center gap-3",
|
|
2378
2378
|
children: [
|
|
2379
2379
|
/* @__PURE__ */ Y("div", {
|
|
2380
2380
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
2381
|
-
children: /* @__PURE__ */ Y(
|
|
2381
|
+
children: /* @__PURE__ */ Y(Fe, { className: "size-4.5" })
|
|
2382
2382
|
}),
|
|
2383
2383
|
/* @__PURE__ */ X("div", {
|
|
2384
2384
|
className: "flex min-w-0 flex-col",
|
|
@@ -2401,7 +2401,7 @@ function En({ passkey: e }) {
|
|
|
2401
2401
|
"aria-label": n.deletePasskey.replace("{{name}}", a),
|
|
2402
2402
|
children: [/* @__PURE__ */ Y(D, {}), t.settings.delete]
|
|
2403
2403
|
}),
|
|
2404
|
-
/* @__PURE__ */ Y(
|
|
2404
|
+
/* @__PURE__ */ Y(wn, {
|
|
2405
2405
|
isOpen: r,
|
|
2406
2406
|
onOpenChange: i,
|
|
2407
2407
|
passkey: e
|
|
@@ -2411,7 +2411,7 @@ function En({ passkey: e }) {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
//#endregion
|
|
2413
2413
|
//#region src/components/auth/passkey/passkey-skeleton.tsx
|
|
2414
|
-
function
|
|
2414
|
+
function En() {
|
|
2415
2415
|
return /* @__PURE__ */ Y("div", {
|
|
2416
2416
|
className: "flex items-center justify-between",
|
|
2417
2417
|
children: /* @__PURE__ */ X("div", {
|
|
@@ -2425,14 +2425,14 @@ function Dn() {
|
|
|
2425
2425
|
}
|
|
2426
2426
|
//#endregion
|
|
2427
2427
|
//#region src/components/auth/passkey/passkeys-empty.tsx
|
|
2428
|
-
function
|
|
2429
|
-
let { localization: t } = m(
|
|
2428
|
+
function Dn({ onAddPress: e }) {
|
|
2429
|
+
let { localization: t } = m(Sn);
|
|
2430
2430
|
return /* @__PURE__ */ X("div", {
|
|
2431
2431
|
className: "flex flex-col items-center justify-center gap-4",
|
|
2432
2432
|
children: [
|
|
2433
2433
|
/* @__PURE__ */ Y("div", {
|
|
2434
2434
|
className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
|
|
2435
|
-
children: /* @__PURE__ */ Y(
|
|
2435
|
+
children: /* @__PURE__ */ Y(Fe, { className: "size-4.5" })
|
|
2436
2436
|
}),
|
|
2437
2437
|
/* @__PURE__ */ X("div", {
|
|
2438
2438
|
className: "flex flex-col items-center justify-center gap-1 text-center",
|
|
@@ -2454,8 +2454,8 @@ function On({ onAddPress: e }) {
|
|
|
2454
2454
|
}
|
|
2455
2455
|
//#endregion
|
|
2456
2456
|
//#region src/components/auth/passkey/passkeys.tsx
|
|
2457
|
-
function
|
|
2458
|
-
let { authClient: r } = p(), { localization: i } = m(
|
|
2457
|
+
function On({ className: e, variant: t, ...n }) {
|
|
2458
|
+
let { authClient: r } = p(), { localization: i } = m(Sn), { data: a, isPending: o } = le(r), [s, c] = q(!1);
|
|
2459
2459
|
return /* @__PURE__ */ X("div", {
|
|
2460
2460
|
className: G("flex flex-col gap-3", e),
|
|
2461
2461
|
children: [
|
|
@@ -2475,9 +2475,9 @@ function kn({ className: e, variant: t, ...n }) {
|
|
|
2475
2475
|
/* @__PURE__ */ Y(A, {
|
|
2476
2476
|
variant: t,
|
|
2477
2477
|
...n,
|
|
2478
|
-
children: /* @__PURE__ */ Y(A.Content, { children: o ? /* @__PURE__ */ Y(
|
|
2478
|
+
children: /* @__PURE__ */ Y(A.Content, { children: o ? /* @__PURE__ */ Y(En, {}) : 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(Tn, { passkey: e })] }, e.id)) : /* @__PURE__ */ Y(Dn, { onAddPress: () => c(!0) }) })
|
|
2479
2479
|
}),
|
|
2480
|
-
/* @__PURE__ */ Y(
|
|
2480
|
+
/* @__PURE__ */ Y(Cn, {
|
|
2481
2481
|
isOpen: s,
|
|
2482
2482
|
onOpenChange: c
|
|
2483
2483
|
})
|
|
@@ -2486,17 +2486,17 @@ function kn({ className: e, variant: t, ...n }) {
|
|
|
2486
2486
|
}
|
|
2487
2487
|
//#endregion
|
|
2488
2488
|
//#region src/components/auth/theme/theme-toggle-item.tsx
|
|
2489
|
-
var
|
|
2490
|
-
function
|
|
2491
|
-
let { useTheme: e, localization: t } = m(
|
|
2489
|
+
var kn = "[role=\"tab\"][aria-selected=\"true\"]";
|
|
2490
|
+
function An() {
|
|
2491
|
+
let { useTheme: e, localization: t } = m(jn), { theme: n, setTheme: r, themes: i = [] } = e();
|
|
2492
2492
|
return /* @__PURE__ */ X(M.Item, {
|
|
2493
2493
|
className: "py-1 pe-2",
|
|
2494
2494
|
onFocus: (e) => {
|
|
2495
|
-
e.target === e.currentTarget && e.currentTarget.querySelector(
|
|
2495
|
+
e.target === e.currentTarget && e.currentTarget.querySelector(kn)?.focus({ preventScroll: !0 });
|
|
2496
2496
|
},
|
|
2497
2497
|
shouldCloseOnSelect: !1,
|
|
2498
2498
|
children: [
|
|
2499
|
-
/* @__PURE__ */ Y(
|
|
2499
|
+
/* @__PURE__ */ Y(Ve, { className: "text-muted" }),
|
|
2500
2500
|
/* @__PURE__ */ Y(L, { children: t.theme }),
|
|
2501
2501
|
/* @__PURE__ */ Y(U, {
|
|
2502
2502
|
className: "ml-auto",
|
|
@@ -2521,17 +2521,17 @@ function jn() {
|
|
|
2521
2521
|
i.includes("system") && /* @__PURE__ */ X(U.Tab, {
|
|
2522
2522
|
id: "system",
|
|
2523
2523
|
"aria-label": t.system,
|
|
2524
|
-
children: [/* @__PURE__ */ Y(
|
|
2524
|
+
children: [/* @__PURE__ */ Y(Me, { className: "size-3" }), /* @__PURE__ */ Y(U.Indicator, {})]
|
|
2525
2525
|
}),
|
|
2526
2526
|
i.includes("light") && /* @__PURE__ */ X(U.Tab, {
|
|
2527
2527
|
id: "light",
|
|
2528
2528
|
"aria-label": t.light,
|
|
2529
|
-
children: [/* @__PURE__ */ Y(
|
|
2529
|
+
children: [/* @__PURE__ */ Y(Ke, { className: "size-3" }), /* @__PURE__ */ Y(U.Indicator, {})]
|
|
2530
2530
|
}),
|
|
2531
2531
|
i.includes("dark") && /* @__PURE__ */ X(U.Tab, {
|
|
2532
2532
|
id: "dark",
|
|
2533
2533
|
"aria-label": t.dark,
|
|
2534
|
-
children: [/* @__PURE__ */ Y(
|
|
2534
|
+
children: [/* @__PURE__ */ Y(Be, { className: "size-3" }), /* @__PURE__ */ Y(U.Indicator, {})]
|
|
2535
2535
|
})
|
|
2536
2536
|
]
|
|
2537
2537
|
})
|
|
@@ -2542,7 +2542,7 @@ function jn() {
|
|
|
2542
2542
|
}
|
|
2543
2543
|
//#endregion
|
|
2544
2544
|
//#region src/lib/auth/theme-plugin.ts
|
|
2545
|
-
var
|
|
2545
|
+
var jn = a(ht.id, ({ useTheme: e, ...t }) => {
|
|
2546
2546
|
let n = ht({
|
|
2547
2547
|
setTheme: () => {},
|
|
2548
2548
|
...t
|
|
@@ -2554,14 +2554,14 @@ var Mn = a(ht.id, ({ useTheme: e, ...t }) => {
|
|
|
2554
2554
|
setTheme: n.setTheme,
|
|
2555
2555
|
themes: n.themes
|
|
2556
2556
|
})),
|
|
2557
|
-
userMenuItems: [
|
|
2558
|
-
accountCards: [
|
|
2557
|
+
userMenuItems: [An],
|
|
2558
|
+
accountCards: [Mn]
|
|
2559
2559
|
};
|
|
2560
2560
|
});
|
|
2561
2561
|
//#endregion
|
|
2562
2562
|
//#region src/components/auth/theme/appearance.tsx
|
|
2563
|
-
function
|
|
2564
|
-
let { useTheme: r, localization: i } = m(
|
|
2563
|
+
function Mn({ className: e, variant: t, ...n }) {
|
|
2564
|
+
let { useTheme: r, localization: i } = m(jn), { theme: a, setTheme: o, themes: u = [] } = r(), d = rt();
|
|
2565
2565
|
return /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("h2", {
|
|
2566
2566
|
className: G("text-sm font-semibold mb-3"),
|
|
2567
2567
|
children: i.appearance
|
|
@@ -2569,7 +2569,7 @@ function Nn({ className: e, variant: t, ...n }) {
|
|
|
2569
2569
|
className: G("p-4 gap-4", e),
|
|
2570
2570
|
variant: t,
|
|
2571
2571
|
...n,
|
|
2572
|
-
children: /* @__PURE__ */ X(A.Content, { children: [/* @__PURE__ */ Y(L, { children: i.theme }), /* @__PURE__ */ Y(
|
|
2572
|
+
children: /* @__PURE__ */ X(A.Content, { children: [/* @__PURE__ */ Y(L, { children: i.theme }), /* @__PURE__ */ Y(tt, {
|
|
2573
2573
|
variant: t === "transparent" ? "secondary" : "primary",
|
|
2574
2574
|
value: d ? a : "",
|
|
2575
2575
|
onChange: o,
|
|
@@ -2586,7 +2586,7 @@ function Nn({ className: e, variant: t, ...n }) {
|
|
|
2586
2586
|
className: "flex gap-2 justify-between",
|
|
2587
2587
|
children: [/* @__PURE__ */ X("span", {
|
|
2588
2588
|
className: "flex gap-2 items-center",
|
|
2589
|
-
children: [/* @__PURE__ */ Y(
|
|
2589
|
+
children: [/* @__PURE__ */ Y(Me, { className: "text-muted" }), i.system]
|
|
2590
2590
|
}), /* @__PURE__ */ Y(R.Control, { children: /* @__PURE__ */ Y(R.Indicator, {}) })]
|
|
2591
2591
|
}), /* @__PURE__ */ Y(l, { className: "w-full" })]
|
|
2592
2592
|
})
|
|
@@ -2600,7 +2600,7 @@ function Nn({ className: e, variant: t, ...n }) {
|
|
|
2600
2600
|
className: "flex gap-2 justify-between",
|
|
2601
2601
|
children: [/* @__PURE__ */ X("span", {
|
|
2602
2602
|
className: "flex gap-2 items-center",
|
|
2603
|
-
children: [/* @__PURE__ */ Y(
|
|
2603
|
+
children: [/* @__PURE__ */ Y(Ke, { className: "text-muted" }), i.light]
|
|
2604
2604
|
}), /* @__PURE__ */ Y(R.Control, { children: /* @__PURE__ */ Y(R.Indicator, {}) })]
|
|
2605
2605
|
}), /* @__PURE__ */ Y(c, { className: "w-full" })]
|
|
2606
2606
|
})
|
|
@@ -2614,7 +2614,7 @@ function Nn({ className: e, variant: t, ...n }) {
|
|
|
2614
2614
|
className: "flex gap-2 justify-between",
|
|
2615
2615
|
children: [/* @__PURE__ */ X("span", {
|
|
2616
2616
|
className: "flex gap-2 items-center",
|
|
2617
|
-
children: [/* @__PURE__ */ Y(
|
|
2617
|
+
children: [/* @__PURE__ */ Y(Be, { className: "text-muted" }), i.dark]
|
|
2618
2618
|
}), /* @__PURE__ */ Y(R.Control, { children: /* @__PURE__ */ Y(R.Indicator, {}) })]
|
|
2619
2619
|
}), /* @__PURE__ */ Y(s, { className: "w-full" })]
|
|
2620
2620
|
})
|
|
@@ -2626,8 +2626,8 @@ function Nn({ className: e, variant: t, ...n }) {
|
|
|
2626
2626
|
}
|
|
2627
2627
|
//#endregion
|
|
2628
2628
|
//#region src/components/auth/username/username-field.tsx
|
|
2629
|
-
function
|
|
2630
|
-
let { authClient: i } = p(), { localization: a, minUsernameLength: o, maxUsernameLength: s, isUsernameAvailable: c } = m(
|
|
2629
|
+
function Nn({ name: e, field: t, isPending: n, variant: r }) {
|
|
2630
|
+
let { authClient: i } = p(), { localization: a, minUsernameLength: o, maxUsernameLength: s, isUsernameAvailable: c } = m(Pn), l = String(t.defaultValue ?? ""), [u, d] = q(l), { mutate: f, data: h, error: g, reset: _ } = ne(i, { onError: () => {} }), v = _t((e) => {
|
|
2631
2631
|
let t = e.trim();
|
|
2632
2632
|
if (!t || t === l) {
|
|
2633
2633
|
_();
|
|
@@ -2664,7 +2664,7 @@ function Pn({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
2664
2664
|
}), b && /* @__PURE__ */ Y(I.Suffix, {
|
|
2665
2665
|
"aria-label": h?.available ? a.usernameAvailable : h?.available === !1 ? a.usernameTaken : void 0,
|
|
2666
2666
|
className: "px-2",
|
|
2667
|
-
children: h?.available ? /* @__PURE__ */ Y(
|
|
2667
|
+
children: h?.available ? /* @__PURE__ */ Y(Ee, { className: "text-success" }) : g || h?.available === !1 ? /* @__PURE__ */ Y(D, { className: "text-danger" }) : /* @__PURE__ */ Y(V, {
|
|
2668
2668
|
size: "sm",
|
|
2669
2669
|
color: "current"
|
|
2670
2670
|
})
|
|
@@ -2676,83 +2676,77 @@ function Pn({ name: e, field: t, isPending: n, variant: r }) {
|
|
|
2676
2676
|
}
|
|
2677
2677
|
//#endregion
|
|
2678
2678
|
//#region src/lib/auth/username-plugin.tsx
|
|
2679
|
-
var
|
|
2679
|
+
var Pn = a(gt.id, (e = {}) => {
|
|
2680
2680
|
let t = gt(e);
|
|
2681
2681
|
return {
|
|
2682
2682
|
...t,
|
|
2683
2683
|
additionalFields: t.additionalFields?.map((e) => e.name === "username" ? {
|
|
2684
2684
|
...e,
|
|
2685
|
-
render:
|
|
2685
|
+
render: Nn
|
|
2686
2686
|
} : e),
|
|
2687
|
-
views: { auth: { signIn:
|
|
2687
|
+
views: { auth: { signIn: Fn } }
|
|
2688
2688
|
};
|
|
2689
2689
|
});
|
|
2690
2690
|
//#endregion
|
|
2691
2691
|
//#region src/components/auth/username/sign-in-username.tsx
|
|
2692
|
-
function
|
|
2693
|
-
let { authClient: s, basePaths: c,
|
|
2694
|
-
function
|
|
2692
|
+
function Fn({ className: n, socialLayout: i, socialPosition: a = "bottom", variant: o }) {
|
|
2693
|
+
let { authClient: s, basePaths: c, emailAndPassword: l, localization: u, plugins: d, redirectTo: f, socialProviders: h, viewPaths: g, navigate: _ } = p(), { fetchOptions: v, resetFetchOptions: y } = ee(), { localization: b } = m(Pn), [x, S] = q("");
|
|
2694
|
+
function C(e) {
|
|
2695
2695
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
2696
2696
|
}
|
|
2697
|
-
let { mutate:
|
|
2697
|
+
let { mutate: w, isPending: te } = ge(s, {
|
|
2698
2698
|
onError: (e, { email: t }) => {
|
|
2699
|
-
|
|
2700
|
-
children: d.auth.resend,
|
|
2701
|
-
onClick: () => T({
|
|
2702
|
-
email: t,
|
|
2703
|
-
callbackURL: `${l}${h}`
|
|
2704
|
-
})
|
|
2705
|
-
} }), b();
|
|
2699
|
+
S(""), e.error?.code === "EMAIL_NOT_VERIFIED" && (sessionStorage.setItem("better-auth-ui.verify-email", t), _({ to: `${c.auth}/${g.auth.verifyEmail}` })), y();
|
|
2706
2700
|
},
|
|
2707
|
-
onSuccess: () =>
|
|
2708
|
-
}), { mutate:
|
|
2701
|
+
onSuccess: () => _({ to: f })
|
|
2702
|
+
}), { mutate: ne, isPending: re } = ye(s, {
|
|
2709
2703
|
onError: () => {
|
|
2710
|
-
|
|
2704
|
+
S(""), y();
|
|
2711
2705
|
},
|
|
2712
|
-
onSuccess: () =>
|
|
2713
|
-
}),
|
|
2706
|
+
onSuccess: () => _({ to: f })
|
|
2707
|
+
}), ie = (e) => {
|
|
2714
2708
|
e.preventDefault();
|
|
2715
2709
|
let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
|
|
2716
|
-
|
|
2710
|
+
C(n) ? w({
|
|
2717
2711
|
email: n,
|
|
2718
|
-
password:
|
|
2719
|
-
...
|
|
2720
|
-
fetchOptions:
|
|
2721
|
-
}) :
|
|
2712
|
+
password: x,
|
|
2713
|
+
...l?.rememberMe ? { rememberMe: r } : {},
|
|
2714
|
+
fetchOptions: v
|
|
2715
|
+
}) : ne({
|
|
2722
2716
|
username: n,
|
|
2723
|
-
password:
|
|
2724
|
-
...
|
|
2725
|
-
fetchOptions:
|
|
2717
|
+
password: x,
|
|
2718
|
+
...l?.rememberMe ? { rememberMe: r } : {},
|
|
2719
|
+
fetchOptions: v
|
|
2726
2720
|
});
|
|
2727
|
-
},
|
|
2721
|
+
}, T = Z({ mutationKey: r.signIn.all }) + Z({ mutationKey: r.signUp.all }) > 0, ae = te || re, oe = d.find((e) => e.captchaComponent)?.captchaComponent, se = l?.enabled && !!h?.length;
|
|
2728
2722
|
return /* @__PURE__ */ X(A, {
|
|
2729
2723
|
className: G("w-full max-w-sm gap-4 md:p-6", n),
|
|
2730
2724
|
variant: o,
|
|
2731
2725
|
children: [
|
|
2732
2726
|
/* @__PURE__ */ Y(A.Header, { children: /* @__PURE__ */ Y(A.Title, {
|
|
2733
2727
|
className: "text-xl font-semibold mb-1",
|
|
2734
|
-
children:
|
|
2728
|
+
children: u.auth.signIn
|
|
2735
2729
|
}) }),
|
|
2736
2730
|
/* @__PURE__ */ X(A.Content, {
|
|
2737
2731
|
className: "gap-4",
|
|
2738
2732
|
children: [
|
|
2739
|
-
a === "top" && /* @__PURE__ */ X(J, { children: [!!
|
|
2740
|
-
|
|
2741
|
-
onSubmit:
|
|
2733
|
+
a === "top" && /* @__PURE__ */ X(J, { children: [!!h?.length && /* @__PURE__ */ Y(t, { socialLayout: i }), se && /* @__PURE__ */ Y(e, { children: u.auth.or })] }),
|
|
2734
|
+
l?.enabled && /* @__PURE__ */ X(P, {
|
|
2735
|
+
onSubmit: ie,
|
|
2742
2736
|
className: "flex flex-col gap-4",
|
|
2743
2737
|
children: [
|
|
2744
2738
|
/* @__PURE__ */ X(W, {
|
|
2745
2739
|
name: "email",
|
|
2746
2740
|
type: "text",
|
|
2747
2741
|
autoComplete: "username email",
|
|
2748
|
-
isDisabled:
|
|
2742
|
+
isDisabled: T,
|
|
2749
2743
|
validate: (e) => {
|
|
2750
|
-
if (!e) return
|
|
2744
|
+
if (!e) return u.auth.fieldRequired;
|
|
2751
2745
|
},
|
|
2752
2746
|
children: [
|
|
2753
|
-
/* @__PURE__ */ Y(L, { children:
|
|
2747
|
+
/* @__PURE__ */ Y(L, { children: b.username }),
|
|
2754
2748
|
/* @__PURE__ */ Y(F, {
|
|
2755
|
-
placeholder:
|
|
2749
|
+
placeholder: b.usernameOrEmailPlaceholder,
|
|
2756
2750
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
2757
2751
|
required: !0
|
|
2758
2752
|
}),
|
|
@@ -2760,72 +2754,72 @@ function In({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2760
2754
|
]
|
|
2761
2755
|
}),
|
|
2762
2756
|
/* @__PURE__ */ X(W, {
|
|
2763
|
-
minLength:
|
|
2764
|
-
maxLength:
|
|
2757
|
+
minLength: l?.minPasswordLength,
|
|
2758
|
+
maxLength: l?.maxPasswordLength,
|
|
2765
2759
|
name: "password",
|
|
2766
2760
|
type: "password",
|
|
2767
2761
|
autoComplete: "current-password",
|
|
2768
|
-
isDisabled:
|
|
2769
|
-
value:
|
|
2770
|
-
onChange:
|
|
2762
|
+
isDisabled: T,
|
|
2763
|
+
value: x,
|
|
2764
|
+
onChange: S,
|
|
2771
2765
|
validate: (e) => {
|
|
2772
|
-
if (!e) return
|
|
2773
|
-
let t =
|
|
2774
|
-
if (t && e.length < t) return
|
|
2775
|
-
if (n && e.length > n) return
|
|
2766
|
+
if (!e) return u.auth.fieldRequired;
|
|
2767
|
+
let t = l?.minPasswordLength, n = l?.maxPasswordLength;
|
|
2768
|
+
if (t && e.length < t) return u.auth.tooShort.replace("{{min}}", String(t));
|
|
2769
|
+
if (n && e.length > n) return u.auth.tooLong.replace("{{max}}", String(n));
|
|
2776
2770
|
},
|
|
2777
2771
|
children: [
|
|
2778
|
-
/* @__PURE__ */ Y(L, { children:
|
|
2772
|
+
/* @__PURE__ */ Y(L, { children: u.auth.password }),
|
|
2779
2773
|
/* @__PURE__ */ Y(F, {
|
|
2780
|
-
placeholder:
|
|
2774
|
+
placeholder: u.auth.passwordPlaceholder,
|
|
2781
2775
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
2782
2776
|
required: !0
|
|
2783
2777
|
}),
|
|
2784
2778
|
/* @__PURE__ */ Y(N, {})
|
|
2785
2779
|
]
|
|
2786
2780
|
}),
|
|
2787
|
-
|
|
2781
|
+
l?.rememberMe && /* @__PURE__ */ Y(Xe, {
|
|
2788
2782
|
name: "rememberMe",
|
|
2789
|
-
isDisabled:
|
|
2783
|
+
isDisabled: T,
|
|
2790
2784
|
variant: o === "transparent" ? "primary" : "secondary",
|
|
2791
|
-
children: /* @__PURE__ */ X(
|
|
2785
|
+
children: /* @__PURE__ */ X(Xe.Content, { children: [/* @__PURE__ */ Y(Xe.Control, { children: /* @__PURE__ */ Y(Xe.Indicator, {}) }), u.auth.rememberMe] })
|
|
2792
2786
|
}),
|
|
2793
|
-
|
|
2787
|
+
oe && /* @__PURE__ */ Y("div", {
|
|
2794
2788
|
className: "flex justify-center",
|
|
2795
|
-
children:
|
|
2789
|
+
children: oe
|
|
2796
2790
|
}),
|
|
2797
2791
|
/* @__PURE__ */ X("div", {
|
|
2798
2792
|
className: "flex flex-col gap-3",
|
|
2799
2793
|
children: [/* @__PURE__ */ X(k, {
|
|
2800
2794
|
type: "submit",
|
|
2801
2795
|
className: "w-full",
|
|
2802
|
-
isPending:
|
|
2803
|
-
children: [
|
|
2796
|
+
isPending: ae || T,
|
|
2797
|
+
children: [ae && /* @__PURE__ */ Y(V, {
|
|
2804
2798
|
color: "current",
|
|
2805
2799
|
size: "sm"
|
|
2806
|
-
}),
|
|
2807
|
-
}),
|
|
2800
|
+
}), u.auth.signIn]
|
|
2801
|
+
}), d.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ Y(t, { view: "signIn" }, `${e.id}-${n.toString()}`)))]
|
|
2808
2802
|
})
|
|
2809
2803
|
]
|
|
2810
2804
|
}),
|
|
2811
|
-
a === "bottom" && /* @__PURE__ */ X(J, { children: [
|
|
2805
|
+
a === "bottom" && /* @__PURE__ */ X(J, { children: [se && /* @__PURE__ */ Y(e, { children: u.auth.or }), !!h?.length && /* @__PURE__ */ Y(t, { socialLayout: i })] })
|
|
2812
2806
|
]
|
|
2813
2807
|
}),
|
|
2814
2808
|
/* @__PURE__ */ X(A.Footer, {
|
|
2815
2809
|
className: "flex-col gap-3",
|
|
2816
|
-
children: [
|
|
2817
|
-
href: `${c.auth}/${
|
|
2810
|
+
children: [l?.enabled && l?.forgotPassword && /* @__PURE__ */ Y($e, {
|
|
2811
|
+
href: `${c.auth}/${g.auth.forgotPassword}`,
|
|
2818
2812
|
className: "text-sm no-underline hover:underline",
|
|
2819
|
-
children:
|
|
2820
|
-
}),
|
|
2813
|
+
children: u.auth.forgotPasswordLink
|
|
2814
|
+
}), l?.enabled && /* @__PURE__ */ X(Ze, {
|
|
2821
2815
|
className: "text-sm",
|
|
2822
2816
|
children: [
|
|
2823
|
-
|
|
2817
|
+
u.auth.needToCreateAnAccount,
|
|
2824
2818
|
" ",
|
|
2825
|
-
/* @__PURE__ */ Y(
|
|
2826
|
-
href: `${c.auth}/${
|
|
2819
|
+
/* @__PURE__ */ Y($e, {
|
|
2820
|
+
href: `${c.auth}/${g.auth.signUp}`,
|
|
2827
2821
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
2828
|
-
children:
|
|
2822
|
+
children: u.auth.signUp
|
|
2829
2823
|
})
|
|
2830
2824
|
]
|
|
2831
2825
|
})]
|
|
@@ -2834,4 +2828,4 @@ function In({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2834
2828
|
});
|
|
2835
2829
|
}
|
|
2836
2830
|
//#endregion
|
|
2837
|
-
export {
|
|
2831
|
+
export { Et as ApiKeys, Mn as Appearance, Qt as ChangeOrganizationLogo, Vt as CreateOrganizationDialog, kt as DangerZone, Ot as DeleteAccount, tn as DeleteOrganization, en as DeleteOrganizationSkeleton, rn as InviteMemberDialog, on as LeaveOrganization, Mt as MagicLink, Rt as ManageAccount, Nt as ManageAccounts, yn as Organization, vt as OrganizationApiKeys, gn as OrganizationDangerZone, un as OrganizationInvitations, ln as OrganizationInvitationsEmpty, Ht as OrganizationLogo, mn as OrganizationMembers, hn as OrganizationPeople, _n as OrganizationProfile, Wt as OrganizationRow, vn as OrganizationSettings, bn as OrganizationSwitcher, Q as OrganizationView, Ut as OrganizationViewSkeleton, Kt as Organizations, Zt as OrganizationsSettings, On as Passkeys, Fn as SignInUsername, It as SwitchAccountSubmenu, Ft as SwitchAccountSubmenuContent, Pt as SwitchAccountSubmenuItem, An as ThemeToggleItem, Xt as UserInvitations, Nn as UsernameField, yt as apiKeyPlugin, Dt as deleteUserPlugin, jt as magicLinkPlugin, Lt as multiSessionPlugin, $ as organizationPlugin, Sn as passkeyPlugin, jn as themePlugin, Pn as usernamePlugin };
|