@studiocubics/cms 0.0.1 → 0.0.2

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 (244) hide show
  1. package/dist/clerk/actions/invitations.d.ts +6 -0
  2. package/dist/clerk/actions/invitations.js +59 -0
  3. package/dist/clerk/actions/invitations.js.map +1 -0
  4. package/dist/clerk/actions/systemUsers.d.ts +8 -0
  5. package/dist/clerk/actions/systemUsers.js +64 -0
  6. package/dist/clerk/actions/systemUsers.js.map +1 -0
  7. package/dist/clerk/auth.d.ts +8 -0
  8. package/dist/clerk/auth.js +21 -0
  9. package/dist/clerk/auth.js.map +1 -0
  10. package/dist/clerk/hasPermission.d.ts +33 -0
  11. package/dist/clerk/hasPermission.js +78 -0
  12. package/dist/clerk/hasPermission.js.map +1 -0
  13. package/dist/clerk/rbacConfig.d.ts +31 -0
  14. package/dist/clerk/rbacConfig.js +48 -0
  15. package/dist/clerk/rbacConfig.js.map +1 -0
  16. package/dist/clerk/schemas/invitation.d.ts +12 -0
  17. package/dist/clerk/schemas/invitation.js +20 -0
  18. package/dist/clerk/schemas/invitation.js.map +1 -0
  19. package/dist/clerk/schemas/systemUser.d.ts +6 -0
  20. package/dist/clerk/toClientSafeUser.d.ts +48 -0
  21. package/dist/clerk/toClientSafeUser.js +46 -0
  22. package/dist/clerk/toClientSafeUser.js.map +1 -0
  23. package/dist/constants/defaults.d.ts +6 -0
  24. package/dist/constants/defaults.js +56 -0
  25. package/dist/constants/defaults.js.map +1 -0
  26. package/dist/constants/pageLimits.d.ts +2 -0
  27. package/dist/constants/pageLimits.js +5 -0
  28. package/dist/constants/pageLimits.js.map +1 -0
  29. package/dist/index.css +215 -0
  30. package/dist/index.js +45 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/providers/CMSRootProviders.d.ts +4 -0
  33. package/dist/providers/CMSRootProviders.js +11 -0
  34. package/dist/providers/CMSRootProviders.js.map +1 -0
  35. package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.d.ts +2 -0
  36. package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.js +13 -0
  37. package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.js.map +1 -0
  38. package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css.js +4 -0
  39. package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css.js.map +1 -0
  40. package/dist/ui/Layout/CMSSecurityLayout.d.ts +2 -0
  41. package/dist/ui/Layout/CMSSecurityLayout.js +18 -0
  42. package/dist/ui/Layout/CMSSecurityLayout.js.map +1 -0
  43. package/dist/ui/Layout/CMSSidebar/CMSSidebar.d.ts +6 -0
  44. package/dist/ui/Layout/CMSSidebar/CMSSidebar.js +15 -0
  45. package/dist/ui/Layout/CMSSidebar/CMSSidebar.js.map +1 -0
  46. package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.d.ts +4 -0
  47. package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.js +18 -0
  48. package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.js.map +1 -0
  49. package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.d.ts +1 -0
  50. package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.js +39 -0
  51. package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.js.map +1 -0
  52. package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css.js +4 -0
  53. package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css.js.map +1 -0
  54. package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.d.ts +1 -0
  55. package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.js +16 -0
  56. package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.js.map +1 -0
  57. package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css.js +4 -0
  58. package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css.js.map +1 -0
  59. package/dist/ui/Layout/_index.d.ts +2 -0
  60. package/dist/ui/System/Auth/SignIn/SignIn.d.ts +1 -0
  61. package/dist/ui/System/Auth/SignIn/SignIn.js +28 -0
  62. package/dist/ui/System/Auth/SignIn/SignIn.js.map +1 -0
  63. package/dist/ui/System/Auth/SignIn/SignIn.module.css.js +4 -0
  64. package/dist/ui/System/Auth/SignIn/SignIn.module.css.js.map +1 -0
  65. package/dist/ui/System/Auth/SignIn/useSignInForm.d.ts +14 -0
  66. package/dist/ui/System/Auth/SignIn/useSignInForm.js +46 -0
  67. package/dist/ui/System/Auth/SignIn/useSignInForm.js.map +1 -0
  68. package/dist/ui/System/Auth/SignUp/SignUp.d.ts +1 -0
  69. package/dist/ui/System/Auth/SignUp/SignUp.js +36 -0
  70. package/dist/ui/System/Auth/SignUp/SignUp.js.map +1 -0
  71. package/dist/ui/System/Auth/SignUp/SignUp.module.css.js +4 -0
  72. package/dist/ui/System/Auth/SignUp/SignUp.module.css.js.map +1 -0
  73. package/dist/ui/System/Auth/SignUp/useSignUpForm.d.ts +19 -0
  74. package/dist/ui/System/Auth/SignUp/useSignUpForm.js +58 -0
  75. package/dist/ui/System/Auth/SignUp/useSignUpForm.js.map +1 -0
  76. package/dist/ui/System/Invitations/InvitationList.d.ts +1 -0
  77. package/dist/ui/System/Invitations/InvitationList.js +11 -0
  78. package/dist/ui/System/Invitations/InvitationList.js.map +1 -0
  79. package/dist/ui/System/Invitations/InvitationListActions.d.ts +11 -0
  80. package/dist/ui/System/Invitations/InvitationListActions.js +39 -0
  81. package/dist/ui/System/Invitations/InvitationListActions.js.map +1 -0
  82. package/dist/ui/System/Invitations/InvitationListCard.d.ts +4 -0
  83. package/dist/ui/System/Invitations/InvitationListCard.js +16 -0
  84. package/dist/ui/System/Invitations/InvitationListCard.js.map +1 -0
  85. package/dist/ui/System/Invitations/InvitationListPage.d.ts +2 -0
  86. package/dist/ui/System/Invitations/InvitationListPage.js +22 -0
  87. package/dist/ui/System/Invitations/InvitationListPage.js.map +1 -0
  88. package/dist/ui/System/Invitations/InvitationListPagination.d.ts +4 -0
  89. package/dist/ui/System/Invitations/InvitationListPagination.js +11 -0
  90. package/dist/ui/System/Invitations/InvitationListPagination.js.map +1 -0
  91. package/dist/ui/System/Permissions/RoleListCard.d.ts +6 -0
  92. package/dist/ui/System/Permissions/RoleListCard.js +11 -0
  93. package/dist/ui/System/Permissions/RoleListCard.js.map +1 -0
  94. package/dist/ui/System/Permissions/RolePermissionsPage.d.ts +4 -0
  95. package/dist/ui/System/Permissions/RolePermissionsPage.js +14 -0
  96. package/dist/ui/System/Permissions/RolePermissionsPage.js.map +1 -0
  97. package/dist/ui/System/Permissions/RolePermissionsTable.d.ts +2 -0
  98. package/dist/ui/System/Permissions/RolePermissionsTable.js +28 -0
  99. package/dist/ui/System/Permissions/RolePermissionsTable.js.map +1 -0
  100. package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.d.ts +5 -0
  101. package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.js +31 -0
  102. package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.js.map +1 -0
  103. package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css.js +4 -0
  104. package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css.js.map +1 -0
  105. package/dist/ui/System/SystemUser/CurrentSystemUserPage.d.ts +1 -0
  106. package/dist/ui/System/SystemUser/CurrentSystemUserPage.js +17 -0
  107. package/dist/ui/System/SystemUser/CurrentSystemUserPage.js.map +1 -0
  108. package/dist/ui/System/SystemUser/SystemUserActions.d.ts +6 -0
  109. package/dist/ui/System/SystemUser/SystemUserActions.js +14 -0
  110. package/dist/ui/System/SystemUser/SystemUserActions.js.map +1 -0
  111. package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.d.ts +12 -0
  112. package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.js +16 -0
  113. package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.js.map +1 -0
  114. package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css.js +4 -0
  115. package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css.js.map +1 -0
  116. package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.d.ts +11 -0
  117. package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.js +26 -0
  118. package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.js.map +1 -0
  119. package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css.js +4 -0
  120. package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css.js.map +1 -0
  121. package/dist/ui/System/SystemUser/SystemUserList.d.ts +1 -0
  122. package/dist/ui/System/SystemUser/SystemUserList.js +11 -0
  123. package/dist/ui/System/SystemUser/SystemUserList.js.map +1 -0
  124. package/dist/ui/System/SystemUser/SystemUserListActions.d.ts +1 -0
  125. package/dist/ui/System/SystemUser/SystemUserListActions.js +11 -0
  126. package/dist/ui/System/SystemUser/SystemUserListActions.js.map +1 -0
  127. package/dist/ui/System/SystemUser/SystemUserListCard.d.ts +11 -0
  128. package/dist/ui/System/SystemUser/SystemUserListCard.js +34 -0
  129. package/dist/ui/System/SystemUser/SystemUserListCard.js.map +1 -0
  130. package/dist/ui/System/SystemUser/SystemUserListPage.d.ts +2 -0
  131. package/dist/ui/System/SystemUser/SystemUserListPage.js +24 -0
  132. package/dist/ui/System/SystemUser/SystemUserListPage.js.map +1 -0
  133. package/dist/ui/System/SystemUser/SystemUserListPagination.d.ts +4 -0
  134. package/dist/ui/System/SystemUser/SystemUserListPagination.js +11 -0
  135. package/dist/ui/System/SystemUser/SystemUserListPagination.js.map +1 -0
  136. package/dist/ui/System/SystemUser/SystemUserPage.d.ts +1 -0
  137. package/dist/ui/System/SystemUser/SystemUserPage.js +17 -0
  138. package/dist/ui/System/SystemUser/SystemUserPage.js.map +1 -0
  139. package/dist/ui/System/SystemUser/SystemUserPageContent.d.ts +5 -0
  140. package/dist/ui/System/SystemUser/SystemUserPageContent.js +13 -0
  141. package/dist/ui/System/SystemUser/SystemUserPageContent.js.map +1 -0
  142. package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.d.ts +6 -0
  143. package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.js +21 -0
  144. package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.js.map +1 -0
  145. package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css.js +4 -0
  146. package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css.js.map +1 -0
  147. package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.d.ts +9 -0
  148. package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.js +19 -0
  149. package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.js.map +1 -0
  150. package/dist/ui/System/SystemUser/SystemUserTimestamps.d.ts +9 -0
  151. package/dist/ui/System/SystemUser/SystemUserTimestamps.js +27 -0
  152. package/dist/ui/System/SystemUser/SystemUserTimestamps.js.map +1 -0
  153. package/dist/ui/System/WelcomePage/WelcomePage.d.ts +1 -0
  154. package/dist/ui/System/WelcomePage/WelcomePage.js +16 -0
  155. package/dist/ui/System/WelcomePage/WelcomePage.js.map +1 -0
  156. package/dist/ui/System/WelcomePage/WelcomePage.module.css.js +4 -0
  157. package/dist/ui/System/WelcomePage/WelcomePage.module.css.js.map +1 -0
  158. package/{src/ui/System/types.ts → dist/ui/System/types.d.ts} +3 -5
  159. package/dist/utils/proxyFunctions.d.ts +4 -0
  160. package/dist/utils/proxyFunctions.js +34 -0
  161. package/dist/utils/proxyFunctions.js.map +1 -0
  162. package/package.json +14 -14
  163. package/rollup.config.js +1 -1
  164. package/.turbo/turbo-build.log +0 -7
  165. package/CHANGELOG.md +0 -12
  166. package/eslint.config.js +0 -21
  167. package/src/clerk/actions/invitations.ts +0 -78
  168. package/src/clerk/actions/systemUsers.ts +0 -94
  169. package/src/clerk/auth.ts +0 -34
  170. package/src/clerk/clerk.d.ts +0 -105
  171. package/src/clerk/hasPermission.ts +0 -96
  172. package/src/clerk/rbacConfig.ts +0 -68
  173. package/src/clerk/schemas/invitation.ts +0 -17
  174. package/src/clerk/schemas/systemUser.ts +0 -16
  175. package/src/clerk/toClientSafeUser.ts +0 -77
  176. package/src/constants/defaults.tsx +0 -62
  177. package/src/constants/pageLimits.ts +0 -2
  178. package/src/declaration.d.ts +0 -5
  179. package/src/providers/CMSRootProviders.tsx +0 -13
  180. package/src/routes.d.ts +0 -96
  181. package/src/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css +0 -4
  182. package/src/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.tsx +0 -16
  183. package/src/ui/Layout/CMSSecurityLayout.tsx +0 -27
  184. package/src/ui/Layout/CMSSidebar/CMSSidebar.tsx +0 -39
  185. package/src/ui/Layout/CMSSidebar/CMSSidebarBody.tsx +0 -43
  186. package/src/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css +0 -7
  187. package/src/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.tsx +0 -59
  188. package/src/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css +0 -44
  189. package/src/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.tsx +0 -30
  190. package/src/ui/Layout/_index.ts +0 -2
  191. package/src/ui/System/Auth/SignIn/SignIn.module.css +0 -50
  192. package/src/ui/System/Auth/SignIn/SignIn.tsx +0 -79
  193. package/src/ui/System/Auth/SignIn/useSignInForm.tsx +0 -42
  194. package/src/ui/System/Auth/SignUp/SignUp.module.css +0 -48
  195. package/src/ui/System/Auth/SignUp/SignUp.tsx +0 -138
  196. package/src/ui/System/Auth/SignUp/useSignUpForm.tsx +0 -54
  197. package/src/ui/System/Invitations/InvitationList.tsx +0 -9
  198. package/src/ui/System/Invitations/InvitationListActions.tsx +0 -167
  199. package/src/ui/System/Invitations/InvitationListCard.tsx +0 -79
  200. package/src/ui/System/Invitations/InvitationListPage.tsx +0 -32
  201. package/src/ui/System/Invitations/InvitationListPagination.tsx +0 -19
  202. package/src/ui/System/Permissions/RoleListCard.tsx +0 -33
  203. package/src/ui/System/Permissions/RolePermissionsPage.tsx +0 -18
  204. package/src/ui/System/Permissions/RolePermissionsTable.tsx +0 -36
  205. package/src/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css +0 -5
  206. package/src/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.tsx +0 -102
  207. package/src/ui/System/SystemUser/CurrentSystemUserPage.tsx +0 -12
  208. package/src/ui/System/SystemUser/SystemUserActions.tsx +0 -45
  209. package/src/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css +0 -6
  210. package/src/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.tsx +0 -71
  211. package/src/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css +0 -7
  212. package/src/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.tsx +0 -114
  213. package/src/ui/System/SystemUser/SystemUserList.tsx +0 -18
  214. package/src/ui/System/SystemUser/SystemUserListActions.tsx +0 -17
  215. package/src/ui/System/SystemUser/SystemUserListCard.tsx +0 -85
  216. package/src/ui/System/SystemUser/SystemUserListPage.tsx +0 -33
  217. package/src/ui/System/SystemUser/SystemUserListPagination.tsx +0 -19
  218. package/src/ui/System/SystemUser/SystemUserPage.tsx +0 -30
  219. package/src/ui/System/SystemUser/SystemUserPageContent.tsx +0 -54
  220. package/src/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css +0 -17
  221. package/src/ui/System/SystemUser/SystemUserRole/SystemUserRole.tsx +0 -64
  222. package/src/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.tsx +0 -51
  223. package/src/ui/System/SystemUser/SystemUserTimestamps.tsx +0 -56
  224. package/src/ui/System/WelcomePage/WelcomePage.module.css +0 -18
  225. package/src/ui/System/WelcomePage/WelcomePage.tsx +0 -43
  226. package/src/utils/proxyFunctions.ts +0 -37
  227. package/tsconfig.json +0 -32
  228. /package/{src/clerk/_index.ts → dist/clerk/_index.d.ts} +0 -0
  229. /package/{src/clerk/actions/_index.ts → dist/clerk/actions/_index.d.ts} +0 -0
  230. /package/{src/clerk/schemas/_index.ts → dist/clerk/schemas/_index.d.ts} +0 -0
  231. /package/{src/constants/_index.ts → dist/constants/_index.d.ts} +0 -0
  232. /package/{src/index.ts → dist/index.d.ts} +0 -0
  233. /package/{src/providers/_index.ts → dist/providers/_index.d.ts} +0 -0
  234. /package/{src/ui/Inputs/_index.ts → dist/ui/Inputs/_index.d.ts} +0 -0
  235. /package/{src/ui/Layout/CMSSidebar/_index.ts → dist/ui/Layout/CMSSidebar/_index.d.ts} +0 -0
  236. /package/{src/ui/System/Auth/SignIn/_index.ts → dist/ui/System/Auth/SignIn/_index.d.ts} +0 -0
  237. /package/{src/ui/System/Auth/SignUp/_index.ts → dist/ui/System/Auth/SignUp/_index.d.ts} +0 -0
  238. /package/{src/ui/System/Auth/_index.ts → dist/ui/System/Auth/_index.d.ts} +0 -0
  239. /package/{src/ui/System/Invitations/_index.ts → dist/ui/System/Invitations/_index.d.ts} +0 -0
  240. /package/{src/ui/System/Permissions/_index.ts → dist/ui/System/Permissions/_index.d.ts} +0 -0
  241. /package/{src/ui/System/SystemUser/_index.ts → dist/ui/System/SystemUser/_index.d.ts} +0 -0
  242. /package/{src/ui/System/_index.ts → dist/ui/System/_index.d.ts} +0 -0
  243. /package/{src/ui/_index.ts → dist/ui/_index.d.ts} +0 -0
  244. /package/{src/utils/_index.ts → dist/utils/_index.d.ts} +0 -0
