@donotdev/ui 0.0.2 → 0.0.3

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.
Files changed (104) hide show
  1. package/dist/components/auth/AuthMenu.d.ts.map +1 -1
  2. package/dist/components/auth/AuthMenu.js +15 -28
  3. package/dist/components/common/FeatureCard.js +1 -1
  4. package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
  5. package/dist/components/cookie-consent/CookieConsent.js +2 -41
  6. package/dist/components/cookie-consent/index.d.ts +0 -1
  7. package/dist/components/cookie-consent/index.d.ts.map +1 -1
  8. package/dist/components/cookie-consent/index.js +1 -1
  9. package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
  10. package/dist/components/layout/components/header/ThemeToggle.d.ts +1 -1
  11. package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
  12. package/dist/components/layout/components/header/ThemeToggle.js +5 -4
  13. package/dist/dndev.css +137 -120
  14. package/dist/index.js +4 -4
  15. package/dist/internal/devtools/DebugTools.d.ts.map +1 -1
  16. package/dist/internal/devtools/DebugTools.js +8 -4
  17. package/dist/internal/devtools/components/ConfigTab.d.ts.map +1 -1
  18. package/dist/internal/devtools/components/ConfigTab.js +31 -133
  19. package/dist/internal/devtools/components/DebugDialog.d.ts.map +1 -1
  20. package/dist/internal/devtools/components/DebugDialog.js +11 -520
  21. package/dist/internal/devtools/components/DesignTab.d.ts +2 -0
  22. package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -0
  23. package/dist/internal/devtools/components/DesignTab.js +220 -0
  24. package/dist/internal/devtools/components/StoresTab.d.ts.map +1 -1
  25. package/dist/internal/devtools/components/StoresTab.js +54 -102
  26. package/dist/internal/devtools/components/index.d.ts +1 -6
  27. package/dist/internal/devtools/components/index.d.ts.map +1 -1
  28. package/dist/internal/devtools/components/index.js +1 -6
  29. package/dist/internal/devtools/utils/index.d.ts +0 -1
  30. package/dist/internal/devtools/utils/index.d.ts.map +1 -1
  31. package/dist/internal/devtools/utils/index.js +0 -1
  32. package/dist/internal/initializers/BaseStoresInitializer.d.ts.map +1 -1
  33. package/dist/internal/initializers/BaseStoresInitializer.js +25 -58
  34. package/dist/internal/layout/DnDevLayout.js +3 -3
  35. package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
  36. package/dist/internal/layout/components/footer/FooterBranding.js +3 -1
  37. package/dist/routing/AuthGuard.d.ts +14 -10
  38. package/dist/routing/AuthGuard.d.ts.map +1 -1
  39. package/dist/routing/AuthGuard.js +25 -22
  40. package/dist/routing/Link.d.ts +2 -2
  41. package/dist/routing/Link.js +2 -2
  42. package/dist/routing/hooks/hooks.next.js +1 -1
  43. package/dist/routing/hooks/hooks.vite.js +1 -1
  44. package/dist/routing/hooks/useRedirectGuard.next.d.ts +2 -36
  45. package/dist/routing/hooks/useRedirectGuard.next.d.ts.map +1 -1
  46. package/dist/routing/hooks/useRedirectGuard.next.js +14 -55
  47. package/dist/routing/hooks/useRedirectGuard.vite.d.ts +2 -36
  48. package/dist/routing/hooks/useRedirectGuard.vite.d.ts.map +1 -1
  49. package/dist/routing/hooks/useRedirectGuard.vite.js +14 -55
  50. package/dist/routing/index.d.ts +0 -1
  51. package/dist/routing/index.d.ts.map +1 -1
  52. package/dist/routing/index.js +1 -1
  53. package/dist/styles/index.css +137 -120
  54. package/dist/utils/assetResolver.d.ts +5 -5
  55. package/dist/utils/assetResolver.js +4 -4
  56. package/dist/utils/useAuthSafe.d.ts +25 -12
  57. package/dist/utils/useAuthSafe.d.ts.map +1 -1
  58. package/dist/utils/useAuthSafe.js +3 -1
  59. package/dist/utils/useAuthVisibility.d.ts +3 -3
  60. package/dist/utils/useAuthVisibility.d.ts.map +1 -1
  61. package/dist/utils/useAuthVisibility.js +25 -21
  62. package/dist/utils/useBillingVisibility.d.ts +2 -2
  63. package/dist/utils/useBillingVisibility.d.ts.map +1 -1
  64. package/dist/utils/useBillingVisibility.js +12 -13
  65. package/dist/utils/useCrudSafe.d.ts +1 -1
  66. package/dist/utils/useCrudSafe.d.ts.map +1 -1
  67. package/dist/utils/useCrudSafe.js +26 -13
  68. package/dist/utils/useOAuthSafe.d.ts +25 -12
  69. package/dist/utils/useOAuthSafe.d.ts.map +1 -1
  70. package/dist/utils/useStripeBillingSafe.d.ts +30 -18
  71. package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
  72. package/dist/utils/useStripeBillingSafe.js +5 -6
  73. package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
  74. package/dist/vite-routing/AppRoutes.js +5 -5
  75. package/dist/vite-routing/RootLayout.d.ts.map +1 -1
  76. package/dist/vite-routing/RootLayout.js +34 -7
  77. package/package.json +9 -9
  78. package/dist/internal/devtools/components/AuthTab.d.ts +0 -2
  79. package/dist/internal/devtools/components/AuthTab.d.ts.map +0 -1
  80. package/dist/internal/devtools/components/AuthTab.js +0 -98
  81. package/dist/internal/devtools/components/ColorRatioTab.d.ts +0 -2
  82. package/dist/internal/devtools/components/ColorRatioTab.d.ts.map +0 -1
  83. package/dist/internal/devtools/components/ColorRatioTab.js +0 -322
  84. package/dist/internal/devtools/components/DebugToggle.d.ts +0 -2
  85. package/dist/internal/devtools/components/DebugToggle.d.ts.map +0 -1
  86. package/dist/internal/devtools/components/DebugToggle.js +0 -57
  87. package/dist/internal/devtools/components/EnvironmentTab.d.ts +0 -2
  88. package/dist/internal/devtools/components/EnvironmentTab.d.ts.map +0 -1
  89. package/dist/internal/devtools/components/EnvironmentTab.js +0 -26
  90. package/dist/internal/devtools/components/I18nTab.d.ts +0 -2
  91. package/dist/internal/devtools/components/I18nTab.d.ts.map +0 -1
  92. package/dist/internal/devtools/components/I18nTab.js +0 -76
  93. package/dist/internal/devtools/components/OAuthGuideButton.d.ts +0 -10
  94. package/dist/internal/devtools/components/OAuthGuideButton.d.ts.map +0 -1
  95. package/dist/internal/devtools/components/OAuthGuideButton.js +0 -71
  96. package/dist/internal/devtools/components/StripeDebugTab.d.ts +0 -2
  97. package/dist/internal/devtools/components/StripeDebugTab.d.ts.map +0 -1
  98. package/dist/internal/devtools/components/StripeDebugTab.js +0 -175
  99. package/dist/internal/devtools/components/ThemesTab.d.ts +0 -2
  100. package/dist/internal/devtools/components/ThemesTab.d.ts.map +0 -1
  101. package/dist/internal/devtools/components/ThemesTab.js +0 -77
  102. package/dist/internal/devtools/utils/spacingAnalyzer.d.ts +0 -15
  103. package/dist/internal/devtools/utils/spacingAnalyzer.d.ts.map +0 -1
  104. package/dist/internal/devtools/utils/spacingAnalyzer.js +0 -88
