@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
|
@@ -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';
|
|
@@ -19,13 +19,13 @@ 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
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Root component that provides payment context.
|
|
26
26
|
* Supports 3 modes:
|
|
27
27
|
* 1. SSR: paymentServiceConfig.paymentDetails - pre-fetched data
|
|
28
|
-
* 2. Lazy loading: pricingServiceSelections +
|
|
28
|
+
* 2. Lazy loading: pricingServiceSelections + totalParticipants props - calls API on init
|
|
29
29
|
* 3. Reactive: no config/props - reads from BookingService signals
|
|
30
30
|
*
|
|
31
31
|
* @component
|
|
@@ -37,7 +37,7 @@ export interface RootProps {
|
|
|
37
37
|
* </Payment.Root>
|
|
38
38
|
*
|
|
39
39
|
* // Lazy loading mode
|
|
40
|
-
* <Payment.Root pricingServiceSelections={[...]}
|
|
40
|
+
* <Payment.Root pricingServiceSelections={[...]} totalParticipants={2}>
|
|
41
41
|
* {({ isLoading }) => isLoading ? <div>Loading...</div> : <Payment.Total />}
|
|
42
42
|
* </Payment.Root>
|
|
43
43
|
*
|
|
@@ -26,7 +26,7 @@ function RootContent({ children, }) {
|
|
|
26
26
|
* Root component that provides payment context.
|
|
27
27
|
* Supports 3 modes:
|
|
28
28
|
* 1. SSR: paymentServiceConfig.paymentDetails - pre-fetched data
|
|
29
|
-
* 2. Lazy loading: pricingServiceSelections +
|
|
29
|
+
* 2. Lazy loading: pricingServiceSelections + totalParticipants props - calls API on init
|
|
30
30
|
* 3. Reactive: no config/props - reads from BookingService signals
|
|
31
31
|
*
|
|
32
32
|
* @component
|
|
@@ -38,7 +38,7 @@ function RootContent({ children, }) {
|
|
|
38
38
|
* </Payment.Root>
|
|
39
39
|
*
|
|
40
40
|
* // Lazy loading mode
|
|
41
|
-
* <Payment.Root pricingServiceSelections={[...]}
|
|
41
|
+
* <Payment.Root pricingServiceSelections={[...]} totalParticipants={2}>
|
|
42
42
|
* {({ isLoading }) => isLoading ? <div>Loading...</div> : <Payment.Total />}
|
|
43
43
|
* </Payment.Root>
|
|
44
44
|
*
|
|
@@ -49,12 +49,12 @@ function RootContent({ children, }) {
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
export function Root(props) {
|
|
52
|
-
const { children, paymentServiceConfig = {}, pricingServiceSelections,
|
|
52
|
+
const { children, paymentServiceConfig = {}, pricingServiceSelections, totalParticipants, } = props;
|
|
53
53
|
// Merge public config with lazy loading props into internal config
|
|
54
54
|
const internalConfig = {
|
|
55
55
|
...paymentServiceConfig,
|
|
56
56
|
pricingServiceSelections,
|
|
57
|
-
|
|
57
|
+
totalParticipants,
|
|
58
58
|
};
|
|
59
59
|
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(PaymentServiceDefinition, PaymentService, internalConfig), disposeOnUnmount: true, children: _jsx(RootContent, { children: children }) }));
|
|
60
60
|
}
|
|
@@ -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
|
|
@@ -109,10 +109,13 @@ export function ListData(props) {
|
|
|
109
109
|
*/
|
|
110
110
|
export function DateRange(props) {
|
|
111
111
|
const service = useService(TimeSlotListServiceDefinition);
|
|
112
|
+
const bookingService = useService(BookingServiceDefinition);
|
|
112
113
|
const dateRange = service.dateRange.get();
|
|
114
|
+
const timezone = bookingService.timezone.get();
|
|
113
115
|
return props.children({
|
|
114
116
|
startDate: dateRange.start,
|
|
115
117
|
endDate: dateRange.end,
|
|
116
118
|
setDateRange: service.actions.setDateRange,
|
|
119
|
+
timezone,
|
|
117
120
|
});
|
|
118
121
|
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as Booking from './booking/Booking.js';
|
|
2
|
+
export * as BookingItem from './booking/BookingItem.js';
|
|
2
3
|
export * as BookingForm from './booking-form/BookingForm.js';
|
|
3
4
|
export * as Service from './service/Service.js';
|
|
4
5
|
export * as ServiceMedia from './service/ServiceMedia.js';
|
package/dist/react/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as Booking from './booking/Booking.js';
|
|
2
|
+
export * as BookingItem from './booking/BookingItem.js';
|
|
2
3
|
export * as BookingForm from './booking-form/BookingForm.js';
|
|
3
4
|
export * as Service from './service/Service.js';
|
|
4
5
|
export * as ServiceMedia from './service/ServiceMedia.js';
|
|
@@ -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;
|