@donotdev/cli 0.0.3 → 0.0.5
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/dependencies-matrix.json +194 -110
- package/dist/bin/commands/bump.d.ts +1 -1
- package/dist/bin/commands/bump.js +103 -96
- package/dist/bin/commands/create-app.js +40 -28
- package/dist/bin/commands/create-project.js +40 -28
- package/dist/bin/commands/format.d.ts +1 -1
- package/dist/bin/commands/lint.d.ts +1 -1
- package/dist/index.js +40 -28
- package/package.json +1 -9
- package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +5 -5
- package/templates/app-demo/src/themes.css.example +108 -156
- package/templates/app-next/src/app/ClientLayout.tsx.example +1 -1
- package/templates/app-next/src/locales/home_en.json.example +6 -0
- package/templates/app-next/src/pages/HomePage.tsx.example +152 -8
- package/templates/app-next/src/themes.css.example +92 -140
- package/templates/app-vite/src/App.tsx.example +3 -3
- package/templates/app-vite/src/locales/home_en.json.example +6 -0
- package/templates/app-vite/src/pages/HomePage.tsx.example +149 -8
- package/templates/app-vite/src/themes.css.example +90 -138
- package/templates/root-consumer/guides/AGENT_START_HERE.md.example +297 -53
- package/templates/root-consumer/guides/COMPONENTS_ADV.md.example +360 -0
- package/templates/root-consumer/guides/COMPONENTS_ATOMIC.md.example +134 -0
- package/templates/root-consumer/guides/COMPONENTS_CRUD.md.example +70 -0
- package/templates/root-consumer/guides/COMPONENTS_UI.md.example +141 -0
- package/templates/root-consumer/guides/ENV_SETUP.md.example +14 -0
- package/templates/root-consumer/guides/INDEX.md.example +17 -25
- package/templates/root-consumer/guides/SETUP_AUTH.md.example +77 -0
- package/templates/root-consumer/guides/SETUP_BILLING.md.example +78 -0
- package/templates/root-consumer/guides/SETUP_FUNCTIONS.md.example +62 -0
- package/templates/root-consumer/guides/SETUP_I18N.md.example +187 -0
- package/templates/root-consumer/guides/SETUP_LAYOUTS.md.example +126 -0
- package/templates/root-consumer/guides/SETUP_OAUTH.md.example +53 -0
- package/templates/root-consumer/guides/SETUP_PAGES.md.example +120 -0
- package/templates/root-consumer/guides/SETUP_THEMES.md.example +107 -0
- package/templates/root-consumer/guides/advanced/COOKIE_REFERENCE.md.example +252 -0
- package/templates/root-consumer/guides/{EMULATOR_SETUP.md.example → advanced/EMULATORS.md.example} +1 -1
- package/templates/root-consumer/guides/{VERSION_CONTROL.md.example → advanced/VERSION_CONTROL.md.example} +0 -7
- package/templates/root-consumer/guides/AUTH_SETUP.md.example +0 -92
- package/templates/root-consumer/guides/BILLING_SETUP.md.example +0 -120
- package/templates/root-consumer/guides/CLI.md.example +0 -293
- package/templates/root-consumer/guides/COMPONENTS.md.example +0 -875
- package/templates/root-consumer/guides/FEATURES.md.example +0 -286
- package/templates/root-consumer/guides/FRAMEWORK_OVERVIEW.md.example +0 -97
- package/templates/root-consumer/guides/FUNCTIONS.md.example +0 -177
- package/templates/root-consumer/guides/GETTING_STARTED.md.example +0 -451
- package/templates/root-consumer/guides/HOW_TO_USE.md.example +0 -296
- package/templates/root-consumer/guides/I18N_SETUP.md.example +0 -204
- package/templates/root-consumer/guides/IMPORT_PATTERNS.md.example +0 -79
- package/templates/root-consumer/guides/INSTALLATION.md.example +0 -296
- package/templates/root-consumer/guides/LAYOUTS.md.example +0 -310
- package/templates/root-consumer/guides/PAGES_SETUP.md.example +0 -123
- package/templates/root-consumer/guides/STYLING.md.example +0 -273
- package/templates/root-consumer/guides/THEMING_SETUP.md.example +0 -119
- /package/templates/root-consumer/guides/{CONFIG_SETUP.md.example → SETUP_APP_CONFIG.md.example} +0 -0
- /package/templates/root-consumer/guides/{APP_CHECK_SETUP.md.example → advanced/APP_CHECK.md.example} +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Setup: Pages & Routing
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Drop `*Page.tsx` files. Routes auto-discovered, navigation auto-generated, sitemap auto-built.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## File Routing Rule
|
|
8
|
+
|
|
9
|
+
**CRITICAL: Only files ending in `Page.tsx` inside `src/pages` become routes.**
|
|
10
|
+
|
|
11
|
+
Files must be named `*Page.tsx` (e.g., `HomePage.tsx`, `AboutPage.tsx`, `BlogPostPage.tsx`). Files without the `Page.tsx` suffix are ignored by the routing system.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Standard Use
|
|
16
|
+
|
|
17
|
+
**Pattern:** `src/pages/**/*Page.tsx` → routes
|
|
18
|
+
|
|
19
|
+
**Basic page structure:**
|
|
20
|
+
```tsx
|
|
21
|
+
// src/pages/AboutPage.tsx
|
|
22
|
+
import { PageContainer } from '@donotdev/ui';
|
|
23
|
+
|
|
24
|
+
export const NAMESPACE = 'about';
|
|
25
|
+
|
|
26
|
+
export const meta: PageMeta = {
|
|
27
|
+
namespace: NAMESPACE,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default function AboutPage() {
|
|
31
|
+
return <PageContainer><h1>About</h1></PageContainer>;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Cookie-cutter pattern (Landing page):**
|
|
36
|
+
```tsx
|
|
37
|
+
import { PageContainer } from '@donotdev/ui';
|
|
38
|
+
import { HeroSection, Section, Card, CallToAction } from '@donotdev/components';
|
|
39
|
+
|
|
40
|
+
export default function HomePage() {
|
|
41
|
+
return (
|
|
42
|
+
<PageContainer>
|
|
43
|
+
<HeroSection title="Welcome" subtitle="Build fast" variant="primary" />
|
|
44
|
+
<Section title="Features" gridCols={3}>
|
|
45
|
+
<Card title="Fast" />
|
|
46
|
+
<Card title="Simple" />
|
|
47
|
+
<Card title="Powerful" />
|
|
48
|
+
</Section>
|
|
49
|
+
<CallToAction title="Get Started" primaryAction={<Button>Sign Up</Button>} />
|
|
50
|
+
</PageContainer>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Drop files, get routes. No config needed.**
|
|
56
|
+
|
|
57
|
+
**Component reference:** See [COMPONENTS_ATOMIC.md](./COMPONENTS_ATOMIC.md) for atomic components, [COMPONENTS_UI.md](./COMPONENTS_UI.md) for layout components.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Advanced: All PageMeta Props
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
export const meta: PageMeta = {
|
|
65
|
+
// Translation/SEO namespace
|
|
66
|
+
namespace: NAMESPACE,
|
|
67
|
+
|
|
68
|
+
// Route configuration
|
|
69
|
+
route: '/custom-url', // Override auto-generated path
|
|
70
|
+
route: { params: ['slug'] }, // Dynamic: /blog/:slug
|
|
71
|
+
|
|
72
|
+
// Page title (optional - auto-extracted from filename)
|
|
73
|
+
title: 'Custom Title',
|
|
74
|
+
|
|
75
|
+
// Navigation icon (lucide-react JSX only)
|
|
76
|
+
icon: <Rocket />, // Menu icon (default: Link)
|
|
77
|
+
|
|
78
|
+
// Hide from navigation menu
|
|
79
|
+
hideFromMenu: false, // Default: false (shows in nav)
|
|
80
|
+
|
|
81
|
+
// Authentication
|
|
82
|
+
auth: true, // Simple: auth required
|
|
83
|
+
auth: { required: true }, // Explicit: auth required
|
|
84
|
+
auth: { required: true, role: 'admin' }, // Role-based access
|
|
85
|
+
auth: { required: true, tier: 'pro' }, // Tier-based access
|
|
86
|
+
auth: {
|
|
87
|
+
required: true,
|
|
88
|
+
validate: (role, tier) => role === 'admin' && tier === 'pro'
|
|
89
|
+
}, // Custom validation
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Advanced: Dynamic Routes & Navigation
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
// Dynamic route
|
|
99
|
+
export const meta: PageMeta = {
|
|
100
|
+
namespace: 'blog',
|
|
101
|
+
route: { params: ['slug'] }, // → /blog/:slug
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default function BlogPostPage() {
|
|
105
|
+
const { slug } = useParams<{ slug: string }>();
|
|
106
|
+
return <PageContainer><h1>{slug}</h1></PageContainer>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Manual navigation
|
|
110
|
+
import { useNavigate, Link } from '@donotdev/ui';
|
|
111
|
+
const navigate = useNavigate();
|
|
112
|
+
navigate('/about');
|
|
113
|
+
<Link path="/about">About</Link>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Pre-configured:** Navigation menu auto-generated, sitemap auto-built (if `generateSitemap: true`).
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
**Drop files, get routes. Framework handles the rest.**
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Setup: Themes
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Override CSS variables in `src/themes.css`. Framework handles theme switching, auto-computed colors.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Use
|
|
8
|
+
|
|
9
|
+
**File:** `src/themes.css` (scaffolded with all variables)
|
|
10
|
+
|
|
11
|
+
**Override colors:**
|
|
12
|
+
```css
|
|
13
|
+
:root {
|
|
14
|
+
/* Brand colors */
|
|
15
|
+
--primary: #2563eb;
|
|
16
|
+
--secondary: #9333ea;
|
|
17
|
+
--accent: #ec4899;
|
|
18
|
+
|
|
19
|
+
/* Base colors */
|
|
20
|
+
--background: #ffffff;
|
|
21
|
+
--foreground: #000000;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Add custom theme:**
|
|
26
|
+
```css
|
|
27
|
+
.ocean {
|
|
28
|
+
--theme-icon: 'Waves';
|
|
29
|
+
--theme-label: 'Ocean';
|
|
30
|
+
--primary: #0ea5e9;
|
|
31
|
+
--background: #001a33;
|
|
32
|
+
--foreground: #e0f2fe;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Framework auto-computes:** Surfaces (card, popover), muted colors, borders, text on brand colors.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Advanced: All CSS Variables
|
|
41
|
+
|
|
42
|
+
**Brand colors:**
|
|
43
|
+
```css
|
|
44
|
+
--primary, --secondary, --accent
|
|
45
|
+
--primary-foreground, --secondary-foreground, --accent-foreground
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Base colors:**
|
|
49
|
+
```css
|
|
50
|
+
--background, --foreground
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Status colors:**
|
|
54
|
+
```css
|
|
55
|
+
--success, --warning, --destructive
|
|
56
|
+
--success-foreground, --warning-foreground, --destructive-foreground
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Surfaces:**
|
|
60
|
+
```css
|
|
61
|
+
--card, --card-foreground
|
|
62
|
+
--popover, --popover-foreground
|
|
63
|
+
--muted, --muted-foreground
|
|
64
|
+
--border, --input, --ring
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Theme metadata:**
|
|
68
|
+
```css
|
|
69
|
+
--theme-icon: 'Sun'; /* Lucide icon name */
|
|
70
|
+
--theme-label: 'Light'; /* Display name */
|
|
71
|
+
--theme-is-dark: 0; /* 0 = light, 1 = dark */
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Advanced: Styling Overrides
|
|
77
|
+
|
|
78
|
+
**Utility classes:**
|
|
79
|
+
```tsx
|
|
80
|
+
<Card className="dndev-gap-sm" /> // Gap utilities
|
|
81
|
+
<div className="dndev-flex dndev-gap-md" /> // Layout utilities
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Data attributes:**
|
|
85
|
+
```tsx
|
|
86
|
+
<HeroSection data-text-align="center" title="Centered" />
|
|
87
|
+
<div data-gap="medium" data-radius="md" />
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Inline styles:**
|
|
91
|
+
```tsx
|
|
92
|
+
<Button style={{ minWidth: '200px' }} />
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Global CSS rules:**
|
|
96
|
+
```css
|
|
97
|
+
/* src/themes.css */
|
|
98
|
+
.dndev-button {
|
|
99
|
+
border-radius: 8px; /* Override default */
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Framework respects your overrides.** All components use CSS variables, so color changes propagate automatically.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
**Override variables, get themes. Framework handles the rest.**
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Cookie Reference Guide
|
|
2
|
+
|
|
3
|
+
**For Framework Consumers: GDPR Compliance**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This guide maps DoNotDev framework features to the cookies they set, helping you configure your cookie consent banner and privacy policy correctly.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Cookie Categories (GDPR)
|
|
14
|
+
|
|
15
|
+
- **Necessary** - Essential for service to function (no consent required per GDPR Article 6(1)(f))
|
|
16
|
+
- **Functional** - Enhances experience (requires consent per GDPR Article 6(1)(a))
|
|
17
|
+
- **Analytics** - Usage tracking (requires consent)
|
|
18
|
+
- **Marketing** - Advertising/tracking (requires consent)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Feature Cookie Mapping
|
|
23
|
+
|
|
24
|
+
### Authentication (`@donotdev/auth`)
|
|
25
|
+
|
|
26
|
+
**Provider: Firebase Authentication**
|
|
27
|
+
|
|
28
|
+
| Cookie Name | Category | Purpose | Expires |
|
|
29
|
+
|------------|----------|---------|---------|
|
|
30
|
+
| `__session` | Necessary | Session authentication token | Session |
|
|
31
|
+
| `__Secure-*` | Necessary | Security tokens (HTTPS only) | Varies |
|
|
32
|
+
|
|
33
|
+
**GDPR Status:** Necessary - Authentication is essential for account-based services.
|
|
34
|
+
|
|
35
|
+
**Environment Variables:**
|
|
36
|
+
```bash
|
|
37
|
+
VITE_FIREBASE_API_KEY=your-key
|
|
38
|
+
VITE_FIREBASE_PROJECT_ID=your-project
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### OAuth (`@donotdev/oauth`)
|
|
44
|
+
|
|
45
|
+
**Providers: Google, GitHub OAuth**
|
|
46
|
+
|
|
47
|
+
| Cookie Name | Category | Purpose | Expires |
|
|
48
|
+
|------------|----------|---------|---------|
|
|
49
|
+
| OAuth state cookies | Necessary | CSRF protection during OAuth flow | Session |
|
|
50
|
+
| Provider session cookies | Necessary | Maintain OAuth session | Per provider |
|
|
51
|
+
|
|
52
|
+
**GDPR Status:** Necessary - Part of authentication flow.
|
|
53
|
+
|
|
54
|
+
**Environment Variables:**
|
|
55
|
+
```bash
|
|
56
|
+
VITE_AUTH_PARTNERS=google,github
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Third-party cookies set by OAuth providers:**
|
|
60
|
+
- **Google:** `SID`, `HSID`, `SSID`, `APISID`, `SAPISID` (necessary for OAuth)
|
|
61
|
+
- **GitHub:** `user_session`, `logged_in` (necessary for OAuth)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### Billing (`@donotdev/billing`)
|
|
66
|
+
|
|
67
|
+
**Provider: Stripe**
|
|
68
|
+
|
|
69
|
+
| Cookie Name | Category | Purpose | Expires |
|
|
70
|
+
|------------|----------|---------|---------|
|
|
71
|
+
| `__stripe_mid` | Necessary | Fraud prevention | 1 year |
|
|
72
|
+
| `__stripe_sid` | Necessary | Checkout session | 30 minutes |
|
|
73
|
+
|
|
74
|
+
**GDPR Status:** Necessary - Required for payment processing and fraud prevention.
|
|
75
|
+
|
|
76
|
+
**Environment Variables:**
|
|
77
|
+
```bash
|
|
78
|
+
VITE_STRIPE_PUBLIC_KEY=pk_live_xxx
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Stripe Privacy:** Stripe sets these cookies when Checkout or Customer Portal is opened. They're classified as necessary for PCI compliance and fraud prevention.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### Framework Core Cookies
|
|
86
|
+
|
|
87
|
+
**Set by `@donotdev/core`**
|
|
88
|
+
|
|
89
|
+
| Cookie Name | Category | Purpose | Expires |
|
|
90
|
+
|------------|----------|---------|---------|
|
|
91
|
+
| `dndev-cookie-consent` | Necessary | Stores user's cookie preferences | 365 days |
|
|
92
|
+
| `dndev-theme` | Necessary | Remembers dark/light mode preference | 365 days |
|
|
93
|
+
| `dndev-lang` | Necessary | Remembers language preference | 365 days |
|
|
94
|
+
|
|
95
|
+
**GDPR Status:** Necessary (essential for UX, no tracking, purely local preferences)
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Analytics & Marketing (Optional)
|
|
100
|
+
|
|
101
|
+
These are NOT included in the framework but commonly added by consumers:
|
|
102
|
+
|
|
103
|
+
### Google Analytics
|
|
104
|
+
|
|
105
|
+
| Cookie Name | Category | Purpose | Expires |
|
|
106
|
+
|------------|----------|---------|---------|
|
|
107
|
+
| `_ga` | Analytics | Distinguish users | 2 years |
|
|
108
|
+
| `_gid` | Analytics | Distinguish users | 24 hours |
|
|
109
|
+
| `_gat` | Analytics | Throttle requests | 1 minute |
|
|
110
|
+
|
|
111
|
+
**GDPR Status:** Analytics - Requires explicit consent.
|
|
112
|
+
|
|
113
|
+
**Setup:** Consumer must add Google Analytics script and obtain consent.
|
|
114
|
+
|
|
115
|
+
### Facebook Pixel
|
|
116
|
+
|
|
117
|
+
| Cookie Name | Category | Purpose | Expires |
|
|
118
|
+
|------------|----------|---------|---------|
|
|
119
|
+
| `_fbp` | Marketing | Track conversions | 90 days |
|
|
120
|
+
|
|
121
|
+
**GDPR Status:** Marketing - Requires explicit consent.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Cookie Banner Configuration
|
|
126
|
+
|
|
127
|
+
### Minimal Setup (Auth + Billing + Theme/Lang)
|
|
128
|
+
|
|
129
|
+
If your app only uses auth, billing, theme, and language preferences, all cookies are **necessary**:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
// src/config/app.ts
|
|
133
|
+
export const appConfig: AppConfig = {
|
|
134
|
+
features: {
|
|
135
|
+
// No config needed - all framework cookies are necessary
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Result:** No cookie banner shown - all cookies are GDPR-compliant without consent.
|
|
141
|
+
|
|
142
|
+
### With Analytics/Marketing
|
|
143
|
+
|
|
144
|
+
If you add Google Analytics or marketing pixels:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// src/config/app.ts
|
|
148
|
+
export const appConfig: AppConfig = {
|
|
149
|
+
features: {
|
|
150
|
+
requiredCookies: ['necessary', 'functional', 'analytics'],
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Result:** Cookie banner shows all categories, users must consent to analytics.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Privacy Policy Template
|
|
160
|
+
|
|
161
|
+
**Example text for your privacy policy:**
|
|
162
|
+
|
|
163
|
+
```markdown
|
|
164
|
+
## Cookies We Use
|
|
165
|
+
|
|
166
|
+
### Essential Cookies (Always Active)
|
|
167
|
+
|
|
168
|
+
We use essential cookies that are necessary for our service to function:
|
|
169
|
+
|
|
170
|
+
- **Authentication** (Firebase): Maintains your login session
|
|
171
|
+
- **Payment Processing** (Stripe): Enables secure payments and fraud prevention
|
|
172
|
+
- **Cookie Preferences**: Remembers your cookie consent choices
|
|
173
|
+
|
|
174
|
+
These cookies are essential and cannot be disabled.
|
|
175
|
+
|
|
176
|
+
### Functional Cookies (Optional)
|
|
177
|
+
|
|
178
|
+
With your consent, we use functional cookies to enhance your experience:
|
|
179
|
+
|
|
180
|
+
- **Theme Preference**: Remembers your dark/light mode choice
|
|
181
|
+
- **Language Preference**: Remembers your selected language
|
|
182
|
+
|
|
183
|
+
You can disable these in cookie settings.
|
|
184
|
+
|
|
185
|
+
### Analytics Cookies (Optional) [If applicable]
|
|
186
|
+
|
|
187
|
+
With your consent, we use Google Analytics to understand how visitors use our site.
|
|
188
|
+
This helps us improve the user experience.
|
|
189
|
+
|
|
190
|
+
You can disable these in cookie settings.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Testing Cookie Compliance
|
|
196
|
+
|
|
197
|
+
### Check What Cookies Are Set
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
// Browser console
|
|
201
|
+
document.cookie
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Verify Consent Before Analytics
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
import { useConsent } from '@donotdev/core';
|
|
208
|
+
|
|
209
|
+
function MyAnalytics() {
|
|
210
|
+
const hasAnalyticsConsent = useConsent('hasCategory')('analytics');
|
|
211
|
+
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
if (hasAnalyticsConsent) {
|
|
214
|
+
// Initialize Google Analytics
|
|
215
|
+
}
|
|
216
|
+
}, [hasAnalyticsConsent]);
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## GDPR Compliance Checklist
|
|
223
|
+
|
|
224
|
+
- [ ] List all cookies in privacy policy with categories
|
|
225
|
+
- [ ] Only set analytics/marketing cookies after consent
|
|
226
|
+
- [ ] Provide cookie settings link in footer
|
|
227
|
+
- [ ] Allow users to withdraw consent
|
|
228
|
+
- [ ] Store consent for 12 months maximum
|
|
229
|
+
- [ ] Don't block essential features if functional cookies declined
|
|
230
|
+
|
|
231
|
+
**Framework handles:** Consent storage, banner UI, category management
|
|
232
|
+
|
|
233
|
+
**You handle:** Privacy policy text, analytics integration, marketing pixels
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Quick Reference
|
|
238
|
+
|
|
239
|
+
| Feature | Cookies | Category | Consent Required? |
|
|
240
|
+
|---------|---------|----------|-------------------|
|
|
241
|
+
| Auth | `__session`, `__Secure-*` | Necessary | No |
|
|
242
|
+
| OAuth | Provider session cookies | Necessary | No |
|
|
243
|
+
| Billing | `__stripe_mid`, `__stripe_sid` | Necessary | No |
|
|
244
|
+
| Theme | `dndev-theme` | Necessary | No |
|
|
245
|
+
| Language | `dndev-lang` | Necessary | No |
|
|
246
|
+
| Consent | `dndev-cookie-consent` | Necessary | No |
|
|
247
|
+
| Analytics | `_ga`, `_gid` | Analytics | Yes |
|
|
248
|
+
| Marketing | `_fbp`, etc. | Marketing | Yes |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
**Need help?** Check your browser DevTools → Application → Cookies to see exactly what's being set.
|
package/templates/root-consumer/guides/{EMULATOR_SETUP.md.example → advanced/EMULATORS.md.example}
RENAMED
|
@@ -37,7 +37,7 @@ STRIPE_WEBHOOK_SECRET=whsec_... # Your permanent production webhook secret
|
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
39
|
# Start emulators for a specific app
|
|
40
|
-
|
|
40
|
+
dndev emu showcase
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
If you need Stripe webhook forwarding, the emulator command will provide instructions on how to start the Stripe CLI and where to paste the temporary webhook secret.
|
|
@@ -171,11 +171,4 @@ Review the migration guide before updating.
|
|
|
171
171
|
|
|
172
172
|
---
|
|
173
173
|
|
|
174
|
-
## Related
|
|
175
|
-
|
|
176
|
-
- **[Dependency System](../../docs/development/DEPENDENCY_SYSTEM.md)** - How dependency management works
|
|
177
|
-
- **[Architecture Hub](../../docs/architecture/INDEX.md)** - Framework structure
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
174
|
**Keep your dependencies up to date. Stay secure. Stay compatible.**
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# Authentication Setup
|
|
2
|
-
|
|
3
|
-
**For AI Agents:** Configure auth providers and routes. Framework handles the rest.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Environment Variables
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# .env
|
|
11
|
-
VITE_AUTH_PARTNERS=password,emailLink,google,github,facebook
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
**Available Firebase Auth providers:** `password`, `emailLink`, `google`, `github`, `facebook`, `twitter`, `microsoft`, `yahoo`, `apple`
|
|
15
|
-
|
|
16
|
-
**Default:** If not set, only `google` is enabled.
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 2. App Configuration
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
// apps/your-app/src/config/app.ts
|
|
24
|
-
import type { AppConfig } from '@donotdev/core';
|
|
25
|
-
|
|
26
|
-
export const appConfig: AppConfig = {
|
|
27
|
-
auth: {
|
|
28
|
-
authRoute: '/login', // Redirect when auth required (default: '/login')
|
|
29
|
-
roleRoute: '/404', // Redirect when role insufficient (default: '/404')
|
|
30
|
-
tierRoute: '/404', // Redirect when tier insufficient (default: '/404')
|
|
31
|
-
loginPath: '/login', // Optional: Login page path (undefined = show providers in header)
|
|
32
|
-
profilePath: '/profile', // Optional: Profile page path (default: '/profile')
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## 3. Firebase Console Setup
|
|
40
|
-
|
|
41
|
-
**User must enable providers in Firebase Console:**
|
|
42
|
-
- Authentication > Sign-in method
|
|
43
|
-
- Enable Email/Password (for `password` and `emailLink`)
|
|
44
|
-
- Enable OAuth providers (Google, GitHub, etc.) and configure credentials
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## What You Get
|
|
49
|
-
|
|
50
|
-
**Automatic:**
|
|
51
|
-
- ✅ `AuthHeader` component in layout (null if auth not needed)
|
|
52
|
-
- ✅ OAuth callbacks handled automatically
|
|
53
|
-
- ✅ Protected routes via `PageMeta.auth`
|
|
54
|
-
- ✅ Session management
|
|
55
|
-
|
|
56
|
-
**Components:**
|
|
57
|
-
- `AuthHeader`, `AuthMenu` from `@donotdev/ui`
|
|
58
|
-
- `LoginTemplate` from `@donotdev/templates`
|
|
59
|
-
- `EmailPasswordForm`, `MultipleAuthProviders` from `@donotdev/auth`
|
|
60
|
-
|
|
61
|
-
**Hook:**
|
|
62
|
-
```typescript
|
|
63
|
-
import { useAuth } from '@donotdev/auth';
|
|
64
|
-
|
|
65
|
-
const user = useAuth('user');
|
|
66
|
-
const signIn = useAuth('signInWithEmail');
|
|
67
|
-
const signOut = useAuth('signOut');
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Protected Route Example
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
// apps/your-app/src/pages/DashboardPage.tsx
|
|
76
|
-
export const meta = {
|
|
77
|
-
namespace: 'dashboard',
|
|
78
|
-
auth: { required: true }, // ← Protected route
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default function DashboardPage() {
|
|
82
|
-
const user = useAuth('user');
|
|
83
|
-
return <PageContainer>Welcome, {user?.displayName}!</PageContainer>;
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
**Files to modify:**
|
|
90
|
-
- `.env` - Add `VITE_AUTH_PARTNERS`
|
|
91
|
-
- `src/config/app.ts` - Add `auth` config
|
|
92
|
-
- `src/pages/**/*.tsx` - Add `auth` to `PageMeta` for protected routes
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Billing Setup
|
|
2
|
-
|
|
3
|
-
**For AI Agents:** Create Stripe config files. Framework handles checkout, webhooks, subscriptions.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Environment Variables
|
|
8
|
-
|
|
9
|
-
**Local Emulators (.env.local):**
|
|
10
|
-
```bash
|
|
11
|
-
# apps/your-app/functions/.env.local
|
|
12
|
-
STRIPE_SECRET_KEY=sk_test_xxx
|
|
13
|
-
STRIPE_WEBHOOK_SECRET=whsec_xxx # Get from 'stripe listen'
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Production (.env):**
|
|
17
|
-
```bash
|
|
18
|
-
# apps/your-app/functions/.env
|
|
19
|
-
STRIPE_SECRET_KEY=sk_live_xxx
|
|
20
|
-
STRIPE_WEBHOOK_SECRET=whsec_xxx # Permanent production secret
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Frontend (.env):**
|
|
24
|
-
```bash
|
|
25
|
-
# apps/your-app/.env
|
|
26
|
-
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## 2. Stripe Dashboard
|
|
32
|
-
|
|
33
|
-
**User must:**
|
|
34
|
-
1. Create products in Stripe Dashboard
|
|
35
|
-
2. Copy Price IDs (starts with `price_...`)
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## 3. Frontend Config
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
// apps/your-app/src/config/stripeFrontConfig.ts
|
|
43
|
-
import type { StripeFrontConfig } from '@donotdev/core';
|
|
44
|
-
|
|
45
|
-
export const stripeFrontConfig: StripeFrontConfig = {
|
|
46
|
-
pro_plan: {
|
|
47
|
-
name: 'Pro Plan',
|
|
48
|
-
price: 29,
|
|
49
|
-
currency: 'USD',
|
|
50
|
-
description: 'Perfect for growing teams',
|
|
51
|
-
features: ['Unlimited projects', 'Priority support'],
|
|
52
|
-
priceId: 'price_1234567890', // ← Stripe Price ID
|
|
53
|
-
allowPromotionCodes: true,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## 4. Backend Config
|
|
61
|
-
|
|
62
|
-
```typescript
|
|
63
|
-
// apps/your-app/functions/src/config/stripeBackConfig.ts
|
|
64
|
-
import type { StripeBackConfig } from '@donotdev/core';
|
|
65
|
-
|
|
66
|
-
export const stripeBackConfig: StripeBackConfig = {
|
|
67
|
-
pro_plan: {
|
|
68
|
-
type: 'StripeSubscription', // or 'StripePayment'
|
|
69
|
-
name: 'Pro Plan',
|
|
70
|
-
price: 2900, // In cents
|
|
71
|
-
currency: 'USD',
|
|
72
|
-
priceId: process.env.STRIPE_PRICE_PRO_PLAN!,
|
|
73
|
-
tier: 'pro',
|
|
74
|
-
duration: 'month',
|
|
75
|
-
|
|
76
|
-
// Optional hooks
|
|
77
|
-
onPurchaseSuccess: async (userId, metadata) => {
|
|
78
|
-
// Grant features, send email, etc.
|
|
79
|
-
},
|
|
80
|
-
onSubscriptionCancelled: async (userId) => {
|
|
81
|
-
// Revoke features, etc.
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## 5. Wire Up Functions
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
|
-
// apps/your-app/functions/src/index.ts
|
|
93
|
-
import { createCheckoutSession } from '@donotdev/functions/firebase';
|
|
94
|
-
import { stripeBackConfig } from './config/stripeBackConfig';
|
|
95
|
-
|
|
96
|
-
export const createCheckout = createCheckoutSession(stripeBackConfig);
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## What You Get
|
|
102
|
-
|
|
103
|
-
**Components:**
|
|
104
|
-
- `SubscriptionTemplate`, `PaymentTemplate` from `@donotdev/templates`
|
|
105
|
-
- `ProductCard`, `SubscriptionManager` from `@donotdev/billing`
|
|
106
|
-
|
|
107
|
-
**Hook:**
|
|
108
|
-
```typescript
|
|
109
|
-
import { useStripeBilling } from '@donotdev/billing';
|
|
110
|
-
|
|
111
|
-
const checkout = useStripeBilling('checkout');
|
|
112
|
-
await checkout({ priceId: 'price_123', mode: 'subscription' });
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
**Files to create:**
|
|
118
|
-
- `src/config/stripeFrontConfig.ts` - Frontend config
|
|
119
|
-
- `functions/src/config/stripeBackConfig.ts` - Backend config
|
|
120
|
-
- `functions/src/index.ts` - Wire up functions
|