@donotdev/ui 0.1.0 → 0.1.42
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 +21 -242
- package/README.md +1 -19
- package/assets/apple-touch-icon.png +0 -0
- package/assets/favicon.ico +0 -0
- package/assets/fonts/Inter-latin-ext.woff2 +0 -0
- package/assets/fonts/Inter-latin.woff2 +0 -0
- package/assets/fonts/PlayfairDisplay-latin-ext.woff2 +0 -0
- package/assets/fonts/PlayfairDisplay-latin.woff2 +0 -0
- package/assets/fonts/Roboto-400-cyrillic-ext.woff2 +0 -0
- package/assets/fonts/Roboto-400-cyrillic.woff2 +0 -0
- package/assets/fonts/Roboto-400-greek-ext.woff2 +0 -0
- package/assets/fonts/Roboto-400-greek.woff2 +0 -0
- package/assets/fonts/Roboto-400-latin-ext.woff2 +0 -0
- package/assets/fonts/Roboto-400-latin.woff2 +0 -0
- package/assets/fonts/Roboto-400-vietnamese.woff2 +0 -0
- package/assets/fonts/Roboto-700-cyrillic-ext.woff2 +0 -0
- package/assets/fonts/Roboto-700-cyrillic.woff2 +0 -0
- package/assets/fonts/Roboto-700-greek-ext.woff2 +0 -0
- package/assets/fonts/Roboto-700-greek.woff2 +0 -0
- package/assets/fonts/Roboto-700-latin-ext.woff2 +0 -0
- package/assets/fonts/Roboto-700-latin.woff2 +0 -0
- package/assets/fonts/Roboto-700-vietnamese.woff2 +0 -0
- package/assets/icon-192x192.png +0 -0
- package/assets/icon-512x512.png +0 -0
- package/assets/logo.png +0 -0
- package/assets/logo.svg +1 -1
- package/assets/manifest.json +0 -0
- package/dist/CookieConsent-5NH5DNTP.js +1 -0
- package/dist/{GoToDialog-CR4VOVXT.js → GoToDialog-CICRYHHG.js} +1 -1
- package/dist/chunk-MIPTBUWY.js +1 -0
- package/dist/components/auth/AuthHeader.d.ts +6 -1
- package/dist/components/auth/AuthHeader.d.ts.map +1 -1
- package/dist/components/auth/AuthHeader.js +4 -4
- package/dist/components/common/FeatureCard.d.ts +11 -6
- package/dist/components/common/FeatureCard.d.ts.map +1 -1
- package/dist/components/common/FeatureCard.js +43 -32
- package/dist/components/common/FeatureDisabled.d.ts +1 -0
- package/dist/components/common/FeatureDisabled.d.ts.map +1 -1
- 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 +1 -0
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.d.ts +4 -3
- package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.js +36 -35
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- 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/components/Breadcrumbs.d.ts +2 -0
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts +1 -0
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppBranding.d.ts +1 -0
- package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppIcon.d.ts +1 -0
- package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppTitle.d.ts +1 -0
- package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/CacheSettings.d.ts.map +1 -1
- package/dist/components/layout/components/header/CacheSettings.js +6 -2
- package/dist/components/layout/components/header/GameTitle.d.ts +1 -0
- package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderMenu.d.ts +1 -0
- package/dist/components/layout/components/header/HeaderMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderNavigation.d.ts +1 -0
- package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.d.ts +1 -0
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +1 -0
- 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 +47 -23
- 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 +6 -1
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +46 -38
- 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 +80 -80
- package/dist/crud/components/EntityRecommendations.d.ts +1 -1
- package/dist/crud/components/EntityRecommendations.d.ts.map +1 -1
- package/dist/crud/components/EntityRecommendations.js +4 -4
- package/dist/crud/components/EntityWorkflow.d.ts.map +1 -1
- package/dist/crud/components/EntityWorkflow.js +1 -1
- package/dist/crud/crudImports.d.ts +1 -1
- package/dist/crud/crudImports.d.ts.map +1 -1
- package/dist/crud/crudImports.js +1 -1
- package/dist/dndev-next.css +831 -171
- package/dist/dndev.css +1000 -185
- package/dist/files/inter-cyrillic-300-normal.woff +0 -0
- package/dist/files/inter-cyrillic-300-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-400-normal.woff +0 -0
- package/dist/files/inter-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-600-normal.woff +0 -0
- package/dist/files/inter-cyrillic-600-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-700-normal.woff +0 -0
- package/dist/files/inter-cyrillic-700-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-300-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-300-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-400-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-600-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-700-normal.woff +0 -0
- package/dist/files/inter-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/files/inter-greek-300-normal.woff +0 -0
- package/dist/files/inter-greek-300-normal.woff2 +0 -0
- package/dist/files/inter-greek-400-normal.woff +0 -0
- package/dist/files/inter-greek-400-normal.woff2 +0 -0
- package/dist/files/inter-greek-600-normal.woff +0 -0
- package/dist/files/inter-greek-600-normal.woff2 +0 -0
- package/dist/files/inter-greek-700-normal.woff +0 -0
- package/dist/files/inter-greek-700-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-300-normal.woff +0 -0
- package/dist/files/inter-greek-ext-300-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-400-normal.woff +0 -0
- package/dist/files/inter-greek-ext-400-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-600-normal.woff +0 -0
- package/dist/files/inter-greek-ext-600-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-700-normal.woff +0 -0
- package/dist/files/inter-greek-ext-700-normal.woff2 +0 -0
- package/dist/files/inter-latin-300-normal.woff +0 -0
- package/dist/files/inter-latin-300-normal.woff2 +0 -0
- package/dist/files/inter-latin-400-normal.woff +0 -0
- package/dist/files/inter-latin-400-normal.woff2 +0 -0
- package/dist/files/inter-latin-600-normal.woff +0 -0
- package/dist/files/inter-latin-600-normal.woff2 +0 -0
- package/dist/files/inter-latin-700-normal.woff +0 -0
- package/dist/files/inter-latin-700-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-300-normal.woff +0 -0
- package/dist/files/inter-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-400-normal.woff +0 -0
- package/dist/files/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-600-normal.woff +0 -0
- package/dist/files/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-700-normal.woff +0 -0
- package/dist/files/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-300-normal.woff +0 -0
- package/dist/files/inter-vietnamese-300-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-400-normal.woff +0 -0
- package/dist/files/inter-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-600-normal.woff +0 -0
- package/dist/files/inter-vietnamese-600-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-700-normal.woff +0 -0
- package/dist/files/inter-vietnamese-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-400-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-500-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-600-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-cyrillic-700-normal.woff +0 -0
- package/dist/files/playfair-display-cyrillic-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-400-normal.woff +0 -0
- package/dist/files/playfair-display-latin-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-500-normal.woff +0 -0
- package/dist/files/playfair-display-latin-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-600-normal.woff +0 -0
- package/dist/files/playfair-display-latin-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-700-normal.woff +0 -0
- package/dist/files/playfair-display-latin-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-400-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-500-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-600-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-latin-ext-700-normal.woff +0 -0
- package/dist/files/playfair-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-400-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-500-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-500-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-600-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-600-normal.woff2 +0 -0
- package/dist/files/playfair-display-vietnamese-700-normal.woff +0 -0
- package/dist/files/playfair-display-vietnamese-700-normal.woff2 +0 -0
- package/dist/files/press-start-2p-cyrillic-400-normal.woff +0 -0
- package/dist/files/press-start-2p-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-cyrillic-ext-400-normal.woff +0 -0
- package/dist/files/press-start-2p-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-greek-400-normal.woff +0 -0
- package/dist/files/press-start-2p-greek-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-latin-400-normal.woff +0 -0
- package/dist/files/press-start-2p-latin-400-normal.woff2 +0 -0
- package/dist/files/press-start-2p-latin-ext-400-normal.woff +0 -0
- package/dist/files/press-start-2p-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-400-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-400-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-700-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-700-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-ext-400-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-cyrillic-ext-700-normal.woff +0 -0
- package/dist/files/roboto-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/files/roboto-greek-400-normal.woff +0 -0
- package/dist/files/roboto-greek-400-normal.woff2 +0 -0
- package/dist/files/roboto-greek-700-normal.woff +0 -0
- package/dist/files/roboto-greek-700-normal.woff2 +0 -0
- package/dist/files/roboto-greek-ext-400-normal.woff +0 -0
- package/dist/files/roboto-greek-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-greek-ext-700-normal.woff +0 -0
- package/dist/files/roboto-greek-ext-700-normal.woff2 +0 -0
- package/dist/files/roboto-latin-400-normal.woff +0 -0
- package/dist/files/roboto-latin-400-normal.woff2 +0 -0
- package/dist/files/roboto-latin-700-normal.woff +0 -0
- package/dist/files/roboto-latin-700-normal.woff2 +0 -0
- package/dist/files/roboto-latin-ext-400-normal.woff +0 -0
- package/dist/files/roboto-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/roboto-latin-ext-700-normal.woff +0 -0
- package/dist/files/roboto-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/roboto-math-400-normal.woff +0 -0
- package/dist/files/roboto-math-400-normal.woff2 +0 -0
- package/dist/files/roboto-math-700-normal.woff +0 -0
- package/dist/files/roboto-math-700-normal.woff2 +0 -0
- package/dist/files/roboto-symbols-400-normal.woff +0 -0
- package/dist/files/roboto-symbols-400-normal.woff2 +0 -0
- package/dist/files/roboto-symbols-700-normal.woff +0 -0
- package/dist/files/roboto-symbols-700-normal.woff2 +0 -0
- package/dist/files/roboto-vietnamese-400-normal.woff +0 -0
- package/dist/files/roboto-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/roboto-vietnamese-700-normal.woff +0 -0
- package/dist/files/roboto-vietnamese-700-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-300-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-300-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-400-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-400-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-500-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-500-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-600-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-600-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-700-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-700-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-300-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-400-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-500-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-600-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/space-grotesk-latin-ext-700-normal.woff +0 -0
- package/dist/files/space-grotesk-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-300-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-300-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-400-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-400-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-500-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-500-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-600-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-600-normal.woff2 +0 -0
- package/dist/files/space-grotesk-vietnamese-700-normal.woff +0 -0
- package/dist/files/space-grotesk-vietnamese-700-normal.woff2 +0 -0
- package/dist/index.js +4 -4
- package/dist/internal/common/ErrorFallback.js +1 -1
- package/dist/internal/devtools/DebugTools.js +1 -1
- package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/DesignTab.js +6 -2
- package/dist/internal/devtools/utils/envVarDiscovery.d.ts.map +1 -1
- package/dist/internal/devtools/utils/envVarDiscovery.js +4 -5
- package/dist/internal/devtools/utils/virtualModuleInspector.d.ts.map +1 -1
- package/dist/internal/devtools/utils/virtualModuleInspector.js +13 -0
- package/dist/internal/initializers/BaseStoresInitializer.d.ts +3 -1
- package/dist/internal/initializers/BaseStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/BaseStoresInitializer.js +17 -4
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.js +2 -13
- package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.js +65 -23
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +57 -29
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts +2 -0
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.js +45 -15
- package/dist/internal/layout/components/PWAUpdateNotification.d.ts.map +1 -1
- package/dist/internal/layout/components/PWAUpdateNotification.js +15 -2
- package/dist/internal/layout/config/presets/moolti.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/moolti.js +11 -13
- 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 +5 -1
- 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 +7 -2
- 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 +9 -3
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +14 -8
- package/dist/routing/AuthGuard.d.ts +7 -22
- package/dist/routing/AuthGuard.d.ts.map +1 -1
- package/dist/routing/AuthGuard.js +19 -64
- 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 +1 -0
- package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
- package/dist/routing/GoTo.d.ts +1 -0
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoToInput.d.ts.map +1 -1
- package/dist/routing/GoToInput.js +5 -5
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +14 -0
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/useNavigate.next.d.ts +4 -0
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +10 -7
- package/dist/routing/hooks/useNavigate.vite.d.ts +4 -0
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +16 -13
- 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 +15 -27
- 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 +15 -27
- package/dist/routing/index.d.ts +1 -0
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -0
- package/dist/routing/useGoTo.d.ts.map +1 -1
- package/dist/routing/useGoTo.js +12 -17
- package/dist/styles/index.css +1000 -185
- package/dist/symbol-index.json +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/sanitizeSvg.d.ts +4 -0
- package/dist/utils/sanitizeSvg.d.ts.map +1 -1
- package/dist/utils/sanitizeSvg.js +4 -0
- 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 +5 -0
- package/dist/utils/useAuthVisibility.d.ts +1 -0
- package/dist/utils/useAuthVisibility.d.ts.map +1 -1
- package/dist/utils/useBillingVisibility.d.ts +1 -0
- package/dist/utils/useBillingVisibility.d.ts.map +1 -1
- package/dist/utils/useSeo.d.ts +121 -0
- package/dist/utils/useSeo.d.ts.map +1 -0
- package/dist/utils/useSeo.js +116 -0
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +20 -5
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +6 -7
- 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 +17 -12
- package/dist/CookieConsent-UVTR7CWW.js +0 -1
- package/dist/chunk-XHGRMKOY.js +0 -1
- package/dist/components/license/LicenseWatermark.d.ts +0 -25
- package/dist/components/license/LicenseWatermark.d.ts.map +0 -1
- package/dist/components/license/LicenseWatermark.js +0 -109
- package/dist/components/license/watermarkData.d.ts +0 -7
- package/dist/components/license/watermarkData.d.ts.map +0 -1
- package/dist/components/license/watermarkData.js +0 -18
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// packages/ui/src/routing/AuthReturnTo.tsx
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Auth Return-To Navigation + Guard Toast
|
|
5
|
+
* @description Consumes `dndev.auth.returnTo` from sessionStorage after OAuth
|
|
6
|
+
* redirect and navigates back to the pre-auth path.
|
|
7
|
+
* Also consumes `dndev.auth.guardToast` flag to show a toast when
|
|
8
|
+
* useNavigate blocked a SPA nav to a protected route.
|
|
9
|
+
*
|
|
10
|
+
* Mount once at layout/provider level (RootLayout). Renders nothing.
|
|
11
|
+
* Works on all routes - unlike AuthGuard which only runs on guarded pages.
|
|
12
|
+
*
|
|
13
|
+
* @version 0.1.0
|
|
14
|
+
* @since 0.6.0
|
|
15
|
+
* @author AMBROISE PARK Consulting
|
|
16
|
+
*/
|
|
17
|
+
import { useEffect } from 'react';
|
|
18
|
+
import { useToast } from '@donotdev/components';
|
|
19
|
+
import { isClient, safeSessionStorage, useTranslation } from '@donotdev/core';
|
|
20
|
+
import { useAuthSafe } from '../utils/useAuthSafe';
|
|
21
|
+
import { useNavigate } from '@donotdev/ui/routing/hooks';
|
|
22
|
+
/**
|
|
23
|
+
* AuthReturnTo - Restores navigation after OAuth redirect.
|
|
24
|
+
*
|
|
25
|
+
* OAuth always lands on `/` (origin). This component watches for sign-in,
|
|
26
|
+
* reads the saved returnTo path, and navigates back. Runs once per sign-in.
|
|
27
|
+
*
|
|
28
|
+
* Also shows a warning toast when the user was redirected by the auth guard
|
|
29
|
+
* (flag set by useNavigate, consumed here on mount of the landing page).
|
|
30
|
+
*
|
|
31
|
+
* @component
|
|
32
|
+
*/
|
|
33
|
+
export function AuthReturnTo() {
|
|
34
|
+
const user = useAuthSafe('user');
|
|
35
|
+
const navigate = useNavigate();
|
|
36
|
+
const { t } = useTranslation('dndev');
|
|
37
|
+
const { toast } = useToast();
|
|
38
|
+
// Show guard toast on landing page after auth redirect
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!isClient())
|
|
41
|
+
return;
|
|
42
|
+
const flag = safeSessionStorage.getItem('dndev.auth.guardToast');
|
|
43
|
+
if (!flag)
|
|
44
|
+
return;
|
|
45
|
+
safeSessionStorage.removeItem('dndev.auth.guardToast');
|
|
46
|
+
toast('warning', t('guard.signInRequired', 'Please sign in to access this page'));
|
|
47
|
+
}, []);
|
|
48
|
+
// Return-to after sign-in
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (!user || !isClient())
|
|
51
|
+
return;
|
|
52
|
+
const returnTo = safeSessionStorage.getItem('dndev.auth.returnTo');
|
|
53
|
+
if (!returnTo)
|
|
54
|
+
return;
|
|
55
|
+
safeSessionStorage.removeItem('dndev.auth.returnTo');
|
|
56
|
+
if (returnTo !== window.location.pathname) {
|
|
57
|
+
navigate(returnTo, { replace: true });
|
|
58
|
+
}
|
|
59
|
+
}, [user, navigate]);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentType } from 'react';
|
|
2
2
|
import { DISPLAY } from '@donotdev/components';
|
|
3
3
|
import type { NavigationItem } from './useNavigation';
|
|
4
|
+
/** Props for the DnDevNavigationMenu component. */
|
|
4
5
|
export interface DnDevNavigationMenuProps {
|
|
5
6
|
/** Routes to display (optional - auto-fetches if not provided) */
|
|
6
7
|
routes?: NavigationItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDevNavigationMenu.d.ts","sourceRoot":"","sources":["../../src/routing/DnDevNavigationMenu.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAEf,OAAO,EAOL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAW9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA8KvE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"DnDevNavigationMenu.d.ts","sourceRoot":"","sources":["../../src/routing/DnDevNavigationMenu.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAEf,OAAO,EAOL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAW9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,mDAAmD;AACnD,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA8KvE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/dist/routing/GoTo.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoTo.d.ts","sourceRoot":"","sources":["../../src/routing/GoTo.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA0B,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGvE,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,iCAIlB,SAAS,4CA0CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"GoTo.d.ts","sourceRoot":"","sources":["../../src/routing/GoTo.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA0B,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGvE,kDAAkD;AAClD,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,iCAIlB,SAAS,4CA0CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoToInput.d.ts","sourceRoot":"","sources":["../../src/routing/GoToInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GoToInput.d.ts","sourceRoot":"","sources":["../../src/routing/GoToInput.tsx"],"names":[],"mappings":"AA0BA,QAAA,MAAM,SAAS,+CAqEd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
11
|
import { Search } from 'lucide-react';
|
|
12
|
-
import {
|
|
12
|
+
import { useEffect, useState, useRef } from 'react';
|
|
13
13
|
import { Stack } from '@donotdev/components';
|
|
14
14
|
import { useOverlayStore } from '@donotdev/core';
|
|
15
15
|
import { useTranslation } from '@donotdev/core';
|
|
@@ -30,15 +30,15 @@ const GoToInput = () => {
|
|
|
30
30
|
setValue('');
|
|
31
31
|
}
|
|
32
32
|
}, [isCommandDialogOpen]);
|
|
33
|
-
const handleFocus =
|
|
33
|
+
const handleFocus = () => {
|
|
34
34
|
useOverlayStore.getState().openCommandDialog(value);
|
|
35
|
-
}
|
|
36
|
-
const handleKeyDown =
|
|
35
|
+
};
|
|
36
|
+
const handleKeyDown = (e) => {
|
|
37
37
|
if (e.key === 'Enter') {
|
|
38
38
|
e.preventDefault();
|
|
39
39
|
useOverlayStore.getState().openCommandDialog(value);
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
};
|
|
42
42
|
return (_jsxs(Stack, { direction: "row", align: "center", className: "dndev-relative dndev-w-full dndev-max-w-sm", role: "search", children: [_jsx(Search, { className: "dndev-absolute dndev-size-md", style: { insetInlineStart: '0.75rem', opacity: 0.5 }, "aria-hidden": "true" }), _jsx("input", { ref: inputRef, type: "text", value: value, onChange: (e) => setValue(e.target.value), onFocus: handleFocus, onKeyDown: handleKeyDown, placeholder: t('globalGoTo.searchPlaceholder', 'Search pages...'), className: "dndev-input dndev-w-full", style: { paddingInlineStart: '2.5rem', paddingInlineEnd: '5rem' }, "aria-label": t('globalGoTo.ariaLabel', 'Search navigation') }), _jsx("div", { className: "dndev-absolute dndev-flex dndev-items-center dndev-text-sm", style: { insetInlineEnd: '0.75rem', gap: '0.25rem', opacity: 0.5 }, "aria-hidden": "true", children: _jsx("kbd", { style: {
|
|
43
43
|
padding: '0.25rem 0.5rem',
|
|
44
44
|
fontSize: 'var(--font-size-xs)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/routing/Link.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AASf;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/routing/Link.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AASf;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,SAAS,CAyJzC,CAAC"}
|
package/dist/routing/Link.js
CHANGED
|
@@ -29,6 +29,12 @@ export const Link = ({ path, replace, prefetch = true, children, icon, iconEnd =
|
|
|
29
29
|
// Special framework trigger: #cookie-settings
|
|
30
30
|
if (path === '#cookie-settings') {
|
|
31
31
|
const handleCookieSettings = (e) => {
|
|
32
|
+
// Honor browser native open-in-new-tab on modifier+click or non-left-click.
|
|
33
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) {
|
|
34
|
+
if (onClick)
|
|
35
|
+
onClick(e);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
32
38
|
e.preventDefault();
|
|
33
39
|
e.stopPropagation();
|
|
34
40
|
try {
|
|
@@ -61,6 +67,14 @@ export const Link = ({ path, replace, prefetch = true, children, icon, iconEnd =
|
|
|
61
67
|
}
|
|
62
68
|
return; // Don't prevent default for external links
|
|
63
69
|
}
|
|
70
|
+
// Honor browser native open-in-new-tab on modifier+click or non-left-click.
|
|
71
|
+
// Without this, preventDefault() below would block the browser default,
|
|
72
|
+
// and Ctrl/Cmd-click would silently navigate in the same tab.
|
|
73
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) {
|
|
74
|
+
if (onClick)
|
|
75
|
+
onClick(e);
|
|
76
|
+
return; // browser handles new tab / new window
|
|
77
|
+
}
|
|
64
78
|
// Internal links: use framework navigation
|
|
65
79
|
e.preventDefault();
|
|
66
80
|
if (onClick) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useRouter as
|
|
1
|
+
"use client";import{useRouter as p}from"next/navigation";import{isClient as k,useOverlayStore as v}from"@donotdev/core";function d(){let e=p(),r=v(t=>t.closeAll);return(t,s)=>{if(t==="back")return r(),e.back();if(r(),s?.preserveScroll&&k()){let o=window.scrollY;s?.replace?e.replace(t):e.push(t),requestAnimationFrame(()=>{window.scrollTo({top:o,behavior:"auto"})});return}return s?.replace?e.replace(t):e.push(t)}}function b(){let e=p();return()=>e.back()}function w(){let e=p();return()=>e.refresh()}function N(){let e=p();return r=>e.prefetch(r)}import{usePathname as T,useSearchParams as I}from"next/navigation";function l(){let e=T(),t=I().toString(),s=t?`?${t}`:void 0;return{pathname:e||"/",search:s,hash:"",state:null}}import{useParams as C}from"next/navigation";function g(){let e=C();return e||{}}function G(e){let t=g()[e];if(typeof t=="string")return t;if(Array.isArray(t)&&t.length>0)return t[0]}import{useSearchParams as $}from"next/navigation";function R(){return $()}import{usePathname as K}from"next/navigation";function O(e){let r=K(),t=e.replace(/:[^/]+/g,"([^/]+)").replace(/\*/g,".*"),s=new RegExp(`^${t}$`),o=r.match(s);if(!o)return null;let u=e.match(/:[^/]+/g)?.map(a=>a.slice(1))||[],n={};return u.forEach((a,c)=>{n[a]=o[c+1]||""}),{params:n,pathname:r,pattern:e}}import{useCallback as P}from"react";function U(){let e=R(),r=d(),t=l(),s=P((n,a)=>{let c=new URLSearchParams(e.toString());c.set(n,a);let f=c.toString(),i=`${t.pathname||"/"}${f?`?${f}`:""}`;r(i)},[e,r,t.pathname]),o=P(n=>{let a=new URLSearchParams(e.toString());a.delete(n);let c=a.toString(),m=`${t.pathname||"/"}${c?`?${c}`:""}`;r(m)},[e,r,t.pathname]),u=P(()=>{let n=t.pathname||"/";r(n)},[r,t.pathname]);return{query:e,setQuery:s,removeQuery:o,clearQueries:u}}import{useMemo as Q}from"react";import{isClient as F,FEATURE_STATUS as M}from"@donotdev/core";import{useAuthConfig as j}from"@donotdev/core";import*as S from"@donotdev/auth";import{DEGRADED_AUTH_API as L}from"@donotdev/core";var A=S?.useAuth;function E(e){return L[e]}function h(e){return A?A(e):E(e)}var ce=S?.PasswordResetCallback??(()=>null);function q(e={}){let{auth:r,redirectTo:t,condition:s}=e,o=l(),u=j(),n=h("user"),a=h("can"),c=h("status");return Q(()=>{let m={shouldRedirect:!1,redirectTo:null,isChecking:!1};if(!F())return m;if(c===M.INITIALIZING)return{...m,isChecking:!0};if(s){let i=s(n,c);return{shouldRedirect:i,redirectTo:i&&t||null,isChecking:!1}}if(r!==!1&&r!==void 0){if(!a)return m;if(!a.navigate(r)){let i=null;if(typeof r=="object"&&r.required&&!n){let y=o.search?.includes("code=")||o.search?.includes("state=")||o.search?.includes("error="),x=u.authRoute;y?i=`${x}${o.search}`:i=x}else typeof r=="object"&&r.role?i=u.roleRoute:typeof r=="object"&&r.tier?i=u.tierRoute:i=u.roleRoute;return{shouldRedirect:!0,redirectTo:t||i,isChecking:!1}}}return m},[r,c,n,a,s,t,o.search,u.authRoute,u.roleRoute,u.tierRoute])}export{b as useBack,l as useLocation,O as useMatch,d as useNavigate,g as useParams,N as usePrefetch,U as useQueryParams,q as useRedirectGuard,w as useRefresh,G as useRouteParam,R as useSearchParams};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useNavigate as P}from"react-router-dom";import{isClient as v,useOverlayStore as k}from"@donotdev/core";function h(){let e=P(),r=k(t=>t.closeAll);return(t,i)=>t==="back"?(r(),e(-1)):(r(),i?.replace?e(t,{replace:!0}):e(t))}function I(){let e=P();return()=>e(-1)}function b(){return()=>{v()&&window.location.reload()}}function w(){return e=>{}}import{useLocation as C}from"react-router-dom";function m(){return C()}import{useParams as G}from"react-router-dom";function d(){return G()}function T(e){let t=d()[e];if(typeof t=="string")return t;if(Array.isArray(t)&&t.length>0)return t[0]}import{useSearchParams as N}from"react-router-dom";function R(){return N()[0]}import{useMatch as L}from"react-router-dom";function K(e){return L(e)}import{useCallback as g}from"react";function U(){let e=R(),r=h(),t=m(),i=g((n,u)=>{let a=new URLSearchParams(e.toString());a.set(n,u);let l=a.toString(),o=`${t.pathname||"/"}${l?`?${l}`:""}`;r(o)},[e,r,t.pathname]),c=g(n=>{let u=new URLSearchParams(e.toString());u.delete(n);let a=u.toString(),f=`${t.pathname||"/"}${a?`?${a}`:""}`;r(f)},[e,r,t.pathname]),s=g(()=>{let n=t.pathname||"/";r(n)},[r,t.pathname]);return{query:e,setQuery:i,removeQuery:c,clearQueries:s}}import{useMemo as M}from"react";import{isClient as Q,FEATURE_STATUS as E}from"@donotdev/core";import{useAuthConfig as _}from"@donotdev/core";import*as y from"@donotdev/auth";import{DEGRADED_AUTH_API as O}from"@donotdev/core";var x=y?.useAuth;function $(e){return O[e]}function p(e){return x?x(e):$(e)}var ue=y?.PasswordResetCallback??(()=>null);function j(e={}){let{auth:r,redirectTo:t,condition:i}=e,c=m(),s=_(),n=p("user"),u=p("can"),a=p("status");return M(()=>{let f={shouldRedirect:!1,redirectTo:null,isChecking:!1};if(!Q())return f;if(a===E.INITIALIZING)return{...f,isChecking:!0};if(i){let o=i(n,a);return{shouldRedirect:o,redirectTo:o&&t||null,isChecking:!1}}if(r!==!1&&r!==void 0){if(!u)return f;if(!u.navigate(r)){let o=null;if(typeof r=="object"&&r.required&&!n){let S=c.search.includes("code=")||c.search.includes("state=")||c.search.includes("error="),A=s.authRoute;S?o=`${A}${c.search}`:o=A}else typeof r=="object"&&r.role?o=s.roleRoute:typeof r=="object"&&r.tier?o=s.tierRoute:o=s.roleRoute;return{shouldRedirect:!0,redirectTo:t||o,isChecking:!1}}}return f},[r,a,n,u,i,t,c.search,s.authRoute,s.roleRoute,s.tierRoute])}export{I as useBack,m as useLocation,K as useMatch,h as useNavigate,d as useParams,w as usePrefetch,U as useQueryParams,j as useRedirectGuard,b as useRefresh,T as useRouteParam,R as useSearchParams};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { NavigateOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Navigation hook. Auth is handled by AuthGuard (cold-load redirect).
|
|
4
|
+
* Protected routes are hidden from unauthorized users via useAccessibleRoutes.
|
|
5
|
+
*/
|
|
2
6
|
export declare function useNavigate(): (to: string, options?: NavigateOptions) => void;
|
|
3
7
|
export declare function useBack(): () => void;
|
|
4
8
|
export declare function useRefresh(): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigate.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNavigate.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.next.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,WAAW,KAIjB,IAAI,MAAM,EAAE,UAAU,eAAe,UAwB9C;AAED,wBAAgB,OAAO,eAGtB;AAED,wBAAgB,UAAU,eAGzB;AAED,wBAAgB,WAAW,KAEjB,IAAI,MAAM,UACnB"}
|
|
@@ -4,17 +4,20 @@
|
|
|
4
4
|
* @fileoverview Next.js-specific navigation hooks
|
|
5
5
|
* @description Navigation hooks for Next.js App Router
|
|
6
6
|
*
|
|
7
|
-
* @version 0.
|
|
7
|
+
* @version 0.2.0
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
11
|
import { useRouter as useNextRouter } from 'next/navigation';
|
|
12
|
-
import { useCallback } from 'react';
|
|
13
12
|
import { isClient, useOverlayStore } from '@donotdev/core';
|
|
13
|
+
/**
|
|
14
|
+
* Navigation hook. Auth is handled by AuthGuard (cold-load redirect).
|
|
15
|
+
* Protected routes are hidden from unauthorized users via useAccessibleRoutes.
|
|
16
|
+
*/
|
|
14
17
|
export function useNavigate() {
|
|
15
18
|
const router = useNextRouter();
|
|
16
19
|
const closeAll = useOverlayStore((state) => state.closeAll);
|
|
17
|
-
return
|
|
20
|
+
return (to, options) => {
|
|
18
21
|
if (to === 'back') {
|
|
19
22
|
closeAll();
|
|
20
23
|
return router.back();
|
|
@@ -36,17 +39,17 @@ export function useNavigate() {
|
|
|
36
39
|
if (options?.replace)
|
|
37
40
|
return router.replace(to);
|
|
38
41
|
return router.push(to);
|
|
39
|
-
}
|
|
42
|
+
};
|
|
40
43
|
}
|
|
41
44
|
export function useBack() {
|
|
42
45
|
const router = useNextRouter();
|
|
43
|
-
return
|
|
46
|
+
return () => router.back();
|
|
44
47
|
}
|
|
45
48
|
export function useRefresh() {
|
|
46
49
|
const router = useNextRouter();
|
|
47
|
-
return
|
|
50
|
+
return () => router.refresh();
|
|
48
51
|
}
|
|
49
52
|
export function usePrefetch() {
|
|
50
53
|
const router = useNextRouter();
|
|
51
|
-
return
|
|
54
|
+
return (to) => router.prefetch(to);
|
|
52
55
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { NavigateOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Navigation hook. Auth is handled by AuthGuard (cold-load redirect).
|
|
4
|
+
* Protected routes are hidden from unauthorized users via useAccessibleRoutes.
|
|
5
|
+
*/
|
|
2
6
|
export declare function useNavigate(): (to: string, options?: NavigateOptions) => void | Promise<void>;
|
|
3
7
|
export declare function useBack(): () => void | Promise<void>;
|
|
4
8
|
export declare function useRefresh(): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigate.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.vite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNavigate.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useNavigate.vite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,WAAW,KAIjB,IAAI,MAAM,EAAE,UAAU,eAAe,0BAW9C;AAED,wBAAgB,OAAO,+BAGtB;AAED,wBAAgB,UAAU,eAIzB;AAED,wBAAgB,WAAW,KACjB,KAAK,MAAM,UAGpB"}
|
|
@@ -4,39 +4,42 @@
|
|
|
4
4
|
* @fileoverview Vite-specific navigation hooks
|
|
5
5
|
* @description Navigation hooks for React Router (Vite)
|
|
6
6
|
*
|
|
7
|
-
* @version 0.
|
|
7
|
+
* @version 0.2.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
12
|
import { isClient, useOverlayStore } from '@donotdev/core';
|
|
13
|
+
/**
|
|
14
|
+
* Navigation hook. Auth is handled by AuthGuard (cold-load redirect).
|
|
15
|
+
* Protected routes are hidden from unauthorized users via useAccessibleRoutes.
|
|
16
|
+
*/
|
|
14
17
|
export function useNavigate() {
|
|
15
|
-
const
|
|
18
|
+
const routerNavigate = useRouterNavigate();
|
|
16
19
|
const closeAll = useOverlayStore((state) => state.closeAll);
|
|
17
|
-
return
|
|
20
|
+
return (to, options) => {
|
|
18
21
|
if (to === 'back') {
|
|
19
22
|
closeAll();
|
|
20
|
-
return
|
|
23
|
+
return routerNavigate(-1);
|
|
21
24
|
}
|
|
22
25
|
closeAll();
|
|
23
26
|
if (options?.replace)
|
|
24
|
-
return
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
+
return routerNavigate(to, { replace: true });
|
|
28
|
+
return routerNavigate(to);
|
|
29
|
+
};
|
|
27
30
|
}
|
|
28
31
|
export function useBack() {
|
|
29
32
|
const navigate = useRouterNavigate();
|
|
30
|
-
return
|
|
33
|
+
return () => navigate(-1);
|
|
31
34
|
}
|
|
32
35
|
export function useRefresh() {
|
|
33
|
-
return
|
|
36
|
+
return () => {
|
|
34
37
|
if (isClient())
|
|
35
38
|
window.location.reload();
|
|
36
|
-
}
|
|
39
|
+
};
|
|
37
40
|
}
|
|
38
41
|
export function usePrefetch() {
|
|
39
|
-
return
|
|
42
|
+
return (_to) => {
|
|
40
43
|
// Vite: no-op
|
|
41
|
-
}
|
|
44
|
+
};
|
|
42
45
|
}
|
|
@@ -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,CAgGrB"}
|
|
@@ -32,21 +32,17 @@ export function useRedirectGuard(options = {}) {
|
|
|
32
32
|
const status = useAuthSafe('status');
|
|
33
33
|
// Determine redirect state
|
|
34
34
|
const redirectState = useMemo(() => {
|
|
35
|
+
const noAction = {
|
|
36
|
+
shouldRedirect: false,
|
|
37
|
+
redirectTo: null,
|
|
38
|
+
isChecking: false,
|
|
39
|
+
};
|
|
35
40
|
// SSR-safe: return safe defaults on server
|
|
36
|
-
if (!isClient())
|
|
37
|
-
return
|
|
38
|
-
shouldRedirect: false,
|
|
39
|
-
redirectTo: null,
|
|
40
|
-
isChecking: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
41
|
+
if (!isClient())
|
|
42
|
+
return noAction;
|
|
43
43
|
// Only INITIALIZING = still checking. DEGRADED/ERROR/READY = auth resolved (proceed with current user)
|
|
44
44
|
if (status === FEATURE_STATUS.INITIALIZING) {
|
|
45
|
-
return {
|
|
46
|
-
shouldRedirect: false,
|
|
47
|
-
redirectTo: null,
|
|
48
|
-
isChecking: true,
|
|
49
|
-
};
|
|
45
|
+
return { ...noAction, isChecking: true };
|
|
50
46
|
}
|
|
51
47
|
// Custom condition provided
|
|
52
48
|
if (condition) {
|
|
@@ -59,27 +55,23 @@ export function useRedirectGuard(options = {}) {
|
|
|
59
55
|
}
|
|
60
56
|
// Use auth config to determine redirect
|
|
61
57
|
if (auth !== false && auth !== undefined) {
|
|
62
|
-
if (!can)
|
|
63
|
-
return
|
|
64
|
-
shouldRedirect: false,
|
|
65
|
-
redirectTo: null,
|
|
66
|
-
isChecking: false,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
58
|
+
if (!can)
|
|
59
|
+
return noAction;
|
|
69
60
|
// Check if user can navigate to this route
|
|
70
61
|
if (!can.navigate(auth)) {
|
|
71
62
|
let targetRoute = null;
|
|
72
|
-
// Authentication failure (not logged in)
|
|
63
|
+
// Authentication failure (not logged in) → always redirect
|
|
73
64
|
if (typeof auth === 'object' && auth.required && !user) {
|
|
74
65
|
// Check if we have OAuth parameters that need to be preserved
|
|
75
66
|
const hasOAuthParams = location.search?.includes('code=') ||
|
|
76
67
|
location.search?.includes('state=') ||
|
|
77
68
|
location.search?.includes('error=');
|
|
69
|
+
const authRoute = authConfig.authRoute;
|
|
78
70
|
if (hasOAuthParams) {
|
|
79
|
-
targetRoute = `${
|
|
71
|
+
targetRoute = `${authRoute}${location.search}`;
|
|
80
72
|
}
|
|
81
73
|
else {
|
|
82
|
-
targetRoute =
|
|
74
|
+
targetRoute = authRoute;
|
|
83
75
|
}
|
|
84
76
|
}
|
|
85
77
|
// Authorization failure (wrong role)
|
|
@@ -102,11 +94,7 @@ export function useRedirectGuard(options = {}) {
|
|
|
102
94
|
}
|
|
103
95
|
}
|
|
104
96
|
// No redirect needed
|
|
105
|
-
return
|
|
106
|
-
shouldRedirect: false,
|
|
107
|
-
redirectTo: null,
|
|
108
|
-
isChecking: false,
|
|
109
|
-
};
|
|
97
|
+
return noAction;
|
|
110
98
|
}, [
|
|
111
99
|
auth,
|
|
112
100
|
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,CAgGrB"}
|
|
@@ -32,21 +32,17 @@ export function useRedirectGuard(options = {}) {
|
|
|
32
32
|
const status = useAuthSafe('status');
|
|
33
33
|
// Determine redirect state
|
|
34
34
|
const redirectState = useMemo(() => {
|
|
35
|
+
const noAction = {
|
|
36
|
+
shouldRedirect: false,
|
|
37
|
+
redirectTo: null,
|
|
38
|
+
isChecking: false,
|
|
39
|
+
};
|
|
35
40
|
// SSR-safe: return safe defaults on server
|
|
36
|
-
if (!isClient())
|
|
37
|
-
return
|
|
38
|
-
shouldRedirect: false,
|
|
39
|
-
redirectTo: null,
|
|
40
|
-
isChecking: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
41
|
+
if (!isClient())
|
|
42
|
+
return noAction;
|
|
43
43
|
// Only INITIALIZING = still checking. DEGRADED/ERROR/READY = auth resolved (proceed with current user)
|
|
44
44
|
if (status === FEATURE_STATUS.INITIALIZING) {
|
|
45
|
-
return {
|
|
46
|
-
shouldRedirect: false,
|
|
47
|
-
redirectTo: null,
|
|
48
|
-
isChecking: true,
|
|
49
|
-
};
|
|
45
|
+
return { ...noAction, isChecking: true };
|
|
50
46
|
}
|
|
51
47
|
// Custom condition provided
|
|
52
48
|
if (condition) {
|
|
@@ -59,27 +55,23 @@ export function useRedirectGuard(options = {}) {
|
|
|
59
55
|
}
|
|
60
56
|
// Use auth config to determine redirect
|
|
61
57
|
if (auth !== false && auth !== undefined) {
|
|
62
|
-
if (!can)
|
|
63
|
-
return
|
|
64
|
-
shouldRedirect: false,
|
|
65
|
-
redirectTo: null,
|
|
66
|
-
isChecking: false,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
58
|
+
if (!can)
|
|
59
|
+
return noAction;
|
|
69
60
|
// Check if user can navigate to this route
|
|
70
61
|
if (!can.navigate(auth)) {
|
|
71
62
|
let targetRoute = null;
|
|
72
|
-
// Authentication failure (not logged in)
|
|
63
|
+
// Authentication failure (not logged in) → always redirect
|
|
73
64
|
if (typeof auth === 'object' && auth.required && !user) {
|
|
74
65
|
// Check if we have OAuth parameters that need to be preserved
|
|
75
66
|
const hasOAuthParams = location.search.includes('code=') ||
|
|
76
67
|
location.search.includes('state=') ||
|
|
77
68
|
location.search.includes('error=');
|
|
69
|
+
const authRoute = authConfig.authRoute;
|
|
78
70
|
if (hasOAuthParams) {
|
|
79
|
-
targetRoute = `${
|
|
71
|
+
targetRoute = `${authRoute}${location.search}`;
|
|
80
72
|
}
|
|
81
73
|
else {
|
|
82
|
-
targetRoute =
|
|
74
|
+
targetRoute = authRoute;
|
|
83
75
|
}
|
|
84
76
|
}
|
|
85
77
|
// Authorization failure (wrong role)
|
|
@@ -102,11 +94,7 @@ export function useRedirectGuard(options = {}) {
|
|
|
102
94
|
}
|
|
103
95
|
}
|
|
104
96
|
// No redirect needed
|
|
105
|
-
return
|
|
106
|
-
shouldRedirect: false,
|
|
107
|
-
redirectTo: null,
|
|
108
|
-
isChecking: false,
|
|
109
|
-
};
|
|
97
|
+
return noAction;
|
|
110
98
|
}, [
|
|
111
99
|
auth,
|
|
112
100
|
status,
|
package/dist/routing/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
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
|
@@ -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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGoTo.d.ts","sourceRoot":"","sources":["../../src/routing/useGoTo.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;
|
|
1
|
+
{"version":3,"file":"useGoTo.d.ts","sourceRoot":"","sources":["../../src/routing/useGoTo.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;2BAwBY,MAAM;uBAKV,MAAM;2BASvB,MAAM;CAehB,CAAC"}
|
package/dist/routing/useGoTo.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @since 0.0.1
|
|
8
8
|
* @author AMBROISE PARK Consulting
|
|
9
9
|
*/
|
|
10
|
-
import { useCallback
|
|
10
|
+
import { useCallback } from 'react';
|
|
11
11
|
import { useNavigationStore } from '@donotdev/core';
|
|
12
12
|
// Platform-specific hooks via conditional exports
|
|
13
13
|
import { useNavigate } from '@donotdev/ui/routing/hooks';
|
|
@@ -26,28 +26,23 @@ export const useGoTo = () => {
|
|
|
26
26
|
const isFavoriteStore = useNavigationStore((state) => state.isFavorite);
|
|
27
27
|
const addRecentStore = useNavigationStore((state) => state.addRecent);
|
|
28
28
|
// Get favorite items
|
|
29
|
-
const favoriteItems =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return navigationItems.filter((item) => favorites.includes(item.path));
|
|
33
|
-
}, [favorites, navigationItems]);
|
|
29
|
+
const favoriteItems = navigationItems.length
|
|
30
|
+
? navigationItems.filter((item) => favorites.includes(item.path))
|
|
31
|
+
: [];
|
|
34
32
|
// Get recent items
|
|
35
|
-
const recentItems =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const items = navigationItems.filter((item) => recent.includes(item.path));
|
|
39
|
-
return items.slice(0, 5);
|
|
40
|
-
}, [recent, navigationItems]);
|
|
33
|
+
const recentItems = navigationItems.length
|
|
34
|
+
? navigationItems.filter((item) => recent.includes(item.path)).slice(0, 5)
|
|
35
|
+
: [];
|
|
41
36
|
// Toggle favorite (delegates to navigation store)
|
|
42
|
-
const toggleFavorite =
|
|
37
|
+
const toggleFavorite = (path) => {
|
|
43
38
|
toggleFavoriteStore(path);
|
|
44
|
-
}
|
|
39
|
+
};
|
|
45
40
|
// Check if item is favorite (delegates to navigation store)
|
|
46
|
-
const isFavorite =
|
|
41
|
+
const isFavorite = (path) => isFavoriteStore(path);
|
|
47
42
|
// Add to recent (delegates to navigation store)
|
|
48
|
-
const addRecent =
|
|
43
|
+
const addRecent = (path) => {
|
|
49
44
|
addRecentStore(path);
|
|
50
|
-
}
|
|
45
|
+
};
|
|
51
46
|
// Navigate to item
|
|
52
47
|
const navigateToItem = useCallback((path) => {
|
|
53
48
|
addRecent(path);
|