@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
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { toCapitalised } from '@studiocubics/utils';
4
+ import { User, Edit } from 'lucide-react';
5
+ import { TransitionAnimation, Tooltip, Button } from '@studiocubics/components';
6
+ import Link from 'next/link';
7
+ import { useDisclosure } from '@studiocubics/hooks';
8
+ import styles from './SystemUserRole.module.css.js';
9
+ import { RBAC_CONFIG } from '../../../../clerk/rbacConfig.js';
10
+ import { SystemUserRoleForm } from '../SystemUserRoleForm/SystemUserRoleForm.js';
11
+
12
+ function SystemUserRole({ role, editable }) {
13
+ const roleDetails = RBAC_CONFIG[role];
14
+ const { open, handleOpen, handleClose } = useDisclosure();
15
+ if (!roleDetails)
16
+ return null;
17
+ return (jsxs(Fragment, { children: [jsx(TransitionAnimation, { in: !open, transformOrigin: "top", mountOnly: true, unmountOnExit: true, children: jsxs("div", { className: styles.root, children: [jsxs("div", { className: styles.main, children: [jsx(Tooltip, { renderArrow: true, title: "View resource permissions", children: jsx(Button, { as: Link, variant: "contained", color: "primary", startIcon: jsx(User, { size: 16 }), size: "sm", href: `/dashboard/security/permissions/${role}`, children: toCapitalised(role) }) }), jsx("p", { children: roleDetails.desc })] }), editable && (jsx(Button, { size: "sm", startIcon: jsx(Edit, {}), onClick: handleOpen, children: "Edit Role" }))] }) }), jsx(TransitionAnimation, { in: open, transformOrigin: "top right", mountOnly: true, unmountOnExit: true, children: jsx(SystemUserRoleForm, { role: role, onClose: handleClose }) })] }));
18
+ }
19
+
20
+ export { SystemUserRole };
21
+ //# sourceMappingURL=SystemUserRole.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SystemUserRole.js","sources":["../../../../../src/ui/System/SystemUser/SystemUserRole/SystemUserRole.tsx"],"sourcesContent":["\"use client\";\n\nimport { toCapitalised } from \"@studiocubics/utils\";\nimport { Edit, User } from \"lucide-react\";\nimport { Button, Tooltip, TransitionAnimation } from \"@studiocubics/components\";\nimport Link from \"next/link\";\nimport { useDisclosure } from \"@studiocubics/hooks\";\nimport styles from \"./SystemUserRole.module.css\";\nimport { RBAC_CONFIG, type Role } from \"../../../../clerk/rbacConfig\";\nimport type { Route } from \"next\";\nimport { SystemUserRoleForm } from \"../SystemUserRoleForm/SystemUserRoleForm\";\n\nexport interface SystemUserRoleProps {\n role: Role;\n editable?: boolean;\n}\n\nexport function SystemUserRole({ role, editable }: SystemUserRoleProps) {\n const roleDetails = RBAC_CONFIG[role];\n const { open, handleOpen, handleClose } = useDisclosure();\n if (!roleDetails) return null;\n\n return (\n <>\n <TransitionAnimation\n in={!open}\n transformOrigin={\"top\"}\n mountOnly\n unmountOnExit\n >\n <div className={styles.root}>\n <div className={styles.main}>\n <Tooltip renderArrow title={\"View resource permissions\"}>\n <Button\n as={Link}\n variant=\"contained\"\n color=\"primary\"\n startIcon={<User size={16} />}\n size=\"sm\"\n href={`/dashboard/security/permissions/${role}` as Route}\n >\n {toCapitalised(role)}\n </Button>\n </Tooltip>\n <p>{roleDetails.desc}</p>\n </div>\n {editable && (\n <Button size=\"sm\" startIcon={<Edit />} onClick={handleOpen}>\n Edit Role\n </Button>\n )}\n </div>\n </TransitionAnimation>\n <TransitionAnimation\n in={open}\n transformOrigin={\"top right\"}\n mountOnly\n unmountOnExit\n >\n <SystemUserRoleForm role={role} onClose={handleClose} />\n </TransitionAnimation>\n </>\n );\n}\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;SAiBgB,cAAc,CAAC,CAAA,CAAE,IAAI,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,EAAuB,CAAA,CAAA;AACpE,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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AA,CAAA,CAAA,CAAA,CAAA,CAAkB,CAAA,CAAA,CAAA,CAAC,IAAI,CAAA,CAAE,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAI,CAAA,CAAA,CACpC,CAAA,CAAA,CAAA,CACrB,CAAA;AAEP;;"}
@@ -0,0 +1,4 @@
1
+ var styles = {"root":"SystemUserRole-module_root__HlOLA","main":"SystemUserRole-module_main__X9g43"};
2
+
3
+ export { styles as default };
4
+ //# sourceMappingURL=SystemUserRole.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SystemUserRole.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,9 @@
1
+ import { type CardProps } from "@studiocubics/components";
2
+ import { type Role } from "../../../../clerk/rbacConfig";
3
+ declare const initialSystemUserRoleUpdateState: import("@studiocubics/utils").ActionResponse<"role", "role"[]>;
4
+ export type SystemUserRoleUpdateState = typeof initialSystemUserRoleUpdateState;
5
+ export declare function SystemUserRoleForm({ role, onClose, ...rest }: {
6
+ role: Role;
7
+ onClose(): void;
8
+ } & CardProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { Card, ConfirmationForm, Select } from '@studiocubics/components';
4
+ import { initialiseForm, toCapitalised } from '@studiocubics/utils';
5
+ import { roles } from '../../../../clerk/rbacConfig.js';
6
+ import { useActionState } from 'react';
7
+ import '../../../../clerk/actions/invitations.js';
8
+ import { systemUserRoleUpdateAction } from '../../../../clerk/actions/systemUsers.js';
9
+ import '@clerk/nextjs/server';
10
+ import '../../../../clerk/schemas/invitation.js';
11
+
12
+ const initialSystemUserRoleUpdateState = initialiseForm("role");
13
+ function SystemUserRoleForm({ role, onClose, ...rest }) {
14
+ const [state, action, pending] = useActionState(systemUserRoleUpdateAction.bind(null, "hello"), initialSystemUserRoleUpdateState);
15
+ return (jsx(Card, { ...rest, fullWidth: true, children: jsx(ConfirmationForm, { variant: "danger", confirmText: "Change Role", action: action, formTitle: "Edit Role", onCancel: onClose, children: jsx(Select, { label: "Current role", error: state.fieldErrors?.role, defaultValue: role, disabled: pending, children: roles.map((r) => (jsx("option", { value: r, children: toCapitalised(r) }, r))) }) }) }));
16
+ }
17
+
18
+ export { SystemUserRoleForm };
19
+ //# sourceMappingURL=SystemUserRoleForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SystemUserRoleForm.js","sources":["../../../../../src/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CardProps,\n Card,\n ConfirmationForm,\n Select,\n} from \"@studiocubics/components\";\nimport { initialiseForm, toCapitalised } from \"@studiocubics/utils\";\nimport { type Role, roles } from \"../../../../clerk/rbacConfig\";\nimport { useActionState } from \"react\";\nimport { systemUserRoleUpdateAction } from \"../../../../clerk/_index\";\n\nconst initialSystemUserRoleUpdateState = initialiseForm(\"role\");\n\nexport type SystemUserRoleUpdateState = typeof initialSystemUserRoleUpdateState;\n\nexport function SystemUserRoleForm({\n role,\n onClose,\n ...rest\n}: { role: Role; onClose(): void } & CardProps) {\n const [state, action, pending] = useActionState(\n systemUserRoleUpdateAction.bind(null, \"hello\"),\n initialSystemUserRoleUpdateState,\n );\n return (\n <Card {...rest} fullWidth>\n <ConfirmationForm\n variant=\"danger\"\n confirmText=\"Change Role\"\n action={action}\n formTitle=\"Edit Role\"\n onCancel={onClose}\n >\n <Select\n label=\"Current role\"\n error={state.fieldErrors?.role}\n defaultValue={role}\n disabled={pending}\n >\n {roles.map((r) => (\n <option key={r} value={r}>\n {toCapitalised(r)}\n </option>\n ))}\n </Select>\n </ConfirmationForm>\n </Card>\n );\n}\n"],"names":["_jsx"],"mapp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AAK,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CACpB,KAAK,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAE,IAAI,CAAA,CAC9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAE,CAAA,CAAA,CAAA,CAAI,CAAA,CAClB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,WAEhB,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAG,CAAC,CAAC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CACXA,CAAAA,CAAAA,cAAgB,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACrB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAC,CAAC,CAAC,CAAA,CAAA,CAAA,CADN,CAAC,CAEL,CACV,CAAC,GACK,CAAA,CAAA,CACQ,CAAA,CAAA,CACd,CAAA;AAEX;;"}
@@ -0,0 +1,9 @@
1
+ import type { User } from "@clerk/nextjs/server";
2
+ export declare function CurrentSystemUserTimestamps(): import("react/jsx-runtime").JSX.Element;
3
+ export interface SystemUserTimestampsProps {
4
+ createdAt?: User["createdAt"] | NonNullable<ClerkClientUser>["createdAt"];
5
+ updatedAt?: User["updatedAt"] | NonNullable<ClerkClientUser>["updatedAt"];
6
+ lastSignInAt?: User["lastSignInAt"] | NonNullable<ClerkClientUser>["lastSignInAt"];
7
+ isLoaded?: boolean;
8
+ }
9
+ export declare function SystemUserTimestamps(props: SystemUserTimestampsProps): import("react/jsx-runtime").JSX.Element[];
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useUser } from '@clerk/nextjs';
4
+ import { LabeledValue, Skeleton } from '@studiocubics/components';
5
+
6
+ function CurrentSystemUserTimestamps() {
7
+ const { user, isLoaded } = useUser();
8
+ // if (!user) return null;
9
+ return (jsx(SystemUserTimestamps, { isLoaded: isLoaded, createdAt: user?.createdAt, updatedAt: user?.updatedAt, lastSignInAt: user?.lastSignInAt }));
10
+ }
11
+ function SystemUserTimestamps(props) {
12
+ const { createdAt, updatedAt, lastSignInAt, isLoaded = true } = props;
13
+ const timestamps = [
14
+ { stamp: "Created at", time: createdAt },
15
+ { stamp: "Updated", time: updatedAt },
16
+ { stamp: "Last Sign in", time: lastSignInAt },
17
+ ];
18
+ return timestamps.map((timestamp) => {
19
+ let timestampTime = timestamp.time && typeof timestamp.time == "number"
20
+ ? new Date(timestamp.time)
21
+ : timestamp.time;
22
+ return (jsx(LabeledValue, { label: timestamp.stamp, children: isLoaded ? (!timestamp.time ? ("-") : (timestampTime?.toLocaleString())) : (jsx(Skeleton, { width: 150, height: 24 })) }, timestamp.stamp));
23
+ });
24
+ }
25
+
26
+ export { CurrentSystemUserTimestamps, SystemUserTimestamps };
27
+ //# sourceMappingURL=SystemUserTimestamps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SystemUserTimestamps.js","sources":["../../../../src/ui/System/SystemUser/SystemUserTimestamps.tsx"],"sourcesContent":["\"use client\";\n\nimport { useUser } from \"@clerk/nextjs\";\nimport type { User } from \"@clerk/nextjs/server\";\nimport { LabeledValue, Skeleton } from \"@studiocubics/components\";\n\nexport function CurrentSystemUserTimestamps() {\n const { user, isLoaded } = useUser();\n // if (!user) return null;\n return (\n <SystemUserTimestamps\n isLoaded={isLoaded}\n createdAt={user?.createdAt}\n updatedAt={user?.updatedAt}\n lastSignInAt={user?.lastSignInAt}\n />\n );\n}\nexport interface SystemUserTimestampsProps {\n createdAt?: User[\"createdAt\"] | NonNullable<ClerkClientUser>[\"createdAt\"];\n updatedAt?: User[\"updatedAt\"] | NonNullable<ClerkClientUser>[\"updatedAt\"];\n lastSignInAt?:\n | User[\"lastSignInAt\"]\n | NonNullable<ClerkClientUser>[\"lastSignInAt\"];\n isLoaded?: boolean;\n}\n\nexport function SystemUserTimestamps(props: SystemUserTimestampsProps) {\n const { createdAt, updatedAt, lastSignInAt, isLoaded = true } = props;\n const timestamps = [\n { stamp: \"Created at\", time: createdAt },\n { stamp: \"Updated\", time: updatedAt },\n { stamp: \"Last Sign in\", time: lastSignInAt },\n ];\n\n return timestamps.map((timestamp) => {\n let timestampTime =\n timestamp.time && typeof timestamp.time == \"number\"\n ? new Date(timestamp.time)\n : timestamp.time;\n\n return (\n <LabeledValue key={timestamp.stamp} label={timestamp.stamp}>\n {isLoaded ? (\n !timestamp.time ? (\n \"-\"\n ) : (\n timestampTime?.toLocaleString()\n )\n ) : (\n <Skeleton width={150} height={24} />\n )}\n </LabeledValue>\n );\n });\n}\n"],"names":["_jsx"],"mappings":";;;;;SAMgB,2BAA2B,CAAA,CAAA,CAAA;IACzC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,EAAE,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,QAAQ,CAAA,CAAE,CAAA,CAAA,CAAG,OAAO,CAAA,CAAE;;IAEpC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACEA,CAAAA,CAAAA,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAAA,CAAA,CAAA,CACnB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAE,CAAA,CAAA,CAAA,CA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A,CAAA,CAEDA,CAAAA,CAAAA,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAE,CAAA,CAAA,CAAG,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAE,CAAA,CAAE,CAAA,CAAA,CAAI,CACrC,EAAA,CAAA,CATgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,CAUnB,CAAA;AAEnB,CAAA,CAAA,CAAA,CAAA,CAAC,CAAC;AACJ;;"}
@@ -0,0 +1 @@
1
+ export declare function WelcomePage(): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,16 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Button, CubicsUILogo, PoweredByBanner } from '@studiocubics/components';
3
+ import styles from './WelcomePage.module.css.js';
4
+ import Link from 'next/link';
5
+ import { LogIn, LayoutDashboardIcon } from 'lucide-react';
6
+ import { auth } from '../../../clerk/auth.js';
7
+
8
+ async function WelcomePage() {
9
+ const { userId } = await auth();
10
+ const loggedOutUser = (jsx(Link, { href: "/auth/signIn/", children: jsx(Button, { variant: "contained", endIcon: jsx(LogIn, {}), children: "Get Started" }) }));
11
+ const loggedInUser = (jsx(Link, { href: "/dashboard", children: jsx(Button, { variant: "contained", endIcon: jsx(LayoutDashboardIcon, {}), children: "Go to dashboard" }) }));
12
+ return (jsxs("div", { className: styles.root, children: [jsx(CubicsUILogo, { width: "10rem", height: "auto", onlyFavicon: true }), jsx(PoweredByBanner, { size: "md" }), jsx("h2", { children: "Welcome to Cubics CMS!" }), jsx("p", { className: styles.desc, children: "A powerful and intuitive platform to manage your content effortlessly. Streamline updates, enhance collaboration, and take full control of your digital presence." }), userId ? loggedInUser : loggedOutUser, !userId && (jsxs("p", { className: styles.catcall, children: ["Dont have an account?\u00A0", jsx(Link, { href: "/auth/requestAccount", children: "Request from an admin" })] }))] }));
13
+ }
14
+
15
+ export { WelcomePage };
16
+ //# sourceMappingURL=WelcomePage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WelcomePage.js","sources":["../../../../src/ui/System/WelcomePage/WelcomePage.tsx"],"sourcesContent":["import { Button, CubicsUILogo, PoweredByBanner } from \"@studiocubics/components\";\nimport styles from \"./WelcomePage.module.css\";\nimport Link from \"next/link\";\nimport { LayoutDashboardIcon, LogIn } from \"lucide-react\";\nimport { auth } from \"../../../clerk/auth\";\nexport async function WelcomePage() {\n const { userId } = await auth();\n const loggedOutUser = (\n <Link href={\"/auth/signIn/\"}>\n <Button variant=\"contained\" endIcon={<LogIn />}>\n Get Started\n </Button>\n </Link>\n );\n const loggedInUser = (\n <Link href={\"/dashboard\"}>\n <Button variant=\"contained\" endIcon={<LayoutDashboardIcon />}>\n Go to dashboard\n </Button>\n </Link>\n );\n return (\n <div className={styles.root}>\n <CubicsUILogo width={\"10rem\"} height={\"auto\"} onlyFavicon />\n <PoweredByBanner size={\"md\"} />\n <h2>Welcome to Cubics CMS!</h2>\n <p className={styles.desc}>\n A powerful and intuitive platform to manage your content effortlessly.\n Streamline updates, enhance collaboration, and take full control of your\n digital presence.\n </p>\n {userId ? loggedInUser : loggedOutUser}\n {!userId && (\n <p className={styles.catcall}>\n Dont have an account?&nbsp;\n {/* TODO add request account from admin flow.\n //@ts-ignore */}\n <Link href=\"/auth/requestAccount\">Request from an admin</Link>\n </p>\n )}\n </div>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AAKO,eAAe,WAAW,GAAA;AAC/B,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE;IAC/B,MAAM,aAAa,IACjBA,GAAA,CAAC,IAAI,IAAC,IAAI,EAAE,eAAe,EAAA,QAAA,EACzBA,GAAA,CAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAEA,GAAA,CAAC,KAAK,EAAA,EAAA,CAAG,EAAA,QAAA,EAAA,aAAA,EAAA,CAErC,EAAA,CACJ,CACR;IACD,MAAM,YAAY,IAChBA,GAAA,CAAC,IAAI,IAAC,IAAI,EAAE,YAAY,EAAA,QAAA,EACtBA,GAAA,CAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAEA,GAAA,CAAC,mBAAmB,EAAA,EAAA,CAAG,EAAA,QAAA,EAAA,iBAAA,EAAA,CAEnD,EAAA,CACJ,CACR;AACD,IAAA,QACEC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,IAAI,EAAA,QAAA,EAAA,CACzBD,GAAA,CAAC,YAAY,EAAA,EAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAA,IAAA,EAAA,CAAG,EAC5DA,GAAA,CAAC,eAAe,EAAA,EAAC,IAAI,EAAE,IAAI,GAAI,EAC/BA,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,CAA+B,EAC/BA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,MAAM,CAAC,IAAI,EAAA,QAAA,EAAA,mKAAA,EAAA,CAIrB,EACH,MAAM,GAAG,YAAY,GAAG,aAAa,EACrC,CAAC,MAAM,KACNC,IAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,MAAM,CAAC,OAAO,EAAA,QAAA,EAAA,CAAA,6BAAA,EAI1BD,IAAC,IAAI,EAAA,EAAC,IAAI,EAAC,sBAAsB,EAAA,QAAA,EAAA,uBAAA,EAAA,CAA6B,CAAA,EAAA,CAC5D,CACL,CAAA,EAAA,CACG;AAEV;;;;"}
@@ -0,0 +1,4 @@
1
+ var styles = {"root":"WelcomePage-module_root__NQgmW","desc":"WelcomePage-module_desc__D429m","catcall":"WelcomePage-module_catcall__ZfRP8"};
2
+
3
+ export { styles as default };
4
+ //# sourceMappingURL=WelcomePage.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WelcomePage.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,7 +1,5 @@
1
- import type { TabProps } from "@studiocubics/ui";
1
+ import type { TabProps } from "@studiocubics/components";
2
2
  import type { AppRoutes } from "../../routes";
