@wix/headless-bookings 0.0.49 → 0.0.51

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.
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Booking - High-level component for managing bookings
3
- * Provides root component for booking context
3
+ * Provides root component for booking context and booking item display components
4
4
  */
5
5
  import React from 'react';
6
+ import * as CoreBooking from '../core/booking/Booking.js';
6
7
  import type { BookingServiceConfig } from '../../services/booking/booking.js';
7
- export type { BookingData, DataProps } from '../core/booking/Booking.js';
8
+ import { type AsChildChildren } from '@wix/headless-utils/react';
9
+ export type { BookingData, DataProps, BookingItem, } from '../core/booking/Booking.js';
8
10
  /**
9
11
  * Props for Booking.Root component
10
12
  */
@@ -52,3 +54,212 @@ export declare const Root: {
52
54
  export declare const Actions: {
53
55
  Book: React.ForwardRefExoticComponent<import("./Book.js").BookProps & React.RefAttributes<HTMLButtonElement>>;
54
56
  };
57
+ /**
58
+ * Hook to access the current BookingItem from context.
59
+ * Must be used within Booking.ItemRepeater.
60
+ *
61
+ * @throws Error if used outside of ItemRepeater context
62
+ */
63
+ export declare const useBookingItem: typeof CoreBooking.useBookingItemContext;
64
+ /**
65
+ * Props for Booking.ItemsRoot component (Container Level)
66
+ */
67
+ export interface ItemsRootProps {
68
+ children: React.ReactNode;
69
+ className?: string;
70
+ }
71
+ /**
72
+ * Container component that provides GenericList.Root context for booking items.
73
+ * Use Booking.Items inside for list container with emptyState support.
74
+ *
75
+ * @component
76
+ * @example
77
+ * ```tsx
78
+ * <Booking.ItemsRoot>
79
+ * <Booking.Items emptyState={<div>No bookings selected</div>}>
80
+ * <Booking.ItemRepeater>
81
+ * <div className="booking-card">
82
+ * <Booking.Service>
83
+ * <Service.Name />
84
+ * </Booking.Service>
85
+ * </div>
86
+ * </Booking.ItemRepeater>
87
+ * </Booking.Items>
88
+ * </Booking.ItemsRoot>
89
+ * ```
90
+ */
91
+ export declare const ItemsRoot: React.ForwardRefExoticComponent<ItemsRootProps & React.RefAttributes<HTMLDivElement>>;
92
+ /**
93
+ * Props for Booking.Items component (List Container Level)
94
+ */
95
+ export interface ItemsProps {
96
+ children: React.ReactNode;
97
+ /** Content to render when there are no booking items */
98
+ emptyState?: React.ReactNode;
99
+ className?: string;
100
+ }
101
+ /**
102
+ * List container component with emptyState support.
103
+ * Wraps GenericList.Items. Must be used within Booking.ItemsRoot.
104
+ *
105
+ * @component
106
+ * @example
107
+ * ```tsx
108
+ * <Booking.ItemsRoot>
109
+ * <Booking.Items emptyState={<div>No bookings selected</div>}>
110
+ * <Booking.ItemRepeater>
111
+ * <Booking.Service>
112
+ * <Service.Name />
113
+ * </Booking.Service>
114
+ * </Booking.ItemRepeater>
115
+ * </Booking.Items>
116
+ * </Booking.ItemsRoot>
117
+ * ```
118
+ */
119
+ export declare const Items: React.ForwardRefExoticComponent<ItemsProps & React.RefAttributes<HTMLElement>>;
120
+ /**
121
+ * Props for Booking.ItemRepeater component
122
+ */
123
+ export interface ItemRepeaterProps {
124
+ children: React.ReactNode;
125
+ }
126
+ /**
127
+ * Repeater component that maps over booking items and provides context per item.
128
+ * Uses GenericList.Repeater internally with itemWrapper that provides BookingItemContext.
129
+ * Children have access to Booking.Service, Booking.TimeSlot, etc.
130
+ *
131
+ * @component
132
+ * @example
133
+ * ```tsx
134
+ * <Booking.ItemRepeater>
135
+ * <div className="booking-card">
136
+ * <Booking.Service>
137
+ * <Service.Name />
138
+ * <Service.Price />
139
+ * </Booking.Service>
140
+ * <Booking.TimeSlot>
141
+ * <TimeSlot.StartDate />
142
+ * </Booking.TimeSlot>
143
+ * <Booking.StaffName />
144
+ * </div>
145
+ * </Booking.ItemRepeater>
146
+ * ```
147
+ */
148
+ export declare const ItemRepeater: React.ForwardRefExoticComponent<ItemRepeaterProps & React.RefAttributes<HTMLElement>>;
149
+ /**
150
+ * Props for Booking.Service component
151
+ */
152
+ export interface BookingServiceProps {
153
+ children: React.ReactNode;
154
+ }
155
+ /**
156
+ * Wraps Service.Root with the service from the current booking item context.
157
+ * Children can use all Service.* components (Service.Name, Service.Price, etc.).
158
+ *
159
+ * @component
160
+ * @example
161
+ * ```tsx
162
+ * <Booking.Service>
163
+ * <Service.Name className="text-xl font-bold" />
164
+ * <Service.Description />
165
+ * <Service.Price />
166
+ * </Booking.Service>
167
+ * ```
168
+ */
169
+ export declare function Service(props: BookingServiceProps): React.ReactNode;
170
+ /**
171
+ * Props for Booking.TimeSlot component
172
+ */
173
+ export interface BookingTimeSlotProps {
174
+ children: React.ReactNode;
175
+ }
176
+ /**
177
+ * Wraps TimeSlot.Root with the timeSlot from the current booking item context.
178
+ * Children can use all TimeSlot.* components (TimeSlot.StartDate, TimeSlot.Duration, etc.).
179
+ * Always renders with data-has-time-slot attribute for CSS targeting.
180
+ *
181
+ * @component
182
+ * @example
183
+ * ```tsx
184
+ * <Booking.TimeSlot>
185
+ * <TimeSlot.StartDate />
186
+ * <TimeSlot.Duration />
187
+ * </Booking.TimeSlot>
188
+ * ```
189
+ */
190
+ export declare function TimeSlot(props: BookingTimeSlotProps): React.ReactNode;
191
+ /**
192
+ * Props for Booking.Payment component
193
+ */
194
+ export interface BookingPaymentProps {
195
+ children: React.ReactNode;
196
+ }
197
+ /**
198
+ * Wraps Payment.Root with all services from all booking items.
199
+ * Should be used outside of ItemRepeater - it calculates payment for all items.
200
+ * Children can use all Payment.* components (Payment.Total, Payment.Subtotal, etc.).
201
+ * Always renders with data-has-payment attribute for CSS targeting.
202
+ *
203
+ * @component
204
+ * @example
205
+ * ```tsx
206
+ * <Booking.Root>
207
+ * <Booking.ItemsRoot>
208
+ * <Booking.Items>
209
+ * <Booking.ItemRepeater>
210
+ * <Booking.Service><Service.Name /></Booking.Service>
211
+ * </Booking.ItemRepeater>
212
+ * </Booking.Items>
213
+ * </Booking.ItemsRoot>
214
+ *
215
+ * <Booking.Payment>
216
+ * <Payment.Total className="text-xl font-bold" />
217
+ * <Payment.Subtotal />
218
+ * </Booking.Payment>
219
+ * </Booking.Root>
220
+ * ```
221
+ */
222
+ export declare function Payment(props: BookingPaymentProps): React.ReactNode;
223
+ /**
224
+ * Props for Booking.Location component
225
+ */
226
+ export interface BookingLocationProps {
227
+ children: React.ReactNode;
228
+ }
229
+ /**
230
+ * Wraps Location.Root with the location from the booking context.
231
+ * Children can use all Location.* components (Location.Name, Location.Address, etc.).
232
+ * Always renders with data-has-location attribute for CSS targeting.
233
+ *
234
+ * @component
235
+ * @example
236
+ * ```tsx
237
+ * <Booking.Location>
238
+ * <Location.Name className="font-bold" />
239
+ * <Location.Address />
240
+ * <Location.Phone />
241
+ * </Booking.Location>
242
+ * ```
243
+ */
244
+ export declare function Location(props: BookingLocationProps): React.ReactNode;
245
+ /**
246
+ * Props for Booking.StaffName component
247
+ */
248
+ export interface StaffNameProps {
249
+ asChild?: boolean;
250
+ children?: AsChildChildren<{
251
+ name: string;
252
+ }>;
253
+ className?: string;
254
+ }
255
+ /**
256
+ * Displays the first staff member's name from the current booking item.
257
+ * Always renders with data-has-staff-name attribute for CSS targeting.
258
+ *
259
+ * @component
260
+ * @example
261
+ * ```tsx
262
+ * <Booking.StaffName className="text-foreground" />
263
+ * ```
264
+ */
265
+ export declare const StaffName: React.ForwardRefExoticComponent<StaffNameProps & React.RefAttributes<HTMLElement>>;
@@ -1,6 +1,31 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Booking - High-level component for managing bookings
4
+ * Provides root component for booking context and booking item display components
5
+ */
6
+ import React from 'react';
2
7
  import * as CoreBooking from '../core/booking/Booking.js';
3
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
+ import * as PaymentComponent from '../payment/Payment.js';
13
+ import * as LocationComponent from '../location/Location.js';
14
+ import { GenericList } from '@wix/headless-components/react';
15
+ // ============================================================================
16
+ // TestIds
17
+ // ============================================================================
18
+ var TestIds;
19
+ (function (TestIds) {
20
+ TestIds["bookingItemsRoot"] = "booking-items-root";
21
+ TestIds["bookingItems"] = "booking-items";
22
+ TestIds["bookingItem"] = "booking-item";
23
+ TestIds["bookingItemService"] = "booking-item-service";
24
+ TestIds["bookingItemTimeSlot"] = "booking-item-time-slot";
25
+ TestIds["bookingItemPayment"] = "booking-item-payment";
26
+ TestIds["bookingLocation"] = "booking-location";
27
+ TestIds["bookingStaffName"] = "booking-staff-name";
28
+ })(TestIds || (TestIds = {}));
4
29
  /**
5
30
  * Root component that provides booking context to the entire app.
6
31
  *
@@ -24,6 +49,9 @@ export const Root = (props) => {
24
49
  return (_jsx(CoreBooking.Root, { bookingServiceConfig: bookingServiceConfig, children: children }));
25
50
  };
26
51
  Root.displayName = 'Booking.Root';
52
+ // ============================================================================
53
+ // Actions Namespace
54
+ // ============================================================================
27
55
  /**
28
56
  * Actions namespace containing action components for booking
29
57
  *
@@ -42,3 +70,196 @@ Root.displayName = 'Booking.Root';
42
70
  export const Actions = {
43
71
  Book,
44
72
  };
73
+ // ============================================================================
74
+ // BookingItem Context (re-export from core)
75
+ // ============================================================================
76
+ /**
77
+ * Hook to access the current BookingItem from context.
78
+ * Must be used within Booking.ItemRepeater.
79
+ *
80
+ * @throws Error if used outside of ItemRepeater context
81
+ */
82
+ export const useBookingItem = CoreBooking.useBookingItemContext;
83
+ /**
84
+ * Container component that provides GenericList.Root context for booking items.
85
+ * Use Booking.Items inside for list container with emptyState support.
86
+ *
87
+ * @component
88
+ * @example
89
+ * ```tsx
90
+ * <Booking.ItemsRoot>
91
+ * <Booking.Items emptyState={<div>No bookings selected</div>}>
92
+ * <Booking.ItemRepeater>
93
+ * <div className="booking-card">
94
+ * <Booking.Service>
95
+ * <Service.Name />
96
+ * </Booking.Service>
97
+ * </div>
98
+ * </Booking.ItemRepeater>
99
+ * </Booking.Items>
100
+ * </Booking.ItemsRoot>
101
+ * ```
102
+ */
103
+ export const ItemsRoot = React.forwardRef((props, ref) => {
104
+ const { children, ...otherProps } = props;
105
+ return (_jsx(CoreBooking.ItemsData, { children: ({ items }) => (_jsx(GenericList.Root, { ref: ref, items: items.map((item) => ({
106
+ ...item,
107
+ id: item.instanceId,
108
+ })), hasMore: false, isLoading: false, "data-testid": TestIds.bookingItemsRoot, ...otherProps, children: children })) }));
109
+ });
110
+ ItemsRoot.displayName = 'Booking.ItemsRoot';
111
+ /**
112
+ * List container component with emptyState support.
113
+ * Wraps GenericList.Items. Must be used within Booking.ItemsRoot.
114
+ *
115
+ * @component
116
+ * @example
117
+ * ```tsx
118
+ * <Booking.ItemsRoot>
119
+ * <Booking.Items emptyState={<div>No bookings selected</div>}>
120
+ * <Booking.ItemRepeater>
121
+ * <Booking.Service>
122
+ * <Service.Name />
123
+ * </Booking.Service>
124
+ * </Booking.ItemRepeater>
125
+ * </Booking.Items>
126
+ * </Booking.ItemsRoot>
127
+ * ```
128
+ */
129
+ export const Items = React.forwardRef((props, ref) => {
130
+ const { children, ...otherProps } = props;
131
+ return (_jsx(GenericList.Items, { ref: ref, "data-testid": TestIds.bookingItems, ...otherProps, children: children }));
132
+ });
133
+ Items.displayName = 'Booking.Items';
134
+ /**
135
+ * Internal component that wraps each booking item with context provider.
136
+ */
137
+ const BookingItemWrapper = ({ item, children, }) => {
138
+ return (_jsx(CoreBooking.BookingItemProvider, { item: item, children: children }));
139
+ };
140
+ /**
141
+ * Repeater component that maps over booking items and provides context per item.
142
+ * Uses GenericList.Repeater internally with itemWrapper that provides BookingItemContext.
143
+ * Children have access to Booking.Service, Booking.TimeSlot, etc.
144
+ *
145
+ * @component
146
+ * @example
147
+ * ```tsx
148
+ * <Booking.ItemRepeater>
149
+ * <div className="booking-card">
150
+ * <Booking.Service>
151
+ * <Service.Name />
152
+ * <Service.Price />
153
+ * </Booking.Service>
154
+ * <Booking.TimeSlot>
155
+ * <TimeSlot.StartDate />
156
+ * </Booking.TimeSlot>
157
+ * <Booking.StaffName />
158
+ * </div>
159
+ * </Booking.ItemRepeater>
160
+ * ```
161
+ */
162
+ export const ItemRepeater = React.forwardRef((props, ref) => {
163
+ const { children } = props;
164
+ return (_jsx(GenericList.Repeater, { ref: ref, itemWrapper: ({ item }) => (_jsx(BookingItemWrapper, { item: item, children: children }, item.instanceId)), children: undefined }));
165
+ });
166
+ ItemRepeater.displayName = 'Booking.ItemRepeater';
167
+ /**
168
+ * Wraps Service.Root with the service from the current booking item context.
169
+ * Children can use all Service.* components (Service.Name, Service.Price, etc.).
170
+ *
171
+ * @component
172
+ * @example
173
+ * ```tsx
174
+ * <Booking.Service>
175
+ * <Service.Name className="text-xl font-bold" />
176
+ * <Service.Description />
177
+ * <Service.Price />
178
+ * </Booking.Service>
179
+ * ```
180
+ */
181
+ export function Service(props) {
182
+ const { children } = props;
183
+ return (_jsx(CoreBooking.BookingItemInfo, { children: ({ service }) => (_jsx(ServiceComponent.Root, { service: service, children: children })) }));
184
+ }
185
+ /**
186
+ * Wraps TimeSlot.Root with the timeSlot from the current booking item context.
187
+ * Children can use all TimeSlot.* components (TimeSlot.StartDate, TimeSlot.Duration, etc.).
188
+ * Always renders with data-has-time-slot attribute for CSS targeting.
189
+ *
190
+ * @component
191
+ * @example
192
+ * ```tsx
193
+ * <Booking.TimeSlot>
194
+ * <TimeSlot.StartDate />
195
+ * <TimeSlot.Duration />
196
+ * </Booking.TimeSlot>
197
+ * ```
198
+ */
199
+ export function TimeSlot(props) {
200
+ const { children } = props;
201
+ return (_jsx(CoreBooking.BookingItemInfo, { children: ({ timeSlot }) => timeSlot ? (_jsx(TimeSlotComponent.Root, { timeSlot: timeSlot, children: children })) : null }));
202
+ }
203
+ /**
204
+ * Wraps Payment.Root with all services from all booking items.
205
+ * Should be used outside of ItemRepeater - it calculates payment for all items.
206
+ * Children can use all Payment.* components (Payment.Total, Payment.Subtotal, etc.).
207
+ * Always renders with data-has-payment attribute for CSS targeting.
208
+ *
209
+ * @component
210
+ * @example
211
+ * ```tsx
212
+ * <Booking.Root>
213
+ * <Booking.ItemsRoot>
214
+ * <Booking.Items>
215
+ * <Booking.ItemRepeater>
216
+ * <Booking.Service><Service.Name /></Booking.Service>
217
+ * </Booking.ItemRepeater>
218
+ * </Booking.Items>
219
+ * </Booking.ItemsRoot>
220
+ *
221
+ * <Booking.Payment>
222
+ * <Payment.Total className="text-xl font-bold" />
223
+ * <Payment.Subtotal />
224
+ * </Booking.Payment>
225
+ * </Booking.Root>
226
+ * ```
227
+ */
228
+ export function Payment(props) {
229
+ const { children } = props;
230
+ return (_jsx(CoreBooking.PaymentData, { children: ({ slotServices }) => (_jsx(PaymentComponent.Root, { slotServices: slotServices, children: children })) }));
231
+ }
232
+ /**
233
+ * Wraps Location.Root with the location from the booking context.
234
+ * Children can use all Location.* components (Location.Name, Location.Address, etc.).
235
+ * Always renders with data-has-location attribute for CSS targeting.
236
+ *
237
+ * @component
238
+ * @example
239
+ * ```tsx
240
+ * <Booking.Location>
241
+ * <Location.Name className="font-bold" />
242
+ * <Location.Address />
243
+ * <Location.Phone />
244
+ * </Booking.Location>
245
+ * ```
246
+ */
247
+ export function Location(props) {
248
+ const { children } = props;
249
+ return (_jsx(CoreBooking.Data, { children: ({ location }) => location ? (_jsx(LocationComponent.Root, { location: location, children: children })) : null }));
250
+ }
251
+ /**
252
+ * Displays the first staff member's name from the current booking item.
253
+ * Always renders with data-has-staff-name attribute for CSS targeting.
254
+ *
255
+ * @component
256
+ * @example
257
+ * ```tsx
258
+ * <Booking.StaffName className="text-foreground" />
259
+ * ```
260
+ */
261
+ export const StaffName = React.forwardRef((props, ref) => {
262
+ const { asChild, children, className } = props;
263
+ return (_jsx(CoreBooking.BookingItemInfo, { children: ({ staffName }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.bookingStaffName, "data-has-staff-name": Boolean(staffName), customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) })) }));
264
+ });
265
+ StaffName.displayName = 'Booking.StaffName';
@@ -5,7 +5,9 @@
5
5
  import React from 'react';