@@ -1,167 +0,0 @@
1
- "use client";
2
-
3
- import { useDisclosure } from "@studiocubics/hooks";
4
- import {
5
- Button,
6
- Dialog,
7
- Switch,
8
- TextInput,
9
- ConfirmationForm,
10
- Select,
11
- } from "@studiocubics/ui";
12
- import { Ban, Eye, EyeClosed, UserPlus } from "lucide-react";
13
- import Link from "next/link";
14
- import type { Invitation } from "@clerk/nextjs/server";
15
- import { initialiseForm, toCapitalised } from "@studiocubics/utils";
16
- import { useActionState, useEffect } from "react";
17
- import {
18
- invitationDeleteAction,
19
- invitationCreateAction,
20
- } from "../../../clerk/actions/invitations";
21
- import { roles } from "../../../clerk/rbacConfig";
22
-
23
- export function InvitationListActions({
24
- status,
25
- }: {
26
- status: ClerkInvitationListParams["status"];
27
- }) {
28
- const isShowRevoked = status == "revoked";
29
- return (
30
- <>
31
- <Link href={`?status=${!isShowRevoked ? "revoked" : ""}`}>
32
- <Button
33
- startIcon={isShowRevoked ? <Eye /> : <EyeClosed />}
34
- size="sm"
35
- color={isShowRevoked ? "primary" : undefined}
36
- >
37
- {isShowRevoked ? "Hide" : "Show"} Revoked
38
- </Button>
39
- </Link>
40
- <InvitationCreateDialog />
41
- </>
42
- );
43
- }
44
- export function InvitationRevokeDialog({ id }: { id: Invitation["id"] }) {
45
- const { open, handleOpen, handleStrictClose, handleClose } = useDisclosure();
46
- const [state, action, pending] = useActionState(
47
- invitationDeleteAction.bind(null, id),
48
- initialiseForm(),
49
- );
50
- useEffect(() => {
51
- if (state.success) {
52
- handleClose();
53
- }
54
- }, [state]);
55
- return (
56
- <>
57
- <Button
58
- color="error"
59
- type="submit"
60
- startIcon={<Ban />}
61
- onClick={handleOpen}
62
- disabled={pending}
63
- >
64
- Revoke Invitation
65
- </Button>
66
- <Dialog open={open} onClose={handleStrictClose}>
67
- <ConfirmationForm
68
- variant="danger"
69
- onCancel={handleClose}
70
- action={action}
71
- formTitle="Revoke Invitation"
72
- confirmText="Revoke"
73
- disabled={pending}
74
- >
75
- Are you sure you want to revoke this invitation?
76
- </ConfirmationForm>
77
- </Dialog>
78
- </>
79
- );
80
- }
81
- const initialInvitationCreateState = initialiseForm(
82
- "emailAddress",
83
- "expiresInDays",
84
- "role",
85
- );
86
- export type InvitationCreateState = typeof initialInvitationCreateState;
87
- export function InvitationCreateDialog() {
88
- const { open, handleOpen, handleStrictClose, handleClose } = useDisclosure();
89
- const [state, action, pending] = useActionState<
90
- InvitationCreateState,
91
- FormData
92
- >(invitationCreateAction, initialInvitationCreateState);
93
- useEffect(() => {
94
- if (state.success) {
95
- handleClose();
96
- }
97
- }, [state]);
98
- return (
99
- <>
100
- <Button
101
- size="sm"
102
- startIcon={<UserPlus />}
103
- variant="contained"
104
- onClick={handleOpen}
105
- >
106
- Invite New
107
- </Button>
108
- <Dialog open={open} onClose={handleStrictClose}>
109
- <ConfirmationForm
110
- onCancel={handleClose}
111
- action={action}
112
- formTitle="Invite New"
113
- disabled={pending}
114
- >
115
- <TextInput
116
- required
117
- type="email"
118
- name="emailAddress"
119
- label="Email Address"
120
- disabled={pending}
121
- error={state.fieldErrors?.emailAddress}
122
- />
123
- <TextInput
124
- type="number"
125
- name="expiresInDays"
126
- label="Expires in Days"
127
- endIcon={<strong>Days&nbsp;&nbsp;</strong>}
128
- defaultValue={30}
129
- disabled={pending}
130
- error={state.fieldErrors?.expiresInDays}
131
- />
132
- <Switch
133
- name="ignoreExisting"
134
- label="Ignore Existing Invites"
135
- disabled={pending}
136
- />
137
- <Switch
138
- name="notify"
139
- value={true}
140
- label="Notify with email"
141
- disabled={pending}
142
- />
143
- <Select
144
- name="role"
145
- label="Select Role to assign user on sign up"
146
- disabled={pending}
147
- error={state.fieldErrors?.role}
148
- >
149
- {roles.map((r) => (
150
- <option key={r} value={r}>
151
- {toCapitalised(r)}
152
- </option>
153
- ))}
154
- </Select>
155
- </ConfirmationForm>
156
- </Dialog>
157
- </>
158
- );
159
- }
160
-
161
- // emailAddress: string;
162
- // expiresInDays?: number;
163
- // ignoreExisting?: boolean;
164
- // notify?: boolean;
165
- // publicMetadata?: UserPublicMetadata;
166
- // redirectUrl?: string;
167
- // templateSlug?: "invitation" | "waitlist_invitation";
@@ -1,79 +0,0 @@
1
- import type { Invitation } from "@clerk/nextjs/server";
2
- import {
3
- AccordionItem,
4
- Chip,
5
- CollectionItemCard,
6
- CopyableText,
7
- LabeledValue,
8
- SectionWrapper,
9
- Tooltip,
10
- } from "@studiocubics/ui";
11
- import { formatDate, relativeTime, toCapitalised } from "@studiocubics/utils";
12
- import { InvitationRevokeDialog } from "./InvitationListActions";
13
- import { ThemedMonacoEditor } from "../../Inputs/ThemedMonacoEditor/ThemedMonacoEditor";
14
-
15
- export function InvitationListCard({ invitation }: { invitation: Invitation }) {
16
- return (
17
- <AccordionItem
18
- summary={
19
- <CollectionItemCard
20
- id={invitation.id}
21
- title={invitation.emailAddress}
22
- subtitle={
23
- <>
24
- Invited&thinsp;
25
- <Tooltip>
26
- <span>{relativeTime(invitation.createdAt)}</span>
27
- </Tooltip>
28
- </>
29
- }
30
- chip={toCapitalised(invitation.status)}
31
- description={<span></span>}
32
- />
33
- }
34
- name="InvitationListCard"
35
- >
36
- <SectionWrapper title={"Basic Details"} noBorders>
37
- <LabeledValue label={"Id"}>{invitation.id}</LabeledValue>
38
- <LabeledValue label={"Email Address"}>
39
- {invitation.emailAddress}
40
- </LabeledValue>
41
- <LabeledValue label={"Status"}>
42
- <Chip
43
- color={
44
- invitation.status == "accepted"
45
- ? "primary"
46
- : invitation.status == "pending"
47
- ? "secondary"
48
- : "error"
49
- }
50
- >
51
- <strong>{toCapitalised(invitation.status)}</strong>
52
- </Chip>
53
- </LabeledValue>
54
- </SectionWrapper>
55
- <SectionWrapper title={"Timestamps"}>
56
- <LabeledValue label={"Created At"}>
57
- {formatDate(invitation.createdAt)}
58
- </LabeledValue>
59
- <LabeledValue label={"Updated At"}>
60
- {formatDate(invitation.updatedAt)}
61
- </LabeledValue>
62
- </SectionWrapper>
63
- <SectionWrapper title={"Invite Link"}>
64
- <CopyableText>{invitation.url ?? "No link found!"}</CopyableText>
65
- </SectionWrapper>
66
- <SectionWrapper title={"Public Metadata"}>
67
- <ThemedMonacoEditor
68
- options={{ readOnly: true }}
69
- height="10vh"
70
- defaultLanguage="json"
71
- defaultValue={JSON.stringify(invitation.publicMetadata)}
72
- />
73
- </SectionWrapper>
74
- {invitation.status == "pending" && (
75
- <InvitationRevokeDialog id={invitation.id} />
76
- )}
77
- </AccordionItem>
78
- );
79
- }
@@ -1,32 +0,0 @@
1
- import { INVITATIONS_PAGE_LIMIT as limit } from "../../../constants/pageLimits";
2
- import { PageLayoutPagination } from "@studiocubics/ui";
3
- import { InvitationListPagination } from "./InvitationListPagination";
4
- import { InvitationList } from "./InvitationList";
5
- import type { SecurityPageProps } from "../types";
6
- import { InvitationListActions } from "./InvitationListActions";
7
-
8
- export async function InvitationListPage({
9
- searchParams,
10
- securityLinks,
11
- }: SecurityPageProps) {
12
- const sp = await searchParams;
13
- const status = sp.status as ClerkInvitationListParams["status"];
14
- const page = Number(sp.page ?? 1);
15
- const offset = (page - 1) * limit;
16
- const params = {
17
- limit,
18
- offset,
19
- status,
20
- };
21
-
22
- return (
23
- <PageLayoutPagination
24
- size="sm"
25
- title={securityLinks[3]?.children}
26
- actions={<InvitationListActions status={status} />}
27
- paginationComponent={<InvitationListPagination page={page} {...params} />}
28
- >
29
- <InvitationList {...params} />
30
- </PageLayoutPagination>
31
- );
32
- }
@@ -1,19 +0,0 @@
1
- import { NextSSRPagination } from "@studiocubics/next";
2
- import { invitationListReadAction } from "../../../clerk/actions/invitations";
3
-
4
- export async function InvitationListPagination({
5
- page,
6
- ...params
7
- }: {
8
- page: number;
9
- limit: number;
10
- } & ClerkInvitationListParams) {
11
- const invitationList = await invitationListReadAction(params);
12
- return (
13
- <NextSSRPagination
14
- page={page}
15
- limit={params.limit}
16
- total={invitationList.totalCount}
17
- />
18
- );
19
- }
@@ -1,33 +0,0 @@
1
- import {
2
- AccordionItem,
3
- CollectionItemCard,
4
- SectionWrapper,
5
- } from "@studiocubics/ui";
6
- import { RolePermissionsTable } from "./RolePermissionsTable";
7
- import type { Role, RoleDoc } from "../../../clerk/rbacConfig";
8
-
9
- export interface RoleCardProps {
10
- role: Role;
11
- rbacConfig: RoleDoc;
12
- }
13
-
14
- export function RoleListCard(props: RoleCardProps) {
15
- const { role, rbacConfig } = props;
16
-
17
- return (
18
- <AccordionItem
19
- name="RoleCard"
20
- summary={
21
- <CollectionItemCard
22
- title={role}
23
- chip={rbacConfig.isSystem ? "System User" : ""}
24
- description={rbacConfig.desc}
25
- />
26
- }
27
- >
28
- <SectionWrapper title={`${role}'s Permissions`} noBorders>
29
- <RolePermissionsTable {...props} />
30
- </SectionWrapper>
31
- </AccordionItem>
32
- );
33
- }
@@ -1,18 +0,0 @@
1
- import { PageLayoutPagination, type TabProps } from "@studiocubics/ui";
2
- import { RoleListCard } from "./RoleListCard";
3
- import { RBAC_CONFIG } from "../../../clerk/rbacConfig";
4
-
5
- export function RolePermissionsPage({
6
- securityLinks,
7
- }: {
8
- securityLinks: TabProps[];
9
- }) {
10
- return (
11
- <PageLayoutPagination size="sm" title={securityLinks[1]?.children}>
12
- {(Object.keys(RBAC_CONFIG) as (keyof typeof RBAC_CONFIG)[]).map((k) => {
13
- const item = RBAC_CONFIG[k];
14
- return <RoleListCard key={k} role={k} rbacConfig={item} />;
15
- })}
16
- </PageLayoutPagination>
17
- );
18
- }
@@ -1,36 +0,0 @@
1
- "use client";
2
-
3
- import { Check, X } from "lucide-react";
4
- import type { RoleCardProps } from "./RoleListCard";
5
- import { useCallback, useMemo } from "react";
6
- import { Table, type TableData } from "@studiocubics/ui";
7
-
8
- export function RolePermissionsTable({ rbacConfig }: RoleCardProps) {
9
- const permissions = rbacConfig.permissions;
10
- const icon = useCallback((check?: boolean) => {
11
- return check ? <Check /> : <X />;
12
- }, []);
13
- const tableData: TableData = useMemo(
14
- () => [
15
- ["", "create", "delete", "read", "update"],
16
- ...permissions.map((p) => [
17
- p.resource,
18
- icon(p.actions.create),
19
- icon(p.actions.delete),
20
- icon(p.actions.read),
21
- icon(p.actions.update),
22
- ]),
23
- ],
24
- [permissions],
25
- );
26
-
27
- if (!permissions || !permissions.length)
28
- return (
29
- <p>
30
- This is a root system user role, all resource actions are permitted to
31
- anyone with this role. Make sure to always have atleast one admin user.
32
- </p>
33
- );
34
-
35
- return <Table data={tableData} />;
36
- }
@@ -1,5 +0,0 @@
1
- .title {
2
- display: flex;
3
- align-items: center;
4
- gap: var(--spacing-gap);
5
- }
@@ -1,102 +0,0 @@
1
- "use client";
2
-
3
- import { useClerk, useUser } from "@clerk/nextjs";
4
- import { useAnchorElement, useDisclosure } from "@studiocubics/hooks";
5
- import {
6
- Chip,
7
- ConfirmationForm,
8
- Dialog,
9
- IdentityDisplay,
10
- type IdentityDisplayProps,
11
- List,
12
- ListItem,
13
- Popover,
14
- Skeleton,
15
- } from "@studiocubics/ui";
16
- import { toCapitalised } from "@studiocubics/utils";
17
- import { LogOut, UserCog } from "lucide-react";
18
- import type { SubmitEvent } from "react";
19
- import styles from "./CurrentSystemUserButton.module.css";
20
- import type { Role } from "../../../../clerk/rbacConfig";
21
-
22
- export function CurrentSystemUserButton(
23
- props: { clickable?: boolean } & Omit<IdentityDisplayProps, "profileName">,
24
- ) {
25
- const user = useUser();
26
-
27
- const { clickable = true, ...rest } = props;
28
- const { open, anchorEl, handleClick, handleClose } = useAnchorElement();
29
-
30
- if (!user.isLoaded) return <Skeleton height={78} />;
31
-
32
- return (
33
- <>
34
- <IdentityDisplay
35
- onClick={clickable ? handleClick : undefined}
36
- profileImage={user.user?.imageUrl ?? ""}
37
- role={user.user?.primaryEmailAddress?.emailAddress}
38
- {...rest}
39
- profileName={
40
- <div className={styles.title}>
41
- <h4>{user.user?.fullName}</h4>{" "}
42
- <Chip size="sm" color="primary">
43
- <strong>
44
- {toCapitalised(user.user?.publicMetadata.role as Role)}
45
- </strong>
46
- </Chip>
47
- </div>
48
- }
49
- />
50
- {clickable && (
51
- <Popover
52
- anchorEl={anchorEl}
53
- open={open}
54
- onClose={handleClose}
55
- anchorPosition={{ vertical: "top", horizontal: "right" }}
56
- transformOrigin={{ vertical: "bottom", horizontal: "left" }}
57
- >
58
- <List className="surfaceContainer">
59
- <ListItem
60
- startIcon={<UserCog />}
61
- href="/dashboard/security/account"
62
- >
63
- Account Settings
64
- </ListItem>
65
- <Logout />
66
- </List>
67
- </Popover>
68
- )}
69
- </>
70
- );
71
- }
72
- export function Logout() {
73
- const { open, handleClose, handleStrictClose, handleOpen } = useDisclosure();
74
- const clerk = useClerk();
75
- async function handleSubmit(e: SubmitEvent<HTMLFormElement>) {
76
- e.preventDefault();
77
- await clerk.signOut();
78
- }
79
- return (
80
- <>
81
- <ListItem
82
- className={styles.logoutButton}
83
- onClick={handleOpen}
84
- // disabled
85
- startIcon={<LogOut />}
86
- color="error"
87
- >
88
- Log out
89
- </ListItem>
90
- <Dialog open={open} onClose={handleStrictClose}>
91
- <ConfirmationForm
92
- variant="danger"
93
- formTitle="Logout"
94
- onCancel={handleClose}
95
- onSubmit={handleSubmit}
96
- >
97
- Are you sure you want to sign out of this account?
98
- </ConfirmationForm>
99
- </Dialog>
100
- </>
101
- );
102
- }
@@ -1,12 +0,0 @@
1
- import { currentUser } from "@clerk/nextjs/server";
2
- import { redirect } from "next/navigation";
3
- import { SystemUserPageContent } from "./SystemUserPageContent";
4
- import { auth } from "../../../clerk/auth";
5
-
6
- export async function CurrentSystemUserPage() {
7
- const user = await currentUser();
8
- const session = await auth();
9
- const allowEdit = await session.hasPermission("systemUsers", "update");
10
- if (!user) redirect("/auth/signIn/");
11
- return <SystemUserPageContent user={user} allowEdit={allowEdit} />;
12
- }
@@ -1,45 +0,0 @@
1
- "use client";
2
-
3
- import type { User } from "@clerk/nextjs/server";
4
- import { useDisclosure } from "@studiocubics/hooks";
5
- import {
6
- ConfirmationForm,
7
- Dialog,
8
- ListItem,
9
- type ListItemProps,
10
- TextInput,
11
- } from "@studiocubics/ui";
12
- import { Trash } from "lucide-react";
13
-
14
- export function SystemUserDeleteListItem(
15
- props: ListItemProps & { uid: User["id"]; fullName?: User["fullName"] },
16
- ) {
17
- const { uid, fullName, ...rest } = props;
18
- const { open, handleOpen, handleStrictClose, handleClose } = useDisclosure();
19
- return (
20
- <>
21
- <ListItem
22
- {...rest}
23
- color="error"
24
- startIcon={<Trash />}
25
- onClick={handleOpen}
26
- >
27
- Delete User
28
- </ListItem>
29
- <Dialog open={open} onClose={handleStrictClose}>
30
- <ConfirmationForm
31
- formTitle="Delete System User"
32
- variant="danger"
33
- onCancel={handleClose}
34
- >
35
- Are you sure you want to delete {fullName ? `${fullName}'s` : "this"}{" "}
36
- system account?
37
- <br />
38
- All information will be deleted, this action is irreversible and
39
- cannot be undone.
40
- <TextInput fullWidth />
41
- </ConfirmationForm>
42
- </Dialog>
43
- </>
44
- );
45
- }
@@ -1,6 +0,0 @@
1
- .root {
2
- display: flex;
3
- justify-content: space-between;
4
- align-items: flex-start;
5
- width: 100%;
6
- }
@@ -1,71 +0,0 @@
1
- "use client";
2
-
3
- import { Button, IdentityDisplay, TransitionAnimation } from "@studiocubics/ui";
4
- import styles from "./SystemUserDetails.module.css";
5
- import { Edit } from "lucide-react";
6
- import { useDisclosure } from "@studiocubics/hooks";
7
- import { type User } from "@clerk/nextjs/server";
8
- import { SystemUserDetailsForm } from "../SystemUserDetailsForm/SystemUserDetailsForm";
9
-
10
- interface SystemUserDetailsProps {
11
- id: User["id"];
12
- fullName: User["fullName"];
13
- firstName: User["firstName"];
14
- lastName?: User["lastName"];
15
- imageUrl: User["imageUrl"];
16
- emailAddress?: NonNullable<User["primaryEmailAddress"]>["emailAddress"];
17
- editable?: boolean;
18
- }
19
- export function SystemUserDetails({
20
- id,
21
- fullName,
22
- firstName,
23
- lastName,
24
- imageUrl,
25
- emailAddress,
26
- editable,
27
- }: SystemUserDetailsProps) {
28
- const { open, handleOpen, handleClose } = useDisclosure();
29
- return (
30
- <>
31
- <TransitionAnimation
32
- in={open}
33
- transformOrigin={"top right"}
34
- mountOnly
35
- unmountOnExit
36
- >
37
- <SystemUserDetailsForm
38
- imageUrl={imageUrl}
39
- firstName={firstName}
40
- lastName={lastName}
41
- onClose={handleClose}
42
- />
43
- </TransitionAnimation>
44
- <TransitionAnimation
45
- in={!open}
46
- transformOrigin={"top"}
47
- mountOnly
48
- unmountOnExit
49
- >
50
- <div className={styles.root}>
51
- <IdentityDisplay
52
- profileName={fullName}
53
- profileImage={imageUrl}
54
- role={
55
- <p>
56
- {emailAddress}
57
- <br />
58
- <strong>{id}</strong>
59
- </p>
60
- }
61
- />
62
- {editable && (
63
- <Button size="sm" startIcon={<Edit />} onClick={handleOpen}>
64
- Edit Details
65
- </Button>
66
- )}
67
- </div>
68
- </TransitionAnimation>
69
- </>
70
- );
71
- }
@@ -1,7 +0,0 @@
1
- .form {
2
- flex: 1;
3
- }
4
- .formRow {
5
- display: flex;
6
- gap: var(--spacing-gap);
7
- }