@@ -1,71 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- // packages/ui/src/internal/devtools/components/OAuthGuideButton.tsx
4
- /**
5
-
6
- * @fileoverview OAuth Setup Guide Button Component
7
-
8
- * @description Shows OAuth setup instructions in a compact format for developers
9
-
10
- *
11
-
12
- * @version 0.0.1
13
-
14
- * @since 0.0.1
15
-
16
- * @author AMBROISE PARK Consulting
17
-
18
- */
19
- import { useState } from 'react';
20
- import { Stack } from '@donotdev/components';
21
- /**
22
-
23
- * OAuth Setup Guide Button Component
24
-
25
- * Shows OAuth setup instructions in a compact format
26
-
27
- */
28
- export const OAuthGuideButton = () => {
29
- const [isExpanded, setIsExpanded] = useState(false);
30
- return (_jsxs("div", { className: "dndev-relative", children: [_jsx("button", { onClick: () => setIsExpanded(!isExpanded), style: {
31
- padding: 'var(--gap-sm) var(--gap-md)',
32
- borderRadius: 'var(--radius-lg)',
33
- fontFamily: 'monospace',
34
- backgroundColor: 'rgb(59 130 246 / 0.2)',
35
- transition: 'background-color var(--duration-normal)',
36
- }, onMouseEnter: (e) => {
37
- e.currentTarget.style.backgroundColor = 'rgb(59 130 246 / 0.3)';
38
- }, onMouseLeave: (e) => {
39
- e.currentTarget.style.backgroundColor = 'rgb(59 130 246 / 0.2)';
40
- }, title: "OAuth Setup Guide", children: "\uD83D\uDD27 OAuth" }), isExpanded && (_jsxs("div", { className: "dndev-absolute", style: {
41
- bottom: '100%',
42
- right: 0,
43
- zIndex: 'calc(var(--z-toast) + 100)',
44
- marginBottom: 'var(--gap-sm)',
45
- padding: 'var(--gap-md)',
46
- backgroundColor: '#fff',
47
- border: '1px solid rgb(229 231 235)',
48
- borderRadius: 'var(--radius-lg)',
49
- boxShadow: 'var(--shadow-xl)',
50
- maxWidth: '28rem',
51
- }, children: [_jsx("h3", { style: {
52
- marginBottom: 'var(--gap-md)',
53
- color: 'rgb(17 24 39)',
54
- }, children: "OAuth Setup Guide" }), _jsxs(Stack, { direction: "row", gap: "tight", children: [_jsxs("div", { children: [_jsx("h4", { style: {
55
- color: 'rgb(31 41 55)',
56
- marginBottom: 'var(--gap-sm)',
57
- }, children: "1. Firebase Console" }), _jsxs(Stack, { as: "ol", gap: "tight", className: "list-decimal list-inside", style: { color: 'var(--muted-foreground)' }, children: [_jsxs("li", { children: ["Go to", ' ', _jsx("a", { href: "https://console.firebase.google.com", target: "_blank", rel: "noopener noreferrer", style: { color: 'rgb(37 99 235)' }, onMouseEnter: (e) => (e.currentTarget.style.textDecoration = 'underline'), onMouseLeave: (e) => (e.currentTarget.style.textDecoration = 'none'), children: "Firebase Console" })] }), _jsx("li", { children: "Authentication \u2192 Sign-in method" }), _jsx("li", { children: "Enable Google, GitHub, etc." })] })] }), _jsxs("div", { children: [_jsx("h4", { style: {
58
- color: 'rgb(31 41 55)',
59
- marginBottom: 'var(--gap-sm)',
60
- }, children: "2. GitHub OAuth" }), _jsxs(Stack, { as: "ol", gap: "tight", className: "list-decimal list-inside", style: { color: 'var(--muted-foreground)' }, children: [_jsxs("li", { children: ["Create OAuth App at", ' ', _jsx("a", { href: "https://github.com/settings/applications/new", target: "_blank", rel: "noopener noreferrer", style: { color: 'rgb(37 99 235)' }, onMouseEnter: (e) => (e.currentTarget.style.textDecoration = 'underline'), onMouseLeave: (e) => (e.currentTarget.style.textDecoration = 'none'), children: "GitHub" })] }), _jsxs("li", { children: ["Callback URL:", ' ', _jsx("code", { style: {
61
- backgroundColor: 'var(--muted)',
62
- padding: '0 var(--gap-sm)',
63
- }, children: "https://your-project.firebaseapp.com/__/auth/handler" })] }), _jsx("li", { children: "Copy Client ID/Secret to Firebase" })] })] }), _jsxs("div", { children: [_jsx("h4", { style: {
64
- color: 'rgb(31 41 55)',
65
- marginBottom: 'var(--gap-sm)',
66
- }, children: "3. Authorized Domains" }), _jsx("p", { style: { color: 'rgb(55 65 81)' }, children: "Add localhost, your-domain.com to Firebase Console \u2192 Authentication \u2192 Settings" })] }), _jsx("div", { style: {
67
- border: '1px solid var(--warning)',
68
- padding: 'var(--gap-sm)',
69
- color: 'var(--warning)',
70
- }, children: _jsxs("p", { children: [_jsx("strong", { children: "Note:" }), " 400 error = GitHub OAuth not configured in Firebase"] }) })] })] }))] }));
71
- };
@@ -1,2 +0,0 @@
1
- export declare const StripeDebugTab: () => import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=StripeDebugTab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StripeDebugTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/StripeDebugTab.tsx"],"names":[],"mappings":"AAiDA,eAAO,MAAM,cAAc,+CAyhB1B,CAAC"}
@@ -1,175 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- // packages/ui/src/internal/devtools/components/StripeDebugTab.tsx
4
- /**
5
- * @fileoverview Stripe Debug Tab Component
6
- * @description Debug panel for testing Stripe integration with dynamic key configuration and emulator support
7
- *
8
- * @version 0.0.1
9
- * @since 0.0.1
10
- * @author AMBROISE PARK Consulting
11
- */
12
- import { CheckCircle2, AlertCircle, Loader2 } from 'lucide-react';
13
- import { useState, useEffect, useMemo } from 'react';
14
- import { Card, Button, BUTTON_VARIANT, Input, Label, Badge, BADGE_VARIANT, Alert, ALERT_VARIANT, DescriptionList, Text, Stack, } from '@donotdev/components';
15
- import { getDndevConfig, getPlatformEnvVar, useFeatureConsent, FRAMEWORK_FEATURES, } from '@donotdev/core';
16
- import { useAuthSafe, useStripeBillingSafe } from '../../../utils';
17
- import { isBillingAvailable } from '../../../utils/useStripeBillingSafe';
18
- import { discoverEnvVarsByPattern, findFirstEnvVarByPattern, } from '../utils/envVarDiscovery';
19
- import { maskSensitiveValue } from '../utils/maskSensitive';
20
- import { MaskedValue } from './MaskedValue';
21
- export const StripeDebugTab = () => {
22
- // Get auth state for billing (required for isAvailable to work)
23
- const user = useAuthSafe('user');
24
- const initialized = useAuthSafe('initialized');
25
- const authStateChecked = useAuthSafe('authStateChecked');
26
- const authState = { user, initialized, authStateChecked };
27
- const checkout = useStripeBillingSafe('checkout', authState);
28
- const loading = useStripeBillingSafe('loading', authState);
29
- const error = useStripeBillingSafe('error', authState);
30
- const isAvailable = useStripeBillingSafe('isAvailable', authState);
31
- const [overrides, setOverrides] = useState({});
32
- const [testResult, setTestResult] = useState(null);
33
- const [emulatorStatus, setEmulatorStatus] = useState(null);
34
- // Detect emulator status
35
- useEffect(() => {
36
- const useEmulator = getPlatformEnvVar('USE_FIREBASE_EMULATOR') === 'true';
37
- const emulatorHost = getPlatformEnvVar('FIREBASE_EMULATOR_HOST') || 'localhost';
38
- const emulatorPort = getPlatformEnvVar('FIREBASE_FUNCTIONS_EMULATOR_PORT') || '5001';
39
- setEmulatorStatus({
40
- enabled: useEmulator,
41
- host: useEmulator ? emulatorHost : undefined,
42
- port: useEmulator ? emulatorPort : undefined,
43
- });
44
- }, []);
45
- const config = getDndevConfig();
46
- const envVars = config?.env || {};
47
- const stripeVars = useMemo(() => discoverEnvVarsByPattern(envVars, ['*STRIPE*']), [envVars]);
48
- const currentPublishableKey = findFirstEnvVarByPattern(envVars, [
49
- '*STRIPE*PUBLISHABLE*',
50
- '*STRIPE*KEY*',
51
- '*PUBLISHABLE*KEY*',
52
- ]) || '';
53
- const priceIdVars = discoverEnvVarsByPattern(envVars, [
54
- '*STRIPE*PRICE*',
55
- '*PRICE*ID*',
56
- '*PRICE_ID*',
57
- ]);
58
- const currentPriceId = Object.values(priceIdVars)[0] || '';
59
- const effectivePublishableKey = overrides.publishableKey || currentPublishableKey;
60
- const effectivePriceId = overrides.priceId || currentPriceId;
61
- const handleTestCheckout = async () => {
62
- if (!user) {
63
- setTestResult({
64
- success: false,
65
- message: 'Please sign in to test checkout',
66
- });
67
- return;
68
- }
69
- if (!effectivePriceId) {
70
- setTestResult({
71
- success: false,
72
- message: 'No price ID configured. Please set a price ID.',
73
- });
74
- return;
75
- }
76
- setTestResult(null);
77
- try {
78
- const result = await checkout({
79
- priceId: effectivePriceId,
80
- mode: 'payment',
81
- allowPromotionCodes: true,
82
- });
83
- if (result.sessionUrl) {
84
- setTestResult({
85
- success: true,
86
- message: 'Checkout session created successfully!',
87
- sessionUrl: result.sessionUrl,
88
- });
89
- }
90
- else {
91
- setTestResult({
92
- success: false,
93
- message: 'No session URL received',
94
- });
95
- }
96
- }
97
- catch (err) {
98
- setTestResult({
99
- success: false,
100
- message: err instanceof Error
101
- ? err.message
102
- : 'Checkout failed with unknown error',
103
- });
104
- }
105
- };
106
- const clearOverrides = () => {
107
- setOverrides({});
108
- setTestResult(null);
109
- };
110
- const quickFillTestCard = () => {
111
- setOverrides({
112
- ...overrides,
113
- publishableKey: 'pk_test_42424242424242424242424242424242',
114
- });
115
- };
116
- const testCardItems = [
117
- {
118
- label: 'Success',
119
- value: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: "4242 4242 4242 4242" })),
120
- },
121
- {
122
- label: 'Decline',
123
- value: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: "4000 0000 0000 0002" })),
124
- },
125
- {
126
- label: '3D Secure',
127
- value: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: "4000 0025 0000 3155" })),
128
- },
129
- ];
130
- const canProceed = useFeatureConsent(FRAMEWORK_FEATURES.BILLING);
131
- const stripePublishableKey = getPlatformEnvVar('STRIPE_PUBLISHABLE_KEY');
132
- const billingEnabled = getPlatformEnvVar('BILLING_ENABLED');
133
- return (_jsxs(Stack, { gap: "large", children: [_jsx(Card, { title: "Billing Module Status", subtitle: "Why billing might be in stub mode", children: _jsxs(Stack, { gap: "medium", children: [_jsx(DescriptionList, { items: [
134
- {
135
- label: 'Module Installed',
136
- value: (_jsx(Badge, { variant: isBillingAvailable
137
- ? BADGE_VARIANT.DEFAULT
138
- : BADGE_VARIANT.DESTRUCTIVE, children: isBillingAvailable ? '✅ Yes' : '❌ No' })),
139
- },
140
- {
141
- label: 'isAvailable (hook)',
142
- value: (_jsx(Badge, { variant: isAvailable
143
- ? BADGE_VARIANT.DEFAULT
144
- : BADGE_VARIANT.DESTRUCTIVE, children: isAvailable ? '✅ Yes' : '❌ No' })),
145
- },
146
- {
147
- label: 'Feature Consent',
148
- value: (_jsx(Badge, { variant: canProceed
149
- ? BADGE_VARIANT.DEFAULT
150
- : BADGE_VARIANT.DESTRUCTIVE, children: canProceed ? '✅ Yes' : '❌ No' })),
151
- },
152
- {
153
- label: 'STRIPE_PUBLISHABLE_KEY',
154
- value: stripePublishableKey ? (_jsx(MaskedValue, { keyName: "STRIPE_PUBLISHABLE_KEY", value: stripePublishableKey, textClassName: "dndev-font-mono dndev-text-xs dndev-text-muted-foreground" })) : (_jsx(Badge, { variant: BADGE_VARIANT.DESTRUCTIVE, children: "Not Set" })),
155
- },
156
- {
157
- label: 'BILLING_ENABLED',
158
- value: billingEnabled ? (_jsx(Badge, { variant: billingEnabled === 'true'
159
- ? BADGE_VARIANT.DEFAULT
160
- : BADGE_VARIANT.SECONDARY, children: billingEnabled })) : (_jsx(Badge, { variant: BADGE_VARIANT.OUTLINE, children: "Not Set" })),
161
- },
162
- ] }), !isBillingAvailable && (_jsxs(Alert, { variant: ALERT_VARIANT.WARNING, children: [_jsx("strong", { children: "Billing module not installed." }), " This means billing is in stub mode. Check:", _jsxs("ul", { className: "dndev-mt-sm dndev-list-disc dndev-list-inside dndev-text-sm", children: [_jsx("li", { children: "Is @donotdev/billing installed in package.json?" }), _jsx("li", { children: "Check browser console for import errors" })] })] })), isBillingAvailable && !isAvailable && (_jsxs(Alert, { variant: ALERT_VARIANT.ERROR, children: [_jsx("strong", { children: "Billing module installed but not available." }), ' ', "Feature detection failed. Check:", _jsxs("ul", { className: "dndev-mt-sm dndev-list-disc dndev-list-inside dndev-text-sm", children: [_jsxs("li", { children: [_jsx("strong", { children: "STRIPE_PUBLISHABLE_KEY" }), " must be set (with VITE_ or NEXT_PUBLIC_ prefix)"] }), _jsxs("li", { children: ["Feature Consent (canProceed): ", canProceed ? 'Yes' : 'No'] }), !stripePublishableKey && (_jsx("li", { className: "dndev-text-destructive dndev-font-semibold", children: "\u2192 Set VITE_STRIPE_PUBLISHABLE_KEY or NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY in your .env file" }))] })] }))] }) }), _jsx(Card, { title: "Current Configuration", subtitle: "Stripe environment variables detected", children: _jsx(Stack, { gap: "medium", children: Object.keys(stripeVars).length === 0 ? (_jsx(Alert, { variant: ALERT_VARIANT.WARNING, children: "No Stripe environment variables detected. Add variables matching pattern *STRIPE* to your configuration." })) : (_jsxs(_Fragment, { children: [_jsxs(Stack, { gap: "tight", children: [_jsx(Label, { children: "Publishable Key" }), _jsx(Input, { value: currentPublishableKey
163
- ? `${maskSensitiveValue(currentPublishableKey)} (masked)`
164
- : '', readOnly: true, className: "dndev-font-mono dndev-text-xs", placeholder: "Not configured" }), currentPublishableKey && (_jsx(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground", children: "Detected from environment variables" }))] }), _jsxs(Stack, { gap: "tight", children: [_jsx(Label, { children: "Price ID" }), _jsx(Input, { value: currentPriceId, readOnly: true, className: "dndev-font-mono dndev-text-xs", placeholder: "Not configured" }), currentPriceId && (_jsx(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground", children: "Detected from environment variables" }))] }), Object.keys(stripeVars).length > 2 && (_jsxs(Stack, { gap: "tight", children: [_jsx(Label, { children: "All Stripe Variables" }), _jsxs(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground", children: [Object.keys(stripeVars).length, " Stripe-related variables detected"] })] }))] })) }) }), _jsx(Card, { title: "Runtime Overrides", subtitle: "Override keys for testing (not persistent, cleared on refresh)", children: _jsxs(Stack, { gap: "medium", children: [_jsxs(Stack, { gap: "tight", children: [_jsx(Label, { children: "Override Publishable Key" }), _jsxs(Stack, { direction: "row", gap: "tight", children: [_jsx(Input, { value: overrides.publishableKey || '', onChange: (e) => setOverrides({
165
- ...overrides,
166
- publishableKey: e.target.value,
167
- }), className: "dndev-font-mono dndev-text-xs", placeholder: currentPublishableKey || 'pk_test_...' }), _jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, onClick: quickFillTestCard, title: "Quick fill test key", children: "Test Key" })] }), overrides.publishableKey && (_jsxs(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground", children: ["Override active: ", maskSensitiveValue(overrides.publishableKey), ' ', "(masked)"] }))] }), _jsxs(Stack, { gap: "tight", children: [_jsx(Label, { children: "Override Price ID" }), _jsx(Input, { value: overrides.priceId || '', onChange: (e) => setOverrides({
168
- ...overrides,
169
- priceId: e.target.value,
170
- }), className: "dndev-font-mono dndev-text-xs", placeholder: currentPriceId || 'price_...' }), overrides.priceId && (_jsxs(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground", children: ["Override active: ", overrides.priceId] }))] }), (overrides.publishableKey || overrides.priceId) && (_jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, onClick: clearOverrides, children: "Clear Overrides" }))] }) }), _jsx(Card, { title: "Emulator Status", subtitle: "Firebase Functions emulator connection status", children: emulatorStatus ? (_jsxs(Stack, { gap: "tight", children: [_jsx(Stack, { direction: "row", align: "center", gap: "tight", children: emulatorStatus.enabled ? (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "dndev-size-md dndev-text-success" }), _jsx("span", { children: "Emulator Enabled" }), _jsx(Badge, { children: "Active" })] })) : (_jsxs(_Fragment, { children: [_jsx(AlertCircle, { className: "dndev-size-md dndev-text-warning" }), _jsx("span", { children: "Emulator Disabled" }), _jsx(Badge, { variant: BADGE_VARIANT.SECONDARY, children: "Production" })] })) }), emulatorStatus.enabled && (_jsxs(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground dndev-font-mono dndev-ml-md", children: ["Host: ", emulatorStatus.host, _jsx("br", {}), "Port: ", emulatorStatus.port] }))] })) : (_jsx(Text, { as: "span", className: "dndev-text-sm dndev-text-muted-foreground", children: "Checking status..." })) }), _jsx(Card, { title: "Test Checkout", subtitle: "Test the checkout flow with current configuration", children: _jsxs(Stack, { gap: "medium", children: [_jsxs(Stack, { gap: "tight", children: [_jsx(Label, { children: "Effective Price ID" }), _jsx(Input, { value: effectivePriceId, readOnly: true, className: "dndev-font-mono dndev-text-xs", placeholder: "No price ID configured" }), _jsx(Text, { className: "dndev-text-xs dndev-text-muted-foreground", children: overrides.priceId
171
- ? 'Using override'
172
- : currentPriceId
173
- ? 'Using environment variable'
174
- : 'No price ID available' })] }), !isAvailable && (_jsx(Alert, { variant: ALERT_VARIANT.WARNING, children: "Billing is not available. Please check feature consent." })), !user && (_jsx(Alert, { variant: ALERT_VARIANT.WARNING, children: "Please sign in to test checkout" })), _jsx(Button, { onClick: handleTestCheckout, disabled: loading || !user || !effectivePriceId || !isAvailable, className: "dndev-w-full", icon: loading ? Loader2 : undefined, children: loading ? 'Creating checkout session...' : 'Test Checkout' }), error && _jsx(Alert, { variant: ALERT_VARIANT.ERROR, children: error }), testResult && (_jsx(Alert, { variant: testResult.success ? ALERT_VARIANT.SUCCESS : ALERT_VARIANT.ERROR, children: _jsxs("div", { className: "dndev-grid dndev-gap-sm", children: [_jsx("div", { children: testResult.message }), testResult.sessionUrl && (_jsx("a", { href: testResult.sessionUrl, target: "_blank", rel: "noopener noreferrer", className: "dndev-text-xs dndev-text-primary dndev-underline", children: "Open checkout session \u2192" }))] }) }))] }) }), _jsx(Card, { title: "Test Cards", subtitle: "Use these test card numbers in Stripe test mode", children: _jsxs(Stack, { gap: "medium", children: [_jsx(DescriptionList, { items: testCardItems }), _jsx(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground", children: "Use any future expiry date, any CVC, and any ZIP code" })] }) })] }));
175
- };
@@ -1,2 +0,0 @@
1
- export declare const ThemesTab: () => import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=ThemesTab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemesTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/ThemesTab.tsx"],"names":[],"mappings":"AA0BA,eAAO,MAAM,SAAS,+CAiJrB,CAAC"}
@@ -1,77 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- // packages/ui/src/internal/devtools/components/ThemesTab.tsx
4
- /**
5
- * @fileoverview Themes Tab Component
6
- * @description Displays theme store state and available themes
7
- *
8
- * @version 0.0.1
9
- * @since 0.0.1
10
- * @author AMBROISE PARK Consulting
11
- */
12
- import { Card, CARD_VARIANT, DescriptionList, Text, Badge, BADGE_VARIANT, Alert, ALERT_VARIANT, Stack, } from '@donotdev/components';
13
- import { useTheme, useThemeReady } from '@donotdev/core';
14
- import { getThemesConfig } from '@donotdev/core';
15
- export const ThemesTab = () => {
16
- const currentTheme = useTheme('currentTheme');
17
- const availableThemes = useTheme('availableThemes');
18
- const isDarkMode = useTheme('isDarkMode');
19
- const themeMode = useTheme('themeMode');
20
- const error = useTheme('error');
21
- const isReady = useThemeReady();
22
- const themesConfig = getThemesConfig();
23
- const currentThemeInfo = availableThemes.find((theme) => theme.name === currentTheme);
24
- const currentThemeItems = [
25
- {
26
- label: 'Current Theme',
27
- value: _jsx(Text, { className: "dndev-font-mono", children: currentTheme }),
28
- },
29
- {
30
- label: 'Theme Mode',
31
- value: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: themeMode })),
32
- },
33
- {
34
- label: 'Dark Mode',
35
- value: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: isDarkMode ? 'Yes' : 'No' })),
36
- },
37
- {
38
- label: 'Ready',
39
- value: _jsx(Text, { className: "dndev-font-mono", children: isReady ? 'Yes' : 'No' }),
40
- },
41
- ...(currentThemeInfo
42
- ? [
43
- {
44
- label: 'Display Name',
45
- value: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: currentThemeInfo.displayName })),
46
- },
47
- {
48
- label: 'Category',
49
- value: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: currentThemeInfo.meta?.category || 'N/A' })),
50
- },
51
- ]
52
- : []),
53
- ];
54
- const configItems = themesConfig?.discovered || themesConfig?.manifest
55
- ? [
56
- ...(themesConfig.discovered
57
- ? [
58
- {
59
- label: 'Discovered Themes',
60
- value: (_jsxs(Text, { as: "span", className: "dndev-font-mono", children: [themesConfig.discovered.length, " themes"] })),
61
- },
62
- ]
63
- : []),
64
- ...(themesConfig.manifest
65
- ? [
66
- {
67
- label: 'Total Themes',
68
- value: (_jsxs(Text, { className: "dndev-font-mono", children: [themesConfig.manifest.totalThemes || 0, " themes"] })),
69
- },
70
- ]
71
- : []),
72
- ]
73
- : [];
74
- return (_jsxs(Stack, { gap: "medium", children: [_jsx(Card, { title: "Current Theme", subtitle: "Active theme state", children: _jsxs(Stack, { gap: "medium", children: [_jsx(DescriptionList, { items: currentThemeItems }), error && _jsxs(Alert, { variant: ALERT_VARIANT.ERROR, children: ["Error: ", error] })] }) }), _jsx(Card, { title: "Available Themes", subtitle: `${availableThemes.length} theme${availableThemes.length !== 1 ? 's' : ''} discovered`, children: _jsx(Stack, { gap: "tight", children: availableThemes.map((theme) => (_jsx(Card, { variant: theme.name === currentTheme
75
- ? CARD_VARIANT.ACCENT
76
- : CARD_VARIANT.DEFAULT, children: _jsxs(Stack, { direction: "row", align: "center", justify: "between", children: [_jsxs("div", { children: [_jsx(Text, { as: "span", className: "dndev-font-semibold", children: String(theme.displayName || theme.name) }), _jsx(Text, { as: "span", className: "dndev-text-xs dndev-text-muted-foreground dndev-font-mono", children: theme.name })] }), _jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [theme.isDark && (_jsx(Badge, { variant: BADGE_VARIANT.SECONDARY, children: "Dark" })), theme.name === currentTheme && _jsx(Badge, { children: "Active" })] })] }) }, theme.name))) }) }), themesConfig && configItems.length > 0 && (_jsx(Card, { title: "Config", subtitle: "Theme configuration from build", children: _jsx(DescriptionList, { items: configItems }) }))] }));
77
- };
@@ -1,15 +0,0 @@
1
- /**
2
- * @fileoverview Spacing Analyzer Utility
3
- * @description Analyzes spacing (padding and margin) of elements on the page for debugging layout issues
4
- *
5
- * @version 0.0.1
6
- * @since 0.0.1
7
- * @author AMBROISE PARK Consulting
8
- */
9
- import type { SpacingAnalysis } from '../types';
10
- export declare class SpacingAnalyzer {
11
- static analyzePageSpacing(): SpacingAnalysis;
12
- private static groupByComponentType;
13
- static logAnalysis(analysis: SpacingAnalysis): void;
14
- }
15
- //# sourceMappingURL=spacingAnalyzer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spacingAnalyzer.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/utils/spacingAnalyzer.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,qBAAa,eAAe;IAC1B,MAAM,CAAC,kBAAkB,IAAI,eAAe;IAoD5C,OAAO,CAAC,MAAM,CAAC,oBAAoB;IA8BnC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;CA0BpD"}
@@ -1,88 +0,0 @@
1
- // packages/ui/src/internal/devtools/utils/spacingAnalyzer.ts
2
- export class SpacingAnalyzer {
3
- static analyzePageSpacing() {
4
- const elements = document.querySelectorAll('*');
5
- const spacingElements = [];
6
- elements.forEach((el) => {
7
- const styles = window.getComputedStyle(el);
8
- const padding = {
9
- top: parseInt(styles.paddingTop),
10
- right: parseInt(styles.paddingRight),
11
- bottom: parseInt(styles.paddingBottom),
12
- left: parseInt(styles.paddingLeft),
13
- };
14
- const margin = {
15
- top: parseInt(styles.marginTop),
16
- right: parseInt(styles.marginRight),
17
- bottom: parseInt(styles.marginBottom),
18
- left: parseInt(styles.marginLeft),
19
- };
20
- const hasSpacing = Object.values(padding).some((v) => v > 0) ||
21
- Object.values(margin).some((v) => v > 0);
22
- if (hasSpacing) {
23
- spacingElements.push({
24
- element: el,
25
- padding,
26
- margin,
27
- tagName: el.tagName,
28
- className: el.className ? String(el.className) : '',
29
- id: el.id,
30
- rect: el.getBoundingClientRect(),
31
- });
32
- }
33
- });
34
- const groupedSpacing = this.groupByComponentType(spacingElements);
35
- return {
36
- totalElements: spacingElements.length,
37
- groupedSpacing,
38
- summary: {
39
- pageContainer: groupedSpacing['content-padding']?.length || 0,
40
- marketingSections: groupedSpacing['dndev-gap-lg']?.length || 0,
41
- heroSection: groupedSpacing['HeroSection']?.length || 0,
42
- valueCards: groupedSpacing['ValueCard']?.length || 0,
43
- featureCards: groupedSpacing['FeatureCard']?.length || 0,
44
- other: groupedSpacing['other']?.length || 0,
45
- },
46
- };
47
- }
48
- static groupByComponentType(spacingElements) {
49
- return spacingElements.reduce((acc, item) => {
50
- const componentName = item.className
51
- ? item.className
52
- .split(' ')
53
- .find((cls) => cls.includes('PageContainer') ||
54
- cls.includes('Section') ||
55
- cls.includes('HeroSection') ||
56
- cls.includes('ValueCard') ||
57
- cls.includes('FeatureCard') ||
58
- cls.includes('content-padding') ||
59
- cls.includes('gap-')) || 'other'
60
- : 'other';
61
- if (!acc[componentName]) {
62
- acc[componentName] = [];
63
- }
64
- acc[componentName].push(item);
65
- return acc;
66
- }, {});
67
- }
68
- static logAnalysis(analysis) {
69
- console.group('🔍 Spacing Analysis');
70
- console.log(`Found ${analysis.totalElements} elements with padding/margin`);
71
- console.log('Summary:', analysis.summary);
72
- Object.entries(analysis.groupedSpacing).forEach(([group, items]) => {
73
- console.group(`${group} (${items.length} elements)`);
74
- items.forEach((item) => {
75
- const hasPadding = Object.values(item.padding).some((v) => typeof v === 'number' && v > 0);
76
- const hasMargin = Object.values(item.margin).some((v) => typeof v === 'number' && v > 0);
77
- if (hasPadding) {
78
- console.log('📦 Padding:', item.padding);
79
- }
80
- if (hasMargin) {
81
- console.log('📏 Margin:', item.margin);
82
- }
83
- });
84
- console.groupEnd();
85
- });
86
- console.groupEnd();
87
- }
88
- }