@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.
Files changed (49) hide show
  1. package/cjs/dist/react/booking/Booking.d.ts +36 -117
  2. package/cjs/dist/react/booking/Booking.js +40 -109
  3. package/cjs/dist/react/booking/BookingItem.d.ts +64 -0
  4. package/cjs/dist/react/booking/BookingItem.js +71 -0
  5. package/cjs/dist/react/core/booking/Booking.js +1 -1
  6. package/cjs/dist/react/core/booking-form/BookingForm.js +1 -1
  7. package/cjs/dist/react/core/location-list/LocationList.js +1 -1
  8. package/cjs/dist/react/core/payment/Payment.js +1 -1
  9. package/cjs/dist/react/core/service/Service.js +1 -1
  10. package/cjs/dist/react/core/service-list/ServiceList.js +1 -1
  11. package/cjs/dist/react/core/staff-member-list/StaffMemberList.js +1 -1
  12. package/cjs/dist/react/core/time-slot-list/TimeSlot.js +1 -1
  13. package/cjs/dist/react/core/time-slot-list/TimeSlotList.d.ts +2 -0
  14. package/cjs/dist/react/core/time-slot-list/TimeSlotList.js +4 -1
  15. package/cjs/dist/react/index.d.ts +1 -0
  16. package/cjs/dist/react/index.js +1 -0
  17. package/cjs/dist/react/service/Service.d.ts +0 -2
  18. package/cjs/dist/react/service/Service.js +3 -3
  19. package/cjs/dist/react/service/ServiceMedia.d.ts +1 -63
  20. package/cjs/dist/react/service/ServiceMedia.js +1 -60
  21. package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +21 -6
  22. package/cjs/dist/react/time-slot-list/TimeSlot.js +34 -14
  23. package/cjs/dist/react/time-slot-list/TimeSlotList.d.ts +3 -49
  24. package/cjs/dist/react/time-slot-list/TimeSlotList.js +24 -21
  25. package/dist/react/booking/Booking.d.ts +36 -117
  26. package/dist/react/booking/Booking.js +40 -109
  27. package/dist/react/booking/BookingItem.d.ts +64 -0
  28. package/dist/react/booking/BookingItem.js +71 -0
  29. package/dist/react/core/booking/Booking.js +1 -1
  30. package/dist/react/core/booking-form/BookingForm.js +1 -1
  31. package/dist/react/core/location-list/LocationList.js +1 -1
  32. package/dist/react/core/payment/Payment.js +1 -1
  33. package/dist/react/core/service/Service.js +1 -1
  34. package/dist/react/core/service-list/ServiceList.js +1 -1
  35. package/dist/react/core/staff-member-list/StaffMemberList.js +1 -1
  36. package/dist/react/core/time-slot-list/TimeSlot.js +1 -1
  37. package/dist/react/core/time-slot-list/TimeSlotList.d.ts +2 -0
  38. package/dist/react/core/time-slot-list/TimeSlotList.js +4 -1
  39. package/dist/react/index.d.ts +1 -0
  40. package/dist/react/index.js +1 -0
  41. package/dist/react/service/Service.d.ts +0 -2
  42. package/dist/react/service/Service.js +3 -3
  43. package/dist/react/service/ServiceMedia.d.ts +1 -63
  44. package/dist/react/service/ServiceMedia.js +1 -60
  45. package/dist/react/time-slot-list/TimeSlot.d.ts +21 -6
  46. package/dist/react/time-slot-list/TimeSlot.js +34 -14
  47. package/dist/react/time-slot-list/TimeSlotList.d.ts +3 -49
  48. package/dist/react/time-slot-list/TimeSlotList.js +24 -21
  49. 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 { type AsChildChildren } from '@wix/headless-utils/react';
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.ItemsRoot component (Container Level)
66
+ * Props for Booking.BookingItems component
67
67
  */