3
-
4
- export type SecurityPageProps<T extends AppRoutes = "/dashboard/security"> =
5
- PageProps<T> & {
3
+ export type SecurityPageProps<T extends AppRoutes = "/dashboard/security"> = PageProps<T> & {
6
4
  securityLinks: TabProps[];
7
- };
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const cmsMiddleware: import("next/server").NextMiddleware;
2
+ export declare const cmsConfig: {
3
+ matcher: string[];
4
+ };
@@ -0,0 +1,34 @@
1
+ import { createRouteMatcher, clerkMiddleware } from '@clerk/nextjs/server';
2
+ import { NextResponse } from 'next/server';
3
+
4
+ const isPublicRoute = createRouteMatcher(["/", "/auth(.*)"]);
5
+ const cmsMiddleware = clerkMiddleware(async (auth, req) => {
6
+ const { userId, sessionClaims, redirectToSignIn } = await auth();
7
+ // If the user isn't signed in and the route is private, redirect to sign-in
8
+ if (!userId && !isPublicRoute(req)) {
9
+ return redirectToSignIn({ returnBackUrl: req.url });
10
+ }
11
+ // Catch users who do not have `onboardingComplete: true` in their publicMetadata
12
+ // Redirect them to the /auth/onboarding route to complete onboarding
13
+ if (userId &&
14
+ !sessionClaims?.metadata?.onboardingComplete &&
15
+ req.nextUrl.pathname !== "/auth/onboarding") {
16
+ const onboardingUrl = new URL("/auth/onboarding", req.url);
17
+ return NextResponse.redirect(onboardingUrl);
18
+ }
19
+ // If the user is logged in and the route is protected, let them view.
20
+ if (userId && !isPublicRoute(req)) {
21
+ return NextResponse.next();
22
+ }
23
+ });
24
+ const cmsConfig = {
25
+ matcher: [
26
+ // Skip Next.js internals and all static files, unless found in search params
27
+ "/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)",
28
+ // Always run for API routes
29
+ "/(api|trpc)(.*)",
30
+ ],
31
+ };
32
+
33
+ export { cmsConfig, cmsMiddleware };
34
+ //# sourceMappingURL=proxyFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxyFunctions.js","sources":["../../src/utils/proxyFunctions.ts"],"sourcesContent":["import { clerkMiddleware, createRouteMatcher } from \"@clerk/nextjs/server\";\nimport { NextResponse } from \"next/server\";\n\nconst isPublicRoute = createRouteMatcher([\"/\", \"/auth(.*)\"]);\n\nexport const cmsMiddleware = clerkMiddleware(async (auth, req) => {\n const { userId, sessionClaims, redirectToSignIn } = await auth();\n\n // If the user isn't signed in and the route is private, redirect to sign-in\n if (!userId && !isPublicRoute(req)) {\n return redirectToSignIn({ returnBackUrl: req.url });\n }\n\n // Catch users who do not have `onboardingComplete: true` in their publicMetadata\n // Redirect them to the /auth/onboarding route to complete onboarding\n if (\n userId &&\n !sessionClaims?.metadata?.onboardingComplete &&\n req.nextUrl.pathname !== \"/auth/onboarding\"\n ) {\n const onboardingUrl = new URL(\"/auth/onboarding\", req.url);\n return NextResponse.redirect(onboardingUrl);\n }\n\n // If the user is logged in and the route is protected, let them view.\n if (userId && !isPublicRoute(req)) {\n return NextResponse.next();\n }\n});\nexport const cmsConfig = {\n matcher: [\n // Skip Next.js internals and all static files, unless found in search params\n \"/((?!_next|[^?]*\\\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)\",\n // Always run for API routes\n \"/(api|trpc)(.*)\",\n ],\n};\n"],"names":[],"mappings":";;;AAGA,MAAM,aAAa,GAAG,kBAAkB,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAErD,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,IAAI,EAAE,GAAG,KAAI;IAC/D,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAI,EAAE;;IAGhE,IAAI,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;QAClC,OAAO,gBAAgB,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;IACrD;;;AAIA,IAAA,IACE,MAAM;AACN,QAAA,CAAC,aAAa,EAAE,QAAQ,EAAE,kBAAkB;AAC5C,QAAA,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,kBAAkB,EAC3C;QACA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,kBAAkB,EAAE,GAAG,CAAC,GAAG,CAAC;AAC1D,QAAA,OAAO,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC;IAC7C;;IAGA,IAAI,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;AACjC,QAAA,OAAO,YAAY,CAAC,IAAI,EAAE;IAC5B;AACF,CAAC;AACM,MAAM,SAAS,GAAG;AACvB,IAAA,OAAO,EAAE;;QAEP,qHAAqH;;QAErH,iBAAiB;AAClB,KAAA;;;;;"}
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "access": "public"
6
6
  },
