@donotdev/cli 0.0.4 → 0.0.6

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 (54) hide show
  1. package/dependencies-matrix.json +234 -114
  2. package/dist/bin/commands/build.js +9 -3
  3. package/dist/bin/commands/bump.js +119 -100
  4. package/dist/bin/commands/cacheout.js +9 -3
  5. package/dist/bin/commands/create-app.js +60 -34
  6. package/dist/bin/commands/create-project.js +61 -34
  7. package/dist/bin/commands/deploy.js +22 -14
  8. package/dist/bin/commands/dev.js +9 -3
  9. package/dist/bin/commands/emu.js +9 -3
  10. package/dist/bin/commands/format.js +9 -3
  11. package/dist/bin/commands/lint.js +9 -3
  12. package/dist/bin/commands/make-admin.d.ts +11 -0
  13. package/dist/bin/commands/make-admin.d.ts.map +1 -0
  14. package/dist/bin/commands/make-admin.js +12 -0
  15. package/dist/bin/commands/make-admin.js.map +1 -0
  16. package/dist/bin/commands/preview.js +9 -3
  17. package/dist/bin/commands/sync-secrets.js +9 -3
  18. package/dist/index.js +72 -44
  19. package/package.json +1 -1
  20. package/templates/app-demo/index.html.example +4 -0
  21. package/templates/app-demo/src/App.tsx.example +28 -10
  22. package/templates/app-demo/src/config/app.ts.example +56 -0
  23. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +5 -5
  24. package/templates/app-next/src/app/ClientLayout.tsx.example +5 -4
  25. package/templates/app-next/src/app/layout.tsx.example +17 -25
  26. package/templates/app-next/src/globals.css.example +10 -7
  27. package/templates/app-next/src/locales/dndev_en.json.example +68 -0
  28. package/templates/app-next/src/pages/locales/example_en.json.example +5 -0
  29. package/templates/app-vite/index.html.example +3 -0
  30. package/templates/app-vite/src/App.tsx.example +1 -1
  31. package/templates/app-vite/src/globals.css.example +14 -6
  32. package/templates/app-vite/src/locales/dndev_en.json.example +68 -0
  33. package/templates/functions-firebase/README.md.example +25 -0
  34. package/templates/functions-firebase/tsconfig.json.example +3 -13
  35. package/templates/functions-vercel/tsconfig.json.example +1 -13
  36. package/templates/root-consumer/firebase.json.example +1 -1
  37. package/templates/root-consumer/guides/AGENT_START_HERE.md.example +229 -7
  38. package/templates/root-consumer/guides/COMPONENTS_ADV.md.example +456 -0
  39. package/templates/root-consumer/guides/COMPONENTS_ATOMIC.md.example +43 -1
  40. package/templates/root-consumer/guides/COMPONENTS_UI.md.example +6 -0
  41. package/templates/root-consumer/guides/INDEX.md.example +3 -0
  42. package/templates/root-consumer/guides/SETUP_APP_CONFIG.md.example +5 -2
  43. package/templates/root-consumer/guides/SETUP_BILLING.md.example +44 -4
  44. package/templates/root-consumer/guides/SETUP_CRUD.md.example +1244 -0
  45. package/templates/root-consumer/guides/SETUP_FUNCTIONS.md.example +52 -0
  46. package/templates/root-consumer/guides/SETUP_I18N.md.example +145 -6
  47. package/templates/root-consumer/guides/SETUP_LAYOUTS.md.example +18 -0
  48. package/templates/root-consumer/guides/SETUP_PAGES.md.example +25 -0
  49. package/templates/root-consumer/guides/SETUP_PWA.md.example +213 -0
  50. package/templates/root-consumer/guides/USE_ROUTING.md.example +503 -0
  51. package/templates/root-consumer/vercel.json.example +315 -20
  52. package/templates/app-demo/src/Routes.tsx.example +0 -20
  53. package/templates/app-vite/src/Routes.tsx.example +0 -16
  54. package/templates/app-vite/src/pages/locales/README.md.example +0 -1
