@bigz-app/booking-widget 0.3.11 → 1.1.0

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 (93) hide show
  1. package/README.md +206 -94
  2. package/dist/booking-widget.js +7555 -7948
  3. package/dist/booking-widget.js.map +1 -1
  4. package/dist/components/PromoDialog.d.ts +13 -1
  5. package/dist/components/PromoDialog.d.ts.map +1 -1
  6. package/dist/components/Sidebar.d.ts +3 -3
  7. package/dist/components/Sidebar.d.ts.map +1 -1
  8. package/dist/components/UniversalBookingWidget.d.ts +15 -0
  9. package/dist/components/UniversalBookingWidget.d.ts.map +1 -1
  10. package/dist/components/{BookingForm.d.ts → booking/BookingForm.d.ts} +15 -1
  11. package/dist/components/booking/BookingForm.d.ts.map +1 -0
  12. package/dist/components/booking/BookingSuccessModal.d.ts.map +1 -0
  13. package/dist/components/{PaymentForm.d.ts → booking/PaymentForm.d.ts} +9 -3
  14. package/dist/components/booking/PaymentForm.d.ts.map +1 -0
  15. package/dist/components/booking/VoucherInput.d.ts.map +1 -0
  16. package/dist/components/booking/index.d.ts +5 -0
  17. package/dist/components/booking/index.d.ts.map +1 -0
  18. package/dist/components/events/EventInstanceSelection.d.ts.map +1 -0
  19. package/dist/components/events/EventTypeDetailsDialog.d.ts.map +1 -0
  20. package/dist/components/{EventTypeSelection.d.ts → events/EventTypeSelection.d.ts} +0 -12
  21. package/dist/components/events/EventTypeSelection.d.ts.map +1 -0
  22. package/dist/components/events/ImageCarousel.d.ts.map +1 -0
  23. package/dist/components/{NextEventsPreview.d.ts → events/NextEventsPreview.d.ts} +1 -1
  24. package/dist/components/events/NextEventsPreview.d.ts.map +1 -0
  25. package/dist/components/events/index.d.ts +6 -0
  26. package/dist/components/events/index.d.ts.map +1 -0
  27. package/dist/components/shared/Badge.d.ts +18 -0
  28. package/dist/components/shared/Badge.d.ts.map +1 -0
  29. package/dist/components/shared/Button.d.ts +29 -0
  30. package/dist/components/shared/Button.d.ts.map +1 -0
  31. package/dist/components/shared/EmptyState.d.ts +19 -0
  32. package/dist/components/shared/EmptyState.d.ts.map +1 -0
  33. package/dist/components/shared/ErrorBoundary.d.ts +30 -0
  34. package/dist/components/shared/ErrorBoundary.d.ts.map +1 -0
  35. package/dist/components/shared/FormGroup.d.ts +23 -0
  36. package/dist/components/shared/FormGroup.d.ts.map +1 -0
  37. package/dist/components/shared/Input.d.ts +26 -0
  38. package/dist/components/shared/Input.d.ts.map +1 -0
  39. package/dist/components/shared/SectionHeader.d.ts +15 -0
  40. package/dist/components/shared/SectionHeader.d.ts.map +1 -0
  41. package/dist/components/shared/Spinner.d.ts +20 -0
  42. package/dist/components/shared/Spinner.d.ts.map +1 -0
  43. package/dist/components/shared/icons.d.ts +27 -0
  44. package/dist/components/shared/icons.d.ts.map +1 -0
  45. package/dist/components/shared/index.d.ts +12 -0
  46. package/dist/components/shared/index.d.ts.map +1 -0
  47. package/dist/components/shared/skeletons/EventCardSkeleton.d.ts +11 -0
  48. package/dist/components/shared/skeletons/EventCardSkeleton.d.ts.map +1 -0
  49. package/dist/components/shared/skeletons/EventInstanceSkeleton.d.ts +13 -0
  50. package/dist/components/shared/skeletons/EventInstanceSkeleton.d.ts.map +1 -0
  51. package/dist/components/shared/skeletons/NextEventsSkeleton.d.ts +11 -0
  52. package/dist/components/shared/skeletons/NextEventsSkeleton.d.ts.map +1 -0
  53. package/dist/components/shared/skeletons/index.d.ts +4 -0
  54. package/dist/components/shared/skeletons/index.d.ts.map +1 -0
  55. package/dist/components/upsells/UpsellCard.d.ts +10 -0
  56. package/dist/components/upsells/UpsellCard.d.ts.map +1 -0
  57. package/dist/components/upsells/UpsellsStep.d.ts +39 -0
  58. package/dist/components/upsells/UpsellsStep.d.ts.map +1 -0
  59. package/dist/components/upsells/index.d.ts +4 -0
  60. package/dist/components/upsells/index.d.ts.map +1 -0
  61. package/dist/index.cjs +7489 -7929
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.d.ts +4 -3
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.esm.js +7490 -7930
  66. package/dist/index.esm.js.map +1 -1
  67. package/dist/index.npm.d.ts +2 -1
  68. package/dist/index.npm.d.ts.map +1 -1
  69. package/dist/index.vanilla.d.ts +3 -2
  70. package/dist/index.vanilla.d.ts.map +1 -1
  71. package/dist/styles/StyleProvider.d.ts +1 -1
  72. package/dist/styles/StyleProvider.d.ts.map +1 -1
  73. package/dist/styles/shared-styles.d.ts +71 -0
  74. package/dist/styles/shared-styles.d.ts.map +1 -0
  75. package/dist/utils.d.ts +1 -1
  76. package/dist/utils.d.ts.map +1 -1
  77. package/dist/validation/booking-schema.d.ts +84 -0
  78. package/dist/validation/booking-schema.d.ts.map +1 -0
  79. package/package.json +8 -3
  80. package/dist/components/BookingForm.d.ts.map +0 -1
  81. package/dist/components/BookingSuccessModal.d.ts.map +0 -1
  82. package/dist/components/EventInstanceSelection.d.ts.map +0 -1
  83. package/dist/components/EventTypeDetailsDialog.d.ts.map +0 -1
  84. package/dist/components/EventTypeSelection.d.ts.map +0 -1
  85. package/dist/components/ImageCarousel.d.ts.map +0 -1
  86. package/dist/components/NextEventsPreview.d.ts.map +0 -1
  87. package/dist/components/PaymentForm.d.ts.map +0 -1
  88. package/dist/components/VoucherInput.d.ts.map +0 -1
  89. /package/dist/components/{BookingSuccessModal.d.ts → booking/BookingSuccessModal.d.ts} +0 -0
  90. /package/dist/components/{VoucherInput.d.ts → booking/VoucherInput.d.ts} +0 -0
  91. /package/dist/components/{EventInstanceSelection.d.ts → events/EventInstanceSelection.d.ts} +0 -0
  92. /package/dist/components/{EventTypeDetailsDialog.d.ts → events/EventTypeDetailsDialog.d.ts} +0 -0
  93. /package/dist/components/{ImageCarousel.d.ts → events/ImageCarousel.d.ts} +0 -0
