@donotdev/ui 0.0.31 → 0.1.1
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/LICENSE.md +3 -3
- package/dist/{GoToDialog-CR4VOVXT.js → GoToDialog-RU5RP7S2.js} +1 -1
- package/dist/chunk-ETE4RC7M.js +1 -0
- package/dist/components/auth/AuthHeader.d.ts +8 -3
- package/dist/components/auth/AuthHeader.d.ts.map +1 -1
- package/dist/components/auth/AuthHeader.js +6 -6
- package/dist/components/auth/AuthMenu.d.ts +2 -2
- package/dist/components/auth/AuthMenu.js +1 -1
- package/dist/components/common/FeatureCard.d.ts +2 -0
- package/dist/components/common/FeatureCard.d.ts.map +1 -1
- package/dist/components/common/FeatureCard.js +1 -1
- package/dist/components/common/FeatureDisabled.d.ts +2 -1
- package/dist/components/common/FeatureDisabled.d.ts.map +1 -1
- package/dist/components/common/FeatureDisabled.js +2 -2
- package/dist/components/common/ProgressBar.d.ts +1 -1
- package/dist/components/common/ProgressBar.js +2 -2
- package/dist/components/common/RedirectOverlay.d.ts +1 -1
- package/dist/components/common/RedirectOverlay.js +2 -2
- package/dist/components/common/Skeleton.d.ts +7 -7
- package/dist/components/common/Skeleton.js +8 -8
- package/dist/components/common/TechBento.d.ts +1 -0
- package/dist/components/common/TechBento.d.ts.map +1 -1
- package/dist/components/common/icon.d.ts +2 -1
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +2 -2
- package/dist/components/common/index.d.ts +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/cookie-consent/ConsentBanner.d.ts +1 -1
- package/dist/components/cookie-consent/ConsentBanner.js +2 -2
- package/dist/components/cookie-consent/CookieConsent.d.ts +1 -0
- package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/index.d.ts +1 -1
- package/dist/components/cookie-consent/index.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/layout/GameContainer.d.ts +1 -1
- package/dist/components/layout/GameContainer.js +2 -2
- package/dist/components/layout/GameFlow.d.ts +2 -2
- package/dist/components/layout/GameFlow.js +2 -2
- package/dist/components/layout/PageConfig.d.ts +25 -0
- package/dist/components/layout/PageConfig.d.ts.map +1 -0
- package/dist/components/layout/PageConfig.js +47 -0
- package/dist/components/layout/PageContainer.d.ts +1 -1
- package/dist/components/layout/PageContainer.js +2 -2
- package/dist/components/layout/components/Breadcrumbs.d.ts +3 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +2 -2
- package/dist/components/layout/components/DropdownNavigation.d.ts +1 -1
- package/dist/components/layout/components/DropdownNavigation.js +2 -2
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts +2 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.js +2 -2
- package/dist/components/layout/components/Notifications.d.ts +4 -4
- package/dist/components/layout/components/Notifications.js +3 -3
- package/dist/components/layout/components/header/AppBranding.d.ts +3 -2
- package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppBranding.js +2 -2
- package/dist/components/layout/components/header/AppIcon.d.ts +2 -1
- package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppIcon.js +2 -2
- package/dist/components/layout/components/header/AppTitle.d.ts +2 -1
- package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppTitle.js +2 -2
- package/dist/components/layout/components/header/CacheSettings.d.ts +1 -1
- package/dist/components/layout/components/header/CacheSettings.js +5 -5
- package/dist/components/layout/components/header/GameTitle.d.ts +2 -1
- package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/GameTitle.js +2 -2
- package/dist/components/layout/components/header/HeaderMenu.d.ts +2 -1
- package/dist/components/layout/components/header/HeaderMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderMenu.js +2 -2
- package/dist/components/layout/components/header/HeaderNavigation.d.ts +2 -1
- package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderNavigation.js +2 -2
- package/dist/components/layout/components/header/SettingsMenu.d.ts +2 -1
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +2 -2
- package/dist/components/layout/components/header/ThemeToggle.d.ts +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +2 -2
- package/dist/components/layout/components/index.d.ts +1 -1
- package/dist/components/layout/components/index.js +1 -1
- package/dist/components/layout/index.d.ts +2 -1
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +2 -1
- package/dist/components/license/LicenseWatermark.d.ts +1 -1
- package/dist/components/license/LicenseWatermark.js +2 -2
- package/dist/components/license/watermarkData.js +1 -1
- package/dist/crud/components/CrudCardLink.d.ts +1 -1
- package/dist/crud/components/EntityCardList.d.ts +1 -1
- package/dist/crud/components/EntityCardList.d.ts.map +1 -1
- package/dist/crud/components/EntityCardList.js +33 -22
- package/dist/crud/components/EntityDisplayRenderer.d.ts +1 -1
- package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityDisplayRenderer.js +14 -13
- package/dist/crud/components/EntityFormRenderer.d.ts +1 -1
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +18 -20
- package/dist/crud/components/EntityList.d.ts +1 -1
- package/dist/crud/components/EntityList.d.ts.map +1 -1
- package/dist/crud/components/EntityList.js +41 -25
- package/dist/crud/components/EntityRecommendations.d.ts +2 -2
- package/dist/crud/components/EntityRecommendations.d.ts.map +1 -1
- package/dist/crud/components/EntityRecommendations.js +6 -6
- package/dist/crud/components/EntityWorkflow.js +1 -1
- package/dist/crud/components/Form.d.ts +10 -10
- package/dist/crud/components/Form.js +12 -12
- package/dist/crud/components/index.d.ts +1 -1
- package/dist/crud/components/index.js +1 -1
- package/dist/crud/crudImports.d.ts +2 -1
- package/dist/crud/crudImports.d.ts.map +1 -1
- package/dist/crud/crudImports.js +2 -1
- package/dist/crud/index.d.ts +1 -1
- package/dist/crud/index.js +1 -1
- package/dist/data/techLogos.d.ts +1 -1
- package/dist/data/techLogos.js +1 -1
- package/dist/dndev-next.css +374 -81
- package/dist/dndev.css +455 -80
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/internal/common/DnDevErrorBoundary.d.ts +2 -2
- package/dist/internal/common/DnDevErrorBoundary.js +2 -2
- package/dist/internal/common/ErrorFallback.d.ts +1 -1
- package/dist/internal/common/ErrorFallback.js +3 -3
- package/dist/internal/common/GlobalErrorFallback.d.ts +1 -1
- package/dist/internal/common/GlobalErrorFallback.js +2 -2
- package/dist/internal/common/RouteErrorFallback.d.ts +1 -1
- package/dist/internal/common/RouteErrorFallback.js +2 -2
- package/dist/internal/devtools/DebugTools.js +2 -2
- package/dist/internal/devtools/components/AuthDebugButton.js +1 -1
- package/dist/internal/devtools/components/ConfigTab.js +1 -1
- package/dist/internal/devtools/components/CookieTab.js +1 -1
- package/dist/internal/devtools/components/DebugDialog.js +1 -1
- package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/DesignTab.js +7 -3
- package/dist/internal/devtools/components/LayoutReset.js +2 -2
- package/dist/internal/devtools/components/MaskedValue.js +1 -1
- package/dist/internal/devtools/components/StoresTab.js +1 -1
- package/dist/internal/devtools/components/index.d.ts +1 -1
- package/dist/internal/devtools/components/index.js +1 -1
- package/dist/internal/devtools/index.d.ts +1 -1
- package/dist/internal/devtools/index.js +1 -1
- package/dist/internal/devtools/types.d.ts +9 -9
- package/dist/internal/devtools/utils/envVarDiscovery.d.ts.map +1 -1
- package/dist/internal/devtools/utils/envVarDiscovery.js +5 -6
- package/dist/internal/devtools/utils/index.d.ts +1 -1
- package/dist/internal/devtools/utils/index.js +1 -1
- package/dist/internal/devtools/utils/maskSensitive.js +1 -1
- package/dist/internal/devtools/utils/virtualModuleInspector.d.ts.map +1 -1
- package/dist/internal/devtools/utils/virtualModuleInspector.js +3 -1
- package/dist/internal/initializers/BaseStoresInitializer.d.ts +3 -3
- package/dist/internal/initializers/BaseStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/BaseStoresInitializer.js +13 -4
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.js +2 -2
- package/dist/internal/initializers/ViteStoresInitializer.d.ts +1 -1
- package/dist/internal/initializers/ViteStoresInitializer.js +2 -2
- package/dist/internal/initializers/index.d.ts +1 -1
- package/dist/internal/initializers/index.js +1 -1
- package/dist/internal/layout/DnDevLayout.d.ts +2 -2
- package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.js +45 -18
- package/dist/internal/layout/components/AutoMetaTags.d.ts +4 -2
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +193 -57
- package/dist/internal/layout/components/FaviconHead.d.ts +1 -1
- package/dist/internal/layout/components/FaviconHead.js +2 -2
- package/dist/internal/layout/components/FontPreloadLinks.d.ts +1 -1
- package/dist/internal/layout/components/FontPreloadLinks.js +1 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts +3 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.js +47 -17
- package/dist/internal/layout/components/PWAUpdateNotification.d.ts +1 -1
- package/dist/internal/layout/components/PWAUpdateNotification.d.ts.map +1 -1
- package/dist/internal/layout/components/PWAUpdateNotification.js +17 -4
- package/dist/internal/layout/components/PerformanceHints.js +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.d.ts +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.js +2 -2
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +2 -2
- package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts +1 -1
- package/dist/internal/layout/components/footer/FooterLegalLinks.js +2 -2
- package/dist/internal/layout/components/index.d.ts +1 -1
- package/dist/internal/layout/components/index.js +1 -1
- package/dist/internal/layout/config/defaults.js +1 -1
- package/dist/internal/layout/config/index.d.ts +1 -1
- package/dist/internal/layout/config/index.js +1 -1
- package/dist/internal/layout/config/presets/admin.d.ts +1 -1
- package/dist/internal/layout/config/presets/blog.d.ts +1 -1
- package/dist/internal/layout/config/presets/docs.js +1 -1
- package/dist/internal/layout/config/presets/game.js +1 -1
- package/dist/internal/layout/config/presets/index.d.ts +1 -1
- package/dist/internal/layout/config/presets/landing.js +1 -1
- package/dist/internal/layout/config/presets/moolti.js +1 -1
- package/dist/internal/layout/config/presets/plain.d.ts +2 -2
- package/dist/internal/layout/config/presets/plain.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/plain.js +12 -1
- package/dist/internal/layout/renderers/index.d.ts +1 -1
- package/dist/internal/layout/renderers/index.js +1 -1
- package/dist/internal/layout/zones/DnDevFooter.d.ts +3 -1
- package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevFooter.js +6 -2
- package/dist/internal/layout/zones/DnDevHeader.d.ts +3 -1
- package/dist/internal/layout/zones/DnDevHeader.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevHeader.js +8 -3
- package/dist/internal/layout/zones/DnDevMergedBar.js +1 -1
- package/dist/internal/layout/zones/DnDevSidebar.d.ts +3 -1
- package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevSidebar.js +10 -4
- package/dist/internal/layout/zones/index.d.ts +1 -1
- package/dist/internal/layout/zones/index.js +1 -1
- package/dist/internal/providers/NavigationProvider.d.ts +1 -1
- package/dist/internal/providers/NavigationProvider.js +2 -2
- package/dist/internal/providers/SentryInitializer.d.ts +1 -1
- package/dist/internal/providers/SentryInitializer.js +2 -2
- package/dist/internal/providers/UIProviders.d.ts +1 -1
- package/dist/internal/providers/UIProviders.js +3 -3
- package/dist/internal/providers/index.d.ts +1 -1
- package/dist/internal/providers/index.js +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +1 -1
- package/dist/providers/NextJsAppProviders.d.ts +1 -1
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +5 -3
- package/dist/providers/ViteAppProviders.d.ts +1 -1
- package/dist/providers/ViteAppProviders.js +2 -2
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/routing/404.d.ts +2 -2
- package/dist/routing/404.js +3 -3
- package/dist/routing/AuthGuard.d.ts +14 -29
- package/dist/routing/AuthGuard.d.ts.map +1 -1
- package/dist/routing/AuthGuard.js +27 -72
- package/dist/routing/AuthGuardFallback.d.ts +1 -1
- package/dist/routing/AuthGuardFallback.js +2 -2
- package/dist/routing/AuthReturnTo.d.ts +13 -0
- package/dist/routing/AuthReturnTo.d.ts.map +1 -0
- package/dist/routing/AuthReturnTo.js +61 -0
- package/dist/routing/DnDevNavigationMenu.d.ts +2 -1
- package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
- package/dist/routing/DnDevNavigationMenu.js +2 -2
- package/dist/routing/GoTo.d.ts +1 -0
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +1 -1
- package/dist/routing/GoToDialog.js +1 -1
- package/dist/routing/GoToInput.js +1 -1
- package/dist/routing/GoToWrapper.d.ts +1 -1
- package/dist/routing/GoToWrapper.js +2 -2
- package/dist/routing/Link.d.ts +2 -2
- package/dist/routing/Link.js +2 -2
- package/dist/routing/NavigationItem.d.ts +1 -1
- package/dist/routing/NavigationItem.js +2 -2
- package/dist/routing/hooks/hooks.next.d.ts +1 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/index.d.ts +1 -1
- package/dist/routing/hooks/index.js +1 -1
- package/dist/routing/hooks/types.d.ts +1 -1
- package/dist/routing/hooks/useLocation.next.js +1 -1
- package/dist/routing/hooks/useLocation.vite.js +1 -1
- package/dist/routing/hooks/useNavigate.next.d.ts +8 -0
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +59 -9
- package/dist/routing/hooks/useNavigate.vite.d.ts +8 -0
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +65 -15
- package/dist/routing/hooks/useQueryParams.next.js +1 -1
- package/dist/routing/hooks/useQueryParams.vite.js +1 -1
- package/dist/routing/hooks/useRedirectGuard.next.d.ts +2 -0
- package/dist/routing/hooks/useRedirectGuard.next.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.next.js +12 -28
- package/dist/routing/hooks/useRedirectGuard.vite.d.ts +2 -0
- package/dist/routing/hooks/useRedirectGuard.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.vite.js +12 -28
- package/dist/routing/hooks/useRouteParam.next.js +1 -1
- package/dist/routing/hooks/useRouteParam.vite.js +1 -1
- package/dist/routing/index.d.ts +2 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +2 -1
- package/dist/routing/useGoTo.js +1 -1
- package/dist/routing/useNavigation.d.ts +2 -2
- package/dist/routing/useNavigation.js +3 -3
- package/dist/routing/useRouteDiscovery.d.ts +7 -7
- package/dist/routing/useRouteDiscovery.js +6 -6
- package/dist/styles/index.css +455 -80
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/styles/layoutConstants.d.ts +6 -6
- package/dist/styles/layoutConstants.js +5 -5
- package/dist/symbol-index.json +1 -0
- package/dist/utils/assetResolver.d.ts +5 -5
- package/dist/utils/assetResolver.js +4 -4
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/sanitizeSvg.d.ts +4 -0
- package/dist/utils/sanitizeSvg.d.ts.map +1 -1
- package/dist/utils/sanitizeSvg.js +5 -1
- package/dist/utils/tList.js +1 -1
- package/dist/utils/useAISafe.d.ts +28 -0
- package/dist/utils/useAISafe.d.ts.map +1 -0
- package/dist/utils/useAISafe.js +53 -0
- package/dist/utils/useAuthSafe.d.ts +39 -0
- package/dist/utils/useAuthSafe.d.ts.map +1 -1
- package/dist/utils/useAuthSafe.js +6 -1
- package/dist/utils/useAuthVisibility.d.ts +1 -0
- package/dist/utils/useAuthVisibility.d.ts.map +1 -1
- package/dist/utils/useAuthVisibility.js +1 -1
- package/dist/utils/useBillingVisibility.d.ts +1 -0
- package/dist/utils/useBillingVisibility.d.ts.map +1 -1
- package/dist/utils/useBillingVisibility.js +1 -1
- package/dist/utils/useCrudSafe.js +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -1
- package/dist/utils/useOAuthSafe.d.ts +1 -1
- package/dist/utils/useSeo.d.ts +121 -0
- package/dist/utils/useSeo.d.ts.map +1 -0
- package/dist/utils/useSeo.js +114 -0
- package/dist/utils/useStripeBillingSafe.js +1 -1
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +15 -5
- package/dist/vite-routing/RootLayout.d.ts +1 -1
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +11 -9
- package/dist/vite-routing/index.d.ts +1 -1
- package/dist/vite-routing/index.js +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -1
- package/guidelines/COMPONENTS.md +136 -0
- package/guidelines/GOTCHAS.md +66 -0
- package/guidelines/LAYOUTS.md +310 -0
- package/guidelines/PAGES.md +205 -0
- package/guidelines/ROUTING.md +499 -0
- package/guidelines/SEO.md +275 -0
- package/package.json +12 -7
- package/dist/chunk-XHGRMKOY.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// packages/ui/src/internal/layout/zones/DnDevSidebar.tsx
|
|
3
3
|
/**
|
|
4
4
|
* @fileoverview DnDevSidebar Zone Component
|
|
@@ -9,7 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
*
|
|
10
10
|
* Slots: top | content | bottom
|
|
11
11
|
*
|
|
12
|
-
* @version 0.0
|
|
12
|
+
* @version 0.1.0
|
|
13
13
|
* @since 0.0.1
|
|
14
14
|
* @author AMBROISE PARK Consulting
|
|
15
15
|
*/
|
|
@@ -28,7 +28,9 @@ const RESIZE_HANDLE_WIDTH = 6;
|
|
|
28
28
|
* targets `aside[role='navigation'].sidebar`. Removing it silently breaks every sidebar feature.
|
|
29
29
|
* DO NOT remove or change role="navigation" under any circumstance.
|
|
30
30
|
*/
|
|
31
|
-
function DnDevSidebarComponent({ top, content, bottom, defaultWidth = DEFAULT_SLOTS.sidebar.defaultWidth, minWidth = DEFAULT_SLOTS.sidebar.minWidth, maxWidth = DEFAULT_SLOTS.sidebar.maxWidth, }) {
|
|
31
|
+
function DnDevSidebarComponent({ children, top, content, bottom, defaultWidth = DEFAULT_SLOTS.sidebar.defaultWidth, minWidth = DEFAULT_SLOTS.sidebar.minWidth, maxWidth = DEFAULT_SLOTS.sidebar.maxWidth, }) {
|
|
32
|
+
// Custom mode: children provided = consumer owns zone visuals, data-custom skips polish CSS
|
|
33
|
+
const isCustom = children !== undefined;
|
|
32
34
|
// Resize state
|
|
33
35
|
const sidebarWidth = useLayout('sidebarWidth') ?? defaultWidth;
|
|
34
36
|
const setSidebarWidth = useLayout('setSidebarWidth');
|
|
@@ -170,6 +172,10 @@ function DnDevSidebarComponent({ top, content, bottom, defaultWidth = DEFAULT_SL
|
|
|
170
172
|
* resize handle styles, collapsed styles — essentially ALL sidebar behavior.
|
|
171
173
|
* aria-label provides the accessible name. Both attributes are required.
|
|
172
174
|
*/
|
|
173
|
-
_jsxs("aside", { ref: asideRef, role: "navigation", "aria-label": "Site navigation", className: "sidebar", "data-dragging": isDragging, "data-collapsed": isCollapsed,
|
|
175
|
+
_jsxs("aside", { ref: asideRef, role: "navigation", "aria-label": "Site navigation", className: "sidebar", "data-dragging": isDragging, "data-collapsed": isCollapsed, "data-custom": isCustom || undefined, children: [isCustom ? (
|
|
176
|
+
/* Custom mode: consumer component fills content area, no slot divs */
|
|
177
|
+
children) : (
|
|
178
|
+
/* Slotted mode: framework slot layout with polish CSS */
|
|
179
|
+
_jsxs(_Fragment, { children: [top && _jsx("div", { className: "sidebar-top", children: top }), _jsx("div", { className: "sidebar-content", children: content }), bottom && _jsx("div", { className: "sidebar-bottom", children: bottom })] })), _jsx("div", { className: "dndev-sidebar-resize-handle", onPointerDown: handlePointerDown, onDoubleClick: toggleCollapse, onKeyDown: handleKeyDown, role: "separator", "aria-label": "Resize sidebar. Double-click or Enter to toggle. Home to collapse, End to fit content.", "aria-valuenow": sidebarWidth, "aria-valuemin": minWidth, "aria-valuemax": maxWidth, "aria-orientation": "vertical", tabIndex: 0 })] }));
|
|
174
180
|
}
|
|
175
181
|
export const DnDevSidebar = memo(DnDevSidebarComponent);
|
|
@@ -16,7 +16,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
* For current path/location, use `useLocation()` from '@donotdev/ui' directly.
|
|
17
17
|
* For route discovery/menus, use NavigationStore hooks directly.
|
|
18
18
|
*
|
|
19
|
-
* @version 0.0
|
|
19
|
+
* @version 0.1.0
|
|
20
20
|
* @since 0.0.1
|
|
21
21
|
* @author AMBROISE PARK Consulting
|
|
22
22
|
*
|
|
@@ -48,7 +48,7 @@ import { useAbortControllerStore, useOverlayStore } from '@donotdev/core';
|
|
|
48
48
|
* </NavigationProvider>
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
|
-
* @version 0.0
|
|
51
|
+
* @version 0.1.0
|
|
52
52
|
* @since 0.0.1
|
|
53
53
|
* @author AMBROISE PARK Consulting
|
|
54
54
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Uses useLayoutEffect to initialize Sentry once on mount.
|
|
7
7
|
* Gracefully degrades if VITE_SENTRY_DSN or NEXT_PUBLIC_SENTRY_DSN is not set.
|
|
8
8
|
*
|
|
9
|
-
* @version 0.0
|
|
9
|
+
* @version 0.1.0
|
|
10
10
|
* @since 0.0.1
|
|
11
11
|
* @author AMBROISE PARK Consulting
|
|
12
12
|
*/
|
|
@@ -18,7 +18,7 @@ import { initSentry } from '@donotdev/core';
|
|
|
18
18
|
* Runs once on mount using useLayoutEffect (synchronous, before paint).
|
|
19
19
|
* Gracefully degrades if Sentry DSN is not configured.
|
|
20
20
|
*
|
|
21
|
-
* @version 0.0
|
|
21
|
+
* @version 0.1.0
|
|
22
22
|
* @since 0.0.1
|
|
23
23
|
* @author AMBROISE PARK Consulting
|
|
24
24
|
*/
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
* @fileoverview UIProviders component
|
|
6
6
|
* @description Provides wrapper to basic UI components
|
|
7
7
|
*
|
|
8
|
-
* @version 0.0
|
|
8
|
+
* @version 0.1.0
|
|
9
9
|
* @since 0.0.1
|
|
10
10
|
* @author AMBROISE PARK Consulting
|
|
11
11
|
*/
|
|
@@ -19,7 +19,7 @@ function UIGlobalErrorFallback(props) {
|
|
|
19
19
|
/**
|
|
20
20
|
* Provides a wrapper to basic UI components
|
|
21
21
|
*
|
|
22
|
-
* @version 0.0
|
|
22
|
+
* @version 0.1.0
|
|
23
23
|
* @since 0.0.1
|
|
24
24
|
* @author AMBROISE PARK Consulting
|
|
25
25
|
*/
|
|
@@ -30,7 +30,7 @@ export function UIProviders({ children }) {
|
|
|
30
30
|
* ModalDialog - Renders modal dialog using store directly
|
|
31
31
|
* Moved from ModalContext to avoid redundant context wrapper
|
|
32
32
|
*
|
|
33
|
-
* @version 0.0
|
|
33
|
+
* @version 0.1.0
|
|
34
34
|
* @since 0.0.1
|
|
35
35
|
* @author AMBROISE PARK Consulting
|
|
36
36
|
*/
|
package/dist/next.d.ts
CHANGED
package/dist/next.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA+DxD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAuDhE"}
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
* @fileoverview NextJsAppProviders component
|
|
6
6
|
* @description Next.js-specific app providers with SSR support
|
|
7
7
|
*
|
|
8
|
-
* @version 0.0
|
|
8
|
+
* @version 0.1.0
|
|
9
9
|
* @since 0.0.1
|
|
10
10
|
* @author AMBROISE PARK Consulting
|
|
11
11
|
*/
|
|
@@ -20,6 +20,8 @@ import PerformanceHints from '../internal/layout/components/PerformanceHints';
|
|
|
20
20
|
import { DnDevLayout } from '../internal/layout/DnDevLayout';
|
|
21
21
|
import { SentryInitializer } from '../internal/providers/SentryInitializer';
|
|
22
22
|
import { UIProviders } from '../internal/providers/UIProviders';
|
|
23
|
+
import { PasswordResetCallback } from '../utils/useAuthSafe';
|
|
24
|
+
import { AuthReturnTo } from '../routing/AuthReturnTo';
|
|
23
25
|
// Null fallback for lazy components that fail to load (e.g., optional auth dependency absent)
|
|
24
26
|
const NullFallback = () => null;
|
|
25
27
|
// Lazy load client-only components — each wrapped with catch to prevent hanging
|
|
@@ -38,7 +40,7 @@ const RedirectOverlay = lazy(() => import('../components/common/RedirectOverlay'
|
|
|
38
40
|
* ConsentBanner - Lazy loaded consent component
|
|
39
41
|
* Only shows if user hasn't consented yet
|
|
40
42
|
*
|
|
41
|
-
* @version 0.0
|
|
43
|
+
* @version 0.1.0
|
|
42
44
|
* @since 0.0.1
|
|
43
45
|
* @author AMBROISE PARK Consulting
|
|
44
46
|
*/
|
|
@@ -52,5 +54,5 @@ function ConsentBanner() {
|
|
|
52
54
|
}
|
|
53
55
|
export function NextJsAppProviders(props) {
|
|
54
56
|
const { config = {}, layout, children, serverCookies, customStores } = props;
|
|
55
|
-
return (_jsxs(AppConfigProvider, { config: config, platform: "nextjs", children: [_jsx(SentryInitializer, {}), _jsx(HelmetProvider, { children: _jsxs(NextJsStoresInitializer, { serverCookies: serverCookies, customStores: customStores, children: [_jsx(FaviconHead, {}), _jsx(PerformanceHints, {}), _jsx(QueryProviders, { children: _jsxs(UIProviders, { children: [_jsx(DnDevLayout, { layout: layout, children: children }), _jsx(ConsentBanner, {}), _jsx(Suspense, { fallback: null, children: _jsx(PWAUpdateNotification, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(LicenseWatermark, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(RedirectOverlay, {}) })] }) })] }) })] }));
|
|
57
|
+
return (_jsxs(AppConfigProvider, { config: config, platform: "nextjs", children: [_jsx(SentryInitializer, {}), _jsx(HelmetProvider, { children: _jsxs(NextJsStoresInitializer, { serverCookies: serverCookies, customStores: customStores, children: [_jsx(FaviconHead, {}), _jsx(PerformanceHints, {}), _jsx(QueryProviders, { children: _jsxs(UIProviders, { children: [_jsx(DnDevLayout, { layout: layout, children: children }), _jsx(ConsentBanner, {}), _jsx(AuthReturnTo, {}), _jsx(PasswordResetCallback, {}), _jsx(Suspense, { fallback: null, children: _jsx(PWAUpdateNotification, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(LicenseWatermark, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(RedirectOverlay, {}) })] }) })] }) })] }));
|
|
56
58
|
}
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
* @fileoverview ViteAppProviders component
|
|
5
5
|
* @description Vite-specific app providers with lazy loading
|
|
6
6
|
*
|
|
7
|
-
* @version 0.0
|
|
7
|
+
* @version 0.1.0
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
@@ -56,7 +56,7 @@ const PerformanceHints = lazy(() => import('../internal/layout/components/Perfor
|
|
|
56
56
|
* 12. ConsentBanner (cookie consent)
|
|
57
57
|
* 13. PWAUpdateNotification (PWA updates)
|
|
58
58
|
*
|
|
59
|
-
* @version 0.0
|
|
59
|
+
* @version 0.1.0
|
|
60
60
|
* @since 0.0.1
|
|
61
61
|
* @author AMBROISE PARK Consulting
|
|
62
62
|
*
|
package/dist/providers/index.js
CHANGED
package/dist/routing/404.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { PageMeta } from '@donotdev/core';
|
|
|
2
2
|
/**
|
|
3
3
|
* 404 Not Found page metadata configuration
|
|
4
4
|
*
|
|
5
|
-
* @version 0.0
|
|
5
|
+
* @version 0.1.0
|
|
6
6
|
* @since 0.0.1
|
|
7
7
|
* @author AMBROISE PARK Consulting
|
|
8
8
|
*/
|
|
@@ -17,7 +17,7 @@ export declare const meta: PageMeta;
|
|
|
17
17
|
* - Accessible design with proper semantic HTML
|
|
18
18
|
* - Responsive across all viewports
|
|
19
19
|
*
|
|
20
|
-
* @version 0.0
|
|
20
|
+
* @version 0.1.0
|
|
21
21
|
* @since 0.0.1
|
|
22
22
|
* @author AMBROISE PARK Consulting
|
|
23
23
|
*/
|
package/dist/routing/404.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
* @fileoverview 404 Not Found page component
|
|
6
6
|
* @description Professional 404 page with full-viewport centered layout, i18n, and dynamic route suggestions
|
|
7
7
|
*
|
|
8
|
-
* @version 0.0
|
|
8
|
+
* @version 0.1.0
|
|
9
9
|
* @since 0.0.1
|
|
10
10
|
* @author AMBROISE PARK Consulting
|
|
11
11
|
*/
|
|
@@ -22,7 +22,7 @@ import { PageContainer } from '../components/layout/PageContainer';
|
|
|
22
22
|
/**
|
|
23
23
|
* 404 Not Found page metadata configuration
|
|
24
24
|
*
|
|
25
|
-
* @version 0.0
|
|
25
|
+
* @version 0.1.0
|
|
26
26
|
* @since 0.0.1
|
|
27
27
|
* @author AMBROISE PARK Consulting
|
|
28
28
|
*/
|
|
@@ -39,7 +39,7 @@ export const meta = {
|
|
|
39
39
|
* - Accessible design with proper semantic HTML
|
|
40
40
|
* - Responsive across all viewports
|
|
41
41
|
*
|
|
42
|
-
* @version 0.0
|
|
42
|
+
* @version 0.1.0
|
|
43
43
|
* @since 0.0.1
|
|
44
44
|
* @author AMBROISE PARK Consulting
|
|
45
45
|
*/
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @version 0.0.3
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* @author AMBROISE PARK Consulting
|
|
8
|
-
*/
|
|
9
|
-
import { type ReactNode, type ComponentType } from 'react';
|
|
10
|
-
import { USER_ROLES, SUBSCRIPTION_TIERS, type PageAuth } from '@donotdev/core';
|
|
1
|
+
import type { ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { USER_ROLES, SUBSCRIPTION_TIERS } from '@donotdev/core';
|
|
3
|
+
import type { PageAuth } from '@donotdev/core';
|
|
11
4
|
/**
|
|
12
5
|
* Props for AuthGuard component
|
|
13
6
|
*/
|
|
@@ -20,21 +13,13 @@ interface AuthGuardProps {
|
|
|
20
13
|
fallback?: ComponentType;
|
|
21
14
|
}
|
|
22
15
|
/**
|
|
23
|
-
* AuthGuard
|
|
24
|
-
*
|
|
25
|
-
* 🎯 SINGLE SOURCE OF TRUTH: Only uses @donotdev/core, never directly calls auth
|
|
26
|
-
*
|
|
27
|
-
* Role System (from store):
|
|
28
|
-
* - 'guest': No authentication
|
|
29
|
-
* - 'user': Authenticated Firebase user
|
|
30
|
-
* - 'admin': Authenticated user with Firebase custom claim isAdmin: true
|
|
16
|
+
* AuthGuard - cold-load redirect safety net
|
|
31
17
|
*
|
|
32
|
-
*
|
|
33
|
-
* -
|
|
34
|
-
*
|
|
35
|
-
* - 'premium': Premium features
|
|
18
|
+
* For SPA navigation, auth is intercepted in useNavigate (before page mount).
|
|
19
|
+
* This component handles the cold-load case: user pastes a protected URL directly.
|
|
20
|
+
* It redirects to authRoute, saves returnTo, and AuthReturnTo handles the redirect back.
|
|
36
21
|
*
|
|
37
|
-
* @version 0.0
|
|
22
|
+
* @version 0.1.0
|
|
38
23
|
* @since 0.0.1
|
|
39
24
|
* @author AMBROISE PARK Consulting
|
|
40
25
|
*/
|
|
@@ -43,7 +28,7 @@ export declare function AuthGuard({ auth, children, fallback: Fallback, }: AuthG
|
|
|
43
28
|
* Hook to check if current user can navigate to a route with given auth config
|
|
44
29
|
* ONLY uses store - single source of truth!
|
|
45
30
|
*
|
|
46
|
-
* @version 0.0
|
|
31
|
+
* @version 0.1.0
|
|
47
32
|
* @since 0.0.1
|
|
48
33
|
* @author AMBROISE PARK Consulting
|
|
49
34
|
*/
|
|
@@ -55,7 +40,7 @@ export declare const useCanAccess: typeof useCanNavigate;
|
|
|
55
40
|
/**
|
|
56
41
|
* Hook to get current user's role - directly from store
|
|
57
42
|
*
|
|
58
|
-
* @version 0.0
|
|
43
|
+
* @version 0.1.0
|
|
59
44
|
* @since 0.0.1
|
|
60
45
|
* @author AMBROISE PARK Consulting
|
|
61
46
|
*/
|
|
@@ -63,7 +48,7 @@ export declare function useUserRole(): typeof USER_ROLES.GUEST | typeof USER_ROL
|
|
|
63
48
|
/**
|
|
64
49
|
* Hook to check specific role - directly from store
|
|
65
50
|
*
|
|
66
|
-
* @version 0.0
|
|
51
|
+
* @version 0.1.0
|
|
67
52
|
* @since 0.0.1
|
|
68
53
|
* @author AMBROISE PARK Consulting
|
|
69
54
|
*/
|
|
@@ -71,7 +56,7 @@ export declare function useHasRole(role: typeof USER_ROLES.GUEST | typeof USER_R
|
|
|
71
56
|
/**
|
|
72
57
|
* Hook to get all auth state for debugging
|
|
73
58
|
*
|
|
74
|
-
* @version 0.0
|
|
59
|
+
* @version 0.1.0
|
|
75
60
|
* @since 0.0.1
|
|
76
61
|
* @author AMBROISE PARK Consulting
|
|
77
62
|
*/
|
|
@@ -85,7 +70,7 @@ export declare function useAuthState(): {
|
|
|
85
70
|
/**
|
|
86
71
|
* HOC to wrap components with auth protection
|
|
87
72
|
*
|
|
88
|
-
* @version 0.0
|
|
73
|
+
* @version 0.1.0
|
|
89
74
|
* @since 0.0.1
|
|
90
75
|
* @author AMBROISE PARK Consulting
|
|
91
76
|
*/
|
|
@@ -93,7 +78,7 @@ export declare function withAuth<P extends object>(Component: ComponentType<P>,
|
|
|
93
78
|
/**
|
|
94
79
|
* Utility to create auth configs
|
|
95
80
|
*
|
|
96
|
-
* @version 0.0
|
|
81
|
+
* @version 0.1.0
|
|
97
82
|
* @since 0.0.1
|
|
98
83
|
* @author AMBROISE PARK Consulting
|
|
99
84
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/routing/AuthGuard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/routing/AuthGuard.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,EAEL,UAAU,EACV,kBAAkB,EAGnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAM/C;;GAEG;AACH,UAAU,cAAc;IACtB,wCAAwC;IACxC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,QAAQ,EACR,QAAQ,EAAE,QAAoC,GAC/C,EAAE,cAAc,2CA0ChB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,CAG9D;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,uBAAiB,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,WAAW,IACvB,OAAO,UAAU,CAAC,KAAK,GACvB,OAAO,UAAU,CAAC,IAAI,GACtB,OAAO,UAAU,CAAC,KAAK,CAS1B;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EACA,OAAO,UAAU,CAAC,KAAK,GACvB,OAAO,UAAU,CAAC,IAAI,GACtB,OAAO,UAAU,CAAC,KAAK,GAC1B,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY;;;;;;EAW3B;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,IAAI,EAAE,QAAQ,GAAG,KAAK,WAEW,CAAC,6CAOnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B,iCAAiC;kBACrB,KAAK;IAEjB,oCAAoC;oBACtB,QAAQ;IAEtB,yCAAyC;gBAC/B,QAAQ;IAKlB,uDAAuD;iBAC5C,QAAQ;IAKnB,gCAAgC;iBAExB,CAAC,OAAO,kBAAkB,EAAE,MAAM,OAAO,kBAAkB,CAAC,KACjE,QAAQ;IAKX,eAAe;eACN,QAAQ;IAKjB,mBAAmB;mBACN,QAAQ;IAKrB,sCAAsC;oBACxB,QAAQ;IAMtB,wBAAwB;uBACL,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,KAAG,QAAQ;CAItE,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,107 +1,62 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
// packages/ui/src/routing/AuthGuard.tsx
|
|
4
4
|
/**
|
|
5
5
|
* @fileoverview AuthGuard component
|
|
6
|
-
* @description
|
|
6
|
+
* @description Cold-load safety net for protected routes. Redirects unauthenticated
|
|
7
|
+
* users to authRoute. SPA navigation is intercepted earlier in useNavigate.
|
|
7
8
|
*
|
|
8
|
-
* @version 0.0
|
|
9
|
+
* @version 0.1.0
|
|
9
10
|
* @since 0.0.1
|
|
10
11
|
* @author AMBROISE PARK Consulting
|
|
11
12
|
*/
|
|
12
|
-
import { useEffect,
|
|
13
|
-
import { Spinner
|
|
14
|
-
import {
|
|
13
|
+
import { useEffect, } from 'react';
|
|
14
|
+
import { Spinner } from '@donotdev/components';
|
|
15
|
+
import { FEATURE_STATUS, USER_ROLES, SUBSCRIPTION_TIERS, isClient, safeSessionStorage, } from '@donotdev/core';
|
|
15
16
|
// Platform-specific hooks via conditional exports
|
|
16
17
|
import { useRedirectGuard, useNavigate } from '@donotdev/ui/routing/hooks';
|
|
17
18
|
import { useAuthSafe } from '../utils/useAuthSafe';
|
|
18
|
-
// Lazy load consent component for auth routes
|
|
19
|
-
const CookieConsent = lazy(() => import('../components/cookie-consent/CookieConsent'));
|
|
20
19
|
/**
|
|
21
|
-
* AuthGuard
|
|
20
|
+
* AuthGuard - cold-load redirect safety net
|
|
22
21
|
*
|
|
23
|
-
*
|
|
22
|
+
* For SPA navigation, auth is intercepted in useNavigate (before page mount).
|
|
23
|
+
* This component handles the cold-load case: user pastes a protected URL directly.
|
|
24
|
+
* It redirects to authRoute, saves returnTo, and AuthReturnTo handles the redirect back.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
-
* - 'guest': No authentication
|
|
27
|
-
* - 'user': Authenticated Firebase user
|
|
28
|
-
* - 'admin': Authenticated user with Firebase custom claim isAdmin: true
|
|
29
|
-
*
|
|
30
|
-
* Subscription System (from store):
|
|
31
|
-
* - 'free': Basic features
|
|
32
|
-
* - 'pro': Professional features
|
|
33
|
-
* - 'premium': Premium features
|
|
34
|
-
*
|
|
35
|
-
* @version 0.0.3
|
|
26
|
+
* @version 0.1.0
|
|
36
27
|
* @since 0.0.1
|
|
37
28
|
* @author AMBROISE PARK Consulting
|
|
38
29
|
*/
|
|
39
30
|
export function AuthGuard({ auth, children, fallback: Fallback = () => _jsx(Spinner, { overlay: true }), }) {
|
|
40
31
|
const navigate = useNavigate();
|
|
41
32
|
const user = useAuthSafe('user');
|
|
42
|
-
const can = useAuthSafe('can');
|
|
43
33
|
const status = useAuthSafe('status');
|
|
44
|
-
const [slowWarning, setSlowWarning] = useState(false);
|
|
45
|
-
// Check if redirect should happen BEFORE rendering fallback
|
|
46
34
|
const { shouldRedirect, redirectTo, isChecking } = useRedirectGuard({
|
|
47
35
|
auth,
|
|
48
36
|
});
|
|
49
|
-
|
|
50
|
-
// Soft timeout at 5 seconds - show warning, don't force redirect
|
|
51
|
-
// Firebase auth typically resolves in 200ms-800ms (broadband), 1-3s (cold start)
|
|
52
|
-
const timer = setTimeout(() => {
|
|
53
|
-
if (status === FEATURE_STATUS.INITIALIZING) {
|
|
54
|
-
setSlowWarning(true);
|
|
55
|
-
if (process.env.NODE_ENV === 'development') {
|
|
56
|
-
console.warn('[AuthGuard] Auth taking longer than usual (>5s)');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, 5000);
|
|
60
|
-
return () => clearTimeout(timer);
|
|
61
|
-
}, [status]);
|
|
62
|
-
// Redirect if needed
|
|
37
|
+
// Redirect if needed - save current path when redirecting unauthenticated user
|
|
63
38
|
useEffect(() => {
|
|
64
39
|
if (shouldRedirect && redirectTo) {
|
|
40
|
+
if (!user && isClient()) {
|
|
41
|
+
safeSessionStorage.setItem('dndev.auth.returnTo', window.location.pathname + window.location.search);
|
|
42
|
+
safeSessionStorage.setItem('dndev.auth.guardToast', '1');
|
|
43
|
+
}
|
|
65
44
|
navigate(redirectTo, { replace: true });
|
|
66
45
|
}
|
|
67
|
-
}, [shouldRedirect, redirectTo, navigate]);
|
|
46
|
+
}, [shouldRedirect, redirectTo, navigate, user]);
|
|
47
|
+
// Return-to after OAuth is handled by AuthReturnTo (mounted in RootLayout).
|
|
68
48
|
// Public route - no auth required
|
|
69
49
|
if (auth === false) {
|
|
70
50
|
return _jsx(_Fragment, { children: children });
|
|
71
51
|
}
|
|
72
|
-
//
|
|
73
|
-
// This prevents content flash before redirect
|
|
52
|
+
// Show spinner while redirect will happen or auth is still checking
|
|
74
53
|
if (shouldRedirect || isChecking) {
|
|
75
54
|
return _jsx(Spinner, { overlay: true });
|
|
76
55
|
}
|
|
77
|
-
//
|
|
78
|
-
if (status === FEATURE_STATUS.INITIALIZING && slowWarning) {
|
|
79
|
-
return (_jsx(Stack, { align: "center", justify: "center", style: { padding: 'var(--gap-md)', minHeight: '100vh' }, children: _jsxs("div", { className: "dndev-w-full", style: { maxWidth: '28rem', textAlign: 'center' }, children: [_jsx("h2", { style: { marginBottom: 'var(--gap-md)' }, children: "Loading is taking longer than usual" }), _jsx("p", { style: {
|
|
80
|
-
marginBottom: 'var(--gap-md)',
|
|
81
|
-
color: 'var(--muted-foreground)',
|
|
82
|
-
}, children: "This might be due to a slow connection. Please wait or try refreshing the page." }), _jsx("button", { onClick: () => window.location.reload(), style: {
|
|
83
|
-
padding: 'var(--gap-sm) var(--gap-md)',
|
|
84
|
-
backgroundColor: 'var(--primary)',
|
|
85
|
-
color: 'var(--primary-foreground)',
|
|
86
|
-
border: 'none',
|
|
87
|
-
borderRadius: 'var(--radius)',
|
|
88
|
-
cursor: 'pointer',
|
|
89
|
-
}, children: "Refresh Page" })] }) }));
|
|
90
|
-
}
|
|
91
|
-
// Still checking auth state (but not redirecting) - show fallback
|
|
56
|
+
// Still initializing auth - show fallback spinner
|
|
92
57
|
if (status === FEATURE_STATUS.INITIALIZING) {
|
|
93
58
|
return _jsx(Fallback, {});
|
|
94
59
|
}
|
|
95
|
-
// Check if it's a consent issue (no functional cookies for auth)
|
|
96
|
-
// This is a special case where we don't redirect, but show consent UI
|
|
97
|
-
if (auth &&
|
|
98
|
-
typeof auth === 'object' &&
|
|
99
|
-
auth.required &&
|
|
100
|
-
!user &&
|
|
101
|
-
can &&
|
|
102
|
-
!can.navigate(auth)) {
|
|
103
|
-
return (_jsx(Stack, { align: "center", justify: "center", style: { padding: 'var(--gap-md)', minHeight: '100vh' }, children: _jsxs("div", { className: "dndev-w-full", style: { maxWidth: '28rem' }, children: [_jsx("h2", { style: { marginBottom: 'var(--gap-md)' }, children: "Authentication Required" }), _jsx("p", { style: { marginBottom: 'var(--gap-md)' }, children: "This page requires authentication. Please accept functional cookies to continue." }), _jsx(Suspense, { fallback: _jsx("div", { children: "Loading consent..." }), children: _jsx(CookieConsent, {}) })] }) }));
|
|
104
|
-
}
|
|
105
60
|
// All checks passed, render children
|
|
106
61
|
return _jsx(_Fragment, { children: children });
|
|
107
62
|
}
|
|
@@ -109,7 +64,7 @@ export function AuthGuard({ auth, children, fallback: Fallback = () => _jsx(Spin
|
|
|
109
64
|
* Hook to check if current user can navigate to a route with given auth config
|
|
110
65
|
* ONLY uses store - single source of truth!
|
|
111
66
|
*
|
|
112
|
-
* @version 0.0
|
|
67
|
+
* @version 0.1.0
|
|
113
68
|
* @since 0.0.1
|
|
114
69
|
* @author AMBROISE PARK Consulting
|
|
115
70
|
*/
|
|
@@ -124,7 +79,7 @@ export const useCanAccess = useCanNavigate;
|
|
|
124
79
|
/**
|
|
125
80
|
* Hook to get current user's role - directly from store
|
|
126
81
|
*
|
|
127
|
-
* @version 0.0
|
|
82
|
+
* @version 0.1.0
|
|
128
83
|
* @since 0.0.1
|
|
129
84
|
* @author AMBROISE PARK Consulting
|
|
130
85
|
*/
|
|
@@ -136,7 +91,7 @@ export function useUserRole() {
|
|
|
136
91
|
/**
|
|
137
92
|
* Hook to check specific role - directly from store
|
|
138
93
|
*
|
|
139
|
-
* @version 0.0
|
|
94
|
+
* @version 0.1.0
|
|
140
95
|
* @since 0.0.1
|
|
141
96
|
* @author AMBROISE PARK Consulting
|
|
142
97
|
*/
|
|
@@ -148,7 +103,7 @@ export function useHasRole(role) {
|
|
|
148
103
|
/**
|
|
149
104
|
* Hook to get all auth state for debugging
|
|
150
105
|
*
|
|
151
|
-
* @version 0.0
|
|
106
|
+
* @version 0.1.0
|
|
152
107
|
* @since 0.0.1
|
|
153
108
|
* @author AMBROISE PARK Consulting
|
|
154
109
|
*/
|
|
@@ -167,7 +122,7 @@ export function useAuthState() {
|
|
|
167
122
|
/**
|
|
168
123
|
* HOC to wrap components with auth protection
|
|
169
124
|
*
|
|
170
|
-
* @version 0.0
|
|
125
|
+
* @version 0.1.0
|
|
171
126
|
* @since 0.0.1
|
|
172
127
|
* @author AMBROISE PARK Consulting
|
|
173
128
|
*/
|
|
@@ -178,7 +133,7 @@ export function withAuth(Component, auth) {
|
|
|
178
133
|
/**
|
|
179
134
|
* Utility to create auth configs
|
|
180
135
|
*
|
|
181
|
-
* @version 0.0
|
|
136
|
+
* @version 0.1.0
|
|
182
137
|
* @since 0.0.1
|
|
183
138
|
* @author AMBROISE PARK Consulting
|
|
184
139
|
*/
|
|
@@ -17,7 +17,7 @@ interface AuthGuardFallbackProps {
|
|
|
17
17
|
* the authentication options directly on the protected route, providing
|
|
18
18
|
* better UX and keeping users in context.
|
|
19
19
|
*
|
|
20
|
-
* @version 0.0
|
|
20
|
+
* @version 0.1.0
|
|
21
21
|
* @since 0.0.1
|
|
22
22
|
* @author AMBROISE PARK Consulting
|
|
23
23
|
*/
|