@donotdev/ui 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/auth/AuthHeader.js +1 -93
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +3 -286
- package/dist/components/auth/index.js +1 -9
- package/dist/components/common/FeatureCard.d.ts.map +1 -1
- package/dist/components/common/FeatureCard.js +1 -86
- package/dist/components/common/FeatureDisabled.js +1 -67
- package/dist/components/common/IconPlaceholder.d.ts +24 -0
- package/dist/components/common/IconPlaceholder.d.ts.map +1 -0
- package/dist/components/common/IconPlaceholder.js +1 -0
- package/dist/components/common/LazyLucideIcon.d.ts +39 -0
- package/dist/components/common/LazyLucideIcon.d.ts.map +1 -0
- package/dist/components/common/LazyLucideIcon.js +1 -0
- package/dist/components/common/ProgressBar.js +1 -84
- package/dist/components/common/RedirectOverlay.js +1 -243
- package/dist/components/common/Skeleton.js +1 -144
- package/dist/components/common/TechBento.d.ts.map +1 -1
- package/dist/components/common/TechBento.js +1 -53
- package/dist/components/common/icon.d.ts +1 -1
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +1 -84
- package/dist/components/common/iconByName.d.ts +33 -0
- package/dist/components/common/iconByName.d.ts.map +1 -0
- package/dist/components/common/iconByName.js +1 -0
- package/dist/components/common/index.js +1 -16
- package/dist/components/cookie-consent/ConsentBanner.d.ts +3 -1
- package/dist/components/cookie-consent/ConsentBanner.d.ts.map +1 -1
- package/dist/components/cookie-consent/ConsentBanner.js +1 -31
- package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.js +1 -183
- package/dist/components/cookie-consent/index.js +1 -11
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts +7 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts.map +1 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.js +1 -0
- package/dist/components/index.js +1 -13
- package/dist/components/layout/GameContainer.d.ts.map +1 -1
- package/dist/components/layout/GameContainer.js +1 -72
- package/dist/components/layout/GameFlow.d.ts.map +1 -1
- package/dist/components/layout/GameFlow.js +1 -93
- package/dist/components/layout/PageConfig.d.ts.map +1 -1
- package/dist/components/layout/PageConfig.js +1 -47
- package/dist/components/layout/PageContainer.d.ts.map +1 -1
- package/dist/components/layout/PageContainer.js +1 -38
- package/dist/components/layout/components/Breadcrumbs.d.ts +2 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +1 -89
- package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/DropdownNavigation.js +1 -30
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.js +1 -26
- package/dist/components/layout/components/Notifications.js +1 -182
- package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppBranding.js +1 -54
- package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppIcon.js +1 -59
- package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppTitle.js +1 -40
- package/dist/components/layout/components/header/CacheSettings.js +1 -225
- package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/GameTitle.js +1 -66
- package/dist/components/layout/components/header/HeaderMenu.js +1 -75
- package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderNavigation.js +1 -66
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +1 -85
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +1 -93
- package/dist/components/layout/components/index.js +1 -25
- package/dist/components/layout/index.js +1 -14
- package/dist/crud/components/ChildRowsPicker.js +1 -68
- package/dist/crud/components/CrudCardLink.js +1 -14
- package/dist/crud/components/EntityCardList.js +1 -184
- package/dist/crud/components/EntityDisplayRenderer.js +1 -130
- package/dist/crud/components/EntityFormRenderer.js +1 -433
- package/dist/crud/components/EntityList.js +1 -521
- package/dist/crud/components/EntityRecommendations.js +1 -87
- package/dist/crud/components/EntityWorkflow.js +1 -55
- package/dist/crud/components/Form.d.ts.map +1 -1
- package/dist/crud/components/Form.js +1 -198
- package/dist/crud/components/cellEditFor.js +1 -74
- package/dist/crud/components/entityParent.js +1 -76
- package/dist/crud/components/index.js +1 -16
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
- package/dist/crud/components/useRecordBreadcrumb.js +1 -43
- package/dist/crud/crudImports.js +1 -51
- package/dist/crud/index.js +1 -11
- package/dist/data/techLogos.js +1 -99
- package/dist/dndev-next.css +25 -4
- package/dist/dndev.css +25 -4
- package/dist/index.js +1 -5
- package/dist/internal/common/DnDevErrorBoundary.js +1 -55
- package/dist/internal/common/ErrorFallback.js +3 -214
- package/dist/internal/common/GlobalErrorFallback.js +1 -45
- package/dist/internal/common/RouteErrorFallback.js +3 -140
- package/dist/internal/devtools/DebugTools.js +1 -131
- package/dist/internal/devtools/components/AuthDebugButton.js +1 -72
- package/dist/internal/devtools/components/ConfigTab.js +1 -61
- package/dist/internal/devtools/components/CookieTab.js +1 -156
- package/dist/internal/devtools/components/DebugDialog.js +1 -48
- package/dist/internal/devtools/components/DesignTab.js +1 -469
- package/dist/internal/devtools/components/LayoutReset.js +1 -214
- package/dist/internal/devtools/components/MaskedValue.js +1 -39
- package/dist/internal/devtools/components/StoresTab.js +1 -90
- package/dist/internal/devtools/components/index.js +1 -16
- package/dist/internal/devtools/index.js +1 -13
- package/dist/internal/devtools/types.js +0 -2
- package/dist/internal/devtools/utils/envVarDiscovery.js +1 -106
- package/dist/internal/devtools/utils/index.js +1 -12
- package/dist/internal/devtools/utils/maskSensitive.js +1 -59
- package/dist/internal/devtools/utils/virtualModuleInspector.js +1 -309
- package/dist/internal/initializers/BaseStoresInitializer.js +1 -367
- package/dist/internal/initializers/NextJsStoresInitializer.js +1 -78
- package/dist/internal/initializers/ViteStoresInitializer.js +1 -20
- package/dist/internal/initializers/index.js +1 -11
- package/dist/internal/layout/DnDevLayout.js +1 -321
- package/dist/internal/layout/components/AutoMetaTags.d.ts +2 -0
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +1 -338
- package/dist/internal/layout/components/FaviconHead.js +1 -60
- package/dist/internal/layout/components/FontPreloadLinks.js +1 -31
- package/dist/internal/layout/components/HeadTags.js +1 -20
- package/dist/internal/layout/components/PWAUpdateNotification.js +1 -131
- package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.js +1 -35
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +1 -37
- package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterLegalLinks.js +1 -44
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts +4 -2
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/useLegalLinks.js +1 -21
- package/dist/internal/layout/components/i18nSeoMeta.js +1 -53
- package/dist/internal/layout/components/index.js +1 -13
- package/dist/internal/layout/config/defaults.js +1 -47
- package/dist/internal/layout/config/index.js +1 -11
- package/dist/internal/layout/config/presets/admin.js +1 -35
- package/dist/internal/layout/config/presets/blog.js +1 -31
- package/dist/internal/layout/config/presets/docs.js +1 -51
- package/dist/internal/layout/config/presets/game.js +1 -53
- package/dist/internal/layout/config/presets/index.js +1 -24
- package/dist/internal/layout/config/presets/landing.js +1 -42
- package/dist/internal/layout/config/presets/moolti.js +1 -52
- package/dist/internal/layout/config/presets/plain.js +1 -25
- package/dist/internal/layout/renderers/index.js +0 -10
- package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevFooter.js +1 -67
- package/dist/internal/layout/zones/DnDevHeader.js +1 -41
- package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevMergedBar.js +1 -52
- package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevSidebar.js +1 -181
- package/dist/internal/layout/zones/index.js +1 -14
- package/dist/internal/providers/NavigationProvider.d.ts.map +1 -1
- package/dist/internal/providers/NavigationProvider.js +1 -71
- package/dist/internal/providers/SentryInitializer.d.ts.map +1 -1
- package/dist/internal/providers/SentryInitializer.js +1 -36
- package/dist/internal/providers/UIProviders.js +1 -79
- package/dist/internal/providers/index.js +1 -12
- package/dist/next.js +1 -11
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +1 -107
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +1 -117
- package/dist/providers/index.js +1 -11
- package/dist/routing/404.js +1 -108
- package/dist/routing/AuthGuard.js +1 -178
- package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
- package/dist/routing/AuthGuardFallback.js +1 -67
- package/dist/routing/AuthReturnTo.js +1 -68
- package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
- package/dist/routing/DnDevNavigationMenu.js +1 -138
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +1 -38
- package/dist/routing/GoToDialog.d.ts.map +1 -1
- package/dist/routing/GoToDialog.js +1 -97
- package/dist/routing/GoToInput.d.ts.map +1 -1
- package/dist/routing/GoToInput.js +1 -49
- package/dist/routing/GoToWrapper.d.ts.map +1 -1
- package/dist/routing/GoToWrapper.js +1 -59
- package/dist/routing/Link.d.ts +10 -2
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +1 -109
- package/dist/routing/NavigationItem.d.ts.map +1 -1
- package/dist/routing/NavigationItem.js +1 -44
- package/dist/routing/NotFoundDocument.d.ts +33 -0
- package/dist/routing/NotFoundDocument.d.ts.map +1 -0
- package/dist/routing/NotFoundDocument.js +1 -0
- package/dist/routing/SignedInRedirect.js +1 -47
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/index.js +1 -26
- package/dist/routing/hooks/types.js +0 -2
- package/dist/routing/hooks/useLocation.next.js +1 -35
- package/dist/routing/hooks/useLocation.vite.js +1 -13
- package/dist/routing/hooks/useMatch.next.js +1 -31
- package/dist/routing/hooks/useMatch.vite.js +1 -6
- package/dist/routing/hooks/useNavigate.next.js +1 -64
- package/dist/routing/hooks/useNavigate.vite.js +1 -61
- package/dist/routing/hooks/useParams.next.js +1 -9
- package/dist/routing/hooks/useParams.vite.js +1 -6
- package/dist/routing/hooks/useQueryParams.next.js +1 -66
- package/dist/routing/hooks/useQueryParams.vite.js +1 -66
- package/dist/routing/hooks/useRedirectGuard.next.js +1 -119
- package/dist/routing/hooks/useRedirectGuard.vite.js +1 -117
- package/dist/routing/hooks/useRouteParam.next.js +1 -38
- package/dist/routing/hooks/useRouteParam.vite.js +1 -38
- package/dist/routing/hooks/useRoutePath.next.js +1 -36
- package/dist/routing/hooks/useRoutePath.vite.js +1 -25
- package/dist/routing/hooks/useSearchParams.next.js +1 -22
- package/dist/routing/hooks/useSearchParams.vite.js +1 -22
- package/dist/routing/hooks/useUrlLanguage.next.js +1 -50
- package/dist/routing/hooks/useUrlLanguage.vite.js +1 -41
- package/dist/routing/index.d.ts +1 -0
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -32
- package/dist/routing/link/InternalLink.next.d.ts +23 -0
- package/dist/routing/link/InternalLink.next.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.next.js +1 -0
- package/dist/routing/link/InternalLink.vite.d.ts +22 -0
- package/dist/routing/link/InternalLink.vite.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.vite.js +1 -0
- package/dist/routing/link/absolutePath.d.ts +17 -0
- package/dist/routing/link/absolutePath.d.ts.map +1 -0
- package/dist/routing/link/absolutePath.js +1 -0
- package/dist/routing/link/link.next.d.ts +12 -0
- package/dist/routing/link/link.next.d.ts.map +1 -0
- package/dist/routing/link/link.next.js +1 -0
- package/dist/routing/link/link.vite.d.ts +12 -0
- package/dist/routing/link/link.vite.d.ts.map +1 -0
- package/dist/routing/link/link.vite.js +1 -0
- package/dist/routing/link/types.d.ts +30 -0
- package/dist/routing/link/types.d.ts.map +1 -0
- package/dist/routing/link/types.js +0 -0
- package/dist/routing/parentRoute.js +1 -43
- package/dist/routing/useGoTo.d.ts.map +1 -1
- package/dist/routing/useGoTo.js +1 -59
- package/dist/routing/useNavigation.d.ts.map +1 -1
- package/dist/routing/useNavigation.js +1 -114
- package/dist/routing/useRouteDiscovery.d.ts +1 -0
- package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
- package/dist/routing/useRouteDiscovery.js +1 -313
- package/dist/rsc.d.ts +28 -0
- package/dist/rsc.d.ts.map +1 -0
- package/dist/rsc.js +1 -0
- package/dist/styles/index.css +25 -4
- package/dist/styles/index.js +1 -10
- package/dist/styles/layoutConstants.js +1 -134
- package/dist/symbol-index.json +1 -1
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -297
- package/dist/utils/index.js +1 -23
- package/dist/utils/sanitizeSvg.js +1 -51
- package/dist/utils/tList.js +1 -42
- package/dist/utils/useAISafe.d.ts.map +1 -1
- package/dist/utils/useAISafe.js +1 -53
- package/dist/utils/useAuthSafe.d.ts.map +1 -1
- package/dist/utils/useAuthSafe.js +1 -78
- package/dist/utils/useAuthVisibility.d.ts.map +1 -1
- package/dist/utils/useAuthVisibility.js +1 -63
- package/dist/utils/useBillingVisibility.d.ts.map +1 -1
- package/dist/utils/useBillingVisibility.js +1 -57
- package/dist/utils/useCrudSafe.d.ts.map +1 -1
- package/dist/utils/useCrudSafe.js +1 -75
- package/dist/utils/useDeleteAccountSafe.js +1 -52
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -85
- package/dist/utils/useOAuthSafe.d.ts.map +1 -1
- package/dist/utils/useOAuthSafe.js +1 -38
- package/dist/utils/useSeo.js +1 -151
- package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
- package/dist/utils/useStripeBillingSafe.js +1 -81
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +1 -235
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +1 -205
- package/dist/vite-routing/index.js +1 -11
- package/dist/vite.js +1 -10
- package/guidelines/COMPONENTS.md +3 -3
- package/guidelines/PAGES.md +3 -0
- package/guidelines/ROUTING.md +15 -0
- package/guidelines/SEO.md +4 -1
- package/package.json +18 -8
- package/dist/ChildRowsPicker-63M4EQUQ.js +0 -1
- package/dist/ChildRowsPicker-ISP365ON.js +0 -1
- package/dist/ChildRowsPicker-PQFE6NCR.js +0 -1
- package/dist/ChildRowsPicker-XXFFSMWY.js +0 -1
- package/dist/CookieConsent-QOUAY6B4.js +0 -1
- package/dist/GoToDialog-KSBGOIWO.js +0 -1
- package/dist/GoToDialog-XBK5EZF4.js +0 -1
- package/dist/chunk-3CIZFGST.js +0 -1
- package/dist/chunk-LHMKU342.js +0 -1
- package/dist/chunk-MS7ZIW5Z.js +0 -1
- package/dist/chunk-O2XFH626.js +0 -1
- package/dist/chunk-P2DHZWPY.js +0 -1
- package/dist/components/common/lucideIconByName.d.ts +0 -9
- package/dist/components/common/lucideIconByName.d.ts.map +0 -1
- package/dist/components/common/lucideIconByName.js +0 -32
- package/dist/internal/layout/components/PerformanceHints.d.ts +0 -71
- package/dist/internal/layout/components/PerformanceHints.d.ts.map +0 -1
- package/dist/internal/layout/components/PerformanceHints.js +0 -71
|
@@ -1,57 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview useBillingVisibility Hook
|
|
4
|
-
* @description Determines when to show/hide billing UI based on feature status
|
|
5
|
-
*
|
|
6
|
-
* This hook encapsulates the common pattern for billing UI visibility:
|
|
7
|
-
* - Hide if not available (not installed/configured)
|
|
8
|
-
* - Show with loading state during initialization
|
|
9
|
-
* - Show normal UI when status === 'ready'
|
|
10
|
-
*
|
|
11
|
-
* @version 0.1.0
|
|
12
|
-
* @since 0.0.1
|
|
13
|
-
* @author AMBROISE PARK Consulting
|
|
14
|
-
*/
|
|
15
|
-
import { useAuthSafe } from './useAuthSafe';
|
|
16
|
-
import { useStripeBillingSafe } from './useStripeBillingSafe';
|
|
17
|
-
/**
|
|
18
|
-
* Hook to determine billing UI visibility and loading states
|
|
19
|
-
*
|
|
20
|
-
* **Visibility Rules:**
|
|
21
|
-
* - Hide if `!isAvailable` (not installed/configured)
|
|
22
|
-
* - Show with loading if `status === 'initializing'` during operations
|
|
23
|
-
* - Show normal UI when `isAvailable && status === 'ready'`
|
|
24
|
-
*
|
|
25
|
-
* @returns BillingVisibilityState with visibility flags
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* const { shouldHide, isLoading, isReady } = useBillingVisibility();
|
|
30
|
-
*
|
|
31
|
-
* if (shouldHide) {
|
|
32
|
-
* return <FeatureDisabled featureName="Billing" />;
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
|
-
* if (isLoading) {
|
|
36
|
-
* return <Button disabled><Spinner /></Button>;
|
|
37
|
-
* }
|
|
38
|
-
*
|
|
39
|
-
* return <BillingForm />;
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export function useBillingVisibility() {
|
|
43
|
-
// Get auth state for billing (required for isAvailable to work)
|
|
44
|
-
const user = useAuthSafe('user');
|
|
45
|
-
const status = useAuthSafe('status');
|
|
46
|
-
const authState = { user, status };
|
|
47
|
-
const billingStatus = useStripeBillingSafe('status', authState);
|
|
48
|
-
const isAvailable = useStripeBillingSafe('isAvailable', authState);
|
|
49
|
-
const shouldHide = !isAvailable;
|
|
50
|
-
const isLoading = billingStatus === 'initializing';
|
|
51
|
-
const isReady = isAvailable && billingStatus === 'ready';
|
|
52
|
-
return {
|
|
53
|
-
shouldHide,
|
|
54
|
-
isLoading,
|
|
55
|
-
isReady,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
1
|
+
"use client";import{useAuthSafe as e}from"./useAuthSafe.js";import{useStripeBillingSafe as o}from"./useStripeBillingSafe.js";function b(){let a=e("user"),n=e("status"),i={user:a,status:n},t=o("status",i),s=o("isAvailable",i);return{shouldHide:!s,isLoading:t==="initializing",isReady:s&&t==="ready"}}export{b as useBillingVisibility};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrudSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useCrudSafe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCrudSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useCrudSafe.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGnE,UAAU,kBAAkB,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAkBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EACrC,kBAAkB,EAAE,MAAM,GAAG,MAAM,EACnC,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GAClC,OAAO,CAAC,CAAC,CAAC,CAKZ;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,SAAoC,CAAC"}
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Safe useCrud wrapper for graceful degradation
|
|
4
|
-
* @description Provides CRUD functionality when @donotdev/crud is installed,
|
|
5
|
-
* gracefully degrades to no-op when not installed. This is the recommended
|
|
6
|
-
* way to use CRUD in optional/plugin contexts.
|
|
7
|
-
*
|
|
8
|
-
* ## CRITICAL: DO NOT USE DYNAMIC IMPORTS
|
|
9
|
-
*
|
|
10
|
-
* This file MUST use sync `import * as crudModule from '@donotdev/crud'`
|
|
11
|
-
* at module level. DO NOT refactor to use async `import('@donotdev/crud').then(...)`.
|
|
12
|
-
*
|
|
13
|
-
* ### Why sync import is required:
|
|
14
|
-
*
|
|
15
|
-
* 1. **Bundler aliasing**: Vite/webpack alias missing packages to empty modules
|
|
16
|
-
* at BUILD TIME. The import completes immediately (no async).
|
|
17
|
-
*
|
|
18
|
-
* 2. **Rules of Hooks**: If we use async dynamic import:
|
|
19
|
-
* - First render: `realUseCrud = null` → uses stub (0 hooks)
|
|
20
|
-
* - Async completes: `realUseCrud = useCrud` → now has hooks
|
|
21
|
-
* - Next render: React sees different hook count → CRASH
|
|
22
|
-
*
|
|
23
|
-
* 3. **Monorepo gotcha**: Dynamic imports resolve workspace packages even when
|
|
24
|
-
* the consuming app doesn't have them as dependencies. This causes the
|
|
25
|
-
* real hook to activate unexpectedly → Rules of Hooks violation.
|
|
26
|
-
*
|
|
27
|
-
* 4. **Decision is immutable**: With sync import, `crudModule?.useCrud`
|
|
28
|
-
* is evaluated ONCE at module load. It's either the real hook or undefined.
|
|
29
|
-
* This never changes during the app lifecycle.
|
|
30
|
-
*
|
|
31
|
-
* @see docs/development/GRACEFUL_DEGRADATION.md
|
|
32
|
-
* @version 0.1.0
|
|
33
|
-
* @since 0.0.1
|
|
34
|
-
* @author AMBROISE PARK Consulting
|
|
35
|
-
*/
|
|
36
|
-
import { DEGRADED_CRUD_API } from '@donotdev/core';
|
|
37
|
-
import * as crudModule from '@donotdev/crud';
|
|
38
|
-
// Check if real hook exists (will be undefined if Vite aliased to empty module)
|
|
39
|
-
const realUseCrud = crudModule?.useCrud;
|
|
40
|
-
/**
|
|
41
|
-
* Stub that returns degraded CRUD values.
|
|
42
|
-
* Used when @donotdev/crud is not installed.
|
|
43
|
-
*/
|
|
44
|
-
function useCrudStub() {
|
|
45
|
-
return DEGRADED_CRUD_API;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Safe wrapper for useCrud hook.
|
|
49
|
-
*
|
|
50
|
-
* - If @donotdev/crud installed → uses real hook (handles Firebase/consent internally)
|
|
51
|
-
* - If not installed → returns degraded API values
|
|
52
|
-
*
|
|
53
|
-
* @param entityOrCollection - Entity definition or collection name
|
|
54
|
-
* @param options - Options including backend type and schema
|
|
55
|
-
* @returns CRUD operations and state, or degraded API if crud unavailable
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* // With entity
|
|
60
|
-
* const { add, update } = useCrudSafe(carEntity);
|
|
61
|
-
*
|
|
62
|
-
* // With collection string
|
|
63
|
-
* const { get, set } = useCrudSafe('users', { schema: UserSchema });
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export function useCrudSafe(entityOrCollection, options = {}) {
|
|
67
|
-
if (realUseCrud) {
|
|
68
|
-
return realUseCrud(entityOrCollection, options);
|
|
69
|
-
}
|
|
70
|
-
return useCrudStub();
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Check if CRUD module is available (for conditional UI rendering)
|
|
74
|
-
*/
|
|
75
|
-
export const isCrudAvailable = typeof realUseCrud === 'function';
|
|
1
|
+
"use client";import{DEGRADED_CRUD_API as r}from"@donotdev/core";import*as o from"@donotdev/crud";var e=o?.useCrud;function u(){return r}function d(n,t={}){return e?e(n,t):u()}var s=typeof e=="function";export{s as isCrudAvailable,d as useCrudSafe};
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Safe useDeleteAccount wrapper for graceful degradation
|
|
4
|
-
* @description Provides the account deletion flow when @donotdev/auth is installed,
|
|
5
|
-
* degrades to a no-op state when not installed.
|
|
6
|
-
*
|
|
7
|
-
* ## CRITICAL: DO NOT USE DYNAMIC IMPORTS
|
|
8
|
-
*
|
|
9
|
-
* Same contract as `useAuthSafe`: sync `import * as authModule` at module level.
|
|
10
|
-
* The branch (real hook vs stub) is decided ONCE at module load and never changes,
|
|
11
|
-
* so the hook count per render is stable (Rules of Hooks).
|
|
12
|
-
*
|
|
13
|
-
* @see ./useAuthSafe.ts
|
|
14
|
-
* @see docs/development/GRACEFUL_DEGRADATION.md
|
|
15
|
-
* @version 0.1.0
|
|
16
|
-
* @since 0.2.3
|
|
17
|
-
* @author AMBROISE PARK Consulting
|
|
18
|
-
*/
|
|
19
|
-
import * as authModule from '@donotdev/auth';
|
|
20
|
-
// Undefined if package not installed/aliased to empty module
|
|
21
|
-
const realUseDeleteAccount = authModule?.useDeleteAccount;
|
|
22
|
-
const NOOP = () => { };
|
|
23
|
-
/** Inert deletion state used when @donotdev/auth is not installed. */
|
|
24
|
-
const DEGRADED_DELETE_ACCOUNT_STATE = {
|
|
25
|
-
showConfirmDialog: false,
|
|
26
|
-
showPasswordDialog: false,
|
|
27
|
-
isDeleting: false,
|
|
28
|
-
error: null,
|
|
29
|
-
startDeleteFlow: NOOP,
|
|
30
|
-
confirmDelete: async () => { },
|
|
31
|
-
cancel: NOOP,
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Safe wrapper for `useDeleteAccount`.
|
|
35
|
-
*
|
|
36
|
-
* - If @donotdev/auth installed → real hook (confirm / reauth / delete flow)
|
|
37
|
-
* - If not installed → inert state, no-op actions
|
|
38
|
-
*
|
|
39
|
-
* @returns Account deletion state and actions
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const deletion = useDeleteAccountSafe();
|
|
44
|
-
* deletion.startDeleteFlow();
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export function useDeleteAccountSafe() {
|
|
48
|
-
if (realUseDeleteAccount) {
|
|
49
|
-
return realUseDeleteAccount();
|
|
50
|
-
}
|
|
51
|
-
return DEGRADED_DELETE_ACCOUNT_STATE;
|
|
52
|
-
}
|
|
1
|
+
import*as o from"@donotdev/auth";var e=o?.useDeleteAccount,t=()=>{},n={showConfirmDialog:!1,showPasswordDialog:!1,isDeleting:!1,error:null,startDeleteFlow:t,confirmDelete:async()=>{},cancel:t};function c(){return e?e():n}export{c as useDeleteAccountSafe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormStoreSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useFormStoreSafe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFormStoreSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useFormStoreSafe.ts"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,QAAA,MAAM,yBAAyB;;;;;;;;;;mCAYP,MAAM,YAAY,OAAO;;oCAElB,MAAM,EAAE;;;;;;CAO7B,CAAC;AAEX,sFAAsF;AACtF,KAAK,aAAa,GAAG,OAAO,yBAAyB,CAAC;AAWtD;;GAEG;AACH,eAAO,MAAM,oBAAoB,SAAyC,CAAC;AAE3E;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,GAAG,CAAC,CAK5E;yBALe,gBAAgB;wBAaA,OAAO,yBAAyB"}
|
|
@@ -1,85 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Safe FormStore access for graceful degradation
|
|
4
|
-
* @description Provides FormStore functionality when @donotdev/crud is installed,
|
|
5
|
-
* gracefully degrades when not installed.
|
|
6
|
-
*
|
|
7
|
-
* ## CRITICAL: DO NOT USE DYNAMIC IMPORTS
|
|
8
|
-
*
|
|
9
|
-
* This file MUST use sync `import * as crudModule from '@donotdev/crud'`
|
|
10
|
-
* at module level. DO NOT refactor to use async `import('@donotdev/crud').then(...)`.
|
|
11
|
-
*
|
|
12
|
-
* @see packages/ui/src/utils/useAuthSafe.ts for pattern reference
|
|
13
|
-
* @see docs/development/GRACEFUL_DEGRADATION.md
|
|
14
|
-
* @version 0.1.0
|
|
15
|
-
* @since 0.0.1
|
|
16
|
-
* @author AMBROISE PARK Consulting
|
|
17
|
-
*/
|
|
18
|
-
import * as crudModule from '@donotdev/crud';
|
|
19
|
-
// Sync import - bundler aliases to empty module if not installed
|
|
20
|
-
// Decision made ONCE at module load time, never changes
|
|
21
|
-
/**
|
|
22
|
-
* Degraded FormStore state - returned when CRUD package not installed
|
|
23
|
-
* Matches FormStoreState & FormStoreActions interface
|
|
24
|
-
*/
|
|
25
|
-
const DEGRADED_FORM_STORE_STATE = {
|
|
26
|
-
forms: {},
|
|
27
|
-
// State transitions (no-ops)
|
|
28
|
-
startSubmit: () => { },
|
|
29
|
-
setUploading: () => { },
|
|
30
|
-
setValidating: () => { },
|
|
31
|
-
setSubmitting: () => { },
|
|
32
|
-
setSuccess: () => { },
|
|
33
|
-
setError: () => { },
|
|
34
|
-
reset: () => { },
|
|
35
|
-
cleanup: () => { },
|
|
36
|
-
// Dirty state management
|
|
37
|
-
setIsDirty: (_formId, _isDirty) => { },
|
|
38
|
-
hasDirtyForms: () => false,
|
|
39
|
-
getDirtyFormIds: () => [],
|
|
40
|
-
// Getters
|
|
41
|
-
getStatus: () => 'idle',
|
|
42
|
-
isLoading: () => false,
|
|
43
|
-
getUploadProgress: () => 0,
|
|
44
|
-
getError: () => null,
|
|
45
|
-
getIsDirty: () => false,
|
|
46
|
-
};
|
|
47
|
-
// Extract useFormStore if available (undefined if package not installed/aliased)
|
|
48
|
-
// Zustand stores have both the hook and getState method
|
|
49
|
-
// why: public selector type is the degraded shape (FormStoreLike), not crud's FormStore state; retyping it changes the exported signature
|
|
50
|
-
const realUseFormStore = crudModule?.useFormStore;
|
|
51
|
-
/**
|
|
52
|
-
* Check if FormStore is available
|
|
53
|
-
*/
|
|
54
|
-
export const isFormStoreAvailable = typeof realUseFormStore === 'function';
|
|
55
|
-
/**
|
|
56
|
-
* Safe access to FormStore.
|
|
57
|
-
* Returns degraded state selector result if CRUD package not installed.
|
|
58
|
-
*
|
|
59
|
-
* @param selector - Zustand selector function
|
|
60
|
-
* @returns Selected state, or degraded state selection if CRUD not available
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```tsx
|
|
64
|
-
* const hasDirtyForms = useFormStoreSafe((state) => state.hasDirtyForms());
|
|
65
|
-
* // Always safe to call - returns false when degraded
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export function useFormStoreSafe(selector) {
|
|
69
|
-
if (realUseFormStore) {
|
|
70
|
-
return realUseFormStore(selector);
|
|
71
|
-
}
|
|
72
|
-
return selector(DEGRADED_FORM_STORE_STATE);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Get FormStore state directly (non-hook version).
|
|
76
|
-
* Use this in non-React contexts or for one-time checks.
|
|
77
|
-
*
|
|
78
|
-
* @returns FormStore state, or degraded state if CRUD not available
|
|
79
|
-
*/
|
|
80
|
-
useFormStoreSafe.getState = () => {
|
|
81
|
-
if (realUseFormStore && typeof realUseFormStore.getState === 'function') {
|
|
82
|
-
return realUseFormStore.getState();
|
|
83
|
-
}
|
|
84
|
-
return DEGRADED_FORM_STORE_STATE;
|
|
85
|
-
};
|
|
1
|
+
"use client";import*as o from"@donotdev/crud";var r={forms:{},startSubmit:()=>{},setUploading:()=>{},setValidating:()=>{},setSubmitting:()=>{},setSuccess:()=>{},setError:()=>{},reset:()=>{},cleanup:()=>{},setIsDirty:(e,i)=>{},hasDirtyForms:()=>!1,getDirtyFormIds:()=>[],getStatus:()=>"idle",isLoading:()=>!1,getUploadProgress:()=>0,getError:()=>null,getIsDirty:()=>!1},t=o?.useFormStore,n=typeof t=="function";function s(e){return t?t(e):e(r)}s.getState=()=>t&&typeof t.getState=="function"?t.getState():r;export{n as isFormStoreAvailable,s as useFormStoreSafe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuthSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useOAuthSafe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOAuthSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useOAuthSafe.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAiB/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAK1E;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAqC,CAAC"}
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { DEGRADED_OAUTH_API } from '@donotdev/core';
|
|
3
|
-
import * as oauthModule from '@donotdev/oauth';
|
|
4
|
-
// Check if real hook exists (will be undefined if Vite aliased to empty module)
|
|
5
|
-
const realUseOAuth = oauthModule?.useOAuth;
|
|
6
|
-
/**
|
|
7
|
-
* Stub that returns degraded OAuth values.
|
|
8
|
-
* Used when @donotdev/oauth is not installed.
|
|
9
|
-
*/
|
|
10
|
-
function useOAuthStub(key) {
|
|
11
|
-
return DEGRADED_OAUTH_API[key];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Safe wrapper for useOAuth hook.
|
|
15
|
-
*
|
|
16
|
-
* - If @donotdev/oauth installed → uses real hook (handles credentials/consent internally)
|
|
17
|
-
* - If not installed → returns degraded API values
|
|
18
|
-
*
|
|
19
|
-
* @param key - Property name to access from OAuth API
|
|
20
|
-
* @returns The OAuth API value, or degraded value if OAuth unavailable
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const connect = useOAuthSafe('connect');
|
|
25
|
-
* const loading = useOAuthSafe('loading');
|
|
26
|
-
* const isAvailable = useOAuthSafe('isAvailable');
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export function useOAuthSafe(key) {
|
|
30
|
-
if (realUseOAuth) {
|
|
31
|
-
return realUseOAuth(key);
|
|
32
|
-
}
|
|
33
|
-
return useOAuthStub(key);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Check if OAuth module is available (for conditional UI rendering)
|
|
37
|
-
*/
|
|
38
|
-
export const isOAuthAvailable = typeof realUseOAuth === 'function';
|
|
1
|
+
"use client";import{DEGRADED_OAUTH_API as u}from"@donotdev/core";import*as A from"@donotdev/oauth";var e=A?.useOAuth;function o(t){return u[t]}function r(t){return e?e(t):o(t)}var f=typeof e=="function";export{f as isOAuthAvailable,r as useOAuthSafe};
|
package/dist/utils/useSeo.js
CHANGED
|
@@ -1,151 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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';
|
|
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
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Dynamic SEO component
|
|
13
|
-
*
|
|
14
|
-
* @description Sets SEO metadata at runtime. Render after data is loaded.
|
|
15
|
-
* Overrides any static PageMeta SEO settings.
|
|
16
|
-
* Works in SSR/prerender - meta tags will be in initial HTML.
|
|
17
|
-
*
|
|
18
|
-
* @example Static title override
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <Seo fullTitle="About Us | MyApp" />
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @example Dynamic product page
|
|
24
|
-
* ```tsx
|
|
25
|
-
* const { data: product } = useProduct(id);
|
|
26
|
-
* if (!product) return <Loading />;
|
|
27
|
-
*
|
|
28
|
-
* return (
|
|
29
|
-
* <>
|
|
30
|
-
* <Seo
|
|
31
|
-
* title={product.name}
|
|
32
|
-
* description={product.description}
|
|
33
|
-
* image={product.image}
|
|
34
|
-
* type="product"
|
|
35
|
-
* />
|
|
36
|
-
* <ProductDetails product={product} />
|
|
37
|
-
* </>
|
|
38
|
-
* );
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example Article with dates
|
|
42
|
-
* ```tsx
|
|
43
|
-
* <Seo
|
|
44
|
-
* title={article.title}
|
|
45
|
-
* description={article.excerpt}
|
|
46
|
-
* type="article"
|
|
47
|
-
* publishDate={article.createdAt}
|
|
48
|
-
* modifiedDate={article.updatedAt}
|
|
49
|
-
* />
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export function Seo({ title, fullTitle, description, image, type = 'website', keywords, noindex, canonicalUrl, publishDate, modifiedDate, entity, data, }) {
|
|
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)}`;
|
|
66
|
-
// Resolve final title
|
|
67
|
-
const resolvedTitle = fullTitle
|
|
68
|
-
? fullTitle
|
|
69
|
-
: pageTitle
|
|
70
|
-
? `${pageTitle} | ${siteName}`
|
|
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;
|
|
89
|
-
// Build meta tags array for cleaner rendering
|
|
90
|
-
const metaTags = [];
|
|
91
|
-
// Description
|
|
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"));
|
|
94
|
-
}
|
|
95
|
-
// Image
|
|
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"));
|
|
98
|
-
}
|
|
99
|
-
// Type
|
|
100
|
-
if (type) {
|
|
101
|
-
metaTags.push(_jsx("meta", { property: "og:type", content: type }, "og:type"));
|
|
102
|
-
}
|
|
103
|
-
// Keywords
|
|
104
|
-
if (keywords && keywords.length > 0) {
|
|
105
|
-
const keywordsStr = Array.isArray(keywords)
|
|
106
|
-
? keywords.join(', ')
|
|
107
|
-
: keywords;
|
|
108
|
-
metaTags.push(_jsx("meta", { name: "keywords", content: keywordsStr }, "keywords"));
|
|
109
|
-
}
|
|
110
|
-
// Robots
|
|
111
|
-
if (noindex) {
|
|
112
|
-
metaTags.push(_jsx("meta", { name: "robots", content: "noindex, nofollow" }, "robots"));
|
|
113
|
-
}
|
|
114
|
-
// Article-specific meta
|
|
115
|
-
if (type === 'article') {
|
|
116
|
-
if (publishDate) {
|
|
117
|
-
metaTags.push(_jsx("meta", { property: "article:published_time", content: publishDate }, "article:published_time"));
|
|
118
|
-
}
|
|
119
|
-
if (modifiedDate) {
|
|
120
|
-
metaTags.push(_jsx("meta", { property: "article:modified_time", content: modifiedDate }, "article:modified_time"));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// OG/Twitter title
|
|
124
|
-
metaTags.push(_jsx("meta", { property: "og:title", content: resolvedTitle }, "og:title"), _jsx("meta", { name: "twitter:title", content: resolvedTitle }, "twitter:title"));
|
|
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) }))] }));
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Hook version for those who prefer hooks
|
|
129
|
-
* Returns the Seo component with props bound
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```tsx
|
|
133
|
-
* const SeoTags = useSeo({
|
|
134
|
-
* title: apartment.reference,
|
|
135
|
-
* description: apartment.description,
|
|
136
|
-
* });
|
|
137
|
-
*
|
|
138
|
-
* return (
|
|
139
|
-
* <>
|
|
140
|
-
* <SeoTags />
|
|
141
|
-
* <Content />
|
|
142
|
-
* </>
|
|
143
|
-
* );
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
export function useSeo(props) {
|
|
147
|
-
if (props === null) {
|
|
148
|
-
return () => null;
|
|
149
|
-
}
|
|
150
|
-
return () => _jsx(Seo, { ...props });
|
|
151
|
-
}
|
|
1
|
+
"use client";import{buildProductJsonLd as x,deriveEntitySeo as L,getPlatformEnvVar as J,useAppConfig as z,useTranslation as H}from"@donotdev/core";import{useLocalizedPath as I,useRoutePath as M}from"@donotdev/ui/routing/hooks";import{HeadTags as N}from"../internal/layout/components/HeadTags.js";import{jsx as e,jsxs as j}from"react/jsx-runtime";function E(n,r){return n.startsWith("/")&&r?`${r}${n}`:n}function U({title:n,fullTitle:r,description:w,image:P,type:l="website",keywords:a,noindex:R,canonicalUrl:p,publishDate:y,modifiedDate:f,entity:m,data:h}){let k=z("name")||"",v=M(),_=I(),d=J("APP_URL")||"",{t:A,language:$}=H(m?[m.namespace,"crud"]:void 0),o=m&&h?L(m,h,{t:A,locale:$}):null,u=n??o?.title,s=w??o?.description,S=P??o?.image,i=S?E(S,d):void 0,T=p??`${d}${_(v)}`,g=r||(u?`${u} | ${k}`:k),b=l==="product"?x({title:u??void 0,description:s??void 0,image:i,images:i?[i,...(o?.images??[]).map(c=>E(c,d)).filter(c=>c!==i)]:[],price:o?.price,availability:o?.availability},T):null,t=[];if(s&&t.push(e("meta",{name:"description",content:s},"description"),e("meta",{property:"og:description",content:s},"og:description"),e("meta",{name:"twitter:description",content:s},"twitter:description")),i&&t.push(e("meta",{property:"og:image",content:i},"og:image"),e("meta",{name:"twitter:image",content:i},"twitter:image"),e("meta",{name:"twitter:card",content:"summary_large_image"},"twitter:card")),l&&t.push(e("meta",{property:"og:type",content:l},"og:type")),a&&a.length>0){let c=Array.isArray(a)?a.join(", "):a;t.push(e("meta",{name:"keywords",content:c},"keywords"))}return R&&t.push(e("meta",{name:"robots",content:"noindex, nofollow"},"robots")),l==="article"&&(y&&t.push(e("meta",{property:"article:published_time",content:y},"article:published_time")),f&&t.push(e("meta",{property:"article:modified_time",content:f},"article:modified_time"))),t.push(e("meta",{property:"og:title",content:g},"og:title"),e("meta",{name:"twitter:title",content:g},"twitter:title")),j(N,{children:[e("title",{children:g}),p&&e("link",{rel:"canonical",href:p}),t,b&&e("script",{type:"application/ld+json",children:JSON.stringify(b)})]})}function V(n){return n===null?()=>null:()=>e(U,{...n})}export{U as Seo,V as useSeo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStripeBillingSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useStripeBillingSafe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStripeBillingSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useStripeBillingSafe.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAoB1D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,UAAU,EAC7D,GAAG,EAAE,CAAC,EACN,SAAS,CAAC,EAAE,gBAAgB,GAC3B,UAAU,CAAC,CAAC,CAAC,CAKf;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,SAA6C,CAAC"}
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Safe useStripeBilling wrapper for graceful degradation
|
|
4
|
-
* @description Provides billing functionality when @donotdev/billing is installed,
|
|
5
|
-
* gracefully degrades to no-op when not installed.
|
|
6
|
-
*
|
|
7
|
-
* ## CRITICAL: DO NOT USE DYNAMIC IMPORTS
|
|
8
|
-
*
|
|
9
|
-
* This file MUST use sync `import * as billingModule from '@donotdev/billing'`
|
|
10
|
-
* at module level. DO NOT refactor to use async `import('@donotdev/billing').then(...)`.
|
|
11
|
-
*
|
|
12
|
-
* ### Why sync import is required:
|
|
13
|
-
*
|
|
14
|
-
* 1. **Bundler aliasing**: Vite/webpack alias missing packages to empty modules
|
|
15
|
-
* at BUILD TIME. The import completes immediately (no async).
|
|
16
|
-
*
|
|
17
|
-
* 2. **Rules of Hooks**: If we use async dynamic import:
|
|
18
|
-
* - First render: `realUseStripeBilling = null` → uses stub (0 hooks)
|
|
19
|
-
* - Async completes: `realUseStripeBilling = useStripeBilling` → now has hooks
|
|
20
|
-
* - Next render: React sees different hook count → CRASH
|
|
21
|
-
*
|
|
22
|
-
* 3. **Monorepo gotcha**: Dynamic imports resolve workspace packages even when
|
|
23
|
-
* the consuming app doesn't have them as dependencies. This causes the
|
|
24
|
-
* real hook to activate unexpectedly → Rules of Hooks violation.
|
|
25
|
-
*
|
|
26
|
-
* 4. **Decision is immutable**: With sync import, `billingModule?.useStripeBilling`
|
|
27
|
-
* is evaluated ONCE at module load. It's either the real hook or undefined.
|
|
28
|
-
* This never changes during the app lifecycle.
|
|
29
|
-
*
|
|
30
|
-
* @see docs/development/GRACEFUL_DEGRADATION.md
|
|
31
|
-
* @version 0.1.0
|
|
32
|
-
* @since 0.0.1
|
|
33
|
-
* @author AMBROISE PARK Consulting
|
|
34
|
-
*/
|
|
35
|
-
import * as billingModule from '@donotdev/billing';
|
|
36
|
-
import { DEGRADED_BILLING_API } from '@donotdev/core';
|
|
37
|
-
// Check if real hook exists (will be undefined if Vite aliased to empty module)
|
|
38
|
-
const realUseStripeBilling = billingModule?.useStripeBilling;
|
|
39
|
-
/**
|
|
40
|
-
* Stub that returns degraded billing values.
|
|
41
|
-
* Used when @donotdev/billing is not installed.
|
|
42
|
-
*/
|
|
43
|
-
function useStripeBillingStub(key) {
|
|
44
|
-
return DEGRADED_BILLING_API[key];
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Safe wrapper for useStripeBilling hook.
|
|
48
|
-
*
|
|
49
|
-
* - If @donotdev/billing installed → uses real hook
|
|
50
|
-
* - If not installed → returns degraded API values
|
|
51
|
-
*
|
|
52
|
-
* **IMPORTANT:** For `isAvailable` to return `true`, you must pass `authState`.
|
|
53
|
-
* Without auth state, billing will return `isAvailable: false` until auth status is `ready`.
|
|
54
|
-
*
|
|
55
|
-
* @param key - Property name to access from billing API
|
|
56
|
-
* @param authState - Auth state from useAuthSafe (user, status)
|
|
57
|
-
* @returns The billing API value, or degraded value if billing unavailable
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* // Get auth state first
|
|
62
|
-
* const user = useAuthSafe('user');
|
|
63
|
-
* const status = useAuthSafe('status'); // 'initializing' | 'ready' | 'degraded' | 'error'
|
|
64
|
-
* const authState = { user, status };
|
|
65
|
-
*
|
|
66
|
-
* // Pass to billing
|
|
67
|
-
* const checkout = useStripeBillingSafe('checkout', authState);
|
|
68
|
-
* const billingStatus = useStripeBillingSafe('status', authState);
|
|
69
|
-
* const isAvailable = useStripeBillingSafe('isAvailable', authState);
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export function useStripeBillingSafe(key, authState) {
|
|
73
|
-
if (realUseStripeBilling) {
|
|
74
|
-
return realUseStripeBilling(key, authState);
|
|
75
|
-
}
|
|
76
|
-
return useStripeBillingStub(key);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Check if billing module is available (for conditional UI rendering)
|
|
80
|
-
*/
|
|
81
|
-
export const isBillingAvailable = typeof realUseStripeBilling === 'function';
|
|
1
|
+
"use client";import*as l from"@donotdev/billing";import{DEGRADED_BILLING_API as n}from"@donotdev/core";var t=l?.useStripeBilling;function o(i){return n[i]}function g(i,e){return t?t(i,e):o(i)}var u=typeof t=="function";export{u as isBillingAvailable,g as useStripeBillingSafe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRoutes.d.ts","sourceRoot":"","sources":["../../src/vite-routing/AppRoutes.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppRoutes.d.ts","sourceRoot":"","sources":["../../src/vite-routing/AppRoutes.tsx"],"names":[],"mappings":"AAmDA,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"}
|