@nextsparkjs/core 0.1.0-beta.188 → 0.1.0-beta.189
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/api/keys/ApiKeyDisplay.js +19 -19
- package/dist/components/api/keys/CreateApiKeyDialog.js +21 -21
- package/dist/components/app/layouts/PublicNavbar.d.ts.map +1 -1
- package/dist/components/app/layouts/PublicNavbar.js +34 -16
- package/dist/components/app/misc/ThemeToggle.d.ts.map +1 -1
- package/dist/components/app/misc/ThemeToggle.js +3 -4
- package/dist/components/auth/SessionCookieRefresher.d.ts +5 -0
- package/dist/components/auth/SessionCookieRefresher.d.ts.map +1 -1
- package/dist/components/auth/SessionCookieRefresher.js +7 -1
- package/dist/components/auth/forms/LoginForm.d.ts.map +1 -1
- package/dist/components/auth/forms/LoginForm.js +49 -12
- package/dist/components/auth/forms/SignupForm.d.ts.map +1 -1
- package/dist/components/auth/forms/SignupForm.js +4 -3
- package/dist/components/dashboard/block-editor/block-settings-panel.js +1 -1
- package/dist/components/dashboard/block-editor/floating-block-toolbar.js +1 -1
- package/dist/components/dashboard/block-editor/sortable-block.js +1 -1
- package/dist/components/dashboard/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/Sidebar.js +8 -6
- package/dist/components/dashboard/layouts/TopNavbar.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/TopNavbar.js +51 -54
- package/dist/components/dashboard/misc/NotificationsDropdown.d.ts.map +1 -1
- package/dist/components/dashboard/misc/NotificationsDropdown.js +17 -15
- package/dist/components/dashboard/misc/SearchDropdown.d.ts.map +1 -1
- package/dist/components/dashboard/misc/SearchDropdown.js +19 -22
- package/dist/components/dashboard/mobile/MobileBottomNav.js +1 -1
- package/dist/components/dashboard/mobile/MobileTopBar.js +2 -2
- package/dist/components/dashboard/navigation/DynamicNavigation.js +5 -5
- package/dist/components/devtools/BlockDetailViewer.js +1 -1
- package/dist/components/devtools/BlocksViewer.js +1 -1
- package/dist/components/entities/EntityChildManager.js +5 -5
- package/dist/components/entities/EntityDetailPage.d.ts.map +1 -1
- package/dist/components/entities/EntityDetailPage.js +16 -15
- package/dist/components/entities/EntityFieldRenderer.d.ts.map +1 -1
- package/dist/components/entities/EntityFieldRenderer.js +12 -7
- package/dist/components/entities/EntityPageHeader.js +5 -5
- package/dist/components/entities/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/entities/ErrorBoundary.js +20 -21
- package/dist/components/entities/wrappers/EntityDetailWrapper.js +5 -5
- package/dist/components/entities/wrappers/EntityFormWrapper.js +2 -2
- package/dist/components/entities/wrappers/EntityListWrapper.js +3 -3
- package/dist/components/permissions/NoPermission.js +10 -10
- package/dist/components/public/pageBuilder/PageRenderer.d.ts.map +1 -1
- package/dist/components/public/pageBuilder/PageRenderer.js +2 -1
- package/dist/components/settings/SettingsPageSkeleton.js +4 -4
- package/dist/components/settings/layouts/SettingsSidebar.js +6 -6
- package/dist/components/shared/MultiSelectFilter.d.ts +3 -1
- package/dist/components/shared/MultiSelectFilter.d.ts.map +1 -1
- package/dist/components/shared/MultiSelectFilter.js +7 -3
- package/dist/components/shared/SearchInput.d.ts +2 -0
- package/dist/components/shared/SearchInput.d.ts.map +1 -1
- package/dist/components/shared/SearchInput.js +64 -6
- package/dist/components/ui/address-input.js +18 -18
- package/dist/components/ui/audio-upload.js +9 -9
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox.js +4 -4
- package/dist/components/ui/country-select.d.ts.map +1 -1
- package/dist/components/ui/country-select.js +3 -3
- package/dist/components/ui/currency-select.d.ts.map +1 -1
- package/dist/components/ui/currency-select.js +3 -3
- package/dist/components/ui/dynamic-icon.d.ts.map +1 -1
- package/dist/components/ui/dynamic-icon.js +3 -2
- package/dist/components/ui/file-upload.js +7 -7
- package/dist/components/ui/image-upload.js +8 -8
- package/dist/components/ui/multi-select.d.ts +2 -1
- package/dist/components/ui/multi-select.d.ts.map +1 -1
- package/dist/components/ui/multi-select.js +4 -3
- package/dist/components/ui/phone-input.d.ts.map +1 -1
- package/dist/components/ui/phone-input.js +3 -3
- package/dist/components/ui/relation-display.js +1 -1
- package/dist/components/ui/simple-relation-select.d.ts +2 -1
- package/dist/components/ui/simple-relation-select.d.ts.map +1 -1
- package/dist/components/ui/simple-relation-select.js +7 -6
- package/dist/components/ui/tags-input.d.ts.map +1 -1
- package/dist/components/ui/tags-input.js +1 -1
- package/dist/components/ui/timezone-select.d.ts.map +1 -1
- package/dist/components/ui/timezone-select.js +3 -3
- package/dist/components/ui/user-display.js +4 -4
- package/dist/components/ui/user-select.d.ts.map +1 -1
- package/dist/components/ui/user-select.js +9 -9
- package/dist/components/ui/video-upload.js +9 -9
- package/dist/contexts/SubscriptionContext.d.ts.map +1 -1
- package/dist/contexts/SubscriptionContext.js +5 -1
- package/dist/contexts/TeamContext.d.ts.map +1 -1
- package/dist/contexts/TeamContext.js +83 -26
- package/dist/emails/otp-verification.d.ts.map +1 -1
- package/dist/emails/otp-verification.js +3 -2
- package/dist/hooks/useAccountPreferencesSync.d.ts +13 -0
- package/dist/hooks/useAccountPreferencesSync.d.ts.map +1 -0
- package/dist/hooks/useAccountPreferencesSync.js +95 -0
- package/dist/hooks/useAuth.d.ts +202 -15
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +49 -13
- package/dist/hooks/useEntityConfig.js +2 -2
- package/dist/hooks/useEntitySearch.js +10 -10
- package/dist/hooks/useNotifications.js +12 -12
- package/dist/hooks/usePrefetch.d.ts.map +1 -1
- package/dist/hooks/usePrefetch.js +6 -2
- package/dist/hooks/useSearch.js +15 -15
- package/dist/hooks/useSessionCookieRefresh.d.ts +18 -1
- package/dist/hooks/useSessionCookieRefresh.d.ts.map +1 -1
- package/dist/hooks/useSessionCookieRefresh.js +17 -4
- package/dist/hooks/useSessionHint.d.ts +12 -0
- package/dist/hooks/useSessionHint.d.ts.map +1 -0
- package/dist/hooks/useSessionHint.js +15 -0
- package/dist/hooks/useTranslationPreload.js +6 -6
- package/dist/i18n.d.ts +13 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +2 -27
- package/dist/lib/actions/entity.actions.d.ts.map +1 -1
- package/dist/lib/actions/entity.actions.js +3 -2
- package/dist/lib/api/auth/dual-auth.d.ts +4 -1
- package/dist/lib/api/auth/dual-auth.d.ts.map +1 -1
- package/dist/lib/api/auth/dual-auth.js +5 -16
- package/dist/lib/api/entities.js +33 -33
- package/dist/lib/api/keys.d.ts +27 -27
- package/dist/lib/api/keys.js +27 -27
- package/dist/lib/auth/callback-url.d.ts +11 -0
- package/dist/lib/auth/callback-url.d.ts.map +1 -0
- package/dist/lib/auth/callback-url.js +14 -0
- package/dist/lib/auth/otp-config.d.ts +55 -0
- package/dist/lib/auth/otp-config.d.ts.map +1 -0
- package/dist/lib/auth/otp-config.js +48 -0
- package/dist/lib/auth/registration-helpers.d.ts.map +1 -1
- package/dist/lib/auth/registration-helpers.js +3 -1
- package/dist/lib/auth/session-hint.d.ts +31 -0
- package/dist/lib/auth/session-hint.d.ts.map +1 -0
- package/dist/lib/auth/session-hint.js +37 -0
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +6 -4
- package/dist/lib/blocks/loader.d.ts +3 -11
- package/dist/lib/blocks/loader.d.ts.map +1 -1
- package/dist/lib/blocks/loader.js +1 -9
- package/dist/lib/blocks/loader.server.d.ts +18 -0
- package/dist/lib/blocks/loader.server.d.ts.map +1 -0
- package/dist/lib/blocks/loader.server.js +11 -0
- package/dist/lib/blocks/sanitize-html.d.ts +31 -0
- package/dist/lib/blocks/sanitize-html.d.ts.map +1 -0
- package/dist/lib/blocks/sanitize-html.js +60 -0
- package/dist/lib/config/config-sync.d.ts +1 -0
- package/dist/lib/config/config-sync.d.ts.map +1 -1
- package/dist/lib/config/config-sync.js +4 -1
- package/dist/lib/config/types.d.ts +48 -0
- package/dist/lib/config/types.d.ts.map +1 -1
- package/dist/lib/email/types.d.ts +6 -0
- package/dist/lib/email/types.d.ts.map +1 -1
- package/dist/lib/entities/serialization.d.ts.map +1 -1
- package/dist/lib/entities/serialization.js +3 -6
- package/dist/lib/icons.d.ts +12 -0
- package/dist/lib/icons.d.ts.map +1 -0
- package/dist/lib/icons.js +30 -0
- package/dist/lib/locale.d.ts +25 -1
- package/dist/lib/locale.d.ts.map +1 -1
- package/dist/lib/locale.js +49 -35
- package/dist/lib/mcp/engine.js +1 -1
- package/dist/lib/mcp/errors.js +17 -17
- package/dist/lib/mcp/schema-builder.js +16 -16
- package/dist/lib/mcp/tool-generator.js +18 -18
- package/dist/lib/search-highlighting.d.ts +7 -0
- package/dist/lib/search-highlighting.d.ts.map +1 -1
- package/dist/lib/search-highlighting.js +6 -2
- package/dist/lib/selectors/core-selectors.d.ts +2 -0
- package/dist/lib/selectors/core-selectors.d.ts.map +1 -1
- package/dist/lib/selectors/domains/auth.selectors.d.ts +1 -0
- package/dist/lib/selectors/domains/auth.selectors.d.ts.map +1 -1
- package/dist/lib/selectors/domains/auth.selectors.js +1 -0
- package/dist/lib/selectors/domains/entities.selectors.d.ts +2 -0
- package/dist/lib/selectors/domains/entities.selectors.d.ts.map +1 -1
- package/dist/lib/selectors/domains/entities.selectors.js +2 -0
- package/dist/lib/selectors/selectors.d.ts +4 -0
- package/dist/lib/selectors/selectors.d.ts.map +1 -1
- package/dist/lib/services/block.service.js +1 -1
- package/dist/lib/teams/active-team-cookie.d.ts +24 -0
- package/dist/lib/teams/active-team-cookie.d.ts.map +1 -0
- package/dist/lib/teams/active-team-cookie.js +17 -0
- package/dist/lib/teams/dashboard-team.d.ts +20 -0
- package/dist/lib/teams/dashboard-team.d.ts.map +1 -0
- package/dist/lib/teams/dashboard-team.js +38 -0
- package/dist/lib/teams/schema.d.ts.map +1 -1
- package/dist/lib/teams/schema.js +1 -1
- package/dist/lib/template-resolver.d.ts.map +1 -1
- package/dist/lib/template-resolver.js +0 -1
- package/dist/lib/theme/get-default-theme-mode.d.ts +7 -4
- package/dist/lib/theme/get-default-theme-mode.d.ts.map +1 -1
- package/dist/lib/theme/get-default-theme-mode.js +2 -44
- package/dist/messages/de/auth.json +4 -2
- package/dist/messages/de/common.json +83 -3
- package/dist/messages/de/email.json +1 -1
- package/dist/messages/de/index.d.ts +87 -0
- package/dist/messages/de/index.d.ts.map +1 -1
- package/dist/messages/de/settings.json +5 -0
- package/dist/messages/en/auth.json +4 -2
- package/dist/messages/en/common.json +83 -3
- package/dist/messages/en/email.json +1 -1
- package/dist/messages/en/index.d.ts +86 -0
- package/dist/messages/en/index.d.ts.map +1 -1
- package/dist/messages/en/settings.json +4 -0
- package/dist/messages/es/auth.json +4 -2
- package/dist/messages/es/common.json +83 -3
- package/dist/messages/es/email.json +1 -1
- package/dist/messages/es/index.d.ts +86 -0
- package/dist/messages/es/index.d.ts.map +1 -1
- package/dist/messages/es/settings.json +4 -0
- package/dist/messages/fr/auth.json +4 -2
- package/dist/messages/fr/common.json +83 -3
- package/dist/messages/fr/email.json +1 -1
- package/dist/messages/fr/index.d.ts +87 -0
- package/dist/messages/fr/index.d.ts.map +1 -1
- package/dist/messages/fr/settings.json +5 -0
- package/dist/messages/it/auth.json +4 -2
- package/dist/messages/it/common.json +83 -3
- package/dist/messages/it/email.json +1 -1
- package/dist/messages/it/index.d.ts +87 -0
- package/dist/messages/it/index.d.ts.map +1 -1
- package/dist/messages/it/settings.json +5 -0
- package/dist/messages/pt/auth.json +4 -2
- package/dist/messages/pt/common.json +83 -3
- package/dist/messages/pt/email.json +1 -1
- package/dist/messages/pt/index.d.ts +87 -0
- package/dist/messages/pt/index.d.ts.map +1 -1
- package/dist/messages/pt/settings.json +5 -0
- package/dist/nextspark-registries.d.ts +54 -0
- package/dist/providers/DashboardProviders.d.ts +13 -10
- package/dist/providers/DashboardProviders.d.ts.map +1 -1
- package/dist/providers/DashboardProviders.js +7 -1
- package/dist/templates/app/(auth)/forgot-password/page.tsx +2 -2
- package/dist/templates/app/(auth)/reset-password/page.tsx +6 -6
- package/dist/templates/app/403/page.tsx +6 -6
- package/dist/templates/app/api/v1/teams/switch/route.ts +24 -5
- package/dist/templates/app/dashboard/(main)/[entity]/layout.tsx +9 -7
- package/dist/templates/app/dashboard/(main)/layout.tsx +4 -3
- package/dist/templates/app/dashboard/settings/api-keys/page.tsx +36 -34
- package/dist/templates/app/dashboard/settings/profile/page.tsx +7 -6
- package/dist/templates/app/dashboard/settings/security/page.tsx +5 -4
- package/dist/templates/app/layout.ppr.tsx +8 -8
- package/dist/templates/app/layout.tsx +12 -17
- package/dist/templates/blocks/cta-section/component.tsx +5 -2
- package/dist/templates/blocks/cta-section/config.ts +3 -2
- package/dist/templates/blocks/cta-section/fields.ts +2 -2
- package/dist/templates/blocks/cta-section/schema.ts +2 -2
- package/dist/templates/blocks/features-grid/component.tsx +10 -2
- package/dist/templates/blocks/features-grid/config.ts +3 -2
- package/dist/templates/blocks/features-grid/fields.ts +2 -2
- package/dist/templates/blocks/features-grid/schema.ts +2 -2
- package/dist/templates/blocks/hero/component.tsx +6 -3
- package/dist/templates/blocks/hero/config.ts +3 -2
- package/dist/templates/blocks/hero/fields.ts +2 -2
- package/dist/templates/blocks/hero/schema.ts +2 -2
- package/dist/templates/blocks/testimonials/component.tsx +6 -3
- package/dist/templates/blocks/testimonials/config.ts +3 -2
- package/dist/templates/blocks/testimonials/fields.ts +2 -2
- package/dist/templates/blocks/testimonials/schema.ts +2 -2
- package/dist/templates/blocks/text-content/component.tsx +7 -3
- package/dist/templates/blocks/text-content/config.ts +3 -2
- package/dist/templates/blocks/text-content/fields.ts +2 -2
- package/dist/templates/blocks/text-content/schema.ts +2 -2
- package/dist/templates/contents/themes/starter/blocks/cta-section/component.tsx +102 -0
- package/dist/templates/contents/themes/starter/blocks/cta-section/config.ts +11 -0
- package/dist/templates/contents/themes/starter/blocks/cta-section/fields.ts +89 -0
- package/dist/templates/contents/themes/starter/blocks/cta-section/index.ts +6 -0
- package/dist/templates/contents/themes/starter/blocks/cta-section/schema.ts +32 -0
- package/dist/templates/contents/themes/starter/blocks/cta-section/thumbnail.png +0 -0
- package/dist/templates/contents/themes/starter/blocks/features-grid/component.tsx +119 -0
- package/dist/templates/contents/themes/starter/blocks/features-grid/config.ts +11 -0
- package/dist/templates/contents/themes/starter/blocks/features-grid/fields.ts +97 -0
- package/dist/templates/contents/themes/starter/blocks/features-grid/index.ts +6 -0
- package/dist/templates/contents/themes/starter/blocks/features-grid/schema.ts +40 -0
- package/dist/templates/contents/themes/starter/blocks/features-grid/thumbnail.png +0 -0
- package/dist/templates/contents/themes/starter/blocks/hero/component.tsx +105 -0
- package/dist/templates/contents/themes/starter/blocks/hero/config.ts +11 -0
- package/dist/templates/contents/themes/starter/blocks/hero/fields.ts +60 -0
- package/dist/templates/contents/themes/starter/blocks/hero/index.ts +6 -0
- package/dist/templates/contents/themes/starter/blocks/hero/schema.ts +33 -0
- package/dist/templates/contents/themes/starter/blocks/hero/thumbnail.png +0 -0
- package/dist/templates/contents/themes/starter/blocks/testimonials/component.tsx +116 -0
- package/dist/templates/contents/themes/starter/blocks/testimonials/config.ts +11 -0
- package/dist/templates/contents/themes/starter/blocks/testimonials/fields.ts +105 -0
- package/dist/templates/contents/themes/starter/blocks/testimonials/index.ts +6 -0
- package/dist/templates/contents/themes/starter/blocks/testimonials/schema.ts +41 -0
- package/dist/templates/contents/themes/starter/blocks/testimonials/thumbnail.png +0 -0
- package/dist/templates/contents/themes/starter/blocks/text-content/component.tsx +100 -0
- package/dist/templates/contents/themes/starter/blocks/text-content/config.ts +11 -0
- package/dist/templates/contents/themes/starter/blocks/text-content/fields.ts +88 -0
- package/dist/templates/contents/themes/starter/blocks/text-content/index.ts +6 -0
- package/dist/templates/contents/themes/starter/blocks/text-content/schema.ts +30 -0
- package/dist/templates/contents/themes/starter/blocks/text-content/thumbnail.png +0 -0
- package/dist/templates/contents/themes/starter/config/app.config.ts +8 -0
- package/dist/templates/contents/themes/starter/entities/tasks/tasks.config.ts +7 -0
- package/dist/templates/contents/themes/starter/tests/cypress/e2e/_utils/devtools/access.cy.ts +9 -1
- package/dist/templates/contents/themes/starter/tests/cypress/e2e/api/entities/tasks/TaskAPIController.js +2 -2
- package/dist/templates/contents/themes/starter/tests/cypress/e2e/uat/entities/tasks/tasks-crud.cy.ts +45 -38
- package/dist/templates/contents/themes/starter/tests/cypress/fixtures/entities.json +16 -0
- package/dist/templates/contents/themes/starter/tests/cypress/src/components/DevKeyringPOM.ts +3 -1
- package/dist/templates/contents/themes/starter/tests/cypress/src/core/BlockEditorBasePOM.ts +3 -3
- package/dist/templates/contents/themes/starter/tests/cypress/src/entities/PagesPOM.ts +137 -0
- package/dist/templates/contents/themes/starter/tests/cypress/src/entities/index.ts +2 -0
- package/dist/templates/contents/themes/starter/tests/cypress/src/index.ts +1 -0
- package/dist/templates/contents/themes/starter/tests/cypress/src/session-helpers.ts +42 -11
- package/dist/templates/contents/themes/starter/tests/cypress/support/commands.ts +29 -18
- package/dist/templates/features/blog/blocks/post-content/component.tsx +5 -1
- package/dist/templates/features/blog/blocks/post-content/schema.ts +1 -1
- package/dist/templates/features/pages/blocks/hero/component.tsx +3 -0
- package/dist/templates/features/pages/blocks/hero/schema.ts +1 -1
- package/dist/templates/proxy.ts +138 -53
- package/dist/types/blocks.d.ts.map +1 -1
- package/dist/types/blocks.js +1 -1
- package/dist/types/task.types.d.ts +1 -1
- package/dist/types/task.types.js +7 -7
- package/dist/utils/dev/TranslationDebugger.js +2 -2
- package/package.json +14 -5
- package/scripts/build/registry/__tests__/block-registry.test.mjs +73 -0
- package/scripts/build/registry/__tests__/icons-discovery.test.mjs +130 -0
- package/scripts/build/registry/__tests__/identifier.test.mjs +65 -0
- package/scripts/build/registry/__tests__/page-generator.test.mjs +430 -0
- package/scripts/build/registry/__tests__/scheduled-actions-registry.test.mjs +41 -0
- package/scripts/build/registry/__tests__/template-registry.test.mjs +89 -0
- package/scripts/build/registry/discovery/icons.mjs +275 -0
- package/scripts/build/registry/discovery/index.mjs +1 -0
- package/scripts/build/registry/generators/block-registry.mjs +203 -55
- package/scripts/build/registry/generators/feature-registry.mjs +9 -2
- package/scripts/build/registry/generators/icon-registry.mjs +56 -0
- package/scripts/build/registry/generators/identifier.mjs +28 -0
- package/scripts/build/registry/generators/index.mjs +1 -0
- package/scripts/build/registry/generators/plugin-registry.mjs +4 -3
- package/scripts/build/registry/generators/scheduled-actions-registry.mjs +4 -2
- package/scripts/build/registry/generators/template-registry.mjs +49 -41
- package/scripts/build/registry/generators/theme-registry.mjs +6 -7
- package/scripts/build/registry/post-build/page-generator.mjs +380 -59
- package/scripts/build/registry.mjs +9 -1
- package/templates/app/(auth)/forgot-password/page.tsx +2 -2
- package/templates/app/(auth)/reset-password/page.tsx +6 -6
- package/templates/app/403/page.tsx +6 -6
- package/templates/app/api/v1/teams/switch/route.ts +24 -5
- package/templates/app/dashboard/(main)/[entity]/layout.tsx +9 -7
- package/templates/app/dashboard/(main)/layout.tsx +4 -3
- package/templates/app/dashboard/settings/api-keys/page.tsx +36 -34
- package/templates/app/dashboard/settings/profile/page.tsx +7 -6
- package/templates/app/dashboard/settings/security/page.tsx +5 -4
- package/templates/app/layout.ppr.tsx +8 -8
- package/templates/app/layout.tsx +12 -17
- package/templates/blocks/cta-section/component.tsx +5 -2
- package/templates/blocks/cta-section/config.ts +3 -2
- package/templates/blocks/cta-section/fields.ts +2 -2
- package/templates/blocks/cta-section/schema.ts +2 -2
- package/templates/blocks/features-grid/component.tsx +10 -2
- package/templates/blocks/features-grid/config.ts +3 -2
- package/templates/blocks/features-grid/fields.ts +2 -2
- package/templates/blocks/features-grid/schema.ts +2 -2
- package/templates/blocks/hero/component.tsx +6 -3
- package/templates/blocks/hero/config.ts +3 -2
- package/templates/blocks/hero/fields.ts +2 -2
- package/templates/blocks/hero/schema.ts +2 -2
- package/templates/blocks/testimonials/component.tsx +6 -3
- package/templates/blocks/testimonials/config.ts +3 -2
- package/templates/blocks/testimonials/fields.ts +2 -2
- package/templates/blocks/testimonials/schema.ts +2 -2
- package/templates/blocks/text-content/component.tsx +7 -3
- package/templates/blocks/text-content/config.ts +3 -2
- package/templates/blocks/text-content/fields.ts +2 -2
- package/templates/blocks/text-content/schema.ts +2 -2
- package/templates/contents/themes/starter/blocks/cta-section/component.tsx +102 -0
- package/templates/contents/themes/starter/blocks/cta-section/config.ts +11 -0
- package/templates/contents/themes/starter/blocks/cta-section/fields.ts +89 -0
- package/templates/contents/themes/starter/blocks/cta-section/index.ts +6 -0
- package/templates/contents/themes/starter/blocks/cta-section/schema.ts +32 -0
- package/templates/contents/themes/starter/blocks/cta-section/thumbnail.png +0 -0
- package/templates/contents/themes/starter/blocks/features-grid/component.tsx +119 -0
- package/templates/contents/themes/starter/blocks/features-grid/config.ts +11 -0
- package/templates/contents/themes/starter/blocks/features-grid/fields.ts +97 -0
- package/templates/contents/themes/starter/blocks/features-grid/index.ts +6 -0
- package/templates/contents/themes/starter/blocks/features-grid/schema.ts +40 -0
- package/templates/contents/themes/starter/blocks/features-grid/thumbnail.png +0 -0
- package/templates/contents/themes/starter/blocks/hero/component.tsx +105 -0
- package/templates/contents/themes/starter/blocks/hero/config.ts +11 -0
- package/templates/contents/themes/starter/blocks/hero/fields.ts +60 -0
- package/templates/contents/themes/starter/blocks/hero/index.ts +6 -0
- package/templates/contents/themes/starter/blocks/hero/schema.ts +33 -0
- package/templates/contents/themes/starter/blocks/hero/thumbnail.png +0 -0
- package/templates/contents/themes/starter/blocks/testimonials/component.tsx +116 -0
- package/templates/contents/themes/starter/blocks/testimonials/config.ts +11 -0
- package/templates/contents/themes/starter/blocks/testimonials/fields.ts +105 -0
- package/templates/contents/themes/starter/blocks/testimonials/index.ts +6 -0
- package/templates/contents/themes/starter/blocks/testimonials/schema.ts +41 -0
- package/templates/contents/themes/starter/blocks/testimonials/thumbnail.png +0 -0
- package/templates/contents/themes/starter/blocks/text-content/component.tsx +100 -0
- package/templates/contents/themes/starter/blocks/text-content/config.ts +11 -0
- package/templates/contents/themes/starter/blocks/text-content/fields.ts +88 -0
- package/templates/contents/themes/starter/blocks/text-content/index.ts +6 -0
- package/templates/contents/themes/starter/blocks/text-content/schema.ts +30 -0
- package/templates/contents/themes/starter/blocks/text-content/thumbnail.png +0 -0
- package/templates/contents/themes/starter/config/app.config.ts +8 -0
- package/templates/contents/themes/starter/entities/tasks/tasks.config.ts +7 -0
- package/templates/contents/themes/starter/tests/cypress/e2e/_utils/devtools/access.cy.ts +9 -1
- package/templates/contents/themes/starter/tests/cypress/e2e/api/entities/tasks/TaskAPIController.js +2 -2
- package/templates/contents/themes/starter/tests/cypress/e2e/uat/entities/tasks/tasks-crud.cy.ts +45 -38
- package/templates/contents/themes/starter/tests/cypress/fixtures/entities.json +16 -0
- package/templates/contents/themes/starter/tests/cypress/src/components/DevKeyringPOM.ts +3 -1
- package/templates/contents/themes/starter/tests/cypress/src/core/BlockEditorBasePOM.ts +3 -3
- package/templates/contents/themes/starter/tests/cypress/src/entities/PagesPOM.ts +137 -0
- package/templates/contents/themes/starter/tests/cypress/src/entities/index.ts +2 -0
- package/templates/contents/themes/starter/tests/cypress/src/index.ts +1 -0
- package/templates/contents/themes/starter/tests/cypress/src/session-helpers.ts +42 -11
- package/templates/contents/themes/starter/tests/cypress/support/commands.ts +29 -18
- package/templates/features/blog/blocks/post-content/component.tsx +5 -1
- package/templates/features/blog/blocks/post-content/schema.ts +1 -1
- package/templates/features/pages/blocks/hero/component.tsx +3 -0
- package/templates/features/pages/blocks/hero/schema.ts +1 -1
- package/templates/proxy.ts +138 -53
- package/tests/jest/__mocks__/@nextsparkjs/registries/block-registry.client.ts +9 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/block-registry.lazy.ts +5 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/icon-registry.ts +42 -0
- package/tests/jest/__mocks__/next-intl-server.js +85 -5
- package/tests/jest/__mocks__/next-server.js +32 -0
|
@@ -45,7 +45,7 @@ function useEntityConfig(entityType, options = {}) {
|
|
|
45
45
|
const allEntities = getAllEntityConfigs();
|
|
46
46
|
const foundEntity = allEntities.find((entity) => entity.slug === entityType);
|
|
47
47
|
if (!foundEntity) {
|
|
48
|
-
const error = `
|
|
48
|
+
const error = `Entity "${entityType}" not found in the registry`;
|
|
49
49
|
setState({
|
|
50
50
|
config: null,
|
|
51
51
|
isLoading: false,
|
|
@@ -78,7 +78,7 @@ function useEntityConfig(entityType, options = {}) {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
} catch (err) {
|
|
81
|
-
const error = err instanceof Error ? err.message : "
|
|
81
|
+
const error = err instanceof Error ? err.message : "Unknown error loading entity configuration";
|
|
82
82
|
setState({
|
|
83
83
|
config: null,
|
|
84
84
|
isLoading: false,
|
|
@@ -35,35 +35,35 @@ function useEntitySearch() {
|
|
|
35
35
|
{
|
|
36
36
|
id: "dashboard",
|
|
37
37
|
title: "Dashboard",
|
|
38
|
-
description: "
|
|
38
|
+
description: "Main panel with statistics and quick actions",
|
|
39
39
|
url: "/dashboard",
|
|
40
40
|
category: "Navigation"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
id: "profile",
|
|
44
|
-
title: "
|
|
45
|
-
description: "
|
|
44
|
+
title: "Profile Settings",
|
|
45
|
+
description: "Update personal information and preferences",
|
|
46
46
|
url: "/dashboard/settings/profile",
|
|
47
47
|
category: "Settings"
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
id: "security",
|
|
51
|
-
title: "
|
|
52
|
-
description: "
|
|
51
|
+
title: "Security Settings",
|
|
52
|
+
description: "Two-factor authentication and active sessions",
|
|
53
53
|
url: "/dashboard/settings/security",
|
|
54
54
|
category: "Settings"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
id: "notifications",
|
|
58
|
-
title: "
|
|
59
|
-
description: "
|
|
58
|
+
title: "Notification Settings",
|
|
59
|
+
description: "Email and push notification preferences",
|
|
60
60
|
url: "/dashboard/settings/notifications",
|
|
61
61
|
category: "Settings"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
id: "billing",
|
|
65
|
-
title: "
|
|
66
|
-
description: "
|
|
65
|
+
title: "Billing",
|
|
66
|
+
description: "Plans, payment methods and billing history",
|
|
67
67
|
url: "/dashboard/settings/billing",
|
|
68
68
|
category: "Settings"
|
|
69
69
|
}
|
|
@@ -80,7 +80,7 @@ function useEntitySearch() {
|
|
|
80
80
|
return availableEntities.map((entity) => ({
|
|
81
81
|
id: `entity-${entity.slug}`,
|
|
82
82
|
title: entity.names.singular,
|
|
83
|
-
description: `
|
|
83
|
+
description: `Manage ${entity.names.plural.toLowerCase()}`,
|
|
84
84
|
entityType: entity.slug,
|
|
85
85
|
type: "entity",
|
|
86
86
|
url: `/dashboard/${entity.slug}`,
|
|
@@ -3,8 +3,8 @@ import { useState } from "react";
|
|
|
3
3
|
const EXAMPLE_NOTIFICATIONS = [
|
|
4
4
|
{
|
|
5
5
|
id: "1",
|
|
6
|
-
title: "
|
|
7
|
-
message: "
|
|
6
|
+
title: "Welcome to the Dashboard",
|
|
7
|
+
message: "Your account has been set up successfully. Explore all the available features.",
|
|
8
8
|
type: "success",
|
|
9
9
|
timestamp: new Date(Date.now() - 2 * 60 * 1e3),
|
|
10
10
|
// 2 minutos atrás
|
|
@@ -13,8 +13,8 @@ const EXAMPLE_NOTIFICATIONS = [
|
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
id: "2",
|
|
16
|
-
title: "
|
|
17
|
-
message: "
|
|
16
|
+
title: "New pending task",
|
|
17
|
+
message: "You have 3 incomplete tasks. Want to review them now?",
|
|
18
18
|
type: "info",
|
|
19
19
|
timestamp: new Date(Date.now() - 15 * 60 * 1e3),
|
|
20
20
|
// 15 minutos atrás
|
|
@@ -23,8 +23,8 @@ const EXAMPLE_NOTIFICATIONS = [
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
id: "3",
|
|
26
|
-
title: "
|
|
27
|
-
message: "
|
|
26
|
+
title: "Security settings",
|
|
27
|
+
message: "We recommend enabling two-factor authentication for extra security.",
|
|
28
28
|
type: "warning",
|
|
29
29
|
timestamp: new Date(Date.now() - 2 * 60 * 60 * 1e3),
|
|
30
30
|
// 2 horas atrás
|
|
@@ -33,8 +33,8 @@ const EXAMPLE_NOTIFICATIONS = [
|
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
id: "4",
|
|
36
|
-
title: "
|
|
37
|
-
message: "
|
|
36
|
+
title: "Profile updated",
|
|
37
|
+
message: "Your profile information has been updated successfully.",
|
|
38
38
|
type: "success",
|
|
39
39
|
timestamp: new Date(Date.now() - 24 * 60 * 60 * 1e3),
|
|
40
40
|
// 1 día atrás
|
|
@@ -43,8 +43,8 @@ const EXAMPLE_NOTIFICATIONS = [
|
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
id: "5",
|
|
46
|
-
title: "
|
|
47
|
-
message: "
|
|
46
|
+
title: "New login detected",
|
|
47
|
+
message: "A new sign-in was detected from Chrome in Mexico City.",
|
|
48
48
|
type: "info",
|
|
49
49
|
timestamp: new Date(Date.now() - 3 * 24 * 60 * 60 * 1e3),
|
|
50
50
|
// 3 días atrás
|
|
@@ -52,8 +52,8 @@ const EXAMPLE_NOTIFICATIONS = [
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
id: "6",
|
|
55
|
-
title: "Backup
|
|
56
|
-
message: "
|
|
55
|
+
title: "Backup completed",
|
|
56
|
+
message: "Your data has been backed up successfully.",
|
|
57
57
|
type: "success",
|
|
58
58
|
timestamp: new Date(Date.now() - 7 * 24 * 60 * 60 * 1e3),
|
|
59
59
|
// 1 semana atrás
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetch.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrefetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePrefetch.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrefetch.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB;;;EA0BlC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,cAgBnD"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { TEAMS_QUERY_KEY, fetchUserTeams } from "../contexts/TeamContext.js";
|
|
5
|
+
import { useAuth } from "./useAuth.js";
|
|
5
6
|
const USER_PROFILE_QUERY_KEY = ["user-profile"];
|
|
6
7
|
async function fetchUserProfile() {
|
|
7
8
|
const response = await fetch("/api/user/profile");
|
|
@@ -12,6 +13,7 @@ async function fetchUserProfile() {
|
|
|
12
13
|
}
|
|
13
14
|
function usePrefetchSettings() {
|
|
14
15
|
const queryClient = useQueryClient();
|
|
16
|
+
const { user } = useAuth();
|
|
15
17
|
const prefetchProfile = useCallback(() => {
|
|
16
18
|
queryClient.prefetchQuery({
|
|
17
19
|
queryKey: USER_PROFILE_QUERY_KEY,
|
|
@@ -21,13 +23,15 @@ function usePrefetchSettings() {
|
|
|
21
23
|
});
|
|
22
24
|
}, [queryClient]);
|
|
23
25
|
const prefetchTeams = useCallback(() => {
|
|
26
|
+
if (!user) return;
|
|
24
27
|
queryClient.prefetchQuery({
|
|
25
|
-
|
|
28
|
+
// The key TeamProvider reads: the teams of this user
|
|
29
|
+
queryKey: [...TEAMS_QUERY_KEY, user.id],
|
|
26
30
|
queryFn: fetchUserTeams,
|
|
27
31
|
staleTime: 1e3 * 60 * 5
|
|
28
32
|
// 5 minutes
|
|
29
33
|
});
|
|
30
|
-
}, [queryClient]);
|
|
34
|
+
}, [queryClient, user]);
|
|
31
35
|
return {
|
|
32
36
|
prefetchProfile,
|
|
33
37
|
prefetchTeams
|
package/dist/hooks/useSearch.js
CHANGED
|
@@ -21,11 +21,11 @@ const generateEntitySearchResults = () => {
|
|
|
21
21
|
return {
|
|
22
22
|
id: `entity-${entry.name}`,
|
|
23
23
|
title: displayName,
|
|
24
|
-
description: `
|
|
24
|
+
description: `Manage ${((_c = (_b = config.names) == null ? void 0 : _b.plural) == null ? void 0 : _c.toLowerCase()) || displayName.toLowerCase()}`,
|
|
25
25
|
type: entry.name,
|
|
26
26
|
// Map to specific entity types
|
|
27
27
|
url: `/dashboard/${config.slug || entry.name}`,
|
|
28
|
-
category: "
|
|
28
|
+
category: "Entities",
|
|
29
29
|
entityType: entry.name,
|
|
30
30
|
priority: "medium"
|
|
31
31
|
};
|
|
@@ -41,43 +41,43 @@ const getSearchableFields = (entityConfig) => {
|
|
|
41
41
|
const SYSTEM_PAGES = [
|
|
42
42
|
{
|
|
43
43
|
title: "Dashboard",
|
|
44
|
-
description: "
|
|
44
|
+
description: "Main panel with statistics and quick actions",
|
|
45
45
|
type: "page",
|
|
46
46
|
url: "/dashboard"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
title: "
|
|
50
|
-
description: "
|
|
49
|
+
title: "Task Management",
|
|
50
|
+
description: "Create, edit and organize your tasks",
|
|
51
51
|
type: "page",
|
|
52
52
|
url: "/dashboard/tasks"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
title: "
|
|
56
|
-
description: "
|
|
55
|
+
title: "Profile Settings",
|
|
56
|
+
description: "Update personal information and preferences",
|
|
57
57
|
type: "setting",
|
|
58
58
|
url: "/dashboard/settings/profile"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
|
-
title: "
|
|
62
|
-
description: "
|
|
61
|
+
title: "Security Settings",
|
|
62
|
+
description: "Two-factor authentication and active sessions",
|
|
63
63
|
type: "setting",
|
|
64
64
|
url: "/dashboard/settings/security"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
|
-
title: "
|
|
68
|
-
description: "
|
|
67
|
+
title: "Notification Settings",
|
|
68
|
+
description: "Email and push notification preferences",
|
|
69
69
|
type: "setting",
|
|
70
70
|
url: "/dashboard/settings/notifications"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
title: "
|
|
74
|
-
description: "
|
|
73
|
+
title: "Password Settings",
|
|
74
|
+
description: "Change password and security options",
|
|
75
75
|
type: "setting",
|
|
76
76
|
url: "/dashboard/settings/password"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
title: "
|
|
80
|
-
description: "
|
|
79
|
+
title: "Billing",
|
|
80
|
+
description: "Plans, payment methods and billing history",
|
|
81
81
|
type: "setting",
|
|
82
82
|
url: "/dashboard/settings/billing"
|
|
83
83
|
}
|
|
@@ -12,6 +12,21 @@ export interface UseSessionCookieRefreshOptions {
|
|
|
12
12
|
refreshOnMount?: boolean;
|
|
13
13
|
/** Set to false to turn the hook off (e.g. on public/auth pages). Default: true. */
|
|
14
14
|
enabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Called with each refresh's answer: the session, or `data: null` when there is
|
|
17
|
+
* none. `session.isCurrent()` turns false once the hook is turned off (a
|
|
18
|
+
* sign-out), so work the answer starts can drop what arrives after that.
|
|
19
|
+
*/
|
|
20
|
+
onRefresh?: (result: SessionRefreshResult, session: SessionRefreshContext) => void;
|
|
21
|
+
}
|
|
22
|
+
/** What `refreshSessionCookie()` answers. */
|
|
23
|
+
export type SessionRefreshResult = {
|
|
24
|
+
data?: unknown;
|
|
25
|
+
error?: unknown;
|
|
26
|
+
} | null | undefined;
|
|
27
|
+
/** Passed with each answer: whether the session it belongs to is still the page's. */
|
|
28
|
+
export interface SessionRefreshContext {
|
|
29
|
+
isCurrent: () => boolean;
|
|
15
30
|
}
|
|
16
31
|
export declare const DEFAULT_SESSION_REFRESH_INTERVAL_MS: number;
|
|
17
32
|
/**
|
|
@@ -29,7 +44,9 @@ export declare const DEFAULT_SESSION_REFRESH_INTERVAL_MS: number;
|
|
|
29
44
|
*
|
|
30
45
|
* Calls are throttled by `minIntervalMs`; a failed call (offline, server
|
|
31
46
|
* down) does not count towards the throttle, so the next trigger retries.
|
|
32
|
-
* Anonymous visitors just get a cheap `null` session response.
|
|
47
|
+
* Anonymous visitors just get a cheap `null` session response. Turning the
|
|
48
|
+
* hook off (a sign-out) drops the answer of a call still on the wire, and
|
|
49
|
+
* turning it on again reads the session at once, whatever the throttle says.
|
|
33
50
|
*/
|
|
34
51
|
export declare function useSessionCookieRefresh(options?: UseSessionCookieRefreshOptions): void;
|
|
35
52
|
//# sourceMappingURL=useSessionCookieRefresh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionCookieRefresh.d.ts","sourceRoot":"","sources":["../../src/hooks/useSessionCookieRefresh.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useSessionCookieRefresh.d.ts","sourceRoot":"","sources":["../../src/hooks/useSessionCookieRefresh.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAA;CACnF;AAED,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAA;AAEzF,sFAAsF;AACtF,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,OAAO,CAAA;CACzB;AAED,eAAO,MAAM,mCAAmC,QAAgB,CAAA;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,8BAAmC,QAiEnF"}
|
|
@@ -10,20 +10,33 @@ function useSessionCookieRefresh(options = {}) {
|
|
|
10
10
|
} = options;
|
|
11
11
|
const lastRefreshAtRef = useRef(0);
|
|
12
12
|
const inFlightRef = useRef(false);
|
|
13
|
+
const generationRef = useRef(0);
|
|
14
|
+
const onRefreshRef = useRef(options.onRefresh);
|
|
15
|
+
onRefreshRef.current = options.onRefresh;
|
|
13
16
|
useEffect(() => {
|
|
14
|
-
if (
|
|
17
|
+
if (typeof window === "undefined") return;
|
|
18
|
+
if (!enabled) {
|
|
19
|
+
generationRef.current++;
|
|
20
|
+
inFlightRef.current = false;
|
|
21
|
+
lastRefreshAtRef.current = 0;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
15
24
|
const refresh = async () => {
|
|
25
|
+
var _a;
|
|
16
26
|
if (inFlightRef.current) return;
|
|
17
27
|
const now = Date.now();
|
|
18
28
|
if (now - lastRefreshAtRef.current < minIntervalMs) return;
|
|
29
|
+
const generation = generationRef.current;
|
|
30
|
+
const current = () => generation === generationRef.current;
|
|
19
31
|
inFlightRef.current = true;
|
|
20
32
|
lastRefreshAtRef.current = now;
|
|
21
33
|
try {
|
|
22
|
-
await refreshSessionCookie();
|
|
34
|
+
const result = await refreshSessionCookie();
|
|
35
|
+
if (current()) (_a = onRefreshRef.current) == null ? void 0 : _a.call(onRefreshRef, result, { isCurrent: current });
|
|
23
36
|
} catch {
|
|
24
|
-
lastRefreshAtRef.current = 0;
|
|
37
|
+
if (current()) lastRefreshAtRef.current = 0;
|
|
25
38
|
} finally {
|
|
26
|
-
inFlightRef.current = false;
|
|
39
|
+
if (current()) inFlightRef.current = false;
|
|
27
40
|
}
|
|
28
41
|
};
|
|
29
42
|
const onVisibilityChange = () => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this browser is signed in, as the session hint says (see
|
|
3
|
+
* lib/auth/session-hint), following it as it changes: a sign-in or sign-out on
|
|
4
|
+
* the page, or the tab coming back into view. `ready` stays false through the
|
|
5
|
+
* server render and hydration, which cannot read the cookie, so both render the
|
|
6
|
+
* same thing until the effect runs.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSessionHint(): {
|
|
9
|
+
ready: boolean;
|
|
10
|
+
signedIn: boolean;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useSessionHint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSessionHint.d.ts","sourceRoot":"","sources":["../../src/hooks/useSessionHint.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAStE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { hasSessionHint, subscribeSessionHint } from "../lib/auth/session-hint.js";
|
|
4
|
+
const signedOutOnServer = () => false;
|
|
5
|
+
function useSessionHint() {
|
|
6
|
+
const [ready, setReady] = useState(false);
|
|
7
|
+
const signedIn = useSyncExternalStore(subscribeSessionHint, hasSessionHint, signedOutOnServer);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setReady(true);
|
|
10
|
+
}, []);
|
|
11
|
+
return { ready, signedIn: ready && signedIn };
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
useSessionHint
|
|
15
|
+
};
|
|
@@ -8,14 +8,14 @@ function useTranslationPreload(context = "auto") {
|
|
|
8
8
|
const locale = useLocale();
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
const preloadNamespaces = async (namespaces, contextName) => {
|
|
11
|
-
console.log(`[TranslationPreload] \u{1F680}
|
|
11
|
+
console.log(`[TranslationPreload] \u{1F680} Starting ${contextName} preload for ${locale}:`, namespaces);
|
|
12
12
|
const promises = namespaces.map(async (namespace) => {
|
|
13
13
|
try {
|
|
14
14
|
await import(`../messages/${locale}/${namespace}.json`);
|
|
15
|
-
console.log(`[TranslationPreload] \u2713
|
|
15
|
+
console.log(`[TranslationPreload] \u2713 Preloaded: ${namespace}`);
|
|
16
16
|
return { namespace, success: true };
|
|
17
17
|
} catch (error) {
|
|
18
|
-
console.warn(`[TranslationPreload] \u26A0\uFE0F Error
|
|
18
|
+
console.warn(`[TranslationPreload] \u26A0\uFE0F Error preloading ${namespace}:`, error);
|
|
19
19
|
return { namespace, success: false, error };
|
|
20
20
|
}
|
|
21
21
|
});
|
|
@@ -23,7 +23,7 @@ function useTranslationPreload(context = "auto") {
|
|
|
23
23
|
const successful = results.filter(
|
|
24
24
|
(result) => result.status === "fulfilled" && result.value.success
|
|
25
25
|
).length;
|
|
26
|
-
console.log(`[TranslationPreload] \u2705
|
|
26
|
+
console.log(`[TranslationPreload] \u2705 ${contextName} preload complete: ${successful}/${namespaces.length} namespaces`);
|
|
27
27
|
};
|
|
28
28
|
const schedulePreload = () => {
|
|
29
29
|
let namespacesToLoad = [];
|
|
@@ -76,7 +76,7 @@ function useNavigationPreload() {
|
|
|
76
76
|
} else {
|
|
77
77
|
namespacesToLoad = PUBLIC_NAMESPACES;
|
|
78
78
|
}
|
|
79
|
-
console.log(`[NavigationPreload]
|
|
79
|
+
console.log(`[NavigationPreload] Preloading for ${pathname}:`, namespacesToLoad);
|
|
80
80
|
const promises = namespacesToLoad.map(
|
|
81
81
|
(namespace) => import(`../messages/${locale}/${namespace}.json`).catch((error) => {
|
|
82
82
|
console.warn(`[NavigationPreload] Error: ${namespace}`, error);
|
|
@@ -84,7 +84,7 @@ function useNavigationPreload() {
|
|
|
84
84
|
})
|
|
85
85
|
);
|
|
86
86
|
await Promise.all(promises);
|
|
87
|
-
console.log(`[NavigationPreload] \u2705
|
|
87
|
+
console.log(`[NavigationPreload] \u2705 Ready to navigate to ${pathname}`);
|
|
88
88
|
};
|
|
89
89
|
return { preloadForRoute };
|
|
90
90
|
}
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Not used to load translations: every request gets the merged
|
|
3
|
+
* catalog. Kept for code that imports it.
|
|
4
|
+
*/
|
|
1
5
|
declare const NAMESPACE_GROUPS: {
|
|
2
6
|
PUBLIC_INITIAL: string[];
|
|
3
7
|
DASHBOARD_AUTHENTICATED: string[];
|
|
4
8
|
AUTH_ONLY: string[];
|
|
5
9
|
ALL: string[];
|
|
6
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Not used to load translations: every request gets the merged
|
|
13
|
+
* catalog. Kept for code that imports it.
|
|
14
|
+
*/
|
|
7
15
|
declare function getPageNamespaces(pathname: string): string[];
|
|
16
|
+
/**
|
|
17
|
+
* The request config next-intl builds translations from. It reads nothing from
|
|
18
|
+
* the request itself: a page rendered with request data is dynamic, and the
|
|
19
|
+
* locale already comes from getUserLocale, resolved once per request.
|
|
20
|
+
*/
|
|
8
21
|
declare const _default: (params: import("next-intl/server").GetRequestConfigParams) => import("next-intl/server").RequestConfig | Promise<import("next-intl/server").RequestConfig>;
|
|
9
22
|
export default _default;
|
|
10
23
|
export { getPageNamespaces, NAMESPACE_GROUPS };
|
package/dist/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,QAAA,MAAM,gBAAgB;;;;;CAYrB,CAAC;AAEF;;;GAGG;AACH,iBAAS,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAsErD;AAYD;;;;GAIG;;AACH,wBA8BG;AAGH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC"}
|
package/dist/i18n.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getRequestConfig } from "next-intl/server";
|
|
2
2
|
import { I18N_CONFIG } from "./lib/config/index.js";
|
|
3
|
-
import { headers } from "next/headers";
|
|
4
3
|
import { loadMergedTranslations } from "./lib/translations/registry.js";
|
|
5
4
|
import { getUserLocale } from "./lib/locale.js";
|
|
6
5
|
const DEBUG_I18N = process.env.NEXTSPARK_DEBUG_I18N === "true";
|
|
@@ -67,33 +66,9 @@ async function getServerLocale() {
|
|
|
67
66
|
return I18N_CONFIG.defaultLocale;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
|
-
var i18n_default = getRequestConfig(async () => {
|
|
71
|
-
|
|
69
|
+
var i18n_default = getRequestConfig(async ({ locale: requestedLocale }) => {
|
|
70
|
+
const locale = I18N_CONFIG.supportedLocales.includes(requestedLocale) ? requestedLocale : await getServerLocale();
|
|
72
71
|
try {
|
|
73
|
-
locale = await getServerLocale();
|
|
74
|
-
} catch {
|
|
75
|
-
locale = I18N_CONFIG.defaultLocale;
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
let pathname = "";
|
|
79
|
-
try {
|
|
80
|
-
const headersList = await headers();
|
|
81
|
-
pathname = headersList.get("x-pathname") || headersList.get("x-url") || "";
|
|
82
|
-
if (!pathname) {
|
|
83
|
-
const referer = headersList.get("referer") || "";
|
|
84
|
-
if (referer) {
|
|
85
|
-
try {
|
|
86
|
-
const url = new URL(referer);
|
|
87
|
-
pathname = url.pathname;
|
|
88
|
-
if (DEBUG_I18N) {
|
|
89
|
-
console.log(`[i18n] Extracted pathname from referer: "${pathname}"`);
|
|
90
|
-
}
|
|
91
|
-
} catch {
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
} catch {
|
|
96
|
-
}
|
|
97
72
|
const messages = await loadMergedTranslations(locale);
|
|
98
73
|
if (DEBUG_I18N) {
|
|
99
74
|
console.log(`[i18n] Loaded merged translations for ${locale} with ${Object.keys(messages).length} namespaces`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.actions.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/entity.actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity.actions.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/entity.actions.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EAElB,MAAM,SAAS,CAAA;AAqChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAwDhC;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CA+DhC;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,sBAAsB,CAAC,CA4DjC;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,SAAS,CAAC,CAAC,GAAG,OAAO,EACzC,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAsCvC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAoClD;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EAAE,EACb,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CA0DhD;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAuCtC;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAkCrC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { revalidatePath, revalidateTag } from "next/cache";
|
|
3
3
|
import { headers, cookies } from "next/headers";
|
|
4
|
+
import { ACTIVE_TEAM_COOKIE, activeTeamIdForSession } from "../teams/active-team-cookie.js";
|
|
4
5
|
import { redirect } from "next/navigation";
|
|
5
6
|
import { GenericEntityService } from "../services/generic-entity.service.js";
|
|
6
7
|
import { entityRegistry } from "../entities/registry.js";
|
|
7
8
|
import { getTypedSession } from "../auth.js";
|
|
8
9
|
import { checkPermission } from "../permissions/check.js";
|
|
9
10
|
async function getAuthContext() {
|
|
10
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
11
12
|
const headersList = await headers();
|
|
12
13
|
const session = await getTypedSession(headersList);
|
|
13
14
|
if (!((_a = session == null ? void 0 : session.user) == null ? void 0 : _a.id)) {
|
|
14
15
|
return { success: false, error: "Authentication required" };
|
|
15
16
|
}
|
|
16
17
|
const cookieStore = await cookies();
|
|
17
|
-
const teamId = (_b = cookieStore.get(
|
|
18
|
+
const teamId = activeTeamIdForSession((_b = cookieStore.get(ACTIVE_TEAM_COOKIE)) == null ? void 0 : _b.value, (_c = session.session) == null ? void 0 : _c.id);
|
|
18
19
|
if (!teamId) {
|
|
19
20
|
return { success: false, error: "No active team selected" };
|
|
20
21
|
}
|
|
@@ -45,6 +45,8 @@ export interface DualAuthResult {
|
|
|
45
45
|
scopes?: string[];
|
|
46
46
|
/** `api_key.id` of the key that authenticated the request (type 'api-key' only). Used for audit logging (#105). */
|
|
47
47
|
keyId?: string;
|
|
48
|
+
/** The session's id (type 'session' only): the active team cookie counts only for it. */
|
|
49
|
+
sessionId?: string;
|
|
48
50
|
rateLimitResponse?: Response;
|
|
49
51
|
/** Set when a dev-only x-act-as-user override replaced the real caller. */
|
|
50
52
|
actingAs?: {
|
|
@@ -88,7 +90,8 @@ export declare function hasRequiredScope(authResult: DualAuthResult, requiredSco
|
|
|
88
90
|
/**
|
|
89
91
|
* Resolve and validate team context from request.
|
|
90
92
|
*
|
|
91
|
-
* Resolution priority: x-team-id header > activeTeamId cookie
|
|
93
|
+
* Resolution priority: x-team-id header > the activeTeamId cookie this session wrote >
|
|
94
|
+
* user's defaultTeamId
|
|
92
95
|
*
|
|
93
96
|
* Returns the validated teamId string on success, or a NextResponse error if:
|
|
94
97
|
* - No team context can be resolved (400)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dual-auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/auth/dual-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"dual-auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/auth/dual-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAMvD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAKrB,MAAM,gBAAgB,CAAA;AAEvB,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAK/F;;;GAGG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,mBAAmB,mBAAmB,CAAA;AACnD,eAAO,MAAM,kBAAkB,8BAA8B,CAAA;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AAOjD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;IACpC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,mHAAmH;IACnH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iBAAiB,CAAC,EAAE,QAAQ,CAAA;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,EAAE;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3D,0EAA0E;IAC1E,KAAK,CAAC,EAAE,eAAe,CAAA;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,cAAc,CAAC,CAsCzB;AAwKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAUtG;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,cAAc,GACzB,OAAO,CAAC,MAAM,GAAG,YAAY,CAAC,CAsChC;AAMD;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AA2BD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,MAAkC,EAAE,MAAM,GAAE,MAAY;;;;GAShG;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,cAAc,GAAG,YAAY,CAUlF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ACTIVE_TEAM_COOKIE, activeTeamIdForSession } from "../../teams/active-team-cookie.js";
|
|
2
|
+
import { getUserDefaultTeamId } from "../../teams/dashboard-team.js";
|
|
1
3
|
import { NextResponse } from "next/server";
|
|
2
4
|
import { auth } from "../../auth.js";
|
|
3
5
|
import { validateApiKey } from "../auth.js";
|
|
@@ -15,21 +17,6 @@ const ADMIN_BYPASS_HEADER = "x-admin-bypass";
|
|
|
15
17
|
const ADMIN_BYPASS_VALUE = "confirm-cross-team-access";
|
|
16
18
|
const ACT_AS_USER_HEADER = "x-act-as-user";
|
|
17
19
|
const ELEVATED_ROLES = ["superadmin", "developer"];
|
|
18
|
-
async function getUserDefaultTeamId(userId) {
|
|
19
|
-
try {
|
|
20
|
-
const result = await queryOne(
|
|
21
|
-
`SELECT "teamId" FROM "team_members"
|
|
22
|
-
WHERE "userId" = $1
|
|
23
|
-
ORDER BY "joinedAt" ASC
|
|
24
|
-
LIMIT 1`,
|
|
25
|
-
[userId]
|
|
26
|
-
);
|
|
27
|
-
return result == null ? void 0 : result.teamId;
|
|
28
|
-
} catch (error) {
|
|
29
|
-
console.error("[dual-auth] Failed to get default team:", error);
|
|
30
|
-
return void 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
20
|
async function authenticateRequest(request, options = {}) {
|
|
34
21
|
const apiKeyResult = await tryApiKeyAuth(request);
|
|
35
22
|
if (apiKeyResult.success) {
|
|
@@ -131,6 +118,7 @@ async function tryApiKeyAuth(request) {
|
|
|
131
118
|
}
|
|
132
119
|
}
|
|
133
120
|
async function trySessionAuth(request) {
|
|
121
|
+
var _a;
|
|
134
122
|
try {
|
|
135
123
|
console.log("[dual-auth] Attempting session authentication...");
|
|
136
124
|
const session = await auth.api.getSession({ headers: request.headers });
|
|
@@ -144,6 +132,7 @@ async function trySessionAuth(request) {
|
|
|
144
132
|
return {
|
|
145
133
|
success: true,
|
|
146
134
|
type: "session",
|
|
135
|
+
sessionId: (_a = session.session) == null ? void 0 : _a.id,
|
|
147
136
|
user: {
|
|
148
137
|
id: session.user.id,
|
|
149
138
|
email: session.user.email,
|
|
@@ -171,7 +160,7 @@ function hasRequiredScope(authResult, requiredScope) {
|
|
|
171
160
|
}
|
|
172
161
|
async function resolveTeamContext(request, authResult) {
|
|
173
162
|
var _a;
|
|
174
|
-
const teamId = request.headers.get("x-team-id") || ((_a = request.cookies.get(
|
|
163
|
+
const teamId = request.headers.get("x-team-id") || activeTeamIdForSession((_a = request.cookies.get(ACTIVE_TEAM_COOKIE)) == null ? void 0 : _a.value, authResult.sessionId) || authResult.user.defaultTeamId;
|
|
175
164
|
if (!teamId) {
|
|
176
165
|
return NextResponse.json(
|
|
177
166
|
{ success: false, error: "Team context required. Include x-team-id header." },
|