@@ -0,0 +1,456 @@
1
+ # Advanced Components (@donotdev/adv-comps)
2
+
3
+ High-level, opinionated, and marketing-focused UI components for DoNotDev framework.
4
+
5
+ ## Setup
6
+
7
+ **IMPORTANT:** You must import the styles in your `globals.css` file:
8
+
9
+ ```css
10
+ @import '@donotdev/adv-comps/styles';
11
+ ```
12
+
13
+ Without this import, components will not have their required CSS styles.
14
+
15
+ ## Components
16
+
17
+ ### Crawl
18
+
19
+ Cinematic 3D text crawl component with lazy loading.
20
+
21
+ ```tsx
22
+ import { Crawl } from '@donotdev/adv-comps';
23
+
24
+ <Crawl
25
+ intro?: ReactNode | string
26
+ title?: ReactNode | string
27
+ content: ReactNode | string | string[]
28
+ duration?: number // @default 26
29
+ contentHeight?: string // @default "150vh"
30
+ tiltAngle?: number
31
+ className?: string
32
+ style?: CSSProperties
33
+ aria-label?: string
34
+ />
35
+ ```
36
+
37
+ ### Marquee
38
+
39
+ Production-grade marquee with accessibility, reduced motion support, and smart behavior detection.
40
+
41
+ ```tsx
42
+ import { Marquee } from '@donotdev/adv-comps';
43
+
44
+ <Marquee<T>
45
+ items: T[]
46
+ renderItem: (item: T, index: number) => ReactNode
47
+ className?: string
48
+ itemClassName?: string
49
+ gap?: 'none' | 'tight' | 'medium' | 'large' // @default 'medium'
50
+ speed?: number // px per second
51
+ direction?: 'left' | 'right' | 'up' | 'down' | 'auto' // @default 'auto'
52
+ pauseOnHover?: boolean
53
+ ariaLabel?: string
54
+ reducedMotion?: 'respect' | 'ignore'
55
+ behavior?: 'bounce' | 'infinite' | 'auto'
56
+ pauseOnFocusWithin?: boolean
57
+ easing?: 'linear' | 'ease-in-out' | 'ease-out'
58
+ />
59
+ ```
60
+
61
+ ### Roadmap
62
+
63
+ Timeline component with horizontal (desktop) / vertical (mobile) layout. Features animated progress line, glowing nodes, and lift-on-hover cards.
64
+
65
+ ```tsx
66
+ import { Roadmap } from '@donotdev/adv-comps';
67
+ import type { RoadmapStep } from '@donotdev/adv-comps';
68
+
69
+ <Roadmap
70
+ steps: RoadmapStep[]
71
+ className?: string
72
+ variant?: CardVariant // @default 'default'
73
+ />
74
+
75
+ // RoadmapStep interface:
76
+ interface RoadmapStep {
77
+ phase: string // e.g., "Week 1", "Days 1-2"
78
+ icon: LucideIcon
79
+ title: string
80
+ subtitle: string
81
+ description?: string
82
+ content?: CardContent // Optional content shown in popover on click
83
+ }
84
+ ```
85
+
86
+ ### StackedCards
87
+
88
+ Simple scroll-reveal stacked cards. Active card shows full content, stacked cards show only bottom edge with number.
89
+
90
+ ```tsx
91
+ import { StackedCards } from '@donotdev/adv-comps';
92
+ import type { StackedCardData } from '@donotdev/adv-comps';
93
+
94
+ <StackedCards
95
+ items: StackedCardData[]
96
+ variant?: SurfaceVariantProps['variant']
97
+ ariaLabel?: string
98
+ threshold?: number // Intersection threshold (0.0 - 1.0) @default 0.3
99
+ className?: string
100
+ style?: CSSProperties
101
+ />
102
+
103
+ // StackedCardData extends ComponentData with:
104
+ interface StackedCardData extends ComponentData {
105
+ number?: string | number // Custom number/label (e.g. "01", "Week 1"). Defaults to index.
106
+ }
107
+ ```
108
+
109
+ ### Reveal
110
+
111
+ Reveal component for staggered animations. Features viewport-based visibility detection, directional animations, and customizable stagger delays.
112
+
113
+ ```tsx
114
+ import { Reveal } from '@donotdev/adv-comps';
115
+
116
+ <Reveal
117
+ items: string[] | ReactNode[]
118
+ direction?: 'left' | 'right' | 'top' | 'bottom' | 'fade-in' | 'alternate-h' | 'alternate-v'
119
+ stagger?: number // milliseconds between items
120
+ threshold?: number
121
+ distance?: number // animation distance in pixels
122
+ duration?: number // animation duration in milliseconds
123
+ once?: boolean // if true, only animate once
124
+ viewport?: boolean // if true, only animate items in viewport
125
+ overrides?: Array<{
126
+ index: number
127
+ direction: 'left' | 'right' | 'top' | 'bottom' | 'fade-in'
128
+ }>
129
+ className?: string
130
+ children?: ReactNode
131
+ />
132
+ ```
133
+
134
+ ### InspectorGadget
135
+
136
+ Floating code inspector component. Displays a floating eye icon button that opens a dialog showing the page's source code.
137
+
138
+ ```tsx
139
+ import { InspectorGadget } from '@donotdev/adv-comps';
140
+
141
+ <InspectorGadget
142
+ data?: string // Source code string
143
+ sourcePath?: string // Path to source file (import with ?raw) - overrides data if provided
144
+ sourceCode?: string // Source code loaded from file
145
+ language?: string // Code language for syntax highlighting @default 'tsx'
146
+ title?: string // Dialog title @default 'Page Source'
147
+ className?: string
148
+ />
149
+ ```
150
+
151
+ ### Breathing Components
152
+
153
+ Breathing exercise components for meditation and wellness apps.
154
+
155
+ ```tsx
156
+ import { LungsAnimation, BreathingExerciseLayout } from '@donotdev/adv-comps';
157
+ import type { BreathingExerciseDnDevLayoutProps } from '@donotdev/adv-comps';
158
+
159
+ <BreathingExerciseLayout
160
+ status?: ReactNode
161
+ animation: ReactNode
162
+ instructions: ReactNode
163
+ debug?: boolean
164
+ onSkip?: () => void
165
+ statusValue?: string
166
+ onRestart?: () => void
167
+ isPaused?: boolean
168
+ isComplete?: boolean
169
+ />
170
+
171
+ <LungsAnimation ... />
172
+ ```
173
+
174
+ ### Carousel
175
+
176
+ Premium carousel component with lazy loading built-in. Features true infinite circular loop, hardware-accelerated animations, swipe/touch gestures, and autoplay with pause-on-hover.
177
+
178
+ ```tsx
179
+ import { Carousel } from '@donotdev/adv-comps';
180
+ import type { CarouselProps, CarouselRef } from '@donotdev/adv-comps';
181
+
182
+ <Carousel<T>
183
+ items: T[]
184
+ renderItem: (item: T, index: number, isActive: boolean) => ReactNode
185
+ className?: string
186
+ slideClassName?: string
187
+ showArrows?: boolean
188
+ showDots?: boolean
189
+ showProgress?: boolean
190
+ autoplay?: boolean
191
+ autoplayInterval?: number // milliseconds
192
+ transitionDuration?: number // milliseconds
193
+ loop?: boolean
194
+ // ... and more props
195
+ />
196
+ ```
197
+
198
+ ### ComparisonGrid
199
+
200
+ Comparison grid component for displaying feature comparisons. Provides lazy-loaded content with skeleton loading states.
201
+
202
+ ```tsx
203
+ import { ComparisonGrid } from '@donotdev/adv-comps';
204
+ import type { ComparisonItem } from '@donotdev/adv-comps';
205
+
206
+ <ComparisonGrid
207
+ title?: string
208
+ items: ComparisonItem[]
209
+ gridCols?: 1 | 2 | 3 | 4 // @default 2
210
+ className?: string
211
+ ariaLabel?: string
212
+ />
213
+
214
+ // ComparisonItem interface:
215
+ interface ComparisonItem {
216
+ useCase: string
217
+ bestFit: string
218
+ dndev: string
219
+ reason: string
220
+ }
221
+ ```
222
+
223
+ ### CongratulationsCard
224
+
225
+ Card component for displaying congratulatory messages. Features customizable icon and text with centered layout.
226
+
227
+ ```tsx
228
+ import { CongratulationsCard } from '@donotdev/adv-comps';
229
+
230
+ <CongratulationsCard
231
+ text: string
232
+ icon?: ReactNode // @default '🎉'
233
+ className?: string
234
+ />
235
+ ```
236
+
237
+ ### GuideModal
238
+
239
+ Modal component for displaying guides and tutorials. Provides step-by-step guide display with navigation, progress tracking, and completion handling.
240
+
241
+ ```tsx
242
+ import { GuideModal } from '@donotdev/adv-comps';
243
+ import type { GuideModalProps, GuideTemplate } from '@donotdev/adv-comps';
244
+
245
+ <GuideModal
246
+ open: boolean
247
+ onOpenChange: (open: boolean) => void
248
+ guide: GuideTemplate
249
+ icon?: LucideIcon
250
+ />
251
+
252
+ // GuideTemplate interface:
253
+ interface GuideTemplate {
254
+ title: string
255
+ subtitle: string
256
+ quickStart?: {
257
+ title: string
258
+ code: string
259
+ description: string
260
+ }
261
+ steps?: GuideStep[]
262
+ features?: string[]
263
+ templates?: Array<{
264
+ name: string
265
+ description: string
266
+ }>
267
+ actions?: Array<{
268
+ label: string
269
+ href: string
270
+ variant?: 'default' | 'outline'
271
+ icon?: LucideIcon
272
+ }>
273
+ }
274
+
275
+ // GuideStep interface:
276
+ interface GuideStep {
277
+ icon: LucideIcon
278
+ title: string
279
+ description: string
280
+ code?: string
281
+ details?: string
282
+ }
283
+ ```
284
+
285
+ ### SplitReveal
286
+
287
+ Split reveal component for displaying content in two columns. Features left column content and right column stat cards or custom content with reveal animations.
288
+
289
+ ```tsx
290
+ import { SplitReveal } from '@donotdev/adv-comps';
291
+ import type { StatCardData } from '@donotdev/adv-comps';
292
+
293
+ <SplitReveal
294
+ left: ReactNode
295
+ right: ReactNode | StatCardData[]
296
+ leftDirection?: 'left' | 'right' | 'top' | 'bottom' | 'fade-in' // @default 'left'
297
+ rightDirection?: 'left' | 'right' | 'top' | 'bottom' | 'fade-in' // @default 'right'
298
+ threshold?: number // @default 0.3
299
+ className?: string
300
+ />
301
+
302
+ // StatCardData interface:
303
+ interface StatCardData {
304
+ title: string
305
+ description: string
306
+ }
307
+ ```
308
+
309
+ ### StartChallengeForm
310
+
311
+ Generic form layout component for input + CTA button patterns.
312
+
313
+ ```tsx
314
+ import { StartChallengeForm } from '@donotdev/adv-comps';
315
+
316
+ <StartChallengeForm
317
+ input={{
318
+ value: string
319
+ onChange: (value: string) => void
320
+ placeholder?: string
321
+ label?: string
322
+ maxLength?: number
323
+ className?: string
324
+ }}
325
+ button={{
326
+ label: string
327
+ onClick: () => void
328
+ icon?: ComponentType<{ className?: string }>
329
+ variant?: ButtonVariant
330
+ className?: string
331
+ }}
332
+ size?: 'sm' | 'md' | 'lg'
333
+ className?: string
334
+ />
335
+ ```
336
+
337
+ ### Waterfall
338
+
339
+ Waterfall component with lazy loading built-in. Features clean cascade layout with diagonal staircase effect, perfect for step-by-step processes or feature showcases.
340
+
341
+ ```tsx
342
+ import { Waterfall } from '@donotdev/adv-comps';
343
+ import type { WaterfallProps } from '@donotdev/adv-comps';
344
+
345
+ <Waterfall
346
+ items: ComponentData[]
347
+ className?: string
348
+ connectorClassName?: string
349
+ density?: 'compact' | 'comfortable'
350
+ ariaLabel?: string
351
+ direction?: 'horizontal' | 'descending'
352
+ />
353
+ ```
354
+
355
+ ## Notes
356
+
357
+ - All components are lazy-loaded by default for optimal performance
358
+ - Components use framework theme variables for consistent styling
359
+ - Most components support reduced motion preferences
360
+ - All components are SSR-safe and work with both Vite and Next.js
361
+
362
+ ## FAQSection (from @donotdev/core)
363
+
364
+ FAQ section component for displaying frequently asked questions using accordion. Reads FAQ items from i18n JSON files.
365
+
366
+ **Note:** This component is from `@donotdev/core`, not `@donotdev/adv-comps`. It requires i18n setup with translation files.
367
+
368
+ ```tsx
369
+ import { FAQSection, useTranslation } from '@donotdev/core';
370
+ import { Section } from '@donotdev/components';
371
+
372
+ function FAQPage() {
373
+ const { t } = useTranslation(['faq']);
374
+
375
+ return (
376
+ <Section>
377
+ <FAQSection t={t} keyPrefix="faqs.items" maxIndex={50} />
378
+ </Section>
379
+ );
380
+ }
381
+ ```
382
+
383
+ **Props:**
384
+ - `t: TFunction` - Translation function from `useTranslation` hook
385
+ - `keyPrefix: string` - Base key prefix for FAQ items (e.g., `'faqs.items'`)
386
+ - `maxIndex?: number` - Maximum number of FAQ items to check (default: 50)
387
+ - `className?: string` - CSS class for container
388
+ - `itemClassName?: string` - CSS class for each accordion item
389
+ - `aria-label?: string` - ARIA label for accessibility (default: 'Frequently Asked Questions')
390
+
391
+ **JSON Structure:**
392
+
393
+ FAQ items must be in your i18n JSON files with this structure:
394
+
395
+ ```json
396
+ {
397
+ "faqs": {
398
+ "items": [
399
+ {
400
+ "q": "Question text",
401
+ "a": "Answer text"
402
+ },
403
+ {
404
+ "q": "Another question",
405
+ "a": "Another answer"
406
+ }
407
+ ]
408
+ }
409
+ }
410
+ ```
411
+
412
+ The component uses `translateObjectArray` to automatically load all items from `keyPrefix` (e.g., `faqs.items[0]`, `faqs.items[1]`, etc.) up to `maxIndex`.
413
+
414
+ **Example:**
415
+
416
+ ```tsx
417
+ // src/pages/FAQPage.tsx
418
+ import { FAQSection, useTranslation } from '@donotdev/core';
419
+ import { HeroSection, Section } from '@donotdev/components';
420
+ import { PageContainer } from '@donotdev/ui';
421
+
422
+ export const NAMESPACE = 'faq';
423
+
424
+ function FAQPage() {
425
+ const { t } = useTranslation([NAMESPACE]);
426
+
427
+ return (
428
+ <PageContainer variant="docs">
429
+ <HeroSection title={t('title')} subtitle={t('subtitle')} />
430
+ <Section>
431
+ <FAQSection t={t} keyPrefix="faqs.items" maxIndex={50} />
432
+ </Section>
433
+ </PageContainer>
434
+ );
435
+ }
436
+ ```
437
+
438
+ ```json
439
+ // src/pages/locales/faq_en.json
440
+ {
441
+ "title": "Frequently Asked Questions",
442
+ "subtitle": "Everything you need to know.",
443
+ "faqs": {
444
+ "items": [
445
+ {
446
+ "q": "How long does the free trial last?",
447
+ "a": "There is no limit. You can use the framework packages indefinitely for development and local testing."
448
+ },
449
+ {
450
+ "q": "What is the watermark?",
451
+ "a": "The watermark is a floating button that appears when running applications without a valid license."
452
+ }
453
+ ]
454
+ }
455
+ }
456
+ ```
@@ -22,10 +22,11 @@ These are the only ways one should handle layout to get to quick results functio
22
22
  ## Content Components