package/README.md CHANGED
@@ -1,130 +1,242 @@
1
- # @bigz-app/booking-widget
1
+ # bigZ Booking Widget
2
2
 
3
- A flexible and themeable booking widget for BigZ Bookings in React.
3
+ A modern, customizable booking widget for bigZ Booking System built with React, TypeScript, and Tailwind CSS v4.
4
4
 
5
- ## Installation
5
+ ## Features
6
6
 
7
- ```bash
8
- pnpm install @bigz-app/booking-widget
9
- ```
7
+ - 🎯 **Multi-format support**: ESM, CommonJS, and UMD builds
8
+ - **Performance optimized**: Built with Preact for UMD, React for npm
9
+ - 🎨 **Fully customizable**: Theme-based styling with CSS custom properties
10
+ - 🌍 **Internationalization ready**: Support for multiple currencies and locales
11
+ - 📱 **Responsive design**: Mobile-first approach with Tailwind CSS
12
+ - 🔒 **Type-safe**: Full TypeScript support with strict type checking
13
+ - 🧩 **Modular architecture**: Well-organized component structure
14
+ - 💳 **Payment integration**: Stripe-powered payment processing
15
+ - 🎫 **Discount system**: Voucher and gift card support
10
16
 
11
17
  ## Quick Start
12
18
 
