@wix/headless-bookings 0.0.87 → 0.0.89
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/payment/Payment.d.ts +3 -3
- package/cjs/dist/react/core/payment/Payment.js +4 -4
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.d.ts +2 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.js +3 -0
- package/cjs/dist/react/index.d.ts +1 -0
- package/cjs/dist/react/index.js +1 -0
- package/cjs/dist/react/payment/Payment.d.ts +3 -46
- package/cjs/dist/react/payment/Payment.js +4 -37
- 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/cjs/dist/services/payment/payment.d.ts +2 -2
- package/cjs/dist/services/payment/payment.def.d.ts +1 -1
- package/cjs/dist/services/payment/payment.js +11 -11
- 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/payment/Payment.d.ts +3 -3
- package/dist/react/core/payment/Payment.js +4 -4
- package/dist/react/core/time-slot-list/TimeSlotList.d.ts +2 -0
- package/dist/react/core/time-slot-list/TimeSlotList.js +3 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/payment/Payment.d.ts +3 -46
- package/dist/react/payment/Payment.js +4 -37
- 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/dist/services/payment/payment.d.ts +2 -2
- package/dist/services/payment/payment.def.d.ts +1 -1
- package/dist/services/payment/payment.js +11 -11
- package/package.json +2 -2
|
@@ -19,7 +19,7 @@ export interface RootProps {
|
|
|
19
19
|
/** Pricing service selections for lazy loading (triggers API call) */
|
|
20
20
|
pricingServiceSelections?: PricingServiceSelection[];
|
|
21
21
|
/** Number of participants for lazy loading */
|
|
22
|
-
|
|
22
|
+
totalParticipants?: number;
|
|
23
23
|
asChild?: boolean;
|
|
24
24
|
className?: string;
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ export interface RootProps {
|
|
|
27
27
|
* Root component that provides payment context to the entire app.
|
|
28
28
|
* Supports 3 modes:
|
|
29
29
|
* 1. SSR: paymentServiceConfig.paymentDetails - pre-fetched data
|
|
30
|
-
* 2. Lazy loading: pricingServiceSelections +
|
|
30
|
+
* 2. Lazy loading: pricingServiceSelections + totalParticipants props - calls API via useEffect
|
|
31
31
|
* 3. Reactive: no config/props - reads from BookingService signals
|
|
32
32
|
*
|
|
33
33
|
* @order 1
|
|
@@ -48,7 +48,7 @@ export interface RootProps {
|
|
|
48
48
|
* // Lazy loading mode
|
|
49
49
|
* function LazyPayment({ slotServices }) {
|
|
50
50
|
* return (
|
|
51
|
-
* <Payment.Root slotServices={slotServices}
|
|
51
|
+
* <Payment.Root slotServices={slotServices} totalParticipants={2}>
|
|
52
52
|
* {({ isLoading }) => isLoading ? <div>Loading...</div> : <Payment.Total />}
|
|
53
53
|
* </Payment.Root>
|
|
54
54
|
* );
|
|
@@ -109,27 +109,6 @@ export interface TaxProps {
|
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
111
|
export declare const Tax: React.ForwardRefExoticComponent<TaxProps & React.RefAttributes<HTMLElement>>;
|
|
112
|
-
/**
|
|
113
|
-
* Props for Payment.Discount component
|
|
114
|
-
*/
|
|
115
|
-
export interface DiscountProps {
|
|
116
|
-
asChild?: boolean;
|
|
117
|
-
children?: AsChildChildren<{
|
|
118
|
-
discount: MoneyData | null;
|
|
119
|
-
}>;
|
|
120
|
-
className?: string;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Displays the payment discount.
|
|
124
|
-
* Uses data-has-discount attribute for conditional visibility.
|
|
125
|
-
*
|
|
126
|
-
* @component
|
|
127
|
-
* @example
|
|
128
|
-
* ```tsx
|
|
129
|
-
* <Payment.Discount className="text-green-500" />
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
export declare const Discount: React.ForwardRefExoticComponent<DiscountProps & React.RefAttributes<HTMLElement>>;
|
|
133
112
|
/**
|
|
134
113
|
* Props for Payment.Total component
|
|
135
114
|
*/
|
|
@@ -280,7 +259,6 @@ export interface LineItemRepeaterProps {
|
|
|
280
259
|
* ```tsx
|
|
281
260
|
* <Payment.LineItemRepeater>
|
|
282
261
|
* <Payment.LineItemTotal />
|
|
283
|
-
* <Payment.LineItemDiscount />
|
|
284
262
|
* </Payment.LineItemRepeater>
|
|
285
263
|
* ```
|
|
286
264
|
*/
|
|
@@ -329,27 +307,6 @@ export interface LineItemSubtotalProps {
|
|
|
329
307
|
* ```
|
|
330
308
|
*/
|
|
331
309
|
export declare const LineItemSubtotal: React.ForwardRefExoticComponent<LineItemSubtotalProps & React.RefAttributes<HTMLElement>>;
|
|
332
|
-
/**
|
|
333
|
-
* Props for Payment.LineItemDiscount component
|
|
334
|
-
*/
|
|
335
|
-
export interface LineItemDiscountProps {
|
|
336
|
-
asChild?: boolean;
|
|
337
|
-
children?: AsChildChildren<{
|
|
338
|
-
discount: MoneyData | null;
|
|
339
|
-
}>;
|
|
340
|
-
className?: string;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Displays the line item discount.
|
|
344
|
-
* Uses data-has-discount attribute for conditional visibility.
|
|
345
|
-
*
|
|
346
|
-
* @component
|
|
347
|
-
* @example
|
|
348
|
-
* ```tsx
|
|
349
|
-
* <Payment.LineItemDiscount className="text-green-500" />
|
|
350
|
-
* ```
|
|
351
|
-
*/
|
|
352
|
-
export declare const LineItemDiscount: React.ForwardRefExoticComponent<LineItemDiscountProps & React.RefAttributes<HTMLElement>>;
|
|
353
310
|
/**
|
|
354
311
|
* Props for Payment.LineItemDeposit component
|
|
355
312
|
*/
|
|
@@ -12,7 +12,6 @@ var TestIds;
|
|
|
12
12
|
TestIds["paymentRoot"] = "payment-root";
|
|
13
13
|
TestIds["paymentSubtotal"] = "payment-subtotal";
|
|
14
14
|
TestIds["paymentTax"] = "payment-tax";
|
|
15
|
-
TestIds["paymentDiscount"] = "payment-discount";
|
|
16
15
|
TestIds["paymentTotal"] = "payment-total";
|
|
17
16
|
TestIds["paymentPayNow"] = "payment-pay-now";
|
|
18
17
|
TestIds["paymentPayLater"] = "payment-pay-later";
|
|
@@ -21,14 +20,13 @@ var TestIds;
|
|
|
21
20
|
TestIds["paymentLineItemRepeater"] = "payment-line-item-repeater";
|
|
22
21
|
TestIds["paymentLineItemTotal"] = "payment-line-item-total";
|
|
23
22
|
TestIds["paymentLineItemSubtotal"] = "payment-line-item-subtotal";
|
|
24
|
-
TestIds["paymentLineItemDiscount"] = "payment-line-item-discount";
|
|
25
23
|
TestIds["paymentLineItemDeposit"] = "payment-line-item-deposit";
|
|
26
24
|
})(TestIds || (TestIds = {}));
|
|
27
25
|
/**
|
|
28
26
|
* Root component that provides payment context to the entire app.
|
|
29
27
|
* Supports 3 modes:
|
|
30
28
|
* 1. SSR: paymentServiceConfig.paymentDetails - pre-fetched data
|
|
31
|
-
* 2. Lazy loading: pricingServiceSelections +
|
|
29
|
+
* 2. Lazy loading: pricingServiceSelections + totalParticipants props - calls API via useEffect
|
|
32
30
|
* 3. Reactive: no config/props - reads from BookingService signals
|
|
33
31
|
*
|
|
34
32
|
* @order 1
|
|
@@ -49,7 +47,7 @@ var TestIds;
|
|
|
49
47
|
* // Lazy loading mode
|
|
50
48
|
* function LazyPayment({ slotServices }) {
|
|
51
49
|
* return (
|
|
52
|
-
* <Payment.Root slotServices={slotServices}
|
|
50
|
+
* <Payment.Root slotServices={slotServices} totalParticipants={2}>
|
|
53
51
|
* {({ isLoading }) => isLoading ? <div>Loading...</div> : <Payment.Total />}
|
|
54
52
|
* </Payment.Root>
|
|
55
53
|
* );
|
|
@@ -57,8 +55,8 @@ var TestIds;
|
|
|
57
55
|
* ```
|
|
58
56
|
*/
|
|
59
57
|
export const Root = React.forwardRef((props, ref) => {
|
|
60
|
-
const { children, paymentServiceConfig, pricingServiceSelections,
|
|
61
|
-
return (_jsx(CorePayment.Root, { paymentServiceConfig: paymentServiceConfig, pricingServiceSelections: pricingServiceSelections,
|
|
58
|
+
const { children, paymentServiceConfig, pricingServiceSelections, totalParticipants, asChild, className, ...attrs } = props;
|
|
59
|
+
return (_jsx(CorePayment.Root, { paymentServiceConfig: paymentServiceConfig, pricingServiceSelections: pricingServiceSelections, totalParticipants: totalParticipants, children: ({ isLoading, hasError }) => {
|
|
62
60
|
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentRoot, "data-loading": isLoading, "data-has-error": hasError, customElement: children, customElementProps: { isLoading, hasError }, ...attrs, children: children }));
|
|
63
61
|
} }));
|
|
64
62
|
});
|
|
@@ -106,21 +104,6 @@ export const Tax = React.forwardRef((props, ref) => {
|
|
|
106
104
|
return (_jsx(CorePayment.Data, { children: ({ tax, hasTax }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentTax, "data-has-tax": hasTax, customElement: children, customElementProps: { tax }, children: hasTax && _jsx(Money, { money: tax }) })) }));
|
|
107
105
|
});
|
|
108
106
|
Tax.displayName = 'Payment.Tax';
|
|
109
|
-
/**
|
|
110
|
-
* Displays the payment discount.
|
|
111
|
-
* Uses data-has-discount attribute for conditional visibility.
|
|
112
|
-
*
|
|
113
|
-
* @component
|
|
114
|
-
* @example
|
|
115
|
-
* ```tsx
|
|
116
|
-
* <Payment.Discount className="text-green-500" />
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
export const Discount = React.forwardRef((props, ref) => {
|
|
120
|
-
const { asChild, children, className } = props;
|
|
121
|
-
return (_jsx(CorePayment.Data, { children: ({ discount, hasDiscount }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentDiscount, "data-has-discount": hasDiscount, customElement: children, customElementProps: { discount }, children: hasDiscount && _jsx(Money, { money: discount }) })) }));
|
|
122
|
-
});
|
|
123
|
-
Discount.displayName = 'Payment.Discount';
|
|
124
107
|
/**
|
|
125
108
|
* Displays the payment total.
|
|
126
109
|
* Always displays the monetary value. Exposes customPrice for custom rendering.
|
|
@@ -249,7 +232,6 @@ const LineItemWrapper = ({ item, currency, children, }) => {
|
|
|
249
232
|
* ```tsx
|
|
250
233
|
* <Payment.LineItemRepeater>
|
|
251
234
|
* <Payment.LineItemTotal />
|
|
252
|
-
* <Payment.LineItemDiscount />
|
|
253
235
|
* </Payment.LineItemRepeater>
|
|
254
236
|
* ```
|
|
255
237
|
*/
|
|
@@ -289,21 +271,6 @@ export const LineItemSubtotal = React.forwardRef((props, ref) => {
|
|
|
289
271
|
return (_jsx(CorePayment.LineItemInfo, { children: ({ subtotal, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItemSubtotal, "data-has-custom-price": !!customPrice, customElement: children, customElementProps: { subtotal, customPrice }, children: customPrice ? (_jsx("span", { children: customPrice })) : (subtotal && _jsx(Money, { money: subtotal })) })) }));
|
|
290
272
|
});
|
|
291
273
|
LineItemSubtotal.displayName = 'Payment.LineItemSubtotal';
|
|
292
|
-
/**
|
|
293
|
-
* Displays the line item discount.
|
|
294
|
-
* Uses data-has-discount attribute for conditional visibility.
|
|
295
|
-
*
|
|
296
|
-
* @component
|
|
297
|
-
* @example
|
|
298
|
-
* ```tsx
|
|
299
|
-
* <Payment.LineItemDiscount className="text-green-500" />
|
|
300
|
-
* ```
|
|
301
|
-
*/
|
|
302
|
-
export const LineItemDiscount = React.forwardRef((props, ref) => {
|
|
303
|
-
const { asChild, children, className } = props;
|
|
304
|
-
return (_jsx(CorePayment.LineItemInfo, { children: ({ discount, hasDiscount }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItemDiscount, "data-has-discount": hasDiscount, customElement: children, customElementProps: { discount }, children: hasDiscount && _jsx(Money, { money: discount }) })) }));
|
|
305
|
-
});
|
|
306
|
-
LineItemDiscount.displayName = 'Payment.LineItemDiscount';
|
|
307
274
|
/**
|
|
308
275
|
* Displays the line item deposit amount.
|
|
309
276
|
* Uses data-has-deposit attribute for conditional visibility.
|
|
@@ -1178,7 +1178,5 @@ export declare const StaffMembers: typeof StaffMembersBase & {
|
|
|
1178
1178
|
};
|
|
1179
1179
|
export declare const MainMedia: React.ForwardRefExoticComponent<ServiceMediaModule.MainProps & React.RefAttributes<HTMLImageElement>>;
|
|
1180
1180
|
export declare const CoverMedia: React.ForwardRefExoticComponent<ServiceMediaModule.CoverProps & React.RefAttributes<HTMLImageElement>>;
|
|
1181
|
-
export declare const MediaGallery: React.FC<ServiceMediaModule.GalleryProps>;
|
|
1182
1181
|
export type { MainProps as MainMediaProps } from './ServiceMedia.js';
|
|
1183
1182
|
export type { CoverProps as CoverMediaProps } from './ServiceMedia.js';
|
|
1184
|
-
export type { GalleryProps as MediaGalleryProps } from './ServiceMedia.js';
|
|
@@ -5,8 +5,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import * as CoreService from '../core/service/Service.js';
|
|
8
|
+
import * as CoreServiceMediaGallery from '../core/service/ServiceMediaGallery.js';
|
|
8
9
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
9
10
|
import { Money } from '@wix/headless-components/react';
|
|
11
|
+
import { MediaGallery } from '@wix/headless-media/react';
|
|
10
12
|
import { RateType, } from '@wix/auto_sdk_bookings_services';
|
|
11
13
|
import * as LocationList from '../location/LocationList.js';
|
|
12
14
|
// Note: Location components are used inside LocationList.LocationRepeater
|
|
@@ -118,7 +120,7 @@ export const Root = React.forwardRef((props, ref) => {
|
|
|
118
120
|
serviceSlug,
|
|
119
121
|
appId,
|
|
120
122
|
};
|
|
121
|
-
return (_jsx(CoreService.Root, { serviceServiceConfig: serviceServiceConfig, children: ({ selected, bookable }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceRoot, "data-selected": selected, "data-bookable": bookable, customElement: children, customElementProps: { selected, bookable }, ...attrs, children: children })) }));
|
|
123
|
+
return (_jsx(CoreService.Root, { serviceServiceConfig: serviceServiceConfig, children: ({ selected, bookable }) => (_jsx(CoreServiceMediaGallery.MediaGallery, { children: ({ mediaItems }) => (_jsx(MediaGallery.Root, { mediaGalleryServiceConfig: { media: mediaItems }, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceRoot, "data-selected": selected, "data-bookable": bookable, customElement: children, customElementProps: { selected, bookable }, ...attrs, children: children }) })) })) }));
|
|
122
124
|
});
|
|
123
125
|
Root.displayName = 'Service.Root';
|
|
124
126
|
/**
|
|
@@ -1131,5 +1133,3 @@ export const MainMedia = ServiceMediaModule.Main;
|
|
|
1131
1133
|
MainMedia.displayName = 'Service.MainMedia';
|
|
1132
1134
|
export const CoverMedia = ServiceMediaModule.Cover;
|
|
1133
1135
|
CoverMedia.displayName = 'Service.CoverMedia';
|
|
1134
|
-
export const MediaGallery = ServiceMediaModule.Gallery;
|
|
1135
|
-
MediaGallery.displayName = 'Service.MediaGallery';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ServiceMedia - Compound component for displaying service media
|
|
3
|
-
* Provides components for displaying main media
|
|
3
|
+
* Provides components for displaying main media and cover media images
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
@@ -105,67 +105,6 @@ export interface CoverProps {
|
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
107
|
export declare const Cover: React.ForwardRefExoticComponent<CoverProps & React.RefAttributes<HTMLImageElement>>;
|
|
108
|
-
/**
|
|
109
|
-
* Props for ServiceMedia.Gallery component
|
|
110
|
-
*/
|
|
111
|
-
export interface GalleryProps {
|
|
112
|
-
/** Child components to render within the gallery (MediaGallery components) */
|
|
113
|
-
children: React.ReactNode;
|
|
114
|
-
/** Whether the gallery should loop infinitely */
|
|
115
|
-
infinite?: boolean;
|
|
116
|
-
/** Auto-play configuration for the gallery */
|
|
117
|
-
autoPlay?: {
|
|
118
|
-
/** Direction of auto-play */
|
|
119
|
-
direction?: 'forward' | 'backward';
|
|
120
|
-
/** Interval between slides in milliseconds */
|
|
121
|
-
intervalMs?: number;
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Container for service media items gallery.
|
|
126
|
-
* Renders a MediaGallery.Root with the service media items.
|
|
127
|
-
* Supports autoPlay and infinite scroll options for carousel behavior.
|
|
128
|
-
*
|
|
129
|
-
* @component
|
|
130
|
-
* @example
|
|
131
|
-
* ```tsx
|
|
132
|
-
* // Basic usage with MediaGallery components
|
|
133
|
-
* <ServiceMedia.Gallery>
|
|
134
|
-
* <MediaGallery.Thumbnails>
|
|
135
|
-
* <MediaGallery.ThumbnailRepeater>
|
|
136
|
-
* <MediaGallery.ThumbnailItem />
|
|
137
|
-
* </MediaGallery.ThumbnailRepeater>
|
|
138
|
-
* </MediaGallery.Thumbnails>
|
|
139
|
-
* </ServiceMedia.Gallery>
|
|
140
|
-
*
|
|
141
|
-
* // With autoPlay carousel
|
|
142
|
-
* <ServiceMedia.Gallery
|
|
143
|
-
* autoPlay={{ direction: 'forward', intervalMs: 3000 }}
|
|
144
|
-
* infinite
|
|
145
|
-
* >
|
|
146
|
-
* <MediaGallery.Viewport />
|
|
147
|
-
* <MediaGallery.Previous />
|
|
148
|
-
* <MediaGallery.Next />
|
|
149
|
-
* </ServiceMedia.Gallery>
|
|
150
|
-
*
|
|
151
|
-
* // Full gallery with thumbnails and navigation
|
|
152
|
-
* <ServiceMedia.Gallery infinite>
|
|
153
|
-
* <div className="gallery-container">
|
|
154
|
-
* <MediaGallery.Viewport className="main-image" />
|
|
155
|
-
* <div className="controls">
|
|
156
|
-
* <MediaGallery.Previous>Prev</MediaGallery.Previous>
|
|
157
|
-
* <MediaGallery.Next>Next</MediaGallery.Next>
|
|
158
|
-
* </div>
|
|
159
|
-
* <MediaGallery.Thumbnails>
|
|
160
|
-
* <MediaGallery.ThumbnailRepeater>
|
|
161
|
-
* <MediaGallery.ThumbnailItem />
|
|
162
|
-
* </MediaGallery.ThumbnailRepeater>
|
|
163
|
-
* </MediaGallery.Thumbnails>
|
|
164
|
-
* </div>
|
|
165
|
-
* </ServiceMedia.Gallery>
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
export declare const Gallery: React.FC<GalleryProps>;
|
|
169
108
|
/**
|
|
170
109
|
* ServiceMedia compound component for displaying service media
|
|
171
110
|
*
|
|
@@ -186,6 +125,5 @@ export declare const Gallery: React.FC<GalleryProps>;
|
|
|
186
125
|
export declare const ServiceMedia: {
|
|
187
126
|
Main: React.ForwardRefExoticComponent<MainProps & React.RefAttributes<HTMLImageElement>>;
|
|
188
127
|
Cover: React.ForwardRefExoticComponent<CoverProps & React.RefAttributes<HTMLImageElement>>;
|
|
189
|
-
Gallery: React.FC<GalleryProps>;
|
|
190
128
|
};
|
|
191
129
|
export default ServiceMedia;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* ServiceMedia - Compound component for displaying service media
|
|
4
|
-
* Provides components for displaying main media
|
|
4
|
+
* Provides components for displaying main media and cover media images
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
8
8
|
import { WixMediaImage } from '@wix/headless-media/react';
|
|
9
|
-
import { MediaGallery } from '@wix/headless-media/react';
|
|
10
9
|
import * as CoreServiceMediaMain from '../core/service/ServiceMediaMain.js';
|
|
11
10
|
import * as CoreServiceMediaCover from '../core/service/ServiceMediaCover.js';
|
|
12
|
-
import * as CoreServiceMediaGallery from '../core/service/ServiceMediaGallery.js';
|
|
13
11
|
var TestIds;
|
|
14
12
|
(function (TestIds) {
|
|
15
13
|
TestIds["serviceMediaMain"] = "service-media-main";
|
|
@@ -94,62 +92,6 @@ export const Cover = React.forwardRef((props, ref) => {
|
|
|
94
92
|
return (_jsx(CoreServiceMediaCover.CoverMedia, { children: ({ coverMedia }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceMediaCover, customElement: children, customElementProps: { media: coverMedia }, children: coverMedia?.image ? _jsx(WixMediaImage, { media: coverMedia }) : null })) }));
|
|
95
93
|
});
|
|
96
94
|
Cover.displayName = 'ServiceMedia.Cover';
|
|
97
|
-
/**
|
|
98
|
-
* Container for service media items gallery.
|
|
99
|
-
* Renders a MediaGallery.Root with the service media items.
|
|
100
|
-
* Supports autoPlay and infinite scroll options for carousel behavior.
|
|
101
|
-
*
|
|
102
|
-
* @component
|
|
103
|
-
* @example
|
|
104
|
-
* ```tsx
|
|
105
|
-
* // Basic usage with MediaGallery components
|
|
106
|
-
* <ServiceMedia.Gallery>
|
|
107
|
-
* <MediaGallery.Thumbnails>
|
|
108
|
-
* <MediaGallery.ThumbnailRepeater>
|
|
109
|
-
* <MediaGallery.ThumbnailItem />
|
|
110
|
-
* </MediaGallery.ThumbnailRepeater>
|
|
111
|
-
* </MediaGallery.Thumbnails>
|
|
112
|
-
* </ServiceMedia.Gallery>
|
|
113
|
-
*
|
|
114
|
-
* // With autoPlay carousel
|
|
115
|
-
* <ServiceMedia.Gallery
|
|
116
|
-
* autoPlay={{ direction: 'forward', intervalMs: 3000 }}
|
|
117
|
-
* infinite
|
|
118
|
-
* >
|
|
119
|
-
* <MediaGallery.Viewport />
|
|
120
|
-
* <MediaGallery.Previous />
|
|
121
|
-
* <MediaGallery.Next />
|
|
122
|
-
* </ServiceMedia.Gallery>
|
|
123
|
-
*
|
|
124
|
-
* // Full gallery with thumbnails and navigation
|
|
125
|
-
* <ServiceMedia.Gallery infinite>
|
|
126
|
-
* <div className="gallery-container">
|
|
127
|
-
* <MediaGallery.Viewport className="main-image" />
|
|
128
|
-
* <div className="controls">
|
|
129
|
-
* <MediaGallery.Previous>Prev</MediaGallery.Previous>
|
|
130
|
-
* <MediaGallery.Next>Next</MediaGallery.Next>
|
|
131
|
-
* </div>
|
|
132
|
-
* <MediaGallery.Thumbnails>
|
|
133
|
-
* <MediaGallery.ThumbnailRepeater>
|
|
134
|
-
* <MediaGallery.ThumbnailItem />
|
|
135
|
-
* </MediaGallery.ThumbnailRepeater>
|
|
136
|
-
* </MediaGallery.Thumbnails>
|
|
137
|
-
* </div>
|
|
138
|
-
* </ServiceMedia.Gallery>
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
export const Gallery = (props) => {
|
|
142
|
-
const { children, infinite, autoPlay } = props;
|
|
143
|
-
return (_jsx(CoreServiceMediaGallery.MediaGallery, { children: ({ mediaItems }) => {
|
|
144
|
-
const mediaGalleryServiceConfig = {
|
|
145
|
-
media: mediaItems,
|
|
146
|
-
infinite,
|
|
147
|
-
autoPlay,
|
|
148
|
-
};
|
|
149
|
-
return (_jsx(MediaGallery.Root, { mediaGalleryServiceConfig: mediaGalleryServiceConfig, children: children }));
|
|
150
|
-
} }));
|
|
151
|
-
};
|
|
152
|
-
Gallery.displayName = 'ServiceMedia.Gallery';
|
|
153
95
|
/**
|
|
154
96
|
* ServiceMedia compound component for displaying service media
|
|
155
97
|
*
|
|
@@ -170,6 +112,5 @@ Gallery.displayName = 'ServiceMedia.Gallery';
|
|
|
170
112
|
export const ServiceMedia = {
|
|
171
113
|
Main,
|
|
172
114
|
Cover,
|
|
173
|
-
Gallery,
|
|
174
115
|
};
|
|
175
116
|
export default ServiceMedia;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* the necessary context. There is no public TimeSlot.Root - context is managed internally.
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import { type DateData } from '@wix/headless-components/react';
|
|
9
10
|
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
10
11
|
import type { TimeSlot as TimeSlotType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
11
12
|
import * as CoreTimeSlot from '../core/time-slot-list/TimeSlot.js';
|
|
@@ -46,9 +47,10 @@ export declare enum TestIds {
|
|
|
46
47
|
timeSlotStaffMemberActionSelect = "time-slot-staff-member-action-select"
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
|
-
* Props for TimeSlot.StartDate component
|
|
50
|
+
* Props for TimeSlot.StartDate component.
|
|
51
|
+
* Inherits formatting options from DateData (dateTimeFormatOptions, locale).
|
|
50
52
|
*/
|
|
51
|
-
export interface StartDateProps {
|
|
53
|
+
export interface StartDateProps extends Omit<DateData, 'date'> {
|
|
52
54
|
asChild?: boolean;
|
|
53
55
|
children?: AsChildChildren<{
|
|
54
56
|
startDate: Date;
|
|
@@ -65,7 +67,13 @@ export interface StartDateProps {
|
|
|
65
67
|
* // Default usage - displays "10:00 AM"
|
|
66
68
|
* <TimeSlot.StartDate className="text-foreground" />
|
|
67
69
|
*
|
|
68
|
-
* // With custom
|
|
70
|
+
* // With custom date format
|
|
71
|
+
* <TimeSlot.StartDate
|
|
72
|
+
* className="text-foreground"
|
|
73
|
+
* dateTimeFormatOptions={{ weekday: 'long', month: 'long', day: 'numeric' }}
|
|
74
|
+
* />
|
|
75
|
+
*
|
|
76
|
+
* // With custom formatting via asChild
|
|
69
77
|
* <TimeSlot.StartDate asChild>
|
|
70
78
|
* {({ startDate }) => (
|
|
71
79
|
* <span>{formatTime(startDate)}</span>
|
|
@@ -75,9 +83,10 @@ export interface StartDateProps {
|
|
|
75
83
|
*/
|
|
76
84
|
export declare const StartDate: React.ForwardRefExoticComponent<StartDateProps & React.RefAttributes<HTMLElement>>;
|
|
77
85
|
/**
|
|
78
|
-
* Props for TimeSlot.EndDate component
|
|
86
|
+
* Props for TimeSlot.EndDate component.
|
|
87
|
+
* Inherits formatting options from DateData (dateTimeFormatOptions, locale).
|
|
79
88
|
*/
|
|
80
|
-
export interface EndDateProps {
|
|
89
|
+
export interface EndDateProps extends Omit<DateData, 'date'> {
|
|
81
90
|
asChild?: boolean;
|
|
82
91
|
children?: AsChildChildren<{
|
|
83
92
|
endDate: Date;
|
|
@@ -94,7 +103,13 @@ export interface EndDateProps {
|
|
|
94
103
|
* // Default usage - displays "11:00 AM"
|
|
95
104
|
* <TimeSlot.EndDate className="text-foreground" />
|
|
96
105
|
*
|
|
97
|
-
* // With custom
|
|
106
|
+
* // With custom date format
|
|
107
|
+
* <TimeSlot.EndDate
|
|
108
|
+
* className="text-foreground"
|
|
109
|
+
* dateTimeFormatOptions={{ weekday: 'long', month: 'long', day: 'numeric' }}
|
|
110
|
+
* />
|
|
111
|
+
*
|
|
112
|
+
* // With custom formatting via asChild
|
|
98
113
|
* <TimeSlot.EndDate asChild>
|
|
99
114
|
* {({ endDate }) => (
|
|
100
115
|
* <span>{formatTime(endDate)}</span>
|
|
@@ -7,7 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
* the necessary context. There is no public TimeSlot.Root - context is managed internally.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { GenericList } from '@wix/headless-components/react';
|
|
10
|
+
import { GenericList, Date, } from '@wix/headless-components/react';
|
|
11
11
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
12
12
|
import * as CoreTimeSlot from '../core/time-slot-list/TimeSlot.js';
|
|
13
13
|
/**
|
|
@@ -56,7 +56,13 @@ export var TestIds;
|
|
|
56
56
|
* // Default usage - displays "10:00 AM"
|
|
57
57
|
* <TimeSlot.StartDate className="text-foreground" />
|
|
58
58
|
*
|
|
59
|
-
* // With custom
|
|
59
|
+
* // With custom date format
|
|
60
|
+
* <TimeSlot.StartDate
|
|
61
|
+
* className="text-foreground"
|
|
62
|
+
* dateTimeFormatOptions={{ weekday: 'long', month: 'long', day: 'numeric' }}
|
|
63
|
+
* />
|
|
64
|
+
*
|
|
65
|
+
* // With custom formatting via asChild
|
|
60
66
|
* <TimeSlot.StartDate asChild>
|
|
61
67
|
* {({ startDate }) => (
|
|
62
68
|
* <span>{formatTime(startDate)}</span>
|
|
@@ -65,11 +71,15 @@ export var TestIds;
|
|
|
65
71
|
* ```
|
|
66
72
|
*/
|
|
67
73
|
export const StartDate = React.forwardRef((props, ref) => {
|
|
68
|
-
const { asChild, children, className } = props;
|
|
69
|
-
return (_jsx(CoreTimeSlot.Info, { children: ({ startDate }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.timeSlotStartDate, customElement: children, customElementProps: { startDate }, children: _jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
const { asChild, children, className, dateTimeFormatOptions, locale } = props;
|
|
75
|
+
return (_jsx(CoreTimeSlot.Info, { children: ({ startDate }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.timeSlotStartDate, customElement: children, customElementProps: { startDate }, children: _jsx(Date, { date: {
|
|
76
|
+
date: startDate,
|
|
77
|
+
locale,
|
|
78
|
+
dateTimeFormatOptions: dateTimeFormatOptions ?? {
|
|
79
|
+
hour: '2-digit',
|
|
80
|
+
minute: '2-digit',
|
|
81
|
+
},
|
|
82
|
+
} }) })) }));
|
|
73
83
|
});
|
|
74
84
|
StartDate.displayName = 'TimeSlot.StartDate';
|
|
75
85
|
/**
|
|
@@ -82,7 +92,13 @@ StartDate.displayName = 'TimeSlot.StartDate';
|
|
|
82
92
|
* // Default usage - displays "11:00 AM"
|
|
83
93
|
* <TimeSlot.EndDate className="text-foreground" />
|
|
84
94
|
*
|
|
85
|
-
* // With custom
|
|
95
|
+
* // With custom date format
|
|
96
|
+
* <TimeSlot.EndDate
|
|
97
|
+
* className="text-foreground"
|
|
98
|
+
* dateTimeFormatOptions={{ weekday: 'long', month: 'long', day: 'numeric' }}
|
|
99
|
+
* />
|
|
100
|
+
*
|
|
101
|
+
* // With custom formatting via asChild
|
|
86
102
|
* <TimeSlot.EndDate asChild>
|
|
87
103
|
* {({ endDate }) => (
|
|
88
104
|
* <span>{formatTime(endDate)}</span>
|
|
@@ -91,11 +107,15 @@ StartDate.displayName = 'TimeSlot.StartDate';
|
|
|
91
107
|
* ```
|
|
92
108
|
*/
|
|
93
109
|
export const EndDate = React.forwardRef((props, ref) => {
|
|
94
|
-
const { asChild, children, className } = props;
|
|
95
|
-
return (_jsx(CoreTimeSlot.Info, { children: ({ endDate }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.timeSlotEndDate, customElement: children, customElementProps: { endDate }, children: _jsx(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
110
|
+
const { asChild, children, className, dateTimeFormatOptions, locale } = props;
|
|
111
|
+
return (_jsx(CoreTimeSlot.Info, { children: ({ endDate }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.timeSlotEndDate, customElement: children, customElementProps: { endDate }, children: _jsx(Date, { date: {
|
|
112
|
+
date: endDate,
|
|
113
|
+
locale,
|
|
114
|
+
dateTimeFormatOptions: dateTimeFormatOptions ?? {
|
|
115
|
+
hour: '2-digit',
|
|
116
|
+
minute: '2-digit',
|
|
117
|
+
},
|
|
118
|
+
} }) })) }));
|
|
99
119
|
});
|
|
100
120
|
EndDate.displayName = 'TimeSlot.EndDate';
|
|
101
121
|
/**
|
|
@@ -168,7 +188,7 @@ export const Select = React.forwardRef((props, ref) => {
|
|
|
168
188
|
disabled: !bookable,
|
|
169
189
|
isSelected,
|
|
170
190
|
bookable,
|
|
171
|
-
}, children: _jsx("button", { onClick: handleClick, disabled: !bookable, children: label }) }));
|
|
191
|
+
}, children: _jsx("button", { onClick: handleClick, disabled: !bookable, children: children || label }) }));
|
|
172
192
|
} }));
|
|
173
193
|
});
|
|
174
194
|
Select.displayName = 'TimeSlot.Actions.Select';
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { ListVariant } from '@wix/headless-components/react';
|
|
7
7
|
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
8
|
-
import type { TimeSlot as TimeSlotType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
9
8
|
import type { TimeSlotListServiceConfig } from '../../services/time-slot-list/time-slot-list.def.js';
|
|
10
9
|
export type { StartDateProps as TimeSlotStartDateProps, EndDateProps as TimeSlotEndDateProps, DurationProps as TimeSlotDurationProps, SelectProps as TimeSlotSelectProps, LocationNameProps as TimeSlotLocationNameProps, StaffMembersProps as TimeSlotStaffMembersProps, StaffMemberRepeaterProps as TimeSlotStaffMemberRepeaterProps, StaffMemberNameProps as TimeSlotStaffMemberNameProps, SelectStaffMemberProps as TimeSlotSelectStaffMemberProps, ClearStaffSelectionProps as TimeSlotClearStaffSelectionProps, } from './TimeSlot.js';
|
|
11
10
|
/**
|
|
@@ -120,32 +119,11 @@ export interface TimeSlotsProps {
|
|
|
120
119
|
* ```
|
|
121
120
|
*/
|
|
122
121
|
export declare const TimeSlots: React.ForwardRefExoticComponent<TimeSlotsProps & React.RefAttributes<HTMLElement>>;
|
|
123
|
-
/**
|
|
124
|
-
* Data provided to TimeSlotRepeater function children
|
|
125
|
-
*/
|
|
126
|
-
export interface TimeSlotRepeaterChildProps {
|
|
127
|
-
/** Whether the slot is currently selected */
|
|
128
|
-
isSelected: boolean;
|
|
129
|
-
/** Whether the slot can be booked */
|
|
130
|
-
bookable: boolean;
|
|
131
|
-
/** Start date/time as Date (constructed from the raw localStartDate string) */
|
|
132
|
-
startDate: Date;
|
|
133
|
-
/** End date/time as Date (constructed from the raw localEndDate string) */
|
|
134
|
-
endDate: Date;
|
|
135
|
-
/** Duration in minutes */
|
|
136
|
-
durationInMinutes: number;
|
|
137
|
-
/** The raw time slot data */
|
|
138
|
-
timeSlot: TimeSlotType;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Children type for TimeSlotRepeater - can be ReactNode or function
|
|
142
|
-
*/
|
|
143
|
-
type TimeSlotRepeaterChildren = React.ReactNode | ((props: TimeSlotRepeaterChildProps) => React.ReactNode);
|
|
144
122
|
/**
|
|
145
123
|
* Props for TimeSlotList.TimeSlotRepeater component
|
|
146
124
|
*/
|
|
147
125
|
export interface TimeSlotRepeaterProps {
|
|
148
|
-
children:
|
|
126
|
+
children: React.ReactNode;
|
|
149
127
|
}
|
|
150
128
|
export declare const TimeSlotRepeater: React.ForwardRefExoticComponent<TimeSlotRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
151
129
|
/**
|
|
@@ -193,36 +171,12 @@ export interface DateRangeInputProps {
|
|
|
193
171
|
startDate: Date;
|
|
194
172
|
endDate: Date;
|
|
195
173
|
onChange: (start: Date, end: Date) => void;
|
|
174
|
+
/** IANA timezone string for the time slots (e.g., "America/New_York") */
|
|
175
|
+
timezone: string | undefined;
|
|
196
176
|
}>;
|
|
197
177
|
/** CSS classes to apply to the container */
|
|
198
178
|
className?: string;
|
|
199
179
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Date range input for setting the start and end date filter.
|
|
202
|
-
* Uses the core DateRange component to access service data.
|
|
203
|
-
* Both dates are set together and trigger a single fetch.
|
|
204
|
-
*
|
|
205
|
-
* Default rendering provides two native date inputs.
|
|
206
|
-
*
|
|
207
|
-
* @component
|
|
208
|
-
* @example
|
|
209
|
-
* ```tsx
|
|
210
|
-
* // Default usage - renders two date inputs
|
|
211
|
-
* <TimeSlotList.DateRange.Input className="flex gap-2" />
|
|
212
|
-
*
|
|
213
|
-
* // With asChild for custom rendering
|
|
214
|
-
* <TimeSlotList.DateRange.Input asChild>
|
|
215
|
-
* {({ startDate, endDate, onChange }) => (
|
|
216
|
-
* <MyDateRangePicker
|
|
217
|
-
* start={startDate}
|
|
218
|
-
* end={endDate}
|
|
219
|
-
* onRangeChange={(start, end) => onChange(start, end)}
|
|
220
|
-
* />
|
|
221
|
-
* )}
|
|
222
|
-
* </TimeSlotList.DateRange.Input>
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
export declare const DateRangeInput: React.ForwardRefExoticComponent<DateRangeInputProps & React.RefAttributes<HTMLElement>>;
|
|
226
180
|
/**
|
|
227
181
|
* DateRange namespace for TimeSlotList date range filter
|
|
228
182
|
*/
|