23
23
 
24
24
  - **Card** - Premium card component with title, content, footer, and elevation variants.
25
+ - **Navigation with middle-click support:** Wrap Card in Link component for navigation that supports middle-click (opens in new tab). See navigation section below.
25
26
  - **DualCard** - Side-by-side card layout for comparison or feature showcases.
26
27
  - **Text** - Typography component with semantic text variants.
27
28
  - **Blockquote** - Styled blockquote for citations and testimonials.
28
- - **List** - Bullet points, numbered lists, and feature lists with zero CSS.
29
+ - **List** - Bullet points, numbered lists, and feature lists with zero CSS. Use `icon` prop for custom icons, `icon={null}` for plain bullets.
29
30
  - **DescriptionList** - Key-value pairs and metadata using semantic HTML (dl, dt, dd).
30
31
  - **Separator** - Visual separator with semantic styling variants.
31
32
 
@@ -130,5 +131,46 @@ These are the only ways one should handle layout to get to quick results functio
130
131
 
131
132
  **See also:** [COMPONENTS_UI.md](./COMPONENTS_UI.md) for layout/composition components | [COMPONENTS_CRUD.md](./COMPONENTS_CRUD.md) for CRUD operations and entity forms
132
133
 
134
+ ---
135
+
136
+ ## Navigation with Card Component
137
+
138
+ **For clickable cards with navigation support (including middle-click):**
139
+
140
+ Wrap Card in Link component from `@donotdev/ui`:
141
+
142
+ ```tsx
143
+ import { Card } from '@donotdev/components';
144
+ import { Link } from '@donotdev/ui';
145
+
146
+ // Card with navigation (supports middle-click)
147
+ <Link
148
+ path="/about"
149
+ style={{ display: 'block', textDecoration: 'none', height: '100%' }}
150
+ aria-label="Learn more about About"
151
+ >
152
+ <Card
153
+ title="About"
154
+ subtitle="Learn more about us"
155
+ content="Click to navigate"
156
+ />
157
+ </Link>
158
+
159
+ // Card with onClick only (no middle-click support)
160
+ <Card
161
+ title="Action Card"
162
+ onClick={() => handleAction()}
163
+ />
164
+ ```
165
+
166
+ **Why wrap in Link?**
167
+ - Card component is standalone and not routing-aware
168
+ - Link wrapper provides framework navigation (SPA routing, keeps outlet context)
169
+ - Native browser middle-click support (opens in new tab)
170
+ - CSR/SSR safe
171
+
172
+ **Alternative:** Use FeatureCard from `@donotdev/ui` which handles this automatically when `href` prop is provided.
173
+
174
+ ---
133
175
 
