keystone-design-bootstrap 1.0.68 → 1.0.70

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 (34) hide show
  1. package/README.md +74 -132
  2. package/dist/design_system/sections/index.js +110 -60
  3. package/dist/design_system/sections/index.js.map +1 -1
  4. package/dist/index.js +117 -61
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/server-api.d.ts +9 -1
  7. package/dist/lib/server-api.js +11 -0
  8. package/dist/lib/server-api.js.map +1 -1
  9. package/dist/tracking/index.d.ts +134 -5
  10. package/dist/tracking/index.js +123 -0
  11. package/dist/tracking/index.js.map +1 -1
  12. package/package.json +2 -1
  13. package/src/design_system/components/ChatWidget.tsx +6 -7
  14. package/src/design_system/portal/LoginForm.tsx +21 -2
  15. package/src/design_system/portal/PortalPage.tsx +5 -5
  16. package/src/design_system/portal/PortalTabTracker.tsx +10 -2
  17. package/src/design_system/sections/contact-section-form.aman.tsx +6 -1
  18. package/src/design_system/sections/contact-section-form.balance.tsx +6 -1
  19. package/src/design_system/sections/contact-section-form.barelux.tsx +6 -1
  20. package/src/design_system/sections/contact-section-form.tsx +6 -1
  21. package/src/design_system/sections/email-signup-section.tsx +6 -1
  22. package/src/design_system/sections/header-navigation.aman.tsx +6 -1
  23. package/src/design_system/sections/header-navigation.balance.tsx +6 -1
  24. package/src/design_system/sections/header-navigation.barelux.tsx +6 -1
  25. package/src/design_system/sections/header-navigation.tsx +6 -1
  26. package/src/design_system/sections/job-application-form.aman.tsx +6 -1
  27. package/src/design_system/sections/job-application-form.barelux.tsx +6 -1
  28. package/src/design_system/sections/job-application-form.tsx +6 -1
  29. package/src/lib/server-api.ts +18 -0
  30. package/src/next/layouts/root-layout.tsx +78 -33
  31. package/src/tracking/KeystoneAnalyticsTracker.tsx +41 -0
  32. package/src/tracking/PostHogProvider.tsx +128 -0
  33. package/src/tracking/captureEvent.ts +140 -0
  34. package/src/tracking/index.ts +5 -0
package/README.md CHANGED
@@ -1,175 +1,117 @@
1
1
  # Keystone Design Bootstrap
2
2
 
3
- A comprehensive design system for Keystone customer websites. Provides themed sections, elements, and utilities for building consistent, server-rendered Next.js sites.
3
+ The shared design system and runtime package powering all Keystone customer websites. Provides themed sections, UI elements, the member portal, server-side API helpers, form handling, Meta Pixel tracking, and the Next.js app shell.
4
4
 
5
- ## Quick Start
5
+ ---
6
6
 
7
- 1. **Set your theme** in `config/index.ts`:
8
- ```typescript
9
- export const config = {
10
- site: { theme: "barelux" } // or "aman", "classic"
11
- }
12
- ```
7
+ ## Documentation
13
8
 
14
- 2. **Import theme CSS** in your `app/globals.css`:
15
- ```css
16
- @import "keystone-design-bootstrap/styles/fonts.css";
17
- @import "keystone-design-bootstrap/styles/theme.css";
18
- @import "keystone-design-bootstrap/styles/typography.css";
19
- @import "keystone-design-bootstrap/styles/style-overrides.barelux.css"; /* Change to match your theme */
20
- ```
9
+ | Doc | Description |
10
+ |---|---|
11
+ | [`docs/architecture.md`](./docs/architecture.md) | Package structure, rendering model, theme system, publishing workflow |
12
+ | [`docs/server-api.md`](./docs/server-api.md) | All data-fetching functions, caching strategy, environment variables |
13
+ | [`docs/navigation-and-layout.md`](./docs/navigation-and-layout.md) | `KeystoneRootLayout`, `SiteConfig`, CTA URL resolution, dynamic nav, mobile sticky footer |
14
+ | [`docs/member-portal.md`](./docs/member-portal.md) | Member portal setup, tabs, auth flow, iframe booking, messaging |
15
+ | [`docs/forms.md`](./docs/forms.md) | Dynamic forms, `ContactSection`, form route, custom form pattern |
16
+ | [`docs/meta-tracking.md`](./docs/meta-tracking.md) | Meta Pixel initialization, automatic events, custom form tracking |
17
+ | [`docs/site-customization.md`](./docs/site-customization.md) | Per-site config, style overrides, component customization hierarchy |
18
+ | [`docs/theme-system.md`](./docs/theme-system.md) | Creating and registering themes, CSS tokens, component variants |
21
19
 
22
- 3. **Run** `npm run dev` and you're ready!
20
+ ---
23
21
 
24
- ## Installation
22
+ ## Quick start (new customer site)
23
+
24
+ ### 1. Environment variables
25
25
 
