@better-auth-ui/heroui 1.6.9 → 1.6.11
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/additional-field.d.ts +2 -2
- package/dist/components/auth/api-key/api-key.d.ts +1 -1
- package/dist/components/auth/api-key/api-keys.d.ts +1 -1
- package/dist/components/auth/api-key/delete-api-key-dialog.d.ts +1 -1
- package/dist/components/auth/api-key/organization-api-keys.d.ts +1 -1
- package/dist/components/auth/auth-provider.d.ts +1 -1
- package/dist/components/auth/auth.d.ts +3 -3
- package/dist/components/auth/delete-user/danger-zone.d.ts +2 -2
- package/dist/components/auth/delete-user/delete-account.d.ts +1 -1
- package/dist/components/auth/email/email-changed-email.d.ts +2 -2
- package/dist/components/auth/email/email-verification-email.d.ts +2 -2
- package/dist/components/auth/email/magic-link-email.d.ts +2 -2
- package/dist/components/auth/email/new-device-email.d.ts +2 -2
- package/dist/components/auth/email/organization-invitation-email.d.ts +2 -2
- package/dist/components/auth/email/otp-email.d.ts +2 -2
- package/dist/components/auth/email/password-changed-email.d.ts +2 -2
- package/dist/components/auth/email/reset-password-email.d.ts +2 -2
- package/dist/components/auth/field-separator.d.ts +1 -1
- package/dist/components/auth/forgot-password.d.ts +1 -1
- package/dist/components/auth/magic-link/magic-link-button.d.ts +1 -1
- package/dist/components/auth/magic-link/magic-link.d.ts +2 -2
- package/dist/components/auth/multi-session/manage-account.d.ts +1 -1
- package/dist/components/auth/multi-session/manage-accounts.d.ts +1 -1
- package/dist/components/auth/multi-session/switch-account-submenu-item.d.ts +1 -1
- package/dist/components/auth/organization/delete-organization-dialog.d.ts +1 -1
- package/dist/components/auth/organization/leave-organization-dialog.d.ts +1 -1
- package/dist/components/auth/organization/organization-danger-zone.d.ts +2 -2
- package/dist/components/auth/organization/organization-invitation-row.d.ts +1 -1
- package/dist/components/auth/organization/organization-invitations.d.ts +1 -1
- package/dist/components/auth/organization/organization-logo.d.ts +3 -3
- package/dist/components/auth/organization/organization-member-row.d.ts +1 -1
- package/dist/components/auth/organization/organization-members.d.ts +1 -1
- package/dist/components/auth/organization/organization-people.d.ts +1 -1
- package/dist/components/auth/organization/organization-profile.d.ts +1 -1
- package/dist/components/auth/organization/organization-row.d.ts +1 -1
- package/dist/components/auth/organization/organization-settings.d.ts +2 -2
- package/dist/components/auth/organization/organization-switcher.d.ts +3 -3
- package/dist/components/auth/organization/organization-view-skeleton.d.ts +2 -2
- package/dist/components/auth/organization/organization-view.d.ts +3 -3
- package/dist/components/auth/organization/organization.d.ts +3 -3
- package/dist/components/auth/organization/organizations-settings.d.ts +2 -2
- package/dist/components/auth/organization/organizations.d.ts +1 -1
- package/dist/components/auth/organization/remove-member-dialog.d.ts +1 -1
- package/dist/components/auth/organization/slug-field.d.ts +1 -1
- package/dist/components/auth/organization/user-invitation-row.d.ts +1 -1
- package/dist/components/auth/organization/user-invitations.d.ts +1 -1
- package/dist/components/auth/passkey/passkey-button.d.ts +1 -1
- package/dist/components/auth/passkey/passkey.d.ts +1 -1
- package/dist/components/auth/passkey/passkeys.d.ts +1 -1
- package/dist/components/auth/provider-button.d.ts +2 -2
- package/dist/components/auth/reset-password.d.ts +1 -1
- package/dist/components/auth/settings/account/account-settings.d.ts +2 -2
- package/dist/components/auth/settings/account/change-email.d.ts +1 -1
- package/dist/components/auth/settings/account/user-profile.d.ts +1 -1
- package/dist/components/auth/settings/security/active-session.d.ts +1 -1
- package/dist/components/auth/settings/security/active-sessions.d.ts +1 -1
- package/dist/components/auth/settings/security/change-password.d.ts +1 -1
- package/dist/components/auth/settings/security/linked-account.d.ts +1 -1
- package/dist/components/auth/settings/security/linked-accounts.d.ts +1 -1
- package/dist/components/auth/settings/security/security-settings.d.ts +2 -2
- package/dist/components/auth/settings/settings.d.ts +3 -3
- package/dist/components/auth/sign-in.d.ts +2 -2
- package/dist/components/auth/sign-up.d.ts +2 -2
- package/dist/components/auth/theme/appearance.d.ts +1 -1
- package/dist/components/auth/user/user-avatar.d.ts +3 -3
- package/dist/components/auth/user/user-button.d.ts +2 -2
- package/dist/components/auth/user/user-view.d.ts +3 -3
- package/dist/components/auth/username/sign-in-username.d.ts +2 -2
- package/dist/components/auth/username/username-field.d.ts +1 -1
- package/dist/email.d.ts +8 -8
- package/dist/email.js +211 -8
- package/dist/index.d.ts +21 -21
- package/dist/index.js +3393 -21
- package/dist/lib/auth/api-key-plugin.d.ts +3 -3
- package/dist/lib/auth/auth-plugin.d.ts +5 -5
- package/dist/lib/auth/delete-user-plugin.d.ts +2 -2
- package/dist/lib/auth/magic-link-plugin.d.ts +3 -3
- package/dist/lib/auth/multi-session-plugin.d.ts +3 -3
- package/dist/lib/auth/organization-plugin.d.ts +2 -2
- package/dist/lib/auth/passkey-plugin.d.ts +3 -3
- package/dist/lib/auth/theme-plugin.d.ts +3 -3
- package/dist/lib/auth/username-plugin.d.ts +3 -3
- package/dist/plugins.d.ts +46 -46
- package/dist/plugins.js +2824 -47
- package/dist/user-view--47tVtJ3.js +113 -0
- package/package.json +3 -5
- package/dist/components/auth/additional-field.js +0 -137
- package/dist/components/auth/api-key/api-key-skeleton.js +0 -5
- package/dist/components/auth/api-key/api-key.js +0 -17
- package/dist/components/auth/api-key/api-keys-empty.js +0 -9
- package/dist/components/auth/api-key/api-keys.js +0 -22
- package/dist/components/auth/api-key/create-api-key-dialog.js +0 -44
- package/dist/components/auth/api-key/delete-api-key-dialog.js +0 -17
- package/dist/components/auth/api-key/new-api-key-dialog.js +0 -24
- package/dist/components/auth/api-key/organization-api-keys.js +0 -22
- package/dist/components/auth/auth-provider.js +0 -11
- package/dist/components/auth/auth.js +0 -88
- package/dist/components/auth/delete-user/danger-zone.js +0 -12
- package/dist/components/auth/delete-user/delete-account.js +0 -50
- package/dist/components/auth/email/email-changed-email.js +0 -23
- package/dist/components/auth/email/email-verification-email.js +0 -23
- package/dist/components/auth/email/magic-link-email.js +0 -23
- package/dist/components/auth/email/new-device-email.js +0 -23
- package/dist/components/auth/email/organization-invitation-email.js +0 -23
- package/dist/components/auth/email/otp-email.js +0 -22
- package/dist/components/auth/email/password-changed-email.js +0 -23
- package/dist/components/auth/email/reset-password-email.js +0 -23
- package/dist/components/auth/error-toaster.js +0 -33
- package/dist/components/auth/field-separator.js +0 -5
- package/dist/components/auth/forgot-password.js +0 -37
- package/dist/components/auth/magic-link/magic-link-button.js +0 -34
- package/dist/components/auth/magic-link/magic-link.js +0 -40
- package/dist/components/auth/multi-session/manage-account.js +0 -33
- package/dist/components/auth/multi-session/manage-accounts.js +0 -33
- package/dist/components/auth/multi-session/switch-account-submenu-content.js +0 -25
- package/dist/components/auth/multi-session/switch-account-submenu-item.js +0 -17
- package/dist/components/auth/multi-session/switch-account-submenu.js +0 -24
- package/dist/components/auth/organization/change-organization-logo.js +0 -69
- package/dist/components/auth/organization/create-organization-dialog.js +0 -37
- package/dist/components/auth/organization/delete-organization-dialog.js +0 -25
- package/dist/components/auth/organization/delete-organization-skeleton.js +0 -8
- package/dist/components/auth/organization/delete-organization.js +0 -27
- package/dist/components/auth/organization/invite-member-dialog.js +0 -47
- package/dist/components/auth/organization/leave-organization-dialog.js +0 -21
- package/dist/components/auth/organization/leave-organization.js +0 -16
- package/dist/components/auth/organization/organization-danger-zone.js +0 -23
- package/dist/components/auth/organization/organization-invitation-row-skeleton.js +0 -9
- package/dist/components/auth/organization/organization-invitation-row.js +0 -31
- package/dist/components/auth/organization/organization-invitations-empty.js +0 -13
- package/dist/components/auth/organization/organization-invitations.js +0 -66
- package/dist/components/auth/organization/organization-logo.js +0 -14
- package/dist/components/auth/organization/organization-member-row-skeleton.js +0 -9
- package/dist/components/auth/organization/organization-member-row.js +0 -34
- package/dist/components/auth/organization/organization-members.js +0 -67
- package/dist/components/auth/organization/organization-people.js +0 -11
- package/dist/components/auth/organization/organization-profile.js +0 -34
- package/dist/components/auth/organization/organization-row.js +0 -31
- package/dist/components/auth/organization/organization-settings.js +0 -13
- package/dist/components/auth/organization/organization-switcher.js +0 -48
- package/dist/components/auth/organization/organization-view-skeleton.js +0 -9
- package/dist/components/auth/organization/organization-view.js +0 -31
- package/dist/components/auth/organization/organization.js +0 -60
- package/dist/components/auth/organization/organizations-empty.js +0 -9
- package/dist/components/auth/organization/organizations-settings.js +0 -17
- package/dist/components/auth/organization/organizations.js +0 -21
- package/dist/components/auth/organization/remove-member-dialog.js +0 -20
- package/dist/components/auth/organization/slug-field.js +0 -38
- package/dist/components/auth/organization/user-invitation-row-skeleton.js +0 -8
- package/dist/components/auth/organization/user-invitation-row.js +0 -22
- package/dist/components/auth/organization/user-invitations-empty.js +0 -12
- package/dist/components/auth/organization/user-invitations.js +0 -18
- package/dist/components/auth/passkey/add-passkey-dialog.js +0 -22
- package/dist/components/auth/passkey/delete-passkey-dialog.js +0 -14
- package/dist/components/auth/passkey/passkey-button.js +0 -25
- package/dist/components/auth/passkey/passkey-skeleton.js +0 -5
- package/dist/components/auth/passkey/passkey.js +0 -17
- package/dist/components/auth/passkey/passkeys-empty.js +0 -9
- package/dist/components/auth/passkey/passkeys.js +0 -16
- package/dist/components/auth/provider-button.js +0 -29
- package/dist/components/auth/provider-buttons.js +0 -29
- package/dist/components/auth/reset-password.js +0 -57
- package/dist/components/auth/settings/account/account-settings.js +0 -22
- package/dist/components/auth/settings/account/change-avatar.js +0 -54
- package/dist/components/auth/settings/account/change-email.js +0 -28
- package/dist/components/auth/settings/account/user-profile.js +0 -65
- package/dist/components/auth/settings/security/active-session.js +0 -52
- package/dist/components/auth/settings/security/active-sessions.js +0 -23
- package/dist/components/auth/settings/security/change-password.js +0 -79
- package/dist/components/auth/settings/security/linked-account.js +0 -38
- package/dist/components/auth/settings/security/linked-accounts.js +0 -36
- package/dist/components/auth/settings/security/security-settings.js +0 -20
- package/dist/components/auth/settings/settings.js +0 -53
- package/dist/components/auth/sign-in.js +0 -64
- package/dist/components/auth/sign-out.js +0 -33
- package/dist/components/auth/sign-up.js +0 -98
- package/dist/components/auth/theme/appearance.js +0 -24
- package/dist/components/auth/theme/theme-toggle-item.js +0 -57
- package/dist/components/auth/user/user-avatar.js +0 -32
- package/dist/components/auth/user/user-button.js +0 -40
- package/dist/components/auth/user/user-view.js +0 -27
- package/dist/components/auth/username/sign-in-username.js +0 -88
- package/dist/components/auth/username/username-field.js +0 -45
- package/dist/lib/auth/api-key-plugin.js +0 -12
- package/dist/lib/auth/auth-plugin.js +0 -1
- package/dist/lib/auth/delete-user-plugin.js +0 -7
- package/dist/lib/auth/magic-link-plugin.js +0 -18
- package/dist/lib/auth/multi-session-plugin.js +0 -9
- package/dist/lib/auth/organization-plugin.js +0 -19
- package/dist/lib/auth/passkey-plugin.js +0 -9
- package/dist/lib/auth/theme-plugin.js +0 -26
- package/dist/lib/auth/username-plugin.js +0 -19
package/dist/plugins.js
CHANGED
|
@@ -1,48 +1,2825 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
import { a as e, r as t, t as n } from "./user-view--47tVtJ3.js";
|
|
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 w, useHasPermission as T, useInviteMember as ee, useIsUsernameAvailable as te, useLeaveOrganization as ne, useListAccounts as re, useListApiKeys as ie, useListDeviceSessions as ae, useListOrganizationInvitations as oe, useListOrganizationMembers as E, useListOrganizations as se, useListPasskeys as ce, useListUserInvitations as le, useRejectInvitation as ue, useRemoveMember as de, useRevokeMultiSession as fe, useSendVerificationEmail as pe, useSession as D, 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, ChevronUp as De, ChevronsExpandVertical as Oe, CirclePlus as ke, Clock as Ae, CloudArrowUpIn as je, Copy as Me, Display as Ne, Ellipsis as Pe, Envelope as Fe, Fingerprint as Ie, Funnel as Le, Gear as Re, Key as ze, Lock as Be, Moon as Ve, Palette as He, PaperPlane as Ue, Pencil as We, Person as Ge, PersonPlus as Ke, Sun as qe, TrashBin as Je, TriangleExclamation as Ye, Xmark as O } from "@gravity-ui/icons";
|
|
6
|
+
import { AlertDialog as k, Avatar as Xe, Button as A, Card as j, Checkbox as Ze, Chip as M, Description as Qe, Dropdown as N, EmptyState as $e, FieldError as P, Form as F, Input as I, InputGroup as L, Label as R, Link as et, ListBox as tt, Radio as z, RadioGroup as nt, SearchField as B, Select as rt, Skeleton as V, Spinner as H, Table as U, Tabs as W, TextField as G, cn as K, toast as q, useIsHydrated as it } from "@heroui/react";
|
|
7
|
+
import { useEffect as at, useMemo as ot, useRef as st, useState as J } from "react";
|
|
8
|
+
import { Fragment as Y, jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
9
|
+
import { useIsMutating as ct, useQueryClient as lt } from "@tanstack/react-query";
|
|
10
|
+
import { apiKeyPlugin as ut, deleteUserPlugin as dt, magicLinkPlugin as ft, multiSessionPlugin as pt, organizationPlugin as mt, passkeyPlugin as ht, themePlugin as gt, usernamePlugin as _t } from "@better-auth-ui/core/plugins";
|
|
11
|
+
import { buttonVariants as vt } from "@heroui/styles";
|
|
12
|
+
import { useDebouncer as yt } from "@tanstack/react-pacer";
|
|
13
|
+
//#region src/components/auth/api-key/organization-api-keys.tsx
|
|
14
|
+
function bt({ className: e, variant: t }) {
|
|
15
|
+
let { authClient: n } = p(), { data: r } = D(n), { data: i, isPending: a } = d(n), { data: o } = E(n);
|
|
16
|
+
return o?.members.some((e) => e.role === "owner" && e.userId === r?.user.id) ? /* @__PURE__ */ X(Ot, {
|
|
17
|
+
className: e,
|
|
18
|
+
variant: t,
|
|
19
|
+
organizationId: i?.id,
|
|
20
|
+
isPending: a
|
|
21
|
+
}) : null;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/lib/auth/api-key-plugin.ts
|
|
25
|
+
var xt = a(ut.id, (e = {}) => {
|
|
26
|
+
let t = ut(e);
|
|
27
|
+
return {
|
|
28
|
+
...t,
|
|
29
|
+
securityCards: [Ot],
|
|
30
|
+
...t.organization ? { organizationCards: [bt] } : {}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/auth/api-key/delete-api-key-dialog.tsx
|
|
35
|
+
function St({ isOpen: e, onOpenChange: t, apiKey: n, organizationId: r }) {
|
|
36
|
+
let { authClient: i, localization: a } = p(), { localization: o } = m(xt), s = `${n.start}${"*".repeat(16)}`, { mutate: c, isPending: l } = b(i, { onSuccess: () => t(!1) });
|
|
37
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
38
|
+
isOpen: e,
|
|
39
|
+
onOpenChange: t,
|
|
40
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ Z(k.Dialog, { children: [
|
|
41
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
42
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
43
|
+
status: "danger",
|
|
44
|
+
children: /* @__PURE__ */ X(ze, {})
|
|
45
|
+
}), /* @__PURE__ */ X(k.Heading, { children: o.deleteApiKey })] }),
|
|
46
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
47
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
48
|
+
children: [/* @__PURE__ */ X("p", {
|
|
49
|
+
className: "text-muted text-sm",
|
|
50
|
+
children: o.deleteApiKeyWarning
|
|
51
|
+
}), /* @__PURE__ */ Z(G, {
|
|
52
|
+
value: s,
|
|
53
|
+
className: "font-mono text-xs",
|
|
54
|
+
variant: "secondary",
|
|
55
|
+
children: [/* @__PURE__ */ X(R, { children: n.name || o.apiKey }), /* @__PURE__ */ X(I, {
|
|
56
|
+
readOnly: !0,
|
|
57
|
+
className: "font-mono text-xs"
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
62
|
+
slot: "close",
|
|
63
|
+
variant: "tertiary",
|
|
64
|
+
isDisabled: l,
|
|
65
|
+
children: a.settings.cancel
|
|
66
|
+
}), /* @__PURE__ */ Z(A, {
|
|
67
|
+
variant: "danger",
|
|
68
|
+
onPress: () => c({
|
|
69
|
+
keyId: n.id,
|
|
70
|
+
...r ? { configId: "organization" } : {}
|
|
71
|
+
}),
|
|
72
|
+
isPending: l,
|
|
73
|
+
children: [l && /* @__PURE__ */ X(H, {
|
|
74
|
+
color: "current",
|
|
75
|
+
size: "sm"
|
|
76
|
+
}), o.deleteApiKey]
|
|
77
|
+
})] })
|
|
78
|
+
] }) })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/auth/api-key/api-key.tsx
|
|
83
|
+
function Ct({ apiKey: e, hideDelete: t, organizationId: n }) {
|
|
84
|
+
let { localization: r } = p(), { localization: i } = m(xt), [a, o] = J(!1), s = `${e.start}${"*".repeat(16)}`;
|
|
85
|
+
return /* @__PURE__ */ Z("div", {
|
|
86
|
+
className: "flex items-center gap-3",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ X("div", {
|
|
89
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
90
|
+
children: /* @__PURE__ */ X(ze, { className: "size-4.5" })
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ Z("div", {
|
|
93
|
+
className: "flex flex-col min-w-0",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ X("span", {
|
|
96
|
+
className: "text-sm font-medium leading-tight truncate",
|
|
97
|
+
children: e.name || i.apiKey
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ X("span", {
|
|
100
|
+
className: "text-xs text-muted font-mono truncate",
|
|
101
|
+
children: s
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ X("span", {
|
|
104
|
+
className: "text-xs text-muted",
|
|
105
|
+
children: new Date(e.createdAt).toLocaleString(void 0, {
|
|
106
|
+
dateStyle: "medium",
|
|
107
|
+
timeStyle: "short"
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
!t && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ Z(A, {
|
|
113
|
+
className: "ml-auto shrink-0",
|
|
114
|
+
variant: "outline",
|
|
115
|
+
size: "sm",
|
|
116
|
+
onPress: () => o(!0),
|
|
117
|
+
"aria-label": i.deleteApiKey,
|
|
118
|
+
children: [/* @__PURE__ */ X(O, {}), r.settings.delete]
|
|
119
|
+
}), /* @__PURE__ */ X(St, {
|
|
120
|
+
isOpen: a,
|
|
121
|
+
onOpenChange: o,
|
|
122
|
+
apiKey: e,
|
|
123
|
+
organizationId: n
|
|
124
|
+
})] })
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/components/auth/api-key/api-key-skeleton.tsx
|
|
130
|
+
function wt() {
|
|
131
|
+
return /* @__PURE__ */ X("div", {
|
|
132
|
+
className: "flex items-center justify-between",
|
|
133
|
+
children: /* @__PURE__ */ Z("div", {
|
|
134
|
+
className: "flex items-center gap-3",
|
|
135
|
+
children: [/* @__PURE__ */ X(V, { className: "size-10 rounded-xl" }), /* @__PURE__ */ Z("div", {
|
|
136
|
+
className: "flex flex-col gap-1",
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ X(V, { className: "h-4 w-28 rounded-lg" }),
|
|
139
|
+
/* @__PURE__ */ X(V, { className: "h-3 w-36 rounded-lg" }),
|
|
140
|
+
/* @__PURE__ */ X(V, { className: "h-3 w-32 rounded-lg" })
|
|
141
|
+
]
|
|
142
|
+
})]
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/components/auth/api-key/api-keys-empty.tsx
|
|
148
|
+
function Tt({ onCreatePress: e, hideCreate: t }) {
|
|
149
|
+
let { localization: n } = m(xt);
|
|
150
|
+
return /* @__PURE__ */ Z("div", {
|
|
151
|
+
className: "flex flex-col items-center justify-center gap-4",
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ X("div", {
|
|
154
|
+
className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
|
|
155
|
+
children: /* @__PURE__ */ X(ze, { className: "size-4.5" })
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ Z("div", {
|
|
158
|
+
className: "flex flex-col items-center justify-center gap-1 text-center",
|
|
159
|
+
children: [/* @__PURE__ */ X("p", {
|
|
160
|
+
className: "text-sm font-semibold",
|
|
161
|
+
children: n.noApiKeys
|
|
162
|
+
}), /* @__PURE__ */ X("p", {
|
|
163
|
+
className: "text-muted text-xs",
|
|
164
|
+
children: n.apiKeysDescription
|
|
165
|
+
})]
|
|
166
|
+
}),
|
|
167
|
+
!t && /* @__PURE__ */ X(A, {
|
|
168
|
+
size: "sm",
|
|
169
|
+
onPress: e,
|
|
170
|
+
children: n.createApiKey
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/components/auth/api-key/new-api-key-dialog.tsx
|
|
177
|
+
function Et({ isOpen: e, onOpenChange: t, name: n, secretKey: r }) {
|
|
178
|
+
let { localization: i } = p(), { localization: a } = m(xt), [o, s] = J(!1);
|
|
179
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
180
|
+
isOpen: e,
|
|
181
|
+
onOpenChange: t,
|
|
182
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ Z(k.Dialog, { children: [
|
|
183
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
184
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
185
|
+
status: "warning",
|
|
186
|
+
children: /* @__PURE__ */ X(ze, {})
|
|
187
|
+
}), /* @__PURE__ */ X(k.Heading, { children: a.newApiKey })] }),
|
|
188
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
189
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
190
|
+
children: [/* @__PURE__ */ X("p", {
|
|
191
|
+
className: "text-muted text-sm",
|
|
192
|
+
children: a.newApiKeyWarning
|
|
193
|
+
}), /* @__PURE__ */ Z(G, {
|
|
194
|
+
value: r ?? "",
|
|
195
|
+
className: "font-mono text-xs",
|
|
196
|
+
children: [/* @__PURE__ */ X(R, { children: n || a.apiKey }), /* @__PURE__ */ Z(L, {
|
|
197
|
+
variant: "secondary",
|
|
198
|
+
children: [/* @__PURE__ */ X(L.Input, {
|
|
199
|
+
readOnly: !0,
|
|
200
|
+
className: "font-mono text-xs"
|
|
201
|
+
}), /* @__PURE__ */ X(L.Suffix, {
|
|
202
|
+
className: "px-0",
|
|
203
|
+
children: /* @__PURE__ */ X(A, {
|
|
204
|
+
isIconOnly: !0,
|
|
205
|
+
"aria-label": i.settings.copyToClipboard,
|
|
206
|
+
size: "sm",
|
|
207
|
+
variant: "ghost",
|
|
208
|
+
onPress: async () => {
|
|
209
|
+
if (r) try {
|
|
210
|
+
await navigator.clipboard.writeText(r), s(!0), setTimeout(() => s(!1), 1500);
|
|
211
|
+
} catch (e) {
|
|
212
|
+
q.danger(e instanceof Error ? e.message : String(e));
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
children: X(o ? Ee : Me, {})
|
|
216
|
+
})
|
|
217
|
+
})]
|
|
218
|
+
})]
|
|
219
|
+
})]
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ X(k.Footer, { children: /* @__PURE__ */ X(A, {
|
|
222
|
+
slot: "close",
|
|
223
|
+
children: a.dismissNewKey
|
|
224
|
+
}) })
|
|
225
|
+
] }) })
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/components/auth/api-key/create-api-key-dialog.tsx
|
|
230
|
+
function Dt({ isOpen: e, onOpenChange: t, organizationId: n }) {
|
|
231
|
+
let { authClient: r, localization: i } = p(), { localization: a } = m(xt), { mutate: o, isPending: s } = v(r), [c, l] = J(!1), [u, d] = J(null), [f, h] = J(null), g = (e) => {
|
|
232
|
+
e || (d(null), h(null)), t(e);
|
|
233
|
+
};
|
|
234
|
+
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(k.Backdrop, {
|
|
235
|
+
isOpen: e,
|
|
236
|
+
onOpenChange: g,
|
|
237
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ X(k.Dialog, { children: /* @__PURE__ */ Z(F, {
|
|
238
|
+
onSubmit: (e) => {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
let t = new FormData(e.target).get("name")?.trim();
|
|
241
|
+
o(t || n ? {
|
|
242
|
+
...t ? { name: t } : {},
|
|
243
|
+
...n ? {
|
|
244
|
+
organizationId: n,
|
|
245
|
+
configId: "organization"
|
|
246
|
+
} : {}
|
|
247
|
+
} : void 0, { onSuccess: (e) => {
|
|
248
|
+
g(!1), d(t), h(e.key), l(!0);
|
|
249
|
+
} });
|
|
250
|
+
},
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
253
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
254
|
+
status: "default",
|
|
255
|
+
children: /* @__PURE__ */ X(ze, {})
|
|
256
|
+
}), /* @__PURE__ */ X(k.Heading, { children: a.createApiKey })] }),
|
|
257
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
258
|
+
className: "overflow-visible",
|
|
259
|
+
children: [/* @__PURE__ */ X("p", {
|
|
260
|
+
className: "text-muted text-sm",
|
|
261
|
+
children: a.apiKeysDescription
|
|
262
|
+
}), /* @__PURE__ */ Z(G, {
|
|
263
|
+
className: "mt-4",
|
|
264
|
+
id: "name",
|
|
265
|
+
name: "name",
|
|
266
|
+
isDisabled: s,
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ X(R, { children: a.name }),
|
|
269
|
+
/* @__PURE__ */ X(I, {
|
|
270
|
+
autoFocus: !0,
|
|
271
|
+
placeholder: i.settings.optional,
|
|
272
|
+
variant: "secondary"
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ X(P, {})
|
|
275
|
+
]
|
|
276
|
+
})]
|
|
277
|
+
}),
|
|
278
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
279
|
+
slot: "close",
|
|
280
|
+
variant: "tertiary",
|
|
281
|
+
isDisabled: s,
|
|
282
|
+
children: i.settings.cancel
|
|
283
|
+
}), /* @__PURE__ */ Z(A, {
|
|
284
|
+
type: "submit",
|
|
285
|
+
isPending: s,
|
|
286
|
+
children: [s && /* @__PURE__ */ X(H, {
|
|
287
|
+
color: "current",
|
|
288
|
+
size: "sm"
|
|
289
|
+
}), a.createApiKey]
|
|
290
|
+
})] })
|
|
291
|
+
]
|
|
292
|
+
}) }) })
|
|
293
|
+
}), /* @__PURE__ */ X(Et, {
|
|
294
|
+
isOpen: c,
|
|
295
|
+
onOpenChange: l,
|
|
296
|
+
secretKey: f,
|
|
297
|
+
name: u
|
|
298
|
+
})] });
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/components/auth/api-key/api-keys.tsx
|
|
302
|
+
function Ot({ className: e, variant: t, organizationId: n, isPending: r, hideCreate: i, hideDelete: a }) {
|
|
303
|
+
let { authClient: o } = p(), { localization: s } = m(xt), { data: c, isPending: l } = ie(o, {
|
|
304
|
+
enabled: !r,
|
|
305
|
+
...n ? { query: {
|
|
306
|
+
organizationId: n,
|
|
307
|
+
configId: "organization"
|
|
308
|
+
} } : {}
|
|
309
|
+
}), u = r || l, [d, f] = J(!1);
|
|
310
|
+
return /* @__PURE__ */ Z("div", {
|
|
311
|
+
className: K("flex flex-col gap-3", e),
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ Z("div", {
|
|
314
|
+
className: "flex items-end justify-between gap-3",
|
|
315
|
+
children: [/* @__PURE__ */ X("h2", {
|
|
316
|
+
className: "text-sm font-semibold truncate",
|
|
317
|
+
children: s.apiKeys
|
|
318
|
+
}), !i && /* @__PURE__ */ X(A, {
|
|
319
|
+
className: "shrink-0",
|
|
320
|
+
size: "sm",
|
|
321
|
+
isDisabled: u,
|
|
322
|
+
onPress: () => f(!0),
|
|
323
|
+
children: s.createApiKey
|
|
324
|
+
})]
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ X(j, {
|
|
327
|
+
variant: t,
|
|
328
|
+
children: /* @__PURE__ */ X(j.Content, { children: u ? /* @__PURE__ */ X(wt, {}) : c?.apiKeys.length ? c?.apiKeys.map((e, t) => /* @__PURE__ */ Z("div", { children: [t > 0 && /* @__PURE__ */ X("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ X(Ct, {
|
|
329
|
+
apiKey: e,
|
|
330
|
+
hideDelete: a,
|
|
331
|
+
organizationId: n
|
|
332
|
+
})] }, e.id)) : /* @__PURE__ */ X(Tt, {
|
|
333
|
+
onCreatePress: () => f(!0),
|
|
334
|
+
hideCreate: i
|
|
335
|
+
}) })
|
|
336
|
+
}),
|
|
337
|
+
!i && /* @__PURE__ */ X(Dt, {
|
|
338
|
+
isOpen: d,
|
|
339
|
+
onOpenChange: f,
|
|
340
|
+
organizationId: n
|
|
341
|
+
})
|
|
342
|
+
]
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/lib/auth/delete-user-plugin.ts
|
|
347
|
+
var kt = a(dt.id, (e = {}) => ({
|
|
348
|
+
...dt(e),
|
|
349
|
+
securityCards: [jt]
|
|
350
|
+
}));
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/components/auth/delete-user/delete-account.tsx
|
|
353
|
+
function At({ className: e, variant: t, ...n }) {
|
|
354
|
+
let { authClient: r, basePaths: a, localization: o, navigate: s, viewPaths: c } = p(), { localization: l, sendDeleteAccountVerification: u } = m(kt), { data: d } = re(r), f = lt(), [h, g] = J(!1), [_, v] = J(""), y = d?.some((e) => e.providerId === "credential"), b = !u && y, { mutate: x, isPending: S } = C(r), w = (e) => {
|
|
355
|
+
g(e), v("");
|
|
356
|
+
}, T = async (e) => {
|
|
357
|
+
e.preventDefault(), x({ ...b ? { password: _ } : {} }, { onSuccess: () => {
|
|
358
|
+
g(!1), v(""), u ? q.success(l.deleteUserVerificationSent) : (q.success(l.deleteUserSuccess), f.removeQueries({ queryKey: i.all }), s({
|
|
359
|
+
to: `${a.auth}/${c.auth.signIn}`,
|
|
360
|
+
replace: !0
|
|
361
|
+
}));
|
|
362
|
+
} });
|
|
363
|
+
};
|
|
364
|
+
return /* @__PURE__ */ X(j, {
|
|
365
|
+
className: e,
|
|
366
|
+
variant: t,
|
|
367
|
+
...n,
|
|
368
|
+
children: /* @__PURE__ */ Z(j.Content, {
|
|
369
|
+
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
370
|
+
children: [/* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("p", {
|
|
371
|
+
className: "text-sm font-medium leading-tight",
|
|
372
|
+
children: l.deleteAccount
|
|
373
|
+
}), /* @__PURE__ */ X("p", {
|
|
374
|
+
className: "text-muted text-xs mt-0.5",
|
|
375
|
+
children: l.deleteAccountDescription
|
|
376
|
+
})] }), /* @__PURE__ */ Z(k, { children: [/* @__PURE__ */ X(A, {
|
|
377
|
+
isDisabled: !d,
|
|
378
|
+
size: "sm",
|
|
379
|
+
variant: "danger-soft",
|
|
380
|
+
onPress: () => g(!0),
|
|
381
|
+
children: l.deleteAccount
|
|
382
|
+
}), /* @__PURE__ */ X(k.Backdrop, {
|
|
383
|
+
isOpen: h,
|
|
384
|
+
onOpenChange: w,
|
|
385
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ X(k.Dialog, { children: /* @__PURE__ */ Z(F, {
|
|
386
|
+
onSubmit: T,
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
389
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
390
|
+
status: "danger",
|
|
391
|
+
children: /* @__PURE__ */ X(Ye, {})
|
|
392
|
+
}), /* @__PURE__ */ X(k.Heading, { children: l.deleteAccount })] }),
|
|
393
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
394
|
+
className: "overflow-visible",
|
|
395
|
+
children: [/* @__PURE__ */ X("p", {
|
|
396
|
+
className: "text-muted text-sm",
|
|
397
|
+
children: l.deleteAccountDescription
|
|
398
|
+
}), b && /* @__PURE__ */ Z(G, {
|
|
399
|
+
className: "mt-4",
|
|
400
|
+
name: "password",
|
|
401
|
+
type: "password",
|
|
402
|
+
isDisabled: S,
|
|
403
|
+
value: _,
|
|
404
|
+
onChange: v,
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ X(R, { children: o.auth.password }),
|
|
407
|
+
/* @__PURE__ */ X(I, {
|
|
408
|
+
autoComplete: "current-password",
|
|
409
|
+
placeholder: o.auth.passwordPlaceholder,
|
|
410
|
+
required: !0,
|
|
411
|
+
variant: "secondary"
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ X(P, {})
|
|
414
|
+
]
|
|
415
|
+
})]
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
418
|
+
slot: "close",
|
|
419
|
+
variant: "tertiary",
|
|
420
|
+
isDisabled: S,
|
|
421
|
+
children: o.settings.cancel
|
|
422
|
+
}), /* @__PURE__ */ Z(A, {
|
|
423
|
+
type: "submit",
|
|
424
|
+
variant: "danger",
|
|
425
|
+
isPending: S,
|
|
426
|
+
children: [S && /* @__PURE__ */ X(H, {
|
|
427
|
+
color: "current",
|
|
428
|
+
size: "sm"
|
|
429
|
+
}), l.deleteAccount]
|
|
430
|
+
})] })
|
|
431
|
+
]
|
|
432
|
+
}) }) })
|
|
433
|
+
})] })]
|
|
434
|
+
})
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/components/auth/delete-user/danger-zone.tsx
|
|
439
|
+
function jt({ className: e, variant: t, ...n }) {
|
|
440
|
+
let { localization: r } = p();
|
|
441
|
+
return /* @__PURE__ */ Z("div", {
|
|
442
|
+
className: K("flex w-full flex-col", e),
|
|
443
|
+
...n,
|
|
444
|
+
children: [/* @__PURE__ */ X("h2", {
|
|
445
|
+
className: K("text-sm font-semibold mb-3 text-danger"),
|
|
446
|
+
children: r.settings.dangerZone
|
|
447
|
+
}), /* @__PURE__ */ X(At, { variant: t })]
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/components/auth/magic-link/magic-link-button.tsx
|
|
452
|
+
function Mt({ view: e }) {
|
|
453
|
+
let { basePaths: t, emailAndPassword: n, viewPaths: i, localization: a } = p(), o = ct({ mutationKey: r.signIn.all }) + ct({ mutationKey: r.signUp.all }) > 0, { localization: s, viewPaths: c } = m(Nt), l = e === "magicLink";
|
|
454
|
+
return l && !n?.enabled ? null : /* @__PURE__ */ Z(et, {
|
|
455
|
+
href: `${t.auth}/${l ? i.auth.signIn : c.auth.magicLink}`,
|
|
456
|
+
isDisabled: o,
|
|
457
|
+
className: K(vt({ variant: "tertiary" }), "w-full gap-2", o && "status-disabled"),
|
|
458
|
+
children: [X(l ? Be : Fe, {}), a.auth.continueWith.replace("{{provider}}", l ? a.auth.password : s.magicLink)]
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/lib/auth/magic-link-plugin.ts
|
|
463
|
+
var Nt = a(ft.id, (e = {}) => ({
|
|
464
|
+
...ft(e),
|
|
465
|
+
authButtons: [Mt],
|
|
466
|
+
views: { auth: { magicLink: Pt } },
|
|
467
|
+
fallbackViews: { auth: { signIn: Pt } }
|
|
468
|
+
}));
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/components/auth/magic-link/magic-link.tsx
|
|
471
|
+
function Pt({ className: n, socialLayout: i, socialPosition: a = "bottom", variant: o, ...s }) {
|
|
472
|
+
let { authClient: c, basePaths: l, baseURL: u, emailAndPassword: d, localization: f, plugins: h, redirectTo: g, socialProviders: _, viewPaths: v } = p(), { localization: y } = m(Nt), [b, x] = J(""), { mutate: S, isPending: C } = _e(c, { onSuccess: () => {
|
|
473
|
+
x(""), q.success(y.magicLinkSent);
|
|
474
|
+
} }), w = ct({ mutationKey: r.signIn.all }) + ct({ mutationKey: r.signUp.all }) > 0, T = (e) => {
|
|
475
|
+
e.preventDefault(), S({
|
|
476
|
+
email: b,
|
|
477
|
+
callbackURL: `${u}${g}`
|
|
478
|
+
});
|
|
479
|
+
}, ee = !!_?.length;
|
|
480
|
+
return /* @__PURE__ */ Z(j, {
|
|
481
|
+
className: K("w-full max-w-sm gap-4 md:p-6", n),
|
|
482
|
+
variant: o,
|
|
483
|
+
...s,
|
|
484
|
+
children: [
|
|
485
|
+
/* @__PURE__ */ X(j.Header, { children: /* @__PURE__ */ X(j.Title, {
|
|
486
|
+
className: "text-xl font-semibold mb-1",
|
|
487
|
+
children: f.auth.signIn
|
|
488
|
+
}) }),
|
|
489
|
+
/* @__PURE__ */ Z(j.Content, {
|
|
490
|
+
className: "gap-4",
|
|
491
|
+
children: [
|
|
492
|
+
a === "top" && /* @__PURE__ */ Z(Y, { children: [!!_?.length && /* @__PURE__ */ X(t, { socialLayout: i }), ee && /* @__PURE__ */ X(e, { children: f.auth.or })] }),
|
|
493
|
+
/* @__PURE__ */ Z(F, {
|
|
494
|
+
onSubmit: T,
|
|
495
|
+
className: "flex flex-col gap-4",
|
|
496
|
+
children: [/* @__PURE__ */ Z(G, {
|
|
497
|
+
name: "email",
|
|
498
|
+
type: "email",
|
|
499
|
+
autoComplete: "email",
|
|
500
|
+
isDisabled: w,
|
|
501
|
+
value: b,
|
|
502
|
+
onChange: x,
|
|
503
|
+
children: [
|
|
504
|
+
/* @__PURE__ */ X(R, { children: f.auth.email }),
|
|
505
|
+
/* @__PURE__ */ X(I, {
|
|
506
|
+
placeholder: f.auth.emailPlaceholder,
|
|
507
|
+
required: !0,
|
|
508
|
+
variant: o === "transparent" ? "primary" : "secondary"
|
|
509
|
+
}),
|
|
510
|
+
/* @__PURE__ */ X(P, {})
|
|
511
|
+
]
|
|
512
|
+
}), /* @__PURE__ */ Z("div", {
|
|
513
|
+
className: "flex flex-col gap-3",
|
|
514
|
+
children: [/* @__PURE__ */ Z(A, {
|
|
515
|
+
type: "submit",
|
|
516
|
+
className: "w-full",
|
|
517
|
+
isPending: w,
|
|
518
|
+
children: [C && /* @__PURE__ */ X(H, {
|
|
519
|
+
color: "current",
|
|
520
|
+
size: "sm"
|
|
521
|
+
}), y.sendMagicLink]
|
|
522
|
+
}), h.flatMap((e) => (e.authButtons ?? []).map((t, n) => /* @__PURE__ */ X(t, { view: "magicLink" }, `${e.id}-${n.toString()}`)))]
|
|
523
|
+
})]
|
|
524
|
+
}),
|
|
525
|
+
a === "bottom" && /* @__PURE__ */ Z(Y, { children: [ee && /* @__PURE__ */ X(e, { children: f.auth.or }), !!_?.length && /* @__PURE__ */ X(t, { socialLayout: i })] })
|
|
526
|
+
]
|
|
527
|
+
}),
|
|
528
|
+
d?.enabled && /* @__PURE__ */ X(j.Footer, {
|
|
529
|
+
className: "flex-col gap-3",
|
|
530
|
+
children: /* @__PURE__ */ Z(Qe, {
|
|
531
|
+
className: "text-sm",
|
|
532
|
+
children: [
|
|
533
|
+
f.auth.needToCreateAnAccount,
|
|
534
|
+
" ",
|
|
535
|
+
/* @__PURE__ */ X(et, {
|
|
536
|
+
href: `${l.auth}/${v.auth.signUp}`,
|
|
537
|
+
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
538
|
+
children: f.auth.signUp
|
|
539
|
+
})
|
|
540
|
+
]
|
|
541
|
+
})
|
|
542
|
+
})
|
|
543
|
+
]
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/components/auth/multi-session/manage-accounts.tsx
|
|
548
|
+
function Ft({ className: e, variant: t, ...n }) {
|
|
549
|
+
let { authClient: r } = p(), { localization: i } = m(zt), { data: a } = D(r), { data: o, isPending: s } = ae(r), c = o?.filter((e) => e.session.id !== a?.session.id), l = [{
|
|
550
|
+
key: a?.session.id ?? "current",
|
|
551
|
+
deviceSession: s ? null : a,
|
|
552
|
+
isPending: s
|
|
553
|
+
}, ...c?.map((e) => ({
|
|
554
|
+
key: e.session.id,
|
|
555
|
+
deviceSession: e,
|
|
556
|
+
isPending: !1
|
|
557
|
+
})) ?? []];
|
|
558
|
+
return /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("h2", {
|
|
559
|
+
className: K("text-sm font-semibold mb-3"),
|
|
560
|
+
children: i.manageAccounts
|
|
561
|
+
}), /* @__PURE__ */ X(j, {
|
|
562
|
+
className: K(e),
|
|
563
|
+
variant: t,
|
|
564
|
+
...n,
|
|
565
|
+
children: /* @__PURE__ */ X(j.Content, {
|
|
566
|
+
className: "gap-0",
|
|
567
|
+
children: l.map((e, t) => /* @__PURE__ */ Z("div", { children: [t > 0 && /* @__PURE__ */ X("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ X(Bt, {
|
|
568
|
+
deviceSession: e.deviceSession,
|
|
569
|
+
isPending: e.isPending
|
|
570
|
+
})] }, e.key))
|
|
571
|
+
})
|
|
572
|
+
})] });
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/components/auth/multi-session/switch-account-submenu-item.tsx
|
|
576
|
+
function It({ deviceSession: e, hideSubtitle: t }) {
|
|
577
|
+
let { authClient: r } = p(), { mutate: i, isPending: a } = he(r, { onSuccess: () => window.scrollTo({ top: 0 }) });
|
|
578
|
+
return /* @__PURE__ */ Z(N.Item, {
|
|
579
|
+
className: "px-2",
|
|
580
|
+
isDisabled: a,
|
|
581
|
+
onPress: () => i({ sessionToken: e.session.token }),
|
|
582
|
+
children: [/* @__PURE__ */ X(n, {
|
|
583
|
+
user: e.user,
|
|
584
|
+
hideSubtitle: t
|
|
585
|
+
}), a && /* @__PURE__ */ X(H, {
|
|
586
|
+
color: "current",
|
|
587
|
+
size: "sm",
|
|
588
|
+
className: "ml-auto"
|
|
589
|
+
})]
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/components/auth/multi-session/switch-account-submenu-content.tsx
|
|
594
|
+
function Lt({ hideSubtitle: e }) {
|
|
595
|
+
let { authClient: t, basePaths: r, viewPaths: i } = p(), { localization: a } = m(zt), { data: o } = D(t), { data: s, isPending: c } = ae(t);
|
|
596
|
+
return /* @__PURE__ */ X(N.Popover, {
|
|
597
|
+
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
598
|
+
children: /* @__PURE__ */ Z(N.Menu, { children: [
|
|
599
|
+
/* @__PURE__ */ Z(N.Item, {
|
|
600
|
+
className: "px-2",
|
|
601
|
+
children: [/* @__PURE__ */ X(n, {
|
|
602
|
+
isPending: c,
|
|
603
|
+
hideSubtitle: e
|
|
604
|
+
}), !c && /* @__PURE__ */ X(Ee, { className: "ml-auto" })]
|
|
605
|
+
}),
|
|
606
|
+
s?.filter((e) => e.session.id !== o?.session?.id).map((t) => /* @__PURE__ */ X(It, {
|
|
607
|
+
deviceSession: t,
|
|
608
|
+
hideSubtitle: e
|
|
609
|
+
}, t.session.id)),
|
|
610
|
+
/* @__PURE__ */ Z(N.Item, {
|
|
611
|
+
textValue: a.addAccount,
|
|
612
|
+
href: `${r.auth}/${i.auth.signIn}`,
|
|
613
|
+
children: [/* @__PURE__ */ X(ke, { className: "text-muted" }), /* @__PURE__ */ X(R, { children: a.addAccount })]
|
|
614
|
+
})
|
|
615
|
+
] })
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region src/components/auth/multi-session/switch-account-submenu.tsx
|
|
620
|
+
function Rt({ className: e, hideSubtitle: t }) {
|
|
621
|
+
let { authClient: n } = p(), { data: r } = D(n), { localization: i } = m(zt);
|
|
622
|
+
return r ? /* @__PURE__ */ Z(N.SubmenuTrigger, { children: [/* @__PURE__ */ Z(N.Item, {
|
|
623
|
+
className: e,
|
|
624
|
+
textValue: i.switchAccount,
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ X(Ce, { className: "text-muted" }),
|
|
627
|
+
/* @__PURE__ */ X(R, { children: i.switchAccount }),
|
|
628
|
+
/* @__PURE__ */ X(N.SubmenuIndicator, {})
|
|
629
|
+
]
|
|
630
|
+
}), /* @__PURE__ */ X(N.Popover, {
|
|
631
|
+
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
632
|
+
children: /* @__PURE__ */ X(Lt, { hideSubtitle: t })
|
|
633
|
+
})] }) : null;
|
|
634
|
+
}
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/lib/auth/multi-session-plugin.ts
|
|
637
|
+
var zt = a(pt.id, (e = {}) => ({
|
|
638
|
+
...pt(e),
|
|
639
|
+
accountCards: [Ft],
|
|
640
|
+
userMenuItems: [Rt]
|
|
641
|
+
}));
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/components/auth/multi-session/manage-account.tsx
|
|
644
|
+
function Bt({ deviceSession: e, isPending: t }) {
|
|
645
|
+
let { authClient: r, localization: i } = p(), { localization: a } = m(zt), { data: o } = Se(r), { mutate: s, isPending: c } = he(r, { onSuccess: () => window.scrollTo({ top: 0 }) }), { mutate: l, isPending: u } = fe(r, { onSuccess: () => q.success(i.settings.revokeSessionSuccess) }), d = e?.session.userId === o?.id, f = c || u;
|
|
646
|
+
return /* @__PURE__ */ Z("div", {
|
|
647
|
+
className: "flex items-center justify-between gap-3",
|
|
648
|
+
children: [
|
|
649
|
+
/* @__PURE__ */ X(n, {
|
|
650
|
+
user: e?.user,
|
|
651
|
+
isPending: t,
|
|
652
|
+
size: "md"
|
|
653
|
+
}),
|
|
654
|
+
e && d && /* @__PURE__ */ Z(A, {
|
|
655
|
+
className: "shrink-0",
|
|
656
|
+
variant: "outline",
|
|
657
|
+
size: "sm",
|
|
658
|
+
onPress: () => l({ sessionToken: e.session.token }),
|
|
659
|
+
isDisabled: f,
|
|
660
|
+
children: [u ? /* @__PURE__ */ X(H, {
|
|
661
|
+
color: "current",
|
|
662
|
+
size: "sm"
|
|
663
|
+
}) : /* @__PURE__ */ X(we, {}), i.auth.signOut]
|
|
664
|
+
}),
|
|
665
|
+
e && !d && /* @__PURE__ */ Z(N, { children: [/* @__PURE__ */ X(A, {
|
|
666
|
+
isIconOnly: !0,
|
|
667
|
+
variant: "ghost",
|
|
668
|
+
className: "shrink-0",
|
|
669
|
+
size: "sm",
|
|
670
|
+
isDisabled: f,
|
|
671
|
+
children: /* @__PURE__ */ X(Pe, {})
|
|
672
|
+
}), /* @__PURE__ */ X(N.Popover, { children: /* @__PURE__ */ Z(N.Menu, { children: [/* @__PURE__ */ Z(N.Item, {
|
|
673
|
+
textValue: a.switchAccount,
|
|
674
|
+
onAction: () => s({ sessionToken: e.session.token }),
|
|
675
|
+
children: [/* @__PURE__ */ X(Ce, { className: "text-muted" }), a.switchAccount]
|
|
676
|
+
}), /* @__PURE__ */ Z(N.Item, {
|
|
677
|
+
textValue: i.auth.signOut,
|
|
678
|
+
onAction: () => l({ sessionToken: e.session.token }),
|
|
679
|
+
children: [/* @__PURE__ */ X(we, { className: "text-muted" }), i.auth.signOut]
|
|
680
|
+
})] }) })] })
|
|
681
|
+
]
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
//#endregion
|
|
685
|
+
//#region src/components/auth/organization/slug-field.tsx
|
|
686
|
+
function Vt(e) {
|
|
687
|
+
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
688
|
+
}
|
|
689
|
+
function Ht({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
690
|
+
let { authClient: a } = p(), { localization: o, checkSlug: s } = m($), { mutate: c, data: l, error: u, reset: d } = _(a), f = yt((e) => {
|
|
691
|
+
!s || !e.trim() || e.trim() === n || c({ slug: e.trim() });
|
|
692
|
+
}, { wait: 500 });
|
|
693
|
+
at(() => {
|
|
694
|
+
s && (d(), f.maybeExecute(e));
|
|
695
|
+
}, [
|
|
696
|
+
s,
|
|
697
|
+
e,
|
|
698
|
+
f.maybeExecute,
|
|
699
|
+
d
|
|
700
|
+
]);
|
|
701
|
+
let h = (e) => {
|
|
702
|
+
t(Vt(e));
|
|
703
|
+
};
|
|
704
|
+
return /* @__PURE__ */ Z(G, {
|
|
705
|
+
id: "slug",
|
|
706
|
+
name: "slug",
|
|
707
|
+
...i,
|
|
708
|
+
value: e,
|
|
709
|
+
onChange: h,
|
|
710
|
+
children: [
|
|
711
|
+
/* @__PURE__ */ X(R, { children: o.slug }),
|
|
712
|
+
/* @__PURE__ */ Z(L, {
|
|
713
|
+
variant: r,
|
|
714
|
+
children: [/* @__PURE__ */ X(L.Input, {
|
|
715
|
+
placeholder: o.slugPlaceholder,
|
|
716
|
+
required: !0
|
|
717
|
+
}), s && !!e.trim() && e.trim() !== n && /* @__PURE__ */ X(L.Suffix, {
|
|
718
|
+
className: "px-2",
|
|
719
|
+
children: l?.status ? /* @__PURE__ */ X(Ee, { className: "text-success" }) : u ? /* @__PURE__ */ X(O, { className: "text-danger" }) : /* @__PURE__ */ X(H, {
|
|
720
|
+
size: "sm",
|
|
721
|
+
color: "current"
|
|
722
|
+
})
|
|
723
|
+
})]
|
|
724
|
+
}),
|
|
725
|
+
/* @__PURE__ */ X(P, {})
|
|
726
|
+
]
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/components/auth/organization/create-organization-dialog.tsx
|
|
731
|
+
function Ut({ isOpen: e, onOpenChange: t }) {
|
|
732
|
+
let { authClient: n, localization: r } = p(), { localization: i } = m($), [a, o] = J(""), [s, c] = J(""), { mutate: l, isPending: u } = y(n, { onSuccess: () => t(!1) });
|
|
733
|
+
return at(() => {
|
|
734
|
+
e || (c(""), o(""));
|
|
735
|
+
}, [e]), at(() => {
|
|
736
|
+
c(Vt(a));
|
|
737
|
+
}, [a]), /* @__PURE__ */ X(k.Backdrop, {
|
|
738
|
+
isOpen: e,
|
|
739
|
+
onOpenChange: t,
|
|
740
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ X(k.Dialog, { children: /* @__PURE__ */ Z(F, {
|
|
741
|
+
onSubmit: (e) => {
|
|
742
|
+
e.preventDefault(), l({
|
|
743
|
+
name: a,
|
|
744
|
+
slug: s
|
|
745
|
+
});
|
|
746
|
+
},
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
749
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
750
|
+
status: "default",
|
|
751
|
+
children: /* @__PURE__ */ X(Te, {})
|
|
752
|
+
}), /* @__PURE__ */ X(k.Heading, { children: i.createOrganization })] }),
|
|
753
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
754
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ X("p", {
|
|
757
|
+
className: "text-muted text-sm",
|
|
758
|
+
children: i.organizationsDescription
|
|
759
|
+
}),
|
|
760
|
+
/* @__PURE__ */ Z(G, {
|
|
761
|
+
id: "name",
|
|
762
|
+
name: "name",
|
|
763
|
+
isDisabled: u,
|
|
764
|
+
value: a,
|
|
765
|
+
onChange: o,
|
|
766
|
+
children: [
|
|
767
|
+
/* @__PURE__ */ X(R, { children: i.name }),
|
|
768
|
+
/* @__PURE__ */ X(I, {
|
|
769
|
+
required: !0,
|
|
770
|
+
autoFocus: !0,
|
|
771
|
+
placeholder: i.namePlaceholder,
|
|
772
|
+
variant: "secondary"
|
|
773
|
+
}),
|
|
774
|
+
/* @__PURE__ */ X(P, {})
|
|
775
|
+
]
|
|
776
|
+
}),
|
|
777
|
+
/* @__PURE__ */ X(Ht, {
|
|
778
|
+
value: s,
|
|
779
|
+
onChange: c,
|
|
780
|
+
isDisabled: u,
|
|
781
|
+
variant: "secondary"
|
|
782
|
+
})
|
|
783
|
+
]
|
|
784
|
+
}),
|
|
785
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
786
|
+
slot: "close",
|
|
787
|
+
variant: "tertiary",
|
|
788
|
+
isDisabled: u,
|
|
789
|
+
children: r.settings.cancel
|
|
790
|
+
}), /* @__PURE__ */ Z(A, {
|
|
791
|
+
type: "submit",
|
|
792
|
+
isPending: u,
|
|
793
|
+
children: [u && /* @__PURE__ */ X(H, {
|
|
794
|
+
color: "current",
|
|
795
|
+
size: "sm"
|
|
796
|
+
}), i.createOrganization]
|
|
797
|
+
})] })
|
|
798
|
+
]
|
|
799
|
+
}) }) })
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region src/components/auth/organization/organization-logo.tsx
|
|
804
|
+
function Wt({ className: e, fallback: t, isPending: n, organization: r, size: i = "sm", style: a, ...o }) {
|
|
805
|
+
if (n && !r) return /* @__PURE__ */ X(V, {
|
|
806
|
+
className: K("rounded-full", i === "sm" ? "size-8" : i === "md" ? "size-10" : "size-12", e),
|
|
807
|
+
style: a
|
|
808
|
+
});
|
|
809
|
+
let s = r?.name?.slice(0, 2).toUpperCase();
|
|
810
|
+
return /* @__PURE__ */ Z(Xe, {
|
|
811
|
+
size: i,
|
|
812
|
+
className: K("rounded-full", e),
|
|
813
|
+
style: a,
|
|
814
|
+
...o,
|
|
815
|
+
children: [/* @__PURE__ */ X(Xe.Image, {
|
|
816
|
+
alt: r?.name ?? "Organization",
|
|
817
|
+
src: r?.logo ?? void 0
|
|
818
|
+
}), /* @__PURE__ */ X(Xe.Fallback, {
|
|
819
|
+
className: K(i === "lg" ? "text-xl" : i === "md" ? "text-base" : "text-sm"),
|
|
820
|
+
delayMs: r?.logo ? 600 : void 0,
|
|
821
|
+
children: t || s || /* @__PURE__ */ X(Te, { className: "size-4" })
|
|
822
|
+
})]
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
//#endregion
|
|
826
|
+
//#region src/components/auth/organization/organization-view-skeleton.tsx
|
|
827
|
+
function Gt({ className: e, hideSlug: t, size: n = "md", ...r }) {
|
|
828
|
+
return /* @__PURE__ */ Z("div", {
|
|
829
|
+
className: K("flex min-w-0 items-center gap-2", e),
|
|
830
|
+
...r,
|
|
831
|
+
children: [/* @__PURE__ */ X(Wt, {
|
|
832
|
+
isPending: !0,
|
|
833
|
+
className: n === "sm" ? "size-5" : void 0,
|
|
834
|
+
size: n === "lg" ? "md" : "sm"
|
|
835
|
+
}), /* @__PURE__ */ Z("div", {
|
|
836
|
+
className: "flex flex-col min-w-0 gap-1",
|
|
837
|
+
children: [/* @__PURE__ */ X(V, { className: "h-3.5 w-20 rounded-lg" }), !t && /* @__PURE__ */ X(V, { className: "h-3 w-28 rounded-lg mt-[0.5px] mb-0.5" })]
|
|
838
|
+
})]
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
//#endregion
|
|
842
|
+
//#region src/components/auth/organization/organization-view.tsx
|
|
843
|
+
function Q({ className: e, isPending: t, size: n = "md", hideSlug: r, hideRole: i, organization: a, ...o }) {
|
|
844
|
+
let { authClient: s } = p(), { roles: c } = m($), { data: l } = D(s), { data: u, isPending: f } = d(s, { enabled: !a && !t }), h = a ?? u, { data: g, isPending: _ } = E(s, {
|
|
845
|
+
query: { organizationId: h?.id },
|
|
846
|
+
enabled: !!h?.id && !i
|
|
847
|
+
}), v = g?.members?.find((e) => e.userId === l?.user.id);
|
|
848
|
+
return t || !a && f || !i && h?.id && _ ? /* @__PURE__ */ X(Gt, {
|
|
849
|
+
className: e,
|
|
850
|
+
hideSlug: r,
|
|
851
|
+
size: n,
|
|
852
|
+
...o
|
|
853
|
+
}) : /* @__PURE__ */ Z("div", {
|
|
854
|
+
className: K("flex min-w-0 items-center gap-2", e),
|
|
855
|
+
...o,
|
|
856
|
+
children: [/* @__PURE__ */ X(Wt, {
|
|
857
|
+
organization: h,
|
|
858
|
+
className: n === "sm" ? "size-5 [&>span]:text-xs" : void 0,
|
|
859
|
+
size: n === "lg" ? "md" : "sm"
|
|
860
|
+
}), /* @__PURE__ */ Z("div", {
|
|
861
|
+
className: "flex flex-col min-w-0",
|
|
862
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
863
|
+
className: "flex min-w-0 items-center gap-2",
|
|
864
|
+
children: [/* @__PURE__ */ X("p", {
|
|
865
|
+
className: "text-foreground text-sm font-medium truncate leading-tight",
|
|
866
|
+
children: h?.name
|
|
867
|
+
}), !i && !!v && /* @__PURE__ */ X(M, {
|
|
868
|
+
className: "shrink-0 -my-0.5",
|
|
869
|
+
size: "sm",
|
|
870
|
+
children: c?.[v.role] ?? v.role
|
|
871
|
+
})]
|
|
872
|
+
}), !r && /* @__PURE__ */ X("p", {
|
|
873
|
+
className: "text-muted text-xs truncate overflow-x-hidden font-mono leading-tight",
|
|
874
|
+
children: h?.slug
|
|
875
|
+
})]
|
|
876
|
+
})]
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/components/auth/organization/organization-row.tsx
|
|
881
|
+
function Kt({ organization: e }) {
|
|
882
|
+
let { authClient: t, basePaths: n, navigate: r } = p(), { localization: i, viewPaths: a, slug: o } = m($), { mutate: s, isPending: c } = me(t, { onSuccess: () => {
|
|
883
|
+
r({ to: `${n.organization}/${a.organization.settings}` });
|
|
884
|
+
} });
|
|
885
|
+
function l() {
|
|
886
|
+
o === void 0 ? s({ organizationId: e.id }) : r({ to: `${n.organization}/${e.slug}/${a.organization.settings}` });
|
|
887
|
+
}
|
|
888
|
+
return /* @__PURE__ */ Z("div", {
|
|
889
|
+
className: "flex items-center gap-3",
|
|
890
|
+
children: [/* @__PURE__ */ X(Q, { organization: e }), /* @__PURE__ */ Z(A, {
|
|
891
|
+
className: "ml-auto shrink-0",
|
|
892
|
+
variant: "outline",
|
|
893
|
+
size: "sm",
|
|
894
|
+
isPending: c,
|
|
895
|
+
onPress: l,
|
|
896
|
+
"aria-label": i.manage,
|
|
897
|
+
children: [c ? /* @__PURE__ */ X(H, {
|
|
898
|
+
color: "current",
|
|
899
|
+
size: "sm"
|
|
900
|
+
}) : /* @__PURE__ */ X(Re, {}), i.manage]
|
|
901
|
+
})]
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
//#endregion
|
|
905
|
+
//#region src/components/auth/organization/organizations-empty.tsx
|
|
906
|
+
function qt({ onCreatePress: e }) {
|
|
907
|
+
let { localization: t } = m($);
|
|
908
|
+
return /* @__PURE__ */ Z($e, {
|
|
909
|
+
className: "flex flex-col items-center gap-4 text-center",
|
|
910
|
+
children: [
|
|
911
|
+
/* @__PURE__ */ X("div", {
|
|
912
|
+
className: "flex size-12 items-center justify-center rounded-full bg-surface-secondary",
|
|
913
|
+
children: /* @__PURE__ */ X(Te, { className: "size-5" })
|
|
914
|
+
}),
|
|
915
|
+
/* @__PURE__ */ Z("div", {
|
|
916
|
+
className: "flex flex-col gap-2",
|
|
917
|
+
children: [/* @__PURE__ */ X("p", {
|
|
918
|
+
className: "text-sm font-semibold text-foreground",
|
|
919
|
+
children: t.noOrganizations
|
|
920
|
+
}), /* @__PURE__ */ X("span", {
|
|
921
|
+
className: "text-sm text-muted",
|
|
922
|
+
children: t.organizationsDescription
|
|
923
|
+
})]
|
|
924
|
+
}),
|
|
925
|
+
/* @__PURE__ */ X(A, {
|
|
926
|
+
size: "sm",
|
|
927
|
+
onPress: e,
|
|
928
|
+
children: t.createOrganization
|
|
929
|
+
})
|
|
930
|
+
]
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region src/components/auth/organization/organizations.tsx
|
|
935
|
+
function Jt({ variant: e }) {
|
|
936
|
+
let { authClient: t } = p(), { localization: n } = m($), [r, i] = J(!1), { data: a, isPending: o } = se(t);
|
|
937
|
+
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ Z("div", {
|
|
938
|
+
className: "flex flex-col gap-3",
|
|
939
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
940
|
+
className: "flex items-end justify-between gap-3",
|
|
941
|
+
children: [/* @__PURE__ */ X("h2", {
|
|
942
|
+
className: "truncate text-sm font-semibold",
|
|
943
|
+
children: n.organizations
|
|
944
|
+
}), /* @__PURE__ */ X(A, {
|
|
945
|
+
className: "shrink-0",
|
|
946
|
+
size: "sm",
|
|
947
|
+
isDisabled: o,
|
|
948
|
+
onPress: () => i(!0),
|
|
949
|
+
children: n.createOrganization
|
|
950
|
+
})]
|
|
951
|
+
}), /* @__PURE__ */ X(j, {
|
|
952
|
+
variant: e,
|
|
953
|
+
children: /* @__PURE__ */ X(j.Content, {
|
|
954
|
+
className: "gap-0",
|
|
955
|
+
children: o ? /* @__PURE__ */ X(Gt, {}) : a?.length ? a.map((e, t) => /* @__PURE__ */ Z("div", { children: [t > 0 && /* @__PURE__ */ X("div", { className: "-mx-4 my-4 border-b border-dashed" }), /* @__PURE__ */ X(Kt, { organization: e })] }, e.id)) : /* @__PURE__ */ X(qt, { onCreatePress: () => i(!0) })
|
|
956
|
+
})
|
|
957
|
+
})]
|
|
958
|
+
}), /* @__PURE__ */ X(Ut, {
|
|
959
|
+
isOpen: r,
|
|
960
|
+
onOpenChange: i
|
|
961
|
+
})] });
|
|
962
|
+
}
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region src/components/auth/organization/user-invitation-row.tsx
|
|
965
|
+
function Yt({ invitation: e }) {
|
|
966
|
+
let { authClient: t } = p(), { localization: n, roles: r } = m($), { mutate: i, isPending: a } = u(t), { mutate: o, isPending: s } = ue(t);
|
|
967
|
+
return /* @__PURE__ */ Z("div", {
|
|
968
|
+
className: "flex items-center gap-3",
|
|
969
|
+
children: [
|
|
970
|
+
/* @__PURE__ */ X("div", {
|
|
971
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
972
|
+
children: /* @__PURE__ */ X(Ae, { className: "size-4.5" })
|
|
973
|
+
}),
|
|
974
|
+
/* @__PURE__ */ Z("div", {
|
|
975
|
+
className: "flex flex-col",
|
|
976
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
977
|
+
className: "flex items-center gap-1.5",
|
|
978
|
+
children: [/* @__PURE__ */ X("span", {
|
|
979
|
+
className: "truncate text-sm font-medium leading-tight",
|
|
980
|
+
children: e.organizationName
|
|
981
|
+
}), /* @__PURE__ */ X(M, {
|
|
982
|
+
size: "sm",
|
|
983
|
+
children: r?.[e.role] ?? e.role
|
|
984
|
+
})]
|
|
985
|
+
}), /* @__PURE__ */ X("span", {
|
|
986
|
+
className: "truncate text-muted text-xs",
|
|
987
|
+
children: new Date(e.createdAt).toLocaleString(void 0, {
|
|
988
|
+
dateStyle: "medium",
|
|
989
|
+
timeStyle: "short"
|
|
990
|
+
})
|
|
991
|
+
})]
|
|
992
|
+
}),
|
|
993
|
+
/* @__PURE__ */ Z("div", {
|
|
994
|
+
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
995
|
+
children: [/* @__PURE__ */ Z(A, {
|
|
996
|
+
variant: "outline",
|
|
997
|
+
size: "sm",
|
|
998
|
+
isPending: a,
|
|
999
|
+
isDisabled: s,
|
|
1000
|
+
onPress: () => i({ invitationId: e.id }),
|
|
1001
|
+
children: [a ? /* @__PURE__ */ X(H, {
|
|
1002
|
+
color: "current",
|
|
1003
|
+
size: "sm"
|
|
1004
|
+
}) : /* @__PURE__ */ X(Ee, {}), n.accept]
|
|
1005
|
+
}), /* @__PURE__ */ X(A, {
|
|
1006
|
+
variant: "danger-soft",
|
|
1007
|
+
size: "sm",
|
|
1008
|
+
isIconOnly: !0,
|
|
1009
|
+
isPending: s,
|
|
1010
|
+
isDisabled: a,
|
|
1011
|
+
onPress: () => o({ invitationId: e.id }),
|
|
1012
|
+
"aria-label": n.rejectInvitation,
|
|
1013
|
+
children: s ? /* @__PURE__ */ X(H, {
|
|
1014
|
+
color: "current",
|
|
1015
|
+
size: "sm"
|
|
1016
|
+
}) : /* @__PURE__ */ X(O, {})
|
|
1017
|
+
})]
|
|
1018
|
+
})
|
|
1019
|
+
]
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/components/auth/organization/user-invitation-row-skeleton.tsx
|
|
1024
|
+
function Xt() {
|
|
1025
|
+
return /* @__PURE__ */ Z("div", {
|
|
1026
|
+
className: "flex items-center gap-3",
|
|
1027
|
+
children: [/* @__PURE__ */ X(V, { className: "size-10 shrink-0 rounded-xl" }), /* @__PURE__ */ Z("div", {
|
|
1028
|
+
className: "flex flex-col gap-1",
|
|
1029
|
+
children: [/* @__PURE__ */ X(V, { className: "h-4 w-40 rounded-lg" }), /* @__PURE__ */ X(V, { className: "h-3 w-28 rounded-lg" })]
|
|
1030
|
+
})]
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
//#endregion
|
|
1034
|
+
//#region src/components/auth/organization/user-invitations-empty.tsx
|
|
1035
|
+
function Zt() {
|
|
1036
|
+
let { localization: e } = m($);
|
|
1037
|
+
return /* @__PURE__ */ Z($e, {
|
|
1038
|
+
className: "flex flex-col items-center gap-4 text-center",
|
|
1039
|
+
children: [/* @__PURE__ */ X("div", {
|
|
1040
|
+
className: "flex size-12 items-center justify-center rounded-full bg-surface-secondary",
|
|
1041
|
+
children: /* @__PURE__ */ X(Ue, { className: "size-5" })
|
|
1042
|
+
}), /* @__PURE__ */ Z("div", {
|
|
1043
|
+
className: "flex flex-col gap-2",
|
|
1044
|
+
children: [/* @__PURE__ */ X("p", {
|
|
1045
|
+
className: "text-sm font-semibold text-foreground",
|
|
1046
|
+
children: e.noInvitations
|
|
1047
|
+
}), /* @__PURE__ */ X("span", {
|
|
1048
|
+
className: "text-sm text-muted",
|
|
1049
|
+
children: e.userInvitationsEmptyDescription
|
|
1050
|
+
})]
|
|
1051
|
+
})]
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region src/components/auth/organization/user-invitations.tsx
|
|
1056
|
+
function Qt({ variant: e }) {
|
|
1057
|
+
let { authClient: t } = p(), { localization: n } = m($), { data: r, isPending: i } = le(t);
|
|
1058
|
+
return /* @__PURE__ */ Z("div", {
|
|
1059
|
+
className: "flex flex-col gap-3",
|
|
1060
|
+
children: [/* @__PURE__ */ X("h2", {
|
|
1061
|
+
className: "truncate text-sm font-semibold",
|
|
1062
|
+
children: n.invitations
|
|
1063
|
+
}), /* @__PURE__ */ X(j, {
|
|
1064
|
+
variant: e,
|
|
1065
|
+
children: /* @__PURE__ */ X(j.Content, { children: i ? /* @__PURE__ */ X(Xt, {}) : r?.length ? r?.map((e, t) => /* @__PURE__ */ Z("div", { children: [t > 0 && /* @__PURE__ */ X("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ X(Yt, { invitation: e })] }, e.id)) : /* @__PURE__ */ X(Zt, {}) })
|
|
1066
|
+
})]
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
//#endregion
|
|
1070
|
+
//#region src/components/auth/organization/organizations-settings.tsx
|
|
1071
|
+
function $t({ className: e, variant: t, ...n }) {
|
|
1072
|
+
return /* @__PURE__ */ Z("div", {
|
|
1073
|
+
className: K("flex w-full flex-col gap-4 md:gap-6", e),
|
|
1074
|
+
...n,
|
|
1075
|
+
children: [/* @__PURE__ */ X(Jt, { variant: t }), /* @__PURE__ */ X(Qt, { variant: t })]
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
//#endregion
|
|
1079
|
+
//#region src/lib/auth/organization-plugin.tsx
|
|
1080
|
+
var $ = a(mt.id, (e = {}) => {
|
|
1081
|
+
let t = mt(e);
|
|
1082
|
+
return {
|
|
1083
|
+
...t,
|
|
1084
|
+
localization: t.localization,
|
|
1085
|
+
settingsTabs: [{
|
|
1086
|
+
view: "organizations",
|
|
1087
|
+
label: /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(Te, { className: "text-muted" }), t.localization.organizations] }),
|
|
1088
|
+
component: $t
|
|
1089
|
+
}]
|
|
1090
|
+
};
|
|
1091
|
+
});
|
|
1092
|
+
//#endregion
|
|
1093
|
+
//#region src/components/auth/organization/change-organization-logo.tsx
|
|
1094
|
+
function en({ className: e }) {
|
|
1095
|
+
let { authClient: t } = p(), { logo: n, localization: r } = m($), { data: i, isPending: a } = d(t), { mutate: s, isPending: c } = xe(t), l = st(null), [u, f] = J(!1), [h, g] = J(!1), _ = c || u || h;
|
|
1096
|
+
async function v(e) {
|
|
1097
|
+
let t = e.target.files?.[0];
|
|
1098
|
+
if (!(!t || !i)) {
|
|
1099
|
+
e.target.value = "", f(!0);
|
|
1100
|
+
try {
|
|
1101
|
+
let e = await n.resize?.(t, n.size, n.extension) || t;
|
|
1102
|
+
s({ data: { logo: await n.upload?.(e) || await o(e) } }, {
|
|
1103
|
+
onSuccess: () => q.success(r.logoChangedSuccess),
|
|
1104
|
+
onSettled: () => f(!1)
|
|
1105
|
+
});
|
|
1106
|
+
} catch (e) {
|
|
1107
|
+
f(!1), e instanceof Error && q.danger(e.message);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
async function y() {
|
|
1112
|
+
let e = i?.logo;
|
|
1113
|
+
s({ data: { logo: "" } }, { onSuccess: async () => {
|
|
1114
|
+
if (!e) {
|
|
1115
|
+
q.success(r.logoDeletedSuccess);
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
g(!0);
|
|
1119
|
+
try {
|
|
1120
|
+
await n.delete?.(e), q.success(r.logoDeletedSuccess);
|
|
1121
|
+
} catch (e) {
|
|
1122
|
+
e instanceof Error && q.danger(e.message);
|
|
1123
|
+
} finally {
|
|
1124
|
+
g(!1);
|
|
1125
|
+
}
|
|
1126
|
+
} });
|
|
1127
|
+
}
|
|
1128
|
+
return n.enabled ? /* @__PURE__ */ Z("div", {
|
|
1129
|
+
className: K("flex flex-col gap-1", e),
|
|
1130
|
+
children: [
|
|
1131
|
+
/* @__PURE__ */ X(R, {
|
|
1132
|
+
isDisabled: !i,
|
|
1133
|
+
children: r.logo
|
|
1134
|
+
}),
|
|
1135
|
+
/* @__PURE__ */ X("input", {
|
|
1136
|
+
ref: l,
|
|
1137
|
+
type: "file",
|
|
1138
|
+
accept: "image/*",
|
|
1139
|
+
className: "hidden",
|
|
1140
|
+
onChange: v
|
|
1141
|
+
}),
|
|
1142
|
+
/* @__PURE__ */ Z("div", {
|
|
1143
|
+
className: "flex items-center gap-4",
|
|
1144
|
+
children: [/* @__PURE__ */ X(A, {
|
|
1145
|
+
type: "button",
|
|
1146
|
+
isIconOnly: !0,
|
|
1147
|
+
variant: "ghost",
|
|
1148
|
+
className: "p-0 h-auto w-auto rounded-full",
|
|
1149
|
+
isDisabled: !i || _,
|
|
1150
|
+
onPress: () => l.current?.click(),
|
|
1151
|
+
children: /* @__PURE__ */ X(Wt, {
|
|
1152
|
+
size: "lg",
|
|
1153
|
+
isPending: a,
|
|
1154
|
+
organization: i
|
|
1155
|
+
})
|
|
1156
|
+
}), /* @__PURE__ */ Z(N, { children: [/* @__PURE__ */ Z(A, {
|
|
1157
|
+
isDisabled: !i || _,
|
|
1158
|
+
size: "sm",
|
|
1159
|
+
variant: "secondary",
|
|
1160
|
+
children: [_ && /* @__PURE__ */ X(H, { size: "sm" }), r.changeLogo]
|
|
1161
|
+
}), /* @__PURE__ */ X(N.Popover, {
|
|
1162
|
+
className: "min-w-fit",
|
|
1163
|
+
children: /* @__PURE__ */ Z(N.Menu, { children: [/* @__PURE__ */ Z(N.Item, {
|
|
1164
|
+
textValue: r.uploadLogo,
|
|
1165
|
+
onAction: () => l.current?.click(),
|
|
1166
|
+
children: [/* @__PURE__ */ X(je, { className: "text-muted" }), /* @__PURE__ */ X(R, { children: r.uploadLogo })]
|
|
1167
|
+
}), /* @__PURE__ */ Z(N.Item, {
|
|
1168
|
+
textValue: r.deleteLogo,
|
|
1169
|
+
isDisabled: !i?.logo,
|
|
1170
|
+
onAction: y,
|
|
1171
|
+
variant: "danger",
|
|
1172
|
+
children: [/* @__PURE__ */ X(Je, { className: "text-danger" }), /* @__PURE__ */ X(R, { children: r.deleteLogo })]
|
|
1173
|
+
})] })
|
|
1174
|
+
})] })]
|
|
1175
|
+
})
|
|
1176
|
+
]
|
|
1177
|
+
}) : null;
|
|
1178
|
+
}
|
|
1179
|
+
//#endregion
|
|
1180
|
+
//#region src/components/auth/organization/delete-organization-dialog.tsx
|
|
1181
|
+
function tn({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
1182
|
+
let { authClient: r, basePaths: i, localization: a, navigate: o } = p(), { localization: s, viewPaths: c } = m($), { mutate: l, isPending: u } = x(r, { onSuccess: () => {
|
|
1183
|
+
t(!1), q.success(s.organizationDeleted), o({
|
|
1184
|
+
to: `${i.settings}/${c.settings.organizations}`,
|
|
1185
|
+
replace: !0
|
|
1186
|
+
});
|
|
1187
|
+
} });
|
|
1188
|
+
function d(e) {
|
|
1189
|
+
e.preventDefault(), l({ organizationId: n.id });
|
|
1190
|
+
}
|
|
1191
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
1192
|
+
isOpen: e,
|
|
1193
|
+
onOpenChange: t,
|
|
1194
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ X(k.Dialog, { children: /* @__PURE__ */ Z(F, {
|
|
1195
|
+
onSubmit: d,
|
|
1196
|
+
children: [
|
|
1197
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
1198
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
1199
|
+
status: "danger",
|
|
1200
|
+
children: /* @__PURE__ */ X(Ye, {})
|
|
1201
|
+
}), /* @__PURE__ */ X(k.Heading, { children: s.deleteOrganization })] }),
|
|
1202
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
1203
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
1204
|
+
children: [/* @__PURE__ */ X("p", {
|
|
1205
|
+
className: "text-muted text-sm",
|
|
1206
|
+
children: s.deleteOrganizationDescription
|
|
1207
|
+
}), /* @__PURE__ */ X(j, {
|
|
1208
|
+
variant: "secondary",
|
|
1209
|
+
children: /* @__PURE__ */ X(j.Content, { children: /* @__PURE__ */ X(Q, {
|
|
1210
|
+
organization: n,
|
|
1211
|
+
hideRole: !0
|
|
1212
|
+
}) })
|
|
1213
|
+
})]
|
|
1214
|
+
}),
|
|
1215
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
1216
|
+
slot: "close",
|
|
1217
|
+
variant: "tertiary",
|
|
1218
|
+
isDisabled: u,
|
|
1219
|
+
children: a.settings.cancel
|
|
1220
|
+
}), /* @__PURE__ */ Z(A, {
|
|
1221
|
+
type: "submit",
|
|
1222
|
+
variant: "danger",
|
|
1223
|
+
isPending: u,
|
|
1224
|
+
children: [u && /* @__PURE__ */ X(H, {
|
|
1225
|
+
color: "current",
|
|
1226
|
+
size: "sm"
|
|
1227
|
+
}), s.deleteOrganization]
|
|
1228
|
+
})] })
|
|
1229
|
+
]
|
|
1230
|
+
}) }) })
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
//#endregion
|
|
1234
|
+
//#region src/components/auth/organization/delete-organization-skeleton.tsx
|
|
1235
|
+
function nn() {
|
|
1236
|
+
return /* @__PURE__ */ Z("div", {
|
|
1237
|
+
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1238
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
1239
|
+
className: "flex flex-col gap-1",
|
|
1240
|
+
children: [/* @__PURE__ */ X(V, { className: "h-3.5 w-40 rounded-lg" }), /* @__PURE__ */ X(V, { className: "h-3 w-64 rounded-lg" })]
|
|
1241
|
+
}), /* @__PURE__ */ X(V, { className: "h-8 w-36 shrink-0 rounded-full" })]
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
//#endregion
|
|
1245
|
+
//#region src/components/auth/organization/delete-organization.tsx
|
|
1246
|
+
function rn() {
|
|
1247
|
+
let { authClient: e } = p(), { localization: t } = m($), { data: n } = d(e), { data: r, isPending: i } = T(e, { permissions: { organization: ["delete"] } }), [a, o] = J(!1);
|
|
1248
|
+
return i ? /* @__PURE__ */ X(nn, {}) : r?.success ? /* @__PURE__ */ Z("div", {
|
|
1249
|
+
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1250
|
+
children: [/* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("p", {
|
|
1251
|
+
className: "text-sm font-medium leading-tight",
|
|
1252
|
+
children: t.deleteOrganization
|
|
1253
|
+
}), /* @__PURE__ */ X("p", {
|
|
1254
|
+
className: "text-muted mt-0.5 text-xs",
|
|
1255
|
+
children: t.deleteOrganizationDescription
|
|
1256
|
+
})] }), /* @__PURE__ */ Z(k, { children: [/* @__PURE__ */ X(A, {
|
|
1257
|
+
isDisabled: !n,
|
|
1258
|
+
size: "sm",
|
|
1259
|
+
variant: "danger-soft",
|
|
1260
|
+
onPress: () => o(!0),
|
|
1261
|
+
children: t.deleteOrganization
|
|
1262
|
+
}), n && /* @__PURE__ */ X(tn, {
|
|
1263
|
+
isOpen: a,
|
|
1264
|
+
onOpenChange: o,
|
|
1265
|
+
organization: n
|
|
1266
|
+
})] })]
|
|
1267
|
+
}) : null;
|
|
1268
|
+
}
|
|
1269
|
+
//#endregion
|
|
1270
|
+
//#region src/components/auth/organization/invite-member-dialog.tsx
|
|
1271
|
+
var an = (e) => e.includes("member") ? "member" : e.at(-1) ?? "";
|
|
1272
|
+
function on({ isOpen: e, onOpenChange: t }) {
|
|
1273
|
+
let { authClient: n, localization: r } = p(), { localization: i, roles: a } = m($), [o, s] = J(() => an(Object.keys(a)));
|
|
1274
|
+
at(() => {
|
|
1275
|
+
s((e) => {
|
|
1276
|
+
let t = Object.keys(a);
|
|
1277
|
+
return t.includes(e) ? e : an(t);
|
|
1278
|
+
});
|
|
1279
|
+
}, [a]);
|
|
1280
|
+
let { mutate: c, isPending: l } = ee(n, { onSuccess: () => {
|
|
1281
|
+
t(!1), q.success(i.inviteMemberSuccess);
|
|
1282
|
+
} }), u = Object.keys(a).includes(o);
|
|
1283
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
1284
|
+
isOpen: e,
|
|
1285
|
+
onOpenChange: t,
|
|
1286
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ X(k.Dialog, { children: /* @__PURE__ */ Z(F, {
|
|
1287
|
+
onSubmit: (e) => {
|
|
1288
|
+
e.preventDefault(), u && c({
|
|
1289
|
+
email: new FormData(e.target).get("email").trim(),
|
|
1290
|
+
role: o
|
|
1291
|
+
});
|
|
1292
|
+
},
|
|
1293
|
+
children: [
|
|
1294
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
1295
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
1296
|
+
status: "default",
|
|
1297
|
+
children: /* @__PURE__ */ X(Ke, {})
|
|
1298
|
+
}), /* @__PURE__ */ X(k.Heading, { children: i.inviteMember })] }),
|
|
1299
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
1300
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
1301
|
+
children: [
|
|
1302
|
+
/* @__PURE__ */ X("p", {
|
|
1303
|
+
className: "text-muted text-sm",
|
|
1304
|
+
children: i.inviteMemberDescription
|
|
1305
|
+
}),
|
|
1306
|
+
/* @__PURE__ */ Z(G, {
|
|
1307
|
+
id: "email",
|
|
1308
|
+
name: "email",
|
|
1309
|
+
type: "email",
|
|
1310
|
+
isDisabled: l,
|
|
1311
|
+
children: [
|
|
1312
|
+
/* @__PURE__ */ X(R, { children: r.auth.email }),
|
|
1313
|
+
/* @__PURE__ */ X(I, {
|
|
1314
|
+
autoFocus: !0,
|
|
1315
|
+
placeholder: r.auth.email,
|
|
1316
|
+
variant: "secondary",
|
|
1317
|
+
required: !0
|
|
1318
|
+
}),
|
|
1319
|
+
/* @__PURE__ */ X(P, {})
|
|
1320
|
+
]
|
|
1321
|
+
}),
|
|
1322
|
+
/* @__PURE__ */ Z(rt, {
|
|
1323
|
+
name: "role",
|
|
1324
|
+
value: o,
|
|
1325
|
+
onChange: (e) => {
|
|
1326
|
+
typeof e == "string" && s(e);
|
|
1327
|
+
},
|
|
1328
|
+
isDisabled: l,
|
|
1329
|
+
variant: "secondary",
|
|
1330
|
+
fullWidth: !0,
|
|
1331
|
+
children: [
|
|
1332
|
+
/* @__PURE__ */ X(R, { children: i.role }),
|
|
1333
|
+
/* @__PURE__ */ Z(rt.Trigger, { children: [/* @__PURE__ */ X(rt.Value, {}), /* @__PURE__ */ X(rt.Indicator, {})] }),
|
|
1334
|
+
/* @__PURE__ */ X(rt.Popover, { children: /* @__PURE__ */ X(tt, { children: Object.entries(a).map(([e, t]) => /* @__PURE__ */ Z(tt.Item, {
|
|
1335
|
+
id: e,
|
|
1336
|
+
textValue: t,
|
|
1337
|
+
children: [t, /* @__PURE__ */ X(tt.ItemIndicator, {})]
|
|
1338
|
+
}, e)) }) }),
|
|
1339
|
+
/* @__PURE__ */ X(P, {})
|
|
1340
|
+
]
|
|
1341
|
+
})
|
|
1342
|
+
]
|
|
1343
|
+
}),
|
|
1344
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
1345
|
+
slot: "close",
|
|
1346
|
+
variant: "tertiary",
|
|
1347
|
+
isDisabled: l,
|
|
1348
|
+
children: r.settings.cancel
|
|
1349
|
+
}), /* @__PURE__ */ Z(A, {
|
|
1350
|
+
type: "submit",
|
|
1351
|
+
isPending: l,
|
|
1352
|
+
isDisabled: !u,
|
|
1353
|
+
children: [l && /* @__PURE__ */ X(H, {
|
|
1354
|
+
color: "current",
|
|
1355
|
+
size: "sm"
|
|
1356
|
+
}), i.inviteMember]
|
|
1357
|
+
})] })
|
|
1358
|
+
]
|
|
1359
|
+
}) }) })
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
//#endregion
|
|
1363
|
+
//#region src/components/auth/organization/leave-organization-dialog.tsx
|
|
1364
|
+
function sn({ isOpen: e, onOpenChange: t, organization: n }) {
|
|
1365
|
+
let { authClient: r, basePaths: i, localization: a, navigate: o } = p(), { localization: s, viewPaths: c } = m($), { mutate: l, isPending: u } = ne(r, { onSuccess: () => {
|
|
1366
|
+
t(!1), q.success(s.leftOrganization), o({
|
|
1367
|
+
to: `${i.settings}/${c.settings.organizations}`,
|
|
1368
|
+
replace: !0
|
|
1369
|
+
});
|
|
1370
|
+
} });
|
|
1371
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
1372
|
+
isOpen: e,
|
|
1373
|
+
onOpenChange: t,
|
|
1374
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ Z(k.Dialog, { children: [
|
|
1375
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
1376
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
1377
|
+
status: "danger",
|
|
1378
|
+
children: /* @__PURE__ */ X(we, {})
|
|
1379
|
+
}), /* @__PURE__ */ X(k.Heading, { children: s.leaveOrganization })] }),
|
|
1380
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
1381
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
1382
|
+
children: [/* @__PURE__ */ X("p", {
|
|
1383
|
+
className: "text-muted text-sm",
|
|
1384
|
+
children: s.leaveOrganizationDescription
|
|
1385
|
+
}), /* @__PURE__ */ X(j, {
|
|
1386
|
+
variant: "secondary",
|
|
1387
|
+
children: /* @__PURE__ */ X(j.Content, { children: /* @__PURE__ */ X(Q, {
|
|
1388
|
+
organization: n,
|
|
1389
|
+
hideRole: !0
|
|
1390
|
+
}) })
|
|
1391
|
+
})]
|
|
1392
|
+
}),
|
|
1393
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
1394
|
+
slot: "close",
|
|
1395
|
+
variant: "tertiary",
|
|
1396
|
+
isDisabled: u,
|
|
1397
|
+
children: a.settings.cancel
|
|
1398
|
+
}), /* @__PURE__ */ Z(A, {
|
|
1399
|
+
variant: "danger",
|
|
1400
|
+
isPending: u,
|
|
1401
|
+
onPress: () => l({ organizationId: n.id }),
|
|
1402
|
+
children: [u && /* @__PURE__ */ X(H, {
|
|
1403
|
+
color: "current",
|
|
1404
|
+
size: "sm"
|
|
1405
|
+
}), s.leaveOrganization]
|
|
1406
|
+
})] })
|
|
1407
|
+
] }) })
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
//#endregion
|
|
1411
|
+
//#region src/components/auth/organization/leave-organization.tsx
|
|
1412
|
+
function cn() {
|
|
1413
|
+
let { authClient: e } = p(), { localization: t } = m($), { data: n } = d(e), [r, i] = J(!1);
|
|
1414
|
+
return /* @__PURE__ */ Z("div", {
|
|
1415
|
+
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
1416
|
+
children: [/* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("p", {
|
|
1417
|
+
className: "text-sm font-medium leading-tight",
|
|
1418
|
+
children: t.leaveOrganization
|
|
1419
|
+
}), /* @__PURE__ */ X("p", {
|
|
1420
|
+
className: "text-muted mt-0.5 text-xs",
|
|
1421
|
+
children: t.leaveOrganizationDescription
|
|
1422
|
+
})] }), /* @__PURE__ */ Z(k, { children: [/* @__PURE__ */ X(A, {
|
|
1423
|
+
isDisabled: !n,
|
|
1424
|
+
size: "sm",
|
|
1425
|
+
variant: "danger-soft",
|
|
1426
|
+
onPress: () => i(!0),
|
|
1427
|
+
children: t.leaveOrganization
|
|
1428
|
+
}), n && /* @__PURE__ */ X(sn, {
|
|
1429
|
+
isOpen: r,
|
|
1430
|
+
onOpenChange: i,
|
|
1431
|
+
organization: n
|
|
1432
|
+
})] })]
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
//#endregion
|
|
1436
|
+
//#region src/components/auth/organization/organization-invitation-row-skeleton.tsx
|
|
1437
|
+
function ln() {
|
|
1438
|
+
return /* @__PURE__ */ Z(U.Row, { children: [
|
|
1439
|
+
/* @__PURE__ */ X(U.Cell, { children: /* @__PURE__ */ X(V, { className: "h-4 w-48 rounded-lg" }) }),
|
|
1440
|
+
/* @__PURE__ */ X(U.Cell, { children: /* @__PURE__ */ X(V, { className: "h-4 w-36 rounded-lg" }) }),
|
|
1441
|
+
/* @__PURE__ */ X(U.Cell, { children: /* @__PURE__ */ X(V, { className: "h-4 w-16 rounded-lg" }) }),
|
|
1442
|
+
/* @__PURE__ */ X(U.Cell, { children: /* @__PURE__ */ X(V, { className: "h-4 w-14 rounded-full" }) }),
|
|
1443
|
+
/* @__PURE__ */ X(U.Cell, {})
|
|
1444
|
+
] });
|
|
1445
|
+
}
|
|
1446
|
+
//#endregion
|
|
1447
|
+
//#region src/components/auth/organization/organization-invitation-row.tsx
|
|
1448
|
+
function un({ invitation: e }) {
|
|
1449
|
+
let { authClient: t } = p(), { localization: n, roles: r } = m($), { data: i, isPending: a } = T(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";
|
|
1450
|
+
return a ? /* @__PURE__ */ X(ln, {}) : /* @__PURE__ */ Z(U.Row, { children: [
|
|
1451
|
+
/* @__PURE__ */ X(U.Cell, {
|
|
1452
|
+
className: "font-medium text-sm",
|
|
1453
|
+
children: e.email
|
|
1454
|
+
}),
|
|
1455
|
+
/* @__PURE__ */ X(U.Cell, {
|
|
1456
|
+
className: "text-muted text-xs tabular-nums whitespace-nowrap",
|
|
1457
|
+
children: new Date(e.createdAt).toLocaleString(void 0, {
|
|
1458
|
+
dateStyle: "short",
|
|
1459
|
+
timeStyle: "short"
|
|
1460
|
+
})
|
|
1461
|
+
}),
|
|
1462
|
+
/* @__PURE__ */ X(U.Cell, {
|
|
1463
|
+
className: "text-sm",
|
|
1464
|
+
children: c
|
|
1465
|
+
}),
|
|
1466
|
+
/* @__PURE__ */ X(U.Cell, {
|
|
1467
|
+
className: "text-sm",
|
|
1468
|
+
children: /* @__PURE__ */ X(M, {
|
|
1469
|
+
color: u,
|
|
1470
|
+
size: "sm",
|
|
1471
|
+
variant: "soft",
|
|
1472
|
+
children: l
|
|
1473
|
+
})
|
|
1474
|
+
}),
|
|
1475
|
+
/* @__PURE__ */ X(U.Cell, {
|
|
1476
|
+
className: "text-end",
|
|
1477
|
+
children: i?.success && e.status === "pending" && /* @__PURE__ */ X(A, {
|
|
1478
|
+
isIconOnly: !0,
|
|
1479
|
+
size: "sm",
|
|
1480
|
+
variant: "danger-soft",
|
|
1481
|
+
isPending: s,
|
|
1482
|
+
onPress: () => o({ invitationId: e.id }),
|
|
1483
|
+
"aria-label": n.cancelInvitation,
|
|
1484
|
+
children: s ? /* @__PURE__ */ X(H, {
|
|
1485
|
+
color: "current",
|
|
1486
|
+
size: "sm"
|
|
1487
|
+
}) : /* @__PURE__ */ X(O, {})
|
|
1488
|
+
})
|
|
1489
|
+
})
|
|
1490
|
+
] });
|
|
1491
|
+
}
|
|
1492
|
+
//#endregion
|
|
1493
|
+
//#region src/components/auth/organization/organization-invitations-empty.tsx
|
|
1494
|
+
function dn({ onInvitePress: e }) {
|
|
1495
|
+
let { localization: t } = m($);
|
|
1496
|
+
return /* @__PURE__ */ Z($e, {
|
|
1497
|
+
className: "flex flex-col items-center gap-4 text-center p-4",
|
|
1498
|
+
children: [
|
|
1499
|
+
/* @__PURE__ */ X(Ue, { className: "size-6 text-muted" }),
|
|
1500
|
+
/* @__PURE__ */ Z("div", {
|
|
1501
|
+
className: "flex flex-col gap-2",
|
|
1502
|
+
children: [/* @__PURE__ */ X("p", {
|
|
1503
|
+
className: "text-sm font-semibold text-foreground",
|
|
1504
|
+
children: t.noInvitations
|
|
1505
|
+
}), /* @__PURE__ */ X("span", {
|
|
1506
|
+
className: "text-sm text-muted",
|
|
1507
|
+
children: t.organizationInvitationsEmptyDescription
|
|
1508
|
+
})]
|
|
1509
|
+
}),
|
|
1510
|
+
/* @__PURE__ */ X(A, {
|
|
1511
|
+
size: "sm",
|
|
1512
|
+
onPress: e,
|
|
1513
|
+
children: t.inviteMember
|
|
1514
|
+
})
|
|
1515
|
+
]
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
//#endregion
|
|
1519
|
+
//#region src/components/auth/organization/organization-invitations.tsx
|
|
1520
|
+
function fn({ className: e, ...t }) {
|
|
1521
|
+
let { authClient: n, localization: r } = p(), { localization: i, roles: a } = m($), { data: o, isPending: s } = oe(n), { isPending: c } = T(n, { permissions: { invitation: ["cancel"] } }), l = s || c, [u, d] = J(), [f, h] = J("all"), [g, _] = J("all"), [v, y] = J(""), b = ot(() => o?.filter((e) => (f === "all" || e.role === f) && (g === "all" || e.status === g) && e.email.toLowerCase().includes(v.toLowerCase())), [
|
|
1522
|
+
v,
|
|
1523
|
+
o,
|
|
1524
|
+
f,
|
|
1525
|
+
g
|
|
1526
|
+
]), x = ot(() => !u || !b ? b : [...b].sort((e, t) => {
|
|
1527
|
+
let n = u.column, r = 0;
|
|
1528
|
+
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;
|
|
1529
|
+
}), [u, b]), [S, C] = J(!1);
|
|
1530
|
+
return /* @__PURE__ */ Z("div", {
|
|
1531
|
+
className: K("flex flex-col gap-3", e),
|
|
1532
|
+
...t,
|
|
1533
|
+
children: [
|
|
1534
|
+
/* @__PURE__ */ X("h3", {
|
|
1535
|
+
className: "truncate text-sm font-semibold",
|
|
1536
|
+
children: i.invitations
|
|
1537
|
+
}),
|
|
1538
|
+
/* @__PURE__ */ Z("div", {
|
|
1539
|
+
className: "flex flex-col gap-4",
|
|
1540
|
+
children: [
|
|
1541
|
+
/* @__PURE__ */ Z("div", {
|
|
1542
|
+
className: "flex items-center gap-3",
|
|
1543
|
+
children: [
|
|
1544
|
+
/* @__PURE__ */ X(B, {
|
|
1545
|
+
className: "min-w-0",
|
|
1546
|
+
"aria-label": i.search,
|
|
1547
|
+
value: v,
|
|
1548
|
+
onChange: y,
|
|
1549
|
+
isDisabled: l,
|
|
1550
|
+
children: /* @__PURE__ */ Z(B.Group, { children: [
|
|
1551
|
+
/* @__PURE__ */ X(B.SearchIcon, {}),
|
|
1552
|
+
/* @__PURE__ */ X(B.Input, {
|
|
1553
|
+
placeholder: i.search,
|
|
1554
|
+
className: "sm:w-[200px]"
|
|
1555
|
+
}),
|
|
1556
|
+
/* @__PURE__ */ X(B.ClearButton, {})
|
|
1557
|
+
] })
|
|
1558
|
+
}),
|
|
1559
|
+
/* @__PURE__ */ Z(N, { children: [/* @__PURE__ */ Z(A, {
|
|
1560
|
+
size: "sm",
|
|
1561
|
+
variant: "secondary",
|
|
1562
|
+
isDisabled: l,
|
|
1563
|
+
children: [/* @__PURE__ */ X(Le, {}), i.role]
|
|
1564
|
+
}), /* @__PURE__ */ X(N.Popover, { children: /* @__PURE__ */ Z(N.Menu, {
|
|
1565
|
+
selectionMode: "single",
|
|
1566
|
+
selectedKeys: new Set([f]),
|
|
1567
|
+
onSelectionChange: (e) => {
|
|
1568
|
+
let t = [...e][0];
|
|
1569
|
+
h(t ?? "all");
|
|
1570
|
+
},
|
|
1571
|
+
children: [/* @__PURE__ */ Z(N.Item, {
|
|
1572
|
+
id: "all",
|
|
1573
|
+
textValue: i.all,
|
|
1574
|
+
children: [/* @__PURE__ */ X(R, { children: i.all }), /* @__PURE__ */ X(N.ItemIndicator, {})]
|
|
1575
|
+
}), Object.entries(a).map(([e, t]) => /* @__PURE__ */ Z(N.Item, {
|
|
1576
|
+
id: e,
|
|
1577
|
+
textValue: t,
|
|
1578
|
+
children: [/* @__PURE__ */ X(R, { children: t }), /* @__PURE__ */ X(N.ItemIndicator, {})]
|
|
1579
|
+
}, e))]
|
|
1580
|
+
}) })] }),
|
|
1581
|
+
/* @__PURE__ */ Z(N, { children: [/* @__PURE__ */ Z(A, {
|
|
1582
|
+
size: "sm",
|
|
1583
|
+
variant: "secondary",
|
|
1584
|
+
isDisabled: l,
|
|
1585
|
+
children: [/* @__PURE__ */ X(Le, {}), i.status]
|
|
1586
|
+
}), /* @__PURE__ */ X(N.Popover, { children: /* @__PURE__ */ Z(N.Menu, {
|
|
1587
|
+
selectionMode: "single",
|
|
1588
|
+
selectedKeys: new Set([g]),
|
|
1589
|
+
onSelectionChange: (e) => {
|
|
1590
|
+
let t = [...e][0];
|
|
1591
|
+
_(t ?? "all");
|
|
1592
|
+
},
|
|
1593
|
+
children: [/* @__PURE__ */ Z(N.Item, {
|
|
1594
|
+
id: "all",
|
|
1595
|
+
textValue: i.all,
|
|
1596
|
+
children: [/* @__PURE__ */ X(R, { children: i.all }), /* @__PURE__ */ X(N.ItemIndicator, {})]
|
|
1597
|
+
}), [
|
|
1598
|
+
"pending",
|
|
1599
|
+
"accepted",
|
|
1600
|
+
"rejected",
|
|
1601
|
+
"canceled"
|
|
1602
|
+
].map((e) => /* @__PURE__ */ Z(N.Item, {
|
|
1603
|
+
id: e,
|
|
1604
|
+
textValue: i[e] ?? e,
|
|
1605
|
+
children: [/* @__PURE__ */ X(R, { children: i[e] ?? e }), /* @__PURE__ */ X(N.ItemIndicator, {})]
|
|
1606
|
+
}, e))]
|
|
1607
|
+
}) })] })
|
|
1608
|
+
]
|
|
1609
|
+
}),
|
|
1610
|
+
(f !== "all" || g !== "all") && /* @__PURE__ */ Z("div", {
|
|
1611
|
+
className: "flex flex-wrap gap-2",
|
|
1612
|
+
children: [f !== "all" && /* @__PURE__ */ Z(M, {
|
|
1613
|
+
size: "sm",
|
|
1614
|
+
variant: "secondary",
|
|
1615
|
+
className: "w-fit",
|
|
1616
|
+
children: [/* @__PURE__ */ Z(M.Label, { children: [
|
|
1617
|
+
i.role,
|
|
1618
|
+
":",
|
|
1619
|
+
" ",
|
|
1620
|
+
/* @__PURE__ */ X("span", {
|
|
1621
|
+
className: "capitalize",
|
|
1622
|
+
children: a?.[f] ?? f
|
|
1623
|
+
})
|
|
1624
|
+
] }), /* @__PURE__ */ X("button", {
|
|
1625
|
+
type: "button",
|
|
1626
|
+
"aria-label": i.clear,
|
|
1627
|
+
className: "text-muted hover:text-foreground inline-flex cursor-pointer items-center",
|
|
1628
|
+
onClick: () => h("all"),
|
|
1629
|
+
children: /* @__PURE__ */ X(O, { className: "size-3" })
|
|
1630
|
+
})]
|
|
1631
|
+
}), g !== "all" && /* @__PURE__ */ Z(M, {
|
|
1632
|
+
size: "sm",
|
|
1633
|
+
variant: "secondary",
|
|
1634
|
+
className: "w-fit",
|
|
1635
|
+
children: [/* @__PURE__ */ Z(M.Label, { children: [
|
|
1636
|
+
i.status,
|
|
1637
|
+
":",
|
|
1638
|
+
" ",
|
|
1639
|
+
i[g] ?? g
|
|
1640
|
+
] }), /* @__PURE__ */ X("button", {
|
|
1641
|
+
type: "button",
|
|
1642
|
+
"aria-label": i.clear,
|
|
1643
|
+
className: "text-muted hover:text-foreground inline-flex cursor-pointer items-center",
|
|
1644
|
+
onClick: () => _("all"),
|
|
1645
|
+
children: /* @__PURE__ */ X(O, { className: "size-3" })
|
|
1646
|
+
})]
|
|
1647
|
+
})]
|
|
1648
|
+
}),
|
|
1649
|
+
/* @__PURE__ */ X(U, { children: /* @__PURE__ */ X(U.ScrollContainer, { children: /* @__PURE__ */ Z(U.Content, {
|
|
1650
|
+
"aria-label": i.invitations,
|
|
1651
|
+
sortDescriptor: u,
|
|
1652
|
+
onSortChange: (e) => {
|
|
1653
|
+
d(u?.column === e.column && e.direction === "ascending" ? void 0 : e);
|
|
1654
|
+
},
|
|
1655
|
+
children: [/* @__PURE__ */ Z(U.Header, { children: [
|
|
1656
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1657
|
+
allowsSorting: !0,
|
|
1658
|
+
isRowHeader: !0,
|
|
1659
|
+
id: "email",
|
|
1660
|
+
children: ({ sortDirection: e }) => /* @__PURE__ */ X(pn, {
|
|
1661
|
+
sortDirection: e,
|
|
1662
|
+
children: r.auth.email
|
|
1663
|
+
})
|
|
1664
|
+
}),
|
|
1665
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1666
|
+
allowsSorting: !0,
|
|
1667
|
+
id: "createdAt",
|
|
1668
|
+
children: ({ sortDirection: e }) => /* @__PURE__ */ X(pn, {
|
|
1669
|
+
sortDirection: e,
|
|
1670
|
+
children: i.invitedAt
|
|
1671
|
+
})
|
|
1672
|
+
}),
|
|
1673
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1674
|
+
allowsSorting: !0,
|
|
1675
|
+
id: "role",
|
|
1676
|
+
children: ({ sortDirection: e }) => /* @__PURE__ */ X(pn, {
|
|
1677
|
+
sortDirection: e,
|
|
1678
|
+
children: i.role
|
|
1679
|
+
})
|
|
1680
|
+
}),
|
|
1681
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1682
|
+
allowsSorting: !0,
|
|
1683
|
+
id: "status",
|
|
1684
|
+
children: ({ sortDirection: e }) => /* @__PURE__ */ X(pn, {
|
|
1685
|
+
sortDirection: e,
|
|
1686
|
+
children: i.status
|
|
1687
|
+
})
|
|
1688
|
+
}),
|
|
1689
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1690
|
+
className: "text-end",
|
|
1691
|
+
children: i.actions
|
|
1692
|
+
})
|
|
1693
|
+
] }), /* @__PURE__ */ X(U.Body, {
|
|
1694
|
+
renderEmptyState: () => /* @__PURE__ */ X(dn, { onInvitePress: () => C(!0) }),
|
|
1695
|
+
children: l ? /* @__PURE__ */ X(ln, {}) : x?.map((e) => /* @__PURE__ */ X(un, { invitation: e }, e.id))
|
|
1696
|
+
})]
|
|
1697
|
+
}) }) })
|
|
1698
|
+
]
|
|
1699
|
+
}),
|
|
1700
|
+
/* @__PURE__ */ X(on, {
|
|
1701
|
+
isOpen: S,
|
|
1702
|
+
onOpenChange: C
|
|
1703
|
+
})
|
|
1704
|
+
]
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
function pn({ children: e, sortDirection: t }) {
|
|
1708
|
+
return /* @__PURE__ */ Z("span", {
|
|
1709
|
+
className: "flex items-center justify-between",
|
|
1710
|
+
children: [e, !!t && /* @__PURE__ */ X(De, { className: K("size-3 transform transition-transform duration-100 ease-out", t === "descending" ? "rotate-180" : "") })]
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
//#endregion
|
|
1714
|
+
//#region src/components/auth/organization/organization-member-row-skeleton.tsx
|
|
1715
|
+
function mn() {
|
|
1716
|
+
return /* @__PURE__ */ Z(U.Row, { children: [
|
|
1717
|
+
/* @__PURE__ */ X(U.Cell, { children: /* @__PURE__ */ X(n, { isPending: !0 }) }),
|
|
1718
|
+
/* @__PURE__ */ X(U.Cell, { children: /* @__PURE__ */ X(V, { className: "h-4 w-18 rounded-lg" }) }),
|
|
1719
|
+
/* @__PURE__ */ X(U.Cell, {
|
|
1720
|
+
className: "flex justify-end",
|
|
1721
|
+
children: /* @__PURE__ */ X(V, { className: "size-8 rounded-full" })
|
|
1722
|
+
})
|
|
1723
|
+
] });
|
|
1724
|
+
}
|
|
1725
|
+
//#endregion
|
|
1726
|
+
//#region src/components/auth/organization/remove-member-dialog.tsx
|
|
1727
|
+
function hn({ isOpen: e, onOpenChange: t, member: r }) {
|
|
1728
|
+
let { authClient: i, localization: a } = p(), { localization: o, roles: s } = m($), { mutate: c, isPending: l } = de(i, { onSuccess: () => {
|
|
1729
|
+
t(!1), q.success(o.memberRemoved);
|
|
1730
|
+
} });
|
|
1731
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
1732
|
+
isOpen: e,
|
|
1733
|
+
onOpenChange: t,
|
|
1734
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ Z(k.Dialog, { children: [
|
|
1735
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
1736
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
1737
|
+
status: "danger",
|
|
1738
|
+
children: /* @__PURE__ */ X(Je, {})
|
|
1739
|
+
}), /* @__PURE__ */ X(k.Heading, { children: o.removeMember })] }),
|
|
1740
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
1741
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
1742
|
+
children: [/* @__PURE__ */ X("p", {
|
|
1743
|
+
className: "text-muted text-sm",
|
|
1744
|
+
children: o.removeMemberWarning
|
|
1745
|
+
}), /* @__PURE__ */ X(j, {
|
|
1746
|
+
variant: "secondary",
|
|
1747
|
+
children: /* @__PURE__ */ Z(j.Content, {
|
|
1748
|
+
className: "justify-between flex-row items-center gap-2",
|
|
1749
|
+
children: [/* @__PURE__ */ X(n, { user: r.user }), /* @__PURE__ */ X(M, {
|
|
1750
|
+
size: "sm",
|
|
1751
|
+
variant: "tertiary",
|
|
1752
|
+
children: /* @__PURE__ */ X(M.Label, { children: s?.[r.role] ?? r.role })
|
|
1753
|
+
})]
|
|
1754
|
+
})
|
|
1755
|
+
})]
|
|
1756
|
+
}),
|
|
1757
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
1758
|
+
slot: "close",
|
|
1759
|
+
variant: "tertiary",
|
|
1760
|
+
isDisabled: l,
|
|
1761
|
+
children: a.settings.cancel
|
|
1762
|
+
}), /* @__PURE__ */ Z(A, {
|
|
1763
|
+
variant: "danger",
|
|
1764
|
+
isPending: l,
|
|
1765
|
+
onPress: () => c({
|
|
1766
|
+
memberIdOrEmail: r.id,
|
|
1767
|
+
organizationId: r.organizationId
|
|
1768
|
+
}),
|
|
1769
|
+
children: [l && /* @__PURE__ */ X(H, {
|
|
1770
|
+
color: "current",
|
|
1771
|
+
size: "sm"
|
|
1772
|
+
}), o.removeMember]
|
|
1773
|
+
})] })
|
|
1774
|
+
] }) })
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
//#endregion
|
|
1778
|
+
//#region src/components/auth/organization/organization-member-row.tsx
|
|
1779
|
+
function gn({ member: e, isOwner: t, organization: r }) {
|
|
1780
|
+
let { authClient: i } = p(), { localization: a, roles: o } = m($), { data: s } = D(i), { data: c, isPending: l } = T(i, { permissions: { member: ["update"] } }), { data: u, isPending: d } = T(i, { permissions: { member: ["delete"] } }), f = l || d, { mutate: h, isPending: g } = be(i, { onSuccess: () => q.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] = J(!1), [S, C] = J(!1);
|
|
1781
|
+
return f ? /* @__PURE__ */ X(mn, {}) : /* @__PURE__ */ Z(U.Row, { children: [
|
|
1782
|
+
/* @__PURE__ */ X(U.Cell, { children: /* @__PURE__ */ X(n, { user: e.user }) }),
|
|
1783
|
+
/* @__PURE__ */ X(U.Cell, { children: _ }),
|
|
1784
|
+
/* @__PURE__ */ Z(U.Cell, { children: [/* @__PURE__ */ Z("div", {
|
|
1785
|
+
className: "flex items-center justify-end gap-1",
|
|
1786
|
+
children: [c?.success && /* @__PURE__ */ Z(N, { children: [/* @__PURE__ */ X(A, {
|
|
1787
|
+
isIconOnly: !0,
|
|
1788
|
+
size: "sm",
|
|
1789
|
+
variant: "tertiary",
|
|
1790
|
+
isDisabled: g,
|
|
1791
|
+
"aria-label": a.changeMemberRole,
|
|
1792
|
+
children: g ? /* @__PURE__ */ X(H, {
|
|
1793
|
+
color: "current",
|
|
1794
|
+
size: "sm"
|
|
1795
|
+
}) : /* @__PURE__ */ X(We, {})
|
|
1796
|
+
}), /* @__PURE__ */ X(N.Popover, {
|
|
1797
|
+
className: "min-w-fit",
|
|
1798
|
+
children: /* @__PURE__ */ X(N.Menu, { children: v.map(([t, n]) => /* @__PURE__ */ X(N.Item, {
|
|
1799
|
+
textValue: n,
|
|
1800
|
+
isDisabled: e.role === t,
|
|
1801
|
+
onAction: () => h({
|
|
1802
|
+
memberId: e.id,
|
|
1803
|
+
role: t
|
|
1804
|
+
}),
|
|
1805
|
+
children: /* @__PURE__ */ X(R, { children: n })
|
|
1806
|
+
}, t)) })
|
|
1807
|
+
})] }), y ? /* @__PURE__ */ X(A, {
|
|
1808
|
+
isIconOnly: !0,
|
|
1809
|
+
size: "sm",
|
|
1810
|
+
variant: "danger-soft",
|
|
1811
|
+
"aria-label": a.leaveOrganization,
|
|
1812
|
+
onPress: () => C(!0),
|
|
1813
|
+
children: /* @__PURE__ */ X(we, {})
|
|
1814
|
+
}) : u?.success && /* @__PURE__ */ X(A, {
|
|
1815
|
+
isIconOnly: !0,
|
|
1816
|
+
size: "sm",
|
|
1817
|
+
variant: "danger-soft",
|
|
1818
|
+
"aria-label": a.removeMember,
|
|
1819
|
+
onPress: () => x(!0),
|
|
1820
|
+
children: /* @__PURE__ */ X(Je, {})
|
|
1821
|
+
})]
|
|
1822
|
+
}), y && r ? /* @__PURE__ */ X(sn, {
|
|
1823
|
+
isOpen: S,
|
|
1824
|
+
onOpenChange: C,
|
|
1825
|
+
organization: r
|
|
1826
|
+
}) : u?.success && /* @__PURE__ */ X(hn, {
|
|
1827
|
+
isOpen: b,
|
|
1828
|
+
onOpenChange: x,
|
|
1829
|
+
member: e
|
|
1830
|
+
})] })
|
|
1831
|
+
] });
|
|
1832
|
+
}
|
|
1833
|
+
//#endregion
|
|
1834
|
+
//#region src/components/auth/organization/organization-members.tsx
|
|
1835
|
+
function _n({ className: e, ...t }) {
|
|
1836
|
+
let { authClient: n } = p(), { localization: r, roles: i } = m($), { data: a } = D(n), { data: o, isPending: s } = d(n), { data: c, isPending: l } = E(n), { isPending: u } = T(n, { permissions: { member: ["update"] } }), { isPending: f } = T(n, { permissions: { member: ["delete"] } }), h = s || l || u || f, [g, _] = J(), [v, y] = J("all"), [b, x] = J(""), S = ot(() => c?.members.filter((e) => (v === "all" || e.role === v) && (e.user.name.toLowerCase().includes(b.toLowerCase()) || e.user.email.toLowerCase().includes(b.toLowerCase()))), [
|
|
1837
|
+
b,
|
|
1838
|
+
c?.members,
|
|
1839
|
+
v
|
|
1840
|
+
]), C = ot(() => !g || !S ? S : [...S].sort((e, t) => {
|
|
1841
|
+
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);
|
|
1842
|
+
return g.direction === "descending" && (a *= -1), a;
|
|
1843
|
+
}), [g, S]), [w, ee] = J(!1), te = c?.members.some((e) => e.role === "owner" && e.userId === a?.user.id);
|
|
1844
|
+
return /* @__PURE__ */ Z("div", {
|
|
1845
|
+
className: K("flex flex-col gap-3", e),
|
|
1846
|
+
...t,
|
|
1847
|
+
children: [
|
|
1848
|
+
/* @__PURE__ */ Z("div", {
|
|
1849
|
+
className: "flex items-end justify-between gap-3",
|
|
1850
|
+
children: [/* @__PURE__ */ X("h3", {
|
|
1851
|
+
className: "truncate text-sm font-semibold",
|
|
1852
|
+
children: r.members
|
|
1853
|
+
}), /* @__PURE__ */ X(A, {
|
|
1854
|
+
className: "shrink-0",
|
|
1855
|
+
size: "sm",
|
|
1856
|
+
isDisabled: h,
|
|
1857
|
+
onPress: () => ee(!0),
|
|
1858
|
+
children: r.inviteMember
|
|
1859
|
+
})]
|
|
1860
|
+
}),
|
|
1861
|
+
/* @__PURE__ */ Z("div", {
|
|
1862
|
+
className: "flex flex-col gap-4",
|
|
1863
|
+
children: [
|
|
1864
|
+
/* @__PURE__ */ Z("div", {
|
|
1865
|
+
className: "flex items-center gap-3",
|
|
1866
|
+
children: [/* @__PURE__ */ X(B, {
|
|
1867
|
+
className: "min-w-0",
|
|
1868
|
+
"aria-label": r.search,
|
|
1869
|
+
value: b,
|
|
1870
|
+
onChange: x,
|
|
1871
|
+
isDisabled: h,
|
|
1872
|
+
children: /* @__PURE__ */ Z(B.Group, { children: [
|
|
1873
|
+
/* @__PURE__ */ X(B.SearchIcon, {}),
|
|
1874
|
+
/* @__PURE__ */ X(B.Input, {
|
|
1875
|
+
placeholder: r.search,
|
|
1876
|
+
className: "sm:w-[200px]"
|
|
1877
|
+
}),
|
|
1878
|
+
/* @__PURE__ */ X(B.ClearButton, {})
|
|
1879
|
+
] })
|
|
1880
|
+
}), /* @__PURE__ */ Z(N, { children: [/* @__PURE__ */ Z(A, {
|
|
1881
|
+
size: "sm",
|
|
1882
|
+
variant: "secondary",
|
|
1883
|
+
isDisabled: h,
|
|
1884
|
+
children: [/* @__PURE__ */ X(Le, {}), r.role]
|
|
1885
|
+
}), /* @__PURE__ */ X(N.Popover, { children: /* @__PURE__ */ Z(N.Menu, {
|
|
1886
|
+
selectionMode: "single",
|
|
1887
|
+
selectedKeys: new Set([v]),
|
|
1888
|
+
onSelectionChange: (e) => {
|
|
1889
|
+
let t = [...e][0];
|
|
1890
|
+
y(t ?? "all");
|
|
1891
|
+
},
|
|
1892
|
+
children: [/* @__PURE__ */ Z(N.Item, {
|
|
1893
|
+
id: "all",
|
|
1894
|
+
textValue: r.all,
|
|
1895
|
+
children: [/* @__PURE__ */ X(R, { children: r.all }), /* @__PURE__ */ X(N.ItemIndicator, {})]
|
|
1896
|
+
}), Object.entries(i).map(([e, t]) => /* @__PURE__ */ Z(N.Item, {
|
|
1897
|
+
id: e,
|
|
1898
|
+
textValue: t,
|
|
1899
|
+
children: [/* @__PURE__ */ X(R, { children: t }), /* @__PURE__ */ X(N.ItemIndicator, {})]
|
|
1900
|
+
}, e))]
|
|
1901
|
+
}) })] })]
|
|
1902
|
+
}),
|
|
1903
|
+
v !== "all" && /* @__PURE__ */ Z(M, {
|
|
1904
|
+
size: "sm",
|
|
1905
|
+
variant: "secondary",
|
|
1906
|
+
className: "w-fit",
|
|
1907
|
+
children: [/* @__PURE__ */ Z(M.Label, { children: [
|
|
1908
|
+
r.role,
|
|
1909
|
+
":",
|
|
1910
|
+
" ",
|
|
1911
|
+
/* @__PURE__ */ X("span", {
|
|
1912
|
+
className: "capitalize",
|
|
1913
|
+
children: i?.[v] ?? v
|
|
1914
|
+
})
|
|
1915
|
+
] }), /* @__PURE__ */ X("button", {
|
|
1916
|
+
type: "button",
|
|
1917
|
+
"aria-label": r.clear,
|
|
1918
|
+
className: "text-muted hover:text-foreground inline-flex cursor-pointer items-center",
|
|
1919
|
+
onClick: () => y("all"),
|
|
1920
|
+
children: /* @__PURE__ */ X(O, { className: "size-3" })
|
|
1921
|
+
})]
|
|
1922
|
+
}),
|
|
1923
|
+
/* @__PURE__ */ X(U, { children: /* @__PURE__ */ X(U.ScrollContainer, { children: /* @__PURE__ */ Z(U.Content, {
|
|
1924
|
+
"aria-label": r.members,
|
|
1925
|
+
sortDescriptor: g,
|
|
1926
|
+
onSortChange: (e) => {
|
|
1927
|
+
_(g?.column === e.column && e.direction === "ascending" ? void 0 : e);
|
|
1928
|
+
},
|
|
1929
|
+
children: [/* @__PURE__ */ Z(U.Header, { children: [
|
|
1930
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1931
|
+
allowsSorting: !0,
|
|
1932
|
+
isRowHeader: !0,
|
|
1933
|
+
id: "user",
|
|
1934
|
+
children: ({ sortDirection: e }) => /* @__PURE__ */ X(vn, {
|
|
1935
|
+
sortDirection: e,
|
|
1936
|
+
children: r.member
|
|
1937
|
+
})
|
|
1938
|
+
}),
|
|
1939
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1940
|
+
allowsSorting: !0,
|
|
1941
|
+
id: "role",
|
|
1942
|
+
children: ({ sortDirection: e }) => /* @__PURE__ */ X(vn, {
|
|
1943
|
+
sortDirection: e,
|
|
1944
|
+
children: r.role
|
|
1945
|
+
})
|
|
1946
|
+
}),
|
|
1947
|
+
/* @__PURE__ */ X(U.Column, {
|
|
1948
|
+
className: "text-end",
|
|
1949
|
+
children: r.actions
|
|
1950
|
+
})
|
|
1951
|
+
] }), /* @__PURE__ */ X(U.Body, { children: h ? /* @__PURE__ */ X(mn, {}) : !!o && C?.map((e) => /* @__PURE__ */ X(gn, {
|
|
1952
|
+
member: e,
|
|
1953
|
+
isOwner: te,
|
|
1954
|
+
organization: o
|
|
1955
|
+
}, e.id)) })]
|
|
1956
|
+
}) }) })
|
|
1957
|
+
]
|
|
1958
|
+
}),
|
|
1959
|
+
/* @__PURE__ */ X(on, {
|
|
1960
|
+
isOpen: w,
|
|
1961
|
+
onOpenChange: ee
|
|
1962
|
+
})
|
|
1963
|
+
]
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
function vn({ children: e, sortDirection: t }) {
|
|
1967
|
+
return /* @__PURE__ */ Z("span", {
|
|
1968
|
+
className: "flex items-center justify-between",
|
|
1969
|
+
children: [e, !!t && /* @__PURE__ */ X(De, { className: K("size-3 transform transition-transform duration-100 ease-out", t === "descending" ? "rotate-180" : "") })]
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
//#endregion
|
|
1973
|
+
//#region src/components/auth/organization/organization-people.tsx
|
|
1974
|
+
function yn({ className: e, ...t }) {
|
|
1975
|
+
return /* @__PURE__ */ Z("div", {
|
|
1976
|
+
className: K("flex flex-col gap-4 md:gap-6", e),
|
|
1977
|
+
...t,
|
|
1978
|
+
children: [/* @__PURE__ */ X(_n, {}), /* @__PURE__ */ X(fn, {})]
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
//#endregion
|
|
1982
|
+
//#region src/components/auth/organization/organization-danger-zone.tsx
|
|
1983
|
+
function bn({ className: e, variant: t, ...n }) {
|
|
1984
|
+
let { authClient: r, localization: i } = p(), { data: a, isPending: o } = T(r, { permissions: { organization: ["delete"] } }), s = !!a?.success;
|
|
1985
|
+
return /* @__PURE__ */ Z("div", {
|
|
1986
|
+
className: K("flex w-full flex-col", e),
|
|
1987
|
+
...n,
|
|
1988
|
+
children: [/* @__PURE__ */ X("h2", {
|
|
1989
|
+
className: K("mb-3 text-sm font-semibold text-danger"),
|
|
1990
|
+
children: i.settings.dangerZone
|
|
1991
|
+
}), /* @__PURE__ */ X(j, {
|
|
1992
|
+
variant: t,
|
|
1993
|
+
children: /* @__PURE__ */ X(j.Content, {
|
|
1994
|
+
className: "gap-0",
|
|
1995
|
+
children: o ? /* @__PURE__ */ X(nn, {}) : /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(cn, {}), s && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ X(rn, {})] })] })
|
|
1996
|
+
})
|
|
1997
|
+
})]
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
//#endregion
|
|
2001
|
+
//#region src/components/auth/organization/organization-profile.tsx
|
|
2002
|
+
function xn({ className: e, variant: t, ...n }) {
|
|
2003
|
+
let { authClient: r, localization: i } = p(), { localization: a } = m($), { data: o } = d(r), [s, c] = J(o?.slug ?? "");
|
|
2004
|
+
at(() => {
|
|
2005
|
+
c(o?.slug ?? "");
|
|
2006
|
+
}, [o?.slug]);
|
|
2007
|
+
let { mutate: l, isPending: u } = xe(r, { onSuccess: () => q.success(a.organizationUpdatedSuccess) });
|
|
2008
|
+
function f(e) {
|
|
2009
|
+
e.preventDefault(), o && l({ data: {
|
|
2010
|
+
name: new FormData(e.currentTarget).get("name"),
|
|
2011
|
+
slug: s
|
|
2012
|
+
} });
|
|
2013
|
+
}
|
|
2014
|
+
let h = t === "transparent" ? "primary" : "secondary";
|
|
2015
|
+
return /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("h2", {
|
|
2016
|
+
className: K("mb-3 text-sm font-semibold"),
|
|
2017
|
+
children: a.organizationProfile
|
|
2018
|
+
}), /* @__PURE__ */ X(j, {
|
|
2019
|
+
className: K(e),
|
|
2020
|
+
variant: t,
|
|
2021
|
+
...n,
|
|
2022
|
+
children: /* @__PURE__ */ X(j.Content, { children: /* @__PURE__ */ Z(F, {
|
|
2023
|
+
onSubmit: f,
|
|
2024
|
+
className: "flex flex-col gap-4",
|
|
2025
|
+
children: [
|
|
2026
|
+
/* @__PURE__ */ X(en, {}),
|
|
2027
|
+
/* @__PURE__ */ Z(G, {
|
|
2028
|
+
name: "name",
|
|
2029
|
+
defaultValue: o?.name,
|
|
2030
|
+
isDisabled: u || !o,
|
|
2031
|
+
children: [
|
|
2032
|
+
/* @__PURE__ */ X(R, { children: a.name }),
|
|
2033
|
+
/* @__PURE__ */ X(I, {
|
|
2034
|
+
className: K(!o && "hidden"),
|
|
2035
|
+
autoComplete: "organization",
|
|
2036
|
+
placeholder: a.namePlaceholder,
|
|
2037
|
+
variant: h
|
|
2038
|
+
}),
|
|
2039
|
+
!o && /* @__PURE__ */ X(V, { className: "h-10 w-full rounded-xl md:h-9" }),
|
|
2040
|
+
/* @__PURE__ */ X(P, {})
|
|
2041
|
+
]
|
|
2042
|
+
}, `${o?.id}-${o?.name}-name`),
|
|
2043
|
+
o ? /* @__PURE__ */ X(Ht, {
|
|
2044
|
+
value: s,
|
|
2045
|
+
onChange: c,
|
|
2046
|
+
currentSlug: o.slug,
|
|
2047
|
+
isDisabled: u,
|
|
2048
|
+
variant: h
|
|
2049
|
+
}) : /* @__PURE__ */ Z(G, {
|
|
2050
|
+
isDisabled: !0,
|
|
2051
|
+
children: [/* @__PURE__ */ X(R, { children: a.slug }), /* @__PURE__ */ X(V, { className: "h-10 w-full rounded-xl md:h-9" })]
|
|
2052
|
+
}),
|
|
2053
|
+
/* @__PURE__ */ Z(A, {
|
|
2054
|
+
type: "submit",
|
|
2055
|
+
isPending: u,
|
|
2056
|
+
isDisabled: !o,
|
|
2057
|
+
size: "sm",
|
|
2058
|
+
className: "mt-1",
|
|
2059
|
+
children: [u && /* @__PURE__ */ X(H, {
|
|
2060
|
+
color: "current",
|
|
2061
|
+
size: "sm"
|
|
2062
|
+
}), i.settings.saveChanges]
|
|
2063
|
+
})
|
|
2064
|
+
]
|
|
2065
|
+
}) })
|
|
2066
|
+
})] });
|
|
2067
|
+
}
|
|
2068
|
+
//#endregion
|
|
2069
|
+
//#region src/components/auth/organization/organization-settings.tsx
|
|
2070
|
+
function Sn({ className: e, variant: t, ...n }) {
|
|
2071
|
+
let { plugins: r } = p();
|
|
2072
|
+
return /* @__PURE__ */ Z("div", {
|
|
2073
|
+
className: K("flex flex-col gap-4 md:gap-6", e),
|
|
2074
|
+
...n,
|
|
2075
|
+
children: [
|
|
2076
|
+
/* @__PURE__ */ X(xn, { variant: t }),
|
|
2077
|
+
r.flatMap((e) => e.organizationCards?.map((n, r) => /* @__PURE__ */ X(n, { variant: t }, `${e.id}-${r.toString()}`))),
|
|
2078
|
+
/* @__PURE__ */ X(bn, { variant: t })
|
|
2079
|
+
]
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
//#endregion
|
|
2083
|
+
//#region src/components/auth/organization/organization.tsx
|
|
2084
|
+
function Cn({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
|
|
2085
|
+
if (!i && !n) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
|
|
2086
|
+
let { authClient: o, basePaths: s, localization: c, navigate: l } = p();
|
|
2087
|
+
h(o);
|
|
2088
|
+
let { localization: u, viewPaths: f, slug: g } = m($), { data: _, isPending: v } = d(o);
|
|
2089
|
+
at(() => {
|
|
2090
|
+
!v && !_ && l({
|
|
2091
|
+
to: `${s.settings}/${f.settings?.organizations}`,
|
|
2092
|
+
replace: !0
|
|
2093
|
+
});
|
|
2094
|
+
}, [
|
|
2095
|
+
s.settings,
|
|
2096
|
+
v,
|
|
2097
|
+
l,
|
|
2098
|
+
f.settings?.organizations,
|
|
2099
|
+
_
|
|
2100
|
+
]);
|
|
2101
|
+
let y = ot(() => i || Object.entries(f.organization).find(([, e]) => e === n)?.[0], [
|
|
2102
|
+
i,
|
|
2103
|
+
n,
|
|
2104
|
+
f.organization
|
|
2105
|
+
]);
|
|
2106
|
+
if (!y) {
|
|
2107
|
+
let e = Object.values(f.organization).join(", ");
|
|
2108
|
+
throw Error(`[Better Auth UI] Unknown organization path "${n}". Valid paths are: ${e}`);
|
|
2109
|
+
}
|
|
2110
|
+
return !v && !_ ? null : /* @__PURE__ */ Z(W, {
|
|
2111
|
+
className: K(e),
|
|
2112
|
+
orientation: "horizontal",
|
|
2113
|
+
selectedKey: y,
|
|
2114
|
+
...a,
|
|
2115
|
+
children: [
|
|
2116
|
+
!t && /* @__PURE__ */ X(W.ListContainer, { children: /* @__PURE__ */ Z(W.List, {
|
|
2117
|
+
"aria-label": c.settings.settings,
|
|
2118
|
+
className: "max-w-fit overflow-x-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
2119
|
+
children: [/* @__PURE__ */ Z(W.Tab, {
|
|
2120
|
+
id: "settings",
|
|
2121
|
+
href: g ? `${s.organization}/${g}/${f.organization.settings}` : `${s.organization}/${f.organization.settings}`,
|
|
2122
|
+
className: "gap-2",
|
|
2123
|
+
onPress: (e) => e.target.scrollIntoView({
|
|
2124
|
+
behavior: "smooth",
|
|
2125
|
+
inline: "center"
|
|
2126
|
+
}),
|
|
2127
|
+
children: [
|
|
2128
|
+
/* @__PURE__ */ X(Re, { className: "text-muted" }),
|
|
2129
|
+
c.settings.settings,
|
|
2130
|
+
/* @__PURE__ */ X(W.Indicator, {})
|
|
2131
|
+
]
|
|
2132
|
+
}), /* @__PURE__ */ Z(W.Tab, {
|
|
2133
|
+
id: "people",
|
|
2134
|
+
href: g ? `${s.organization}/${g}/${f.organization.people}` : `${s.organization}/${f.organization.people}`,
|
|
2135
|
+
className: "gap-2",
|
|
2136
|
+
onPress: (e) => e.target.scrollIntoView({
|
|
2137
|
+
behavior: "smooth",
|
|
2138
|
+
inline: "center"
|
|
2139
|
+
}),
|
|
2140
|
+
children: [
|
|
2141
|
+
/* @__PURE__ */ X(Ge, { className: "text-muted" }),
|
|
2142
|
+
u.people,
|
|
2143
|
+
/* @__PURE__ */ X(W.Indicator, {})
|
|
2144
|
+
]
|
|
2145
|
+
})]
|
|
2146
|
+
}) }),
|
|
2147
|
+
/* @__PURE__ */ X(W.Panel, {
|
|
2148
|
+
id: "settings",
|
|
2149
|
+
className: "px-0",
|
|
2150
|
+
children: /* @__PURE__ */ X(Sn, { variant: r })
|
|
2151
|
+
}),
|
|
2152
|
+
/* @__PURE__ */ X(W.Panel, {
|
|
2153
|
+
id: "people",
|
|
2154
|
+
className: "px-0",
|
|
2155
|
+
children: /* @__PURE__ */ X(yn, {})
|
|
2156
|
+
})
|
|
2157
|
+
]
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
//#endregion
|
|
2161
|
+
//#region src/components/auth/organization/organization-switcher.tsx
|
|
2162
|
+
function wn({ className: e, hideCreate: t, hidePersonal: r, hideSettings: i, hideSlug: a = !0, setActive: o, placement: s, variant: c = "ghost", size: l = "md", trigger: u, ...f }) {
|
|
2163
|
+
let { authClient: h, navigate: g, basePaths: _, localization: v, viewPaths: y } = p(), { data: b, isPending: x } = D(h), { localization: S, viewPaths: C, slug: w } = m($), { data: T, isPending: ee } = d(h), { data: te, isPending: ne } = se(h), { mutate: re } = me(h), ie = x || !!b && (ne || ee), [ae, oe] = J(!1), [E, ce] = J(!1);
|
|
2164
|
+
function le(e) {
|
|
2165
|
+
o ? o(e) : w === void 0 ? re({ organizationId: e?.id ?? null }) : g({ to: e ? `${_.organization}/${e.slug}/${C.organization.settings}` : `${_.settings}/${y.settings.account}` });
|
|
2166
|
+
}
|
|
2167
|
+
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ Z(N, {
|
|
2168
|
+
isOpen: E,
|
|
2169
|
+
onOpenChange: ce,
|
|
2170
|
+
children: [u ? /* @__PURE__ */ X(N.Trigger, { children: u }) : /* @__PURE__ */ Z(A, {
|
|
2171
|
+
variant: c,
|
|
2172
|
+
className: K("h-auto px-2 py-2 text-left", e),
|
|
2173
|
+
isDisabled: !b || ie,
|
|
2174
|
+
"aria-label": S.organization,
|
|
2175
|
+
...f,
|
|
2176
|
+
children: [ie ? /* @__PURE__ */ X(Q, {
|
|
2177
|
+
size: l,
|
|
2178
|
+
isPending: !0,
|
|
2179
|
+
hideRole: !0,
|
|
2180
|
+
hideSlug: a
|
|
2181
|
+
}) : T ? /* @__PURE__ */ X(Q, {
|
|
2182
|
+
size: l,
|
|
2183
|
+
hideRole: !0,
|
|
2184
|
+
hideSlug: a
|
|
2185
|
+
}) : b && !r ? /* @__PURE__ */ X(n, {
|
|
2186
|
+
size: l,
|
|
2187
|
+
hideSubtitle: a
|
|
2188
|
+
}) : /* @__PURE__ */ X(Q, {
|
|
2189
|
+
size: l,
|
|
2190
|
+
hideRole: !0,
|
|
2191
|
+
hideSlug: a,
|
|
2192
|
+
organization: { name: S.organization }
|
|
2193
|
+
}), /* @__PURE__ */ X(Oe, { className: "size-3 shrink-0 text-muted" })]
|
|
2194
|
+
}), /* @__PURE__ */ Z(N.Popover, {
|
|
2195
|
+
placement: s,
|
|
2196
|
+
className: "max-w-svw",
|
|
2197
|
+
children: [T ? /* @__PURE__ */ Z("div", {
|
|
2198
|
+
className: "flex items-center justify-between gap-4 px-4 pt-3",
|
|
2199
|
+
children: [/* @__PURE__ */ X(Q, {
|
|
2200
|
+
hideRole: !0,
|
|
2201
|
+
hideSlug: a,
|
|
2202
|
+
organization: T
|
|
2203
|
+
}), !i && /* @__PURE__ */ Z(et, {
|
|
2204
|
+
href: w ? `${_.organization}/${w}/${C.organization.settings}` : `${_.organization}/${C.organization.settings}`,
|
|
2205
|
+
className: K(vt({
|
|
2206
|
+
variant: "outline",
|
|
2207
|
+
size: "sm"
|
|
2208
|
+
}), "shrink-0 gap-2"),
|
|
2209
|
+
onPress: () => ce(!1),
|
|
2210
|
+
children: [/* @__PURE__ */ X(Re, { className: "text-muted" }), S.manage]
|
|
2211
|
+
})]
|
|
2212
|
+
}) : !ie && b?.user && !r ? /* @__PURE__ */ Z("div", {
|
|
2213
|
+
className: "flex items-center justify-between gap-4 px-4 pt-3",
|
|
2214
|
+
children: [/* @__PURE__ */ X(n, { hideSubtitle: a }), !i && /* @__PURE__ */ Z(et, {
|
|
2215
|
+
href: `${_.settings}/${y.settings.account}`,
|
|
2216
|
+
className: K(vt({
|
|
2217
|
+
variant: "outline",
|
|
2218
|
+
size: "sm"
|
|
2219
|
+
}), "shrink-0 gap-2"),
|
|
2220
|
+
onPress: () => ce(!1),
|
|
2221
|
+
children: [/* @__PURE__ */ X(Re, { className: "text-muted" }), v.settings.settings]
|
|
2222
|
+
})]
|
|
2223
|
+
}) : null, /* @__PURE__ */ Z(N.Menu, { children: [
|
|
2224
|
+
!!T && !r && /* @__PURE__ */ X(N.Item, {
|
|
2225
|
+
textValue: S.personalAccount,
|
|
2226
|
+
onPress: () => le(null),
|
|
2227
|
+
children: /* @__PURE__ */ X(n, { hideSubtitle: a })
|
|
2228
|
+
}),
|
|
2229
|
+
te?.filter((e) => e.id !== T?.id)?.map((e) => /* @__PURE__ */ X(N.Item, {
|
|
2230
|
+
textValue: e.name,
|
|
2231
|
+
onPress: () => le(e),
|
|
2232
|
+
children: /* @__PURE__ */ X(Q, {
|
|
2233
|
+
hideRole: !0,
|
|
2234
|
+
hideSlug: a,
|
|
2235
|
+
organization: e
|
|
2236
|
+
})
|
|
2237
|
+
}, e.id)),
|
|
2238
|
+
!t && /* @__PURE__ */ Z(N.Item, {
|
|
2239
|
+
textValue: S.createOrganization,
|
|
2240
|
+
onPress: () => oe(!0),
|
|
2241
|
+
children: [/* @__PURE__ */ X(ke, { className: "text-muted" }), /* @__PURE__ */ X(R, { children: S.createOrganization })]
|
|
2242
|
+
})
|
|
2243
|
+
] })]
|
|
2244
|
+
})]
|
|
2245
|
+
}), /* @__PURE__ */ X(Ut, {
|
|
2246
|
+
isOpen: ae,
|
|
2247
|
+
onOpenChange: oe
|
|
2248
|
+
})] });
|
|
2249
|
+
}
|
|
2250
|
+
//#endregion
|
|
2251
|
+
//#region src/components/auth/passkey/passkey-button.tsx
|
|
2252
|
+
function Tn({ view: e }) {
|
|
2253
|
+
let { authClient: t, localization: n, redirectTo: i, navigate: a } = p(), { localization: o } = m(En), { mutate: s, isPending: c } = ve(t, { onSuccess: () => a({ to: i }) }), l = ct({ mutationKey: r.signIn.all }) + ct({ mutationKey: r.signUp.all }) > 0;
|
|
2254
|
+
return e === "signUp" ? null : /* @__PURE__ */ Z(A, {
|
|
2255
|
+
className: "w-full",
|
|
2256
|
+
variant: "tertiary",
|
|
2257
|
+
isDisabled: l,
|
|
2258
|
+
isPending: c,
|
|
2259
|
+
onPress: () => s(),
|
|
2260
|
+
children: [c ? /* @__PURE__ */ X(H, {
|
|
2261
|
+
color: "current",
|
|
2262
|
+
size: "sm"
|
|
2263
|
+
}) : /* @__PURE__ */ X(Ie, {}), n.auth.continueWith.replace("{{provider}}", o.passkey)]
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
//#endregion
|
|
2267
|
+
//#region src/lib/auth/passkey-plugin.ts
|
|
2268
|
+
var En = a(ht.id, (e = {}) => ({
|
|
2269
|
+
...ht(e),
|
|
2270
|
+
authButtons: [Tn],
|
|
2271
|
+
securityCards: [Mn]
|
|
2272
|
+
}));
|
|
2273
|
+
//#endregion
|
|
2274
|
+
//#region src/components/auth/passkey/add-passkey-dialog.tsx
|
|
2275
|
+
function Dn({ isOpen: e, onOpenChange: t }) {
|
|
2276
|
+
let { authClient: n, localization: r } = p(), { localization: i } = m(En), { mutate: a, isPending: o } = f(n), s = (e) => {
|
|
2277
|
+
t(e);
|
|
2278
|
+
};
|
|
2279
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
2280
|
+
isOpen: e,
|
|
2281
|
+
onOpenChange: s,
|
|
2282
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ X(k.Dialog, { children: /* @__PURE__ */ Z(F, {
|
|
2283
|
+
onSubmit: (e) => {
|
|
2284
|
+
e.preventDefault();
|
|
2285
|
+
let t = new FormData(e.target).get("name")?.trim();
|
|
2286
|
+
a(t ? { name: t } : void 0, { onSuccess: () => s(!1) });
|
|
2287
|
+
},
|
|
2288
|
+
children: [
|
|
2289
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
2290
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
2291
|
+
status: "default",
|
|
2292
|
+
children: /* @__PURE__ */ X(Ie, {})
|
|
2293
|
+
}), /* @__PURE__ */ X(k.Heading, { children: i.addPasskey })] }),
|
|
2294
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
2295
|
+
className: "overflow-visible",
|
|
2296
|
+
children: [/* @__PURE__ */ X("p", {
|
|
2297
|
+
className: "text-muted text-sm",
|
|
2298
|
+
children: i.passkeysDescription
|
|
2299
|
+
}), /* @__PURE__ */ Z(G, {
|
|
2300
|
+
className: "mt-4",
|
|
2301
|
+
id: "name",
|
|
2302
|
+
name: "name",
|
|
2303
|
+
isDisabled: o,
|
|
2304
|
+
children: [
|
|
2305
|
+
/* @__PURE__ */ X(R, { children: i.name }),
|
|
2306
|
+
/* @__PURE__ */ X(I, {
|
|
2307
|
+
autoFocus: !0,
|
|
2308
|
+
placeholder: r.settings.optional,
|
|
2309
|
+
variant: "secondary"
|
|
2310
|
+
}),
|
|
2311
|
+
/* @__PURE__ */ X(P, {})
|
|
2312
|
+
]
|
|
2313
|
+
})]
|
|
2314
|
+
}),
|
|
2315
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
2316
|
+
slot: "close",
|
|
2317
|
+
variant: "tertiary",
|
|
2318
|
+
isDisabled: o,
|
|
2319
|
+
children: r.settings.cancel
|
|
2320
|
+
}), /* @__PURE__ */ Z(A, {
|
|
2321
|
+
type: "submit",
|
|
2322
|
+
isPending: o,
|
|
2323
|
+
children: [o && /* @__PURE__ */ X(H, {
|
|
2324
|
+
color: "current",
|
|
2325
|
+
size: "sm"
|
|
2326
|
+
}), i.addPasskey]
|
|
2327
|
+
})] })
|
|
2328
|
+
]
|
|
2329
|
+
}) }) })
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
//#endregion
|
|
2333
|
+
//#region src/components/auth/passkey/delete-passkey-dialog.tsx
|
|
2334
|
+
function On({ isOpen: e, onOpenChange: t, passkey: n }) {
|
|
2335
|
+
let { authClient: r, localization: i } = p(), { localization: a } = m(En), o = n.name || a.passkey, { mutate: s, isPending: c } = S(r, { onSuccess: () => t(!1) });
|
|
2336
|
+
return /* @__PURE__ */ X(k.Backdrop, {
|
|
2337
|
+
isOpen: e,
|
|
2338
|
+
onOpenChange: t,
|
|
2339
|
+
children: /* @__PURE__ */ X(k.Container, { children: /* @__PURE__ */ Z(k.Dialog, { children: [
|
|
2340
|
+
/* @__PURE__ */ X(k.CloseTrigger, {}),
|
|
2341
|
+
/* @__PURE__ */ Z(k.Header, { children: [/* @__PURE__ */ X(k.Icon, {
|
|
2342
|
+
status: "danger",
|
|
2343
|
+
children: /* @__PURE__ */ X(Ie, {})
|
|
2344
|
+
}), /* @__PURE__ */ X(k.Heading, { children: a.deletePasskeyTitle })] }),
|
|
2345
|
+
/* @__PURE__ */ Z(k.Body, {
|
|
2346
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
2347
|
+
children: [/* @__PURE__ */ X("p", {
|
|
2348
|
+
className: "text-muted text-sm",
|
|
2349
|
+
children: a.deletePasskeyWarning
|
|
2350
|
+
}), /* @__PURE__ */ Z(G, {
|
|
2351
|
+
value: o,
|
|
2352
|
+
variant: "secondary",
|
|
2353
|
+
children: [/* @__PURE__ */ X(R, { children: n.name || a.passkey }), /* @__PURE__ */ X(I, { readOnly: !0 })]
|
|
2354
|
+
})]
|
|
2355
|
+
}),
|
|
2356
|
+
/* @__PURE__ */ Z(k.Footer, { children: [/* @__PURE__ */ X(A, {
|
|
2357
|
+
slot: "close",
|
|
2358
|
+
variant: "tertiary",
|
|
2359
|
+
isDisabled: c,
|
|
2360
|
+
children: i.settings.cancel
|
|
2361
|
+
}), /* @__PURE__ */ Z(A, {
|
|
2362
|
+
variant: "danger",
|
|
2363
|
+
onPress: () => s({ id: n.id }),
|
|
2364
|
+
isPending: c,
|
|
2365
|
+
children: [c && /* @__PURE__ */ X(H, {
|
|
2366
|
+
color: "current",
|
|
2367
|
+
size: "sm"
|
|
2368
|
+
}), a.deletePasskeyTitle]
|
|
2369
|
+
})] })
|
|
2370
|
+
] }) })
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
//#endregion
|
|
2374
|
+
//#region src/components/auth/passkey/passkey.tsx
|
|
2375
|
+
function kn({ passkey: e }) {
|
|
2376
|
+
let { localization: t } = p(), { localization: n } = m(En), [r, i] = J(!1), a = e.name || n.passkey;
|
|
2377
|
+
return /* @__PURE__ */ Z("div", {
|
|
2378
|
+
className: "flex items-center gap-3",
|
|
2379
|
+
children: [
|
|
2380
|
+
/* @__PURE__ */ X("div", {
|
|
2381
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
2382
|
+
children: /* @__PURE__ */ X(Ie, { className: "size-4.5" })
|
|
2383
|
+
}),
|
|
2384
|
+
/* @__PURE__ */ Z("div", {
|
|
2385
|
+
className: "flex min-w-0 flex-col",
|
|
2386
|
+
children: [/* @__PURE__ */ X("span", {
|
|
2387
|
+
className: "truncate text-sm font-medium leading-tight",
|
|
2388
|
+
children: a
|
|
2389
|
+
}), /* @__PURE__ */ X("span", {
|
|
2390
|
+
className: "text-xs text-muted",
|
|
2391
|
+
children: new Date(e.createdAt).toLocaleString(void 0, {
|
|
2392
|
+
dateStyle: "medium",
|
|
2393
|
+
timeStyle: "short"
|
|
2394
|
+
})
|
|
2395
|
+
})]
|
|
2396
|
+
}),
|
|
2397
|
+
/* @__PURE__ */ Z(A, {
|
|
2398
|
+
className: "ml-auto shrink-0",
|
|
2399
|
+
variant: "outline",
|
|
2400
|
+
size: "sm",
|
|
2401
|
+
onPress: () => i(!0),
|
|
2402
|
+
"aria-label": n.deletePasskey.replace("{{name}}", a),
|
|
2403
|
+
children: [/* @__PURE__ */ X(O, {}), t.settings.delete]
|
|
2404
|
+
}),
|
|
2405
|
+
/* @__PURE__ */ X(On, {
|
|
2406
|
+
isOpen: r,
|
|
2407
|
+
onOpenChange: i,
|
|
2408
|
+
passkey: e
|
|
2409
|
+
})
|
|
2410
|
+
]
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2413
|
+
//#endregion
|
|
2414
|
+
//#region src/components/auth/passkey/passkey-skeleton.tsx
|
|
2415
|
+
function An() {
|
|
2416
|
+
return /* @__PURE__ */ X("div", {
|
|
2417
|
+
className: "flex items-center justify-between",
|
|
2418
|
+
children: /* @__PURE__ */ Z("div", {
|
|
2419
|
+
className: "flex items-center gap-3",
|
|
2420
|
+
children: [/* @__PURE__ */ X(V, { className: "size-10 rounded-xl" }), /* @__PURE__ */ Z("div", {
|
|
2421
|
+
className: "flex flex-col gap-1",
|
|
2422
|
+
children: [/* @__PURE__ */ X(V, { className: "h-4 w-28 rounded-lg" }), /* @__PURE__ */ X(V, { className: "h-3 w-32 rounded-lg" })]
|
|
2423
|
+
})]
|
|
2424
|
+
})
|
|
2425
|
+
});
|
|
2426
|
+
}
|
|
2427
|
+
//#endregion
|
|
2428
|
+
//#region src/components/auth/passkey/passkeys-empty.tsx
|
|
2429
|
+
function jn({ onAddPress: e }) {
|
|
2430
|
+
let { localization: t } = m(En);
|
|
2431
|
+
return /* @__PURE__ */ Z("div", {
|
|
2432
|
+
className: "flex flex-col items-center justify-center gap-4",
|
|
2433
|
+
children: [
|
|
2434
|
+
/* @__PURE__ */ X("div", {
|
|
2435
|
+
className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
|
|
2436
|
+
children: /* @__PURE__ */ X(Ie, { className: "size-4.5" })
|
|
2437
|
+
}),
|
|
2438
|
+
/* @__PURE__ */ Z("div", {
|
|
2439
|
+
className: "flex flex-col items-center justify-center gap-1 text-center",
|
|
2440
|
+
children: [/* @__PURE__ */ X("p", {
|
|
2441
|
+
className: "text-sm font-semibold",
|
|
2442
|
+
children: t.noPasskeys
|
|
2443
|
+
}), /* @__PURE__ */ X("p", {
|
|
2444
|
+
className: "text-muted text-xs",
|
|
2445
|
+
children: t.passkeysDescription
|
|
2446
|
+
})]
|
|
2447
|
+
}),
|
|
2448
|
+
/* @__PURE__ */ X(A, {
|
|
2449
|
+
size: "sm",
|
|
2450
|
+
onPress: e,
|
|
2451
|
+
children: t.addPasskey
|
|
2452
|
+
})
|
|
2453
|
+
]
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2456
|
+
//#endregion
|
|
2457
|
+
//#region src/components/auth/passkey/passkeys.tsx
|
|
2458
|
+
function Mn({ className: e, variant: t, ...n }) {
|
|
2459
|
+
let { authClient: r } = p(), { localization: i } = m(En), { data: a, isPending: o } = ce(r), [s, c] = J(!1);
|
|
2460
|
+
return /* @__PURE__ */ Z("div", {
|
|
2461
|
+
className: K("flex flex-col gap-3", e),
|
|
2462
|
+
children: [
|
|
2463
|
+
/* @__PURE__ */ Z("div", {
|
|
2464
|
+
className: "flex items-end justify-between gap-3",
|
|
2465
|
+
children: [/* @__PURE__ */ X("h2", {
|
|
2466
|
+
className: "text-sm font-semibold truncate",
|
|
2467
|
+
children: i.passkeys
|
|
2468
|
+
}), /* @__PURE__ */ X(A, {
|
|
2469
|
+
className: "shrink-0",
|
|
2470
|
+
size: "sm",
|
|
2471
|
+
isDisabled: o,
|
|
2472
|
+
onPress: () => c(!0),
|
|
2473
|
+
children: i.addPasskey
|
|
2474
|
+
})]
|
|
2475
|
+
}),
|
|
2476
|
+
/* @__PURE__ */ X(j, {
|
|
2477
|
+
variant: t,
|
|
2478
|
+
...n,
|
|
2479
|
+
children: /* @__PURE__ */ X(j.Content, { children: o ? /* @__PURE__ */ X(An, {}) : a?.length ? a.map((e, t) => /* @__PURE__ */ Z("div", { children: [t > 0 && /* @__PURE__ */ X("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ X(kn, { passkey: e })] }, e.id)) : /* @__PURE__ */ X(jn, { onAddPress: () => c(!0) }) })
|
|
2480
|
+
}),
|
|
2481
|
+
/* @__PURE__ */ X(Dn, {
|
|
2482
|
+
isOpen: s,
|
|
2483
|
+
onOpenChange: c
|
|
2484
|
+
})
|
|
2485
|
+
]
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
//#endregion
|
|
2489
|
+
//#region src/components/auth/theme/theme-toggle-item.tsx
|
|
2490
|
+
var Nn = "[role=\"tab\"][aria-selected=\"true\"]";
|
|
2491
|
+
function Pn() {
|
|
2492
|
+
let { useTheme: e, localization: t } = m(Fn), { theme: n, setTheme: r, themes: i = [] } = e();
|
|
2493
|
+
return /* @__PURE__ */ Z(N.Item, {
|
|
2494
|
+
className: "py-1 pe-2",
|
|
2495
|
+
onFocus: (e) => {
|
|
2496
|
+
e.target === e.currentTarget && e.currentTarget.querySelector(Nn)?.focus({ preventScroll: !0 });
|
|
2497
|
+
},
|
|
2498
|
+
shouldCloseOnSelect: !1,
|
|
2499
|
+
children: [
|
|
2500
|
+
/* @__PURE__ */ X(He, { className: "text-muted" }),
|
|
2501
|
+
/* @__PURE__ */ X(R, { children: t.theme }),
|
|
2502
|
+
/* @__PURE__ */ X(W, {
|
|
2503
|
+
className: "ml-auto",
|
|
2504
|
+
selectedKey: n,
|
|
2505
|
+
onSelectionChange: (e) => r(e),
|
|
2506
|
+
children: /* @__PURE__ */ X(W.ListContainer, {
|
|
2507
|
+
onKeyDown: (e) => {
|
|
2508
|
+
if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
|
|
2509
|
+
let t = e.target;
|
|
2510
|
+
if (t.getAttribute("role") !== "tab") return;
|
|
2511
|
+
let n = t.closest("[role=\"menuitem\"]"), r = n?.closest("[role=\"menu\"]");
|
|
2512
|
+
if (!n || !r) return;
|
|
2513
|
+
let i = Array.from(r.querySelectorAll("[role=\"menuitem\"]:not([data-disabled])")), a = i.indexOf(n);
|
|
2514
|
+
if (a === -1) return;
|
|
2515
|
+
let o = i[e.key === "ArrowDown" ? a + 1 : a - 1];
|
|
2516
|
+
o && (e.preventDefault(), o.focus());
|
|
2517
|
+
},
|
|
2518
|
+
children: /* @__PURE__ */ Z(W.List, {
|
|
2519
|
+
"aria-label": t.theme,
|
|
2520
|
+
className: "*:h-5 *:w-5 *:p-0",
|
|
2521
|
+
children: [
|
|
2522
|
+
i.includes("system") && /* @__PURE__ */ Z(W.Tab, {
|
|
2523
|
+
id: "system",
|
|
2524
|
+
"aria-label": t.system,
|
|
2525
|
+
children: [/* @__PURE__ */ X(Ne, { className: "size-3" }), /* @__PURE__ */ X(W.Indicator, {})]
|
|
2526
|
+
}),
|
|
2527
|
+
i.includes("light") && /* @__PURE__ */ Z(W.Tab, {
|
|
2528
|
+
id: "light",
|
|
2529
|
+
"aria-label": t.light,
|
|
2530
|
+
children: [/* @__PURE__ */ X(qe, { className: "size-3" }), /* @__PURE__ */ X(W.Indicator, {})]
|
|
2531
|
+
}),
|
|
2532
|
+
i.includes("dark") && /* @__PURE__ */ Z(W.Tab, {
|
|
2533
|
+
id: "dark",
|
|
2534
|
+
"aria-label": t.dark,
|
|
2535
|
+
children: [/* @__PURE__ */ X(Ve, { className: "size-3" }), /* @__PURE__ */ X(W.Indicator, {})]
|
|
2536
|
+
})
|
|
2537
|
+
]
|
|
2538
|
+
})
|
|
2539
|
+
})
|
|
2540
|
+
})
|
|
2541
|
+
]
|
|
2542
|
+
});
|
|
2543
|
+
}
|
|
2544
|
+
//#endregion
|
|
2545
|
+
//#region src/lib/auth/theme-plugin.ts
|
|
2546
|
+
var Fn = a(gt.id, ({ useTheme: e, ...t }) => {
|
|
2547
|
+
let n = gt({
|
|
2548
|
+
setTheme: () => {},
|
|
2549
|
+
...t
|
|
2550
|
+
});
|
|
2551
|
+
return {
|
|
2552
|
+
...n,
|
|
2553
|
+
useTheme: e ?? (() => ({
|
|
2554
|
+
theme: n.theme,
|
|
2555
|
+
setTheme: n.setTheme,
|
|
2556
|
+
themes: n.themes
|
|
2557
|
+
})),
|
|
2558
|
+
userMenuItems: [Pn],
|
|
2559
|
+
accountCards: [In]
|
|
2560
|
+
};
|
|
2561
|
+
});
|
|
2562
|
+
//#endregion
|
|
2563
|
+
//#region src/components/auth/theme/appearance.tsx
|
|
2564
|
+
function In({ className: e, variant: t, ...n }) {
|
|
2565
|
+
let { useTheme: r, localization: i } = m(Fn), { theme: a, setTheme: o, themes: u = [] } = r(), d = it();
|
|
2566
|
+
return /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("h2", {
|
|
2567
|
+
className: K("text-sm font-semibold mb-3"),
|
|
2568
|
+
children: i.appearance
|
|
2569
|
+
}), /* @__PURE__ */ X(j, {
|
|
2570
|
+
className: K("p-4 gap-4", e),
|
|
2571
|
+
variant: t,
|
|
2572
|
+
...n,
|
|
2573
|
+
children: /* @__PURE__ */ Z(j.Content, { children: [/* @__PURE__ */ X(R, { children: i.theme }), /* @__PURE__ */ X(nt, {
|
|
2574
|
+
variant: t === "transparent" ? "secondary" : "primary",
|
|
2575
|
+
value: d ? a : "",
|
|
2576
|
+
onChange: o,
|
|
2577
|
+
isDisabled: !d || !a,
|
|
2578
|
+
children: /* @__PURE__ */ Z("div", {
|
|
2579
|
+
className: "grid gap-3 grid-cols-2 sm:grid-cols-3",
|
|
2580
|
+
children: [
|
|
2581
|
+
u.includes("system") && /* @__PURE__ */ X(z, {
|
|
2582
|
+
value: "system",
|
|
2583
|
+
className: K("mt-0 px-4 pb-4 pt-3 rounded-xl", "border border-transparent data-[selected=true]:border-accent data-[selected=true]:bg-accent/10", "data-[focus-visible=true]:border-accent data-[focus-visible=true]:bg-accent/10", t === "transparent" ? "bg-surface" : "bg-surface-secondary"),
|
|
2584
|
+
children: /* @__PURE__ */ Z(z.Content, {
|
|
2585
|
+
className: "gap-2",
|
|
2586
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
2587
|
+
className: "flex gap-2 justify-between",
|
|
2588
|
+
children: [/* @__PURE__ */ Z(R, {
|
|
2589
|
+
className: "flex gap-2 items-center",
|
|
2590
|
+
children: [/* @__PURE__ */ X(Ne, { className: "text-muted" }), i.system]
|
|
2591
|
+
}), /* @__PURE__ */ X(z.Control, { children: /* @__PURE__ */ X(z.Indicator, {}) })]
|
|
2592
|
+
}), /* @__PURE__ */ X(l, { className: "w-full" })]
|
|
2593
|
+
})
|
|
2594
|
+
}),
|
|
2595
|
+
u.includes("light") && /* @__PURE__ */ X(z, {
|
|
2596
|
+
value: "light",
|
|
2597
|
+
className: K("mt-0 px-4 pb-4 pt-3 rounded-xl", "border border-transparent data-[selected=true]:border-accent data-[selected=true]:bg-accent/10", "data-[focus-visible=true]:border-accent data-[focus-visible=true]:bg-accent/10", t === "transparent" ? "bg-surface" : "bg-surface-secondary"),
|
|
2598
|
+
children: /* @__PURE__ */ Z(z.Content, {
|
|
2599
|
+
className: "gap-2",
|
|
2600
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
2601
|
+
className: "flex gap-2 justify-between",
|
|
2602
|
+
children: [/* @__PURE__ */ Z(R, {
|
|
2603
|
+
className: "flex gap-2 items-center",
|
|
2604
|
+
children: [/* @__PURE__ */ X(qe, { className: "text-muted" }), i.light]
|
|
2605
|
+
}), /* @__PURE__ */ X(z.Control, { children: /* @__PURE__ */ X(z.Indicator, {}) })]
|
|
2606
|
+
}), /* @__PURE__ */ X(c, { className: "w-full" })]
|
|
2607
|
+
})
|
|
2608
|
+
}),
|
|
2609
|
+
u.includes("dark") && /* @__PURE__ */ X(z, {
|
|
2610
|
+
value: "dark",
|
|
2611
|
+
className: K("mt-0 px-4 pb-4 pt-3 rounded-xl", "border border-transparent data-[selected=true]:border-accent data-[selected=true]:bg-accent/10", "data-[focus-visible=true]:border-accent data-[focus-visible=true]:bg-accent/10", t === "transparent" ? "bg-surface" : "bg-surface-secondary"),
|
|
2612
|
+
children: /* @__PURE__ */ Z(z.Content, {
|
|
2613
|
+
className: "gap-2",
|
|
2614
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
2615
|
+
className: "flex gap-2 justify-between",
|
|
2616
|
+
children: [/* @__PURE__ */ Z(R, {
|
|
2617
|
+
className: "flex gap-2 items-center",
|
|
2618
|
+
children: [/* @__PURE__ */ X(Ve, { className: "text-muted" }), i.dark]
|
|
2619
|
+
}), /* @__PURE__ */ X(z.Control, { children: /* @__PURE__ */ X(z.Indicator, {}) })]
|
|
2620
|
+
}), /* @__PURE__ */ X(s, { className: "w-full" })]
|
|
2621
|
+
})
|
|
2622
|
+
})
|
|
2623
|
+
]
|
|
2624
|
+
})
|
|
2625
|
+
})] })
|
|
2626
|
+
})] });
|
|
2627
|
+
}
|
|
2628
|
+
//#endregion
|
|
2629
|
+
//#region src/components/auth/username/username-field.tsx
|
|
2630
|
+
function Ln({ name: e, field: t, isPending: n, variant: r }) {
|
|
2631
|
+
let { authClient: i } = p(), { localization: a, minUsernameLength: o, maxUsernameLength: s, isUsernameAvailable: c } = m(Rn), l = String(t.defaultValue ?? ""), [u, d] = J(l), { mutate: f, data: h, error: g, reset: _ } = te(i, { onError: () => {} }), v = yt((e) => {
|
|
2632
|
+
let t = e.trim();
|
|
2633
|
+
if (!t || t === l) {
|
|
2634
|
+
_();
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2637
|
+
f({ username: t });
|
|
2638
|
+
}, { wait: 500 });
|
|
2639
|
+
function y(e) {
|
|
2640
|
+
d(e), _(), c && v.maybeExecute(e);
|
|
2641
|
+
}
|
|
2642
|
+
let b = !!c && !!u.trim() && u.trim() !== l;
|
|
2643
|
+
return /* @__PURE__ */ Z(G, {
|
|
2644
|
+
name: e,
|
|
2645
|
+
type: "text",
|
|
2646
|
+
autoComplete: "username",
|
|
2647
|
+
minLength: o,
|
|
2648
|
+
maxLength: s,
|
|
2649
|
+
isDisabled: n,
|
|
2650
|
+
isReadOnly: t.readOnly,
|
|
2651
|
+
value: u,
|
|
2652
|
+
onChange: y,
|
|
2653
|
+
children: [
|
|
2654
|
+
/* @__PURE__ */ X(R, { children: t.label }),
|
|
2655
|
+
/* @__PURE__ */ Z(L, {
|
|
2656
|
+
variant: r === "transparent" ? "primary" : "secondary",
|
|
2657
|
+
children: [/* @__PURE__ */ X(L.Input, {
|
|
2658
|
+
placeholder: t.placeholder,
|
|
2659
|
+
required: t.required
|
|
2660
|
+
}), b && /* @__PURE__ */ X(L.Suffix, {
|
|
2661
|
+
"aria-label": h?.available ? a.usernameAvailable : h?.available === !1 ? a.usernameTaken : void 0,
|
|
2662
|
+
className: "px-2",
|
|
2663
|
+
children: h?.available ? /* @__PURE__ */ X(Ee, { className: "text-success" }) : g || h?.available === !1 ? /* @__PURE__ */ X(O, { className: "text-danger" }) : /* @__PURE__ */ X(H, {
|
|
2664
|
+
size: "sm",
|
|
2665
|
+
color: "current"
|
|
2666
|
+
})
|
|
2667
|
+
})]
|
|
2668
|
+
}),
|
|
2669
|
+
/* @__PURE__ */ X(P, {})
|
|
2670
|
+
]
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
//#endregion
|
|
2674
|
+
//#region src/lib/auth/username-plugin.tsx
|
|
2675
|
+
var Rn = a(_t.id, (e = {}) => {
|
|
2676
|
+
let t = _t(e);
|
|
2677
|
+
return {
|
|
2678
|
+
...t,
|
|
2679
|
+
additionalFields: t.additionalFields?.map((e) => e.name === "username" ? {
|
|
2680
|
+
...e,
|
|
2681
|
+
render: Ln
|
|
2682
|
+
} : e),
|
|
2683
|
+
views: { auth: { signIn: zn } }
|
|
2684
|
+
};
|
|
2685
|
+
});
|
|
2686
|
+
//#endregion
|
|
2687
|
+
//#region src/components/auth/username/sign-in-username.tsx
|
|
2688
|
+
function zn({ className: n, socialLayout: i, socialPosition: a = "bottom", variant: o, ...s }) {
|
|
2689
|
+
let { authClient: c, basePaths: l, baseURL: u, emailAndPassword: d, localization: f, plugins: h, redirectTo: g, socialProviders: _, viewPaths: v, navigate: y } = p(), { fetchOptions: b, resetFetchOptions: x } = w(), { localization: S } = m(Rn), [C, T] = J(""), { mutate: ee } = pe(c, { onSuccess: () => q.success(f.auth.verificationEmailSent) });
|
|
2690
|
+
function te(e) {
|
|
2691
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
2692
|
+
}
|
|
2693
|
+
let { mutate: ne, isPending: re } = ge(c, {
|
|
2694
|
+
onError: (e, { email: t }) => {
|
|
2695
|
+
T(""), e.error?.code === "EMAIL_NOT_VERIFIED" ? q.danger(e.error?.message || e.message, { actionProps: {
|
|
2696
|
+
children: f.auth.resend,
|
|
2697
|
+
onClick: () => ee({
|
|
2698
|
+
email: t,
|
|
2699
|
+
callbackURL: `${u}${g}`
|
|
2700
|
+
})
|
|
2701
|
+
} }) : q.danger(e.error?.message || e.message), x();
|
|
2702
|
+
},
|
|
2703
|
+
onSuccess: () => y({ to: g })
|
|
2704
|
+
}), { mutate: ie, isPending: ae } = ye(c, {
|
|
2705
|
+
onError: (e) => {
|
|
2706
|
+
T(""), q.danger(e.error?.message || e.message), x();
|
|
2707
|
+
},
|
|
2708
|
+
onSuccess: () => y({ to: g })
|
|
2709
|
+
}), oe = (e) => {
|
|
2710
|
+
e.preventDefault();
|
|
2711
|
+
let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
|
|
2712
|
+
te(n) ? ne({
|
|
2713
|
+
email: n,
|
|
2714
|
+
password: C,
|
|
2715
|
+
...d?.rememberMe ? { rememberMe: r } : {},
|
|
2716
|
+
fetchOptions: b
|
|
2717
|
+
}) : ie({
|
|
2718
|
+
username: n,
|
|
2719
|
+
password: C,
|
|
2720
|
+
...d?.rememberMe ? { rememberMe: r } : {},
|
|
2721
|
+
fetchOptions: b
|
|
2722
|
+
});
|
|
2723
|
+
}, E = ct({ mutationKey: r.signIn.all }) + ct({ mutationKey: r.signUp.all }) > 0, se = re || ae, ce = h.find((e) => e.captchaComponent)?.captchaComponent, le = d?.enabled && !!_?.length;
|
|
2724
|
+
return /* @__PURE__ */ Z(j, {
|
|
2725
|
+
className: K("w-full max-w-sm gap-4 md:p-6", n),
|
|
2726
|
+
variant: o,
|
|
2727
|
+
...s,
|
|
2728
|
+
children: [
|
|
2729
|
+
/* @__PURE__ */ X(j.Header, { children: /* @__PURE__ */ X(j.Title, {
|
|
2730
|
+
className: "text-xl font-semibold mb-1",
|
|
2731
|
+
children: f.auth.signIn
|
|
2732
|
+
}) }),
|
|
2733
|
+
/* @__PURE__ */ Z(j.Content, {
|
|
2734
|
+
className: "gap-4",
|
|
2735
|
+
children: [
|
|
2736
|
+
a === "top" && /* @__PURE__ */ Z(Y, { children: [!!_?.length && /* @__PURE__ */ X(t, { socialLayout: i }), le && /* @__PURE__ */ X(e, { children: f.auth.or })] }),
|
|
2737
|
+
d?.enabled && /* @__PURE__ */ Z(F, {
|
|
2738
|
+
onSubmit: oe,
|
|
2739
|
+
className: "flex flex-col gap-4",
|
|
2740
|
+
children: [
|
|
2741
|
+
/* @__PURE__ */ Z(G, {
|
|
2742
|
+
name: "email",
|
|
2743
|
+
type: "text",
|
|
2744
|
+
autoComplete: "username email",
|
|
2745
|
+
isDisabled: E,
|
|
2746
|
+
children: [
|
|
2747
|
+
/* @__PURE__ */ X(R, { children: S.username }),
|
|
2748
|
+
/* @__PURE__ */ X(I, {
|
|
2749
|
+
placeholder: S.usernameOrEmailPlaceholder,
|
|
2750
|
+
variant: o === "transparent" ? "primary" : "secondary",
|
|
2751
|
+
required: !0
|
|
2752
|
+
}),
|
|
2753
|
+
/* @__PURE__ */ X(P, {})
|
|
2754
|
+
]
|
|
2755
|
+
}),
|
|
2756
|
+
/* @__PURE__ */ Z(G, {
|
|
2757
|
+
minLength: d?.minPasswordLength,
|
|
2758
|
+
maxLength: d?.maxPasswordLength,
|
|
2759
|
+
name: "password",
|
|
2760
|
+
type: "password",
|
|
2761
|
+
autoComplete: "current-password",
|
|
2762
|
+
isDisabled: E,
|
|
2763
|
+
value: C,
|
|
2764
|
+
onChange: T,
|
|
2765
|
+
children: [
|
|
2766
|
+
/* @__PURE__ */ X(R, { children: f.auth.password }),
|
|
2767
|
+
/* @__PURE__ */ X(I, {
|
|
2768
|
+
placeholder: f.auth.passwordPlaceholder,
|
|
2769
|
+
variant: o === "transparent" ? "primary" : "secondary",
|
|
2770
|
+
required: !0
|
|
2771
|
+
}),
|
|
2772
|
+
/* @__PURE__ */ X(P, {})
|
|
2773
|
+
]
|
|
2774
|
+
}),
|
|
2775
|
+
d?.rememberMe && /* @__PURE__ */ Z(Ze, {
|
|
2776
|
+
name: "rememberMe",
|
|
2777
|
+
isDisabled: E,
|
|
2778
|
+
variant: o === "transparent" ? "primary" : "secondary",
|
|
2779
|
+
children: [/* @__PURE__ */ X(Ze.Control, { children: /* @__PURE__ */ X(Ze.Indicator, {}) }), /* @__PURE__ */ X(Ze.Content, { children: /* @__PURE__ */ X(R, { children: f.auth.rememberMe }) })]
|
|
2780
|
+
}),
|
|
2781
|
+
ce && /* @__PURE__ */ X("div", {
|
|
2782
|
+
className: "flex justify-center",
|
|
2783
|
+
children: ce
|
|
2784
|
+
}),
|
|
2785
|
+
/* @__PURE__ */ Z("div", {
|
|
2786
|
+
className: "flex flex-col gap-3",
|
|
2787
|
+
children: [/* @__PURE__ */ Z(A, {
|
|
2788
|
+
type: "submit",
|
|
2789
|
+
className: "w-full",
|
|
2790
|
+
isPending: se || E,
|
|
2791
|
+
children: [se && /* @__PURE__ */ X(H, {
|
|
2792
|
+
color: "current",
|
|
2793
|
+
size: "sm"
|
|
2794
|
+
}), f.auth.signIn]
|
|
2795
|
+
}), h.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ X(t, { view: "signIn" }, `${e.id}-${n.toString()}`)))]
|
|
2796
|
+
})
|
|
2797
|
+
]
|
|
2798
|
+
}),
|
|
2799
|
+
a === "bottom" && /* @__PURE__ */ Z(Y, { children: [le && /* @__PURE__ */ X(e, { children: f.auth.or }), !!_?.length && /* @__PURE__ */ X(t, { socialLayout: i })] })
|
|
2800
|
+
]
|
|
2801
|
+
}),
|
|
2802
|
+
/* @__PURE__ */ Z(j.Footer, {
|
|
2803
|
+
className: "flex-col gap-3",
|
|
2804
|
+
children: [d?.forgotPassword && /* @__PURE__ */ X(et, {
|
|
2805
|
+
href: `${l.auth}/${v.auth.forgotPassword}`,
|
|
2806
|
+
className: "no-underline hover:underline",
|
|
2807
|
+
children: f.auth.forgotPasswordLink
|
|
2808
|
+
}), d?.enabled && /* @__PURE__ */ Z(Qe, {
|
|
2809
|
+
className: "text-sm",
|
|
2810
|
+
children: [
|
|
2811
|
+
f.auth.needToCreateAnAccount,
|
|
2812
|
+
" ",
|
|
2813
|
+
/* @__PURE__ */ X(et, {
|
|
2814
|
+
href: `${l.auth}/${v.auth.signUp}`,
|
|
2815
|
+
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
2816
|
+
children: f.auth.signUp
|
|
2817
|
+
})
|
|
2818
|
+
]
|
|
2819
|
+
})]
|
|
2820
|
+
})
|
|
2821
|
+
]
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
//#endregion
|
|
2825
|
+
export { Ot as ApiKeys, In as Appearance, en as ChangeOrganizationLogo, Ut as CreateOrganizationDialog, jt as DangerZone, At as DeleteAccount, rn as DeleteOrganization, nn as DeleteOrganizationSkeleton, on as InviteMemberDialog, cn as LeaveOrganization, Pt as MagicLink, Bt as ManageAccount, Ft as ManageAccounts, Cn as Organization, bt as OrganizationApiKeys, bn as OrganizationDangerZone, fn as OrganizationInvitations, dn as OrganizationInvitationsEmpty, Wt as OrganizationLogo, _n as OrganizationMembers, yn as OrganizationPeople, xn as OrganizationProfile, Kt as OrganizationRow, Sn as OrganizationSettings, wn as OrganizationSwitcher, Q as OrganizationView, Gt as OrganizationViewSkeleton, Jt as Organizations, $t as OrganizationsSettings, Mn as Passkeys, zn as SignInUsername, Rt as SwitchAccountSubmenu, Lt as SwitchAccountSubmenuContent, It as SwitchAccountSubmenuItem, Pn as ThemeToggleItem, Qt as UserInvitations, Ln as UsernameField, xt as apiKeyPlugin, kt as deleteUserPlugin, Nt as magicLinkPlugin, zt as multiSessionPlugin, $ as organizationPlugin, En as passkeyPlugin, Fn as themePlugin, Rn as usernamePlugin };
|