134
176
  **All props documented in JSDoc** - Hover in IDE for complete reference.
@@ -39,6 +39,12 @@
39
39
 
40
40
  ---
41
41
 
42
+ ## Helpers
43
+
44
+ - **tList(t, key, count, icon?, size?)** - Translated array as List. Default: CheckCircle icon. Pass `null` for no icon (use with emoji labels).
45
+
46
+ ---
47
+
42
48
  ## Common Components
43
49
 
44
50
  - **AppLoading** - App-level loading component.
@@ -7,6 +7,7 @@
7
7
  ## Core Setup
8
8
 
9
9
  - [SETUP_PAGES.md](./SETUP_PAGES.md) - Pages & routing (pre-configured)
10
+ - [USE_ROUTING.md](./USE_ROUTING.md) - **Routing components & hooks (CRITICAL)**
10
11
  - [SETUP_APP_CONFIG.md](./SETUP_APP_CONFIG.md) - App + Vite configuration
11
12
  - [SETUP_I18N.md](./SETUP_I18N.md) - Translations (pre-configured)
12
13
  - [SETUP_THEMES.md](./SETUP_THEMES.md) - Themes & CSS variables (pre-configured)
@@ -16,9 +17,11 @@
16
17
 
17
18
  ## Feature Setup
18
19
 