26
26
  ```bash
27
- npm install @keystone-pzjr/design-bootstrap
27
+ # .env.local
28
+ API_URL=http://localhost:3000/api/v1
29
+ API_KEY=your-api-key-here
28
30
  ```
29
31
 
30
- ## Using the Design System
31
-
32
- ### Elements
33
- Reusable UI components:
32
+ ### 2. Config
34
33
 
35
34
  ```typescript
36
- import { Button, Input, Carousel } from '@keystone-pzjr/design-bootstrap/elements'
35
+ // config/index.ts
36
+ import type { SiteConfig } from 'keystone-design-bootstrap/types';
37
37
 
38
- <Button color="primary" size="md">Click Me</Button>
39
- <Input label="Email" type="email" />
40
- <Carousel items={photos} />
38
+ export const config: SiteConfig = {
39
+ site: { title: "Business Name", description: "", theme: "aman" },
40
+ navigation: { header: […], footer: [[…], […], […], […]] },
41
+ };
41
42
  ```
42
43
 
43
- ### Server API
44
- Async functions for fetching data server-side:
44
+ ### 3. Root layout
45
45
 
46
46
  ```typescript
47
- import { getServices, getTestimonials, getBlogPosts } from '@keystone-pzjr/design-bootstrap/lib/server-api'
47
+ // app/layout.tsx
48
+ import { KeystoneRootLayout } from 'keystone-design-bootstrap/next/layouts/root-layout';
49
+ import { config } from '@/config';
48
50
 
49
- const services = await getServices()
50
- const testimonials = await getTestimonials()
51
- ```
52
-
53
- ### Sections
54
- Pre-built page components that accept data via props:
55
-
56
- ```typescript
57
- import { HeroHome, TestimonialsHome } from '@keystone-pzjr/design-bootstrap/sections'
58
- import { getTestimonials } from '@keystone-pzjr/design-bootstrap/lib/server-api'
59
-
60
- export default async function HomePage() {
61
- const testimonials = await getTestimonials()
62
- return (
63
- <main>
64
- <HeroHome />
65
- <TestimonialsHome testimonials={testimonials} />
66
- </main>
67
- )
51
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
52
+ return <KeystoneRootLayout config={config}>{children}</KeystoneRootLayout>;
68
53
  }
69
54
  ```
70
55
 
