@donotdev/ui 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChildRowsPicker-63M4EQUQ.js +1 -0
- package/dist/ChildRowsPicker-ISP365ON.js +1 -0
- package/dist/ChildRowsPicker-PQFE6NCR.js +1 -0
- package/dist/ChildRowsPicker-XXFFSMWY.js +1 -0
- package/dist/{GoToDialog-CICRYHHG.js → GoToDialog-KSBGOIWO.js} +1 -1
- package/dist/{GoToDialog-YGBON6FR.js → GoToDialog-XBK5EZF4.js} +1 -1
- package/dist/chunk-3CIZFGST.js +1 -0
- package/dist/chunk-LHMKU342.js +1 -0
- package/dist/chunk-MS7ZIW5Z.js +1 -0
- package/dist/chunk-P2DHZWPY.js +1 -0
- package/dist/components/auth/AuthHeader.d.ts.map +1 -1
- package/dist/components/auth/AuthHeader.js +0 -2
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +6 -40
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +2 -1
- package/dist/components/common/lucideIconByName.d.ts +9 -0
- package/dist/components/common/lucideIconByName.d.ts.map +1 -0
- package/dist/components/common/lucideIconByName.js +32 -0
- package/dist/components/layout/GameFlow.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +18 -12
- package/dist/components/layout/components/header/CacheSettings.d.ts.map +1 -1
- package/dist/components/layout/components/header/CacheSettings.js +6 -4
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +4 -3
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +2 -1
- package/dist/crud/components/ChildRowsPicker.d.ts +21 -0
- package/dist/crud/components/ChildRowsPicker.d.ts.map +1 -0
- package/dist/crud/components/ChildRowsPicker.js +68 -0
- package/dist/crud/components/CrudCardLink.d.ts +6 -6
- package/dist/crud/components/CrudCardLink.d.ts.map +1 -1
- package/dist/crud/components/CrudCardLink.js +3 -9
- package/dist/crud/components/EntityCardList.d.ts.map +1 -1
- package/dist/crud/components/EntityCardList.js +10 -26
- package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityDisplayRenderer.js +6 -3
- package/dist/crud/components/EntityFormRenderer.d.ts +4 -2
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +160 -56
- package/dist/crud/components/EntityList.d.ts +6 -4
- package/dist/crud/components/EntityList.d.ts.map +1 -1
- package/dist/crud/components/EntityList.js +437 -92
- package/dist/crud/components/EntityRecommendations.js +1 -1
- package/dist/crud/components/EntityWorkflow.d.ts.map +1 -1
- package/dist/crud/components/EntityWorkflow.js +6 -4
- package/dist/crud/components/Form.d.ts +1 -1
- package/dist/crud/components/Form.d.ts.map +1 -1
- package/dist/crud/components/Form.js +2 -2
- package/dist/crud/components/cellEditFor.d.ts +43 -0
- package/dist/crud/components/cellEditFor.d.ts.map +1 -0
- package/dist/crud/components/cellEditFor.js +74 -0
- package/dist/crud/components/entityParent.d.ts +33 -0
- package/dist/crud/components/entityParent.d.ts.map +1 -0
- package/dist/crud/components/entityParent.js +76 -0
- package/dist/crud/components/useRecordBreadcrumb.d.ts +11 -0
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -0
- package/dist/crud/components/useRecordBreadcrumb.js +43 -0
- package/dist/crud/crudImports.d.ts +12 -1
- package/dist/crud/crudImports.d.ts.map +1 -1
- package/dist/crud/crudImports.js +11 -0
- package/dist/dndev-next.css +782 -193
- package/dist/dndev.css +784 -193
- package/dist/index.js +4 -4
- package/dist/internal/common/RouteErrorFallback.d.ts.map +1 -1
- package/dist/internal/common/RouteErrorFallback.js +2 -4
- package/dist/internal/devtools/components/ConfigTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/ConfigTab.js +1 -1
- package/dist/internal/devtools/components/CookieTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/CookieTab.js +1 -5
- package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/DesignTab.js +18 -7
- package/dist/internal/devtools/components/StoresTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/StoresTab.js +17 -3
- package/dist/internal/devtools/types.d.ts +3 -3
- package/dist/internal/devtools/types.d.ts.map +1 -1
- package/dist/internal/devtools/utils/maskSensitive.d.ts +1 -1
- package/dist/internal/devtools/utils/maskSensitive.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts +3 -0
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.js +8 -1
- package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.js +21 -21
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +42 -38
- package/dist/internal/layout/components/FontPreloadLinks.d.ts +7 -4
- package/dist/internal/layout/components/FontPreloadLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/FontPreloadLinks.js +12 -25
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts +2 -0
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +4 -0
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts +2 -1
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/useLegalLinks.js +4 -3
- package/dist/internal/layout/components/i18nSeoMeta.d.ts.map +1 -1
- package/dist/internal/layout/components/i18nSeoMeta.js +1 -0
- package/dist/internal/layout/zones/DnDevMergedBar.js +3 -3
- package/dist/internal/providers/UIProviders.d.ts +0 -8
- package/dist/internal/providers/UIProviders.d.ts.map +1 -1
- package/dist/internal/providers/UIProviders.js +45 -2
- package/dist/providers/NextJsAppProviders.d.ts +5 -1
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +36 -6
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +42 -7
- package/dist/routing/404.d.ts +8 -1
- package/dist/routing/404.d.ts.map +1 -1
- package/dist/routing/404.js +9 -5
- package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
- package/dist/routing/AuthGuardFallback.js +1 -2
- package/dist/routing/AuthReturnTo.d.ts.map +1 -1
- package/dist/routing/AuthReturnTo.js +9 -2
- package/dist/routing/GoTo.d.ts +0 -6
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +5 -8
- package/dist/routing/Link.d.ts +4 -2
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +8 -5
- package/dist/routing/SignedInRedirect.d.ts +27 -0
- package/dist/routing/SignedInRedirect.d.ts.map +1 -0
- package/dist/routing/SignedInRedirect.js +47 -0
- package/dist/routing/hooks/hooks.next.d.ts +2 -0
- package/dist/routing/hooks/hooks.next.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts +2 -0
- package/dist/routing/hooks/hooks.vite.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/useLocation.next.d.ts +12 -0
- package/dist/routing/hooks/useLocation.next.d.ts.map +1 -1
- package/dist/routing/hooks/useLocation.next.js +17 -4
- package/dist/routing/hooks/useMatch.next.d.ts +6 -0
- package/dist/routing/hooks/useMatch.next.d.ts.map +1 -1
- package/dist/routing/hooks/useMatch.next.js +8 -2
- package/dist/routing/hooks/useNavigate.next.d.ts +6 -1
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +13 -4
- package/dist/routing/hooks/useNavigate.vite.d.ts +7 -1
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +20 -4
- package/dist/routing/hooks/useRedirectGuard.next.d.ts +3 -1
- package/dist/routing/hooks/useRedirectGuard.next.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.next.js +18 -10
- package/dist/routing/hooks/useRedirectGuard.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.vite.js +7 -1
- package/dist/routing/hooks/useRoutePath.next.d.ts +23 -0
- package/dist/routing/hooks/useRoutePath.next.d.ts.map +1 -0
- package/dist/routing/hooks/useRoutePath.next.js +36 -0
- package/dist/routing/hooks/useRoutePath.vite.d.ts +13 -0
- package/dist/routing/hooks/useRoutePath.vite.d.ts.map +1 -0
- package/dist/routing/hooks/useRoutePath.vite.js +25 -0
- package/dist/routing/hooks/useUrlLanguage.next.d.ts +28 -0
- package/dist/routing/hooks/useUrlLanguage.next.d.ts.map +1 -0
- package/dist/routing/hooks/useUrlLanguage.next.js +50 -0
- package/dist/routing/hooks/useUrlLanguage.vite.d.ts +22 -0
- package/dist/routing/hooks/useUrlLanguage.vite.d.ts.map +1 -0
- package/dist/routing/hooks/useUrlLanguage.vite.js +41 -0
- package/dist/routing/index.d.ts +3 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +2 -1
- package/dist/routing/parentRoute.d.ts +27 -0
- package/dist/routing/parentRoute.d.ts.map +1 -0
- package/dist/routing/parentRoute.js +43 -0
- package/dist/routing/useNavigation.d.ts.map +1 -1
- package/dist/routing/useNavigation.js +8 -27
- package/dist/routing/useRouteDiscovery.d.ts +2 -2
- package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
- package/dist/routing/useRouteDiscovery.js +6 -5
- package/dist/styles/index.css +781 -192
- package/dist/symbol-index.json +1 -1
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -0
- package/dist/utils/useDeleteAccountSafe.d.ts +17 -0
- package/dist/utils/useDeleteAccountSafe.d.ts.map +1 -0
- package/dist/utils/useDeleteAccountSafe.js +52 -0
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -0
- package/dist/utils/useSeo.d.ts +10 -2
- package/dist/utils/useSeo.d.ts.map +1 -1
- package/dist/utils/useSeo.js +44 -9
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +37 -4
- package/guidelines/COMPONENTS.md +2 -1
- package/guidelines/GOTCHAS.md +2 -0
- package/guidelines/LAYOUTS.md +4 -0
- package/guidelines/PAGES.md +30 -3
- package/guidelines/ROUTING.md +29 -0
- package/guidelines/SEO.md +52 -0
- package/package.json +9 -9
- package/dist/CookieConsent-5NH5DNTP.js +0 -1
- package/dist/CookieConsent-W7UE647Y.js +0 -1
- package/dist/chunk-DRFM6WXH.js +0 -1
- package/dist/chunk-MIPTBUWY.js +0 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts +0 -57
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts.map +0 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.js +0 -182
package/dist/utils/useSeo.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useAppConfig } from '@donotdev/core';
|
|
3
|
+
import { buildProductJsonLd, deriveEntitySeo, getPlatformEnvVar, useAppConfig, useTranslation, } from '@donotdev/core';
|
|
4
|
+
// Platform-specific hooks via conditional exports
|
|
5
|
+
import { useLocalizedPath, useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
4
6
|
import { HeadTags } from '../internal/layout/components/HeadTags';
|
|
7
|
+
/** Root-relative URLs → absolute (link-preview crawlers and JSON-LD need absolute URLs). */
|
|
8
|
+
function absoluteUrl(url, baseUrl) {
|
|
9
|
+
return url.startsWith('/') && baseUrl ? `${baseUrl}${url}` : url;
|
|
10
|
+
}
|
|
5
11
|
/**
|
|
6
12
|
* Dynamic SEO component
|
|
7
13
|
*
|
|
@@ -43,23 +49,52 @@ import { HeadTags } from '../internal/layout/components/HeadTags';
|
|
|
43
49
|
* />
|
|
44
50
|
* ```
|
|
45
51
|
*/
|
|
46
|
-
export function Seo({ title, fullTitle, description, image, type = 'website', keywords, noindex, canonicalUrl, publishDate, modifiedDate, }) {
|
|
52
|
+
export function Seo({ title, fullTitle, description, image, type = 'website', keywords, noindex, canonicalUrl, publishDate, modifiedDate, entity, data, }) {
|
|
47
53
|
const siteName = useAppConfig('name') || '';
|
|
54
|
+
const pathname = useRoutePath();
|
|
55
|
+
const localize = useLocalizedPath();
|
|
56
|
+
const baseUrl = getPlatformEnvVar('APP_URL') || '';
|
|
57
|
+
// Entity-derived identity (card text, entity namespace then crud); explicit props win
|
|
58
|
+
const { t, language } = useTranslation(entity ? [entity.namespace, 'crud'] : undefined);
|
|
59
|
+
const derived = entity && data ? deriveEntitySeo(entity, data, { t, locale: language }) : null;
|
|
60
|
+
const pageTitle = title ?? derived?.title;
|
|
61
|
+
const pageDescription = description ?? derived?.description;
|
|
62
|
+
const pageImage = image ?? derived?.image;
|
|
63
|
+
const absoluteImage = pageImage ? absoluteUrl(pageImage, baseUrl) : undefined;
|
|
64
|
+
// This page in this language (`/en/x`; `/x` for the default language)
|
|
65
|
+
const pageUrl = canonicalUrl ?? `${baseUrl}${localize(pathname)}`;
|
|
48
66
|
// Resolve final title
|
|
49
67
|
const resolvedTitle = fullTitle
|
|
50
68
|
? fullTitle
|
|
51
|
-
:
|
|
52
|
-
? `${
|
|
69
|
+
: pageTitle
|
|
70
|
+
? `${pageTitle} | ${siteName}`
|
|
53
71
|
: siteName;
|
|
72
|
+
const productJsonLd = type === 'product'
|
|
73
|
+
? buildProductJsonLd({
|
|
74
|
+
title: pageTitle ?? undefined,
|
|
75
|
+
description: pageDescription ?? undefined,
|
|
76
|
+
image: absoluteImage,
|
|
77
|
+
images: absoluteImage
|
|
78
|
+
? [
|
|
79
|
+
absoluteImage,
|
|
80
|
+
...(derived?.images ?? [])
|
|
81
|
+
.map((url) => absoluteUrl(url, baseUrl))
|
|
82
|
+
.filter((url) => url !== absoluteImage),
|
|
83
|
+
]
|
|
84
|
+
: [],
|
|
85
|
+
price: derived?.price,
|
|
86
|
+
availability: derived?.availability,
|
|
87
|
+
}, pageUrl)
|
|
88
|
+
: null;
|
|
54
89
|
// Build meta tags array for cleaner rendering
|
|
55
90
|
const metaTags = [];
|
|
56
91
|
// Description
|
|
57
|
-
if (
|
|
58
|
-
metaTags.push(_jsx("meta", { name: "description", content:
|
|
92
|
+
if (pageDescription) {
|
|
93
|
+
metaTags.push(_jsx("meta", { name: "description", content: pageDescription }, "description"), _jsx("meta", { property: "og:description", content: pageDescription }, "og:description"), _jsx("meta", { name: "twitter:description", content: pageDescription }, "twitter:description"));
|
|
59
94
|
}
|
|
60
95
|
// Image
|
|
61
|
-
if (
|
|
62
|
-
metaTags.push(_jsx("meta", { property: "og:image", content:
|
|
96
|
+
if (absoluteImage) {
|
|
97
|
+
metaTags.push(_jsx("meta", { property: "og:image", content: absoluteImage }, "og:image"), _jsx("meta", { name: "twitter:image", content: absoluteImage }, "twitter:image"), _jsx("meta", { name: "twitter:card", content: "summary_large_image" }, "twitter:card"));
|
|
63
98
|
}
|
|
64
99
|
// Type
|
|
65
100
|
if (type) {
|
|
@@ -87,7 +122,7 @@ export function Seo({ title, fullTitle, description, image, type = 'website', ke
|
|
|
87
122
|
}
|
|
88
123
|
// OG/Twitter title
|
|
89
124
|
metaTags.push(_jsx("meta", { property: "og:title", content: resolvedTitle }, "og:title"), _jsx("meta", { name: "twitter:title", content: resolvedTitle }, "twitter:title"));
|
|
90
|
-
return (_jsxs(HeadTags, { children: [_jsx("title", { children: resolvedTitle }), canonicalUrl && _jsx("link", { rel: "canonical", href: canonicalUrl }), metaTags] }));
|
|
125
|
+
return (_jsxs(HeadTags, { children: [_jsx("title", { children: resolvedTitle }), canonicalUrl && _jsx("link", { rel: "canonical", href: canonicalUrl }), metaTags, productJsonLd && (_jsx("script", { type: "application/ld+json", children: JSON.stringify(productJsonLd) }))] }));
|
|
91
126
|
}
|
|
92
127
|
/**
|
|
93
128
|
* Hook version for those who prefer hooks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRoutes.d.ts","sourceRoot":"","sources":["../../src/vite-routing/AppRoutes.tsx"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,aAAa,EAAkC,MAAM,OAAO,CAAC;AAK3E,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"AppRoutes.d.ts","sourceRoot":"","sources":["../../src/vite-routing/AppRoutes.tsx"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,aAAa,EAAkC,MAAM,OAAO,CAAC;AAK3E,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAY3E,yEAAyE;AACzE,KAAK,oBAAoB,GACrB,CAAC,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC,GAC3C,MAAM,CAAC;AAmKX;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CAChC;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,oBAAoB,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,UAAU,sBAAsB;IAC9B,4CAA4C;IAC5C,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,yCAsF9D"}
|
|
@@ -49,9 +49,10 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
49
49
|
import { lazy, Suspense, useLayoutEffect } from 'react';
|
|
50
50
|
import { createBrowserRouter } from 'react-router-dom';
|
|
51
51
|
import { Spinner } from '@donotdev/components';
|
|
52
|
-
import { useLayout } from '@donotdev/core';
|
|
52
|
+
import { applyFirstVisitLanguage, getLanguageRouting, splitLanguagePath, useLayout, } from '@donotdev/core';
|
|
53
53
|
import { RootLayout } from './RootLayout';
|
|
54
54
|
import { AuthGuard } from '../routing/AuthGuard';
|
|
55
|
+
import { SignedInRedirect } from '../routing/SignedInRedirect';
|
|
55
56
|
// Cache lazy components to prevent recreation and infinite loops
|
|
56
57
|
const lazyComponentCache = new Map();
|
|
57
58
|
/**
|
|
@@ -105,6 +106,20 @@ function getRouteHideBreadcrumbs(meta) {
|
|
|
105
106
|
}
|
|
106
107
|
return undefined;
|
|
107
108
|
}
|
|
109
|
+
/** Extract signedInRedirect (PageMeta) from route meta */
|
|
110
|
+
function getRouteSignedInRedirect(meta) {
|
|
111
|
+
if (meta && typeof meta === 'object' && 'signedInRedirect' in meta) {
|
|
112
|
+
const to = meta.signedInRedirect;
|
|
113
|
+
return typeof to === 'string' ? to : undefined;
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
/** Route page, inside SignedInRedirect when its PageMeta sets `signedInRedirect` */
|
|
118
|
+
function routePage(route) {
|
|
119
|
+
const page = _jsx(LazyRoute, { component: route.component, path: route.path });
|
|
120
|
+
const to = getRouteSignedInRedirect(route.meta);
|
|
121
|
+
return to ? _jsx(SignedInRedirect, { to: to, children: page }) : page;
|
|
122
|
+
}
|
|
108
123
|
/**
|
|
109
124
|
* LayoutRoute - Per-route preset switcher
|
|
110
125
|
*
|
|
@@ -196,6 +211,7 @@ function parseAuthConfig(auth) {
|
|
|
196
211
|
*/
|
|
197
212
|
export function createAppRouter(options) {
|
|
198
213
|
const { routeGroups, basename, layout } = options;
|
|
214
|
+
const routerBasename = languageBasename(basename);
|
|
199
215
|
// Find HomePage route (path "/")
|
|
200
216
|
const allRoutes = routeGroups.flatMap((group) => group.routes);
|
|
201
217
|
const homePageRoute = allRoutes.find((route) => route.path === '/');
|
|
@@ -225,7 +241,7 @@ export function createAppRouter(options) {
|
|
|
225
241
|
console.warn('[DoNotDev] HomePage has auth config but the index route is always public. ' +
|
|
226
242
|
'Auth config on HomePage is ignored. Use a different page as your protected entry point.');
|
|
227
243
|
}
|
|
228
|
-
return (_jsx(LayoutRoute, { preset: getRoutePreset(homePageRoute.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(homePageRoute.meta), children:
|
|
244
|
+
return (_jsx(LayoutRoute, { preset: getRoutePreset(homePageRoute.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(homePageRoute.meta), children: routePage(homePageRoute) }));
|
|
229
245
|
})(),
|
|
230
246
|
},
|
|
231
247
|
/** All other routes are discovered and rendered here */
|
|
@@ -233,7 +249,7 @@ export function createAppRouter(options) {
|
|
|
233
249
|
.filter((route) => route.path !== '/')
|
|
234
250
|
.map((route) => ({
|
|
235
251
|
path: route.path.startsWith('/') ? route.path.slice(1) : route.path,
|
|
236
|
-
element: route.parsedAuth === false ? (_jsx(LayoutRoute, { preset: getRoutePreset(route.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(route.meta), children:
|
|
252
|
+
element: route.parsedAuth === false ? (_jsx(LayoutRoute, { preset: getRoutePreset(route.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(route.meta), children: routePage(route) })) : (_jsx(LayoutRoute, { preset: getRoutePreset(route.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(route.meta), children: _jsx(AuthGuard, { auth: route.parsedAuth, children: routePage(route) }) })),
|
|
237
253
|
})),
|
|
238
254
|
// 404 catch-all route (must be last)
|
|
239
255
|
{
|
|
@@ -244,5 +260,22 @@ export function createAppRouter(options) {
|
|
|
244
260
|
},
|
|
245
261
|
];
|
|
246
262
|
// Create and return router instance
|
|
247
|
-
return createBrowserRouter(routeConfig, { basename });
|
|
263
|
+
return createBrowserRouter(routeConfig, { basename: routerBasename });
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Router basename for the URL's language: `/en` on `/en/…` (other languages live under
|
|
267
|
+
* their prefix, the default language at the root), so routes, links and useLocation
|
|
268
|
+
* work with app paths. A first visit to an unprefixed URL moves to the visitor's
|
|
269
|
+
* language first (same rule as the Next proxy). One language: the basename unchanged.
|
|
270
|
+
*
|
|
271
|
+
* @param basename - App basename, if the app is not served at the domain root
|
|
272
|
+
*/
|
|
273
|
+
function languageBasename(basename) {
|
|
274
|
+
const routing = getLanguageRouting();
|
|
275
|
+
applyFirstVisitLanguage(routing.languages, routing.defaultLanguage);
|
|
276
|
+
const appBase = basename ?? '';
|
|
277
|
+
const { language, prefixed } = splitLanguagePath(window.location.pathname.slice(appBase.length) || '/', routing);
|
|
278
|
+
if (!prefixed)
|
|
279
|
+
return basename;
|
|
280
|
+
return `${appBase}/${language}`;
|
|
248
281
|
}
|
package/guidelines/COMPONENTS.md
CHANGED
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
- **useBack** - Navigate back in history.
|
|
77
77
|
- **useRefresh** - Refresh current route.
|
|
78
78
|
- **usePrefetch** - Prefetch route data.
|
|
79
|
-
- **useLocation** - Get current location.
|
|
79
|
+
- **useLocation** - Get current location (reads the query string).
|
|
80
|
+
- **useRoutePath** - Current route path only (safe in cached Next pages).
|
|
80
81
|
- **useParams** - Get route parameters.
|
|
81
82
|
- **useSearchParams** - Get URL search parameters. Returns `URLSearchParams` directly (NOT a tuple). Use `.get('key')` to read values.
|
|
82
83
|
- **useMatch** - Match current route pattern.
|
package/guidelines/GOTCHAS.md
CHANGED
|
@@ -6,6 +6,8 @@ Common mistakes related to routing, styling, layouts, and UI components.
|
|
|
6
6
|
|
|
7
7
|
## Routing [Phase 1, 3]
|
|
8
8
|
|
|
9
|
+
**GOTCHA: PageMeta must be plain text — no DRY variables.** Export `meta` as a self-contained object literal, with configuration values inline (`namespace: 'brands'`, `route: '/marques'`, `auth: { required: true, role: 'admin' }`). Never replace them with imported/shared constants such as `auth: ADMIN_ONLY`, object spreads or helper calls. Discovery parses source text without resolving imports: an unresolved reference silently drops the entire metadata object, losing custom routes AND auth guards. JSX icons are explicitly supported. See PAGES for the complete rule and examples.
|
|
10
|
+
|
|
9
11
|
**Never import from `react-router-dom` - use framework routing.**
|
|
10
12
|
|
|
11
13
|
```tsx
|
package/guidelines/LAYOUTS.md
CHANGED
|
@@ -159,6 +159,8 @@ const customPresets: Record<string, PresetConfig> = {
|
|
|
159
159
|
};
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
+
**No footer, no reserved space.** When no `<footer>` is rendered (preset `footer: null`, or `app.footer: null` in AppConfig), the layout drops the footer row: the main area runs to the bottom of the screen. `app.footer: null` also hides the copyright and legal links where a preset shows them elsewhere (the `moolti` sidebar).
|
|
163
|
+
|
|
162
164
|
### CSS variables for custom presets
|
|
163
165
|
|
|
164
166
|
**Add CSS variables in `src/themes.css`:**
|
|
@@ -246,6 +248,8 @@ footerMode: 'fixed',
|
|
|
246
248
|
footerMode: 'scroll',
|
|
247
249
|
```
|
|
248
250
|
|
|
251
|
+
A footer inside `main` (`scroll`, or a `<footer>` rendered after the page) keeps its own height and sits at the bottom of the screen on a short page: only the page grows (the first child of `main`, or the one after the breadcrumbs). While a page inside a `<Suspense>` streams in, `main` stays empty above the footer, so nothing moves when it arrives.
|
|
252
|
+
|
|
249
253
|
Set `footerMode` in your preset config or in the `layout` prop:
|
|
250
254
|
```tsx
|
|
251
255
|
<ViteAppProviders
|
package/guidelines/PAGES.md
CHANGED
|
@@ -12,6 +12,26 @@ Files must be named `*Page.tsx` (e.g., `HomePage.tsx`, `AboutPage.tsx`, `BlogPos
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## PageMeta: Plain Text, No DRY Variables
|
|
16
|
+
|
|
17
|
+
**`export const meta: PageMeta = { ... };` must be a self-contained object literal.** Discovery reads source text; it does not import or execute the page module. Keep strings, booleans, arrays and nested objects inline. Do not extract metadata into shared constants, imported objects, spreads, helper calls or computed values. This includes `namespace`, `route` and `auth`: intentional duplication is required here. JSX navigation icons such as `icon: <Tags />` are explicitly supported.
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
// WRONG: discovery cannot resolve the imported/shared object.
|
|
21
|
+
export const meta: PageMeta = { route: '/marques', auth: ADMIN_ONLY };
|
|
22
|
+
|
|
23
|
+
// CORRECT: all configuration is readable directly in the source.
|
|
24
|
+
export const meta: PageMeta = {
|
|
25
|
+
namespace: 'brands',
|
|
26
|
+
route: '/marques',
|
|
27
|
+
auth: { required: true, role: 'admin' },
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**An unresolved variable can discard the entire metadata object**, not just that field: custom URLs disappear, filename-derived routes replace them, and route auth defaults to public. A successful TypeScript check does not verify build-time metadata extraction.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
15
35
|
## Standard Use
|
|
16
36
|
|
|
17
37
|
**Pattern:** `src/pages/**/*Page.tsx` - routes
|
|
@@ -24,7 +44,7 @@ import { PageContainer } from '@donotdev/ui';
|
|
|
24
44
|
export const NAMESPACE = 'about';
|
|
25
45
|
|
|
26
46
|
export const meta: PageMeta = {
|
|
27
|
-
namespace:
|
|
47
|
+
namespace: 'about',
|
|
28
48
|
};
|
|
29
49
|
|
|
30
50
|
export default function AboutPage() {
|
|
@@ -62,8 +82,8 @@ export default function HomePage() {
|
|
|
62
82
|
|
|
63
83
|
```tsx
|
|
64
84
|
export const meta: PageMeta = {
|
|
65
|
-
// Translation/SEO namespace
|
|
66
|
-
namespace:
|
|
85
|
+
// Translation/SEO namespace (inline literal, not a shared constant)
|
|
86
|
+
namespace: 'about',
|
|
67
87
|
|
|
68
88
|
// Route configuration
|
|
69
89
|
route: '/custom-url', // Override auto-generated path
|
|
@@ -90,9 +110,16 @@ export const meta: PageMeta = {
|
|
|
90
110
|
required: true,
|
|
91
111
|
validate: (role, tier) => role === 'admin' && tier === 'pro'
|
|
92
112
|
}, // Custom validation
|
|
113
|
+
|
|
114
|
+
// Signed-in visitors go elsewhere (e.g. landing → catalogue)
|
|
115
|
+
signedInRedirect: '/catalogue', // Next + Supabase cookie: proxy redirects (verified session) before render; else client replace
|
|
93
116
|
};
|
|
94
117
|
```
|
|
95
118
|
|
|
119
|
+
**`signedInRedirect`** sends signed-in visitors of the page to an app path. With a server-readable session (Next + Supabase `createBrowserClient`) the generated proxy verifies (and refreshes) the session, then redirects before render, so the page never flashes; an expired session whose refresh fails counts as signed out (see AUTH guideline, generated proxy); every app also wraps the page in `SignedInRedirect`, which navigates once the user is known (sign-in on the page, unreadable cookie). A pending return-to (`?returnTo=` or the saved `dndev.auth.returnTo`) skips it. The path must start with `/` and differ from the page's own path (build error otherwise).
|
|
120
|
+
|
|
121
|
+
**Route `auth` needs auth enabled.** With `AppConfig.auth: false` there are no auth routes to redirect to: a route whose `auth` check fails throws a config error in the redirect guard instead of redirecting. Enable `auth` in `AppConfig`, or remove the route's `auth`.
|
|
122
|
+
|
|
96
123
|
**Reference implementation:** The demo app (`packages/cli/templates/app-demo/`) shows all these patterns working together - landing, admin, docs presets, auth, showcase, CRUD, legal pages.
|
|
97
124
|
|
|
98
125
|
---
|
package/guidelines/ROUTING.md
CHANGED
|
@@ -51,6 +51,7 @@ import { Link, DnDevNavigationMenu } from '@donotdev/ui';
|
|
|
51
51
|
import {
|
|
52
52
|
useNavigate,
|
|
53
53
|
useLocation,
|
|
54
|
+
useRoutePath,
|
|
54
55
|
useParams,
|
|
55
56
|
useRouteParam,
|
|
56
57
|
useSearchParams,
|
|
@@ -58,6 +59,31 @@ import {
|
|
|
58
59
|
} from '@donotdev/ui';
|
|
59
60
|
```
|
|
60
61
|
|
|
62
|
+
**Path only? `useRoutePath()`.** It returns the route path (no language prefix) without reading the query string. On Next, pages are cached (static): reading the query (`useSearchParams`, `useLocation().search`) renders that page in the browser instead of the cached HTML. Read the query only where it is needed, in a small component inside its own `<Suspense>`: generated Next pages have no page-wide boundary (it would delay the whole page past the first paint), and `next build` fails on a query read with no boundary around it.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## NotFoundPage: static fallback and translation compatibility
|
|
67
|
+
|
|
68
|
+
`<NotFoundPage />` still displays the current route path by default. Set
|
|
69
|
+
`showRequestedPath={false}` for a cached/shared fallback: its build-time pathname
|
|
70
|
+
is not the URL of a later request. Framework-generated Next not-found and global
|
|
71
|
+
not-found wrappers opt into this generic, badge-free content. This prop hides only
|
|
72
|
+
the path badge; translated labels, route suggestions and Home/Back actions remain
|
|
73
|
+
server-renderable. It does not disable SSR or defer navigation until mount.
|
|
74
|
+
|
|
75
|
+
The canonical translation text is `dndev:messages.notFound.*`. Framework eager
|
|
76
|
+
locales expose `errors.notFound.{title,description,suggestions,navigateTo,goHome,goBack}`
|
|
77
|
+
as explicit i18next `$t(messages.notFound.<key>)` compatibility references, not
|
|
78
|
+
copies. The component keeps its legacy `errors.notFound.*` lookups so existing
|
|
79
|
+
consumer overrides continue to work. Consumer locale resources are deep-merged
|
|
80
|
+
over framework resources: a legacy override wins for that field; otherwise its
|
|
81
|
+
reference resolves the canonical value, including a consumer canonical override.
|
|
82
|
+
If both families override the same field, the legacy override wins. Prefer
|
|
83
|
+
`messages.notFound.*` for new overrides; remove an old field override when migrating
|
|
84
|
+
it to canonical. `navigateTo` interpolates `{{label}}`. Existing English component
|
|
85
|
+
defaults remain for missing resources; there is no runtime key-family fallback chain.
|
|
86
|
+
|
|
61
87
|
---
|
|
62
88
|
|
|
63
89
|
## Navigation Patterns
|
|
@@ -172,6 +198,8 @@ function CustomSidebar() {
|
|
|
172
198
|
}
|
|
173
199
|
```
|
|
174
200
|
|
|
201
|
+
**SSR snapshot ownership:** `useNavigationItems()` and `useAccessibleNavigationRoutes()` subscribe to route data and update when either routes or auth change. For lower-level render derivation, select `state.cache.allRoutes` and call the pure `filterNavigationRoutes(routes, authState)` exported by `@donotdev/core` outside the store selector. Do not invoke `state.getFilteredRoutes()` inside a render selector: imperative getters read live state rather than the hydration snapshot. Existing imperative getters remain supported for event-time reads.
|
|
202
|
+
|
|
175
203
|
**DON'T manually build navigation:**
|
|
176
204
|
```tsx
|
|
177
205
|
import { Link } from 'react-router-dom'; // BREAKS FRAMEWORK
|
|
@@ -454,6 +482,7 @@ import {
|
|
|
454
482
|
Link,
|
|
455
483
|
useNavigate,
|
|
456
484
|
useLocation,
|
|
485
|
+
useRoutePath,
|
|
457
486
|
useParams,
|
|
458
487
|
useRouteParam,
|
|
459
488
|
useSearchParams,
|
package/guidelines/SEO.md
CHANGED
|
@@ -30,6 +30,19 @@
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
+
## Languages: One URL Each
|
|
34
|
+
|
|
35
|
+
With 2+ languages every page has one URL per language (default language at the root, others
|
|
36
|
+
under `/<lang>`, see core `I18N.md`). Automatic:
|
|
37
|
+
|
|
38
|
+
- **Canonical / `og:url` / JSON-LD `url`:** the page in its own language (`/en/x` on the English page).
|
|
39
|
+
- **`hreflang`:** one `<link rel="alternate">` per language plus `x-default` (the root URL).
|
|
40
|
+
- **Sitemap (Next `src/app/sitemap.xml/route.next.ts`):** every language's URL of each page, each entry with `alternates.languages`.
|
|
41
|
+
|
|
42
|
+
One language: unprefixed URLs, no `hreflang`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
33
46
|
## Vite: Prerendering
|
|
34
47
|
|
|
35
48
|
**Enabled by default** in `vite.config.ts`:
|
|
@@ -199,6 +212,45 @@ export default function ApartmentPage() {
|
|
|
199
212
|
|
|
200
213
|
**Works in SSR/prerender** - meta tags are in initial HTML.
|
|
201
214
|
|
|
215
|
+
### Entity-derived: `<Seo entity data>`
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
<Seo entity={apartmentEntity} data={apartment} type="product" />
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
`deriveEntitySeo` (`@donotdev/core`) builds the identity; explicit props win.
|
|
222
|
+
|
|
223
|
+
- **title:** `listCardFields.title` texts, formatted exactly like the CRUD card (`formatFieldText`: select labels, numbers in the locale, `displayKey`, `displayValue`), joined with `titleSeparator`; empty fields dropped. No slot layout: first `text` field.
|
|
224
|
+
- **description:** first long-text field with a value (textarea/richtext, HTML stripped), else the card subtitle texts then content texts (joined ` · `). Max 160 chars.
|
|
225
|
+
- **JSON-LD (`type="product"`):** `offers` when a price/currency field is positive; `offers.availability` from the record `status`: `available` → `https://schema.org/InStock`, other statuses only when mapped (unmapped → no `availability`). Needs `status` in the record the page renders, so a guest-visible `status` field: the base `status` field is `visibility: 'admin'`, so guests (crawlers) get no `availability` unless the entity declares its own `status` with `visibility: 'guest'`. Availability that depends on private data (e.g. stock shown to professionals only) is not emitted: leave it unmapped.
|
|
226
|
+
- **Overrides:** entity `seo` option.
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
defineEntity({
|
|
230
|
+
// ...
|
|
231
|
+
seo: {
|
|
232
|
+
title: (item, t) => t('seo.title', { size: item.size }), // null → no title
|
|
233
|
+
description: (item, t) => null, // null → no description
|
|
234
|
+
availability: { promoted: 'InStock', reserved: 'SoldOut', signed: 'SoldOut' },
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`t` is the entity namespace, then `crud`, in the page language (llms.txt: app default language). Custom field types (`registerFieldType`) are not known to core: their text is the raw value (also on the server, where the CRUD registry is not loaded). Use the field's `options.displayValue` (shared by card and SEO) or `seo.title`.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Sitemap & llms.txt: One URL Set
|
|
244
|
+
|
|
245
|
+
Both list the same pages, generated from `src/pages` - no app code:
|
|
246
|
+
|
|
247
|
+
- **In:** public static routes, plus one URL per public record (`status` not in `HIDDEN_STATUSES`: any status except `draft`/`deleted`) of each single-param route's entity (`/produits/:slug` → `meta.entity` collection). Never a `:param` template.
|
|
248
|
+
- **Out:** `auth.required` routes and `seo: { noindex: true }` routes.
|
|
249
|
+
- **URLs:** absolute, from `seo.baseUrl` or `NEXT_PUBLIC_APP_URL` / `VITE_APP_URL`. A production build with a localhost URL fails.
|
|
250
|
+
- **llms.txt labels (app default language):** page = namespace `title` → `seo.title` → namespace `meta.fullTitle` → `seo.fullTitle` (a static page with none fails the build); entity record = `deriveEntitySeo` title/description (same as `<Seo entity data>`); entity section = `namePlural` of its `entity-*` translations.
|
|
251
|
+
- **Next:** `src/app/sitemap.xml/route.next.ts` and `src/app/llms.txt/route.next.ts`, revalidated hourly (`appConfig.revalidate`: other lifetime in seconds, or `false` until the next deploy). Entity definitions come from the app's `entities` package.
|
|
252
|
+
- **Vite:** written at build; static pages only (same as the Vite sitemap).
|
|
253
|
+
|
|
202
254
|
---
|
|
203
255
|
|
|
204
256
|
## `<Seo>` Props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
"@tanstack/react-query-next-experimental": "5.107.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@donotdev/ai": "^0.
|
|
61
|
-
"@donotdev/auth": "^0.
|
|
62
|
-
"@donotdev/billing": "^0.
|
|
63
|
-
"@donotdev/components": "^0.
|
|
64
|
-
"@donotdev/core": "^0.
|
|
65
|
-
"@donotdev/crud": "^0.
|
|
66
|
-
"@donotdev/oauth": "^0.
|
|
60
|
+
"@donotdev/ai": "^0.3.0",
|
|
61
|
+
"@donotdev/auth": "^0.3.0",
|
|
62
|
+
"@donotdev/billing": "^0.3.0",
|
|
63
|
+
"@donotdev/components": "^0.3.0",
|
|
64
|
+
"@donotdev/core": "^0.3.0",
|
|
65
|
+
"@donotdev/crud": "^0.3.0",
|
|
66
|
+
"@donotdev/oauth": "^0.3.0",
|
|
67
67
|
"@hookform/resolvers": "^5.9.2",
|
|
68
68
|
"lucide-react": "^0.575.0",
|
|
69
69
|
"react": "^19.3.1",
|
|
70
70
|
"react-dom": "^19.3.1",
|
|
71
71
|
"react-helmet-async": "^2.0.5",
|
|
72
|
-
"react-hook-form": "^7.
|
|
72
|
+
"react-hook-form": "^7.92.0",
|
|
73
73
|
"react-router-dom": "^7.18.5",
|
|
74
74
|
"valibot": "^1.5.0"
|
|
75
75
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-O2XFH626.js";import{Cookie as T,Settings as j,Shield as F,BarChart3 as _,Target as W}from"lucide-react";import{useState as w,useEffect as v,useRef as G}from"react";import{Accordion as K,Button as p,BUTTON_VARIANT as m,Card as V,Switch as q,Text as f,cn as X,Stack as a}from"@donotdev/components";import{handleError as $,useConsent as d,getCookieExamples as y,hasOptionalCookies as J}from"@donotdev/core";import{CONSENT_CATEGORY as l}from"@donotdev/core";import{useTranslation as Q}from"@donotdev/core";import{isClient as Z}from"@donotdev/core";import{Fragment as oe,jsx as o,jsxs as s}from"react/jsx-runtime";var ee=480;function te({position:N="bottom",className:O=""}){let r=d("hasConsented"),u=d("categories"),S=d("acceptAll"),D=d("declineAll"),B=d("updateCategory"),g=d("showBanner"),{t:e}=Q("cookies"),[k,E]=w(!1),[C,c]=w(!r||g),[A,b]=w(u),x=G(null);v(()=>{g&&c(!0)},[g]);let I=Object.keys(u),L=[{id:l.NECESSARY,icon:F,title:e("essentialCookies"),description:e("essentialDescription"),examples:y("necessary")||e("essentialExamples"),locked:!0},{id:l.FUNCTIONAL,icon:T,title:e("functionalCookies"),description:e("functionalDescription"),examples:y("functional")||e("functionalExamples"),legalNotice:e("functionalLegalNotice"),locked:!1},{id:l.ANALYTICS,icon:_,title:e("analyticsCookies"),description:e("analyticsDescription"),examples:y("analytics")||e("analyticsExamples"),locked:!1},{id:l.MARKETING,icon:W,title:e("marketingCookies"),description:e("marketingDescription"),examples:y("marketing")||e("marketingExamples"),locked:!1}].filter(t=>I.includes(t.id)),h=J();if(v(()=>{!r&&!h&&S()},[r,h,S]),v(()=>{let t={...u};if(k){let n=t;Object.keys(n).forEach(i=>{i!==l.NECESSARY&&n[i]===!1&&(n[i]=!0)})}b(t)},[u,k]),v(()=>{if(!Z()||r||!C)return;let t=i=>{x.current&&!x.current.contains(i.target)&&c(!1)},n=setTimeout(()=>{document.addEventListener("mousedown",t)},100);return()=>{clearTimeout(n),document.removeEventListener("mousedown",t)}},[r,C]),r&&!g)return null;let P=()=>{try{Object.entries(A).forEach(([t,n])=>{if(t!==l.NECESSARY&&n!==void 0){let i=t;Object.values(l).includes(i)&&B(i,!!n)}}),E(!1),c(!1)}catch(t){$(t,{userMessage:"Error saving preferences",context:{operation:"save_preferences"},severity:"warning",log:!0,reportToSentry:!1,showNotification:!1})}},R=()=>{S(),c(!1)},U=()=>{D(),c(!1)},z=s(a,{gap:"medium",children:[o(f,{as:"p",variant:"muted",level:"small",style:{lineHeight:1.55},children:e("cookieBannerDescription")}),h&&o(K,{type:"single",collapsible:!0,value:k?"preferences":"",onValueChange:t=>E(t==="preferences"),items:[{value:"preferences",trigger:s(a,{direction:"row",align:"center",gap:"tight",children:[o(j,{className:"dndev-size-sm"}),o(f,{as:"span",level:"small",weight:"medium",children:e("customize")})]}),content:o(a,{gap:"tight",children:L.map(t=>{let n=t.icon,i=A[t.id]??!1;return s(a,{direction:"row",align:"start",justify:"between",gap:"medium",style:{padding:"0.75rem",borderRadius:"var(--radius-surface, 0.5rem)",background:"var(--muted)"},children:[s(a,{direction:"row",align:"start",gap:"tight",style:{flex:1,minWidth:0},children:[o(n,{className:"dndev-size-sm",style:{color:"var(--primary)",marginTop:"0.15rem",flexShrink:0}}),s(a,{gap:"none",style:{minWidth:0},children:[o(f,{as:"span",level:"small",weight:"semibold",children:t.title}),o(f,{as:"span",variant:"muted",level:"caption",style:{lineHeight:1.45},children:t.description})]})]}),t.locked?o(f,{as:"span",variant:"muted",level:"caption",weight:"medium",style:{flexShrink:0},children:e("alwaysOn")}):o(q,{checked:i,onCheckedChange:M=>b(Y=>({...Y,[t.id]:M}))})]},t.id)})})}]})]}),H=k?s(a,{direction:"row",gap:"tight",style:{width:"100%"},children:[o(p,{onClick:()=>E(!1),variant:m.OUTLINE,style:{flex:1},children:e("form.cancel","Cancel")}),o(p,{onClick:P,variant:m.DEFAULT,style:{flex:1},children:e("savePreferences","Save Preferences")})]}):s(a,{direction:"row",gap:"tight",style:{width:"100%"},children:[h&&o(p,{onClick:U,variant:m.OUTLINE,style:{flex:1},children:e("declineOptional")}),o(p,{onClick:R,variant:m.DEFAULT,style:{flex:1},children:e("acceptAll")})]});return s(oe,{children:[C&&o(V,{ref:x,elevated:!0,icon:T,title:e("cookiePreferences"),content:z,footer:H,className:X("dndev-fixed dndev-z-modal",O),style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)",width:`min(${ee}px, calc(100vw - var(--gap-md) * 2))`,height:"auto"}}),!C&&!r&&o(p,{onClick:()=>c(!0),variant:m.OUTLINE,floating:!0,icon:T,display:"compact",tooltip:e("cookiePreferences"),"aria-label":e("cookiePreferences"),className:"dndev-fixed dndev-z-toast",style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)"}})]})}var de=te;export{de as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-O2XFH626.js";import{Cookie as w,Settings as _,Shield as W,BarChart3 as G,Target as K}from"lucide-react";import{useState as y,useEffect as p,useRef as V}from"react";import{Accordion as q,Button as m,BUTTON_VARIANT as f,Card as X,Switch as $,Text as u,cn as J,Stack as a}from"@donotdev/components";import{handleError as Q,useConsent as d,getCookieExamples as S,hasOptionalCookies as Z}from"@donotdev/core";import{CONSENT_CATEGORY as l}from"@donotdev/core";import{useTranslation as ee}from"@donotdev/core";import{isClient as te}from"@donotdev/core";import{Fragment as ie,jsx as o,jsxs as s}from"react/jsx-runtime";var oe=480;function ne({position:N="bottom",className:O=""}){let r=d("hasConsented"),g=d("categories"),E=d("acceptAll"),D=d("declineAll"),B=d("updateCategory"),k=d("showBanner"),{t:e}=ee("cookies"),[C,x]=y(!1),[h,c]=y(!r||k),[A,b]=y(g),T=V(null),[I,L]=y(!1);p(()=>L(!0),[]),p(()=>{k&&c(!0)},[k]);let P=Object.keys(g),R=[{id:l.NECESSARY,icon:W,title:e("essentialCookies"),description:e("essentialDescription"),examples:S("necessary")||e("essentialExamples"),locked:!0},{id:l.FUNCTIONAL,icon:w,title:e("functionalCookies"),description:e("functionalDescription"),examples:S("functional")||e("functionalExamples"),legalNotice:e("functionalLegalNotice"),locked:!1},{id:l.ANALYTICS,icon:G,title:e("analyticsCookies"),description:e("analyticsDescription"),examples:S("analytics")||e("analyticsExamples"),locked:!1},{id:l.MARKETING,icon:K,title:e("marketingCookies"),description:e("marketingDescription"),examples:S("marketing")||e("marketingExamples"),locked:!1}].filter(t=>P.includes(t.id)),v=Z();if(p(()=>{!r&&!v&&E()},[r,v,E]),p(()=>{let t={...g};if(C){let n=t;Object.keys(n).forEach(i=>{i!==l.NECESSARY&&n[i]===!1&&(n[i]=!0)})}b(t)},[g,C]),p(()=>{if(!te()||r||!h)return;let t=i=>{T.current&&!T.current.contains(i.target)&&c(!1)},n=setTimeout(()=>{document.addEventListener("mousedown",t)},100);return()=>{clearTimeout(n),document.removeEventListener("mousedown",t)}},[r,h]),!I||r&&!k)return null;let U=()=>{try{Object.entries(A).forEach(([t,n])=>{if(t!==l.NECESSARY&&n!==void 0){let i=t;Object.values(l).includes(i)&&B(i,!!n)}}),x(!1),c(!1)}catch(t){Q(t,{userMessage:"Error saving preferences",context:{operation:"save_preferences"},severity:"warning",log:!0,reportToSentry:!1,showNotification:!1})}},M=()=>{E(),c(!1)},z=()=>{D(),c(!1)},H=s(a,{gap:"medium",children:[o(u,{as:"p",variant:"muted",level:"small",style:{lineHeight:1.55},children:e("cookieBannerDescription")}),v&&o(q,{type:"single",collapsible:!0,value:C?"preferences":"",onValueChange:t=>x(t==="preferences"),items:[{value:"preferences",trigger:s(a,{direction:"row",align:"center",gap:"tight",children:[o(_,{className:"dndev-size-sm"}),o(u,{as:"span",level:"small",weight:"medium",children:e("customize")})]}),content:o(a,{gap:"tight",children:R.map(t=>{let n=t.icon,i=A[t.id]??!1;return s(a,{direction:"row",align:"start",justify:"between",gap:"medium",style:{padding:"0.75rem",borderRadius:"var(--radius-surface, 0.5rem)",background:"var(--muted)"},children:[s(a,{direction:"row",align:"start",gap:"tight",style:{flex:1,minWidth:0},children:[o(n,{className:"dndev-size-sm",style:{color:"var(--primary)",marginTop:"0.15rem",flexShrink:0}}),s(a,{gap:"none",style:{minWidth:0},children:[o(u,{as:"span",level:"small",weight:"semibold",children:t.title}),o(u,{as:"span",variant:"muted",level:"caption",style:{lineHeight:1.45},children:t.description})]})]}),t.locked?o(u,{as:"span",variant:"muted",level:"caption",weight:"medium",style:{flexShrink:0},children:e("alwaysOn")}):o($,{checked:i,onCheckedChange:j=>b(F=>({...F,[t.id]:j}))})]},t.id)})})}]})]}),Y=C?s(a,{direction:"row",gap:"tight",style:{width:"100%"},children:[o(m,{onClick:()=>x(!1),variant:f.OUTLINE,style:{flex:1},children:e("form.cancel","Cancel")}),o(m,{onClick:U,variant:f.DEFAULT,style:{flex:1},children:e("savePreferences","Save Preferences")})]}):s(a,{direction:"row",gap:"tight",style:{width:"100%"},children:[v&&o(m,{onClick:z,variant:f.OUTLINE,style:{flex:1},children:e("declineOptional")}),o(m,{onClick:M,variant:f.DEFAULT,style:{flex:1},children:e("acceptAll")})]});return s(ie,{children:[h&&o(X,{ref:T,elevated:!0,icon:w,title:e("cookiePreferences"),content:H,footer:Y,className:J("dndev-fixed dndev-z-modal",O),style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)",width:`min(${oe}px, calc(100vw - var(--gap-md) * 2))`,height:"auto"}}),!h&&!r&&o(m,{onClick:()=>c(!0),variant:f.OUTLINE,floating:!0,icon:w,display:"compact",tooltip:e("cookiePreferences"),"aria-label":e("cookiePreferences"),className:"dndev-fixed dndev-z-toast",style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)"}})]})}var me=ne;export{me as default};
|
package/dist/chunk-DRFM6WXH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as f from"lucide-react";import{isValidElement as b}from"react";import{cn as d}from"@donotdev/components";import{jsx as c}from"react/jsx-runtime";function x(e){if(!e)return f.Palette;let n=e.replace(/['"]/g,"");return f[n]||f.Palette}var C=({icon:e,fallback:n,className:i,ariaHidden:s=!1})=>{let o=e||n;if(!o)return null;let a="dndev-size-md";if(typeof o=="function"||typeof o=="object"&&o!==null&&"render"in o)return c(o,{className:d(a,i),style:{flexShrink:0},"aria-hidden":s});if(typeof o=="string"){if(!/^[a-zA-Z0-9_-]+$/.test(o))return c("span",{className:d(a,i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o});let p=x(o);return c(p,{className:d(a,i),style:{flexShrink:0},"aria-hidden":s})}return b(o)?c("span",{className:i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o}):c("span",{className:i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o})},D=C;import*as y from"@donotdev/auth";import{DEGRADED_AUTH_API as P}from"@donotdev/core";var m=y?.useAuth;function L(e){return P[e]}function I(e){return m?m(e):L(e)}var O=typeof m=="function",M=y?.PasswordResetCallback??(()=>null);import{useMemo as h}from"react";import{useNavigationStore as S,useTranslation as E}from"@donotdev/core";import{USER_ROLES as T}from"@donotdev/core";import{useLocation as k}from"@donotdev/ui/routing/hooks";function g(){let e=k(),n=I("user"),i=!!n,{t:s}=E(),o=n?.role||T.GUEST,a=S(r=>!r||typeof r.getFilteredRoutes!="function"?[]:r.getFilteredRoutes({authenticated:i,role:o}));return h(()=>Array.isArray(a)?a.map(r=>({...r,label:K(r,s),isActive:F(r.path,e.pathname),hasChildren:!1,children:void 0})).sort((r,l)=>r.label.localeCompare(l.label,void 0,{sensitivity:"base"})):[],[a,e.pathname,s])}function Q(e){let n=g();return h(()=>n.find(i=>i.path===e),[n,e])}function K(e,n){let i=e.meta?.namespace;return typeof i!="string"||i===""?e.label:n(`${i}:title`,{defaultValue:e.label})}function F(e,n){return e==="/"?n==="/":n===e?!0:n.startsWith(e+"/")}import{useCallback as V}from"react";import{useNavigationStore as u}from"@donotdev/core";import{useNavigate as _}from"@donotdev/ui/routing/hooks";var ne=()=>{let e=_(),n=g()??[],i=u(t=>t.favorites),s=u(t=>t.recent),o=u(t=>t.toggleFavorite),a=u(t=>t.isFavorite),r=u(t=>t.addRecent),l=n.length?n.filter(t=>i.includes(t.path)):[],p=n.length?n.filter(t=>s.includes(t.path)).slice(0,5):[],A=t=>{o(t)},N=t=>a(t),v=t=>{r(t)},R=V(t=>{v(t),e(t)},[e,v]);return{navigationItems:n,favoriteItems:l,recentItems:p,toggleFavorite:A,isFavorite:N,navigateToItem:R}};export{C as a,D as b,I as c,O as d,M as e,g as f,Q as g,ne as h};
|
package/dist/chunk-MIPTBUWY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as l from"lucide-react";import{isValidElement as x}from"react";import{cn as p}from"@donotdev/components";import{jsx as c}from"react/jsx-runtime";function C(e){if(!e)return l.Palette;let n=e.replace(/['"]/g,"");return l[n]||l.Palette}var P=({icon:e,fallback:n,className:r,ariaHidden:s=!1})=>{let o=e||n;if(!o)return null;let i="dndev-size-md";if(typeof o=="function"||typeof o=="object"&&o!==null&&"render"in o)return c(o,{className:p(i,r),style:{flexShrink:0},"aria-hidden":s});if(typeof o=="string"){if(!/^[a-zA-Z0-9_-]+$/.test(o))return c("span",{className:p(i,r),style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o});let f=C(o);return c(f,{className:p(i,r),style:{flexShrink:0},"aria-hidden":s})}return x(o)?c("span",{className:r,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o}):c("span",{className:r,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o})},D=P;import*as I from"@donotdev/auth";import{DEGRADED_AUTH_API as b}from"@donotdev/core";var d=I?.useAuth;function S(e){return b[e]}function y(e){return d?d(e):S(e)}var U=typeof d=="function",G=I?.PasswordResetCallback??(()=>null);import{useMemo as h}from"react";import{useNavigationStore as E}from"@donotdev/core";import{USER_ROLES as L}from"@donotdev/core";import{useLocation as T}from"@donotdev/ui/routing/hooks";function m(){let e=T(),n=y("user"),r=!!n,s=n?.role||L.GUEST,o=E(i=>!i||typeof i.getFilteredRoutes!="function"?[]:i.getFilteredRoutes({authenticated:r,role:s}));return h(()=>Array.isArray(o)?o.map(i=>({...i,isActive:k(i.path,e.pathname),hasChildren:!1,children:void 0})).sort((i,a)=>i.label.localeCompare(a.label,void 0,{sensitivity:"base"})):[],[o,e.pathname])}function B(e){let n=m();return h(()=>n.find(r=>r.path===e),[n,e])}function k(e,n){return e==="/"?n==="/":n===e?!0:n.startsWith(e+"/")}import{useCallback as K}from"react";import{useNavigationStore as u}from"@donotdev/core";import{useNavigate as F}from"@donotdev/ui/routing/hooks";var ee=()=>{let e=F(),n=m()??[],r=u(t=>t.favorites),s=u(t=>t.recent),o=u(t=>t.toggleFavorite),i=u(t=>t.isFavorite),a=u(t=>t.addRecent),g=n.length?n.filter(t=>r.includes(t.path)):[],f=n.length?n.filter(t=>s.includes(t.path)).slice(0,5):[],A=t=>{o(t)},N=t=>i(t),v=t=>{a(t)},R=K(t=>{v(t),e(t)},[e,v]);return{navigationItems:n,favoriteItems:g,recentItems:f,toggleFavorite:A,isFavorite:N,navigateToItem:R}};export{P as a,D as b,y as c,U as d,G as e,m as f,B as g,ee as h};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type { SeoMeta } from '@donotdev/core';
|
|
3
|
-
interface MetaTagsConfig {
|
|
4
|
-
/** Base URL for canonical links */
|
|
5
|
-
baseUrl?: string;
|
|
6
|
-
/** Site name for Open Graph */
|
|
7
|
-
siteName?: string;
|
|
8
|
-
/** Default namespace for translations */
|
|
9
|
-
defaultNamespace?: string;
|
|
10
|
-
/** Default image for social sharing */
|
|
11
|
-
defaultImage?: string;
|
|
12
|
-
/** Twitter handle (without @) */
|
|
13
|
-
twitterHandle?: string;
|
|
14
|
-
/** Default author for all pages */
|
|
15
|
-
defaultAuthor?: string;
|
|
16
|
-
/** Additional static meta tags */
|
|
17
|
-
staticTags?: Record<string, string>;
|
|
18
|
-
}
|
|
19
|
-
interface RouteMetadata {
|
|
20
|
-
ns?: string;
|
|
21
|
-
title?: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
image?: string;
|
|
24
|
-
noindex?: boolean;
|
|
25
|
-
type?: 'website' | 'article' | 'product';
|
|
26
|
-
keywords?: string[];
|
|
27
|
-
author?: string;
|
|
28
|
-
publishDate?: string;
|
|
29
|
-
modifiedDate?: string;
|
|
30
|
-
seo?: SeoMeta;
|
|
31
|
-
}
|
|
32
|
-
interface NextJsAutoMetaTagsProps {
|
|
33
|
-
/** Configuration for meta tags */
|
|
34
|
-
config?: MetaTagsConfig;
|
|
35
|
-
/** Route metadata override */
|
|
36
|
-
routeMeta?: RouteMetadata;
|
|
37
|
-
/** Override title */
|
|
38
|
-
title?: string;
|
|
39
|
-
/** Override description */
|
|
40
|
-
description?: string;
|
|
41
|
-
/** Override image */
|
|
42
|
-
image?: string;
|
|
43
|
-
/** Additional meta tags */
|
|
44
|
-
additionalTags?: Record<string, string>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Next.js-specific AutoMetaTags component
|
|
48
|
-
*
|
|
49
|
-
* Uses Next.js hooks directly instead of platform-aware hooks
|
|
50
|
-
*
|
|
51
|
-
* @version 0.1.0
|
|
52
|
-
* @since 0.0.1
|
|
53
|
-
* @author AMBROISE PARK Consulting
|
|
54
|
-
*/
|
|
55
|
-
declare const NextJsAutoMetaTags: ComponentType<NextJsAutoMetaTagsProps>;
|
|
56
|
-
export default NextJsAutoMetaTags;
|
|
57
|
-
//# sourceMappingURL=NextJsAutoMetaTags.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NextJsAutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/NextJsAutoMetaTags.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,UAAU,cAAc;IACtB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,UAAU,aAAa;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,UAAU,uBAAuB;IAC/B,kCAAkC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAkFD;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,CA6M9D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|