20
+ - [SETUP_CRUD.md](./SETUP_CRUD.md) - CRUD operations & data access (critical)
19
21
  - [SETUP_AUTH.md](./SETUP_AUTH.md) - Authentication (pre-configured)
20
22
  - [SETUP_OAUTH.md](./SETUP_OAUTH.md) - OAuth connections (pre-configured)
21
23
  - [SETUP_BILLING.md](./SETUP_BILLING.md) - Stripe subscriptions (pre-configured)
24
+ - [SETUP_PWA.md](./SETUP_PWA.md) - Progressive Web App setup
22
25
  - [SETUP_FUNCTIONS.md](./SETUP_FUNCTIONS.md) - Firebase Functions (pre-configured)
23
26
 
24
27
  ---
@@ -13,6 +13,8 @@ import type { AppConfig } from '@donotdev/core';
13
13
  export const appConfig: AppConfig = {
14
14
  app: {
15
15
  name: 'My App',
16
+ shortName: 'App', // Required for PWA
17
+ description: 'My app description', // Required for PWA
16
18
  url: 'https://myapp.com',
17
19
  },
18
20
 
@@ -93,9 +95,10 @@ export default defineViteConfig({
93
95
  generateSitemap: true,
94
96
  },
95
97
 
96
- // PWA
98
+ // PWA (see SETUP_PWA.md for full guide)
97
99
  pwa: {
98
- enabled: false,
100
+ enabled: false, // Enable PWA in production
101
+ devEnabled: false, // Enable PWA in development (optional)
99
102
  },
100
103
  });