68
- export interface ItemsRootProps {
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
- * List container component with emptyState support.
104
- * Wraps GenericList.Items. Must be used within Booking.ItemsRoot.
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.ItemsRoot>
110
- * <Booking.Items emptyState={<div>No bookings selected</div>}>
111
- * <Booking.ItemRepeater>
112
- * <Booking.Service>
113
- * <Service.Name />
114
- * </Booking.Service>
115
- * </Booking.ItemRepeater>
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 Items: React.ForwardRefExoticComponent<ItemsProps & React.RefAttributes<HTMLElement>>;
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.ItemRepeater component
96
+ * Props for Booking.BookingItemRepeater component
123
97
  */
124
- export interface ItemRepeaterProps {
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 Booking.Service, Booking.TimeSlot, etc.
104
+ * Children have access to BookingItem.Service, BookingItem.TimeSlot, etc.
131
105
  *
132
106
  * @component
133
107
  * @example
134
108
  * ```tsx
135
- * <Booking.ItemRepeater>
109
+ * <Booking.BookingItemRepeater>
136
110
  * <div className="booking-card">
137
- * <Booking.Service>
111
+ * <BookingItem.Service>
138
112
  * <Service.Name />
139
113
  * <Service.Price />
140
- * </Booking.Service>
141
- * <Booking.TimeSlot>
114
+ * </BookingItem.Service>
115
+ * <BookingItem.TimeSlot>
142
116
  * <TimeSlot.StartDate />
143
- * </Booking.TimeSlot>
144
- * <Booking.StaffName />
117
+ * </BookingItem.TimeSlot>
118
+ * <BookingItem.StaffName />
145
119
  * </div>
146
- * </Booking.ItemRepeater>
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 function Service(props: BookingServiceProps): React.ReactNode;
171
- /**
172
- * Props for Booking.TimeSlot component
173
- */
174
- export interface BookingTimeSlotProps {
175
- children: React.ReactNode;
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
- * Props for Booking.StaffName component
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 that provides GenericList.Root context for booking items.
86
- * Use Booking.Items inside for list container with emptyState support.
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.ItemsRoot>
92
- * <Booking.Items emptyState={<div>No bookings selected</div>}>
93
- * <Booking.ItemRepeater>
94
- * <div className="booking-card">
95
- * <Booking.Service>
96
- * <Service.Name />
97
- * </Booking.Service>
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 ItemsRoot = React.forwardRef((props, ref) => {
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.bookingItemsRoot, ...otherProps, children: children })) }));
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
- Items.displayName = 'Booking.Items';
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 Booking.Service, Booking.TimeSlot, etc.
120
+ * Children have access to BookingItem.Service, BookingItem.TimeSlot, etc.
145
121
  *
146
122
  * @component
147
123
  * @example
148
124
  * ```tsx
149
- * <Booking.ItemRepeater>
125
+ * <Booking.BookingItemRepeater>
150
126
  * <div className="booking-card">
151
- * <Booking.Service>
127
+ * <BookingItem.Service>
152
128
  * <Service.Name />
153
129
  * <Service.Price />
154
- * </Booking.Service>
155
- * <Booking.TimeSlot>
130
+ * </BookingItem.Service>
131
+ * <BookingItem.TimeSlot>
156
132
  * <TimeSlot.StartDate />
157
- * </Booking.TimeSlot>
158
- * <Booking.StaffName />
133
+ * </BookingItem.TimeSlot>
134
+ * <BookingItem.StaffName />
159
135
  * </div>
160
- * </Booking.ItemRepeater>
136
+ * </Booking.BookingItemRepeater>
161
137
  * ```
162
138
  */
163
- export const ItemRepeater = React.forwardRef((props, ref) => {
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
- ItemRepeater.displayName = 'Booking.ItemRepeater';
168
- /**
169
- * Wraps Service.Root with the service from the current booking item context.
170
- * Children can use all Service.* components (Service.Name, Service.Price, etc.).
171
- *
172
- * @component
173
- * @example
174
- * ```tsx
175
- * <Booking.Service>
176
- * <Service.Name className="text-xl font-bold" />
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
- * Displays the first staff member's name from the current booking item.
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
  }
@@ -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';