@aphexcms/cms-core 11.3.0 → 12.0.0-next.20261109084846

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.
Files changed (227) hide show
  1. package/dist/admin/client-auth.svelte.d.ts +120 -0
  2. package/dist/admin/client-auth.svelte.d.ts.map +1 -0
  3. package/dist/admin/client-auth.svelte.js +14 -0
  4. package/dist/admin/client-config.d.ts +72 -0
  5. package/dist/admin/client-config.d.ts.map +1 -0
  6. package/dist/admin/client-config.js +1 -0
  7. package/dist/admin/settings-header-actions.d.ts +12 -0
  8. package/dist/admin/settings-header-actions.d.ts.map +1 -0
  9. package/dist/admin/settings-header-actions.js +1 -0
  10. package/dist/admin/view-data.d.ts +189 -0
  11. package/dist/admin/view-data.d.ts.map +1 -0
  12. package/dist/admin/view-data.js +1 -0
  13. package/dist/admin.css +6 -0
  14. package/dist/api/invitations.d.ts +2 -2
  15. package/dist/api/invitations.d.ts.map +1 -1
  16. package/dist/api/organizations.d.ts +5 -4
  17. package/dist/api/organizations.d.ts.map +1 -1
  18. package/dist/api/organizations.js +2 -3
  19. package/dist/api/user.d.ts +6 -1
  20. package/dist/api/user.d.ts.map +1 -1
  21. package/dist/api/user.js +7 -0
  22. package/dist/app-augment.d.ts +2 -3
  23. package/dist/app-augment.d.ts.map +1 -1
  24. package/dist/app.d.ts +1 -1
  25. package/dist/auth/auth-errors.d.ts +6 -0
  26. package/dist/auth/auth-errors.d.ts.map +1 -1
  27. package/dist/auth/auth-errors.js +8 -0
  28. package/dist/auth/auth-hooks.d.ts.map +1 -1
  29. package/dist/auth/auth-hooks.js +36 -17
  30. package/dist/auth/invitation-email.d.ts +9 -0
  31. package/dist/auth/invitation-email.d.ts.map +1 -0
  32. package/dist/auth/invitation-email.js +49 -0
  33. package/dist/auth/pages.d.ts +16 -0
  34. package/dist/auth/pages.d.ts.map +1 -0
  35. package/dist/auth/pages.js +23 -0
  36. package/dist/auth/provider.d.ts +31 -1
  37. package/dist/auth/provider.d.ts.map +1 -1
  38. package/dist/client/index.d.ts +5 -0
  39. package/dist/client/index.d.ts.map +1 -1
  40. package/dist/client/index.js +9 -0
  41. package/dist/client/ui.d.ts +16 -0
  42. package/dist/client/ui.d.ts.map +1 -1
  43. package/dist/client/ui.js +26 -1
  44. package/dist/components/AphexStudio.svelte +268 -0
  45. package/dist/components/AphexStudio.svelte.d.ts +16 -0
  46. package/dist/components/AphexStudio.svelte.d.ts.map +1 -0
  47. package/dist/components/admin/AccountSettings.svelte +339 -0
  48. package/dist/components/admin/AccountSettings.svelte.d.ts +8 -0
  49. package/dist/components/admin/AccountSettings.svelte.d.ts.map +1 -0
  50. package/dist/components/admin/AccountSettingsView.svelte +61 -0
  51. package/dist/components/admin/AccountSettingsView.svelte.d.ts +19 -0
  52. package/dist/components/admin/AccountSettingsView.svelte.d.ts.map +1 -0
  53. package/dist/components/admin/ApiKeysSettings.svelte +435 -0
  54. package/dist/components/admin/ApiKeysSettings.svelte.d.ts +15 -0
  55. package/dist/components/admin/ApiKeysSettings.svelte.d.ts.map +1 -0
  56. package/dist/components/admin/AuthPageShell.svelte +32 -0
  57. package/dist/components/admin/AuthPageShell.svelte.d.ts +16 -0
  58. package/dist/components/admin/AuthPageShell.svelte.d.ts.map +1 -0
  59. package/dist/components/admin/CreateOrganization.svelte +158 -0
  60. package/dist/components/admin/CreateOrganization.svelte.d.ts +11 -0
  61. package/dist/components/admin/CreateOrganization.svelte.d.ts.map +1 -0
  62. package/dist/components/admin/DeleteAccountSettings.svelte +124 -0
  63. package/dist/components/admin/DeleteAccountSettings.svelte.d.ts +7 -0
  64. package/dist/components/admin/DeleteAccountSettings.svelte.d.ts.map +1 -0
  65. package/dist/components/admin/DeleteOrganizationSettings.svelte +123 -0
  66. package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts +11 -0
  67. package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts.map +1 -0
  68. package/dist/components/admin/DocumentEditor.svelte +92 -22
  69. package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
  70. package/dist/components/admin/GeneralSettings.svelte +45 -0
  71. package/dist/components/admin/GeneralSettings.svelte.d.ts +10 -0
  72. package/dist/components/admin/GeneralSettings.svelte.d.ts.map +1 -0
  73. package/dist/components/admin/GodModeView.svelte +112 -0
  74. package/dist/components/admin/GodModeView.svelte.d.ts +9 -0
  75. package/dist/components/admin/GodModeView.svelte.d.ts.map +1 -0
  76. package/dist/components/admin/InvitationsView.svelte +277 -0
  77. package/dist/components/admin/InvitationsView.svelte.d.ts +11 -0
  78. package/dist/components/admin/InvitationsView.svelte.d.ts.map +1 -0
  79. package/dist/components/admin/InviteView.svelte +98 -0
  80. package/dist/components/admin/InviteView.svelte.d.ts +9 -0
  81. package/dist/components/admin/InviteView.svelte.d.ts.map +1 -0
  82. package/dist/components/admin/LoginView.svelte +478 -0
  83. package/dist/components/admin/LoginView.svelte.d.ts +5 -0
  84. package/dist/components/admin/LoginView.svelte.d.ts.map +1 -0
  85. package/dist/components/admin/MembersSettings.svelte +25 -3
  86. package/dist/components/admin/MembersSettings.svelte.d.ts +5 -1
  87. package/dist/components/admin/MembersSettings.svelte.d.ts.map +1 -1
  88. package/dist/components/admin/OrganizationSettings.svelte +367 -0
  89. package/dist/components/admin/OrganizationSettings.svelte.d.ts +9 -0
  90. package/dist/components/admin/OrganizationSettings.svelte.d.ts.map +1 -0
  91. package/dist/components/admin/OrganizationsList.svelte +92 -0
  92. package/dist/components/admin/OrganizationsList.svelte.d.ts +8 -0
  93. package/dist/components/admin/OrganizationsList.svelte.d.ts.map +1 -0
  94. package/dist/components/admin/OrganizationsView.svelte +31 -0
  95. package/dist/components/admin/OrganizationsView.svelte.d.ts +9 -0
  96. package/dist/components/admin/OrganizationsView.svelte.d.ts.map +1 -0
  97. package/dist/components/admin/PasswordInput.svelte +43 -0
  98. package/dist/components/admin/PasswordInput.svelte.d.ts +8 -0
  99. package/dist/components/admin/PasswordInput.svelte.d.ts.map +1 -0
  100. package/dist/components/admin/PasswordSettings.svelte +179 -0
  101. package/dist/components/admin/PasswordSettings.svelte.d.ts +4 -0
  102. package/dist/components/admin/PasswordSettings.svelte.d.ts.map +1 -0
  103. package/dist/components/admin/PreferencesSettings.svelte +80 -0
  104. package/dist/components/admin/PreferencesSettings.svelte.d.ts +20 -0
  105. package/dist/components/admin/PreferencesSettings.svelte.d.ts.map +1 -0
  106. package/dist/components/admin/ResetPasswordView.svelte +117 -0
  107. package/dist/components/admin/ResetPasswordView.svelte.d.ts +9 -0
  108. package/dist/components/admin/ResetPasswordView.svelte.d.ts.map +1 -0
  109. package/dist/components/admin/RolesSettings.svelte +360 -0
  110. package/dist/components/admin/RolesSettings.svelte.d.ts +11 -0
  111. package/dist/components/admin/RolesSettings.svelte.d.ts.map +1 -0
  112. package/dist/components/admin/SchemaField.svelte +2 -1
  113. package/dist/components/admin/SchemaField.svelte.d.ts.map +1 -1
  114. package/dist/components/admin/SettingsHeaderActions.svelte +25 -0
  115. package/dist/components/admin/SettingsHeaderActions.svelte.d.ts +8 -0
  116. package/dist/components/admin/SettingsHeaderActions.svelte.d.ts.map +1 -0
  117. package/dist/components/admin/SettingsShell.svelte +136 -0
  118. package/dist/components/admin/SettingsShell.svelte.d.ts +9 -0
  119. package/dist/components/admin/SettingsShell.svelte.d.ts.map +1 -0
  120. package/dist/components/admin/TwoFactorChallengeView.svelte +377 -0
  121. package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts +11 -0
  122. package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts.map +1 -0
  123. package/dist/components/admin/TwoFactorSettings.svelte +436 -0
  124. package/dist/components/admin/TwoFactorSettings.svelte.d.ts +7 -0
  125. package/dist/components/admin/TwoFactorSettings.svelte.d.ts.map +1 -0
  126. package/dist/components/admin/fields/ImageField.svelte +4 -2
  127. package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +3 -2
  128. package/dist/components/admin/fields/richtext/RichtextField.svelte +48 -6
  129. package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -1
  130. package/dist/components/layout/sidebar/NavUser.svelte +2 -2
  131. package/dist/config.d.ts +2 -1
  132. package/dist/config.d.ts.map +1 -1
  133. package/dist/email/index.d.ts +1 -0
  134. package/dist/email/index.d.ts.map +1 -1
  135. package/dist/email/index.js +2 -0
  136. package/dist/email/interfaces/email.d.ts +2 -0
  137. package/dist/email/interfaces/email.d.ts.map +1 -1
  138. package/dist/email/link-email.d.ts +15 -0
  139. package/dist/email/link-email.d.ts.map +1 -0
  140. package/dist/email/link-email.js +30 -0
  141. package/dist/field-validation/utils.d.ts +29 -0
  142. package/dist/field-validation/utils.d.ts.map +1 -1
  143. package/dist/field-validation/utils.js +138 -5
  144. package/dist/graphql/index.d.ts.map +1 -1
  145. package/dist/graphql/index.js +1 -1
  146. package/dist/hooks.d.ts +6 -3
  147. package/dist/hooks.d.ts.map +1 -1
  148. package/dist/hooks.js +53 -17
  149. package/dist/jobs/recurring.d.ts +4 -1
  150. package/dist/jobs/recurring.d.ts.map +1 -1
  151. package/dist/jobs/recurring.js +28 -0
  152. package/dist/local-api/auth-helpers.d.ts +4 -4
  153. package/dist/local-api/auth-helpers.js +4 -4
  154. package/dist/local-api/collection-api.d.ts +10 -1
  155. package/dist/local-api/collection-api.d.ts.map +1 -1
  156. package/dist/local-api/collection-api.js +25 -7
  157. package/dist/local-api/index.d.ts +1 -1
  158. package/dist/local-api/index.d.ts.map +1 -1
  159. package/dist/local-api/index.js +7 -5
  160. package/dist/local-api/types.d.ts +1 -1
  161. package/dist/preview/perspective.d.ts +1 -1
  162. package/dist/preview/perspective.js +1 -1
  163. package/dist/resolve-config.d.ts +22 -0
  164. package/dist/resolve-config.d.ts.map +1 -0
  165. package/dist/resolve-config.js +106 -0
  166. package/dist/routes/assets-cdn.d.ts +7 -2
  167. package/dist/routes/assets-cdn.d.ts.map +1 -1
  168. package/dist/routes/assets-cdn.js +1 -1
  169. package/dist/server/api/index.d.ts +1 -2
  170. package/dist/server/api/index.d.ts.map +1 -1
  171. package/dist/server/api/index.js +10 -3
  172. package/dist/server/api/openapi/registry.d.ts.map +1 -1
  173. package/dist/server/api/openapi/registry.js +62 -0
  174. package/dist/server/api/routes/api-keys.d.ts +4 -0
  175. package/dist/server/api/routes/api-keys.d.ts.map +1 -0
  176. package/dist/server/api/routes/api-keys.js +88 -0
  177. package/dist/server/api/routes/documents-by-id.d.ts.map +1 -1
  178. package/dist/server/api/routes/documents-by-id.js +16 -1
  179. package/dist/server/api/routes/documents-publish.d.ts.map +1 -1
  180. package/dist/server/api/routes/documents-publish.js +11 -1
  181. package/dist/server/api/routes/documents.d.ts.map +1 -1
  182. package/dist/server/api/routes/documents.js +16 -2
  183. package/dist/server/api/routes/instance-settings.d.ts +4 -0
  184. package/dist/server/api/routes/instance-settings.d.ts.map +1 -0
  185. package/dist/server/api/routes/instance-settings.js +47 -0
  186. package/dist/server/api/routes/invitations.d.ts +9 -0
  187. package/dist/server/api/routes/invitations.d.ts.map +1 -0
  188. package/dist/server/api/routes/invitations.js +79 -0
  189. package/dist/server/api/routes/organizations-invitations.d.ts +0 -6
  190. package/dist/server/api/routes/organizations-invitations.d.ts.map +1 -1
  191. package/dist/server/api/routes/organizations-invitations.js +6 -7
  192. package/dist/server/api/routes/organizations-team.d.ts.map +1 -1
  193. package/dist/server/api/routes/organizations-team.js +2 -52
  194. package/dist/server/api/routes/organizations.d.ts.map +1 -1
  195. package/dist/server/api/routes/organizations.js +35 -9
  196. package/dist/server/core-routes.d.ts +8 -0
  197. package/dist/server/core-routes.d.ts.map +1 -0
  198. package/dist/server/core-routes.js +67 -0
  199. package/dist/server/index.d.ts +5 -1
  200. package/dist/server/index.d.ts.map +1 -1
  201. package/dist/server/index.js +7 -1
  202. package/dist/server/pages/admin.d.ts +24 -0
  203. package/dist/server/pages/admin.d.ts.map +1 -0
  204. package/dist/server/pages/admin.js +468 -0
  205. package/dist/server/queries/organization-team.d.ts +14 -0
  206. package/dist/server/queries/organization-team.d.ts.map +1 -0
  207. package/dist/server/queries/organization-team.js +65 -0
  208. package/dist/server/queries/pending-invitations.d.ts +8 -0
  209. package/dist/server/queries/pending-invitations.d.ts.map +1 -0
  210. package/dist/server/queries/pending-invitations.js +24 -0
  211. package/dist/types/api-key.d.ts +18 -0
  212. package/dist/types/api-key.d.ts.map +1 -0
  213. package/dist/types/api-key.js +1 -0
  214. package/dist/types/auth.d.ts +35 -0
  215. package/dist/types/auth.d.ts.map +1 -1
  216. package/dist/types/capabilities.d.ts +1 -2
  217. package/dist/types/capabilities.d.ts.map +1 -1
  218. package/dist/types/config.d.ts +124 -4
  219. package/dist/types/config.d.ts.map +1 -1
  220. package/dist/types/filters.d.ts +1 -1
  221. package/dist/types/index.d.ts +1 -0
  222. package/dist/types/index.d.ts.map +1 -1
  223. package/dist/types/index.js +1 -0
  224. package/dist/types/organization.d.ts +1 -1
  225. package/dist/vite/index.d.ts.map +1 -1
  226. package/dist/vite/index.js +46 -39
  227. package/package.json +19 -29
