create-bw-app 0.18.2 → 0.18.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-bw-app",
3
3
  "private": false,
4
- "version": "0.18.2",
4
+ "version": "0.18.4",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "create-bw-app": "bin/create-bw-app.mjs",
package/src/constants.mjs CHANGED
@@ -61,6 +61,8 @@ export const MODULE_STARTER_FILES = {
61
61
  admin: [
62
62
  "app/api/admin/users/route.ts",
63
63
  "app/api/admin/users/roles/route.ts",
64
+ "app/api/admin/users/invitations/route.ts",
65
+ "app/api/admin/users/invitations/[invitationId]/route.ts",
64
66
  "app/(shell)/admin/users/page.tsx",
65
67
  ],
66
68
  crm: [
@@ -136,7 +138,6 @@ export const PLATFORM_STARTER_FILES = [
136
138
  "app/(auth)/auth-provider.tsx",
137
139
  "app/(auth)/layout.tsx",
138
140
  "app/(auth)/login/page.tsx",
139
- "app/(auth)/signup/page.tsx",
140
141
  "app/(auth)/forgot-password/page.tsx",
141
142
  "app/(auth)/reset-password/page.tsx",
142
143
  "app/(auth)/auth/post-login/page.tsx",
@@ -166,14 +167,14 @@ export const PLATFORM_STARTER_FILES = [
166
167
  ];
167
168
 
168
169
  export const APP_DEPENDENCY_DEFAULTS = {
169
- "@brightweblabs/app-shell": "^0.7.1",
170
- "@brightweblabs/core-auth": "^0.7.1",
170
+ "@brightweblabs/app-shell": "^0.7.3",
171
+ "@brightweblabs/core-auth": "^0.7.2",
171
172
  "@brightweblabs/infra": "^0.4.0",
172
- "@brightweblabs/module-admin": "^0.5.7",
173
- "@brightweblabs/module-crm": "^0.9.2",
174
- "@brightweblabs/module-marketing": "^0.2.6",
175
- "@brightweblabs/module-orgs": "^0.3.7",
176
- "@brightweblabs/module-projects": "^0.8.0",
173
+ "@brightweblabs/module-admin": "^0.5.9",
174
+ "@brightweblabs/module-crm": "^0.9.4",
175
+ "@brightweblabs/module-marketing": "^0.2.8",
176
+ "@brightweblabs/module-orgs": "^0.3.9",
177
+ "@brightweblabs/module-projects": "^0.8.2",
177
178
  "@brightweblabs/theme": "^0.5.0",
178
179
  "@brightweblabs/ui": "^1.1.1",
179
180
  "geist": "1.7.2",
package/src/generator.mjs CHANGED
@@ -488,7 +488,6 @@ function createGitignore() {
488
488
  function getPlatformStarterRoutes(selectedModules) {
489
489
  return [
490
490
  "/login",
491
- "/signup",
492
491
  "/forgot-password",
493
492
  "/reset-password",
494
493
  "/account",
@@ -8,7 +8,9 @@ import {
8
8
  DesktopSidebar,
9
9
  MobileNav,
10
10
  computeInitials,
11
+ isShellNavItemActive,
11
12
  useShellNavState,
13
+ type ShellContextualAction,
12
14
  type ShellNavStateGroup,
13
15
  } from "@brightweblabs/app-shell";
14
16
  import { createAuthUiClient } from "@brightweblabs/core-auth/ui";
@@ -25,6 +27,11 @@ export type ShellViewer = {
25
27
  };
26
28
 
27
29
  const authClient = createAuthUiClient();
30
+ const toolbarWindowEventByAction: Record<string, string> = {
31
+ "projects-refresh": "projects:refresh",
32
+ "projects-new-menu": "projects:open-new-project",
33
+ "crm-create-menu": "brightweb:crm:create-contact",
34
+ };
28
35
 
29
36
  export function ShellLayoutClient({
30
37
  children,
@@ -46,12 +53,43 @@ export function ShellLayoutClient({
46
53
  const { isSidebarCollapsed, isGroupOpen, toggleGroup, toggleSidebar } =
47
54
  useShellNavState({ pathname, groups: shellGroups });
48
55
  const isAdminSurface = pathname === "/admin" || pathname.startsWith("/admin/");
49
- const isActive = (href: string) =>
50
- pathname === href || (isAdminSurface && pathname.startsWith(`${href}/`));
56
+ const shellNavItems = [
57
+ ...config.primaryNav,
58
+ ...(config.adminNavItem ? [config.adminNavItem] : []),
59
+ ...config.toolsSection.items,
60
+ ...config.moduleGroups.flatMap((group) => group.children),
61
+ ];
62
+ const activeNavItem = shellNavItems.reduce<(typeof shellNavItems)[number] | undefined>(
63
+ (active, item) => isShellNavItemActive(pathname, item)
64
+ && (!active || item.href.length > active.href.length)
65
+ ? item
66
+ : active,
67
+ undefined,
68
+ );
69
+ const isActive = (href: string) => activeNavItem?.href === href;
51
70
  const displayName =
52
71
  [viewer.firstName, viewer.lastName].filter(Boolean).join(" ") ||
53
72
  viewer.email ||
54
73
  "Conta";
74
+ const projectsBaseHref = pathname.startsWith("/projects") ? "/projects" : "/projetos";
75
+
76
+ const handleToolbarAction = (item: ShellContextualAction) => {
77
+ if (item.action === "projects-back-to-portfolio") {
78
+ router.push(projectsBaseHref);
79
+ return;
80
+ }
81
+ if (item.action === "projects-open-board") {
82
+ const projectId = pathname.split("/")[2];
83
+ if (projectId) {
84
+ router.push(`${projectsBaseHref}/${projectId}/${projectsBaseHref === "/projects" ? "tasks" : "tarefas"}`);
85
+ }
86
+ return;
87
+ }
88
+
89
+ if (item.action) {
90
+ window.dispatchEvent(new Event(toolbarWindowEventByAction[item.action] ?? item.action));
91
+ }
92
+ };
55
93
 
56
94
  return (
57
95
  <AppShellFrame
@@ -100,15 +138,20 @@ export function ShellLayoutClient({
100
138
  }
101
139
  header={
102
140
  <AppHeader
141
+ title={activeNavItem?.label}
103
142
  pathname={pathname}
104
143
  toolbarRoutes={toolbarRoutes}
105
144
  toolbarActions={toolbarActions}
106
- />
145
+ onToolbarAction={handleToolbarAction}
146
+ >
147
+ {null}
148
+ </AppHeader>
107
149
  }
108
150
  mobileNav={
109
151
  <MobileNav
110
152
  toolsExpanded={isGroupOpen(config.toolsSection.key)}
111
153
  visiblePrimaryNav={config.primaryNav}
154
+ adminNavItem={viewer.isAdmin ? config.adminNavItem : null}
112
155
  visibleToolNav={config.toolsSection.items}
113
156
  navGroups={config.moduleGroups}
114
157
  isNavItemActive={isActive}
@@ -0,0 +1,9 @@
1
+ export async function DELETE(
2
+ request: Request,
3
+ context: { params: Promise<{ invitationId: string }> },
4
+ ) {
5
+ const { handleAdminUserInvitationDeleteRequest } = await import("@brightweblabs/module-admin");
6
+ return handleAdminUserInvitationDeleteRequest(request, context);
7
+ }
8
+
9
+ export const dynamic = "force-dynamic";
@@ -0,0 +1,11 @@
1
+ export async function GET() {
2
+ const { handleAdminUserInvitationsGetRequest } = await import("@brightweblabs/module-admin");
3
+ return handleAdminUserInvitationsGetRequest();
4
+ }
5
+
6
+ export async function POST(request: Request) {
7
+ const { handleAdminUserInvitationsPostRequest } = await import("@brightweblabs/module-admin");
8
+ return handleAdminUserInvitationsPostRequest(request);
9
+ }
10
+
11
+ export const dynamic = "force-dynamic";
@@ -1 +0,0 @@
1
- export { SignupPage as default } from "@brightweblabs/core-auth/ui";