6
6
  import { type BookingServiceConfig, type ServiceSelection, type BookingServiceActions } from '../../../services/booking/booking.js';
7
7
  import type { FormValues } from '@wix/form-public';
8
- import type { Location as TimeSlotLocationType } from '@wix/auto_sdk_bookings_availability-time-slots';
8
+ import type { TimeSlot, Resource } from '@wix/auto_sdk_bookings_availability-time-slots';
9
+ import type { Service, Location as ServiceLocationType } from '@wix/auto_sdk_bookings_services';
10
+ import type { SlotService } from '../../../services/payment/payment.js';
9
11
  /**
10
12
  * Props for Booking.Root component
11
13
  */
@@ -35,7 +37,7 @@ export declare function Root(props: RootProps): React.ReactNode;
35
37
  */
36
38
  export interface BookingData {
37
39
  serviceSelections: ServiceSelection[];
38
- location: TimeSlotLocationType | null;
40
+ location: ServiceLocationType | null;
39
41
  timezone: string | undefined;
40
42
  formSubmission: FormValues | null;
41
43
  actions: BookingServiceActions;
@@ -46,22 +48,148 @@ export interface BookingData {
46
48
  export interface DataProps {
47
49
  children: (data: BookingData) => React.ReactNode;
48
50
  }
51
+ export declare function Data(props: DataProps): React.ReactNode;
52
+ /**
53
+ * Unified data object for a single booking item.
54
+ * Contains resolved data ready for use - no raw serviceSelection duplication.
55
+ */
56
+ export interface BookingItem {
57
+ /** SDK Service object */
58
+ service: Service;
59
+ /** Adapted SDK TimeSlot (or null if no time slot selected) */
60
+ timeSlot: TimeSlot | null;
61
+ /** Resolved staff: timeSlot.resources ?? selection.resources, or null if none */
62
+ staff: Resource[] | null;
63
+ /** Unique identifier for this booking instance */
64
+ instanceId: string;
65
+ /** Position in the serviceSelections array */
66
+ index: number;
67
+ }
68
+ /**
69
+ * Hook to access the current BookingItem from context.
70
+ * Must be used within BookingItemProvider.
71
+ *
72
+ * @throws Error if used outside of BookingItemProvider context
73
+ */
74
+ export declare function useBookingItemContext(): BookingItem;
75
+ /**
76
+ * Props for BookingItemProvider
77
+ */
78
+ export interface BookingItemProviderProps {
79
+ children: React.ReactNode;
80
+ item: BookingItem;
81
+ }
82
+ /**
83
+ * Provider component used by repeaters to provide BookingItem context.
84
+ * Can be used by core consumers to create their own repeater.
85
+ *
86
+ * @component
87
+ * @example
88
+ * ```tsx
89
+ * {items.map((item) => (
90
+ * <BookingItemProvider key={item.instanceId} item={item}>
91
+ * {children}
92
+ * </BookingItemProvider>
93
+ * ))}
94
+ * ```
95
+ */
96
+ export declare function BookingItemProvider(props: BookingItemProviderProps): React.ReactNode;
97
+ /**
98
+ * Props for BookingItemInfo render prop component
99
+ */
100
+ export interface BookingItemInfoProps {
101
+ children: (data: {
102
+ /** SDK Service object */
103
+ service: Service;
104
+ /** Adapted SDK TimeSlot (or null if no time slot selected) */
105
+ timeSlot: TimeSlot | null;
106
+ /** First staff member's name, empty string if none */
107
+ staffName: string;
108
+ /** Unique identifier for this booking instance */
109
+ instanceId: string;
110
+ /** Position in the serviceSelections array */
111
+ index: number;
112
+ /** The raw BookingItem object */
113
+ item: BookingItem;
114
+ }) => React.ReactNode;
115
+ }
116
+ /**
117
+ * Core component that provides access to booking item info via render props.
118
+ * Must be used within BookingItemProvider.
119
+ *
120
+ * @component
121
+ * @example
122
+ * ```tsx
123
+ * <BookingItemInfo>
124
+ * {({ service, timeSlot, staffName }) => (
125
+ * <div>
126
+ * <span>{service.name}</span>
127
+ * <span>{staffName}</span>
128
+ * </div>
129
+ * )}
130
+ * </BookingItemInfo>
131
+ * ```
132
+ */
133
+ export declare function BookingItemInfo(props: BookingItemInfoProps): React.ReactNode;
134
+ /**
135
+ * Data exposed by ItemsData render prop
136
+ */
137
+ export interface ItemsDataRenderProps {
138
+ /** Array of BookingItem objects */
139
+ items: BookingItem[];
140
+ }
49
141
  /**
50
- * Core component that provides access to booking data via render props.
51
- * Used internally by higher-level Booking components.
142
+ * Props for ItemsData render prop component
143
+ */
144
+ export interface ItemsDataProps {
145
+ children: (data: ItemsDataRenderProps) => React.ReactNode;
146
+ }
147
+ /**
148
+ * Core component that provides access to booking items array via render props.
149
+ * Transforms serviceSelections into BookingItem objects.
52
150
  *
53
151
  * @component
54
152
  * @example
55
153
  * ```tsx
56
- * <Booking.Data>
57
- * {({ serviceSelections, location, timezone, formSubmission, actions }) => (
58
- * serviceSelections.length > 0 ? (
59
- * <div>{serviceSelections.map(item => item.service.name).join(', ')}</div>
154
+ * <Booking.ItemsData>
155
+ * {({ items }) => (
156
+ * items.length > 0 ? (
157
+ * <div>{items.length} bookings</div>
60
158
  * ) : (
61
- * <div>No services selected</div>
159
+ * <div>No bookings</div>
62
160
  * )
63
161
  * )}
64
- * </Booking.Data>
162
+ * </Booking.ItemsData>
65
163
  * ```
66
164
  */
67
- export declare function Data(props: DataProps): React.ReactNode;
165
+ export declare function ItemsData(props: ItemsDataProps): React.ReactNode;
166
+ /**
167
+ * Data exposed by PaymentData render prop
168
+ */
169
+ export interface PaymentDataRenderProps {
170
+ /** SlotServices array for Payment.Root */
171
+ slotServices: SlotService[];
172
+ }
173
+ /**
174
+ * Props for PaymentData render prop component
175
+ */
176
+ export interface PaymentDataProps {
177
+ children: (data: PaymentDataRenderProps) => React.ReactNode;
178
+ }
179
+ /**
180
+ * Core component that provides payment data via render props.
181
+ * Computes slotServices from serviceSelections.
182
+ *
183
+ * @component
184
+ * @example
185
+ * ```tsx
186
+ * <Booking.PaymentData>
187
+ * {({ slotServices }) => (
188
+ * <Payment.Root slotServices={slotServices}>
189
+ * <Payment.TotalPrice />
190
+ * </Payment.Root>
191
+ * )}
192
+ * </Booking.PaymentData>
193
+ * ```
194
+ */
195
+ export declare function PaymentData(props: PaymentDataProps): React.ReactNode;