@donotdev/ui 0.0.8 → 0.0.10
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.d.ts +1 -1
- package/dist/components/auth/AuthHeader.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.d.ts +2 -1
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +1 -1
- package/dist/components/common/AppLoading.d.ts +1 -1
- package/dist/components/common/AppLoading.d.ts.map +1 -1
- package/dist/components/common/AppLoading.js +0 -1
- package/dist/components/common/Loader.d.ts +4 -4
- package/dist/components/common/Loader.d.ts.map +1 -1
- package/dist/components/common/Loader.js +11 -12
- package/dist/components/common/LoadingMessage.d.ts +1 -9
- package/dist/components/common/LoadingMessage.d.ts.map +1 -1
- package/dist/components/common/LoadingMessage.js +0 -1
- package/dist/components/common/LoadingScreen.d.ts +1 -9
- package/dist/components/common/LoadingScreen.d.ts.map +1 -1
- package/dist/components/common/LoadingScreen.js +0 -1
- package/dist/components/common/RedirectOverlay.js +1 -1
- package/dist/components/common/TechBento.d.ts.map +1 -1
- package/dist/components/common/TechBento.js +1 -0
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts +1 -9
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.js +0 -1
- package/dist/components/layout/components/header/CacheSettings.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +0 -1
- package/dist/components/layout/components/header/ThemeToggle.d.ts +1 -1
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +5 -4
- package/dist/crud/components/DisplayFieldRenderer.d.ts +3 -11
- package/dist/crud/components/DisplayFieldRenderer.d.ts.map +1 -1
- package/dist/crud/components/DisplayFieldRenderer.js +3 -2
- package/dist/crud/components/EntityDisplayRenderer.d.ts +2 -2
- package/dist/crud/components/fields/display/AvatarFieldDisplay.d.ts +2 -2
- package/dist/crud/components/fields/display/BadgeFieldDisplay.d.ts +2 -2
- package/dist/crud/components/fields/display/ButtonFieldDisplay.d.ts +2 -2
- package/dist/crud/components/fields/display/CheckboxFieldDisplay.d.ts +2 -2
- package/dist/crud/components/fields/display/DateFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/DateFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/DateFieldDisplay.js +2 -4
- package/dist/crud/components/fields/display/DropdownDisplay.d.ts +2 -2
- package/dist/crud/components/fields/display/FileFieldDisplay.d.ts +2 -2
- package/dist/crud/components/fields/display/GeoPointFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/GeoPointFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/GeoPointFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/HiddenFieldDisplay.d.ts +3 -3
- package/dist/crud/components/fields/display/HiddenFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/HiddenFieldDisplay.js +0 -9
- package/dist/crud/components/fields/display/ImageFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/ImageFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/ImageFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/LinkFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/LinkFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/LinkFieldDisplay.js +6 -6
- package/dist/crud/components/fields/display/MapFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/MapFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/MapFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/MultiDropdownDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/MultiDropdownDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/MultiDropdownDisplay.js +0 -1
- package/dist/crud/components/fields/display/MultiInputTextFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/MultiInputTextFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/MultiInputTextFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/NumberFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/NumberFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/NumberFieldDisplay.js +2 -4
- package/dist/crud/components/fields/display/PasswordFieldDisplay.d.ts +3 -3
- package/dist/crud/components/fields/display/PasswordFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/PasswordFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/PhoneNumberDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/PhoneNumberDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/PhoneNumberDisplay.js +1 -3
- package/dist/crud/components/fields/display/RadioFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/RadioFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/RadioFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/RangeFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/RangeFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/RangeFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/ReferenceFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/ReferenceFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/ReferenceFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/RichTextDisplay.d.ts +25 -0
- package/dist/crud/components/fields/display/RichTextDisplay.d.ts.map +1 -0
- package/dist/crud/components/fields/display/RichTextDisplay.js +104 -0
- package/dist/crud/components/fields/display/TextAreaDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/TextAreaDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/TextAreaDisplay.js +0 -1
- package/dist/crud/components/fields/display/TextFieldDisplay.d.ts +2 -2
- package/dist/crud/components/fields/display/TimestampFieldDisplay.d.ts +3 -11
- package/dist/crud/components/fields/display/TimestampFieldDisplay.d.ts.map +1 -1
- package/dist/crud/components/fields/display/TimestampFieldDisplay.js +0 -1
- package/dist/crud/components/fields/display/index.d.ts +1 -0
- package/dist/crud/components/fields/display/index.d.ts.map +1 -1
- package/dist/crud/components/fields/display/index.js +1 -0
- package/dist/dndev.css +618 -156
- package/dist/index.js +64 -4
- package/dist/internal/common/ErrorFallback.d.ts +1 -10
- package/dist/internal/common/ErrorFallback.d.ts.map +1 -1
- package/dist/internal/common/GlobalErrorFallback.d.ts +1 -9
- package/dist/internal/common/GlobalErrorFallback.d.ts.map +1 -1
- package/dist/internal/common/RouteErrorFallback.d.ts.map +1 -1
- package/dist/internal/common/RouteErrorFallback.js +2 -3
- package/dist/internal/devtools/components/DebugDialog.d.ts.map +1 -1
- package/dist/internal/devtools/components/DebugDialog.js +3 -1
- package/dist/internal/devtools/components/MaskedValue.d.ts.map +1 -1
- package/dist/internal/devtools/components/MaskedValue.js +1 -1
- package/dist/internal/devtools/components/StoresTab.js +1 -1
- package/dist/internal/initializers/BaseStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/BaseStoresInitializer.js +1 -2
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.js +6 -6
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.d.ts +0 -2
- package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.js +2 -6
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts +0 -2
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +2 -6
- package/dist/internal/layout/components/footer/FooterLegalLinks.js +2 -2
- package/dist/internal/layout/config/defaults.d.ts +0 -10
- package/dist/internal/layout/config/defaults.d.ts.map +1 -1
- package/dist/internal/layout/config/defaults.js +12 -1
- package/dist/internal/layout/config/presets/admin.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/admin.js +7 -2
- package/dist/internal/layout/config/presets/blog.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/blog.js +7 -1
- package/dist/internal/layout/config/presets/docs.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/docs.js +7 -5
- package/dist/internal/layout/config/presets/game.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/game.js +7 -2
- package/dist/internal/layout/config/presets/moolti.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/moolti.js +11 -4
- package/dist/internal/layout/zones/DnDevFooter.d.ts +1 -13
- package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevFooter.js +2 -2
- package/dist/internal/layout/zones/DnDevHeader.d.ts +1 -14
- package/dist/internal/layout/zones/DnDevHeader.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevMergedBar.d.ts +2 -14
- package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevMergedBar.js +11 -3
- package/dist/internal/layout/zones/DnDevSidebar.d.ts +1 -14
- package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
- package/dist/routing/AuthGuard.d.ts.map +1 -1
- package/dist/routing/GoTo.d.ts +3 -1
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +6 -2
- package/dist/routing/GoToDialog.d.ts +1 -1
- package/dist/routing/GoToDialog.d.ts.map +1 -1
- package/dist/routing/GoToDialog.js +3 -5
- package/dist/routing/NavigationItem.d.ts +1 -1
- package/dist/routing/NavigationItem.d.ts.map +1 -1
- package/dist/routing/NavigationItem.js +0 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/useFormNavigationBlocker.d.ts +14 -0
- package/dist/routing/hooks/useFormNavigationBlocker.d.ts.map +1 -0
- package/dist/routing/hooks/useFormNavigationBlocker.js +42 -0
- package/dist/routing/hooks/useNavigate.next.d.ts +1 -1
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +8 -2
- package/dist/routing/hooks/useNavigate.vite.d.ts +1 -1
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +7 -1
- package/dist/routing/useGoTo.d.ts.map +1 -1
- package/dist/styles/index.css +618 -156
- package/dist/utils/assetResolver.d.ts +1 -1
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/tList.d.ts +1 -1
- package/dist/utils/tList.d.ts.map +1 -1
- package/dist/utils/useAuthSafe.d.ts +0 -33
- package/dist/utils/useAuthSafe.d.ts.map +1 -1
- package/dist/utils/useAuthSafe.js +34 -1
- package/dist/utils/useCrudSafe.d.ts +12 -6
- package/dist/utils/useCrudSafe.d.ts.map +1 -1
- package/dist/utils/useCrudSafe.js +9 -6
- package/dist/utils/useFormStoreSafe.d.ts +59 -0
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -0
- package/dist/utils/useFormStoreSafe.js +115 -0
- package/dist/utils/useOAuthSafe.d.ts.map +1 -1
- package/dist/utils/useStripeBillingSafe.d.ts +1 -34
- package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
- package/dist/utils/useStripeBillingSafe.js +34 -1
- package/dist/vite-routing/AppRoutes.d.ts +1 -1
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +0 -1
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +3 -6
- package/package.json +5 -5
|
@@ -139,5 +139,5 @@ export declare function resolveLogo(customPath?: string): string;
|
|
|
139
139
|
* @author AMBROISE PARK Consulting
|
|
140
140
|
*/
|
|
141
141
|
export declare function resolveFaviconSet(): FaviconSet;
|
|
142
|
-
export
|
|
142
|
+
export {};
|
|
143
143
|
//# sourceMappingURL=assetResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetResolver.d.ts","sourceRoot":"","sources":["../../src/utils/assetResolver.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,cAAc;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAED,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,GAAG,IAA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E9C"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export * from './assetResolver';
|
|
10
10
|
export * from './useAuthSafe';
|
|
11
|
+
export * from './useFormStoreSafe';
|
|
11
12
|
export * from './useAuthVisibility';
|
|
12
13
|
export * from './useStripeBillingSafe';
|
|
13
14
|
export * from './useBillingVisibility';
|
|
14
|
-
export * from './useCrudSafe';
|
|
15
15
|
export * from './useOAuthSafe';
|
|
16
16
|
export * from './tList';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export * from './assetResolver';
|
|
11
11
|
export * from './useAuthSafe';
|
|
12
|
+
export * from './useFormStoreSafe';
|
|
12
13
|
export * from './useAuthVisibility';
|
|
13
14
|
export * from './useStripeBillingSafe';
|
|
14
15
|
export * from './useBillingVisibility';
|
|
15
|
-
export * from './useCrudSafe';
|
|
16
16
|
export * from './useOAuthSafe';
|
|
17
17
|
export * from './tList';
|
package/dist/utils/tList.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tList.d.ts","sourceRoot":"","sources":["../../src/utils/tList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tList.d.ts","sourceRoot":"","sources":["../../src/utils/tList.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,KAAK,CACnB,CAAC,EAAE,SAAS,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,UAAU,GAAG,IAAmB,EACtC,IAAI,GAAE,MAAqB,GAC1B,SAAS,CAUX"}
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Safe useAuth wrapper for graceful degradation
|
|
3
|
-
* @description Provides auth functionality when @donotdev/auth is installed,
|
|
4
|
-
* gracefully degrades to no-op when not installed.
|
|
5
|
-
*
|
|
6
|
-
* ## CRITICAL: DO NOT USE DYNAMIC IMPORTS
|
|
7
|
-
*
|
|
8
|
-
* This file MUST use sync `import * as authModule from '@donotdev/auth'`
|
|
9
|
-
* at module level. DO NOT refactor to use async `import('@donotdev/auth').then(...)`.
|
|
10
|
-
*
|
|
11
|
-
* ### Why sync import is required:
|
|
12
|
-
*
|
|
13
|
-
* 1. **Bundler aliasing**: Vite/webpack alias missing packages to empty modules
|
|
14
|
-
* at BUILD TIME. The import completes immediately (no async).
|
|
15
|
-
*
|
|
16
|
-
* 2. **Rules of Hooks**: If we use async dynamic import:
|
|
17
|
-
* - First render: `realUseAuth = null` → uses stub (0 hooks)
|
|
18
|
-
* - Async completes: `realUseAuth = useAuth` → now has hooks
|
|
19
|
-
* - Next render: React sees different hook count → CRASH
|
|
20
|
-
*
|
|
21
|
-
* 3. **Monorepo gotcha**: Dynamic imports resolve workspace packages even when
|
|
22
|
-
* the consuming app doesn't have them as dependencies. This causes the
|
|
23
|
-
* real hook to activate unexpectedly → Rules of Hooks violation.
|
|
24
|
-
*
|
|
25
|
-
* 4. **Decision is immutable**: With sync import, `authModule?.useAuth` is
|
|
26
|
-
* evaluated ONCE at module load. It's either the real hook or undefined.
|
|
27
|
-
* This never changes during the app lifecycle.
|
|
28
|
-
*
|
|
29
|
-
* @see docs/development/GRACEFUL_DEGRADATION.md
|
|
30
|
-
* @version 0.0.4
|
|
31
|
-
* @since 0.0.1
|
|
32
|
-
* @author AMBROISE PARK Consulting
|
|
33
|
-
*/
|
|
34
1
|
import type { AuthAPI } from '@donotdev/core';
|
|
35
2
|
/**
|
|
36
3
|
* Safe wrapper for useAuth hook.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useAuthSafe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAuthSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useAuthSafe.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAmB9C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAKvE;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,SAAoC,CAAC"}
|
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
// packages/ui/src/utils/useAuthSafe.ts
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Safe useAuth wrapper for graceful degradation
|
|
4
|
+
* @description Provides auth functionality when @donotdev/auth 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 authModule from '@donotdev/auth'`
|
|
10
|
+
* at module level. DO NOT refactor to use async `import('@donotdev/auth').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: `realUseAuth = null` → uses stub (0 hooks)
|
|
19
|
+
* - Async completes: `realUseAuth = useAuth` → 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, `authModule?.useAuth` is
|
|
27
|
+
* 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.0.4
|
|
32
|
+
* @since 0.0.1
|
|
33
|
+
* @author AMBROISE PARK Consulting
|
|
34
|
+
*/
|
|
35
|
+
import * as authModule from '@donotdev/auth';
|
|
2
36
|
import { DEGRADED_AUTH_API } from '@donotdev/core';
|
|
3
37
|
// Sync import - bundler aliases to empty module if not installed
|
|
4
38
|
// Decision made ONCE at module load time, never changes
|
|
5
|
-
import * as authModule from '@donotdev/auth';
|
|
6
39
|
// Extract useAuth if available (undefined if package not installed/aliased)
|
|
7
40
|
const realUseAuth = authModule?.useAuth;
|
|
8
41
|
/**
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { CrudAPI, dndevSchema } from '@donotdev/core';
|
|
1
|
+
import type { CrudAPI, dndevSchema, Entity } from '@donotdev/core';
|
|
2
2
|
type BackendType = 'firestore' | 'functions';
|
|
3
|
-
interface
|
|
3
|
+
interface UseCrudSafeOptions<T> {
|
|
4
4
|
backend?: BackendType;
|
|
5
5
|
schema?: dndevSchema<T>;
|
|
6
|
+
entity?: Entity;
|
|
7
|
+
staleTime?: number;
|
|
8
|
+
noCache?: boolean;
|
|
6
9
|
}
|
|
7
10
|
/**
|
|
8
11
|
* Safe wrapper for useCrud hook.
|
|
@@ -10,17 +13,20 @@ interface UseCrudOptions<T> {
|
|
|
10
13
|
* - If @donotdev/crud installed → uses real hook (handles Firebase/consent internally)
|
|
11
14
|
* - If not installed → returns degraded API values
|
|
12
15
|
*
|
|
13
|
-
* @param
|
|
16
|
+
* @param entityOrCollection - Entity definition or collection name
|
|
14
17
|
* @param options - Options including backend type and schema
|
|
15
18
|
* @returns CRUD operations and state, or degraded API if crud unavailable
|
|
16
19
|
*
|
|
17
20
|
* @example
|
|
18
21
|
* ```typescript
|
|
19
|
-
*
|
|
20
|
-
* const {
|
|
22
|
+
* // With entity
|
|
23
|
+
* const { add, update } = useCrudSafe(carEntity);
|
|
24
|
+
*
|
|
25
|
+
* // With collection string
|
|
26
|
+
* const { get, set } = useCrudSafe('users', { schema: UserSchema });
|
|
21
27
|
* ```
|
|
22
28
|
*/
|
|
23
|
-
export declare function useCrudSafe<T = unknown>(
|
|
29
|
+
export declare function useCrudSafe<T = unknown>(entityOrCollection: Entity | string, options?: UseCrudSafeOptions<T>): CrudAPI<T>;
|
|
24
30
|
/**
|
|
25
31
|
* Check if CRUD module is available (for conditional UI rendering)
|
|
26
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrudSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useCrudSafe.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useCrudSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useCrudSafe.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAInE,KAAK,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAE7C,UAAU,kBAAkB,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,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"}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* This never changes during the app lifecycle.
|
|
30
30
|
*
|
|
31
31
|
* @see docs/development/GRACEFUL_DEGRADATION.md
|
|
32
|
-
* @version 0.0.
|
|
32
|
+
* @version 0.0.6
|
|
33
33
|
* @since 0.0.1
|
|
34
34
|
* @author AMBROISE PARK Consulting
|
|
35
35
|
*/
|
|
@@ -50,19 +50,22 @@ function useCrudStub() {
|
|
|
50
50
|
* - If @donotdev/crud installed → uses real hook (handles Firebase/consent internally)
|
|
51
51
|
* - If not installed → returns degraded API values
|
|
52
52
|
*
|
|
53
|
-
* @param
|
|
53
|
+
* @param entityOrCollection - Entity definition or collection name
|
|
54
54
|
* @param options - Options including backend type and schema
|
|
55
55
|
* @returns CRUD operations and state, or degraded API if crud unavailable
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
58
|
* ```typescript
|
|
59
|
-
*
|
|
60
|
-
* const {
|
|
59
|
+
* // With entity
|
|
60
|
+
* const { add, update } = useCrudSafe(carEntity);
|
|
61
|
+
*
|
|
62
|
+
* // With collection string
|
|
63
|
+
* const { get, set } = useCrudSafe('users', { schema: UserSchema });
|
|
61
64
|
* ```
|
|
62
65
|
*/
|
|
63
|
-
export function useCrudSafe(
|
|
66
|
+
export function useCrudSafe(entityOrCollection, options = {}) {
|
|
64
67
|
if (realUseCrud) {
|
|
65
|
-
return realUseCrud(
|
|
68
|
+
return realUseCrud(entityOrCollection, options);
|
|
66
69
|
}
|
|
67
70
|
return useCrudStub();
|
|
68
71
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Degraded FormStore state - returned when CRUD package not installed
|
|
3
|
+
* Matches FormStoreState & FormStoreActions interface
|
|
4
|
+
*/
|
|
5
|
+
declare const DEGRADED_FORM_STORE_STATE: {
|
|
6
|
+
readonly forms: {};
|
|
7
|
+
readonly startSubmit: () => void;
|
|
8
|
+
readonly setUploading: () => void;
|
|
9
|
+
readonly setValidating: () => void;
|
|
10
|
+
readonly setSubmitting: () => void;
|
|
11
|
+
readonly setSuccess: () => void;
|
|
12
|
+
readonly setError: () => void;
|
|
13
|
+
readonly reset: () => void;
|
|
14
|
+
readonly cleanup: () => void;
|
|
15
|
+
readonly setIsDirty: () => void;
|
|
16
|
+
readonly hasDirtyForms: () => boolean;
|
|
17
|
+
readonly getDirtyFormIds: () => never[];
|
|
18
|
+
readonly getStatus: () => "idle";
|
|
19
|
+
readonly isLoading: () => boolean;
|
|
20
|
+
readonly getUploadProgress: () => number;
|
|
21
|
+
readonly getError: () => null;
|
|
22
|
+
readonly getIsDirty: () => boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Check if FormStore is available
|
|
26
|
+
*/
|
|
27
|
+
export declare const isFormStoreAvailable: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Safe access to FormStore.
|
|
30
|
+
* Returns degraded state selector result if CRUD package not installed.
|
|
31
|
+
*
|
|
32
|
+
* @param selector - Zustand selector function
|
|
33
|
+
* @returns Selected state, or degraded state selection if CRUD not available
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* const hasDirtyForms = useFormStoreSafe((state) => state.hasDirtyForms());
|
|
38
|
+
* // Always safe to call - returns false when degraded
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function useFormStoreSafe<T>(selector: (state: any) => T): T;
|
|
42
|
+
export declare namespace useFormStoreSafe {
|
|
43
|
+
var getState: () => typeof DEGRADED_FORM_STORE_STATE;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if any forms are dirty (safe version).
|
|
47
|
+
* Returns false if CRUD package not available.
|
|
48
|
+
*/
|
|
49
|
+
export declare function useHasDirtyFormsSafe(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if navigation should be blocked (safe version).
|
|
52
|
+
* Returns a function that checks FormStore and shows confirmation if needed.
|
|
53
|
+
*
|
|
54
|
+
* @param message - Confirmation message
|
|
55
|
+
* @returns Promise<boolean> - true if navigation should proceed
|
|
56
|
+
*/
|
|
57
|
+
export declare function checkFormNavigationSafe(message?: string): Promise<boolean>;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=useFormStoreSafe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormStoreSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useFormStoreSafe.ts"],"names":[],"mappings":"AA8BA;;;GAGG;AACH,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;CAqBrB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,oBAAoB,SAAyC,CAAC;AAE3E;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAKlE;yBALe,gBAAgB;wBAmBA,OAAO,yBAAyB;;AAOhE;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAG9C;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,SAA4C,GAClD,OAAO,CAAC,OAAO,CAAC,CAUlB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// packages/ui/src/utils/useFormStoreSafe.ts
|
|
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.0.1
|
|
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
|
+
// Extract useFormStore if available (undefined if package not installed/aliased)
|
|
22
|
+
// Zustand stores have both the hook and getState method
|
|
23
|
+
const realUseFormStore = crudModule?.useFormStore;
|
|
24
|
+
/**
|
|
25
|
+
* Degraded FormStore state - returned when CRUD package not installed
|
|
26
|
+
* Matches FormStoreState & FormStoreActions interface
|
|
27
|
+
*/
|
|
28
|
+
const DEGRADED_FORM_STORE_STATE = {
|
|
29
|
+
forms: {},
|
|
30
|
+
// State transitions (no-ops)
|
|
31
|
+
startSubmit: () => { },
|
|
32
|
+
setUploading: () => { },
|
|
33
|
+
setValidating: () => { },
|
|
34
|
+
setSubmitting: () => { },
|
|
35
|
+
setSuccess: () => { },
|
|
36
|
+
setError: () => { },
|
|
37
|
+
reset: () => { },
|
|
38
|
+
cleanup: () => { },
|
|
39
|
+
// Dirty state management
|
|
40
|
+
setIsDirty: () => { },
|
|
41
|
+
hasDirtyForms: () => false, // Key method - returns false when degraded
|
|
42
|
+
getDirtyFormIds: () => [],
|
|
43
|
+
// Getters
|
|
44
|
+
getStatus: () => 'idle',
|
|
45
|
+
isLoading: () => false,
|
|
46
|
+
getUploadProgress: () => 0,
|
|
47
|
+
getError: () => null,
|
|
48
|
+
getIsDirty: () => false,
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Check if FormStore is available
|
|
52
|
+
*/
|
|
53
|
+
export const isFormStoreAvailable = typeof realUseFormStore === 'function';
|
|
54
|
+
/**
|
|
55
|
+
* Safe access to FormStore.
|
|
56
|
+
* Returns degraded state selector result if CRUD package not installed.
|
|
57
|
+
*
|
|
58
|
+
* @param selector - Zustand selector function
|
|
59
|
+
* @returns Selected state, or degraded state selection if CRUD not available
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* const hasDirtyForms = useFormStoreSafe((state) => state.hasDirtyForms());
|
|
64
|
+
* // Always safe to call - returns false when degraded
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export function useFormStoreSafe(selector) {
|
|
68
|
+
if (realUseFormStore) {
|
|
69
|
+
return realUseFormStore(selector);
|
|
70
|
+
}
|
|
71
|
+
return selector(DEGRADED_FORM_STORE_STATE);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get FormStore state directly (non-hook version).
|
|
75
|
+
* Use this in non-React contexts or for one-time checks.
|
|
76
|
+
*
|
|
77
|
+
* @returns FormStore state, or degraded state if CRUD not available
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* const state = useFormStoreSafe.getState();
|
|
82
|
+
* const hasDirty = state.hasDirtyForms(); // Always safe to call
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
useFormStoreSafe.getState = () => {
|
|
86
|
+
if (realUseFormStore && typeof realUseFormStore.getState === 'function') {
|
|
87
|
+
return realUseFormStore.getState();
|
|
88
|
+
}
|
|
89
|
+
return DEGRADED_FORM_STORE_STATE;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Check if any forms are dirty (safe version).
|
|
93
|
+
* Returns false if CRUD package not available.
|
|
94
|
+
*/
|
|
95
|
+
export function useHasDirtyFormsSafe() {
|
|
96
|
+
const hasDirtyForms = useFormStoreSafe((state) => state.hasDirtyForms());
|
|
97
|
+
return hasDirtyForms();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check if navigation should be blocked (safe version).
|
|
101
|
+
* Returns a function that checks FormStore and shows confirmation if needed.
|
|
102
|
+
*
|
|
103
|
+
* @param message - Confirmation message
|
|
104
|
+
* @returns Promise<boolean> - true if navigation should proceed
|
|
105
|
+
*/
|
|
106
|
+
export async function checkFormNavigationSafe(message = 'You have unsaved changes. Discard them?') {
|
|
107
|
+
const state = useFormStoreSafe.getState();
|
|
108
|
+
const hasDirtyForms = state.hasDirtyForms();
|
|
109
|
+
if (!hasDirtyForms)
|
|
110
|
+
return true; // No dirty forms = allow navigation
|
|
111
|
+
if (typeof window !== 'undefined' && window.confirm) {
|
|
112
|
+
return window.confirm(message);
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuthSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useOAuthSafe.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useOAuthSafe.d.ts","sourceRoot":"","sources":["../../src/utils/useOAuthSafe.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Safe useStripeBilling wrapper for graceful degradation
|
|
3
|
-
* @description Provides billing functionality when @donotdev/billing is installed,
|
|
4
|
-
* gracefully degrades to no-op when not installed.
|
|
5
|
-
*
|
|
6
|
-
* ## CRITICAL: DO NOT USE DYNAMIC IMPORTS
|
|
7
|
-
*
|
|
8
|
-
* This file MUST use sync `import * as billingModule from '@donotdev/billing'`
|
|
9
|
-
* at module level. DO NOT refactor to use async `import('@donotdev/billing').then(...)`.
|
|
10
|
-
*
|
|
11
|
-
* ### Why sync import is required:
|
|
12
|
-
*
|
|
13
|
-
* 1. **Bundler aliasing**: Vite/webpack alias missing packages to empty modules
|
|
14
|
-
* at BUILD TIME. The import completes immediately (no async).
|
|
15
|
-
*
|
|
16
|
-
* 2. **Rules of Hooks**: If we use async dynamic import:
|
|
17
|
-
* - First render: `realUseStripeBilling = null` → uses stub (0 hooks)
|
|
18
|
-
* - Async completes: `realUseStripeBilling = useStripeBilling` → now has hooks
|
|
19
|
-
* - Next render: React sees different hook count → CRASH
|
|
20
|
-
*
|
|
21
|
-
* 3. **Monorepo gotcha**: Dynamic imports resolve workspace packages even when
|
|
22
|
-
* the consuming app doesn't have them as dependencies. This causes the
|
|
23
|
-
* real hook to activate unexpectedly → Rules of Hooks violation.
|
|
24
|
-
*
|
|
25
|
-
* 4. **Decision is immutable**: With sync import, `billingModule?.useStripeBilling`
|
|
26
|
-
* is evaluated ONCE at module load. It's either the real hook or undefined.
|
|
27
|
-
* This never changes during the app lifecycle.
|
|
28
|
-
*
|
|
29
|
-
* @see docs/development/GRACEFUL_DEGRADATION.md
|
|
30
|
-
* @version 0.0.4
|
|
31
|
-
* @since 0.0.1
|
|
32
|
-
* @author AMBROISE PARK Consulting
|
|
33
|
-
*/
|
|
34
|
-
import type { BillingAPI } from '@donotdev/core';
|
|
35
1
|
import type { BillingAuthState } from '@donotdev/billing';
|
|
2
|
+
import type { BillingAPI } from '@donotdev/core';
|
|
36
3
|
export type { BillingAuthState } from '@donotdev/billing';
|
|
37
4
|
/**
|
|
38
5
|
* Safe wrapper for useStripeBilling hook.
|
|
@@ -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":"AAqCA,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,6 +1,39 @@
|
|
|
1
1
|
// packages/ui/src/utils/useStripeBillingSafe.ts
|
|
2
|
-
|
|
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.0.4
|
|
32
|
+
* @since 0.0.1
|
|
33
|
+
* @author AMBROISE PARK Consulting
|
|
34
|
+
*/
|
|
3
35
|
import * as billingModule from '@donotdev/billing';
|
|
36
|
+
import { DEGRADED_BILLING_API } from '@donotdev/core';
|
|
4
37
|
// Check if real hook exists (will be undefined if Vite aliased to empty module)
|
|
5
38
|
const realUseStripeBilling = billingModule?.useStripeBilling;
|
|
6
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRoutes.d.ts","sourceRoot":"","sources":["../../src/vite-routing/AppRoutes.tsx"],"names":[],"mappings":"AAoDA,OAAO,
|
|
1
|
+
{"version":3,"file":"AppRoutes.d.ts","sourceRoot":"","sources":["../../src/vite-routing/AppRoutes.tsx"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAyF7D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC,CAAC;CACJ;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,yCA8D9D"}
|
|
@@ -48,7 +48,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
48
48
|
*/
|
|
49
49
|
import { lazy, Suspense } from 'react';
|
|
50
50
|
import { createBrowserRouter } from 'react-router-dom';
|
|
51
|
-
import {} from '@donotdev/core';
|
|
52
51
|
import { RootLayout } from './RootLayout';
|
|
53
52
|
import Loader from '../components/common/Loader';
|
|
54
53
|
import { AuthGuard } from '../routing/AuthGuard';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../src/vite-routing/RootLayout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../src/vite-routing/RootLayout.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA0LnD;;GAEG;AACH,UAAU,oBAAoB;IAC5B,2BAA2B;IAC3B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,oBAAoB,2CAgC1D"}
|
|
@@ -12,11 +12,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
12
12
|
* @since 0.0.1
|
|
13
13
|
* @author AMBROISE PARK Consulting
|
|
14
14
|
*/
|
|
15
|
-
import { Suspense, lazy, useEffect, useRef } from 'react';
|
|
16
|
-
import { useLayoutEffect } from 'react';
|
|
15
|
+
import { Suspense, lazy, useEffect, useLayoutEffect, useRef } from 'react';
|
|
17
16
|
import { Outlet, useLocation } from 'react-router-dom';
|
|
18
|
-
import { globalEmitter, isClient } from '@donotdev/core';
|
|
19
|
-
import Loader from '../components/common/Loader';
|
|
17
|
+
import { globalEmitter, isClient, QueryProviders } from '@donotdev/core';
|
|
20
18
|
import { DnDevLayout } from '../internal/layout/DnDevLayout';
|
|
21
19
|
import { UIProviders } from '../internal/providers/UIProviders';
|
|
22
20
|
// Only lazy load non-critical components (not in render path)
|
|
@@ -65,7 +63,6 @@ function CustomScrollRestoration() {
|
|
|
65
63
|
return;
|
|
66
64
|
// Save current scroll position before navigating
|
|
67
65
|
const currentKey = location.key;
|
|
68
|
-
const currentScroll = mainElement.scrollTop;
|
|
69
66
|
// Check if this is a back/forward navigation (location.state can indicate this)
|
|
70
67
|
// For now, we'll use a simple heuristic: if we have a saved position, it's likely POP
|
|
71
68
|
const savedPosition = scrollPositions.current.get(currentKey);
|
|
@@ -209,5 +206,5 @@ function RouteReadySignal({ children }) {
|
|
|
209
206
|
* @author AMBROISE PARK Consulting
|
|
210
207
|
*/
|
|
211
208
|
export function RootLayout({ layout }) {
|
|
212
|
-
return (_jsxs(UIProviders, { children: [_jsx(Suspense, { fallback: null, children: _jsx(AutoMetaTags, {}) }), _jsxs(FrameworkReadySignal, { children: [_jsx(DnDevLayout, { layout: layout, children: _jsx(RouteReadySignal, { children: _jsx(Outlet, {}) }) }), _jsx(CustomScrollRestoration, {}), _jsxs(Suspense, { fallback: null, children: [_jsx(ConsentBanner, {}), _jsx(PWAUpdateNotification, {}), _jsx(LicenseWatermark, {}), _jsx(RedirectOverlay, {})] })] })] }));
|
|
209
|
+
return (_jsx(QueryProviders, { children: _jsxs(UIProviders, { children: [_jsx(Suspense, { fallback: null, children: _jsx(AutoMetaTags, {}) }), _jsxs(FrameworkReadySignal, { children: [_jsx(DnDevLayout, { layout: layout, children: _jsx(RouteReadySignal, { children: _jsx(Outlet, {}) }) }), _jsx(CustomScrollRestoration, {}), _jsxs(Suspense, { fallback: null, children: [_jsx(ConsentBanner, {}), _jsx(PWAUpdateNotification, {}), _jsx(LicenseWatermark, {}), _jsx(RedirectOverlay, {})] })] })] }) }));
|
|
213
210
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"@donotdev/adv-comps": "^0.0.8",
|
|
56
56
|
"@donotdev/auth": "^0.0.5",
|
|
57
57
|
"@donotdev/billing": "^0.0.5",
|
|
58
|
-
"@donotdev/components": "^0.0.
|
|
59
|
-
"@donotdev/core": "^0.0.
|
|
60
|
-
"@donotdev/crud": "^0.0.
|
|
61
|
-
"@donotdev/firebase": "^0.0.
|
|
58
|
+
"@donotdev/components": "^0.0.13",
|
|
59
|
+
"@donotdev/core": "^0.0.17",
|
|
60
|
+
"@donotdev/crud": "^0.0.8",
|
|
61
|
+
"@donotdev/firebase": "^0.0.6",
|
|
62
62
|
"@donotdev/oauth": "^0.0.5",
|
|
63
63
|
"firebase": "^12.5.0",
|
|
64
64
|
"lucide-react": "^0.562.0",
|