7
7
  "private": false,
8
- "version": "0.0.1",
8
+ "version": "0.0.2",
9
9
  "keywords": [
10
10
  "@studiocubics",
11
11
  "cubics",
@@ -34,37 +34,37 @@
34
34
  "lucide-react": "^0.554.0",
35
35
  "next-themes": "^0.4.6",
36
36
  "zod": "^4.3.6",
37
- "@studiocubics/hooks": "^0.0.1",
38
- "@studiocubics/ui": "^0.0.1",
39
- "@studiocubics/utils": "^0.0.1",
40
- "@studiocubics/next": "^0.0.1"
37
+ "@studiocubics/components": "^0.0.2",
38
+ "@studiocubics/hooks": "^0.0.2",
39
+ "@studiocubics/next": "^0.0.2",
40
+ "@studiocubics/utils": "^0.0.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@eslint/js": "^9.39.1",
44
44
  "@rollup/plugin-terser": "^0.4.4",
45
45
  "@rollup/plugin-typescript": "^12.3.0",
46
46
  "@types/node": "^24.10.1",
47
- "@types/react": "^19.2.5",
48
- "@types/react-dom": "^19.2.3",
47
+ "@types/react": "^19",
48
+ "@types/react-dom": "^19",
49
+ "babel-plugin-react-compiler": "1.0.0",
49
50
  "eslint": "^9.39.1",
50
51
  "eslint-plugin-react-hooks": "^7.0.1",
51
52
  "globals": "^16.5.0",
53
+ "next": "16.1.6",
52
54
  "postcss": "^8.5.6",
53
55
  "postcss-modules": "^6.0.1",
56
+ "react": "19.2.4",
57
+ "react-dom": "19.2.4",
54
58
  "rollup": "^4.53.3",
55
59
  "rollup-plugin-postcss": "^4.0.2",
56
60
  "rollup-preserve-directives": "^1.1.3",
57
- "typescript-eslint": "^8.46.4",
58
- "babel-plugin-react-compiler": "1.0.0",
59
- "next": "16.1.6",
60
- "react": "19.2.4",
61
- "react-dom": "19.2.4",
62
61
  "typescript": "^5.9.3",
63
- "@studiocubics/types": "^0.0.1"
62
+ "typescript-eslint": "^8.46.4",
63
+ "@studiocubics/types": "^0.0.2"
64
64
  },