@@ -0,0 +1,124 @@
1
+ <script lang="ts">
2
+ import { Button } from '@aphexcms/ui/shadcn/button';
3
+ import { Label } from '@aphexcms/ui/shadcn/label';
4
+ import { Input } from '@aphexcms/ui/shadcn/input';
5
+ import * as Card from '@aphexcms/ui/shadcn/card';
6
+ import * as Dialog from '@aphexcms/ui/shadcn/dialog';
7
+ import { toast } from 'svelte-sonner';
8
+ import { goto } from '$app/navigation';
9
+ import PasswordInput from './PasswordInput.svelte';
10
+ import { useAdminAuthClient } from '../../admin/client-auth.svelte';
11
+
12
+ type Props = { email: string };
13
+ let { email }: Props = $props();
14
+
15
+ const auth = useAdminAuthClient();
16
+
17
+ let open = $state(false);
18
+ let confirmation = $state('');
19
+ let password = $state('');
20
+ let isDeleting = $state(false);
21
+
22
+ // Typing the address is the whole safeguard: it's the one field that can't be
23
+ // satisfied by clicking through, which is how an irreversible action gets taken
24
+ // by accident. The password is proof of identity, not of intent — a borrowed
25
+ // session has the button but not the words.
26
+ const canDelete = $derived(confirmation.trim().toLowerCase() === email.toLowerCase());
27
+
28
+ function onOpenChange(next: boolean) {
29
+ // Refuse to close mid-request; the dialog is the only thing reporting progress.
30
+ if (isDeleting) return;
31
+ open = next;
32
+ if (!next) {
33
+ confirmation = '';
34
+ password = '';
35
+ }
36
+ }
37
+
38
+ async function deleteAccount() {
39
+ if (!canDelete || isDeleting) return;
40
+ if (!auth) {
41
+ toast.error('Account deletion is unavailable');
42
+ return;
43
+ }
44
+
45
+ isDeleting = true;
46
+ try {
47
+ const result = await auth.deleteUser({ password });
48
+ if (result.error) {
49
+ // The server refuses when you're the last owner of an organization that
50
+ // still has members — surface its message rather than a generic failure,
51
+ // because it names what to fix.
52
+ throw new Error(result.error.message || 'Could not delete your account');
53
+ }
54
+
55
+ // Straight out, no toast: the session is gone and the admin shell would only
56
+ // render a flash of a workspace this account no longer belongs to.
57
+ await goto('/admin/login?deleted=1');
58
+ } catch (error) {
59
+ toast.error(error instanceof Error ? error.message : 'Could not delete your account');
60
+ isDeleting = false;
61
+ }
62
+ }
63
+ </script>
64
+
65
+ <Card.Root class="border-destructive/40">
66
+ <Card.Content class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
67
+ <div class="space-y-1">
68
+ <p class="text-sm font-medium">Delete account</p>
69
+ <p class="text-muted-foreground max-w-prose text-sm">
70
+ Permanently deletes your account, your profile picture, and your membership of every
71
+ workspace. Content you created stays where it is. This can't be undone.
72
+ </p>
73
+ </div>
74
+
75
+ <Button variant="destructive" class="shrink-0" onclick={() => (open = true)} disabled={!auth}>
76
+ Delete account
77
+ </Button>
78
+ </Card.Content>
79
+ </Card.Root>
80
+
81
+ <Dialog.Root {open} {onOpenChange}>
82
+ <Dialog.Content class="sm:max-w-md">
83
+ <Dialog.Header>
84
+ <Dialog.Title>Delete your account?</Dialog.Title>
85
+ <Dialog.Description>
86
+ This is permanent. Your profile and profile picture are erased and you're removed from every
87
+ workspace you belong to.
88
+ </Dialog.Description>
89
+ </Dialog.Header>
90
+
91
+ <div class="grid gap-4 py-2">
92
+ <div class="grid gap-2">
93
+ <Label for="delete-confirmation">
94
+ Type <span class="font-mono font-medium">{email}</span> to confirm
95
+ </Label>
96
+ <Input
97
+ id="delete-confirmation"
98
+ bind:value={confirmation}
99
+ autocomplete="off"
100
+ disabled={isDeleting}
101
+ />
102
+ </div>
103
+
104
+ <div class="grid gap-2">
105
+ <Label for="delete-password">Your password</Label>
106
+ <PasswordInput
107
+ id="delete-password"
108
+ bind:value={password}
109
+ autocomplete="current-password"
110
+ disabled={isDeleting}
111
+ />
112
+ </div>
113
+ </div>
114
+
115
+ <Dialog.Footer>
116
+ <Button variant="outline" onclick={() => onOpenChange(false)} disabled={isDeleting}>
117
+ Cancel
118
+ </Button>
119
+ <Button variant="destructive" onclick={deleteAccount} disabled={!canDelete || isDeleting}>
120
+ {isDeleting ? 'Deleting…' : 'Delete account'}
121
+ </Button>
122
+ </Dialog.Footer>
123
+ </Dialog.Content>
124
+ </Dialog.Root>
@@ -0,0 +1,7 @@
1
+ type Props = {
2
+ email: string;
3
+ };
4
+ declare const DeleteAccountSettings: import("svelte").Component<Props, {}, "">;
5
+ type DeleteAccountSettings = ReturnType<typeof DeleteAccountSettings>;
6
+ export default DeleteAccountSettings;
7
+ //# sourceMappingURL=DeleteAccountSettings.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeleteAccountSettings.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/DeleteAccountSettings.svelte.ts"],"names":[],"mappings":"AAcC,KAAK,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAqHhC,QAAA,MAAM,qBAAqB,2CAAwC,CAAC;AACpE,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACtE,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,123 @@
1
+ <script lang="ts">
2
+ /**
3
+ * Danger-zone card for deleting the active organization. Core-owned. Member
4
+ * count arrives as a prop (no join); the server re-enforces that only an owner
5
+ * may delete and refuses to strand members.
6
+ */
7
+ import { Button } from '@aphexcms/ui/shadcn/button';
8
+ import { Label } from '@aphexcms/ui/shadcn/label';
9
+ import { Input } from '@aphexcms/ui/shadcn/input';
10
+ import * as Card from '@aphexcms/ui/shadcn/card';
11
+ import * as Dialog from '@aphexcms/ui/shadcn/dialog';
12
+ import { toast } from 'svelte-sonner';
13
+ import { goto } from '$app/navigation';
14
+ import { organizations } from '../../api';
15
+ import type { Organization } from '../../types/organization';
16
+
17
+ type Props = {
18
+ organization: Organization;
19
+ memberCount: number;
20
+ /** Only owners may delete; the server enforces this too. */
21
+ canDelete: boolean;
22
+ };
23
+
24
+ let { organization, memberCount, canDelete }: Props = $props();
25
+
26
+ let open = $state(false);
27
+ let confirmation = $state('');
28
+ let isDeleting = $state(false);
29
+
30
+ const confirmed = $derived(confirmation.trim() === organization.name);
31
+
32
+ function onOpenChange(next: boolean) {
33
+ if (isDeleting) return;
34
+ open = next;
35
+ if (!next) confirmation = '';
36
+ }
37
+
38
+ async function deleteOrganization() {
39
+ if (!confirmed || isDeleting) return;
40
+
41
+ // Read before navigating. Props read through to the page data, and once the
42
+ // navigation lands on /admin that data has no `organization`, so reading
43
+ // `organization.name` afterwards throws even though the delete worked.
44
+ const { id, name } = organization;
45
+ isDeleting = true;
46
+ try {
47
+ const result = await organizations.remove(id);
48
+ if (!result.success) {
49
+ throw new Error(result.error || result.message || 'Could not delete this workspace');
50
+ }
51
+
52
+ // The server moves everyone still signed in onto another workspace, or clears
53
+ // their active one. Reload from the server rather than patching local state —
54
+ // which workspace you land in is its decision, not something to guess at here.
55
+ await goto('/admin', { invalidateAll: true });
56
+ toast.success(`${name} was deleted`);
57
+ } catch (error) {
58
+ toast.error(error instanceof Error ? error.message : 'Could not delete this workspace');
59
+ isDeleting = false;
60
+ }
61
+ }
62
+ </script>
63
+
64
+ <Card.Root class="border-destructive/40">
65
+ <Card.Content class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
66
+ <div class="space-y-1">
67
+ <p class="text-sm font-medium">Delete workspace</p>
68
+ <p class="text-muted-foreground max-w-prose text-sm">
69
+ Permanently deletes <span class="font-medium">{organization.name}</span> along with every document,
70
+ uploaded file, role and invitation in it. This can't be undone.
71
+ </p>
72
+ {#if !canDelete}
73
+ <p class="text-muted-foreground text-sm">Only owners can delete a workspace.</p>
74
+ {/if}
75
+ </div>
76
+
77
+ <Button
78
+ variant="destructive"
79
+ class="shrink-0"
80
+ disabled={!canDelete}
81
+ onclick={() => (open = true)}
82
+ >
83
+ Delete workspace
84
+ </Button>
85
+ </Card.Content>
86
+ </Card.Root>
87
+
88
+ <Dialog.Root {open} {onOpenChange}>
89
+ <Dialog.Content class="sm:max-w-md">
90
+ <Dialog.Header>
91
+ <Dialog.Title>Delete {organization.name}?</Dialog.Title>
92
+ <Dialog.Description>
93
+ Every document, uploaded file, role and invitation in this workspace is erased, and
94
+ {memberCount === 1 ? 'its member is' : `all ${memberCount} members are`} removed. This is permanent.
95
+ </Dialog.Description>
96
+ </Dialog.Header>
97
+
98
+ <div class="grid gap-2 py-2">
99
+ <Label for="delete-org-confirmation">
100
+ Type <span class="font-mono font-medium">{organization.name}</span> to confirm
101
+ </Label>
102
+ <Input
103
+ id="delete-org-confirmation"
104
+ bind:value={confirmation}
105
+ autocomplete="off"
106
+ disabled={isDeleting}
107
+ />
108
+ </div>
109
+
110
+ <Dialog.Footer>
111
+ <Button variant="outline" onclick={() => onOpenChange(false)} disabled={isDeleting}>
112
+ Cancel
113
+ </Button>
114
+ <Button
115
+ variant="destructive"
116
+ onclick={deleteOrganization}
117
+ disabled={!confirmed || isDeleting}
118
+ >
119
+ {isDeleting ? 'Deleting…' : 'Delete workspace'}
120
+ </Button>
121
+ </Dialog.Footer>
122
+ </Dialog.Content>
123
+ </Dialog.Root>
@@ -0,0 +1,11 @@
1
+ import type { Organization } from '../../types/organization.js';
2
+ type Props = {
3
+ organization: Organization;
4
+ memberCount: number;
5
+ /** Only owners may delete; the server enforces this too. */
6
+ canDelete: boolean;
7
+ };
8
+ declare const DeleteOrganizationSettings: import("svelte").Component<Props, {}, "">;
9
+ type DeleteOrganizationSettings = ReturnType<typeof DeleteOrganizationSettings>;
10
+ export default DeleteOrganizationSettings;
11
+ //# sourceMappingURL=DeleteOrganizationSettings.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeleteOrganizationSettings.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/DeleteOrganizationSettings.svelte.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG5D,KAAK,KAAK,GAAG;IACZ,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AAuGH,QAAA,MAAM,0BAA0B,2CAAwC,CAAC;AACzE,KAAK,0BAA0B,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAChF,eAAe,0BAA0B,CAAC"}
@@ -9,7 +9,11 @@
9
9
  import { findOrphanedFields, type OrphanedField } from '../../schema-utils/cleanup';
10
10
  import type { SchemaType } from '../../types/schemas.js';
11
11
  import { Rule } from '../../field-validation/rule';
12
- import { validateDocumentData } from '../../field-validation/utils';
12
+ import {
13
+ humanizeValidationMessage,
14
+ validateDocumentData,
15
+ type FieldErrors
16
+ } from '../../field-validation/utils';
13
17
  import { hasUnpublishedChanges } from '../../utils/content-hash';
14
18
  import { setSchemaContext } from '../../schema-context.svelte';
15
19
  import { setSaveStateContext } from '../../save-state-context.svelte';
@@ -1461,12 +1465,11 @@
1461
1465
  'Conflict: this document was updated by someone else. Reload the page to continue editing.'
1462
1466
  };
