@happychef/reservation-sidebar 2.8.2 → 2.8.3

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 (4) hide show
  1. package/README.md +202 -202
  2. package/dist/index.js +20 -20
  3. package/dist/index.mjs +20 -20
  4. package/package.json +58 -58
package/README.md CHANGED
@@ -1,202 +1,202 @@
1
- # @happychef/reservation-sidebar
2
-
3
- A compound React component for managing restaurant reservations with a sidebar interface.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @happychef/reservation-sidebar
9
- ```
10
-
11
- ## Features
12
-
13
- - Complete reservation management UI with sidebar
14
- - Guest selection and date/time picking
15
- - Menu and staff assignment
16
- - Giftcard selection support
17
- - Seat/table assignment (terras/restaurant)
18
- - Auto-fill customer information
19
- - Multi-language support (NL/EN)
20
- - TypeScript support with full type definitions
21
- - Both ESM and CJS module formats
22
-
23
- ## Usage
24
-
25
- ### Important: Styling Setup
26
-
27
- The component styles are scoped under `.new-reservation-page` class and require CSS variables. Make sure to:
28
-
29
- 1. **Wrap your app** (or at least the component) with the `.new-reservation-page` class
30
- 2. **Define required CSS variables** in your app's CSS:
31
-
32
- ```css
33
- :root {
34
- --color-blue: #4CAF50;
35
- --color-blue-hover-accent: #45a049;
36
- --color-white: #ffffff;
37
- --border-radius: 4px;
38
- --z-index-sidebar-reservation: 1000;
39
- --z-index-modal: 999;
40
- }
41
- ```
42
-
43
- ### Basic Usage
44
-
45
- ```tsx
46
- import { ReservationSidebar } from '@happychef/reservation-sidebar';
47
- import type { FormData, FormErrors } from '@happychef/reservation-sidebar';
48
-
49
- function App() {
50
- const [isOpen, setIsOpen] = useState(false);
51
- const [formData, setFormData] = useState<FormData>({
52
- guests: 2,
53
- date: '',
54
- time: '',
55
- firstName: '',
56
- lastName: '',
57
- email: '',
58
- phone: '',
59
- extraInfo: '',
60
- menu: '',
61
- personeel: '',
62
- giftcard: '',
63
- zitplaats: '',
64
- selectedTableNumbers: [],
65
- selectedTableIds: [],
66
- reservationMode: 'met_limieten',
67
- });
68
- const [errors, setErrors] = useState<FormErrors>({});
69
- const [isSubmitting, setIsSubmitting] = useState(false);
70
- const [reservationSubmitted, setReservationSubmitted] = useState(false);
71
-
72
- const handleChange = (e) => {
73
- setFormData({ ...formData, [e.target.name]: e.target.value });
74
- };
75
-
76
- const handleFinalSubmit = async () => {
77
- setIsSubmitting(true);
78
- // Submit logic here
79
- setIsSubmitting(false);
80
- setReservationSubmitted(true);
81
- };
82
-
83
- const handleNewReservation = () => {
84
- setReservationSubmitted(false);
85
- // Reset form
86
- };
87
-
88
- return (
89
- <div className="new-reservation-page">
90
- <button onClick={() => setIsOpen(true)}>Open Reservation</button>
91
- <ReservationSidebar
92
- isOpen={isOpen}
93
- onClose={() => setIsOpen(false)}
94
- formData={formData}
95
- errors={errors}
96
- handleChange={handleChange}
97
- handleFinalSubmit={handleFinalSubmit}
98
- setFormData={setFormData}
99
- isSubmitting={isSubmitting}
100
- reservationSubmitted={reservationSubmitted}
101
- onNewReservation={handleNewReservation}
102
- apiBaseDomain="https://happychef.cloud/"
103
- />
104
- </div>
105
- );
106
- }
107
- ```
108
-
109
- ## Sub-components
110
-
111
- You can also use individual sub-components:
112
-
113
- ```tsx
114
- import {
115
- FormField,
116
- GiftcardSelection,
117
- ZitplaatsSelection,
118
- ReservationStepTwo,
119
- ReservationSummary,
120
- } from '@happychef/reservation-sidebar';
121
- ```
122
-
123
- ## API Configuration
124
-
125
- ### Setting the API Base Domain
126
-
127
- You can configure the API base domain in two ways:
128
-
129
- **Method 1: Via Component Prop (Recommended)**
130
- ```tsx
131
- <ReservationSidebar
132
- apiBaseDomain="https://happychef.cloud/"
133
- // ... other props
134
- />
135
- ```
136
-
137
- **Method 2: Via window.baseDomain**
138
- ```tsx
139
- // Set before rendering the component
140
- (window as any).baseDomain = 'https://happychef.cloud/';
141
- ```
142
-
143
- ### API Endpoints
144
-
145
- The component expects the following API endpoints to be available:
146
-
147
- - `GET {baseDomain}api/auth-restaurant/` - Restaurant configuration, timeblocks, menu
148
- - `GET {baseDomain}api/personeel` - Staff/personnel data
149
- - `POST {baseDomain}api/autofill` - Customer autofill by email/phone
150
- - `GET {baseDomain}api/slots/{restaurantId}/{beginDate}/{endDate}` - Reservation slots (for table assignment)
151
-
152
- ## Important Notes
153
-
154
- ### ReservationStepOne Component
155
-
156
- The `ReservationStepOne` component in this package is currently a **placeholder implementation**. The full implementation requires:
157
-
158
- 1. **@happychef/algorithm** package - for table availability calculations
159
- 2. **Multiple complex sub-components**:
160
- - Calendar
161
- - DateSelector
162
- - TimeSelector
163
- - TableSelector
164
- - ValueSelector
165
-
166
- To use the full date/time selection functionality, you'll need to:
167
- - Install the `@happychef/algorithm` package
168
- - Copy the complete StepOne implementation from the source repository
169
- - Ensure all sub-components are properly integrated
170
-
171
- The current placeholder provides basic input fields for guests, date, and time.
172
-
173
- ## TypeScript
174
-
175
- Full TypeScript support is included with comprehensive type definitions.
176
-
177
- ```tsx
178
- import type {
179
- FormData,
180
- FormErrors,
181
- ReservationSidebarProps,
182
- RestaurantData,
183
- MenuData,
184
- Timeblock,
185
- } from '@happychef/reservation-sidebar';
186
- ```
187
-
188
- ## Dependencies
189
-
190
- ### Peer Dependencies
191
- - react >=16.8.0
192
- - react-dom >=16.8.0
193
-
194
- ### Required Dependencies
195
- - axios
196
- - lottie-react
197
- - moment-timezone
198
- - react-icons
199
-
200
- ## License
201
-
202
- MIT
1
+ # @happychef/reservation-sidebar
2
+
3
+ A compound React component for managing restaurant reservations with a sidebar interface.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @happychef/reservation-sidebar
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - Complete reservation management UI with sidebar
14
+ - Guest selection and date/time picking
15
+ - Menu and staff assignment
16
+ - Giftcard selection support
17
+ - Seat/table assignment (terras/restaurant)
18
+ - Auto-fill customer information
19
+ - Multi-language support (NL/EN)
20
+ - TypeScript support with full type definitions
21
+ - Both ESM and CJS module formats
22
+
23
+ ## Usage
24
+
25
+ ### Important: Styling Setup
26
+
27
+ The component styles are scoped under `.new-reservation-page` class and require CSS variables. Make sure to:
28
+
29
+ 1. **Wrap your app** (or at least the component) with the `.new-reservation-page` class
30
+ 2. **Define required CSS variables** in your app's CSS:
31
+
32
+ ```css
33
+ :root {
34
+ --color-blue: #4CAF50;
35
+ --color-blue-hover-accent: #45a049;
36
+ --color-white: #ffffff;
37
+ --border-radius: 4px;
38
+ --z-index-sidebar-reservation: 1000;
39
+ --z-index-modal: 999;
40
+ }
41
+ ```
42
+
43
+ ### Basic Usage
44
+
45
+ ```tsx
46
+ import { ReservationSidebar } from '@happychef/reservation-sidebar';
47
+ import type { FormData, FormErrors } from '@happychef/reservation-sidebar';
48
+
49
+ function App() {
50
+ const [isOpen, setIsOpen] = useState(false);
51
+ const [formData, setFormData] = useState<FormData>({
52
+ guests: 2,
53
+ date: '',
54
+ time: '',
55
+ firstName: '',
56
+ lastName: '',
57
+ email: '',
58
+ phone: '',
59
+ extraInfo: '',
60
+ menu: '',
61
+ personeel: '',
62
+ giftcard: '',
63
+ zitplaats: '',
64
+ selectedTableNumbers: [],
65
+ selectedTableIds: [],
66
+ reservationMode: 'met_limieten',
67
+ });
68
+ const [errors, setErrors] = useState<FormErrors>({});
69
+ const [isSubmitting, setIsSubmitting] = useState(false);
70
+ const [reservationSubmitted, setReservationSubmitted] = useState(false);
71
+
72
+ const handleChange = (e) => {
73
+ setFormData({ ...formData, [e.target.name]: e.target.value });
74
+ };
75
+
76
+ const handleFinalSubmit = async () => {
77
+ setIsSubmitting(true);
78
+ // Submit logic here
79
+ setIsSubmitting(false);
80
+ setReservationSubmitted(true);
81
+ };
82
+
83
+ const handleNewReservation = () => {
84
+ setReservationSubmitted(false);
85
+ // Reset form
86
+ };
87
+
88
+ return (
89
+ <div className="new-reservation-page">
90
+ <button onClick={() => setIsOpen(true)}>Open Reservation</button>
91
+ <ReservationSidebar
92
+ isOpen={isOpen}
93
+ onClose={() => setIsOpen(false)}
94
+ formData={formData}
95
+ errors={errors}
96
+ handleChange={handleChange}
97
+ handleFinalSubmit={handleFinalSubmit}
98
+ setFormData={setFormData}
99
+ isSubmitting={isSubmitting}
100
+ reservationSubmitted={reservationSubmitted}
101
+ onNewReservation={handleNewReservation}
102
+ apiBaseDomain="https://happychef.cloud/"
103
+ />
104
+ </div>
105
+ );
106
+ }
107
+ ```
108
+
109
+ ## Sub-components
110
+
111
+ You can also use individual sub-components:
112
+
113
+ ```tsx
114
+ import {
115
+ FormField,
116
+ GiftcardSelection,
117
+ ZitplaatsSelection,
118
+ ReservationStepTwo,
119
+ ReservationSummary,
120
+ } from '@happychef/reservation-sidebar';
121
+ ```
122
+
123
+ ## API Configuration
124
+
125
+ ### Setting the API Base Domain
126
+
127
+ You can configure the API base domain in two ways:
128
+
129
+ **Method 1: Via Component Prop (Recommended)**
130
+ ```tsx
131
+ <ReservationSidebar
132
+ apiBaseDomain="https://happychef.cloud/"
133
+ // ... other props
134
+ />
135
+ ```
136
+
137
+ **Method 2: Via window.baseDomain**
138
+ ```tsx
139
+ // Set before rendering the component
140
+ (window as any).baseDomain = 'https://happychef.cloud/';
141
+ ```
142
+
143
+ ### API Endpoints
144
+
145
+ The component expects the following API endpoints to be available:
146
+
147
+ - `GET {baseDomain}api/auth-restaurant/` - Restaurant configuration, timeblocks, menu
148
+ - `GET {baseDomain}api/personeel` - Staff/personnel data
149
+ - `POST {baseDomain}api/autofill` - Customer autofill by email/phone
150
+ - `GET {baseDomain}api/slots/{restaurantId}/{beginDate}/{endDate}` - Reservation slots (for table assignment)
151
+
152
+ ## Important Notes
153
+
154
+ ### ReservationStepOne Component
155
+
156
+ The `ReservationStepOne` component in this package is currently a **placeholder implementation**. The full implementation requires:
157
+
158
+ 1. **@happychef/algorithm** package - for table availability calculations
159
+ 2. **Multiple complex sub-components**:
160
+ - Calendar
161
+ - DateSelector
162
+ - TimeSelector
163
+ - TableSelector
164
+ - ValueSelector
165
+
166
+ To use the full date/time selection functionality, you'll need to:
167
+ - Install the `@happychef/algorithm` package
168
+ - Copy the complete StepOne implementation from the source repository
169
+ - Ensure all sub-components are properly integrated
170
+
171
+ The current placeholder provides basic input fields for guests, date, and time.
172
+
173
+ ## TypeScript
174
+
175
+ Full TypeScript support is included with comprehensive type definitions.
176
+
177
+ ```tsx
178
+ import type {
179
+ FormData,
180
+ FormErrors,
181
+ ReservationSidebarProps,
182
+ RestaurantData,
183
+ MenuData,
184
+ Timeblock,
185
+ } from '@happychef/reservation-sidebar';
186
+ ```
187
+
188
+ ## Dependencies
189
+
190
+ ### Peer Dependencies
191
+ - react >=16.8.0
192
+ - react-dom >=16.8.0
193
+
194
+ ### Required Dependencies
195
+ - axios
196
+ - lottie-react
197
+ - moment-timezone
198
+ - react-icons
199
+
200
+ ## License
201
+
202
+ MIT