@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.
- package/dist/clerk/actions/invitations.d.ts +6 -0
- package/dist/clerk/actions/invitations.js +59 -0
- package/dist/clerk/actions/invitations.js.map +1 -0
- package/dist/clerk/actions/systemUsers.d.ts +8 -0
- package/dist/clerk/actions/systemUsers.js +64 -0
- package/dist/clerk/actions/systemUsers.js.map +1 -0
- package/dist/clerk/auth.d.ts +8 -0
- package/dist/clerk/auth.js +21 -0
- package/dist/clerk/auth.js.map +1 -0
- package/dist/clerk/hasPermission.d.ts +33 -0
- package/dist/clerk/hasPermission.js +78 -0
- package/dist/clerk/hasPermission.js.map +1 -0
- package/dist/clerk/rbacConfig.d.ts +31 -0
- package/dist/clerk/rbacConfig.js +48 -0
- package/dist/clerk/rbacConfig.js.map +1 -0
- package/dist/clerk/schemas/invitation.d.ts +12 -0
- package/dist/clerk/schemas/invitation.js +20 -0
- package/dist/clerk/schemas/invitation.js.map +1 -0
- package/dist/clerk/schemas/systemUser.d.ts +6 -0
- package/dist/clerk/toClientSafeUser.d.ts +48 -0
- package/dist/clerk/toClientSafeUser.js +46 -0
- package/dist/clerk/toClientSafeUser.js.map +1 -0
- package/dist/constants/defaults.d.ts +6 -0
- package/dist/constants/defaults.js +56 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/constants/pageLimits.d.ts +2 -0
- package/dist/constants/pageLimits.js +5 -0
- package/dist/constants/pageLimits.js.map +1 -0
- package/dist/index.css +215 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/CMSRootProviders.d.ts +4 -0
- package/dist/providers/CMSRootProviders.js +11 -0
- package/dist/providers/CMSRootProviders.js.map +1 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.d.ts +2 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.js +13 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.js.map +1 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css.js +4 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css.js.map +1 -0
- package/dist/ui/Layout/CMSSecurityLayout.d.ts +2 -0
- package/dist/ui/Layout/CMSSecurityLayout.js +18 -0
- package/dist/ui/Layout/CMSSecurityLayout.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebar.d.ts +6 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebar.js +15 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebar.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.d.ts +4 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.js +18 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.d.ts +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.js +39 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css.js +4 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.d.ts +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.js +16 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css.js +4 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css.js.map +1 -0
- package/dist/ui/Layout/_index.d.ts +2 -0
- package/dist/ui/System/Auth/SignIn/SignIn.d.ts +1 -0
- package/dist/ui/System/Auth/SignIn/SignIn.js +28 -0
- package/dist/ui/System/Auth/SignIn/SignIn.js.map +1 -0
- package/dist/ui/System/Auth/SignIn/SignIn.module.css.js +4 -0
- package/dist/ui/System/Auth/SignIn/SignIn.module.css.js.map +1 -0
- package/dist/ui/System/Auth/SignIn/useSignInForm.d.ts +14 -0
- package/dist/ui/System/Auth/SignIn/useSignInForm.js +46 -0
- package/dist/ui/System/Auth/SignIn/useSignInForm.js.map +1 -0
- package/dist/ui/System/Auth/SignUp/SignUp.d.ts +1 -0
- package/dist/ui/System/Auth/SignUp/SignUp.js +36 -0
- package/dist/ui/System/Auth/SignUp/SignUp.js.map +1 -0
- package/dist/ui/System/Auth/SignUp/SignUp.module.css.js +4 -0
- package/dist/ui/System/Auth/SignUp/SignUp.module.css.js.map +1 -0
- package/dist/ui/System/Auth/SignUp/useSignUpForm.d.ts +19 -0
- package/dist/ui/System/Auth/SignUp/useSignUpForm.js +58 -0
- package/dist/ui/System/Auth/SignUp/useSignUpForm.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationList.d.ts +1 -0
- package/dist/ui/System/Invitations/InvitationList.js +11 -0
- package/dist/ui/System/Invitations/InvitationList.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListActions.d.ts +11 -0
- package/dist/ui/System/Invitations/InvitationListActions.js +39 -0
- package/dist/ui/System/Invitations/InvitationListActions.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListCard.d.ts +4 -0
- package/dist/ui/System/Invitations/InvitationListCard.js +16 -0
- package/dist/ui/System/Invitations/InvitationListCard.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListPage.d.ts +2 -0
- package/dist/ui/System/Invitations/InvitationListPage.js +22 -0
- package/dist/ui/System/Invitations/InvitationListPage.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListPagination.d.ts +4 -0
- package/dist/ui/System/Invitations/InvitationListPagination.js +11 -0
- package/dist/ui/System/Invitations/InvitationListPagination.js.map +1 -0
- package/dist/ui/System/Permissions/RoleListCard.d.ts +6 -0
- package/dist/ui/System/Permissions/RoleListCard.js +11 -0
- package/dist/ui/System/Permissions/RoleListCard.js.map +1 -0
- package/dist/ui/System/Permissions/RolePermissionsPage.d.ts +4 -0
- package/dist/ui/System/Permissions/RolePermissionsPage.js +14 -0
- package/dist/ui/System/Permissions/RolePermissionsPage.js.map +1 -0
- package/dist/ui/System/Permissions/RolePermissionsTable.d.ts +2 -0
- package/dist/ui/System/Permissions/RolePermissionsTable.js +28 -0
- package/dist/ui/System/Permissions/RolePermissionsTable.js.map +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.d.ts +5 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.js +31 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.js.map +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css.js +4 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserPage.d.ts +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserPage.js +17 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserPage.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserActions.d.ts +6 -0
- package/dist/ui/System/SystemUser/SystemUserActions.js +14 -0
- package/dist/ui/System/SystemUser/SystemUserActions.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.d.ts +12 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.js +16 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css.js +4 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.d.ts +11 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.js +26 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css.js +4 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserList.d.ts +1 -0
- package/dist/ui/System/SystemUser/SystemUserList.js +11 -0
- package/dist/ui/System/SystemUser/SystemUserList.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListActions.d.ts +1 -0
- package/dist/ui/System/SystemUser/SystemUserListActions.js +11 -0
- package/dist/ui/System/SystemUser/SystemUserListActions.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListCard.d.ts +11 -0
- package/dist/ui/System/SystemUser/SystemUserListCard.js +34 -0
- package/dist/ui/System/SystemUser/SystemUserListCard.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListPage.d.ts +2 -0
- package/dist/ui/System/SystemUser/SystemUserListPage.js +24 -0
- package/dist/ui/System/SystemUser/SystemUserListPage.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListPagination.d.ts +4 -0
- package/dist/ui/System/SystemUser/SystemUserListPagination.js +11 -0
- package/dist/ui/System/SystemUser/SystemUserListPagination.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserPage.d.ts +1 -0
- package/dist/ui/System/SystemUser/SystemUserPage.js +17 -0
- package/dist/ui/System/SystemUser/SystemUserPage.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserPageContent.d.ts +5 -0
- package/dist/ui/System/SystemUser/SystemUserPageContent.js +13 -0
- package/dist/ui/System/SystemUser/SystemUserPageContent.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.d.ts +6 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.js +21 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css.js +4 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.d.ts +9 -0
- package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.js +19 -0
- package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserTimestamps.d.ts +9 -0
- package/dist/ui/System/SystemUser/SystemUserTimestamps.js +27 -0
- package/dist/ui/System/SystemUser/SystemUserTimestamps.js.map +1 -0
- package/dist/ui/System/WelcomePage/WelcomePage.d.ts +1 -0
- package/dist/ui/System/WelcomePage/WelcomePage.js +16 -0
- package/dist/ui/System/WelcomePage/WelcomePage.js.map +1 -0
- package/dist/ui/System/WelcomePage/WelcomePage.module.css.js +4 -0
- package/dist/ui/System/WelcomePage/WelcomePage.module.css.js.map +1 -0
- package/{src/ui/System/types.ts → dist/ui/System/types.d.ts} +3 -5
- package/dist/utils/proxyFunctions.d.ts +4 -0
- package/dist/utils/proxyFunctions.js +34 -0
- package/dist/utils/proxyFunctions.js.map +1 -0
- package/package.json +14 -14
- package/rollup.config.js +1 -1
- package/.turbo/turbo-build.log +0 -7
- package/CHANGELOG.md +0 -12
- package/eslint.config.js +0 -21
- package/src/clerk/actions/invitations.ts +0 -78
- package/src/clerk/actions/systemUsers.ts +0 -94
- package/src/clerk/auth.ts +0 -34
- package/src/clerk/clerk.d.ts +0 -105
- package/src/clerk/hasPermission.ts +0 -96
- package/src/clerk/rbacConfig.ts +0 -68
- package/src/clerk/schemas/invitation.ts +0 -17
- package/src/clerk/schemas/systemUser.ts +0 -16
- package/src/clerk/toClientSafeUser.ts +0 -77
- package/src/constants/defaults.tsx +0 -62
- package/src/constants/pageLimits.ts +0 -2
- package/src/declaration.d.ts +0 -5
- package/src/providers/CMSRootProviders.tsx +0 -13
- package/src/routes.d.ts +0 -96
- package/src/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css +0 -4
- package/src/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.tsx +0 -16
- package/src/ui/Layout/CMSSecurityLayout.tsx +0 -27
- package/src/ui/Layout/CMSSidebar/CMSSidebar.tsx +0 -39
- package/src/ui/Layout/CMSSidebar/CMSSidebarBody.tsx +0 -43
- package/src/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css +0 -7
- package/src/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.tsx +0 -59
- package/src/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css +0 -44
- package/src/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.tsx +0 -30
- package/src/ui/Layout/_index.ts +0 -2
- package/src/ui/System/Auth/SignIn/SignIn.module.css +0 -50
- package/src/ui/System/Auth/SignIn/SignIn.tsx +0 -79
- package/src/ui/System/Auth/SignIn/useSignInForm.tsx +0 -42
- package/src/ui/System/Auth/SignUp/SignUp.module.css +0 -48
- package/src/ui/System/Auth/SignUp/SignUp.tsx +0 -138
- package/src/ui/System/Auth/SignUp/useSignUpForm.tsx +0 -54
- package/src/ui/System/Invitations/InvitationList.tsx +0 -9
- package/src/ui/System/Invitations/InvitationListActions.tsx +0 -167
- package/src/ui/System/Invitations/InvitationListCard.tsx +0 -79
- package/src/ui/System/Invitations/InvitationListPage.tsx +0 -32
- package/src/ui/System/Invitations/InvitationListPagination.tsx +0 -19
- package/src/ui/System/Permissions/RoleListCard.tsx +0 -33
- package/src/ui/System/Permissions/RolePermissionsPage.tsx +0 -18
- package/src/ui/System/Permissions/RolePermissionsTable.tsx +0 -36
- package/src/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css +0 -5
- package/src/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.tsx +0 -102
- package/src/ui/System/SystemUser/CurrentSystemUserPage.tsx +0 -12
- package/src/ui/System/SystemUser/SystemUserActions.tsx +0 -45
- package/src/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css +0 -6
- package/src/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.tsx +0 -71
- package/src/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css +0 -7
- package/src/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.tsx +0 -114
- package/src/ui/System/SystemUser/SystemUserList.tsx +0 -18
- package/src/ui/System/SystemUser/SystemUserListActions.tsx +0 -17
- package/src/ui/System/SystemUser/SystemUserListCard.tsx +0 -85
- package/src/ui/System/SystemUser/SystemUserListPage.tsx +0 -33
- package/src/ui/System/SystemUser/SystemUserListPagination.tsx +0 -19
- package/src/ui/System/SystemUser/SystemUserPage.tsx +0 -30
- package/src/ui/System/SystemUser/SystemUserPageContent.tsx +0 -54
- package/src/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css +0 -17
- package/src/ui/System/SystemUser/SystemUserRole/SystemUserRole.tsx +0 -64
- package/src/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.tsx +0 -51
- package/src/ui/System/SystemUser/SystemUserTimestamps.tsx +0 -56
- package/src/ui/System/WelcomePage/WelcomePage.module.css +0 -18
- package/src/ui/System/WelcomePage/WelcomePage.tsx +0 -43
- package/src/utils/proxyFunctions.ts +0 -37
- package/tsconfig.json +0 -32
- /package/{src/clerk/_index.ts → dist/clerk/_index.d.ts} +0 -0
- /package/{src/clerk/actions/_index.ts → dist/clerk/actions/_index.d.ts} +0 -0
- /package/{src/clerk/schemas/_index.ts → dist/clerk/schemas/_index.d.ts} +0 -0
- /package/{src/constants/_index.ts → dist/constants/_index.d.ts} +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src/providers/_index.ts → dist/providers/_index.d.ts} +0 -0
- /package/{src/ui/Inputs/_index.ts → dist/ui/Inputs/_index.d.ts} +0 -0
- /package/{src/ui/Layout/CMSSidebar/_index.ts → dist/ui/Layout/CMSSidebar/_index.d.ts} +0 -0
- /package/{src/ui/System/Auth/SignIn/_index.ts → dist/ui/System/Auth/SignIn/_index.d.ts} +0 -0
- /package/{src/ui/System/Auth/SignUp/_index.ts → dist/ui/System/Auth/SignUp/_index.d.ts} +0 -0
- /package/{src/ui/System/Auth/_index.ts → dist/ui/System/Auth/_index.d.ts} +0 -0
- /package/{src/ui/System/Invitations/_index.ts → dist/ui/System/Invitations/_index.d.ts} +0 -0
- /package/{src/ui/System/Permissions/_index.ts → dist/ui/System/Permissions/_index.d.ts} +0 -0
- /package/{src/ui/System/SystemUser/_index.ts → dist/ui/System/SystemUser/_index.d.ts} +0 -0
- /package/{src/ui/System/_index.ts → dist/ui/System/_index.d.ts} +0 -0
- /package/{src/ui/_index.ts → dist/ui/_index.d.ts} +0 -0
- /package/{src/utils/_index.ts → dist/utils/_index.d.ts} +0 -0
package/src/clerk/clerk.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { EmailAddress, User } from "@clerk/nextjs/server";
|
|
2
|
-
import { Role } from "@studiocubics/cms";
|
|
3
|
-
import { WithSign } from "@/clerk/Users";
|
|
4
|
-
import { useUser } from "@clerk/nextjs";
|
|
5
|
-
|
|
6
|
-
type WithSign<T extends string> = `+${T}` | `-${T}` | T;
|
|
7
|
-
export type PaginatedResponse<T> = { data: T; totalCount: number };
|
|
8
|
-
type SessionStatus =
|
|
9
|
-
| "abandoned"
|
|
10
|
-
| "active"
|
|
11
|
-
| "ended"
|
|
12
|
-
| "expired"
|
|
13
|
-
| "removed"
|
|
14
|
-
| "replaced"
|
|
15
|
-
| "revoked";
|
|
16
|
-
|
|
17
|
-
type UserListOrderBy =
|
|
18
|
-
| "created_at"
|
|
19
|
-
| "updated_at"
|
|
20
|
-
| "email_address"
|
|
21
|
-
| "web3wallet"
|
|
22
|
-
| "first_name"
|
|
23
|
-
| "last_name"
|
|
24
|
-
| "phone_number"
|
|
25
|
-
| "username"
|
|
26
|
-
| "last_active_at"
|
|
27
|
-
| "last_sign_in_at";
|
|
28
|
-
|
|
29
|
-
declare global {
|
|
30
|
-
type ClerkClientUser = ReturnType<typeof useUser>["user"];
|
|
31
|
-
type ClerkSessionClaims = NonNullable<
|
|
32
|
-
Awaited<ReturnType<typeof auth>>["sessionClaims"]
|
|
33
|
-
>;
|
|
34
|
-
interface CustomJwtSessionClaims {
|
|
35
|
-
metadata: {
|
|
36
|
-
role?: Role;
|
|
37
|
-
onboardingComplete?: boolean;
|
|
38
|
-
// TODO add currentStatus?:"online"|"offline"
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
interface ClerkUserListParams extends Record<string, any> {
|
|
42
|
-
limit?: number;
|
|
43
|
-
offset?: number;
|
|
44
|
-
orderBy?: WithSign<UserListOrderBy>;
|
|
45
|
-
query?: string;
|
|
46
|
-
}
|
|
47
|
-
interface ClerkUserSessionListParams {
|
|
48
|
-
clientId?: string;
|
|
49
|
-
userId?: string;
|
|
50
|
-
status?: SessionStatus;
|
|
51
|
-
limit?: number;
|
|
52
|
-
offset?: number;
|
|
53
|
-
}
|
|
54
|
-
interface ClerkUserSession {
|
|
55
|
-
id: string;
|
|
56
|
-
clientId: string;
|
|
57
|
-
userId: string;
|
|
58
|
-
status: SessionStatus;
|
|
59
|
-
lastActiveAt: number;
|
|
60
|
-
expireAt: number;
|
|
61
|
-
abandonAt: number;
|
|
62
|
-
createdAt: number;
|
|
63
|
-
updatedAt: number;
|
|
64
|
-
lastActiveOrganizationId?: string;
|
|
65
|
-
latestActivity?: ClerkUserSessionActivity;
|
|
66
|
-
actor: Record<string, unknown> | null;
|
|
67
|
-
}
|
|
68
|
-
interface ClerkUserSessionActivity {
|
|
69
|
-
id: string;
|
|
70
|
-
isMobile: boolean;
|
|
71
|
-
ipAddress?: string;
|
|
72
|
-
city?: string;
|
|
73
|
-
country?: string;
|
|
74
|
-
browserVersion?: string;
|
|
75
|
-
browserName?: string;
|
|
76
|
-
deviceType?: string;
|
|
77
|
-
}
|
|
78
|
-
interface ClerkInvitation {
|
|
79
|
-
id: string;
|
|
80
|
-
emailAddress: string;
|
|
81
|
-
url: string;
|
|
82
|
-
publicMetadata: UserPublicMetadata;
|
|
83
|
-
createdAt: number;
|
|
84
|
-
updatedAt: number;
|
|
85
|
-
status: "pending" | "accepted" | "revoked";
|
|
86
|
-
revoked?: boolean;
|
|
87
|
-
}
|
|
88
|
-
interface ClerkInvitationCreateParams {
|
|
89
|
-
emailAddress: string;
|
|
90
|
-
expiresInDays?: number;
|
|
91
|
-
ignoreExisting?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Whether an email invitation should be sent to the given email address. Defaults to true.
|
|
94
|
-
*/
|
|
95
|
-
notify?: boolean;
|
|
96
|
-
publicMetadata?: UserPublicMetadata;
|
|
97
|
-
redirectUrl?: string;
|
|
98
|
-
templateSlug?: "invitation" | "waitlist_invitation";
|
|
99
|
-
}
|
|
100
|
-
interface ClerkInvitationListParams extends Record<string, any> {
|
|
101
|
-
status?: "pending" | "accepted" | "revoked";
|
|
102
|
-
limit?: number;
|
|
103
|
-
offset?: number;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { auth } from "@clerk/nextjs/server";
|
|
3
|
-
import {
|
|
4
|
-
type Resource,
|
|
5
|
-
type RoleActions,
|
|
6
|
-
type Role,
|
|
7
|
-
RBAC_CONFIG,
|
|
8
|
-
} from "./rbacConfig";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Evaluates RBAC permissions using explicitly provided session claims.
|
|
12
|
-
*
|
|
13
|
-
* @returns `true` if the role defined in `sessionClaims.metadata.role`
|
|
14
|
-
* is allowed to perform `action` on `resource` under RBAC rules.
|
|
15
|
-
*/
|
|
16
|
-
export async function hasPermissionForClaims(args: {
|
|
17
|
-
claims: ClerkSessionClaims;
|
|
18
|
-
resource: Resource;
|
|
19
|
-
action: RoleActions;
|
|
20
|
-
record?: Record<string, any>;
|
|
21
|
-
}): Promise<boolean> {
|
|
22
|
-
if (!("metadata" in args.claims)) return false;
|
|
23
|
-
const role = args.claims?.metadata.role;
|
|
24
|
-
if (!role) return false;
|
|
25
|
-
return checkPermissions({ role, ...args });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Evaluates RBAC permissions for the currently authenticated user.
|
|
30
|
-
*
|
|
31
|
-
* Use this when you do NOT already have session claims.
|
|
32
|
-
*
|
|
33
|
-
* @returns `true` if the current user's role is allowed
|
|
34
|
-
* to perform `action` on `resource` under RBAC rules.
|
|
35
|
-
*/
|
|
36
|
-
export async function hasPermission(args: {
|
|
37
|
-
resource: Resource;
|
|
38
|
-
action: RoleActions;
|
|
39
|
-
record?: Record<string, any>;
|
|
40
|
-
}): Promise<boolean> {
|
|
41
|
-
let claims;
|
|
42
|
-
|
|
43
|
-
const a = await auth();
|
|
44
|
-
claims = a.sessionClaims;
|
|
45
|
-
|
|
46
|
-
const role = claims?.metadata.role;
|
|
47
|
-
if (!role) return false;
|
|
48
|
-
return checkPermissions({
|
|
49
|
-
role,
|
|
50
|
-
claims,
|
|
51
|
-
...args,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
export type PermissionCheckInput = {
|
|
55
|
-
role: Role;
|
|
56
|
-
claims: ClerkSessionClaims;
|
|
57
|
-
resource: Resource;
|
|
58
|
-
action: RoleActions;
|
|
59
|
-
record?: Record<string, any>;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Core RBAC policy evaluator.
|
|
64
|
-
*
|
|
65
|
-
* This is the authorization engine shared by all permission checks.
|
|
66
|
-
* It does NOT perform authentication or session resolution.
|
|
67
|
-
*
|
|
68
|
-
* Rules:
|
|
69
|
-
* - `isSystem` roles bypass all checks
|
|
70
|
-
* - permissions are matched by `{ resource, action }`
|
|
71
|
-
* - optional ownership constraints are enforced via `ownerField`
|
|
72
|
-
* @param {PermissionCheckInput} args
|
|
73
|
-
* @returns `true` if at least one permission grants access
|
|
74
|
-
*/
|
|
75
|
-
function checkPermissions(args: PermissionCheckInput) {
|
|
76
|
-
const def = RBAC_CONFIG[args.role];
|
|
77
|
-
if (!def) return false;
|
|
78
|
-
|
|
79
|
-
// Allow system
|
|
80
|
-
if (def.isSystem) return true;
|
|
81
|
-
|
|
82
|
-
// Iterate over all permissions
|
|
83
|
-
for (const p of def.permissions) {
|
|
84
|
-
if (p.resource !== args.resource) continue;
|
|
85
|
-
if (!p.actions?.[args.action]) continue;
|
|
86
|
-
|
|
87
|
-
// Ownership conditions
|
|
88
|
-
if (p.conditions?.ownerField && args.record) {
|
|
89
|
-
const ownerField = p.conditions.ownerField;
|
|
90
|
-
if (args.record[ownerField] !== args.claims.id) continue;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
}
|
package/src/clerk/rbacConfig.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export const roles = ["admin", "manager", "member"] as const;
|
|
2
|
-
export const resources = ["systemUsers", "projects", "invitations"] as const;
|
|
3
|
-
|
|
4
|
-
export const RBAC_CONFIG: {
|
|
5
|
-
[K in Role]: RoleDoc;
|
|
6
|
-
} = {
|
|
7
|
-
admin: {
|
|
8
|
-
desc: "Full system authority with unrestricted access and management capabilities.",
|
|
9
|
-
isSystem: true,
|
|
10
|
-
permissions: [], // system role bypasses all checks
|
|
11
|
-
},
|
|
12
|
-
manager: {
|
|
13
|
-
desc: "Responsible for overseeing teams and resources; can manage existing items and invite users.",
|
|
14
|
-
inherits: ["member"],
|
|
15
|
-
permissions: [
|
|
16
|
-
{
|
|
17
|
-
resource: "systemUsers",
|
|
18
|
-
actions: { create: true, read: true, update: true },
|
|
19
|
-
conditions: { ownerField: "id" },
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
resource: "projects",
|
|
23
|
-
actions: { create: true, read: true, update: true, delete: true },
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
resource: "invitations",
|
|
27
|
-
actions: { create: true, read: true, update: true, delete: true },
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
member: {
|
|
32
|
-
desc: "Standard user with read-level access to assigned resources; limited modification rights.",
|
|
33
|
-
permissions: [
|
|
34
|
-
{ resource: "systemUsers", actions: { read: true } },
|
|
35
|
-
{ resource: "projects", actions: { read: true } },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
} as const;
|
|
39
|
-
|
|
40
|
-
export type Role = (typeof roles)[number];
|
|
41
|
-
export type Resource = (typeof resources)[number];
|
|
42
|
-
|
|
43
|
-
export type RoleActions = "create" | "read" | "update" | "delete";
|
|
44
|
-
|
|
45
|
-
export type ResourcePermission = {
|
|
46
|
-
resource: Resource;
|
|
47
|
-
actions: Partial<Record<RoleActions, boolean>>;
|
|
48
|
-
conditions?: {
|
|
49
|
-
ownerField?: string; // e.g. “creatorId”
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export type RoleDoc = {
|
|
53
|
-
desc?: string;
|
|
54
|
-
inherits?: string[];
|
|
55
|
-
isSystem?: boolean;
|
|
56
|
-
permissions: ResourcePermission[];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const getInvitationPublicMetadata = (role: Role) => {
|
|
60
|
-
switch (role) {
|
|
61
|
-
case "admin":
|
|
62
|
-
return { role, onboardingComplete: true };
|
|
63
|
-
case "manager":
|
|
64
|
-
return { role, onboardingComplete: true };
|
|
65
|
-
default:
|
|
66
|
-
return { role, onboardingComplete: false };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { roles } from "../rbacConfig";
|
|
3
|
-
|
|
4
|
-
export const createInvitationSchema = z.object({
|
|
5
|
-
emailAddress: z.string(),
|
|
6
|
-
expiresInDays: z
|
|
7
|
-
.preprocess((val) => {
|
|
8
|
-
if (typeof val === "string") {
|
|
9
|
-
return Number.parseInt(val);
|
|
10
|
-
}
|
|
11
|
-
return val;
|
|
12
|
-
}, z.number())
|
|
13
|
-
.optional(),
|
|
14
|
-
ignoreExisting: z.boolean().default(false).optional(),
|
|
15
|
-
notify: z.boolean().default(true).optional(),
|
|
16
|
-
role: z.enum(roles),
|
|
17
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
const MAX_UPLOAD_SIZE = 1024 * 1024 * 5; // 10MB
|
|
3
|
-
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/png"];
|
|
4
|
-
export const systemUserUpdateSchema = z.object({
|
|
5
|
-
firstName: z.string().max(25).min(2),
|
|
6
|
-
lastName: z.string().max(25).min(2),
|
|
7
|
-
imageFile: z
|
|
8
|
-
.file()
|
|
9
|
-
.refine((f) => f.size <= MAX_UPLOAD_SIZE, {
|
|
10
|
-
error: "Image size is larger than >10MB",
|
|
11
|
-
})
|
|
12
|
-
.refine(
|
|
13
|
-
(f) => ACCEPTED_IMAGE_TYPES.includes(f.type),
|
|
14
|
-
"Only .jpg and .png formats are supported.",
|
|
15
|
-
),
|
|
16
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { User } from "@clerk/nextjs/server";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Client-safe representation of a Clerk User.
|
|
5
|
-
*
|
|
6
|
-
* This intentionally excludes any sensitive or server-only fields
|
|
7
|
-
* (e.g. privateMetadata, externalAccounts with tokens, etc.)
|
|
8
|
-
* and contains only JSON-serializable data that is safe to pass
|
|
9
|
-
* from Server Components to Client Components.
|
|
10
|
-
*/
|
|
11
|
-
export type ClientSafeUser = {
|
|
12
|
-
id: string;
|
|
13
|
-
username: string | null;
|
|
14
|
-
firstName: string | null;
|
|
15
|
-
lastName: string | null;
|
|
16
|
-
fullName: string | null;
|
|
17
|
-
imageUrl: string;
|
|
18
|
-
primaryEmailAddress: {
|
|
19
|
-
id: string;
|
|
20
|
-
emailAddress: string;
|
|
21
|
-
verified: boolean;
|
|
22
|
-
};
|
|
23
|
-
emailAddresses: Array<{
|
|
24
|
-
id: string;
|
|
25
|
-
emailAddress: string;
|
|
26
|
-
verified: boolean;
|
|
27
|
-
}>;
|
|
28
|
-
publicMetadata: CustomJwtSessionClaims["metadata"];
|
|
29
|
-
createdAt: Date | null;
|
|
30
|
-
updatedAt: Date | null;
|
|
31
|
-
lastSignInAt: Date | null;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Converts a Clerk `User` (server-side) into a client-safe, serializable object.
|
|
36
|
-
*
|
|
37
|
-
* Why this exists:
|
|
38
|
-
* - The Clerk `User` class contains methods and non-serializable fields.
|
|
39
|
-
* - Passing it directly to a Client Component will break React Server Components.
|
|
40
|
-
* - This function strips the object down to stable, safe primitives only.
|
|
41
|
-
*
|
|
42
|
-
* Rules enforced here:
|
|
43
|
-
* - No functions
|
|
44
|
-
* - No circular references
|
|
45
|
-
* - No private or sensitive data
|
|
46
|
-
*
|
|
47
|
-
* @param user Clerk User instance from `@clerk/nextjs/server`
|
|
48
|
-
* @returns ClientSafeUser plain object
|
|
49
|
-
*/
|
|
50
|
-
export function toClientSafeUser(user: User): ClientSafeUser {
|
|
51
|
-
const pea = user.emailAddresses.find(
|
|
52
|
-
(ea) => ea.id == user.primaryEmailAddressId
|
|
53
|
-
);
|
|
54
|
-
if (!pea) throw new Error("Missing primaryEmailAddress");
|
|
55
|
-
return {
|
|
56
|
-
id: user.id,
|
|
57
|
-
username: user.username,
|
|
58
|
-
firstName: user.firstName,
|
|
59
|
-
lastName: user.lastName,
|
|
60
|
-
fullName: user.fullName,
|
|
61
|
-
imageUrl: user.imageUrl,
|
|
62
|
-
primaryEmailAddress: {
|
|
63
|
-
id: pea.id,
|
|
64
|
-
emailAddress: pea.emailAddress,
|
|
65
|
-
verified: pea.verification?.status === "verified",
|
|
66
|
-
},
|
|
67
|
-
emailAddresses: user.emailAddresses.map((email) => ({
|
|
68
|
-
id: email.id,
|
|
69
|
-
emailAddress: email.emailAddress,
|
|
70
|
-
verified: email.verification?.status === "verified",
|
|
71
|
-
})),
|
|
72
|
-
publicMetadata: user.publicMetadata ?? {},
|
|
73
|
-
createdAt: new Date(user.createdAt),
|
|
74
|
-
updatedAt: new Date(user.updatedAt),
|
|
75
|
-
lastSignInAt: user.lastSignInAt ? new Date(user.lastSignInAt) : null,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ListItemProps, TabProps } from "@studiocubics/ui";
|
|
2
|
-
import { Titillium_Web, Outfit } from "next/font/google";
|
|
3
|
-
import {
|
|
4
|
-
Newspaper,
|
|
5
|
-
Settings,
|
|
6
|
-
ShieldUser,
|
|
7
|
-
SquareUser,
|
|
8
|
-
DoorClosedLocked,
|
|
9
|
-
Users,
|
|
10
|
-
Send,
|
|
11
|
-
} from "lucide-react";
|
|
12
|
-
|
|
13
|
-
export const defaultNavLinks: ListItemProps[] = [
|
|
14
|
-
{
|
|
15
|
-
startIcon: <Newspaper />,
|
|
16
|
-
children: "Content",
|
|
17
|
-
href: "/dashboard/content",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
startIcon: <ShieldUser />,
|
|
21
|
-
href: "/dashboard/security",
|
|
22
|
-
children: "Security",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
startIcon: <Settings />,
|
|
26
|
-
href: "/dashboard/settings",
|
|
27
|
-
children: "Settings",
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
export const defaultSecurityLinks: TabProps[] = [
|
|
31
|
-
{
|
|
32
|
-
children: "Your Account",
|
|
33
|
-
startIcon: <SquareUser />,
|
|
34
|
-
href: "/dashboard/security/account",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
children: "Roles & Permissions",
|
|
38
|
-
startIcon: <DoorClosedLocked />,
|
|
39
|
-
href: "/dashboard/security/permissions",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
children: "System Users",
|
|
43
|
-
startIcon: <Users />,
|
|
44
|
-
href: "/dashboard/security/systemUsers",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
children: "Invitations",
|
|
48
|
-
startIcon: <Send />,
|
|
49
|
-
href: "/dashboard/security/invitations",
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
export const fontH = Outfit({
|
|
53
|
-
variable: "--font-h",
|
|
54
|
-
subsets: ["latin"],
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export const fontP = Titillium_Web({
|
|
58
|
-
variable: "--font-p",
|
|
59
|
-
weight: ["200", "400", "600", "700", "900"],
|
|
60
|
-
subsets: ["latin"],
|
|
61
|
-
});
|
|
62
|
-
export const defaultBodyClassName = `${fontH.variable} ${fontP.variable}`;
|
package/src/declaration.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ThemeProvider } from "next-themes";
|
|
4
|
-
import type { ReactNode } from "react";
|
|
5
|
-
import { ClerkProvider } from "@clerk/nextjs";
|
|
6
|
-
|
|
7
|
-
export function CMSRootProviders({ children }: { children: ReactNode }) {
|
|
8
|
-
return (
|
|
9
|
-
<ThemeProvider enableSystem>
|
|
10
|
-
<ClerkProvider>{children}</ClerkProvider>
|
|
11
|
-
</ThemeProvider>
|
|
12
|
-
);
|
|
13
|
-
}
|
package/src/routes.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
type AppRoutes =
|
|
2
|
-
| "/"
|
|
3
|
-
| "/auth/requestAccount"
|
|
4
|
-
| "/auth/signIn/[[...signIn]]"
|
|
5
|
-
| "/auth/signUp/[[...signUp]]"
|
|
6
|
-
| "/dashboard"
|
|
7
|
-
| "/dashboard/content"
|
|
8
|
-
| "/dashboard/content/projects"
|
|
9
|
-
| "/dashboard/security"
|
|
10
|
-
| "/dashboard/security/account"
|
|
11
|
-
| "/dashboard/security/invitations"
|
|
12
|
-
| "/dashboard/security/permissions"
|
|
13
|
-
| "/dashboard/security/systemUsers"
|
|
14
|
-
| "/dashboard/security/systemUsers/[userId]"
|
|
15
|
-
| "/dashboard/security/systemUsers/[userId]/sessions"
|
|
16
|
-
| "/dashboard/settings";
|
|
17
|
-
type PageRoutes = never;
|
|
18
|
-
type LayoutRoutes = "/" | "/auth" | "/dashboard" | "/dashboard/security";
|
|
19
|
-
type RedirectRoutes = never;
|
|
20
|
-
type RewriteRoutes = never;
|
|
21
|
-
type Routes =
|
|
22
|
-
| AppRoutes
|
|
23
|
-
| PageRoutes
|
|
24
|
-
| LayoutRoutes
|
|
25
|
-
| RedirectRoutes
|
|
26
|
-
| RewriteRoutes;
|
|
27
|
-
|
|
28
|
-
interface ParamMap {
|
|
29
|
-
"/": {};
|
|
30
|
-
"/auth": {};
|
|
31
|
-
"/auth/requestAccount": {};
|
|
32
|
-
"/auth/signIn/[[...signIn]]": { signIn?: string[] };
|
|
33
|
-
"/auth/signUp/[[...signUp]]": { signUp?: string[] };
|
|
34
|
-
"/dashboard": {};
|
|
35
|
-
"/dashboard/content": {};
|
|
36
|
-
"/dashboard/content/projects": {};
|
|
37
|
-
"/dashboard/security": {};
|
|
38
|
-
"/dashboard/security/account": {};
|
|
39
|
-
"/dashboard/security/invitations": {};
|
|
40
|
-
"/dashboard/security/permissions": {};
|
|
41
|
-
"/dashboard/security/systemUsers": {};
|
|
42
|
-
"/dashboard/security/systemUsers/[userId]": { userId: string };
|
|
43
|
-
"/dashboard/security/systemUsers/[userId]/sessions": { userId: string };
|
|
44
|
-
"/dashboard/settings": {};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type ParamsOf<Route extends Routes> = ParamMap[Route];
|
|
48
|
-
|
|
49
|
-
interface LayoutSlotMap {
|
|
50
|
-
"/": never;
|
|
51
|
-
"/auth": never;
|
|
52
|
-
"/dashboard": never;
|
|
53
|
-
"/dashboard/security": never;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type {
|
|
57
|
-
AppRoutes,
|
|
58
|
-
PageRoutes,
|
|
59
|
-
LayoutRoutes,
|
|
60
|
-
RedirectRoutes,
|
|
61
|
-
RewriteRoutes,
|
|
62
|
-
ParamMap,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
declare global {
|
|
66
|
-
/**
|
|
67
|
-
* Props for Next.js App Router page components
|
|
68
|
-
* @example
|
|
69
|
-
* ```tsx
|
|
70
|
-
* export default function Page(props: PageProps<'/blog/[slug]'>) {
|
|
71
|
-
* const { slug } = await props.params
|
|
72
|
-
* return <div>Blog post: {slug}</div>
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
interface PageProps<AppRoute extends AppRoutes> {
|
|
77
|
-
params: Promise<ParamMap[AppRoute]>;
|
|
78
|
-
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Props for Next.js App Router layout components
|
|
83
|
-
* @example
|
|
84
|
-
* ```tsx
|
|
85
|
-
* export default function Layout(props: LayoutProps<'/dashboard'>) {
|
|
86
|
-
* return <div>{props.children}</div>
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
type LayoutProps<LayoutRoute extends LayoutRoutes> = {
|
|
91
|
-
params: Promise<ParamMap[LayoutRoute]>;
|
|
92
|
-
children: React.ReactNode;
|
|
93
|
-
} & {
|
|
94
|
-
[K in LayoutSlotMap[LayoutRoute]]: React.ReactNode;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Editor, type EditorProps } from "@monaco-editor/react";
|
|
4
|
-
import { useTheme } from "next-themes";
|
|
5
|
-
import styles from "./ThemedMonacoEditor.module.css";
|
|
6
|
-
export function ThemedMonacoEditor(props: EditorProps) {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<Editor
|
|
11
|
-
className={styles.root}
|
|
12
|
-
theme={theme.resolvedTheme == "dark" ? "vs-dark" : "vs-light"}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { PageLayoutTabs, type PageLayoutTabsProps } from "@studiocubics/ui";
|
|
4
|
-
import Link from "next/link";
|
|
5
|
-
import { usePathname } from "next/navigation";
|
|
6
|
-
|
|
7
|
-
export function CMSSecurityLayout(
|
|
8
|
-
props: Omit<PageLayoutTabsProps, "title" | "subtitle" | "selectedIndex">,
|
|
9
|
-
) {
|
|
10
|
-
const { menuItems } = props;
|
|
11
|
-
const pathname = usePathname();
|
|
12
|
-
const selectedItem = menuItems?.find(
|
|
13
|
-
(mi) => mi.href && pathname.startsWith(mi.href),
|
|
14
|
-
);
|
|
15
|
-
const selectedIndex = selectedItem
|
|
16
|
-
? menuItems?.indexOf(selectedItem)
|
|
17
|
-
: undefined;
|
|
18
|
-
return (
|
|
19
|
-
<PageLayoutTabs
|
|
20
|
-
{...props}
|
|
21
|
-
subtitle={"Manage your account and other System security options"}
|
|
22
|
-
title={"Security"}
|
|
23
|
-
selectedIndex={selectedIndex}
|
|
24
|
-
LinkComponent={Link}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Sidebar,
|
|
3
|
-
SidebarViewport,
|
|
4
|
-
SidebarDrawer,
|
|
5
|
-
type ListItemProps,
|
|
6
|
-
} from "@studiocubics/ui";
|
|
7
|
-
import type { ReactNode } from "react";
|
|
8
|
-
import { CMSSidebarHeader } from "./CMSSidebarHeader/CMSSidebarHeader";
|
|
9
|
-
import { CMSSidebarFooter } from "./CMSSidebarFooter/CMSSidebarFooter";
|
|
10
|
-
import { CMSSidebarBody } from "./CMSSidebarBody";
|
|
11
|
-
import { cookies } from "next/headers";
|
|
12
|
-
|
|
13
|
-
export async function CMSSidebar({
|
|
14
|
-
children,
|
|
15
|
-
sidebarLinks,
|
|
16
|
-
}: {
|
|
17
|
-
children: ReactNode;
|
|
18
|
-
sidebarLinks: ListItemProps[];
|
|
19
|
-
}) {
|
|
20
|
-
const cookieStore = await cookies();
|
|
21
|
-
const defaultOpen = cookieStore.get("sidebarOpen")?.value === "true";
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div style={{ height: "100dvh" }}>
|
|
25
|
-
<Sidebar defaultOpen={defaultOpen}>
|
|
26
|
-
<SidebarDrawer>
|
|
27
|
-
<CMSSidebarHeader />
|
|
28
|
-
<CMSSidebarBody sidebarLinks={sidebarLinks} />
|
|
29
|
-
<CMSSidebarFooter />
|
|
30
|
-
</SidebarDrawer>
|
|
31
|
-
<SidebarViewport
|
|
32
|
-
style={{ backgroundColor: "var(--color-surface-alpha)" }}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</SidebarViewport>
|
|
36
|
-
</Sidebar>
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
}
|