@nextsparkjs/core 0.1.0-beta.82 → 0.1.0-beta.83
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/components/entities/wrappers/EntityDetailWrapper.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityDetailWrapper.js +11 -39
- package/dist/hooks/useEntityQuery.d.ts.map +1 -1
- package/dist/hooks/useEntityQuery.js +21 -3
- package/dist/lib/theme/get-default-theme-mode.d.ts +11 -0
- package/dist/lib/theme/get-default-theme-mode.d.ts.map +1 -1
- package/dist/lib/theme/get-default-theme-mode.js +42 -25
- package/dist/styles/classes.json +1 -1
- package/dist/types/theme.d.ts +2 -0
- package/dist/types/theme.d.ts.map +1 -1
- package/package.json +16 -16
- package/scripts/build/docs-registry.mjs +0 -0
- package/scripts/create-theme.mjs +0 -0
- package/scripts/deploy/release-version.mjs +0 -0
- package/scripts/deploy/vercel-deploy.mjs +0 -0
- package/scripts/dev/watch-plugins.mjs +0 -0
- package/scripts/maintenance/update-core.mjs +0 -0
- package/scripts/setup/npm-postinstall.mjs +0 -0
- package/scripts/setup/setup-claude.mjs +0 -0
- package/scripts/validation/check-imports.sh +0 -0
- package/dist/templates/app/(auth)/forgot-password/page.tsx +0 -216
- package/dist/templates/app/(auth)/layout.tsx +0 -51
- package/dist/templates/app/(auth)/login/page.tsx +0 -21
- package/dist/templates/app/(auth)/reset-password/page.tsx +0 -212
- package/dist/templates/app/(auth)/signup/page.tsx +0 -21
- package/dist/templates/app/(auth)/verify-email/page.tsx +0 -190
- package/dist/templates/app/(public)/[...slug]/page.tsx +0 -378
- package/dist/templates/app/(public)/docs/[section]/[page]/page.tsx +0 -90
- package/dist/templates/app/(public)/docs/layout.tsx +0 -25
- package/dist/templates/app/(public)/docs/page.tsx +0 -81
- package/dist/templates/app/(public)/layout.tsx +0 -41
- package/dist/templates/app/(public)/page.tsx +0 -19
- package/dist/templates/app/403/page.tsx +0 -89
- package/dist/templates/app/api/auth/[...all]/route.ts +0 -78
- package/dist/templates/app/api/cron/billing/lifecycle/route.ts +0 -98
- package/dist/templates/app/api/csp-report/route.ts +0 -175
- package/dist/templates/app/api/devtools/config/entities/route.ts +0 -108
- package/dist/templates/app/api/devtools/config/theme/route.ts +0 -66
- package/dist/templates/app/api/devtools/tests/[...path]/route.ts +0 -130
- package/dist/templates/app/api/devtools/tests/route.ts +0 -134
- package/dist/templates/app/api/health/route.ts +0 -29
- package/dist/templates/app/api/internal/user-metadata/route.ts +0 -36
- package/dist/templates/app/api/superadmin/subscriptions/route.ts +0 -310
- package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +0 -286
- package/dist/templates/app/api/superadmin/teams/route.ts +0 -188
- package/dist/templates/app/api/superadmin/users/[userId]/route.ts +0 -540
- package/dist/templates/app/api/superadmin/users/route.ts +0 -323
- package/dist/templates/app/api/user/delete-account/route.ts +0 -55
- package/dist/templates/app/api/user/plan-flags/route.ts +0 -283
- package/dist/templates/app/api/user/profile/route.ts +0 -133
- package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +0 -210
- package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +0 -331
- package/dist/templates/app/api/v1/[entity]/[id]/route.ts +0 -35
- package/dist/templates/app/api/v1/[entity]/docs.md +0 -369
- package/dist/templates/app/api/v1/[entity]/presets.ts +0 -194
- package/dist/templates/app/api/v1/[entity]/route.ts +0 -31
- package/dist/templates/app/api/v1/api-keys/[id]/route.ts +0 -303
- package/dist/templates/app/api/v1/api-keys/docs.md +0 -101
- package/dist/templates/app/api/v1/api-keys/presets.ts +0 -31
- package/dist/templates/app/api/v1/api-keys/route.ts +0 -250
- package/dist/templates/app/api/v1/auth/docs.md +0 -184
- package/dist/templates/app/api/v1/auth/presets.ts +0 -44
- package/dist/templates/app/api/v1/auth/signup-with-invite/route.ts +0 -227
- package/dist/templates/app/api/v1/billing/cancel/route.ts +0 -206
- package/dist/templates/app/api/v1/billing/change-plan/route.ts +0 -97
- package/dist/templates/app/api/v1/billing/check-action/route.ts +0 -81
- package/dist/templates/app/api/v1/billing/checkout/route.ts +0 -124
- package/dist/templates/app/api/v1/billing/docs.md +0 -209
- package/dist/templates/app/api/v1/billing/plans/route.ts +0 -85
- package/dist/templates/app/api/v1/billing/portal/route.ts +0 -90
- package/dist/templates/app/api/v1/billing/presets.ts +0 -121
- package/dist/templates/app/api/v1/billing/webhooks/stripe/route.ts +0 -428
- package/dist/templates/app/api/v1/blocks/[slug]/route.ts +0 -29
- package/dist/templates/app/api/v1/blocks/docs.md +0 -173
- package/dist/templates/app/api/v1/blocks/presets.ts +0 -121
- package/dist/templates/app/api/v1/blocks/route.ts +0 -45
- package/dist/templates/app/api/v1/blocks/validate/route.ts +0 -45
- package/dist/templates/app/api/v1/cron/docs.md +0 -116
- package/dist/templates/app/api/v1/cron/presets.ts +0 -26
- package/dist/templates/app/api/v1/cron/process/route.ts +0 -108
- package/dist/templates/app/api/v1/devtools/blocks/route.ts +0 -82
- package/dist/templates/app/api/v1/devtools/docs/route.ts +0 -150
- package/dist/templates/app/api/v1/devtools/docs.md +0 -204
- package/dist/templates/app/api/v1/devtools/features/route.ts +0 -61
- package/dist/templates/app/api/v1/devtools/flows/route.ts +0 -61
- package/dist/templates/app/api/v1/devtools/presets.ts +0 -113
- package/dist/templates/app/api/v1/devtools/scheduled-actions/route.ts +0 -120
- package/dist/templates/app/api/v1/devtools/testing/route.ts +0 -82
- package/dist/templates/app/api/v1/media/docs.md +0 -117
- package/dist/templates/app/api/v1/media/presets.ts +0 -24
- package/dist/templates/app/api/v1/media/upload/route.ts +0 -150
- package/dist/templates/app/api/v1/patterns/[id]/usages/route.ts +0 -116
- package/dist/templates/app/api/v1/plugin/[...path]/route.ts +0 -373
- package/dist/templates/app/api/v1/plugin/docs.md +0 -79
- package/dist/templates/app/api/v1/plugin/presets.ts +0 -21
- package/dist/templates/app/api/v1/plugin/route.ts +0 -96
- package/dist/templates/app/api/v1/post-categories/[id]/route.ts +0 -255
- package/dist/templates/app/api/v1/post-categories/docs.md +0 -134
- package/dist/templates/app/api/v1/post-categories/presets.ts +0 -78
- package/dist/templates/app/api/v1/post-categories/route.ts +0 -119
- package/dist/templates/app/api/v1/team-invitations/[token]/accept/route.ts +0 -179
- package/dist/templates/app/api/v1/team-invitations/[token]/decline/route.ts +0 -120
- package/dist/templates/app/api/v1/team-invitations/[token]/route.ts +0 -89
- package/dist/templates/app/api/v1/team-invitations/docs.md +0 -88
- package/dist/templates/app/api/v1/team-invitations/presets.ts +0 -43
- package/dist/templates/app/api/v1/team-invitations/route.ts +0 -114
- package/dist/templates/app/api/v1/teams/[teamId]/invitations/route.ts +0 -171
- package/dist/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +0 -105
- package/dist/templates/app/api/v1/teams/[teamId]/invoices/route.ts +0 -125
- package/dist/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +0 -263
- package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +0 -358
- package/dist/templates/app/api/v1/teams/[teamId]/route.ts +0 -322
- package/dist/templates/app/api/v1/teams/[teamId]/subscription/route.ts +0 -50
- package/dist/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +0 -91
- package/dist/templates/app/api/v1/teams/docs.md +0 -320
- package/dist/templates/app/api/v1/teams/presets.ts +0 -178
- package/dist/templates/app/api/v1/teams/route.ts +0 -293
- package/dist/templates/app/api/v1/teams/switch/route.ts +0 -88
- package/dist/templates/app/api/v1/theme/[...path]/route.ts +0 -361
- package/dist/templates/app/api/v1/theme/docs.md +0 -74
- package/dist/templates/app/api/v1/theme/presets.ts +0 -21
- package/dist/templates/app/api/v1/theme/route.ts +0 -96
- package/dist/templates/app/api/v1/users/[id]/meta/[key]/route.ts +0 -363
- package/dist/templates/app/api/v1/users/[id]/route.ts +0 -302
- package/dist/templates/app/api/v1/users/docs.md +0 -93
- package/dist/templates/app/api/v1/users/presets.ts +0 -59
- package/dist/templates/app/api/v1/users/route.ts +0 -197
- package/dist/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +0 -117
- package/dist/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +0 -103
- package/dist/templates/app/dashboard/(main)/[entity]/create/page.tsx +0 -95
- package/dist/templates/app/dashboard/(main)/[entity]/error.tsx +0 -51
- package/dist/templates/app/dashboard/(main)/[entity]/layout.tsx +0 -113
- package/dist/templates/app/dashboard/(main)/[entity]/loading.tsx +0 -61
- package/dist/templates/app/dashboard/(main)/[entity]/page.tsx +0 -90
- package/dist/templates/app/dashboard/(main)/layout.tsx +0 -98
- package/dist/templates/app/dashboard/(main)/loading.tsx +0 -5
- package/dist/templates/app/dashboard/(main)/page.tsx +0 -201
- package/dist/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +0 -114
- package/dist/templates/app/dashboard/(main)/patterns/[id]/page.tsx +0 -20
- package/dist/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +0 -171
- package/dist/templates/app/dashboard/(main)/patterns/create/page.tsx +0 -86
- package/dist/templates/app/dashboard/(main)/patterns/page.tsx +0 -444
- package/dist/templates/app/dashboard/features/analytics/page.tsx +0 -35
- package/dist/templates/app/dashboard/features/automation/page.tsx +0 -35
- package/dist/templates/app/dashboard/features/layout.tsx +0 -13
- package/dist/templates/app/dashboard/features/loading.tsx +0 -5
- package/dist/templates/app/dashboard/features/webhooks/page.tsx +0 -35
- package/dist/templates/app/dashboard/layout.tsx +0 -86
- package/dist/templates/app/dashboard/permission-denied/page.tsx +0 -29
- package/dist/templates/app/dashboard/settings/api-keys/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/api-keys/page.tsx +0 -513
- package/dist/templates/app/dashboard/settings/billing/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/billing/page.tsx +0 -284
- package/dist/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +0 -222
- package/dist/templates/app/dashboard/settings/invoices/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/invoices/page.tsx +0 -82
- package/dist/templates/app/dashboard/settings/layout.tsx +0 -151
- package/dist/templates/app/dashboard/settings/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/notifications/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/notifications/page.tsx +0 -462
- package/dist/templates/app/dashboard/settings/page.tsx +0 -92
- package/dist/templates/app/dashboard/settings/password/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/password/page.tsx +0 -306
- package/dist/templates/app/dashboard/settings/plans/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/plans/page.tsx +0 -40
- package/dist/templates/app/dashboard/settings/profile/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/profile/page.tsx +0 -686
- package/dist/templates/app/dashboard/settings/security/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/security/page.tsx +0 -505
- package/dist/templates/app/dashboard/settings/teams/loading.tsx +0 -5
- package/dist/templates/app/dashboard/settings/teams/page.tsx +0 -272
- package/dist/templates/app/dashboard/settings/teams/permissions/page.tsx +0 -92
- package/dist/templates/app/devtools/blocks/[slug]/page.tsx +0 -39
- package/dist/templates/app/devtools/blocks/page.tsx +0 -31
- package/dist/templates/app/devtools/config/page.tsx +0 -31
- package/dist/templates/app/devtools/features/page.tsx +0 -31
- package/dist/templates/app/devtools/flows/page.tsx +0 -31
- package/dist/templates/app/devtools/layout.tsx +0 -58
- package/dist/templates/app/devtools/page.tsx +0 -121
- package/dist/templates/app/devtools/scheduled-actions/page.tsx +0 -157
- package/dist/templates/app/devtools/style/page.tsx +0 -330
- package/dist/templates/app/devtools/tags/page.tsx +0 -31
- package/dist/templates/app/devtools/tests/[[...path]]/page.tsx +0 -47
- package/dist/templates/app/favicon.ico +0 -0
- package/dist/templates/app/globals.css +0 -12
- package/dist/templates/app/layout.tsx +0 -96
- package/dist/templates/app/public/page.tsx +0 -30
- package/dist/templates/app/superadmin/docs/[section]/[page]/page.tsx +0 -92
- package/dist/templates/app/superadmin/docs/page.tsx +0 -75
- package/dist/templates/app/superadmin/layout.tsx +0 -67
- package/dist/templates/app/superadmin/page.tsx +0 -149
- package/dist/templates/app/superadmin/subscriptions/page.tsx +0 -655
- package/dist/templates/app/superadmin/team-roles/page.tsx +0 -493
- package/dist/templates/app/superadmin/teams/[teamId]/page.tsx +0 -687
- package/dist/templates/app/superadmin/teams/page.tsx +0 -302
- package/dist/templates/app/superadmin/users/[userId]/page.tsx +0 -548
- package/dist/templates/app/superadmin/users/page.tsx +0 -528
- package/templates/app/(auth)/forgot-password/page.tsx +0 -216
- package/templates/app/(auth)/layout.tsx +0 -51
- package/templates/app/(auth)/login/page.tsx +0 -21
- package/templates/app/(auth)/reset-password/page.tsx +0 -212
- package/templates/app/(auth)/signup/page.tsx +0 -21
- package/templates/app/(auth)/verify-email/page.tsx +0 -190
- package/templates/app/(public)/[...slug]/page.tsx +0 -378
- package/templates/app/(public)/docs/[section]/[page]/page.tsx +0 -90
- package/templates/app/(public)/docs/layout.tsx +0 -25
- package/templates/app/(public)/docs/page.tsx +0 -81
- package/templates/app/(public)/layout.tsx +0 -41
- package/templates/app/(public)/page.tsx +0 -19
- package/templates/app/403/page.tsx +0 -89
- package/templates/app/api/auth/[...all]/route.ts +0 -78
- package/templates/app/api/cron/billing/lifecycle/route.ts +0 -98
- package/templates/app/api/csp-report/route.ts +0 -175
- package/templates/app/api/devtools/config/entities/route.ts +0 -108
- package/templates/app/api/devtools/config/theme/route.ts +0 -66
- package/templates/app/api/devtools/tests/[...path]/route.ts +0 -130
- package/templates/app/api/devtools/tests/route.ts +0 -134
- package/templates/app/api/health/route.ts +0 -29
- package/templates/app/api/internal/user-metadata/route.ts +0 -36
- package/templates/app/api/superadmin/subscriptions/route.ts +0 -310
- package/templates/app/api/superadmin/teams/[teamId]/route.ts +0 -286
- package/templates/app/api/superadmin/teams/route.ts +0 -188
- package/templates/app/api/superadmin/users/[userId]/route.ts +0 -540
- package/templates/app/api/superadmin/users/route.ts +0 -323
- package/templates/app/api/user/delete-account/route.ts +0 -55
- package/templates/app/api/user/plan-flags/route.ts +0 -283
- package/templates/app/api/user/profile/route.ts +0 -133
- package/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +0 -210
- package/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +0 -331
- package/templates/app/api/v1/[entity]/[id]/route.ts +0 -35
- package/templates/app/api/v1/[entity]/docs.md +0 -369
- package/templates/app/api/v1/[entity]/presets.ts +0 -194
- package/templates/app/api/v1/[entity]/route.ts +0 -31
- package/templates/app/api/v1/api-keys/[id]/route.ts +0 -303
- package/templates/app/api/v1/api-keys/docs.md +0 -101
- package/templates/app/api/v1/api-keys/presets.ts +0 -31
- package/templates/app/api/v1/api-keys/route.ts +0 -250
- package/templates/app/api/v1/auth/docs.md +0 -184
- package/templates/app/api/v1/auth/presets.ts +0 -44
- package/templates/app/api/v1/auth/signup-with-invite/route.ts +0 -227
- package/templates/app/api/v1/billing/cancel/route.ts +0 -206
- package/templates/app/api/v1/billing/change-plan/route.ts +0 -97
- package/templates/app/api/v1/billing/check-action/route.ts +0 -81
- package/templates/app/api/v1/billing/checkout/route.ts +0 -124
- package/templates/app/api/v1/billing/docs.md +0 -209
- package/templates/app/api/v1/billing/plans/route.ts +0 -85
- package/templates/app/api/v1/billing/portal/route.ts +0 -90
- package/templates/app/api/v1/billing/presets.ts +0 -121
- package/templates/app/api/v1/billing/webhooks/stripe/route.ts +0 -428
- package/templates/app/api/v1/blocks/[slug]/route.ts +0 -29
- package/templates/app/api/v1/blocks/docs.md +0 -173
- package/templates/app/api/v1/blocks/presets.ts +0 -121
- package/templates/app/api/v1/blocks/route.ts +0 -45
- package/templates/app/api/v1/blocks/validate/route.ts +0 -45
- package/templates/app/api/v1/cron/docs.md +0 -116
- package/templates/app/api/v1/cron/presets.ts +0 -26
- package/templates/app/api/v1/cron/process/route.ts +0 -108
- package/templates/app/api/v1/devtools/blocks/route.ts +0 -82
- package/templates/app/api/v1/devtools/docs/route.ts +0 -150
- package/templates/app/api/v1/devtools/docs.md +0 -204
- package/templates/app/api/v1/devtools/features/route.ts +0 -61
- package/templates/app/api/v1/devtools/flows/route.ts +0 -61
- package/templates/app/api/v1/devtools/presets.ts +0 -113
- package/templates/app/api/v1/devtools/scheduled-actions/route.ts +0 -120
- package/templates/app/api/v1/devtools/testing/route.ts +0 -82
- package/templates/app/api/v1/media/docs.md +0 -117
- package/templates/app/api/v1/media/presets.ts +0 -24
- package/templates/app/api/v1/media/upload/route.ts +0 -150
- package/templates/app/api/v1/patterns/[id]/usages/route.ts +0 -116
- package/templates/app/api/v1/plugin/[...path]/route.ts +0 -373
- package/templates/app/api/v1/plugin/docs.md +0 -79
- package/templates/app/api/v1/plugin/presets.ts +0 -21
- package/templates/app/api/v1/plugin/route.ts +0 -96
- package/templates/app/api/v1/post-categories/[id]/route.ts +0 -255
- package/templates/app/api/v1/post-categories/docs.md +0 -134
- package/templates/app/api/v1/post-categories/presets.ts +0 -78
- package/templates/app/api/v1/post-categories/route.ts +0 -119
- package/templates/app/api/v1/team-invitations/[token]/accept/route.ts +0 -179
- package/templates/app/api/v1/team-invitations/[token]/decline/route.ts +0 -120
- package/templates/app/api/v1/team-invitations/[token]/route.ts +0 -89
- package/templates/app/api/v1/team-invitations/docs.md +0 -88
- package/templates/app/api/v1/team-invitations/presets.ts +0 -43
- package/templates/app/api/v1/team-invitations/route.ts +0 -114
- package/templates/app/api/v1/teams/[teamId]/invitations/route.ts +0 -171
- package/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +0 -105
- package/templates/app/api/v1/teams/[teamId]/invoices/route.ts +0 -125
- package/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +0 -263
- package/templates/app/api/v1/teams/[teamId]/members/route.ts +0 -358
- package/templates/app/api/v1/teams/[teamId]/route.ts +0 -322
- package/templates/app/api/v1/teams/[teamId]/subscription/route.ts +0 -50
- package/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +0 -91
- package/templates/app/api/v1/teams/docs.md +0 -320
- package/templates/app/api/v1/teams/presets.ts +0 -178
- package/templates/app/api/v1/teams/route.ts +0 -293
- package/templates/app/api/v1/teams/switch/route.ts +0 -88
- package/templates/app/api/v1/theme/[...path]/route.ts +0 -361
- package/templates/app/api/v1/theme/docs.md +0 -74
- package/templates/app/api/v1/theme/presets.ts +0 -21
- package/templates/app/api/v1/theme/route.ts +0 -96
- package/templates/app/api/v1/users/[id]/meta/[key]/route.ts +0 -363
- package/templates/app/api/v1/users/[id]/route.ts +0 -302
- package/templates/app/api/v1/users/docs.md +0 -93
- package/templates/app/api/v1/users/presets.ts +0 -59
- package/templates/app/api/v1/users/route.ts +0 -197
- package/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +0 -117
- package/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +0 -103
- package/templates/app/dashboard/(main)/[entity]/create/page.tsx +0 -95
- package/templates/app/dashboard/(main)/[entity]/error.tsx +0 -51
- package/templates/app/dashboard/(main)/[entity]/layout.tsx +0 -113
- package/templates/app/dashboard/(main)/[entity]/loading.tsx +0 -61
- package/templates/app/dashboard/(main)/[entity]/page.tsx +0 -90
- package/templates/app/dashboard/(main)/layout.tsx +0 -98
- package/templates/app/dashboard/(main)/loading.tsx +0 -5
- package/templates/app/dashboard/(main)/page.tsx +0 -201
- package/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +0 -114
- package/templates/app/dashboard/(main)/patterns/[id]/page.tsx +0 -20
- package/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +0 -171
- package/templates/app/dashboard/(main)/patterns/create/page.tsx +0 -86
- package/templates/app/dashboard/(main)/patterns/page.tsx +0 -444
- package/templates/app/dashboard/features/analytics/page.tsx +0 -35
- package/templates/app/dashboard/features/automation/page.tsx +0 -35
- package/templates/app/dashboard/features/layout.tsx +0 -13
- package/templates/app/dashboard/features/loading.tsx +0 -5
- package/templates/app/dashboard/features/webhooks/page.tsx +0 -35
- package/templates/app/dashboard/layout.tsx +0 -86
- package/templates/app/dashboard/permission-denied/page.tsx +0 -29
- package/templates/app/dashboard/settings/api-keys/loading.tsx +0 -5
- package/templates/app/dashboard/settings/api-keys/page.tsx +0 -513
- package/templates/app/dashboard/settings/billing/loading.tsx +0 -5
- package/templates/app/dashboard/settings/billing/page.tsx +0 -284
- package/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +0 -222
- package/templates/app/dashboard/settings/invoices/loading.tsx +0 -5
- package/templates/app/dashboard/settings/invoices/page.tsx +0 -82
- package/templates/app/dashboard/settings/layout.tsx +0 -151
- package/templates/app/dashboard/settings/loading.tsx +0 -5
- package/templates/app/dashboard/settings/notifications/loading.tsx +0 -5
- package/templates/app/dashboard/settings/notifications/page.tsx +0 -462
- package/templates/app/dashboard/settings/page.tsx +0 -92
- package/templates/app/dashboard/settings/password/loading.tsx +0 -5
- package/templates/app/dashboard/settings/password/page.tsx +0 -306
- package/templates/app/dashboard/settings/plans/loading.tsx +0 -5
- package/templates/app/dashboard/settings/plans/page.tsx +0 -40
- package/templates/app/dashboard/settings/profile/loading.tsx +0 -5
- package/templates/app/dashboard/settings/profile/page.tsx +0 -686
- package/templates/app/dashboard/settings/security/loading.tsx +0 -5
- package/templates/app/dashboard/settings/security/page.tsx +0 -505
- package/templates/app/dashboard/settings/teams/loading.tsx +0 -5
- package/templates/app/dashboard/settings/teams/page.tsx +0 -272
- package/templates/app/dashboard/settings/teams/permissions/page.tsx +0 -92
- package/templates/app/devtools/blocks/[slug]/page.tsx +0 -39
- package/templates/app/devtools/blocks/page.tsx +0 -31
- package/templates/app/devtools/config/page.tsx +0 -31
- package/templates/app/devtools/features/page.tsx +0 -31
- package/templates/app/devtools/flows/page.tsx +0 -31
- package/templates/app/devtools/layout.tsx +0 -58
- package/templates/app/devtools/page.tsx +0 -121
- package/templates/app/devtools/scheduled-actions/page.tsx +0 -157
- package/templates/app/devtools/style/page.tsx +0 -330
- package/templates/app/devtools/tags/page.tsx +0 -31
- package/templates/app/devtools/tests/[[...path]]/page.tsx +0 -47
- package/templates/app/favicon.ico +0 -0
- package/templates/app/globals.css +0 -12
- package/templates/app/layout.tsx +0 -96
- package/templates/app/public/page.tsx +0 -30
- package/templates/app/superadmin/docs/[section]/[page]/page.tsx +0 -92
- package/templates/app/superadmin/docs/page.tsx +0 -75
- package/templates/app/superadmin/layout.tsx +0 -67
- package/templates/app/superadmin/page.tsx +0 -149
- package/templates/app/superadmin/subscriptions/page.tsx +0 -655
- package/templates/app/superadmin/team-roles/page.tsx +0 -493
- package/templates/app/superadmin/teams/[teamId]/page.tsx +0 -687
- package/templates/app/superadmin/teams/page.tsx +0 -302
- package/templates/app/superadmin/users/[userId]/page.tsx +0 -548
- package/templates/app/superadmin/users/page.tsx +0 -528
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useEffect } from 'react'
|
|
4
|
-
import { Button } from '@nextsparkjs/core/components/ui/button'
|
|
5
|
-
import { AlertCircle } from 'lucide-react'
|
|
6
|
-
|
|
7
|
-
export default function EntityError({
|
|
8
|
-
error,
|
|
9
|
-
reset,
|
|
10
|
-
}: {
|
|
11
|
-
error: Error & { digest?: string }
|
|
12
|
-
reset: () => void
|
|
13
|
-
}) {
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
// Log the error to an error reporting service
|
|
16
|
-
console.error('Entity page error:', error)
|
|
17
|
-
}, [error])
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div className="flex flex-col items-center justify-center min-h-[400px] gap-4 p-6">
|
|
21
|
-
<div className="flex flex-col items-center gap-2 text-center">
|
|
22
|
-
<AlertCircle className="h-12 w-12 text-destructive" />
|
|
23
|
-
<h2 className="text-xl font-semibold">Something went wrong!</h2>
|
|
24
|
-
<p className="text-sm text-muted-foreground max-w-md">
|
|
25
|
-
{error.message || 'An error occurred while loading this page. Please try again.'}
|
|
26
|
-
</p>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<div className="flex items-center gap-2">
|
|
30
|
-
<Button
|
|
31
|
-
variant="outline"
|
|
32
|
-
onClick={() => window.history.back()}
|
|
33
|
-
>
|
|
34
|
-
Go Back
|
|
35
|
-
</Button>
|
|
36
|
-
<Button
|
|
37
|
-
onClick={() => reset()}
|
|
38
|
-
>
|
|
39
|
-
Try Again
|
|
40
|
-
</Button>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
{process.env.NODE_ENV === 'development' && error.stack && (
|
|
44
|
-
<details className="mt-4 p-4 bg-muted rounded-lg text-xs max-w-2xl w-full">
|
|
45
|
-
<summary className="cursor-pointer font-medium">Error Details (Development Only)</summary>
|
|
46
|
-
<pre className="mt-2 overflow-auto">{error.stack}</pre>
|
|
47
|
-
</details>
|
|
48
|
-
)}
|
|
49
|
-
</div>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Entity Permission Layout
|
|
3
|
-
*
|
|
4
|
-
* Server Component that validates entity permissions BEFORE rendering any page.
|
|
5
|
-
* This layout is NOT overridable by themes to ensure security.
|
|
6
|
-
*
|
|
7
|
-
* IMPORTANT: Do NOT use getTemplateOrDefault here - security must not be bypassable.
|
|
8
|
-
*
|
|
9
|
-
* Flow:
|
|
10
|
-
* 1. User navigates to /dashboard/companies/create
|
|
11
|
-
* 2. Browser sends activeTeamId cookie automatically
|
|
12
|
-
* 3. This layout reads cookie and checks permission via checkPermission()
|
|
13
|
-
* 4. If denied, redirects to /dashboard/permission-denied
|
|
14
|
-
* 5. If allowed, renders the page (children)
|
|
15
|
-
*/
|
|
16
|
-
import { headers, cookies } from 'next/headers'
|
|
17
|
-
import { redirect } from 'next/navigation'
|
|
18
|
-
import { checkPermission } from '@nextsparkjs/core/lib/permissions/check'
|
|
19
|
-
import { isValidPermission } from '@nextsparkjs/core/lib/permissions/init'
|
|
20
|
-
import type { Permission } from '@nextsparkjs/core/lib/permissions/types'
|
|
21
|
-
|
|
22
|
-
type EntityAction = 'list' | 'read' | 'create' | 'update' | 'delete'
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Detect the required action from the pathname
|
|
26
|
-
*
|
|
27
|
-
* @param pathname - Full pathname (e.g., /dashboard/companies/create)
|
|
28
|
-
* @param entitySlug - Entity slug (e.g., companies)
|
|
29
|
-
* @returns The action being attempted
|
|
30
|
-
*/
|
|
31
|
-
function detectActionFromPathname(pathname: string, entitySlug: string): EntityAction {
|
|
32
|
-
const entityPath = `/dashboard/${entitySlug}`
|
|
33
|
-
const relativePath = pathname.replace(entityPath, '')
|
|
34
|
-
|
|
35
|
-
// List: /dashboard/companies or /dashboard/companies/
|
|
36
|
-
if (relativePath === '' || relativePath === '/') return 'list'
|
|
37
|
-
|
|
38
|
-
// Create: /dashboard/companies/create
|
|
39
|
-
if (relativePath === '/create') return 'create'
|
|
40
|
-
|
|
41
|
-
// Update: /dashboard/companies/[id]/edit
|
|
42
|
-
if (relativePath.match(/^\/[^/]+\/edit$/)) return 'update'
|
|
43
|
-
|
|
44
|
-
// Read: /dashboard/companies/[id] (single detail view)
|
|
45
|
-
if (relativePath.match(/^\/[^/]+$/)) return 'read'
|
|
46
|
-
|
|
47
|
-
// Default fallback for any other path
|
|
48
|
-
return 'read'
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface EntityLayoutProps {
|
|
52
|
-
children: React.ReactNode
|
|
53
|
-
params: Promise<{ entity: string }>
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default async function EntityPermissionLayout({
|
|
57
|
-
children,
|
|
58
|
-
params
|
|
59
|
-
}: EntityLayoutProps) {
|
|
60
|
-
const { entity } = await params
|
|
61
|
-
const headersList = await headers()
|
|
62
|
-
const cookieStore = await cookies()
|
|
63
|
-
|
|
64
|
-
// Get pathname from middleware header
|
|
65
|
-
const pathname = headersList.get('x-pathname') || ''
|
|
66
|
-
|
|
67
|
-
// Get userId from middleware header (set for all authenticated routes)
|
|
68
|
-
const userId = headersList.get('x-user-id')
|
|
69
|
-
|
|
70
|
-
// Get teamId from cookie (set by TeamContext and /api/v1/teams/switch)
|
|
71
|
-
const teamId = cookieStore.get('activeTeamId')?.value
|
|
72
|
-
|
|
73
|
-
// Skip validation if missing required data
|
|
74
|
-
// - No userId: middleware will redirect to login (shouldn't happen for dashboard routes)
|
|
75
|
-
// - No teamId: user hasn't selected a team yet, let page handle it
|
|
76
|
-
if (!userId || !teamId) {
|
|
77
|
-
console.log('[EntityPermissionLayout] Skipping validation - missing data:', {
|
|
78
|
-
entity,
|
|
79
|
-
userId: !!userId,
|
|
80
|
-
teamId: !!teamId
|
|
81
|
-
})
|
|
82
|
-
return <>{children}</>
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Skip permission validation for routes that don't have entity permissions
|
|
86
|
-
// These are custom template pages (like agent-single, agent-multi) that aren't real entities
|
|
87
|
-
if (!isValidPermission(`${entity}.list` as Permission)) {
|
|
88
|
-
console.log('[EntityPermissionLayout] Skipping validation - no entity permission config for:', entity)
|
|
89
|
-
return <>{children}</>
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Detect required action from pathname
|
|
93
|
-
const action = detectActionFromPathname(pathname, entity)
|
|
94
|
-
const permission = `${entity}.${action}` as Permission
|
|
95
|
-
|
|
96
|
-
console.log('[EntityPermissionLayout] Checking permission:', {
|
|
97
|
-
entity,
|
|
98
|
-
action,
|
|
99
|
-
permission,
|
|
100
|
-
userId,
|
|
101
|
-
teamId
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
// Check permission using existing core function
|
|
105
|
-
const hasPermission = await checkPermission(userId, teamId, permission)
|
|
106
|
-
|
|
107
|
-
if (!hasPermission) {
|
|
108
|
-
console.log('[EntityPermissionLayout] Permission denied, redirecting')
|
|
109
|
-
redirect(`/dashboard/permission-denied?entity=${entity}&action=${action}`)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return <>{children}</>
|
|
113
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from '@nextsparkjs/core/components/ui/skeleton'
|
|
2
|
-
|
|
3
|
-
export default function EntityLoading() {
|
|
4
|
-
return (
|
|
5
|
-
<div className="space-y-6 p-6">
|
|
6
|
-
{/* Header skeleton */}
|
|
7
|
-
<div className="flex items-center justify-between">
|
|
8
|
-
<div className="space-y-2">
|
|
9
|
-
<Skeleton className="h-8 w-48" />
|
|
10
|
-
<Skeleton className="h-4 w-64" />
|
|
11
|
-
</div>
|
|
12
|
-
<Skeleton className="h-10 w-32" />
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
{/* Table skeleton */}
|
|
16
|
-
<div className="rounded-md border">
|
|
17
|
-
<div className="p-4 border-b">
|
|
18
|
-
<Skeleton className="h-10 w-full max-w-sm" />
|
|
19
|
-
</div>
|
|
20
|
-
<div className="p-4 space-y-4">
|
|
21
|
-
{/* Table header */}
|
|
22
|
-
<div className="flex items-center justify-between pb-4 border-b">
|
|
23
|
-
<div className="flex items-center gap-4">
|
|
24
|
-
<Skeleton className="h-5 w-5" />
|
|
25
|
-
<Skeleton className="h-5 w-24" />
|
|
26
|
-
<Skeleton className="h-5 w-32" />
|
|
27
|
-
<Skeleton className="h-5 w-28" />
|
|
28
|
-
<Skeleton className="h-5 w-20" />
|
|
29
|
-
</div>
|
|
30
|
-
<Skeleton className="h-5 w-16" />
|
|
31
|
-
</div>
|
|
32
|
-
|
|
33
|
-
{/* Table rows */}
|
|
34
|
-
{Array.from({ length: 5 }).map((_, i) => (
|
|
35
|
-
<div key={i} className="flex items-center justify-between py-3">
|
|
36
|
-
<div className="flex items-center gap-4">
|
|
37
|
-
<Skeleton className="h-5 w-5" />
|
|
38
|
-
<Skeleton className="h-5 w-40" />
|
|
39
|
-
<Skeleton className="h-5 w-48" />
|
|
40
|
-
<Skeleton className="h-5 w-24" />
|
|
41
|
-
<Skeleton className="h-5 w-16" />
|
|
42
|
-
</div>
|
|
43
|
-
<Skeleton className="h-8 w-20" />
|
|
44
|
-
</div>
|
|
45
|
-
))}
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
{/* Pagination skeleton */}
|
|
49
|
-
<div className="p-4 border-t flex items-center justify-between">
|
|
50
|
-
<Skeleton className="h-5 w-32" />
|
|
51
|
-
<div className="flex items-center gap-2">
|
|
52
|
-
<Skeleton className="h-8 w-8" />
|
|
53
|
-
<Skeleton className="h-8 w-8" />
|
|
54
|
-
<Skeleton className="h-8 w-8" />
|
|
55
|
-
<Skeleton className="h-8 w-8" />
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { notFound } from 'next/navigation'
|
|
2
|
-
import { getEntity, getEntityRegistry, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
|
-
import { EntityListWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityListWrapper'
|
|
4
|
-
import type { Metadata } from 'next'
|
|
5
|
-
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
6
|
-
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
7
|
-
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
8
|
-
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
9
|
-
|
|
10
|
-
// Initialize registry at module load time (before any component renders)
|
|
11
|
-
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
12
|
-
|
|
13
|
-
// Type guard to check if entity is a full EntityConfig
|
|
14
|
-
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
15
|
-
return 'slug' in entity
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface PageProps {
|
|
19
|
-
params: Promise<{ entity: string }>
|
|
20
|
-
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function EntityListPage({ params }: PageProps) {
|
|
24
|
-
const resolvedParams = await params
|
|
25
|
-
const entitySlug = resolvedParams.entity
|
|
26
|
-
|
|
27
|
-
// Verificar que la entidad existe usando el nuevo registry
|
|
28
|
-
const registry = getEntityRegistry()
|
|
29
|
-
if (!(entitySlug in registry)) {
|
|
30
|
-
notFound()
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const entityConfig = getEntity(entitySlug)
|
|
34
|
-
if (!entityConfig || !isEntityConfig(entityConfig)) {
|
|
35
|
-
notFound()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Verificar que la entidad está habilitada usando la nueva estructura
|
|
39
|
-
if (!entityConfig.enabled) {
|
|
40
|
-
notFound()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Check if entity should be accessible via dashboard route
|
|
44
|
-
// Entities with showInMenu: false are managed elsewhere (e.g., settings)
|
|
45
|
-
if (!entityConfig.ui?.dashboard?.showInMenu) {
|
|
46
|
-
notFound()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// IMPORTANT: Try to resolve entity-specific template first
|
|
50
|
-
// This allows themes to override specific entities (e.g., /dashboard/orders)
|
|
51
|
-
// while falling back to the generic EntityListWrapper for others
|
|
52
|
-
const specificTemplatePath = `app/dashboard/(main)/${entitySlug}/page.tsx`
|
|
53
|
-
const SpecificTemplate = getTemplateOrDefault(specificTemplatePath, null) as React.ComponentType<PageProps> | null
|
|
54
|
-
|
|
55
|
-
if (SpecificTemplate) {
|
|
56
|
-
return <SpecificTemplate params={params} searchParams={Promise.resolve({})} />
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<EntityListWrapper
|
|
61
|
-
entityType={entityConfig.slug}
|
|
62
|
-
/>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
|
67
|
-
const resolvedParams = await params
|
|
68
|
-
const entitySlug = resolvedParams.entity
|
|
69
|
-
|
|
70
|
-
const registry = getEntityRegistry()
|
|
71
|
-
if (!(entitySlug in registry)) {
|
|
72
|
-
return {
|
|
73
|
-
title: 'Not Found - Dashboard'
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const entityConfig = getEntity(entitySlug)
|
|
78
|
-
if (!entityConfig || !isEntityConfig(entityConfig)) {
|
|
79
|
-
return {
|
|
80
|
-
title: 'Not Found - Dashboard'
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
title: `${entityConfig.names.plural} - Dashboard`,
|
|
86
|
-
description: `Manage ${entityConfig.names.plural.toLowerCase()} in your dashboard`
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default getTemplateOrDefault('app/dashboard/(main)/[entity]/page.tsx', EntityListPage)
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main Dashboard Layout with Permission Checking
|
|
3
|
-
*
|
|
4
|
-
* This layout handles:
|
|
5
|
-
* 1. Entity registry initialization
|
|
6
|
-
* 2. Server-side permission validation for entity routes
|
|
7
|
-
* 3. Rendering the DashboardShell with entity navigation
|
|
8
|
-
*
|
|
9
|
-
* IMPORTANT: Permission checking MUST be in this layout (not in [entity]/layout.tsx)
|
|
10
|
-
* because (templates) routes with specific paths take precedence over dynamic [entity] routes.
|
|
11
|
-
*/
|
|
12
|
-
import { headers, cookies } from 'next/headers'
|
|
13
|
-
import { redirect } from 'next/navigation'
|
|
14
|
-
import { DashboardShell } from '@nextsparkjs/core/components/dashboard/layouts/DashboardShell'
|
|
15
|
-
import { serializeEntityConfig, type SerializableEntityConfig } from '@nextsparkjs/core/lib/entities/serialization'
|
|
16
|
-
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
17
|
-
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
18
|
-
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
19
|
-
import { checkPermission } from '@nextsparkjs/core/lib/permissions/check'
|
|
20
|
-
import { isValidPermission } from '@nextsparkjs/core/lib/permissions/init'
|
|
21
|
-
import type { Permission } from '@nextsparkjs/core/lib/permissions/types'
|
|
22
|
-
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
23
|
-
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
24
|
-
|
|
25
|
-
// Register entities globally so other parts of the app can access them via getRegisteredEntities()
|
|
26
|
-
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
27
|
-
|
|
28
|
-
type EntityAction = 'list' | 'read' | 'create' | 'update' | 'delete'
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Parse entity and action from pathname
|
|
32
|
-
* Handles paths like: /dashboard/ai-agents, /dashboard/ai-agents/create, /dashboard/ai-agents/[id]/edit
|
|
33
|
-
*/
|
|
34
|
-
function parseEntityFromPathname(pathname: string): { entity: string; action: EntityAction } | null {
|
|
35
|
-
const match = pathname.match(/^\/dashboard\/([^/]+)(?:\/(.*))?$/)
|
|
36
|
-
if (!match) return null
|
|
37
|
-
|
|
38
|
-
const entity = match[1]
|
|
39
|
-
const rest = match[2] || ''
|
|
40
|
-
|
|
41
|
-
if (rest === '' || rest === '/') return { entity, action: 'list' }
|
|
42
|
-
if (rest === 'create') return { entity, action: 'create' }
|
|
43
|
-
if (rest.match(/^[^/]+\/edit$/)) return { entity, action: 'update' }
|
|
44
|
-
if (rest.match(/^[^/]+$/)) return { entity, action: 'read' }
|
|
45
|
-
|
|
46
|
-
return { entity, action: 'read' }
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Type guard to check if entity is a full EntityConfig
|
|
50
|
-
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
51
|
-
return 'slug' in entity
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Default main dashboard layout component with permission checking
|
|
55
|
-
async function DefaultMainDashboardLayout({
|
|
56
|
-
children
|
|
57
|
-
}: {
|
|
58
|
-
children: React.ReactNode
|
|
59
|
-
}) {
|
|
60
|
-
// Get entities directly from the imported registry
|
|
61
|
-
const allEntities = Object.values(ENTITY_REGISTRY).map(entry => entry.config)
|
|
62
|
-
const entities = allEntities.filter(isEntityConfig)
|
|
63
|
-
const serializedEntities: SerializableEntityConfig[] = entities.map(serializeEntityConfig)
|
|
64
|
-
|
|
65
|
-
// === PERMISSION CHECK ===
|
|
66
|
-
const headersList = await headers()
|
|
67
|
-
const cookieStore = await cookies()
|
|
68
|
-
|
|
69
|
-
const pathname = headersList.get('x-pathname') || ''
|
|
70
|
-
const userId = headersList.get('x-user-id')
|
|
71
|
-
const teamId = cookieStore.get('activeTeamId')?.value
|
|
72
|
-
|
|
73
|
-
if (userId && teamId && pathname) {
|
|
74
|
-
const parsed = parseEntityFromPathname(pathname)
|
|
75
|
-
|
|
76
|
-
if (parsed) {
|
|
77
|
-
const { entity, action } = parsed
|
|
78
|
-
const permission = `${entity}.${action}` as Permission
|
|
79
|
-
|
|
80
|
-
if (isValidPermission(`${entity}.list` as Permission)) {
|
|
81
|
-
const hasPermission = await checkPermission(userId, teamId, permission)
|
|
82
|
-
|
|
83
|
-
if (!hasPermission) {
|
|
84
|
-
redirect(`/dashboard/permission-denied?entity=${entity}&action=${action}`)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<DashboardShell entities={serializedEntities}>
|
|
92
|
-
{children}
|
|
93
|
-
</DashboardShell>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Export the resolved component (theme override or default)
|
|
98
|
-
export default getTemplateOrDefault('app/dashboard/(main)/layout.tsx', DefaultMainDashboardLayout)
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useUserProfile } from '@nextsparkjs/core/hooks/useUserProfile'
|
|
4
|
-
import { useRouter } from 'next/navigation'
|
|
5
|
-
import { useEffect } from 'react'
|
|
6
|
-
import { Button } from '@nextsparkjs/core/components/ui/button'
|
|
7
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@nextsparkjs/core/components/ui/card'
|
|
8
|
-
import { Badge } from '@nextsparkjs/core/components/ui/badge'
|
|
9
|
-
import { useTranslations } from 'next-intl'
|
|
10
|
-
import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
Loader2,
|
|
14
|
-
User,
|
|
15
|
-
Activity,
|
|
16
|
-
Settings,
|
|
17
|
-
CreditCard,
|
|
18
|
-
Users,
|
|
19
|
-
BarChart3,
|
|
20
|
-
ListTodo
|
|
21
|
-
} from 'lucide-react'
|
|
22
|
-
|
|
23
|
-
// Default dashboard page component
|
|
24
|
-
function DefaultDashboardPage() {
|
|
25
|
-
const { user, isLoading } = useUserProfile()
|
|
26
|
-
const router = useRouter()
|
|
27
|
-
const t = useTranslations('dashboard')
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (!isLoading && !user) {
|
|
31
|
-
router.push('/login')
|
|
32
|
-
}
|
|
33
|
-
}, [user, isLoading, router])
|
|
34
|
-
|
|
35
|
-
if (isLoading) {
|
|
36
|
-
return (
|
|
37
|
-
<div className="min-h-screen flex items-center justify-center">
|
|
38
|
-
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
|
39
|
-
</div>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!user) {
|
|
44
|
-
return null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const stats = [
|
|
48
|
-
{
|
|
49
|
-
title: t('stats.accountStatus'),
|
|
50
|
-
value: t('stats.active'),
|
|
51
|
-
icon: <Activity className="h-4 w-4" />,
|
|
52
|
-
trend: t('badges.verified')
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
title: t('stats.plan'),
|
|
56
|
-
value: t('stats.free'),
|
|
57
|
-
icon: <CreditCard className="h-4 w-4" />,
|
|
58
|
-
trend: t('badges.basic')
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: t('stats.teamMembers'),
|
|
62
|
-
value: '1',
|
|
63
|
-
icon: <Users className="h-4 w-4" />,
|
|
64
|
-
trend: t('badges.solo')
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
title: t('stats.usage'),
|
|
68
|
-
value: '0%',
|
|
69
|
-
icon: <BarChart3 className="h-4 w-4" />,
|
|
70
|
-
trend: t('badges.low')
|
|
71
|
-
},
|
|
72
|
-
]
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<div className="min-h-screen bg-gradient-to-b from-background to-muted/20 py-12 px-4 sm:px-6 lg:px-8">
|
|
76
|
-
<div className="max-w-7xl mx-auto space-y-8">
|
|
77
|
-
{/* Header */}
|
|
78
|
-
<div className="mb-8" data-cy="dashboard-welcome">
|
|
79
|
-
<h1 className="text-3xl font-bold">{t('title')}</h1>
|
|
80
|
-
<p className="text-muted-foreground mt-1">
|
|
81
|
-
{t('welcome', { name: user.firstName || user.email })}
|
|
82
|
-
</p>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
{/* Stats Grid */}
|
|
86
|
-
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
|
87
|
-
{stats.map((stat) => (
|
|
88
|
-
<Card key={stat.title}>
|
|
89
|
-
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
90
|
-
<CardTitle className="text-sm font-medium">
|
|
91
|
-
{stat.title}
|
|
92
|
-
</CardTitle>
|
|
93
|
-
{stat.icon}
|
|
94
|
-
</CardHeader>
|
|
95
|
-
<CardContent>
|
|
96
|
-
<div className="text-2xl font-bold">{stat.value}</div>
|
|
97
|
-
<Badge variant="secondary" className="mt-1">
|
|
98
|
-
{stat.trend}
|
|
99
|
-
</Badge>
|
|
100
|
-
</CardContent>
|
|
101
|
-
</Card>
|
|
102
|
-
))}
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
{/* Quick Actions */}
|
|
106
|
-
<Card>
|
|
107
|
-
<CardHeader>
|
|
108
|
-
<CardTitle>{t('quickActions.title')}</CardTitle>
|
|
109
|
-
<CardDescription>
|
|
110
|
-
{t('quickActions.description')}
|
|
111
|
-
</CardDescription>
|
|
112
|
-
</CardHeader>
|
|
113
|
-
<CardContent>
|
|
114
|
-
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
|
115
|
-
<Button
|
|
116
|
-
variant="outline"
|
|
117
|
-
className="h-auto p-4 flex flex-col items-start gap-2"
|
|
118
|
-
onClick={() => router.push('/dashboard/tasks')}
|
|
119
|
-
>
|
|
120
|
-
<ListTodo className="h-5 w-5 text-blue-500" />
|
|
121
|
-
<div className="text-left">
|
|
122
|
-
<p className="font-medium">{t('quickActions.myTasks')}</p>
|
|
123
|
-
<p className="text-xs text-muted-foreground">{t('quickActions.myTasksDescription')}</p>
|
|
124
|
-
</div>
|
|
125
|
-
</Button>
|
|
126
|
-
|
|
127
|
-
<Button
|
|
128
|
-
variant="outline"
|
|
129
|
-
className="h-auto p-4 flex flex-col items-start gap-2"
|
|
130
|
-
onClick={() => router.push('/dashboard/settings/profile')}
|
|
131
|
-
>
|
|
132
|
-
<User className="h-5 w-5 text-green-500" />
|
|
133
|
-
<div className="text-left">
|
|
134
|
-
<p className="font-medium">{t('quickActions.myProfile')}</p>
|
|
135
|
-
<p className="text-xs text-muted-foreground">{t('quickActions.myProfileDescription')}</p>
|
|
136
|
-
</div>
|
|
137
|
-
</Button>
|
|
138
|
-
|
|
139
|
-
<Button
|
|
140
|
-
variant="outline"
|
|
141
|
-
className="h-auto p-4 flex flex-col items-start gap-2"
|
|
142
|
-
onClick={() => router.push('/dashboard/settings')}
|
|
143
|
-
>
|
|
144
|
-
<Settings className="h-5 w-5 text-purple-500" />
|
|
145
|
-
<div className="text-left">
|
|
146
|
-
<p className="font-medium">{t('quickActions.settings')}</p>
|
|
147
|
-
<p className="text-xs text-muted-foreground">{t('quickActions.settingsDescription')}</p>
|
|
148
|
-
</div>
|
|
149
|
-
</Button>
|
|
150
|
-
|
|
151
|
-
<Button
|
|
152
|
-
variant="outline"
|
|
153
|
-
className="h-auto p-4 flex flex-col items-start gap-2"
|
|
154
|
-
onClick={() => router.push('/dashboard/settings/billing')}
|
|
155
|
-
>
|
|
156
|
-
<CreditCard className="h-5 w-5 text-yellow-500" />
|
|
157
|
-
<div className="text-left">
|
|
158
|
-
<p className="font-medium">{t('quickActions.billing')}</p>
|
|
159
|
-
<p className="text-xs text-muted-foreground">{t('quickActions.billingDescription')}</p>
|
|
160
|
-
</div>
|
|
161
|
-
</Button>
|
|
162
|
-
</div>
|
|
163
|
-
</CardContent>
|
|
164
|
-
</Card>
|
|
165
|
-
|
|
166
|
-
{/* Activity Card */}
|
|
167
|
-
<Card>
|
|
168
|
-
<CardHeader>
|
|
169
|
-
<CardTitle>{t('activity.title')}</CardTitle>
|
|
170
|
-
<CardDescription>
|
|
171
|
-
{t('activity.description')}
|
|
172
|
-
</CardDescription>
|
|
173
|
-
</CardHeader>
|
|
174
|
-
<CardContent>
|
|
175
|
-
<div className="space-y-4">
|
|
176
|
-
<div className="flex items-center gap-4">
|
|
177
|
-
<div className="h-2 w-2 bg-blue-500 rounded-full" />
|
|
178
|
-
<div className="flex-1">
|
|
179
|
-
<p className="text-sm font-medium">{t('activity.signedIn')}</p>
|
|
180
|
-
<p className="text-xs text-muted-foreground">{t('activity.justNow')}</p>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
<div className="flex items-center gap-4">
|
|
184
|
-
<div className="h-2 w-2 bg-green-500 rounded-full" />
|
|
185
|
-
<div className="flex-1">
|
|
186
|
-
<p className="text-sm font-medium">{t('activity.accountCreated')}</p>
|
|
187
|
-
<p className="text-xs text-muted-foreground">
|
|
188
|
-
{new Date(user.createdAt || '').toLocaleDateString()}
|
|
189
|
-
</p>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
</CardContent>
|
|
194
|
-
</Card>
|
|
195
|
-
</div>
|
|
196
|
-
</div>
|
|
197
|
-
)
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Export the resolved component (theme override or default)
|
|
201
|
-
export default getTemplateOrDefaultClient('app/dashboard/(main)/page.tsx', DefaultDashboardPage)
|