@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
|
@@ -2,41 +2,91 @@
|
|
|
2
2
|
// packages/ui/src/routing/hooks/useNavigate.vite.ts
|
|
3
3
|
/**
|
|
4
4
|
* @fileoverview Vite-specific navigation hooks
|
|
5
|
-
* @description Navigation hooks for React Router (Vite)
|
|
5
|
+
* @description Navigation hooks for React Router (Vite) with auth interception
|
|
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
|
*/
|
|
11
|
-
import { useCallback } from 'react';
|
|
12
11
|
import { useNavigate as useRouterNavigate } from 'react-router-dom';
|
|
13
|
-
import { isClient, useOverlayStore } from '@donotdev/core';
|
|
12
|
+
import { isClient, useOverlayStore, useAuthConfig, FEATURE_STATUS, getRoutes, safeSessionStorage, } from '@donotdev/core';
|
|
13
|
+
import { useAuthSafe } from '../../utils/useAuthSafe';
|
|
14
|
+
/**
|
|
15
|
+
* Check if a route requires auth by reading discovered routes.
|
|
16
|
+
*
|
|
17
|
+
* Uses exact path match + startsWith for nested routes. Does NOT handle
|
|
18
|
+
* parameterized routes (e.g. `/blog/:slug`). Current protected routes are
|
|
19
|
+
* all exact paths. If parameterized auth routes are added, this needs
|
|
20
|
+
* pattern matching (pathToRegexp or similar).
|
|
21
|
+
*
|
|
22
|
+
* @grill-refuted getRoutes() timing is safe - virtual module hydrates synchronously
|
|
23
|
+
* before React renders. If routes aren't loaded, returns false (fail-open).
|
|
24
|
+
* Cold load is covered by AuthGuard as belt-and-suspenders.
|
|
25
|
+
*/
|
|
26
|
+
function routeRequiresAuth(path) {
|
|
27
|
+
try {
|
|
28
|
+
const routes = getRoutes();
|
|
29
|
+
if (!routes?.length)
|
|
30
|
+
return false;
|
|
31
|
+
const route = routes.find((r) => r.path === path || path.startsWith(r.path + '/'));
|
|
32
|
+
if (!route)
|
|
33
|
+
return false;
|
|
34
|
+
if (route.auth === true)
|
|
35
|
+
return true;
|
|
36
|
+
if (typeof route.auth === 'object' && route.auth?.required)
|
|
37
|
+
return true;
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Navigation hook with auth interception.
|
|
46
|
+
*
|
|
47
|
+
* @grill-refuted Returns a new function ref each render (no useCallback). Safe because
|
|
48
|
+
* AuthGuard's useEffect that depends on navigate is guarded by `shouldRedirect && redirectTo` -
|
|
49
|
+
* the effect body is a no-op when not redirecting, and after redirect the component unmounts.
|
|
50
|
+
* React 19 - no useCallback unless profiler proves bottleneck.
|
|
51
|
+
*/
|
|
14
52
|
export function useNavigate() {
|
|
15
|
-
const
|
|
53
|
+
const routerNavigate = useRouterNavigate();
|
|
16
54
|
const closeAll = useOverlayStore((state) => state.closeAll);
|
|
17
|
-
|
|
55
|
+
const user = useAuthSafe('user');
|
|
56
|
+
const status = useAuthSafe('status');
|
|
57
|
+
const authConfig = useAuthConfig();
|
|
58
|
+
return (to, options) => {
|
|
18
59
|
if (to === 'back') {
|
|
19
60
|
closeAll();
|
|
20
|
-
return
|
|
61
|
+
return routerNavigate(-1);
|
|
62
|
+
}
|
|
63
|
+
// Auth interception: block SPA nav to protected routes when not auth'd.
|
|
64
|
+
// Skip while INITIALIZING - user may be authenticated but not resolved yet.
|
|
65
|
+
if (!user && status !== FEATURE_STATUS.INITIALIZING && routeRequiresAuth(to)) {
|
|
66
|
+
safeSessionStorage.setItem('dndev.auth.returnTo', to);
|
|
67
|
+
safeSessionStorage.setItem('dndev.auth.guardToast', '1');
|
|
68
|
+
closeAll();
|
|
69
|
+
/** @grill-refuted authRoute! safe - useAuthConfig() guarantees DEFAULT_AUTH merge provides '/' */
|
|
70
|
+
return routerNavigate(authConfig.authRoute, { replace: true });
|
|
21
71
|
}
|
|
22
72
|
closeAll();
|
|
23
73
|
if (options?.replace)
|
|
24
|
-
return
|
|
25
|
-
return
|
|
26
|
-
}
|
|
74
|
+
return routerNavigate(to, { replace: true });
|
|
75
|
+
return routerNavigate(to);
|
|
76
|
+
};
|
|
27
77
|
}
|
|
28
78
|
export function useBack() {
|
|
29
79
|
const navigate = useRouterNavigate();
|
|
30
|
-
return
|
|
80
|
+
return () => navigate(-1);
|
|
31
81
|
}
|
|
32
82
|
export function useRefresh() {
|
|
33
|
-
return
|
|
83
|
+
return () => {
|
|
34
84
|
if (isClient())
|
|
35
85
|
window.location.reload();
|
|
36
|
-
}
|
|
86
|
+
};
|
|
37
87
|
}
|
|
38
88
|
export function usePrefetch() {
|
|
39
|
-
return
|
|
89
|
+
return (_to) => {
|
|
40
90
|
// Vite: no-op
|
|
41
|
-
}
|
|
91
|
+
};
|
|
42
92
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PageAuth, FeatureStatus } from '@donotdev/core';
|
|
2
|
+
/** Configuration options for the redirect guard hook. */
|
|
2
3
|
export interface RedirectGuardOptions {
|
|
3
4
|
/** Auth configuration for this route */
|
|
4
5
|
auth?: PageAuth | false;
|
|
@@ -7,6 +8,7 @@ export interface RedirectGuardOptions {
|
|
|
7
8
|
/** Custom condition function to check if redirect should happen */
|
|
8
9
|
condition?: (user: any, status: FeatureStatus) => boolean;
|
|
9
10
|
}
|
|
11
|
+
/** Return value of the useRedirectGuard hook. */
|
|
10
12
|
export interface RedirectGuardResult {
|
|
11
13
|
/** Whether redirect should happen */
|
|
12
14
|
shouldRedirect: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedirectGuard.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useRedirectGuard.next.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,WAAW,oBAAoB;IACnC,wCAAwC;IACxC,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACxB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mEAAmE;IACnE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;CAC3D;AAED,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useRedirectGuard.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useRedirectGuard.next.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK9D,yDAAyD;AACzD,MAAM,WAAW,oBAAoB;IACnC,wCAAwC;IACxC,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACxB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mEAAmE;IACnE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;CAC3D;AAED,iDAAiD;AACjD,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CA4FrB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @fileoverview Next.js Redirect Guard Hook
|
|
5
5
|
* @description Determines redirect state before render. Prevents content flash.
|
|
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
|
*/
|
|
@@ -32,21 +32,13 @@ export function useRedirectGuard(options = {}) {
|
|
|
32
32
|
const status = useAuthSafe('status');
|
|
33
33
|
// Determine redirect state
|
|
34
34
|
const redirectState = useMemo(() => {
|
|
35
|
+
const noAction = { shouldRedirect: false, redirectTo: null, isChecking: false };
|
|
35
36
|
// SSR-safe: return safe defaults on server
|
|
36
|
-
if (!isClient())
|
|
37
|
-
return
|
|
38
|
-
shouldRedirect: false,
|
|
39
|
-
redirectTo: null,
|
|
40
|
-
isChecking: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
37
|
+
if (!isClient())
|
|
38
|
+
return noAction;
|
|
43
39
|
// Only INITIALIZING = still checking. DEGRADED/ERROR/READY = auth resolved (proceed with current user)
|
|
44
40
|
if (status === FEATURE_STATUS.INITIALIZING) {
|
|
45
|
-
return {
|
|
46
|
-
shouldRedirect: false,
|
|
47
|
-
redirectTo: null,
|
|
48
|
-
isChecking: true,
|
|
49
|
-
};
|
|
41
|
+
return { ...noAction, isChecking: true };
|
|
50
42
|
}
|
|
51
43
|
// Custom condition provided
|
|
52
44
|
if (condition) {
|
|
@@ -59,27 +51,23 @@ export function useRedirectGuard(options = {}) {
|
|
|
59
51
|
}
|
|
60
52
|
// Use auth config to determine redirect
|
|
61
53
|
if (auth !== false && auth !== undefined) {
|
|
62
|
-
if (!can)
|
|
63
|
-
return
|
|
64
|
-
shouldRedirect: false,
|
|
65
|
-
redirectTo: null,
|
|
66
|
-
isChecking: false,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
54
|
+
if (!can)
|
|
55
|
+
return noAction;
|
|
69
56
|
// Check if user can navigate to this route
|
|
70
57
|
if (!can.navigate(auth)) {
|
|
71
58
|
let targetRoute = null;
|
|
72
|
-
// Authentication failure (not logged in)
|
|
59
|
+
// Authentication failure (not logged in) → always redirect
|
|
73
60
|
if (typeof auth === 'object' && auth.required && !user) {
|
|
74
61
|
// Check if we have OAuth parameters that need to be preserved
|
|
75
62
|
const hasOAuthParams = location.search?.includes('code=') ||
|
|
76
63
|
location.search?.includes('state=') ||
|
|
77
64
|
location.search?.includes('error=');
|
|
65
|
+
const authRoute = authConfig.authRoute;
|
|
78
66
|
if (hasOAuthParams) {
|
|
79
|
-
targetRoute = `${
|
|
67
|
+
targetRoute = `${authRoute}${location.search}`;
|
|
80
68
|
}
|
|
81
69
|
else {
|
|
82
|
-
targetRoute =
|
|
70
|
+
targetRoute = authRoute;
|
|
83
71
|
}
|
|
84
72
|
}
|
|
85
73
|
// Authorization failure (wrong role)
|
|
@@ -102,11 +90,7 @@ export function useRedirectGuard(options = {}) {
|
|
|
102
90
|
}
|
|
103
91
|
}
|
|
104
92
|
// No redirect needed
|
|
105
|
-
return
|
|
106
|
-
shouldRedirect: false,
|
|
107
|
-
redirectTo: null,
|
|
108
|
-
isChecking: false,
|
|
109
|
-
};
|
|
93
|
+
return noAction;
|
|
110
94
|
}, [
|
|
111
95
|
auth,
|
|
112
96
|
status,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PageAuth, FeatureStatus } from '@donotdev/core';
|
|
2
|
+
/** Configuration options for the redirect guard hook. */
|
|
2
3
|
export interface RedirectGuardOptions {
|
|
3
4
|
/** Auth configuration for this route */
|
|
4
5
|
auth?: PageAuth | false;
|
|
@@ -7,6 +8,7 @@ export interface RedirectGuardOptions {
|
|
|
7
8
|
/** Custom condition function to check if redirect should happen */
|
|
8
9
|
condition?: (user: any, status: FeatureStatus) => boolean;
|
|
9
10
|
}
|
|
11
|
+
/** Return value of the useRedirectGuard hook. */
|
|
10
12
|
export interface RedirectGuardResult {
|
|
11
13
|
/** Whether redirect should happen */
|
|
12
14
|
shouldRedirect: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedirectGuard.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useRedirectGuard.vite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,WAAW,oBAAoB;IACnC,wCAAwC;IACxC,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACxB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mEAAmE;IACnE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;CAC3D;AAED,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useRedirectGuard.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useRedirectGuard.vite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK9D,yDAAyD;AACzD,MAAM,WAAW,oBAAoB;IACnC,wCAAwC;IACxC,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACxB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mEAAmE;IACnE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;CAC3D;AAED,iDAAiD;AACjD,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CA4FrB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @fileoverview Vite Redirect Guard Hook
|
|
5
5
|
* @description Determines redirect state before render. Prevents content flash.
|
|
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
|
*/
|
|
@@ -32,21 +32,13 @@ export function useRedirectGuard(options = {}) {
|
|
|
32
32
|
const status = useAuthSafe('status');
|
|
33
33
|
// Determine redirect state
|
|
34
34
|
const redirectState = useMemo(() => {
|
|
35
|
+
const noAction = { shouldRedirect: false, redirectTo: null, isChecking: false };
|
|
35
36
|
// SSR-safe: return safe defaults on server
|
|
36
|
-
if (!isClient())
|
|
37
|
-
return
|
|
38
|
-
shouldRedirect: false,
|
|
39
|
-
redirectTo: null,
|
|
40
|
-
isChecking: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
37
|
+
if (!isClient())
|
|
38
|
+
return noAction;
|
|
43
39
|
// Only INITIALIZING = still checking. DEGRADED/ERROR/READY = auth resolved (proceed with current user)
|
|
44
40
|
if (status === FEATURE_STATUS.INITIALIZING) {
|
|
45
|
-
return {
|
|
46
|
-
shouldRedirect: false,
|
|
47
|
-
redirectTo: null,
|
|
48
|
-
isChecking: true,
|
|
49
|
-
};
|
|
41
|
+
return { ...noAction, isChecking: true };
|
|
50
42
|
}
|
|
51
43
|
// Custom condition provided
|
|
52
44
|
if (condition) {
|
|
@@ -59,27 +51,23 @@ export function useRedirectGuard(options = {}) {
|
|
|
59
51
|
}
|
|
60
52
|
// Use auth config to determine redirect
|
|
61
53
|
if (auth !== false && auth !== undefined) {
|
|
62
|
-
if (!can)
|
|
63
|
-
return
|
|
64
|
-
shouldRedirect: false,
|
|
65
|
-
redirectTo: null,
|
|
66
|
-
isChecking: false,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
54
|
+
if (!can)
|
|
55
|
+
return noAction;
|
|
69
56
|
// Check if user can navigate to this route
|
|
70
57
|
if (!can.navigate(auth)) {
|
|
71
58
|
let targetRoute = null;
|
|
72
|
-
// Authentication failure (not logged in)
|
|
59
|
+
// Authentication failure (not logged in) → always redirect
|
|
73
60
|
if (typeof auth === 'object' && auth.required && !user) {
|
|
74
61
|
// Check if we have OAuth parameters that need to be preserved
|
|
75
62
|
const hasOAuthParams = location.search.includes('code=') ||
|
|
76
63
|
location.search.includes('state=') ||
|
|
77
64
|
location.search.includes('error=');
|
|
65
|
+
const authRoute = authConfig.authRoute;
|
|
78
66
|
if (hasOAuthParams) {
|
|
79
|
-
targetRoute = `${
|
|
67
|
+
targetRoute = `${authRoute}${location.search}`;
|
|
80
68
|
}
|
|
81
69
|
else {
|
|
82
|
-
targetRoute =
|
|
70
|
+
targetRoute = authRoute;
|
|
83
71
|
}
|
|
84
72
|
}
|
|
85
73
|
// Authorization failure (wrong role)
|
|
@@ -102,11 +90,7 @@ export function useRedirectGuard(options = {}) {
|
|
|
102
90
|
}
|
|
103
91
|
}
|
|
104
92
|
// No redirect needed
|
|
105
|
-
return
|
|
106
|
-
shouldRedirect: false,
|
|
107
|
-
redirectTo: null,
|
|
108
|
-
isChecking: false,
|
|
109
|
-
};
|
|
93
|
+
return noAction;
|
|
110
94
|
}, [
|
|
111
95
|
auth,
|
|
112
96
|
status,
|
package/dist/routing/index.d.ts
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* @description Platform-agnostic routing components and hooks (work in both Vite + Next.js)
|
|
4
4
|
* Vite-specific routing (AppRoutes, RootLayout) moved to ../vite-routing
|
|
5
5
|
*
|
|
6
|
-
* @version 0.0
|
|
6
|
+
* @version 0.1.0
|
|
7
7
|
* @since 0.0.1
|
|
8
8
|
* @author AMBROISE PARK Consulting
|
|
9
9
|
*/
|
|
10
10
|
export * from './Link';
|
|
11
11
|
export * from './AuthGuard';
|
|
12
12
|
export * from './AuthGuardFallback';
|
|
13
|
+
export { AuthReturnTo } from './AuthReturnTo';
|
|
13
14
|
export * from './GoTo';
|
|
14
15
|
export { default as GoToWrapper } from './GoToWrapper';
|
|
15
16
|
export { default as GoToInput } from './GoToInput';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAGH,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAOhD,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,eAAe,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAGH,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAOhD,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,eAAe,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/dist/routing/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @description Platform-agnostic routing components and hooks (work in both Vite + Next.js)
|
|
5
5
|
* Vite-specific routing (AppRoutes, RootLayout) moved to ../vite-routing
|
|
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
|
*/
|
|
@@ -14,6 +14,7 @@ export * from './Link';
|
|
|
14
14
|
// Public API: HeaderNavigation (path prop for single item), DnDevNavigationMenu (full menu).
|
|
15
15
|
export * from './AuthGuard';
|
|
16
16
|
export * from './AuthGuardFallback';
|
|
17
|
+
export { AuthReturnTo } from './AuthReturnTo';
|
|
17
18
|
export * from './GoTo';
|
|
18
19
|
export { default as GoToWrapper } from './GoToWrapper';
|
|
19
20
|
export { default as GoToInput } from './GoToInput';
|
package/dist/routing/useGoTo.js
CHANGED
|
@@ -16,7 +16,7 @@ export interface NavigationItem extends NavigationRoute {
|
|
|
16
16
|
* Use this for UI menus, sidebars, and navigation components that should
|
|
17
17
|
* only show routes the user can access.
|
|
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
|
* @returns Array of navigation items filtered by auth state
|
|
@@ -37,7 +37,7 @@ export declare function useNavigationItems(): NavigationItem[];
|
|
|
37
37
|
* Use this to compose a standalone Button-style nav link without reaching for
|
|
38
38
|
* a full NavigationMenu.
|
|
39
39
|
*
|
|
40
|
-
* @version 0.0
|
|
40
|
+
* @version 0.1.0
|
|
41
41
|
* @since 0.0.1
|
|
42
42
|
* @author AMBROISE PARK Consulting
|
|
43
43
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @fileoverview Navigation Hooks - Clean and Simple
|
|
4
4
|
* @description Only 2 hooks: dumb navigation + smart auth-filtered navigation
|
|
5
5
|
*
|
|
6
|
-
* @version 0.0
|
|
6
|
+
* @version 0.1.0
|
|
7
7
|
* @since 0.0.1
|
|
8
8
|
* @author AMBROISE PARK Consulting
|
|
9
9
|
*/
|
|
@@ -19,7 +19,7 @@ import { useAuthSafe } from '../utils/useAuthSafe';
|
|
|
19
19
|
* Use this for UI menus, sidebars, and navigation components that should
|
|
20
20
|
* only show routes the user can access.
|
|
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
|
* @returns Array of navigation items filtered by auth state
|
|
@@ -77,7 +77,7 @@ export function useNavigationItems() {
|
|
|
77
77
|
* Use this to compose a standalone Button-style nav link without reaching for
|
|
78
78
|
* a full NavigationMenu.
|
|
79
79
|
*
|
|
80
|
-
* @version 0.0
|
|
80
|
+
* @version 0.1.0
|
|
81
81
|
* @since 0.0.1
|
|
82
82
|
* @author AMBROISE PARK Consulting
|
|
83
83
|
*
|
|
@@ -4,7 +4,7 @@ import type { ReactNode } from 'react';
|
|
|
4
4
|
/**
|
|
5
5
|
* Route information interface for discovered routes
|
|
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
|
*/
|
|
@@ -29,7 +29,7 @@ export interface RouteInfo {
|
|
|
29
29
|
/**
|
|
30
30
|
* Group of related routes organized by entity/domain
|
|
31
31
|
*
|
|
32
|
-
* @version 0.0
|
|
32
|
+
* @version 0.1.0
|
|
33
33
|
* @since 0.0.1
|
|
34
34
|
* @author AMBROISE PARK Consulting
|
|
35
35
|
*/
|
|
@@ -68,7 +68,7 @@ export type NavigationRoute = CoreNavigationRoute;
|
|
|
68
68
|
* }
|
|
69
69
|
* ```
|
|
70
70
|
*
|
|
71
|
-
* @version 0.0
|
|
71
|
+
* @version 0.1.0
|
|
72
72
|
* @since 0.0.1
|
|
73
73
|
* @author AMBROISE PARK Consulting
|
|
74
74
|
*/
|
|
@@ -96,7 +96,7 @@ export declare function useRouteDiscovery(): RouteGroup[];
|
|
|
96
96
|
* }
|
|
97
97
|
* ```
|
|
98
98
|
*
|
|
99
|
-
* @version 0.0
|
|
99
|
+
* @version 0.1.0
|
|
100
100
|
* @since 0.0.1
|
|
101
101
|
* @author AMBROISE PARK Consulting
|
|
102
102
|
*/
|
|
@@ -124,7 +124,7 @@ export declare function useAccessibleRoutes(): RouteGroup[];
|
|
|
124
124
|
* }
|
|
125
125
|
* ```
|
|
126
126
|
*
|
|
127
|
-
* @version 0.0
|
|
127
|
+
* @version 0.1.0
|
|
128
128
|
* @since 0.0.1
|
|
129
129
|
* @author AMBROISE PARK Consulting
|
|
130
130
|
*/
|
|
@@ -145,7 +145,7 @@ export declare function useAccessibleNavigationRoutes(): NavigationRoute[];
|
|
|
145
145
|
* }
|
|
146
146
|
* ```
|
|
147
147
|
*
|
|
148
|
-
* @version 0.0
|
|
148
|
+
* @version 0.1.0
|
|
149
149
|
* @since 0.0.1
|
|
150
150
|
* @author AMBROISE PARK Consulting
|
|
151
151
|
*/
|
|
@@ -174,7 +174,7 @@ export declare function useAllRoutes(): RouteInfo[];
|
|
|
174
174
|
* }
|
|
175
175
|
* ```
|
|
176
176
|
*
|
|
177
|
-
* @version 0.0
|
|
177
|
+
* @version 0.1.0
|
|
178
178
|
* @since 0.0.1
|
|
179
179
|
* @author AMBROISE PARK Consulting
|
|
180
180
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* - Route grouping and organization
|
|
14
14
|
* - Performance optimization through store-level caching
|
|
15
15
|
*
|
|
16
|
-
* @version 0.0
|
|
16
|
+
* @version 0.1.0
|
|
17
17
|
* @since 0.0.1
|
|
18
18
|
* @author AMBROISE PARK Consulting
|
|
19
19
|
*
|
|
@@ -47,7 +47,7 @@ import { useAuthSafe } from '../utils/useAuthSafe';
|
|
|
47
47
|
* }
|
|
48
48
|
* ```
|
|
49
49
|
*
|
|
50
|
-
* @version 0.0
|
|
50
|
+
* @version 0.1.0
|
|
51
51
|
* @since 0.0.1
|
|
52
52
|
* @author AMBROISE PARK Consulting
|
|
53
53
|
*/
|
|
@@ -96,7 +96,7 @@ export function useRouteDiscovery() {
|
|
|
96
96
|
* }
|
|
97
97
|
* ```
|
|
98
98
|
*
|
|
99
|
-
* @version 0.0
|
|
99
|
+
* @version 0.1.0
|
|
100
100
|
* @since 0.0.1
|
|
101
101
|
* @author AMBROISE PARK Consulting
|
|
102
102
|
*/
|
|
@@ -145,7 +145,7 @@ export function useAccessibleRoutes() {
|
|
|
145
145
|
* }
|
|
146
146
|
* ```
|
|
147
147
|
*
|
|
148
|
-
* @version 0.0
|
|
148
|
+
* @version 0.1.0
|
|
149
149
|
* @since 0.0.1
|
|
150
150
|
* @author AMBROISE PARK Consulting
|
|
151
151
|
*/
|
|
@@ -180,7 +180,7 @@ export function useAccessibleNavigationRoutes() {
|
|
|
180
180
|
* }
|
|
181
181
|
* ```
|
|
182
182
|
*
|
|
183
|
-
* @version 0.0
|
|
183
|
+
* @version 0.1.0
|
|
184
184
|
* @since 0.0.1
|
|
185
185
|
* @author AMBROISE PARK Consulting
|
|
186
186
|
*/
|
|
@@ -214,7 +214,7 @@ export function useAllRoutes() {
|
|
|
214
214
|
* }
|
|
215
215
|
* ```
|
|
216
216
|
*
|
|
217
|
-
* @version 0.0
|
|
217
|
+
* @version 0.1.0
|
|
218
218
|
* @since 0.0.1
|
|
219
219
|
* @author AMBROISE PARK Consulting
|
|
220
220
|
*/
|