@bigz-app/booking-widget 0.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.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @bigz-app/booking-widget
2
+
3
+ A flexible and themeable booking widget for BigZ Bookings in React.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm install @bigz-app/booking-widget
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ Import the widget and provide the necessary configuration. The widget handles the entire booking flow, from event selection to payment.
14
+
15
+ ```tsx
16
+ import { UniversalBookingWidget } from '@bigz-app/booking-widget';
17
+ import type { UniversalBookingConfig } from '@bigz-app/booking-widget';
18
+
19
+ const MyBookingPage = () => {
20
+ const config: UniversalBookingConfig = {
21
+ // Required
22
+ apiBaseUrl: "https://bigz.app",
23
+ organizationId: "your-org-id",
24
+
25
+ // Choose one event selection method
26
+ eventTypeId: 123,
27
+
28
+ // Optional theming
29
+ theme: "light-professional",
30
+ };
31
+
32
+ return <UniversalBookingWidget config={config} />;
33
+ };
34
+ ```
35
+
36
+ ## Theming & Customization
37
+
38
+ The widget includes several built-in themes and can be deeply customized.
39
+
40
+ **Available Themes:**
41
+ `light-fresh`, `light-elegant`, `light-vibrant`, `light-professional`, `dark-modern`, `dark-forest`, `dark-matrix`, `dark-luxury`, `dark-energetic`.
42
+
43
+ **shadcn/ui Theme:**
44
+ Use `theme: "shadcn"` to automatically adopt your existing `shadcn/ui` CSS variables. It seamlessly adapts to your site's light/dark mode.
45
+
46
+ **Customizing a Theme:**
47
+ You can override any theme's colors, border radius, or font family.
48
+
49
+ ```tsx
50
+ const config = {
51
+ // ...
52
+ theme: "dark-modern", // Start with a base theme
53
+ colors: {
54
+ highlight: "#10b981", // Custom accent: hex, rgb, or tailwind name ("emerald-500")
55
+ surface: "#1f2937", // Custom card background ("gray-800")
56
+ },
57
+ borderRadius: "16px", // e.g. "4px", "md"
58
+ fontFamily: "'Courier New', monospace", // Any valid CSS font-family
59
+ };
60
+ ```
61
+
62
+ ## Configuration
63
+
64
+ The widget is configured with a single object. You must provide `apiBaseUrl`, `organizationId`, and one event selection method.
65
+
66
+ ```typescript
67
+ interface UniversalBookingConfig {
68
+ // --- Required ---
69
+ apiBaseUrl: string; // Your booking system API base URL
70
+ organizationId: string; // Your organization's ID
71
+
72
+ // --- Event Selection (choose ONE) ---
73
+ eventInstanceId?: number; // Directly book a specific instance
74
+ categoryId?: number; // Show all event types in a category
75
+ eventTypeIds?: number[]; // Show a specific list of event types
76
+ eventTypeId?: number; // Show instances for a single event type
77
+
78
+ // --- Theming & Customization ---
79
+ theme?: 'light-fresh' | 'light-elegant' | '...' | 'shadcn';
80
+ colors?: {
81
+ highlight?: string; // Main action/accent color
82
+ background?: string; // Page background
83
+ surface?: string; // Card/surface background
84
+ text?: string; // Main text color
85
+ border?: string; // Border color
86
+ };
87
+ borderRadius?: string; // e.g., "lg", "8px"
88
+ fontFamily?: string; // e.g., "Inter", "system-ui"
89
+
90
+ // --- Optional ---
91
+ locale?: string;
92
+ onSuccess?: (result: any) => void;
93
+ onError?: (error: string) => void;
94
+ }
95
+ ```
96
+
97
+ ## URL Parameter Overrides
98
+
99
+ 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.
100
+
101
+ | Parameter | Maps to Config | Example URL |
102
+ |------------------|------------------|-----------------------|
103
+ | `instanceId` | `eventInstanceId`| `?instanceId=123` |
104
+ | `categoryId` | `categoryId` | `?categoryId=1` |
105
+ | `eventTypeId` | `eventTypeId` | `?eventTypeId=5` |
106
+ | `eventTypeIds` | `eventTypeIds` | `?eventTypeIds=1,3,5` |