13
- Import the widget and provide the necessary configuration. The widget handles the entire booking flow, from event selection to payment, with optional Google Ads conversion tracking.
19
+ ### For Vanilla JavaScript (UMD)
20
+
21
+ ```html
22
+ <!DOCTYPE html>
23
+ <html>
24
+ <head>
25
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@bigz-app/booking-widget@latest/dist/styles.css">
26
+ </head>
27
+ <body>
28
+ <div id="booking-widget"></div>
29
+
30
+ <script src="https://cdn.jsdelivr.net/npm/@bigz-app/booking-widget@latest/dist/booking-widget.js"></script>
31
+ <script>
32
+ BigZBookingWidget.init({
33
+ target: '#booking-widget',
34
+ config: {
35
+ apiUrl: 'https://api.bigz.app',
36
+ locale: 'de',
37
+ currency: 'EUR',
38
+ theme: {
39
+ primary: '#007bff',
40
+ secondary: '#6c757d',
41
+ success: '#28a745',
42
+ warning: '#ffc107',
43
+ error: '#dc3545'
44
+ }
45
+ }
46
+ });
47
+ </script>
48
+ </body>
49
+ </html>
50
+ ```
51
+
52
+ ### For React Applications
53
+
54
+ ```bash
55
+ npm install @bigz-app/booking-widget
56
+ # or
57
+ pnpm add @bigz-app/booking-widget
58
+ ```
14
59
 
15
60
  ```tsx
16
61
  import { UniversalBookingWidget } from '@bigz-app/booking-widget';
17
- import type { UniversalBookingConfig } from '@bigz-app/booking-widget';
18
62
 
19
- const MyBookingPage = () => {
20
- const config: UniversalBookingConfig = {
21
- // Required
22
- apiBaseUrl: "https://bigz.app",
23
- organizationId: "your-org-id",
63
+ function App() {
64
+ const config = {
65
+ apiUrl: 'https://api.bigz.app',
66
+ locale: 'de',
67
+ currency: 'EUR',
68
+ // ... other config options
69
+ };
70
+
71
+ return <UniversalBookingWidget config={config} />;
72
+ }
73
+ ```
74
+
75
+ ## Configuration
24
76
 
25
- // Choose one event selection method
26
- eventTypeId: 123,
77
+ ### UniversalBookingConfig
27
78
 
28
- // Optional theming
29
- theme: "light-professional",
79
+ ```typescript
80
+ interface UniversalBookingConfig {
81
+ // API Configuration
82
+ apiUrl: string;
83
+ apiKey?: string;
84
+
85
+ // Localization
86
+ locale?: SupportedLocale; // 'de' | 'en'
87
+ currency?: CurrencyCode; // 'EUR' | 'USD' | 'GBP' | etc.
88
+
89
+ // Theming
90
+ theme?: {
91
+ surface?: string;
92
+ background?: string;
93
+ highlight?: string;
94
+ text?: string;
95
+ muted?: string;
96
+ border?: string;
97
+ success?: string;
98
+ warning?: string;
99
+ error?: string;
30
100
  };
31
101
 
32
- return <UniversalBookingWidget config={config} />;
33
- };
102
+ // UI Options
103
+ view?: 'next-events' | 'button' | 'cards';
104
+ maxEvents?: number;
105
+ showPrices?: boolean;
106
+ showDescriptions?: boolean;
107
+
108
+ // Promo Dialog
109
+ promoDialog?: PromoDialogConfig;
110
+
111
+ // Callbacks
112
+ onBookingComplete?: (booking: BookingResult) => void;
113
+ onError?: (error: Error) => void;
114
+ }
115
+ ```
116
+
117
+ ## Component Architecture
118
+
119
+ ```
120
+ src/components/
121
+ ├── booking/ # Booking flow components
122
+ │ ├── BookingForm.tsx
123
+ │ ├── PaymentForm.tsx
124
+ │ └── VoucherInput.tsx
125
+ ├── events/ # Event selection components
126
+ │ ├── EventTypeSelection.tsx
127
+ │ ├── EventInstanceSelection.tsx
128
+ │ └── NextEventsPreview.tsx
129
+ ├── shared/ # Reusable UI components
130
+ │ ├── Button.tsx
131
+ │ ├── Input.tsx
132
+ │ ├── Spinner.tsx
133
+ │ └── skeletons/
134
+ └── UniversalBookingWidget.tsx # Main entry point
135
+ ```
136
+
137
+ ## Styling & Theming
138
+
139
+ The widget uses Tailwind CSS v4 with CSS custom properties for theming. All colors, spacing, and typography can be customized through CSS variables:
140
+
141
+ ```css
142
+ :root {
143
+ --bw-surface-color: #ffffff;
144
+ --bw-background-color: #f8f9fa;
145
+ --bw-highlight-color: #007bff;
146
+ --bw-text-color: #212529;
147
+ --bw-text-muted: #6c757d;
148
+ --bw-border-color: #dee2e6;
149
+ --bw-success-color: #28a745;
150
+ --bw-warning-color: #ffc107;
151
+ --bw-error-color: #dc3545;
152
+ --bw-border-radius: 8px;
153
+ --bw-font-family: system-ui, sans-serif;
154
+ }
34
155
  ```