101
104
  ```
@@ -1,6 +1,6 @@
1
1
  # Setup: Billing
2
2
 
3
- **Most is pre-configured.** Create Stripe config files. Framework handles checkout, webhooks, subscriptions.
3
+ **Most is pre-configured.** Create Stripe config files. Framework handles checkout, webhooks, subscriptions, and loading UX.
4
4
 
5
5
  ---
6
6
 
@@ -24,6 +24,36 @@ STRIPE_WEBHOOK_SECRET=whsec_xxx
24
24
 
25
25
  ---
26
26
 
27
+ ## Automatic UX (Zero Config)
28
+
29
+ **The hook handles loading overlays automatically for redirect operations:**
30
+
31
+ ```tsx
32
+ // Just call the method - framework handles the rest
33
+ const checkout = useStripeBilling('checkout', authState);
34
+ const openCustomerPortal = useStripeBilling('openCustomerPortal', authState);
35
+
36
+ // Checkout → Shows "Redirecting to Stripe" / "Initializing secure payment..."
37
+ await checkout({ priceId: 'price_123', mode: 'payment' });
38
+
39
+ // Portal → Shows "Redirecting to Stripe" / "Opening billing portal..."
40
+ await openCustomerPortal();
41
+ ```
42
+
43
+ **What happens automatically:**
44
+ - Blocking fullscreen overlay during Firebase Functions cold start
45
+ - Operation-specific messaging (checkout vs portal)
46
+ - Translated in all 8 supported languages
47
+ - Clean removal on redirect or error
48
+
49
+ **Optional:** Use `loading` state if you want to disable your own buttons:
50
+ ```tsx
51
+ const loading = useStripeBilling('loading', authState);
52
+ <Button disabled={loading}>Purchase</Button>
53
+ ```
54
+
55
+ ---
56
+
27
57
  ## Advanced: Frontend Config
28
58
 
29
59
  ```typescript
@@ -69,10 +99,20 @@ import { useStripeBilling } from '@donotdev/billing';
69
99
  import { SubscriptionTemplate, PaymentTemplate } from '@donotdev/templates';
70
100
  import { ProductCard, SubscriptionManager } from '@donotdev/billing';
71
101
 
72
- const checkout = useStripeBilling('checkout');
73
- await checkout({ priceId: 'price_123', mode: 'subscription' });
102
+ // Auth state required
103
+ const user = useAuth('user');
104
+ const status = useAuth('status');
105
+ const authState = { user, status };
106
+
107
+ // Methods - framework handles overlay automatically
108
+ const checkout = useStripeBilling('checkout', authState);
109
+ const openCustomerPortal = useStripeBilling('openCustomerPortal', authState);
110
+
111
+ // Optional state access
112
+ const loading = useStripeBilling('loading', authState);
113
+ const error = useStripeBilling('error', authState);
74
114
  ```
75
115
 
76
116
  ---
77
117
 
78
- **Create config files, get billing. Framework handles the rest.**
118
+ **Create config files, get billing with best-in-class UX. Framework handles the rest.**