1463
1467
  }
1464
- if (err instanceof ApiError && err.response?.validationErrors) {
1465
- const validationErrors = err.response.validationErrors;
1466
- const errorMessages = validationErrors
1467
- .map((ve: any) => `${ve.field}: ${ve.errors.join(', ')}`)
1468
- .join('; ');
1469
- return { success: false, error: `Validation failed: ${errorMessages}` };
1468
+ // The server calls this `issues`. `validationErrors` was never sent, so a
1469
+ // rejected save used to show its raw technical message.
1470
+ const issues = responseIssues(err);
1471
+ if (issues.length > 0) {
1472
+ return { success: false, error: `Couldn't save. ${describeIssues(issues).join(' ')}` };
1470
1473
  }
1471
1474
  return {
1472
1475
  success: false,
@@ -1537,8 +1540,15 @@
1537
1540
  if (saveError) return;
1538
1541
  }
1539
1542
 
1540
- // Check for validation errors before publishing (Sanity-style)
1541
- const invalid = await validateAllFields();
1543
+ // Check for validation errors before publishing (Sanity-style).
1544
+ // validateAllFields stays top-level because it drives the Publish button:
1545
+ // counting nested problems there would grey the button out with nothing on
1546
+ // screen saying why. This also runs the validator the server is about to
1547
+ // run, so a problem deep inside a block is named here instead of rejected.
1548
+ const topLevel = await validateAllFields();
1549
+ const deep = await findPublishProblems();
1550
+ const invalid: Array<{ title: string; messages: string[]; detailed?: boolean }> =
1551
+ deep.length > 0 ? deep : topLevel;
1542
1552
 
1543
1553
  if (invalid.length > 0) {
1544
1554
  // Show up to three field titles in the toast so the user doesn't
@@ -1548,11 +1558,16 @@
1548
1558
  .map((f) => f.title)
1549
1559
  .join(', ');
1550
1560
  const remainder = invalid.length > 3 ? ` and ${invalid.length - 3} more` : '';
1551
- const detail = invalid.map((f) => `${f.title}: ${f.messages.join(', ')}`).join('\n');
1561
+ const lines = invalid.flatMap((f) =>
1562
+ f.messages.map((m) => (f.detailed ? m : `${f.title}: ${m}`))
1563
+ );
1564
+ const shown = lines.slice(0, 5);
1565
+ if (lines.length > shown.length) shown.push(`And ${lines.length - shown.length} more.`);
1552
1566
 
1553
- saveError = `Cannot publish — fix: ${preview}${remainder}`;
1554
- toast.error(`Fix ${invalid.length} field${invalid.length === 1 ? '' : 's'} to publish`, {
1555
- description: detail
1567
+ saveError = `Can't publish yet. Check: ${preview}${remainder}`;
1568
+ toast.error(`Fix ${lines.length} thing${lines.length === 1 ? '' : 's'} to publish`, {
1569
+ description: shown.join('\n'),
1570
+ duration: 15000
1556
1571
  });
1557
1572
  return;
1558
1573
  }
@@ -1635,17 +1650,17 @@
1635
1650
  saveError =
1636
1651
  'Conflict: this document was updated by someone else. Reload the page to continue editing.';
1637
1652
  } else {
1638
- toast.error(err instanceof ApiError ? err.message : 'Failed to publish document');
1639
-
1640
- // Extract validation errors if present
1641
- if (err instanceof ApiError && err.response?.validationErrors) {
1642
- const validationErrors = err.response.validationErrors;
1643
- const errorMessages = validationErrors
1644
- .map((ve: any) => `${ve.field}: ${ve.errors.join(', ')}`)
1645
- .join('; ');
1646
- saveError = `Cannot publish - Validation failed: ${errorMessages}`;
1653
+ const issues = responseIssues(err);
1654
+ if (issues.length > 0) {
1655
+ const lines = describeIssues(issues);
1656
+ saveError = `Can't publish yet. ${lines.join(' ')}`;
1657
+ toast.error(`Fix ${lines.length} thing${lines.length === 1 ? '' : 's'} to publish`, {
1658
+ description: lines.slice(0, 5).join('\n'),
1659
+ duration: 15000
1660
+ });
1647
1661
  } else {
1648
1662
  saveError = err instanceof ApiError ? err.message : 'Failed to publish document';
1663
+ toast.error(saveError);
1649
1664
  }
1650
1665
  }
1651
1666
  } finally {
@@ -1736,6 +1751,61 @@
1736
1751
  }
1737
1752
  }
1738
1753
 
1754
+ type ReportedIssue = { field: string; path?: string; errors: string[] };
1755
+
1756
+ /** The `issues` a rejected save or publish carries, if the response has them. */
1757
+ function responseIssues(err: unknown): ReportedIssue[] {
1758
+ const issues: unknown = err instanceof ApiError ? err.response?.issues : undefined;
1759
+ if (!Array.isArray(issues)) return [];
1760
+ return issues.filter(
1761
+ (issue): issue is ReportedIssue =>
1762
+ typeof issue === 'object' &&
1763
+ issue !== null &&
1764
+ typeof issue.field === 'string' &&
1765
+ Array.isArray(issue.errors) &&
1766
+ issue.errors.every((message: unknown) => typeof message === 'string')
1767
+ );
1768
+ }
1769
+
1770
+ /** Field problems, in words an editor can act on. */
1771
+ function describeIssues(issues: Array<ReportedIssue | FieldErrors>): string[] {
1772
+ return issues.flatMap((issue) => {
1773
+ const field = schema?.fields.find((f) => f.name === issue.field);
1774
+ const path = 'path' in issue ? issue.path : undefined;
1775
+ return issue.errors.map((message) =>
1776
+ humanizeValidationMessage(path ? `Field "${path}" ${message}` : message, {
1777
+ field,
1778
+ fieldName: issue.field,
1779
+ value: documentData[issue.field],
1780
+ schemas,
1781
+ includeRoot: true
1782
+ })
1783
+ );
1784
+ });
1785
+ }
1786
+
1787
+ /**
1788
+ * Everything the server would refuse at publish, nested fields included.
1789
+ * Advisory: if the check itself throws, publish goes ahead and the server
1790
+ * remains the authority.
1791
+ */
1792
+ async function findPublishProblems(): Promise<
1793
+ Array<{ name: string; title: string; messages: string[]; detailed?: boolean }>
1794
+ > {
1795
+ if (!schema) return [];
1796
+ try {
1797
+ const { errors } = await validateDocumentData(schema, documentData, { schemas });
1798
+ return errors.map((issue) => ({
1799
+ name: issue.field,
1800
+ title: schema?.fields.find((f) => f.name === issue.field)?.title ?? issue.field,
1801
+ messages: describeIssues([issue]),
1802
+ detailed: true
1803
+ }));
1804
+ } catch {
1805
+ return [];
1806
+ }
1807
+ }
1808
+
1739
1809
  // Validate all fields before publishing
1740
1810
  async function validateAllFields(): Promise<
1741
1811
  Array<{ name: string; title: string; messages: string[] }>
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/DocumentEditor.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAUzD,OAAO,KAAK,EAAE,SAAS,EAAuB,MAAM,qBAAqB,CAAC;AAqCzE,UAAU,KAAK;IACd,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;kDAE8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,sBAAsB,CAAC,EAAE;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,IAAI,CAAC;IACT,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;kEAI8D;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,yGAAyG;IACzG,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;CACtB;AAqjFF,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DocumentEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/DocumentEditor.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAczD,OAAO,KAAK,EAAE,SAAS,EAAuB,MAAM,qBAAqB,CAAC;AAqCzE,UAAU,KAAK;IACd,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;kDAE8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,sBAAsB,CAAC,EAAE;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,IAAI,CAAC;IACT,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;kEAI8D;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,yGAAyG;IACzG,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;CACtB;AAwnFF,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ /**
3
+ * General organization settings view: identity panel + danger zone. Core-owned;
4
+ * the embedded `/admin/settings` catch-all SSR's the org record, member count,
5
+ * and whether the current user may delete it.
6
+ */
7
+ import * as Card from '@aphexcms/ui/shadcn/card';
8
+ import type { Organization } from '../../types/organization';
9
+ import OrganizationSettings from './OrganizationSettings.svelte';
10
+ import DeleteOrganizationSettings from './DeleteOrganizationSettings.svelte';
11
+
12
+ interface Props {
13
+ organization: Organization | null;
14
+ memberCount: number;
15
+ canDelete: boolean;
16
+ }
17
+
18
+ let { organization, memberCount, canDelete }: Props = $props();
19
+ </script>
20
+
21
+ <div class="grid gap-5">
22
+ {#if organization}
23
+ <OrganizationSettings activeOrganization={organization} {memberCount} />
24
+
25
+ <!--
26
+ Its own section, and last. A destructive action shouldn't share a visual
27
+ group with the settings above it — the heading is the pause.
28
+ -->
29
+ <section class="mt-5 grid gap-4">
30
+ <header>
31
+ <h2 class="text-base font-semibold">Danger zone</h2>
32
+ <p class="text-muted-foreground text-sm">Irreversible, and affects everyone here.</p>
33
+ </header>
34
+
35
+ <DeleteOrganizationSettings {organization} {memberCount} {canDelete} />
36
+ </section>
37
+ {:else}
38
+ <Card.Root>
39
+ <Card.Content class="py-12 text-center">
40
+ <p class="text-muted-foreground text-lg">No active organization</p>
41
+ <p class="text-muted-foreground mt-2 text-sm">You need to be added to an organization</p>
42
+ </Card.Content>
43
+ </Card.Root>
44
+ {/if}
45
+ </div>
@@ -0,0 +1,10 @@
1
+ import type { Organization } from '../../types/organization.js';
2
+ interface Props {
3
+ organization: Organization | null;
4
+ memberCount: number;
5
+ canDelete: boolean;
6
+ }
7
+ declare const GeneralSettings: import("svelte").Component<Props, {}, "">;
8
+ type GeneralSettings = ReturnType<typeof GeneralSettings>;
9
+ export default GeneralSettings;
10
+ //# sourceMappingURL=GeneralSettings.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralSettings.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/GeneralSettings.svelte.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK5D,UAAU,KAAK;IACd,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACnB;AAqCF,QAAA,MAAM,eAAe,2CAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
@@ -0,0 +1,112 @@
1
+ <script lang="ts">
2
+ import * as Card from '@aphexcms/ui/shadcn/card';
3
+ import { Label } from '@aphexcms/ui/shadcn/label';
4
+ import { Switch } from '@aphexcms/ui/shadcn/switch';
5
+ import { toast } from 'svelte-sonner';
6
+ import { instance } from '../../api/instance';
7
+ import type { AdminGodModeData } from '../../admin/view-data';
8
+ import CreateOrganization from './CreateOrganization.svelte';
9
+ import OrganizationsList from './OrganizationsList.svelte';
10
+
11
+ let { data, userEmail }: { data: AdminGodModeData; userEmail: string } = $props();
12
+
13
+ const tabs = [
14
+ { id: 'general', label: 'General', href: '/admin/god-mode' },
15
+ { id: 'organizations', label: 'Organizations', href: '/admin/god-mode/organizations' }
16
+ ];
17
+
18
+ // Seeded from the load, then owned here so a failed save can put it back.
19
+ let allowUserOrgCreation = $state(false);
20
+ let saving = $state(false);
21
+
22
+ $effect(() => {
23
+ if (data.tab === 'organizations') allowUserOrgCreation = data.allowUserOrgCreation;
24
+ });
25
+
26
+ async function toggleOrgCreation(checked: boolean) {
27
+ const previous = allowUserOrgCreation;
28
+ allowUserOrgCreation = checked;
29
+ saving = true;
30
+ try {
31
+ const result = await instance.updateSettings({ allowUserOrgCreation: checked });
32
+ if (!result.success) throw new Error(result.error ?? 'Could not save');
33
+ } catch (error) {
34
+ allowUserOrgCreation = previous;
35
+ toast.error(error instanceof Error ? error.message : 'Could not save');
36
+ } finally {
37
+ saving = false;
38
+ }
39
+ }
40
+ </script>
41
+
42
+ <svelte:head>
43
+ <title>God Mode</title>
44
+ </svelte:head>
45
+
46
+ <div class="flex-1 overflow-auto p-4 md:p-8">
47
+ <div class="mx-auto w-full max-w-6xl space-y-6">
48
+ <div>
49
+ <h1 class="text-3xl font-semibold">God Mode</h1>
50
+ <p class="text-muted-foreground">Instance administration</p>
51
+ </div>
52
+
53
+ <nav class="border-b">
54
+ <div class="flex gap-4">
55
+ {#each tabs as tab (tab.id)}
56
+ <a
57
+ href={tab.href}
58
+ class="border-b-2 px-1 pb-2 text-sm font-medium transition-colors {data.tab === tab.id
59
+ ? 'border-primary text-primary'
60
+ : 'text-muted-foreground hover:text-foreground border-transparent'}"
61
+ >
62
+ {tab.label}
63
+ </a>
64
+ {/each}
65
+ </div>
66
+ </nav>
67
+
68
+ {#if data.tab === 'general'}
69
+ <Card.Root>
70
+ <Card.Header>
71
+ <Card.Title>Instance information</Card.Title>
72
+ <Card.Description>Details about this Aphex instance</Card.Description>
73
+ </Card.Header>
74
+ <Card.Content>
75
+ <div class="flex items-center justify-between">
76
+ <span class="text-muted-foreground text-sm">Admin</span>
77
+ <span class="text-sm font-medium">{userEmail}</span>
78
+ </div>
79
+ </Card.Content>
80
+ </Card.Root>
81
+ {:else}
82
+ <div>
83
+ <div class="mb-4 flex items-center justify-between">
84
+ <h2 class="text-lg font-medium">
85
+ In this instance
86
+ <span class="text-muted-foreground ml-1">· {data.organizations.length}</span>
87
+ </h2>
88
+ <CreateOrganization />
89
+ </div>
90
+ <OrganizationsList orgs={data.organizations} />
91
+ </div>
92
+
93
+ <div class="flex items-center justify-between rounded-lg border p-4">
94
+ <div class="space-y-0.5">
95
+ <Label for="prevent-org-creation" class="text-base font-medium">
96
+ Prevent anyone else from creating an organization.
97
+ </Label>
98
+ <p class="text-muted-foreground text-sm">
99
+ Toggling this on will let only you create organizations. You will have to invite users
100
+ to new organizations.
101
+ </p>
102
+ </div>
103
+ <Switch
104
+ id="prevent-org-creation"
105
+ checked={!allowUserOrgCreation}
106
+ onCheckedChange={(checked) => toggleOrgCreation(!checked)}
107
+ disabled={saving}
108
+ />
109
+ </div>
110
+ {/if}
111
+ </div>
112
+ </div>
@@ -0,0 +1,9 @@
1
+ import type { AdminGodModeData } from '../../admin/view-data.js';
2
+ type $$ComponentProps = {
3
+ data: AdminGodModeData;
4
+ userEmail: string;
5
+ };
6
+ declare const GodModeView: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type GodModeView = ReturnType<typeof GodModeView>;
8
+ export default GodModeView;
9
+ //# sourceMappingURL=GodModeView.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GodModeView.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/GodModeView.svelte.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI7D,KAAK,gBAAgB,GAAI;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AA4GxE,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}