35
156
 
36
- ## Theming & Customization
157
+ ## Development
37
158
 
38
- The widget includes several built-in themes and can be deeply customized.
159
+ ### Prerequisites
39
160
 
40
- **Available Themes:**
41
- `light-fresh`, `light-elegant`, `light-vibrant`, `light-professional`, `dark-modern`, `dark-forest`, `dark-matrix`, `dark-luxury`, `dark-energetic`.
161
+ - Node.js 18+
162
+ - pnpm
42
163
 
43
- **Customizing a Theme:**
44
- You can override any theme's colors, border radius, or font family.
164
+ ### Setup
45
165
 
46
- ```tsx
47
- const config = {
48
- // ...
49
- theme: "dark-modern", // Start with a base theme
50
- colors: {
51
- highlight: "#10b981", // Custom accent: hex, rgb, or tailwind name ("emerald-500")
52
- surface: "#1f2937", // Custom card background ("gray-800")
53
- },
54
- borderRadius: "16px", // e.g. "4px", "md"
55
- fontFamily: "'Courier New', monospace", // Any valid CSS font-family
56
- };
166
+ ```bash
167
+ # Install dependencies
168
+ pnpm install
169
+
170
+ # Start development server
171
+ pnpm dev
172
+
173
+ # Build for production
174
+ pnpm build
175
+
176
+ # Run linting
177
+ pnpm lint
178
+
179
+ # Type checking
180
+ pnpm exec tsc --noEmit
57
181
  ```
58
182
 
59
- ## Configuration
183
+ ### Build Outputs
60
184
 
61
- The widget is configured with a single object. You must provide `apiBaseUrl`, `organizationId`, and one event selection method.
185
+ - `dist/index.esm.js` - ES modules for modern bundlers
186
+ - `dist/index.cjs` - CommonJS for Node.js
187
+ - `dist/booking-widget.js` - UMD build with Preact for vanilla JS
188
+ - `dist/styles.css` - Extracted CSS styles
62
189
 
63
- ```typescript
64
- interface UniversalBookingConfig {
65
- // --- Required ---
66
- apiBaseUrl: string; // Your booking system API base URL
67
- organizationId: string; // Your organization's ID
68
-
69
- // --- Event Selection (choose ONE) ---
70
- eventInstanceId?: number; // Directly book a specific instance
71
- categoryId?: number; // Show all event types in a category
72
- eventTypeIds?: number[]; // Show a specific list of event types
73
- eventTypeId?: number; // Show instances for a single event type
74
-
75
- // --- Theming & Customization ---
76
- theme?: 'light-fresh' | 'light-elegant' | '...' ;
77
- colors?: {
78
- highlight?: string; // Main action/accent color
79
- background?: string; // Page background
80
- surface?: string; // Card/surface background
81
- text?: string; // Main text color
82
- border?: string; // Border color
83
- };
84
- borderRadius?: string; // e.g., "lg", "8px"
85
- fontFamily?: string; // e.g., "Inter", "system-ui"
190
+ ## API Reference
191
+
192
+ ### UniversalBookingWidget Props
86
193
 
87
- // --- Optional ---
88
- locale?: string;
89
- onSuccess?: (result: any) => void;
90
- onError?: (error: string) => void;
194
+ ```typescript
195
+ interface UniversalBookingWidgetProps {
196
+ config: UniversalBookingConfig;
197
+ className?: string;
91
198
  }
92
199
  ```
93
200
 
94
- ## URL Parameter Overrides
201
+ ### Supported Locales
95
202
 
96
- The widget can be configured dynamically using URL query parameters. These will override any props passed in the `config` object, which is useful for creating dynamic booking links.
203
+ - `de` - German
204
+ - `en` - English
97
205
 
98
- | Parameter | Maps to Config | Example URL |
99
- |------------------|------------------|-----------------------|
100
- | `instanceId` | `eventInstanceId`| `?instanceId=123` |
101
- | `categoryId` | `categoryId` | `?categoryId=1` |
102
- | `eventTypeId` | `eventTypeId` | `?eventTypeId=5` |
103
- | `eventTypeIds` | `eventTypeIds` | `?eventTypeIds=1,3,5` |
206
+ ### Supported Currencies
104
207
 
105
- ## Google Ads Conversion Tracking
208
+ - `EUR` - Euro (€)
209
+ - `USD` - US Dollar ($)
210
+ - `GBP` - British Pound (£)
211
+ - `CHF` - Swiss Franc (CHF)
212
+ - `SEK` - Swedish Krona (kr)
213
+ - `NOK` - Norwegian Krone (kr)
214
+ - `DKK` - Danish Krone (kr)
215
+ - `PLN` - Polish Zloty (zł)
216
+ - `CZK` - Czech Koruna (Kč)
106
217
 
107
- The widget supports automatic Google Ads conversion tracking when payments are successful. This feature requires Google Consent Mode to be implemented on your website.
218
+ ## Browser Support
108
219
 
109
- ```tsx
110
- const config = {
111
- // ... your existing config
112
- googleAds: {
113
- tagId: 'AW-XXXXXXX', // Your Google Ads Tag ID (required)
114
- conversionId: 'booking_conversion', // Your conversion label (required)
115
- conversionCurrency: 'EUR', // Optional, defaults to 'EUR'
116
- includeValue: true, // Optional, defaults to true
117
- consent: true // send the users consent to the widget when initializing.
118
- }
119
- };
120
- ```
220
+ - Chrome 90+
221
+ - Firefox 88+
222
+ - Safari 14+
223
+ - Edge 90+
224
+
225
+ ## Contributing
226
+
227
+ 1. Fork the repository
228
+ 2. Create a feature branch
229
+ 3. Make your changes
230
+ 4. Add tests if applicable
231
+ 5. Ensure TypeScript compilation passes
232
+ 6. Submit a pull request
233
+
234
+ ## License
121
235
 
122
- **Key Features:**
123
- - ✅ Uses Google Consent Mode for proper consent management
124
- - ✅ Prevents duplicate gtag initialization
125
- - ✅ Includes booking value and transaction ID
126
- - ✅ Automatic error handling and fallbacks
236
+ UNLICENSED - All rights reserved
127
237
 
128
- **Required:** You must implement [Google Consent Mode](https://developers.google.com/tag-platform/security/consent) on your website for tracking to work.
238
+ ## Bundle Size
129
239
 
130
- For detailed setup instructions, see [Google Ads Tracking Documentation](./docs/google-ads-tracking.md).
240
+ - UMD: ~585KB (gzipped: ~150KB)
241
+ - ESM: ~494KB (gzipped: ~130KB)
242
+ - CSS: ~46KB (gzipped: ~8KB)