65
65
  "peerDependencies": {
66
- "babel-plugin-react-compiler": ">= 1",
67
66
  "@clerk/nextjs": ">= 6",
67
+ "babel-plugin-react-compiler": ">= 1",
68
68
  "next": ">= 16",
69
69
  "react": ">= 19",
70
70
  "react-dom": ">= 19",
package/rollup.config.js CHANGED
@@ -39,7 +39,7 @@ export default defineConfig({
39
39
  "@clerk/nextjs",
40
40
  "@clerk/nextjs/server",
41
41
  "@monaco-editor/react",
42
- "@studiocubics/ui",
42
+ "@studiocubics/components",
43
43
  "@studiocubics/utils",
44
44
  "@studiocubics/hooks",
45
45
  "@studiocubics/next",
@@ -1,7 +0,0 @@
1
-
2
- > @studiocubics/cms@0.0.1 build /home/runner/work/StudioCubics/StudioCubics/packages/cms
3
- > rollup -c
4
-
5
- 
6
- src/index.ts → dist...
7
- created dist in 6.7s
package/CHANGELOG.md DELETED
@@ -1,12 +0,0 @@
1
- # @studiocubics/cms
2
-
3
- ## 0.0.1
4
-
5
- ### Patch Changes
6
-
7
- - First publish inshallah!
8
- - Updated dependencies
9
- - @studiocubics/hooks@0.0.1
10
- - @studiocubics/utils@0.0.1
11
- - @studiocubics/next@0.0.1
12
- - @studiocubics/ui@0.0.1
package/eslint.config.js DELETED
@@ -1,21 +0,0 @@
1
- import js from "@eslint/js";
2
- import globals from "globals";
3
- import reactHooks from "eslint-plugin-react-hooks";
4
- import tseslint from "typescript-eslint";
5
- import { defineConfig, globalIgnores } from "eslint/config";
6
-
7
- export default defineConfig([
8
- globalIgnores(["dist"]),
9
- {
10
- files: ["**/*.{ts,tsx}"],
11
- extends: [
12
- js.configs.recommended,
13
- tseslint.configs.recommended,
14
- reactHooks.configs.flat.recommended,
15
- ],
16
- languageOptions: {
17
- ecmaVersion: 2020,
18
- globals: globals.browser,
19
- },
20
- },
21
- ]);
@@ -1,78 +0,0 @@
1
- "use server";
2
-
3
- import { clerkClient, type Invitation } from "@clerk/nextjs/server";
4
- import { auth } from "../auth";
5
- import { revalidatePath } from "next/cache";
6
- import { headers } from "next/headers";
7
- import { getInvitationPublicMetadata } from "../rbacConfig";
8
- import { createInvitationSchema } from "../schemas/invitation";
9
- import z from "zod";
10
- import type { InvitationCreateState } from "../../ui/System/Invitations/InvitationListActions";
11
- import { apiRes } from "@studiocubics/utils";
12
- import type { PaginatedResponse } from "../clerk";
13
- import { cache } from "react";
14
-
15
- export const invitationListReadAction = cache(
16
- async (
17
- params: ClerkInvitationListParams,
18
- ): Promise<PaginatedResponse<Invitation[]>> => {
19
- const session = await auth();
20
- if (!session.hasPermission("invitations", "read")) {
21
- throw new Error(apiRes.forbidden);
22
- }
23
- const client = await clerkClient();
24
- const invitationsList = await client.invitations.getInvitationList(params);
25
- return invitationsList;
26
- },
27
- );
28
- export const invitationDeleteAction = async (id: string) => {
29
- const session = await auth();
30
- if (!session.hasPermission("invitations", "delete")) {
31
- return apiRes.actionFail(apiRes.forbidden);
32
- }
33
-
34
- if (!id || typeof id !== "string")
35
- return apiRes.actionFail(apiRes.wrongType("id", "string"));
36
-
37
- const client = await clerkClient();
38
- await client.invitations.revokeInvitation(id);
39
-
40
- revalidatePath("/dashboard/security/invitations");
41
- return apiRes.actionSuccess();
42
- };
43
-
44
- export async function invitationCreateAction(
45
- _: InvitationCreateState,
46
- formData: FormData,
47
- ): Promise<InvitationCreateState> {
48
- const session = await auth();
49
- if (!session.hasPermission("invitations", "create")) {
50
- return apiRes.actionFail(apiRes.forbidden);
51
- }
52
-
53
- const headersList = await headers();
54
- const host = headersList.get("host");
55
- const protocol = host?.startsWith("localhost") ? "http" : "https";
56
-
57
- const formDataObj = Object.fromEntries(formData.entries());
58
- const { success, data, error } =
59
- createInvitationSchema.safeParse(formDataObj);
60
- if (!success) {
61
- const flattenedError = z.flattenError(error);
62
- return apiRes.actionFail(
63
- flattenedError.formErrors.join("\n"),
64
- flattenedError.fieldErrors,
65
- );
66
- }
67
-
68
- const publicMetadata = getInvitationPublicMetadata(data.role);
69
- const client = await clerkClient();
70
- await client.invitations.createInvitation({
71
- ...data,
72
- redirectUrl: `${protocol}://${host}/auth/signUp`,
73
- publicMetadata,
74
- });
75
-
76
- revalidatePath("/dashboard/security/invitations");
77
- return apiRes.actionSuccess();
78
- }
@@ -1,94 +0,0 @@
1
- "use server";
2
- import { clerkClient, type User } from "@clerk/nextjs/server";
3
- import { auth } from "../auth";
4
- import { apiRes } from "@studiocubics/utils";
5
- import type { PaginatedResponse } from "../clerk";
6
- import type { SystemUserRoleUpdateState } from "../../ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm";
7
- import { cache } from "react";
8
- import type { SystemUserDetailsUpdateState } from "../../ui/_index";
9
-
10
- export const systemUserListReadAction = cache(
11
- async (
12
- params: ClerkUserListParams,
13
- removeCurrent: boolean = false,
14
- ): Promise<PaginatedResponse<User[]>> => {
15
- const session = await auth();
16
-
17
- if (!session.hasPermission("systemUsers", "read")) {
18
- throw new Error(apiRes.forbidden);
19
- }
20
-
21
- const client = await clerkClient();
22
- const systemUserList = await client.users.getUserList(params);
23
-
24
- if (removeCurrent) {
25
- systemUserList.data = systemUserList.data.filter(
26
- (su) => su.id !== session.userId,
27
- );
28
- systemUserList.totalCount--;
29
- }
30
-
31
- return systemUserList;
32
- },
33
- );
34
-
35
- export const systemUserReadAction = cache(async (id: string) => {
36
- const session = await auth();
37
-
38
- if (!session.hasPermission("systemUsers", "read")) {
39
- throw new Error(apiRes.forbidden);
40
- }
41
-
42
- const client = await clerkClient();
43
- const systemUser = await client.users.getUser(id);
44
-
45
- if (!systemUser) {
46
- throw new Error(apiRes.notFound(`System User: ${id}`));
47
- }
48
-
49
- return systemUser;
50
- });
51
-
52
- export async function systemUserRoleUpdateAction(
53
- userId: string,
54
- _: SystemUserRoleUpdateState,
55
- formData: FormData,
56
- ): Promise<SystemUserRoleUpdateState> {
57
- const session = await auth();
58
-
59
- if (!session.hasPermission("systemUsers", "update")) {
60
- throw new Error(apiRes.forbidden);
61
- }
62
- const role = formData.get("role");
63
- console.log("userId", userId);
64
- console.log("role", role);
65
- return apiRes.actionSuccess();
66
-
67
- // const client = await clerkClient();
68
- // const { publicMetadata } = await client.users.getUser(userId);
69
- // const patchedUser = await client.users.updateUserMetadata(userId, {
70
- // publicMetadata: {
71
- // ...publicMetadata,
72
- // role,
73
- // },
74
- // });
75
- // return apiRes.actionSuccess(patchedUser);
76
- }
77
-
78
- export async function systemUserDetailsUpdateAction(
79
- userId: string,
80
- _: SystemUserDetailsUpdateState,
81
- formData: FormData,
82
- ): Promise<SystemUserDetailsUpdateState> {
83
- const session = await auth();
84
-
85
- if (!session.hasPermission("systemUsers", "update")) {
86
- throw new Error(apiRes.forbidden);
87
- }
88
- console.log("firstName", formData.get("firstName"));
89
- console.log("lastName", formData.get("firstName"));
90
- console.log("imageFile", formData.get("imageFile"));
91
-
92
- console.log("userId", userId);
93
- return apiRes.actionSuccess();
94
- }
package/src/clerk/auth.ts DELETED
@@ -1,34 +0,0 @@
1
- "use server";
2
- import { auth as clerkAuth } from "@clerk/nextjs/server";
3
- import { hasPermissionForClaims } from "./hasPermission";
4
- import type { Resource, RoleActions } from "./rbacConfig";
5
- type ClerkAuthResult = Awaited<ReturnType<typeof clerkAuth>>;
6
-
7
- export type AuthWithPermissions = ClerkAuthResult & {
8
- hasPermission: (
9
- resource: Resource,
10
- action: RoleActions,
11
- record?: Record<string, any>,
12
- ) => Promise<boolean>;
13
- };
14
- export async function auth(
15
- options?: Parameters<typeof clerkAuth>[0],
16
- ): Promise<AuthWithPermissions> {
17
- const clerkAuthResult = await clerkAuth(options);
18
-
19
- return {
20
- ...clerkAuthResult,
21
- hasPermission: async (
22
- resource: Resource,
23
- action: RoleActions,
24
- record?: Record<string, any>,
25
- ) => {
26
- return hasPermissionForClaims({
27
- claims: clerkAuthResult.sessionClaims,
28
- resource,
29
- action,
30
- record,
31
- });
32
- },
33
- };
34
- }