@bigz-app/booking-widget 0.3.11 → 1.0.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.
- package/README.md +206 -94
- package/dist/booking-widget.js +5230 -7843
- package/dist/booking-widget.js.map +1 -1
- package/dist/components/PromoDialog.d.ts +42 -1
- package/dist/components/PromoDialog.d.ts.map +1 -1
- package/dist/components/Sidebar.d.ts +2 -3
- package/dist/components/Sidebar.d.ts.map +1 -1
- package/dist/components/UniversalBookingWidget.d.ts +15 -0
- package/dist/components/UniversalBookingWidget.d.ts.map +1 -1
- package/dist/components/booking/BookingForm.d.ts.map +1 -0
- package/dist/components/booking/BookingSuccessModal.d.ts.map +1 -0
- package/dist/components/{PaymentForm.d.ts → booking/PaymentForm.d.ts} +2 -2
- package/dist/components/booking/PaymentForm.d.ts.map +1 -0
- package/dist/components/booking/VoucherInput.d.ts.map +1 -0
- package/dist/components/booking/index.d.ts +5 -0
- package/dist/components/booking/index.d.ts.map +1 -0
- package/dist/components/events/EventInstanceSelection.d.ts.map +1 -0
- package/dist/components/events/EventTypeDetailsDialog.d.ts.map +1 -0
- package/dist/components/{EventTypeSelection.d.ts → events/EventTypeSelection.d.ts} +0 -12
- package/dist/components/events/EventTypeSelection.d.ts.map +1 -0
- package/dist/components/events/ImageCarousel.d.ts.map +1 -0
- package/dist/components/{NextEventsPreview.d.ts → events/NextEventsPreview.d.ts} +1 -1
- package/dist/components/events/NextEventsPreview.d.ts.map +1 -0
- package/dist/components/events/index.d.ts +6 -0
- package/dist/components/events/index.d.ts.map +1 -0
- package/dist/components/shared/Button.d.ts +29 -0
- package/dist/components/shared/Button.d.ts.map +1 -0
- package/dist/components/shared/ErrorBoundary.d.ts +30 -0
- package/dist/components/shared/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/shared/Input.d.ts +26 -0
- package/dist/components/shared/Input.d.ts.map +1 -0
- package/dist/components/shared/Spinner.d.ts +20 -0
- package/dist/components/shared/Spinner.d.ts.map +1 -0
- package/dist/components/shared/icons.d.ts +27 -0
- package/dist/components/shared/icons.d.ts.map +1 -0
- package/dist/components/shared/index.d.ts +8 -0
- package/dist/components/shared/index.d.ts.map +1 -0
- package/dist/components/shared/skeletons/EventCardSkeleton.d.ts +11 -0
- package/dist/components/shared/skeletons/EventCardSkeleton.d.ts.map +1 -0
- package/dist/components/shared/skeletons/EventInstanceSkeleton.d.ts +13 -0
- package/dist/components/shared/skeletons/EventInstanceSkeleton.d.ts.map +1 -0
- package/dist/components/shared/skeletons/NextEventsSkeleton.d.ts +11 -0
- package/dist/components/shared/skeletons/NextEventsSkeleton.d.ts.map +1 -0
- package/dist/components/shared/skeletons/index.d.ts +4 -0
- package/dist/components/shared/skeletons/index.d.ts.map +1 -0
- package/dist/index.cjs +5175 -7821
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +5176 -7822
- package/dist/index.esm.js.map +1 -1
- package/dist/index.npm.d.ts +2 -1
- package/dist/index.npm.d.ts.map +1 -1
- package/dist/index.vanilla.d.ts +3 -2
- package/dist/index.vanilla.d.ts.map +1 -1
- package/dist/styles/StyleProvider.d.ts +1 -1
- package/dist/styles/StyleProvider.d.ts.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/validation/booking-schema.d.ts +84 -0
- package/dist/validation/booking-schema.d.ts.map +1 -0
- package/package.json +9 -3
- package/dist/components/BookingForm.d.ts.map +0 -1
- package/dist/components/BookingSuccessModal.d.ts.map +0 -1
- package/dist/components/EventInstanceSelection.d.ts.map +0 -1
- package/dist/components/EventTypeDetailsDialog.d.ts.map +0 -1
- package/dist/components/EventTypeSelection.d.ts.map +0 -1
- package/dist/components/ImageCarousel.d.ts.map +0 -1
- package/dist/components/NextEventsPreview.d.ts.map +0 -1
- package/dist/components/PaymentForm.d.ts.map +0 -1
- package/dist/components/VoucherInput.d.ts.map +0 -1
- /package/dist/components/{BookingForm.d.ts → booking/BookingForm.d.ts} +0 -0
- /package/dist/components/{BookingSuccessModal.d.ts → booking/BookingSuccessModal.d.ts} +0 -0
- /package/dist/components/{VoucherInput.d.ts → booking/VoucherInput.d.ts} +0 -0
- /package/dist/components/{EventInstanceSelection.d.ts → events/EventInstanceSelection.d.ts} +0 -0
- /package/dist/components/{EventTypeDetailsDialog.d.ts → events/EventTypeDetailsDialog.d.ts} +0 -0
- /package/dist/components/{ImageCarousel.d.ts → events/ImageCarousel.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,130 +1,242 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bigZ Booking Widget
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A modern, customizable booking widget for bigZ Booking System built with React, TypeScript, and Tailwind CSS v4.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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
|
-
|
|
20
|
-
const config
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
26
|
-
eventTypeId: 123,
|
|
77
|
+
### UniversalBookingConfig
|
|
27
78
|
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
157
|
+
## Development
|
|
37
158
|
|
|
38
|
-
|
|
159
|
+
### Prerequisites
|
|
39
160
|
|
|
40
|
-
|
|
41
|
-
|
|
161
|
+
- Node.js 18+
|
|
162
|
+
- pnpm
|
|
42
163
|
|
|
43
|
-
|
|
44
|
-
You can override any theme's colors, border radius, or font family.
|
|
164
|
+
### Setup
|
|
45
165
|
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
183
|
+
### Build Outputs
|
|
60
184
|
|
|
61
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
194
|
+
```typescript
|
|
195
|
+
interface UniversalBookingWidgetProps {
|
|
196
|
+
config: UniversalBookingConfig;
|
|
197
|
+
className?: string;
|
|
91
198
|
}
|
|
92
199
|
```
|
|
93
200
|
|
|
94
|
-
|
|
201
|
+
### Supported Locales
|
|
95
202
|
|
|
96
|
-
|
|
203
|
+
- `de` - German
|
|
204
|
+
- `en` - English
|
|
97
205
|
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
218
|
+
## Browser Support
|
|
108
219
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
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
|
-
|
|
238
|
+
## Bundle Size
|
|
129
239
|
|
|
130
|
-
|
|
240
|
+
- UMD: ~585KB (gzipped: ~150KB)
|
|
241
|
+
- ESM: ~494KB (gzipped: ~130KB)
|
|
242
|
+
- CSS: ~46KB (gzipped: ~8KB)
|