@wix/headless-bookings 0.0.86 → 0.0.88
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/cjs/dist/react/booking/Booking.d.ts +36 -117
- package/cjs/dist/react/booking/Booking.js +40 -109
- package/cjs/dist/react/booking/BookingItem.d.ts +64 -0
- package/cjs/dist/react/booking/BookingItem.js +71 -0
- package/cjs/dist/react/core/booking/Booking.js +1 -1
- package/cjs/dist/react/core/booking-form/BookingForm.js +1 -1
- package/cjs/dist/react/core/location-list/LocationList.js +1 -1
- package/cjs/dist/react/core/payment/Payment.js +1 -1
- package/cjs/dist/react/core/service/Service.js +1 -1
- package/cjs/dist/react/core/service-list/ServiceList.js +1 -1
- package/cjs/dist/react/core/staff-member-list/StaffMemberList.js +1 -1
- package/cjs/dist/react/core/time-slot-list/TimeSlot.js +1 -1
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.d.ts +2 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.js +4 -1
- package/cjs/dist/react/index.d.ts +1 -0
- package/cjs/dist/react/index.js +1 -0
- package/cjs/dist/react/service/Service.d.ts +0 -2
- package/cjs/dist/react/service/Service.js +3 -3
- package/cjs/dist/react/service/ServiceMedia.d.ts +1 -63
- package/cjs/dist/react/service/ServiceMedia.js +1 -60
- package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +21 -6
- package/cjs/dist/react/time-slot-list/TimeSlot.js +34 -14
- package/cjs/dist/react/time-slot-list/TimeSlotList.d.ts +3 -49
- package/cjs/dist/react/time-slot-list/TimeSlotList.js +24 -21
- package/dist/react/booking/Booking.d.ts +36 -117
- package/dist/react/booking/Booking.js +40 -109
- package/dist/react/booking/BookingItem.d.ts +64 -0
- package/dist/react/booking/BookingItem.js +71 -0
- package/dist/react/core/booking/Booking.js +1 -1
- package/dist/react/core/booking-form/BookingForm.js +1 -1
- package/dist/react/core/location-list/LocationList.js +1 -1
- package/dist/react/core/payment/Payment.js +1 -1
- package/dist/react/core/service/Service.js +1 -1
- package/dist/react/core/service-list/ServiceList.js +1 -1
- package/dist/react/core/staff-member-list/StaffMemberList.js +1 -1
- package/dist/react/core/time-slot-list/TimeSlot.js +1 -1
- package/dist/react/core/time-slot-list/TimeSlotList.d.ts +2 -0
- package/dist/react/core/time-slot-list/TimeSlotList.js +4 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/service/Service.d.ts +0 -2
- package/dist/react/service/Service.js +3 -3
- package/dist/react/service/ServiceMedia.d.ts +1 -63
- package/dist/react/service/ServiceMedia.js +1 -60
- package/dist/react/time-slot-list/TimeSlot.d.ts +21 -6
- package/dist/react/time-slot-list/TimeSlot.js +34 -14
- package/dist/react/time-slot-list/TimeSlotList.d.ts +3 -49
- package/dist/react/time-slot-list/TimeSlotList.js +24 -21
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import * as CoreBooking from '../core/booking/Booking.js';
|
|
7
7
|
import type { BookingServiceConfig } from '../../services/booking/booking.js';
|
|
8
|
-
import
|
|
8
|
+
import * as BookingItemComponents from './BookingItem.js';
|
|
9
9
|
export type { BookingData, DataProps, BookingItem, } from '../core/booking/Booking.js';
|
|
10
10
|
/**
|
|
11
11
|
* Props for Booking.Root component
|
|
@@ -63,132 +63,70 @@ export declare const Actions: {
|
|
|
63
63
|
*/
|
|
64
64
|
export declare const useBookingItem: typeof CoreBooking.useBookingItemContext;
|
|
65
65
|
/**
|
|
66
|
-
* Props for Booking.
|
|
66
|
+
* Props for Booking.BookingItems component
|
|
67
67
|
*/
|
|
68
|
-
export interface
|
|
69
|
-
children: React.ReactNode;
|
|
70
|
-
className?: string;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Container component that provides GenericList.Root context for booking items.
|
|
74
|
-
* Use Booking.Items inside for list container with emptyState support.
|
|
75
|
-
*
|
|
76
|
-
* @component
|
|
77
|
-
* @example
|
|
78
|
-
* ```tsx
|
|
79
|
-
* <Booking.ItemsRoot>
|
|
80
|
-
* <Booking.Items emptyState={<div>No bookings selected</div>}>
|
|
81
|
-
* <Booking.ItemRepeater>
|
|
82
|
-
* <div className="booking-card">
|
|
83
|
-
* <Booking.Service>
|
|
84
|
-
* <Service.Name />
|
|
85
|
-
* </Booking.Service>
|
|
86
|
-
* </div>
|
|
87
|
-
* </Booking.ItemRepeater>
|
|
88
|
-
* </Booking.Items>
|
|
89
|
-
* </Booking.ItemsRoot>
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
export declare const ItemsRoot: React.ForwardRefExoticComponent<ItemsRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
-
/**
|
|
94
|
-
* Props for Booking.Items component (List Container Level)
|
|
95
|
-
*/
|
|
96
|
-
export interface ItemsProps {
|
|
68
|
+
export interface BookingItemsProps {
|
|
97
69
|
children: React.ReactNode;
|
|
98
70
|
/** Content to render when there are no booking items */
|
|
99
71
|
emptyState?: React.ReactNode;
|
|
100
72
|
className?: string;
|
|
101
73
|
}
|
|
102
74
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
75
|
+
* Container component for booking items with emptyState support.
|
|
76
|
+
* Provides GenericList context and renders items.
|
|
105
77
|
*
|
|
106
78
|
* @component
|
|
107
79
|
* @example
|
|
108
80
|
* ```tsx
|
|
109
|
-
* <Booking.
|
|
110
|
-
* <Booking.
|
|
111
|
-
* <
|
|
112
|
-
* <
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* </Booking.Items>
|
|
117
|
-
* </Booking.ItemsRoot>
|
|
81
|
+
* <Booking.BookingItems emptyState={<div>No bookings selected</div>}>
|
|
82
|
+
* <Booking.BookingItemRepeater>
|
|
83
|
+
* <BookingItem.Service>
|
|
84
|
+
* <Service.Name />
|
|
85
|
+
* </BookingItem.Service>
|
|
86
|
+
* </Booking.BookingItemRepeater>
|
|
87
|
+
* </Booking.BookingItems>
|
|
118
88
|
* ```
|
|
119
89
|
*/
|
|
120
|
-
export declare const
|
|
90
|
+
export declare const BookingItems: React.ForwardRefExoticComponent<BookingItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
/** @deprecated Use Booking.BookingItems instead */
|
|
92
|
+
export declare const ItemsRoot: React.ForwardRefExoticComponent<BookingItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
/** @deprecated Use Booking.BookingItems instead */
|
|
94
|
+
export declare const Items: React.ForwardRefExoticComponent<BookingItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
121
95
|
/**
|
|
122
|
-
* Props for Booking.
|
|
96
|
+
* Props for Booking.BookingItemRepeater component
|
|
123
97
|
*/
|
|
124
|
-
export interface
|
|
98
|
+
export interface BookingItemRepeaterProps {
|
|
125
99
|
children: React.ReactNode;
|
|
126
100
|
}
|
|
127
101
|
/**
|
|
128
102
|
* Repeater component that maps over booking items and provides context per item.
|
|
129
103
|
* Uses GenericList.Repeater internally with itemWrapper that provides BookingItemContext.
|
|
130
|
-
* Children have access to
|
|
104
|
+
* Children have access to BookingItem.Service, BookingItem.TimeSlot, etc.
|
|
131
105
|
*
|
|
132
106
|
* @component
|
|
133
107
|
* @example
|
|
134
108
|
* ```tsx
|
|
135
|
-
* <Booking.
|
|
109
|
+
* <Booking.BookingItemRepeater>
|
|
136
110
|
* <div className="booking-card">
|
|
137
|
-
* <
|
|
111
|
+
* <BookingItem.Service>
|
|
138
112
|
* <Service.Name />
|
|
139
113
|
* <Service.Price />
|
|
140
|
-
* </
|
|
141
|
-
* <
|
|
114
|
+
* </BookingItem.Service>
|
|
115
|
+
* <BookingItem.TimeSlot>
|
|
142
116
|
* <TimeSlot.StartDate />
|
|
143
|
-
* </
|
|
144
|
-
* <
|
|
117
|
+
* </BookingItem.TimeSlot>
|
|
118
|
+
* <BookingItem.StaffName />
|
|
145
119
|
* </div>
|
|
146
|
-
* </Booking.
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
export declare const ItemRepeater: React.ForwardRefExoticComponent<ItemRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
150
|
-
/**
|
|
151
|
-
* Props for Booking.Service component
|
|
152
|
-
*/
|
|
153
|
-
export interface BookingServiceProps {
|
|
154
|
-
children: React.ReactNode;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Wraps Service.Root with the service from the current booking item context.
|
|
158
|
-
* Children can use all Service.* components (Service.Name, Service.Price, etc.).
|
|
159
|
-
*
|
|
160
|
-
* @component
|
|
161
|
-
* @example
|
|
162
|
-
* ```tsx
|
|
163
|
-
* <Booking.Service>
|
|
164
|
-
* <Service.Name className="text-xl font-bold" />
|
|
165
|
-
* <Service.Description />
|
|
166
|
-
* <Service.Price />
|
|
167
|
-
* </Booking.Service>
|
|
120
|
+
* </Booking.BookingItemRepeater>
|
|
168
121
|
* ```
|
|
169
122
|
*/
|
|
170
|
-
export declare
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
*/
|
|
174
|
-
export
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Wraps TimeSlot.Root with the timeSlot from the current booking item context.
|
|
179
|
-
* Children can use all TimeSlot.* components (TimeSlot.StartDate, TimeSlot.Duration, etc.).
|
|
180
|
-
* Always renders with data-has-time-slot attribute for CSS targeting.
|
|
181
|
-
*
|
|
182
|
-
* @component
|
|
183
|
-
* @example
|
|
184
|
-
* ```tsx
|
|
185
|
-
* <Booking.TimeSlot>
|
|
186
|
-
* <TimeSlot.StartDate />
|
|
187
|
-
* <TimeSlot.Duration />
|
|
188
|
-
* </Booking.TimeSlot>
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
export declare function TimeSlot(props: BookingTimeSlotProps): React.ReactNode;
|
|
123
|
+
export declare const BookingItemRepeater: React.ForwardRefExoticComponent<BookingItemRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
124
|
+
/** @deprecated Use Booking.BookingItemRepeater instead */
|
|
125
|
+
export declare const ItemRepeater: React.ForwardRefExoticComponent<BookingItemRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
126
|
+
/** @deprecated Use BookingItem.Service instead */
|
|
127
|
+
export declare const Service: typeof BookingItemComponents.Service;
|
|
128
|
+
/** @deprecated Use BookingItem.TimeSlot instead */
|
|
129
|
+
export declare const TimeSlot: typeof BookingItemComponents.TimeSlot;
|
|
192
130
|
/**
|
|
193
131
|
* Props for Booking.Payment component
|
|
194
132
|
*/
|
|
@@ -244,24 +182,5 @@ export interface BookingLocationProps {
|
|
|
244
182
|
* ```
|
|
245
183
|
*/
|
|
246
184
|
export declare function Location(props: BookingLocationProps): React.ReactNode;
|
|
247
|
-
/**
|
|
248
|
-
|
|
249
|
-
*/
|
|
250
|
-
export interface StaffNameProps {
|
|
251
|
-
asChild?: boolean;
|
|
252
|
-
children?: AsChildChildren<{
|
|
253
|
-
name: string;
|
|
254
|
-
}>;
|
|
255
|
-
className?: string;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Displays the first staff member's name from the current booking item.
|
|
259
|
-
* Returns null when staff name is empty.
|
|
260
|
-
*
|
|
261
|
-
* @component
|
|
262
|
-
* @example
|
|
263
|
-
* ```tsx
|
|
264
|
-
* <Booking.StaffName className="text-foreground" />
|
|
265
|
-
* ```
|
|
266
|
-
*/
|
|
267
|
-
export declare const StaffName: React.ForwardRefExoticComponent<StaffNameProps & React.RefAttributes<HTMLElement>>;
|
|
185
|
+
/** @deprecated Use BookingItem.StaffName instead */
|
|
186
|
+
export declare const StaffName: React.ForwardRefExoticComponent<BookingItemComponents.StaffNameProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -6,12 +6,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import * as CoreBooking from '../core/booking/Booking.js';
|
|
8
8
|
import { Book } from './Book.js';
|
|
9
|
-
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
10
|
-
import * as ServiceComponent from '../service/Service.js';
|
|
11
|
-
import * as TimeSlotComponent from '../time-slot-list/TimeSlot.js';
|
|
12
9
|
import * as PaymentComponent from '../payment/Payment.js';
|
|
13
10
|
import * as CoreLocation from '../core/location/Location.js';
|
|
14
11
|
import { GenericList } from '@wix/headless-components/react';
|
|
12
|
+
// Re-export BookingItem components for backward compatibility
|
|
13
|
+
import * as BookingItemComponents from './BookingItem.js';
|
|
15
14
|
// ============================================================================
|
|
16
15
|
// TestIds
|
|
17
16
|
// ============================================================================
|
|
@@ -82,56 +81,33 @@ export const Actions = {
|
|
|
82
81
|
*/
|
|
83
82
|
export const useBookingItem = CoreBooking.useBookingItemContext;
|
|
84
83
|
/**
|
|
85
|
-
* Container component
|
|
86
|
-
*
|
|
84
|
+
* Container component for booking items with emptyState support.
|
|
85
|
+
* Provides GenericList context and renders items.
|
|
87
86
|
*
|
|
88
87
|
* @component
|
|
89
88
|
* @example
|
|
90
89
|
* ```tsx
|
|
91
|
-
* <Booking.
|
|
92
|
-
* <Booking.
|
|
93
|
-
* <
|
|
94
|
-
* <
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* </div>
|
|
99
|
-
* </Booking.ItemRepeater>
|
|
100
|
-
* </Booking.Items>
|
|
101
|
-
* </Booking.ItemsRoot>
|
|
90
|
+
* <Booking.BookingItems emptyState={<div>No bookings selected</div>}>
|
|
91
|
+
* <Booking.BookingItemRepeater>
|
|
92
|
+
* <BookingItem.Service>
|
|
93
|
+
* <Service.Name />
|
|
94
|
+
* </BookingItem.Service>
|
|
95
|
+
* </Booking.BookingItemRepeater>
|
|
96
|
+
* </Booking.BookingItems>
|
|
102
97
|
* ```
|
|
103
98
|
*/
|
|
104
|
-
export const
|
|
105
|
-
const { children, ...otherProps } = props;
|
|
99
|
+
export const BookingItems = React.forwardRef((props, ref) => {
|
|
100
|
+
const { children, emptyState, ...otherProps } = props;
|
|
106
101
|
return (_jsx(CoreBooking.ItemsData, { children: ({ items }) => (_jsx(GenericList.Root, { ref: ref, items: items.map((item) => ({
|
|
107
102
|
...item,
|
|
108
103
|
id: item.instanceId,
|
|
109
|
-
})), hasMore: false, isLoading: false, "data-testid": TestIds.
|
|
110
|
-
});
|
|
111
|
-
ItemsRoot.displayName = 'Booking.ItemsRoot';
|
|
112
|
-
/**
|
|
113
|
-
* List container component with emptyState support.
|
|
114
|
-
* Wraps GenericList.Items. Must be used within Booking.ItemsRoot.
|
|
115
|
-
*
|
|
116
|
-
* @component
|
|
117
|
-
* @example
|
|
118
|
-
* ```tsx
|
|
119
|
-
* <Booking.ItemsRoot>
|
|
120
|
-
* <Booking.Items emptyState={<div>No bookings selected</div>}>
|
|
121
|
-
* <Booking.ItemRepeater>
|
|
122
|
-
* <Booking.Service>
|
|
123
|
-
* <Service.Name />
|
|
124
|
-
* </Booking.Service>
|
|
125
|
-
* </Booking.ItemRepeater>
|
|
126
|
-
* </Booking.Items>
|
|
127
|
-
* </Booking.ItemsRoot>
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
export const Items = React.forwardRef((props, ref) => {
|
|
131
|
-
const { children, ...otherProps } = props;
|
|
132
|
-
return (_jsx(GenericList.Items, { ref: ref, "data-testid": TestIds.bookingItems, ...otherProps, children: children }));
|
|
104
|
+
})), hasMore: false, isLoading: false, "data-testid": TestIds.bookingItems, ...otherProps, children: _jsx(GenericList.Items, { emptyState: emptyState, children: children }) })) }));
|
|
133
105
|
});
|
|
134
|
-
|
|
106
|
+
BookingItems.displayName = 'Booking.BookingItems';
|
|
107
|
+
/** @deprecated Use Booking.BookingItems instead */
|
|
108
|
+
export const ItemsRoot = BookingItems;
|
|
109
|
+
/** @deprecated Use Booking.BookingItems instead */
|
|
110
|
+
export const Items = BookingItems;
|
|
135
111
|
/**
|
|
136
112
|
* Internal component that wraps each booking item with context provider.
|
|
137
113
|
*/
|
|
@@ -141,66 +117,39 @@ const BookingItemWrapper = ({ item, children, }) => {
|
|
|
141
117
|
/**
|
|
142
118
|
* Repeater component that maps over booking items and provides context per item.
|
|
143
119
|
* Uses GenericList.Repeater internally with itemWrapper that provides BookingItemContext.
|
|
144
|
-
* Children have access to
|
|
120
|
+
* Children have access to BookingItem.Service, BookingItem.TimeSlot, etc.
|
|
145
121
|
*
|
|
146
122
|
* @component
|
|
147
123
|
* @example
|
|
148
124
|
* ```tsx
|
|
149
|
-
* <Booking.
|
|
125
|
+
* <Booking.BookingItemRepeater>
|
|
150
126
|
* <div className="booking-card">
|
|
151
|
-
* <
|
|
127
|
+
* <BookingItem.Service>
|
|
152
128
|
* <Service.Name />
|
|
153
129
|
* <Service.Price />
|
|
154
|
-
* </
|
|
155
|
-
* <
|
|
130
|
+
* </BookingItem.Service>
|
|
131
|
+
* <BookingItem.TimeSlot>
|
|
156
132
|
* <TimeSlot.StartDate />
|
|
157
|
-
* </
|
|
158
|
-
* <
|
|
133
|
+
* </BookingItem.TimeSlot>
|
|
134
|
+
* <BookingItem.StaffName />
|
|
159
135
|
* </div>
|
|
160
|
-
* </Booking.
|
|
136
|
+
* </Booking.BookingItemRepeater>
|
|
161
137
|
* ```
|
|
162
138
|
*/
|
|
163
|
-
export const
|
|
139
|
+
export const BookingItemRepeater = React.forwardRef((props, ref) => {
|
|
164
140
|
const { children } = props;
|
|
165
141
|
return (_jsx(GenericList.Repeater, { ref: ref, itemWrapper: ({ item }) => (_jsx(BookingItemWrapper, { item: item, children: children }, item.instanceId)), children: undefined }));
|
|
166
142
|
});
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
* <Service.Description />
|
|
178
|
-
* <Service.Price />
|
|
179
|
-
* </Booking.Service>
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
export function Service(props) {
|
|
183
|
-
const { children } = props;
|
|
184
|
-
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ service }) => (_jsx(ServiceComponent.Root, { service: service, children: children })) }));
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Wraps TimeSlot.Root with the timeSlot from the current booking item context.
|
|
188
|
-
* Children can use all TimeSlot.* components (TimeSlot.StartDate, TimeSlot.Duration, etc.).
|
|
189
|
-
* Always renders with data-has-time-slot attribute for CSS targeting.
|
|
190
|
-
*
|
|
191
|
-
* @component
|
|
192
|
-
* @example
|
|
193
|
-
* ```tsx
|
|
194
|
-
* <Booking.TimeSlot>
|
|
195
|
-
* <TimeSlot.StartDate />
|
|
196
|
-
* <TimeSlot.Duration />
|
|
197
|
-
* </Booking.TimeSlot>
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
export function TimeSlot(props) {
|
|
201
|
-
const { children } = props;
|
|
202
|
-
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ timeSlot }) => timeSlot ? (_jsx(TimeSlotComponent.Root, { timeSlot: timeSlot, children: children })) : null }));
|
|
203
|
-
}
|
|
143
|
+
BookingItemRepeater.displayName = 'Booking.BookingItemRepeater';
|
|
144
|
+
/** @deprecated Use Booking.BookingItemRepeater instead */
|
|
145
|
+
export const ItemRepeater = BookingItemRepeater;
|
|
146
|
+
// ============================================================================
|
|
147
|
+
// Deprecated: Service, TimeSlot, StaffName (moved to BookingItem namespace)
|
|
148
|
+
// ============================================================================
|
|
149
|
+
/** @deprecated Use BookingItem.Service instead */
|
|
150
|
+
export const Service = BookingItemComponents.Service;
|
|
151
|
+
/** @deprecated Use BookingItem.TimeSlot instead */
|
|
152
|
+
export const TimeSlot = BookingItemComponents.TimeSlot;
|
|
204
153
|
/**
|
|
205
154
|
* Wraps Payment.Root with all services from all booking items.
|
|
206
155
|
* Should be used outside of ItemRepeater - it calculates payment for all items.
|
|
@@ -245,23 +194,5 @@ export function Location(props) {
|
|
|
245
194
|
const { children } = props;
|
|
246
195
|
return (_jsx(CoreBooking.Data, { children: ({ location }) => location ? (_jsx(CoreLocation.Root, { location: location, children: children })) : null }));
|
|
247
196
|
}
|
|
248
|
-
/**
|
|
249
|
-
|
|
250
|
-
* Returns null when staff name is empty.
|
|
251
|
-
*
|
|
252
|
-
* @component
|
|
253
|
-
* @example
|
|
254
|
-
* ```tsx
|
|
255
|
-
* <Booking.StaffName className="text-foreground" />
|
|
256
|
-
* ```
|
|
257
|
-
*/
|
|
258
|
-
export const StaffName = React.forwardRef((props, ref) => {
|
|
259
|
-
const { asChild, children, className } = props;
|
|
260
|
-
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ staffName }) => {
|
|
261
|
-
if (!staffName) {
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.bookingStaffName, customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) }));
|
|
265
|
-
} }));
|
|
266
|
-
});
|
|
267
|
-
StaffName.displayName = 'Booking.StaffName';
|
|
197
|
+
/** @deprecated Use BookingItem.StaffName instead */
|
|
198
|
+
export const StaffName = BookingItemComponents.StaffName;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookingItem - Components for displaying booking item details
|
|
3
|
+
* Must be used within Booking.BookingItemRepeater context
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { type AsChildChildren } from '@wix/headless-utils/react';
|
|
7
|
+
export interface ServiceProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Wraps Service.Root with the service from the current booking item context.
|
|
12
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <BookingItem.Service>
|
|
18
|
+
* <Service.Name className="text-xl font-bold" />
|
|
19
|
+
* <Service.Price />
|
|
20
|
+
* </BookingItem.Service>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function Service(props: ServiceProps): React.ReactNode;
|
|
24
|
+
export declare namespace Service {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TimeSlotProps {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Wraps TimeSlot.Root with the timeSlot from the current booking item context.
|
|
32
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
33
|
+
*
|
|
34
|
+
* @component
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <BookingItem.TimeSlot>
|
|
38
|
+
* <TimeSlot.StartDate />
|
|
39
|
+
* <TimeSlot.EndDate />
|
|
40
|
+
* </BookingItem.TimeSlot>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function TimeSlot(props: TimeSlotProps): React.ReactNode;
|
|
44
|
+
export declare namespace TimeSlot {
|
|
45
|
+
var displayName: string;
|
|
46
|
+
}
|
|
47
|
+
export interface StaffNameProps {
|
|
48
|
+
asChild?: boolean;
|
|
49
|
+
children?: AsChildChildren<{
|
|
50
|
+
name: string;
|
|
51
|
+
}>;
|
|
52
|
+
className?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Displays the staff member's name from the current booking item.
|
|
56
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
57
|
+
*
|
|
58
|
+
* @component
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <BookingItem.StaffName className="text-foreground" />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const StaffName: React.ForwardRefExoticComponent<StaffNameProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* BookingItem - Components for displaying booking item details
|
|
4
|
+
* Must be used within Booking.BookingItemRepeater context
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import * as CoreBooking from '../core/booking/Booking.js';
|
|
8
|
+
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
9
|
+
import * as ServiceComponent from '../service/Service.js';
|
|
10
|
+
import * as TimeSlotComponent from '../time-slot-list/TimeSlot.js';
|
|
11
|
+
var TestIds;
|
|
12
|
+
(function (TestIds) {
|
|
13
|
+
TestIds["bookingItemService"] = "booking-item-service";
|
|
14
|
+
TestIds["bookingItemTimeSlot"] = "booking-item-time-slot";
|
|
15
|
+
TestIds["bookingItemStaffName"] = "booking-item-staff-name";
|
|
16
|
+
})(TestIds || (TestIds = {}));
|
|
17
|
+
/**
|
|
18
|
+
* Wraps Service.Root with the service from the current booking item context.
|
|
19
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
20
|
+
*
|
|
21
|
+
* @component
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <BookingItem.Service>
|
|
25
|
+
* <Service.Name className="text-xl font-bold" />
|
|
26
|
+
* <Service.Price />
|
|
27
|
+
* </BookingItem.Service>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function Service(props) {
|
|
31
|
+
const { children } = props;
|
|
32
|
+
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ service }) => (_jsx(ServiceComponent.Root, { service: service, children: children })) }));
|
|
33
|
+
}
|
|
34
|
+
Service.displayName = 'BookingItem.Service';
|
|
35
|
+
/**
|
|
36
|
+
* Wraps TimeSlot.Root with the timeSlot from the current booking item context.
|
|
37
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
38
|
+
*
|
|
39
|
+
* @component
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <BookingItem.TimeSlot>
|
|
43
|
+
* <TimeSlot.StartDate />
|
|
44
|
+
* <TimeSlot.EndDate />
|
|
45
|
+
* </BookingItem.TimeSlot>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function TimeSlot(props) {
|
|
49
|
+
const { children } = props;
|
|
50
|
+
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ timeSlot }) => timeSlot ? (_jsx(TimeSlotComponent.Root, { timeSlot: timeSlot, children: children })) : null }));
|
|
51
|
+
}
|
|
52
|
+
TimeSlot.displayName = 'BookingItem.TimeSlot';
|
|
53
|
+
/**
|
|
54
|
+
* Displays the staff member's name from the current booking item.
|
|
55
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
56
|
+
*
|
|
57
|
+
* @component
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <BookingItem.StaffName className="text-foreground" />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export const StaffName = React.forwardRef((props, ref) => {
|
|
64
|
+
const { asChild, children, className } = props;
|
|
65
|
+
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ staffName }) => {
|
|
66
|
+
if (!staffName)
|
|
67
|
+
return null;
|
|
68
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.bookingItemStaffName, customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) }));
|
|
69
|
+
} }));
|
|
70
|
+
});
|
|
71
|
+
StaffName.displayName = 'BookingItem.StaffName';
|
|
@@ -25,7 +25,7 @@ import { LocationType, } from '@wix/auto_sdk_bookings_services';
|
|
|
25
25
|
*/
|
|
26
26
|
export function Root(props) {
|
|
27
27
|
const { bookingServiceConfig = {}, children } = props;
|
|
28
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(BookingServiceDefinition, BookingService, bookingServiceConfig), children: children }));
|
|
28
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(BookingServiceDefinition, BookingService, bookingServiceConfig), disposeOnUnmount: true, children: children }));
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Core component that provides access to booking data via render props.
|
|
@@ -178,7 +178,7 @@ export function Root(props) {
|
|
|
178
178
|
}
|
|
179
179
|
// Use Form.Root to set up FormService, then nest WixServices for BookingFormService
|
|
180
180
|
// This allows BookingFormService to access FormService via getService internally
|
|
181
|
-
return (_jsx(Form.Root, { formServiceConfig: formServiceConfig, ref: formRef, children: _jsx(WixServices, { servicesMap: createServicesMap().addService(BookingFormServiceDefinition, BookingFormService, bookingFormServiceConfig), children: _jsx(BookingFormContent, { fields: fieldMap, formRef: formRef, children: children }) }) }));
|
|
181
|
+
return (_jsx(Form.Root, { formServiceConfig: formServiceConfig, ref: formRef, children: _jsx(WixServices, { servicesMap: createServicesMap().addService(BookingFormServiceDefinition, BookingFormService, bookingFormServiceConfig), disposeOnUnmount: true, children: _jsx(BookingFormContent, { fields: fieldMap, formRef: formRef, children: children }) }) }));
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* Internal component that consumes BookingFormService and provides render props.
|
|
@@ -18,7 +18,7 @@ import { LocationListServiceDefinition, LocationListService, } from '../../../se
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export function Root(props) {
|
|
21
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(LocationListServiceDefinition, LocationListService, props.locationListServiceConfig), children: props.children }));
|
|
21
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(LocationListServiceDefinition, LocationListService, props.locationListServiceConfig), disposeOnUnmount: true, children: props.children }));
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Core component that provides access to locations list via render props
|
|
@@ -56,7 +56,7 @@ export function Root(props) {
|
|
|
56
56
|
pricingServiceSelections,
|
|
57
57
|
numberOfParticipants,
|
|
58
58
|
};
|
|
59
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(PaymentServiceDefinition, PaymentService, internalConfig), children: _jsx(RootContent, { children: children }) }));
|
|
59
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(PaymentServiceDefinition, PaymentService, internalConfig), disposeOnUnmount: true, children: _jsx(RootContent, { children: children }) }));
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Core component that provides access to converted payment data.
|
|
@@ -29,7 +29,7 @@ function RootContent({ children, }) {
|
|
|
29
29
|
return children;
|
|
30
30
|
}
|
|
31
31
|
export function Root(props) {
|
|
32
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ServiceServiceDefinition, ServiceService, props.serviceServiceConfig), children: _jsx(RootContent, { children: props.children }) }));
|
|
32
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ServiceServiceDefinition, ServiceService, props.serviceServiceConfig), disposeOnUnmount: true, children: _jsx(RootContent, { children: props.children }) }));
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Core component that provides access to full service data via render props.
|
|
@@ -14,7 +14,7 @@ import { ServiceListServiceDefinition, ServiceListService, } from '../../../serv
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
export function Root(props) {
|
|
17
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ServiceListServiceDefinition, ServiceListService, props.serviceListConfig), children: props.children }));
|
|
17
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ServiceListServiceDefinition, ServiceListService, props.serviceListConfig), disposeOnUnmount: true, children: props.children }));
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Component that provides services list data through render props.
|
|
@@ -18,7 +18,7 @@ import { StaffMemberListServiceDefinition, StaffMemberListService, } from '../..
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export function Root(props) {
|
|
21
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(StaffMemberListServiceDefinition, StaffMemberListService, props.staffMemberListServiceConfig), children: props.children }));
|
|
21
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(StaffMemberListServiceDefinition, StaffMemberListService, props.staffMemberListServiceConfig), disposeOnUnmount: true, children: props.children }));
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Core component that provides access to staff members list via render props
|
|
@@ -24,7 +24,7 @@ import { TimeSlotServiceDefinition, TimeSlotService, } from '../../../services/t
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export function Root(props) {
|
|
27
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(TimeSlotServiceDefinition, TimeSlotService, props.config), children: props.children }));
|
|
27
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(TimeSlotServiceDefinition, TimeSlotService, props.config), disposeOnUnmount: true, children: props.children }));
|
|
28
28
|
}
|
|
29
29
|
const StaffMemberContext = React.createContext(null);
|
|
30
30
|
/**
|
|
@@ -90,6 +90,8 @@ export interface DateRangeRenderProps {
|
|
|
90
90
|
startDate: Date;
|
|
91
91
|
endDate: Date;
|
|
92
92
|
setDateRange: (start: Date, end: Date) => void;
|
|
93
|
+
/** IANA timezone string for the time slots (e.g., "America/New_York") */
|
|
94
|
+
timezone: string | undefined;
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
95
97
|
* Props for DateRange render prop component
|
|
@@ -15,7 +15,7 @@ import { BookingServiceDefinition } from '../../../services/booking/booking.js';
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export function Root(props) {
|
|
18
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(TimeSlotListServiceDefinition, TimeSlotListService, props.config), children: props.children }));
|
|
18
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(TimeSlotListServiceDefinition, TimeSlotListService, props.config), disposeOnUnmount: true, children: props.children }));
|
|
19
19
|
}
|
|
20
20
|
// ============================================================================
|
|
21
21
|
// Timezone Component
|
|
@@ -109,10 +109,13 @@ export function ListData(props) {
|
|
|
109
109
|
*/
|
|
110
110
|
export function DateRange(props) {
|
|
111
111
|
const service = useService(TimeSlotListServiceDefinition);
|
|
112
|
+
const bookingService = useService(BookingServiceDefinition);
|
|
112
113
|
const dateRange = service.dateRange.get();
|
|
114
|
+
const timezone = bookingService.timezone.get();
|
|
113
115
|
return props.children({
|
|
114
116
|
startDate: dateRange.start,
|
|
115
117
|
endDate: dateRange.end,
|
|
116
118
|
setDateRange: service.actions.setDateRange,
|
|
119
|
+
timezone,
|
|
117
120
|
});
|
|
118
121
|
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as Booking from './booking/Booking.js';
|
|
2
|
+
export * as BookingItem from './booking/BookingItem.js';
|
|
2
3
|
export * as BookingForm from './booking-form/BookingForm.js';
|
|
3
4
|
export * as Service from './service/Service.js';
|
|
4
5
|
export * as ServiceMedia from './service/ServiceMedia.js';
|