71
- **Available:** `HeroHome`, `ServicesHome`, `TestimonialsHome`, `BlogSection`, `ContactSection`, `HeaderNavigation`, `FooterHome`, and more.
72
-
73
- ## Package Exports
74
-
75
- ```typescript
76
- // Sections (hero, footer, header, testimonials, etc.)
77
- import { HeroHome, FooterHome, TestimonialsHome } from '@keystone-pzjr/design-bootstrap/sections'
78
-
79
- // Elements (buttons, inputs, carousels, etc.)
80
- import { Button, Input, Carousel } from '@keystone-pzjr/design-bootstrap/elements'
81
-
82
- // Hooks
83
- import { useBreakpoint } from '@keystone-pzjr/design-bootstrap/hooks'
84
-
85
- // Theme context
86
- import { ThemeProvider } from '@keystone-pzjr/design-bootstrap/contexts'
56
+ ### 4. CSS imports
87
57
 
88
- // Server API utilities
89
- import { getServices, getTestimonials } from '@keystone-pzjr/design-bootstrap/lib/server-api'
90
-
91
- // Types
92
- import type { Service, Testimonial } from '@keystone-pzjr/design-bootstrap/types'
93
-
94
- // Themes
95
- import { themes } from '@keystone-pzjr/design-bootstrap/themes'
58
+ ```css
59
+ /* app/globals.css */
60
+ @import "keystone-design-bootstrap/styles/fonts.css";
61
+ @import "keystone-design-bootstrap/styles/theme.css";
62
+ @import "keystone-design-bootstrap/styles/typography.css";
63
+ @import "keystone-design-bootstrap/styles/style-overrides.aman.css"; /* match your theme */
64
+ @import "../styles/custom-overrides.css";
96
65
  ```
97
66
 
98
- ## Meta Pixel Tracking
67
+ ---
99
68
 
100
- Meta Pixel is initialised automatically in `KeystoneRootLayout` when the account has a connected Meta integration with a pixel configured. Most events fire without any extra work. The one place you need to add tracking manually is **custom form submissions**.
69
+ ## Package exports reference
101
70
 
102
- ### What fires automatically
103
-
104
- | Event | Trigger |
71
+ | Import path | Contents |
105
72
  |---|---|
106
- | `PageView` | Every page load |
107
- | `ViewContent` | Route changes to `/services`, `/services/:slug`, `/locations`, `/locations/:slug`, `/portal`, `/service-menu`, `/faq`, `/contact` |
108
- | `InitiateCheckout` | Click on any link to the account's external booking URL |
109
- | Portal tab events | Opening Services, Packages, Specials, or Booking tabs in the member portal |
110
-
111
- ### Adding tracking to a custom form
112
-
113
- On successful submission, add two calls:
73
+ | `keystone-design-bootstrap/sections` | All section components |
74
+ | `keystone-design-bootstrap/elements` | UI element components |
75
+ | `keystone-design-bootstrap/portal` | `PortalPage` and portal sub-components |
76
+ | `keystone-design-bootstrap/next/layouts/root-layout` | `KeystoneRootLayout` |
77
+ | `keystone-design-bootstrap/next/routes/consumer-auth` | `createConsumerAuthHandlers` |
78
+ | `keystone-design-bootstrap/next/routes/form` | `createFormRouteHandlers` (re-exported as `POST`) |
79
+ | `keystone-design-bootstrap/lib/server-api` | Server-side data fetching functions |
80
+ | `keystone-design-bootstrap/lib/cta-urls` | `resolveCtaUrls`, `resolvePortalPath`, `isExternalCtaUrl` |
81
+ | `keystone-design-bootstrap/tracking` | `firePixelEvent`, `setPixelUserData` |
82
+ | `keystone-design-bootstrap/types` | TypeScript types |
83
+ | `keystone-design-bootstrap/hooks` | Client-side hooks |
84
+ | `keystone-design-bootstrap/styles/*` | CSS files |
114
85
 
115
- ```tsx
116
- import { firePixelEvent, setPixelUserData } from 'keystone-design-bootstrap/tracking';
117
-
118
- // inside your success handler, after a confirmed API response:
119
- await setPixelUserData({ email: data.email, phone: data.phone });
120
- firePixelEvent('Lead');
121
- ```
86
+ ---
122
87
 
123
- Also submit with `formType: 'lead'` in the POST body — this triggers the server-side CAPI `Lead` event automatically with no extra backend work.
88
+ ## Local development
124
89
 
125
- Both calls are silent no-ops when no Meta Pixel is configured for the site.
90
+ Use `yalc` to test local builds in a customer site:
126
91
 
127
- See `components/sections/VipReferralForm.tsx` in any customer site for a complete working example.
128
-
129
- ## Architecture
130
-
131
- - **Server-first**: Data fetching happens server-side, components render as Server Components where possible
132
- - **Theme variants**: Components automatically select variants based on active theme
133
- - **Tailwind-first**: Use semantic utility classes (`bg-primary`, `text-fg-primary`, `font-display`)
134
- - **Type-safe**: Full TypeScript support throughout
135
- - **CSS variables**: Themes customize via CSS custom properties
136
- - **Self-hosted fonts**: Uses Fontsource for optimized, bundled font loading
137
-
138
- ## Theme System
139
-
140
- **Available themes:** `classic`, `aman`, `barelux`
141
-
142
- ### Themes
92
+ ```bash
93
+ # In this package
94
+ npm run build && yalc publish
143
95
 
144
- - **classic**: Default professional theme, Inter font, neutral colors
145
- - **aman**: Luxury theme with Playfair Display serifs, warm beige, bronze accents
146
- - **barelux**: Modern minimal theme with Poppins, clean lines
96
+ # In the customer site
97
+ yalc update keystone-design-bootstrap
147
98
 
148
- ### Creating a Theme
99
+ # To restore the published npm version
100
+ yalc remove keystone-design-bootstrap && npm install
101
+ ```
149
102
 
150
- See [`docs/theme-system.md`](./docs/theme-system.md) for complete instructions.
103
+ ---
151
104
 
152
- **With AI assistance:**
153
- ```
154
- I am creating a new theme. Here is a link to an example: https://www.example.com
155
- [Attach screenshots of various pages]
105
+ ## Creating a new theme
156
106
 
157
- Please follow the prompt in /docs/ai-prompt-template.md
158
- ```
107
+ See [`docs/theme-system.md`](./docs/theme-system.md) for the full guide.
159
108
 
160
- **Manual steps:**
109
+ Quick checklist:
161
110
  1. Register in `src/themes/index.ts`
162
111
  2. Install fonts via Fontsource
163
112
  3. Create `src/styles/style-overrides.{theme}.css`
164
113
  4. Create component variants (optional)
165
- 5. Add to design gallery app
166
- 6. Pass lint, typecheck, and build
167
-
168
- **Critical rules:**
169
- - Never modify base components or foundation CSS
170
- - Use semantic variables/classes only
171
- - Set BOTH `--color-*` and `--background-*` prefixes
172
- - Match base component props exactly
173
- - Ensure `npm run lint`, `npm run typecheck`, `npm run build` pass with zero errors/warnings
114
+ 5. Add to design gallery
115
+ 6. `npm run lint && npm run typecheck && npm run build` — must all pass
174
116
 
175
- See [`.cursor/rules/theme-creation.mdc`](./.cursor/rules/theme-creation.mdc) for detailed rules
117
+ **Available themes:** `classic`, `aman`, `barelux`, `balance`