@wix/headless-bookings 0.0.91 → 0.0.93
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/Book.d.ts +1 -1
- package/cjs/dist/react/booking/Book.js +9 -6
- package/cjs/dist/react/booking/Booking.d.ts +2 -15
- package/cjs/dist/react/booking/Booking.js +2 -19
- package/cjs/dist/react/booking/BookingItem.d.ts +1 -2
- package/cjs/dist/react/booking/BookingItem.js +2 -2
- package/cjs/dist/react/booking-form/BookingForm.js +3 -3
- package/cjs/dist/react/location/Location.d.ts +2 -4
- package/cjs/dist/react/location/Location.js +14 -14
- package/cjs/dist/react/location/LocationList.d.ts +1 -2
- package/cjs/dist/react/location/LocationList.js +6 -5
- package/cjs/dist/react/payment/Payment.d.ts +8 -16
- package/cjs/dist/react/payment/Payment.js +14 -14
- package/cjs/dist/react/service/Service.d.ts +8 -16
- package/cjs/dist/react/service/Service.js +29 -29
- package/cjs/dist/react/staff-member/StaffMember.d.ts +1 -2
- package/cjs/dist/react/staff-member/StaffMember.js +5 -5
- package/cjs/dist/react/staff-member/StaffMemberList.d.ts +3 -3
- package/cjs/dist/react/staff-member/StaffMemberList.js +6 -5
- package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +4 -8
- package/cjs/dist/react/time-slot-list/TimeSlot.js +19 -19
- package/cjs/dist/react/time-slot-list/TimeSlotList.d.ts +1 -3
- package/cjs/dist/react/time-slot-list/TimeSlotList.js +9 -8
- package/dist/react/booking/Book.d.ts +1 -1
- package/dist/react/booking/Book.js +9 -6
- package/dist/react/booking/Booking.d.ts +2 -15
- package/dist/react/booking/Booking.js +2 -19
- package/dist/react/booking/BookingItem.d.ts +1 -2
- package/dist/react/booking/BookingItem.js +2 -2
- package/dist/react/booking-form/BookingForm.js +3 -3
- package/dist/react/location/Location.d.ts +2 -4
- package/dist/react/location/Location.js +14 -14
- package/dist/react/location/LocationList.d.ts +1 -2
- package/dist/react/location/LocationList.js +6 -5
- package/dist/react/payment/Payment.d.ts +8 -16
- package/dist/react/payment/Payment.js +14 -14
- package/dist/react/service/Service.d.ts +8 -16
- package/dist/react/service/Service.js +29 -29
- package/dist/react/staff-member/StaffMember.d.ts +1 -2
- package/dist/react/staff-member/StaffMember.js +5 -5
- package/dist/react/staff-member/StaffMemberList.d.ts +3 -3
- package/dist/react/staff-member/StaffMemberList.js +6 -5
- package/dist/react/time-slot-list/TimeSlot.d.ts +4 -8
- package/dist/react/time-slot-list/TimeSlot.js +19 -19
- package/dist/react/time-slot-list/TimeSlotList.d.ts +1 -3
- package/dist/react/time-slot-list/TimeSlotList.js +9 -8
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ export interface BookProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonEle
|
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
children?: React.ReactNode | ((props: BookChildProps) => React.ReactNode);
|
|
13
13
|
label?: string;
|
|
14
|
-
loadingState?:
|
|
14
|
+
loadingState?: React.ReactNode;
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Called when checkout is required for payment.
|
|
@@ -57,7 +57,7 @@ var TestIds;
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export const Book = React.forwardRef((props, ref) => {
|
|
60
|
-
const { asChild, children,
|
|
60
|
+
const { asChild, children, label, loadingState, disabled, onCheckout, onComplete, onError, onClick, ...rest } = props;
|
|
61
61
|
return (_jsx(CoreBook.Book, { onCheckout: (result) => {
|
|
62
62
|
// Create navigateToCheckout with checkoutId captured
|
|
63
63
|
const navigateToCheckout = (options) => navigateToCheckoutUtil({
|
|
@@ -68,12 +68,15 @@ export const Book = React.forwardRef((props, ref) => {
|
|
|
68
68
|
return onCheckout?.(navigateToCheckout);
|
|
69
69
|
}, onComplete: (result) => {
|
|
70
70
|
return onComplete?.({ orderId: result.orderId });
|
|
71
|
-
}, onError: onError, disabled: disabled, children: (
|
|
72
|
-
const handleClick = () => {
|
|
73
|
-
|
|
74
|
-
onClick?.(
|
|
71
|
+
}, onError: onError, disabled: disabled, children: (coreBookProps) => {
|
|
72
|
+
const handleClick = async () => {
|
|
73
|
+
await coreBookProps.onClick();
|
|
74
|
+
onClick?.(coreBookProps);
|
|
75
75
|
};
|
|
76
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
76
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, onClick: handleClick, disabled: coreBookProps.disabled, "data-testid": TestIds.bookingActionBook, "data-in-progress": coreBookProps.isLoading, "data-can-book": coreBookProps.canBook, customElement: children, customElementProps: {
|
|
77
|
+
...coreBookProps,
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
}, children: _jsx("button", { children: coreBookProps.isLoading
|
|
77
80
|
? loadingState
|
|
78
81
|
: children || label }) }));
|
|
79
82
|
} }));
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import * as CoreBooking from '../core/booking/Booking.js';
|
|
7
7
|
import type { BookingServiceConfig } from '../../services/booking/booking.js';
|
|
8
|
-
import * as BookingItemComponents from './BookingItem.js';
|
|
9
8
|
export type { BookingData, DataProps, BookingItem, } from '../core/booking/Booking.js';
|
|
10
9
|
/**
|
|
11
10
|
* Props for Booking.Root component
|
|
@@ -57,9 +56,9 @@ export declare const Actions: {
|
|
|
57
56
|
};
|
|
58
57
|
/**
|
|
59
58
|
* Hook to access the current BookingItem from context.
|
|
60
|
-
* Must be used within Booking.
|
|
59
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
61
60
|
*
|
|
62
|
-
* @throws Error if used outside of
|
|
61
|
+
* @throws Error if used outside of BookingItemRepeater context
|
|
63
62
|
*/
|
|
64
63
|
export declare const useBookingItem: typeof CoreBooking.useBookingItemContext;
|
|
65
64
|
/**
|
|
@@ -88,10 +87,6 @@ export interface BookingItemsProps {
|
|
|
88
87
|
* ```
|
|
89
88
|
*/
|
|
90
89
|
export declare const BookingItems: React.ForwardRefExoticComponent<BookingItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
-
/** @deprecated Use Booking.BookingItems instead */
|
|
92
|
-
export declare const ItemsRoot: React.ForwardRefExoticComponent<BookingItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
-
/** @deprecated Use Booking.BookingItems instead */
|
|
94
|
-
export declare const Items: React.ForwardRefExoticComponent<BookingItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
95
90
|
/**
|
|
96
91
|
* Props for Booking.BookingItemRepeater component
|
|
97
92
|
*/
|
|
@@ -121,12 +116,6 @@ export interface BookingItemRepeaterProps {
|
|
|
121
116
|
* ```
|
|
122
117
|
*/
|
|
123
118
|
export declare const BookingItemRepeater: React.ForwardRefExoticComponent<BookingItemRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
124
|
-
/** @deprecated Use Booking.BookingItemRepeater instead */
|
|
125
|
-
export declare const ItemRepeater: React.ForwardRefExoticComponent<BookingItemRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
126
|
-
/** @deprecated Use BookingItem.Service instead */
|
|
127
|
-
export declare const Service: typeof BookingItemComponents.Service;
|
|
128
|
-
/** @deprecated Use BookingItem.TimeSlot instead */
|
|
129
|
-
export declare const TimeSlot: typeof BookingItemComponents.TimeSlot;
|
|
130
119
|
/**
|
|
131
120
|
* Props for Booking.Payment component
|
|
132
121
|
*/
|
|
@@ -182,5 +171,3 @@ export interface BookingLocationProps {
|
|
|
182
171
|
* ```
|
|
183
172
|
*/
|
|
184
173
|
export declare function Location(props: BookingLocationProps): React.ReactNode;
|
|
185
|
-
/** @deprecated Use BookingItem.StaffName instead */
|
|
186
|
-
export declare const StaffName: React.ForwardRefExoticComponent<BookingItemComponents.StaffNameProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -9,8 +9,6 @@ import { Book } from './Book.js';
|
|
|
9
9
|
import * as PaymentComponent from '../payment/Payment.js';
|
|
10
10
|
import * as CoreLocation from '../core/location/Location.js';
|
|
11
11
|
import { GenericList } from '@wix/headless-components/react';
|
|
12
|
-
// Re-export BookingItem components for backward compatibility
|
|
13
|
-
import * as BookingItemComponents from './BookingItem.js';
|
|
14
12
|
// ============================================================================
|
|
15
13
|
// TestIds
|
|
16
14
|
// ============================================================================
|
|
@@ -75,9 +73,9 @@ export const Actions = {
|
|
|
75
73
|
// ============================================================================
|
|
76
74
|
/**
|
|
77
75
|
* Hook to access the current BookingItem from context.
|
|
78
|
-
* Must be used within Booking.
|
|
76
|
+
* Must be used within Booking.BookingItemRepeater.
|
|
79
77
|
*
|
|
80
|
-
* @throws Error if used outside of
|
|
78
|
+
* @throws Error if used outside of BookingItemRepeater context
|
|
81
79
|
*/
|
|
82
80
|
export const useBookingItem = CoreBooking.useBookingItemContext;
|
|
83
81
|
/**
|
|
@@ -104,10 +102,6 @@ export const BookingItems = React.forwardRef((props, ref) => {
|
|
|
104
102
|
})), hasMore: false, isLoading: false, "data-testid": TestIds.bookingItems, ...otherProps, children: _jsx(GenericList.Items, { emptyState: emptyState, children: children }) })) }));
|
|
105
103
|
});
|
|
106
104
|
BookingItems.displayName = 'Booking.BookingItems';
|
|
107
|
-
/** @deprecated Use Booking.BookingItems instead */
|
|
108
|
-
export const ItemsRoot = BookingItems;
|
|
109
|
-
/** @deprecated Use Booking.BookingItems instead */
|
|
110
|
-
export const Items = BookingItems;
|
|
111
105
|
/**
|
|
112
106
|
* Internal component that wraps each booking item with context provider.
|
|
113
107
|
*/
|
|
@@ -141,15 +135,6 @@ export const BookingItemRepeater = React.forwardRef((props, ref) => {
|
|
|
141
135
|
return (_jsx(GenericList.Repeater, { ref: ref, itemWrapper: ({ item }) => (_jsx(BookingItemWrapper, { item: item, children: children }, item.instanceId)), children: undefined }));
|
|
142
136
|
});
|
|
143
137
|
BookingItemRepeater.displayName = 'Booking.BookingItemRepeater';
|
|
144
|
-
/** @deprecated Use Booking.BookingItemRepeater instead */
|
|
145
|
-
export const ItemRepeater = BookingItemRepeater;
|
|
146
|
-
// ============================================================================
|
|
147
|
-
// Deprecated: Service, TimeSlot, StaffName (moved to BookingItem namespace)
|
|
148
|
-
// ============================================================================
|
|
149
|
-
/** @deprecated Use BookingItem.Service instead */
|
|
150
|
-
export const Service = BookingItemComponents.Service;
|
|
151
|
-
/** @deprecated Use BookingItem.TimeSlot instead */
|
|
152
|
-
export const TimeSlot = BookingItemComponents.TimeSlot;
|
|
153
138
|
/**
|
|
154
139
|
* Wraps Payment.Root with all services from all booking items.
|
|
155
140
|
* Should be used outside of ItemRepeater - it calculates payment for all items.
|
|
@@ -194,5 +179,3 @@ export function Location(props) {
|
|
|
194
179
|
const { children } = props;
|
|
195
180
|
return (_jsx(CoreBooking.Data, { children: ({ location }) => location ? (_jsx(CoreLocation.Root, { location: location, children: children })) : null }));
|
|
196
181
|
}
|
|
197
|
-
/** @deprecated Use BookingItem.StaffName instead */
|
|
198
|
-
export const StaffName = BookingItemComponents.StaffName;
|
|
@@ -44,12 +44,11 @@ export declare function TimeSlot(props: TimeSlotProps): React.ReactNode;
|
|
|
44
44
|
export declare namespace TimeSlot {
|
|
45
45
|
var displayName: string;
|
|
46
46
|
}
|
|
47
|
-
export interface StaffNameProps {
|
|
47
|
+
export interface StaffNameProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
48
48
|
asChild?: boolean;
|
|
49
49
|
children?: AsChildChildren<{
|
|
50
50
|
name: string;
|
|
51
51
|
}>;
|
|
52
|
-
className?: string;
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
54
|
* Displays the staff member's name from the current booking item.
|
|
@@ -61,11 +61,11 @@ TimeSlot.displayName = 'BookingItem.TimeSlot';
|
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
export const StaffName = React.forwardRef((props, ref) => {
|
|
64
|
-
const { asChild, children,
|
|
64
|
+
const { asChild, children, ...rest } = props;
|
|
65
65
|
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ staffName }) => {
|
|
66
66
|
if (!staffName)
|
|
67
67
|
return null;
|
|
68
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
68
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.bookingItemStaffName, customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) }));
|
|
69
69
|
} }));
|
|
70
70
|
});
|
|
71
71
|
StaffName.displayName = 'BookingItem.StaffName';
|
|
@@ -171,7 +171,7 @@ Fields.displayName = 'BookingForm.Fields';
|
|
|
171
171
|
* ```
|
|
172
172
|
*/
|
|
173
173
|
export const ValidateFormSubmission = React.forwardRef((props, ref) => {
|
|
174
|
-
const { asChild, children,
|
|
174
|
+
const { asChild, children, label, onValidationComplete, onClick, ...rest } = props;
|
|
175
175
|
const [valid, setValid] = React.useState(null);
|
|
176
176
|
const [validationFailures, setValidationFailures] = React.useState([]);
|
|
177
177
|
return (_jsx(CoreBookingForm.Actions, { children: ({ validateFormSubmission }) => {
|
|
@@ -184,11 +184,11 @@ export const ValidateFormSubmission = React.forwardRef((props, ref) => {
|
|
|
184
184
|
}
|
|
185
185
|
onClick?.(result);
|
|
186
186
|
};
|
|
187
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
187
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, onClick: handleClick, "data-testid": TestIds.bookingFormActionValidateFormSubmission, "data-valid": valid, customElement: children, customElementProps: {
|
|
188
188
|
onClick: handleClick,
|
|
189
189
|
valid,
|
|
190
190
|
validationFailures,
|
|
191
|
-
}, children: _jsx("button", {
|
|
191
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
192
192
|
} }));
|
|
193
193
|
});
|
|
194
194
|
ValidateFormSubmission.displayName =
|
|
@@ -58,12 +58,11 @@ export declare const Root: React.ForwardRefExoticComponent<RootProps & React.Ref
|
|
|
58
58
|
/**
|
|
59
59
|
* Props for Location.Name component
|
|
60
60
|
*/
|
|
61
|
-
export interface NameProps {
|
|
61
|
+
export interface NameProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
62
62
|
asChild?: boolean;
|
|
63
63
|
children?: React.ReactNode | AsChildChildren<{
|
|
64
64
|
name: string;
|
|
65
65
|
}>;
|
|
66
|
-
className?: string;
|
|
67
66
|
}
|
|
68
67
|
/**
|
|
69
68
|
* Displays the location name.
|
|
@@ -90,14 +89,13 @@ export declare const Name: React.ForwardRefExoticComponent<NameProps & React.Ref
|
|
|
90
89
|
/**
|
|
91
90
|
* Props for Location.Type component
|
|
92
91
|
*/
|
|
93
|
-
export interface TypeProps {
|
|
92
|
+
export interface TypeProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
94
93
|
asChild?: boolean;
|
|
95
94
|
children?: React.ReactNode | AsChildChildren<{
|
|
96
95
|
locationType: LocationType;
|
|
97
96
|
isCustomerLocation: boolean;
|
|
98
97
|
isCustomLocation: boolean;
|
|
99
98
|
}>;
|
|
100
|
-
className?: string;
|
|
101
99
|
}
|
|
102
100
|
/**
|
|
103
101
|
* Displays the location type.
|
|
@@ -93,9 +93,9 @@ Root.displayName = 'Location.Root';
|
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
95
|
export const Name = React.forwardRef((props, ref) => {
|
|
96
|
-
const { asChild, children,
|
|
96
|
+
const { asChild, children, ...rest } = props;
|
|
97
97
|
const { name } = useLocationContext();
|
|
98
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
98
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.locationName, customElement: children, customElementProps: { name: name ?? '' }, children: name ? _jsx("span", { children: name }) : null }));
|
|
99
99
|
});
|
|
100
100
|
Name.displayName = 'Location.Name';
|
|
101
101
|
/**
|
|
@@ -117,13 +117,13 @@ Name.displayName = 'Location.Name';
|
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
119
|
export const Type = React.forwardRef((props, ref) => {
|
|
120
|
-
const { asChild, children,
|
|
120
|
+
const { asChild, children, ...rest } = props;
|
|
121
121
|
const { locationType, isCustomerLocation, isCustomLocation } = useLocationContext();
|
|
122
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
122
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.locationType, customElement: children, customElementProps: {
|
|
123
123
|
locationType,
|
|
124
124
|
isCustomerLocation,
|
|
125
125
|
isCustomLocation,
|
|
126
|
-
},
|
|
126
|
+
}, children: locationType ? _jsx("span", { children: locationType }) : null }));
|
|
127
127
|
});
|
|
128
128
|
Type.displayName = 'Location.Type';
|
|
129
129
|
/**
|
|
@@ -150,9 +150,9 @@ Type.displayName = 'Location.Type';
|
|
|
150
150
|
* ```
|
|
151
151
|
*/
|
|
152
152
|
export const LocationAddress = React.forwardRef((props, ref) => {
|
|
153
|
-
const { asChild, children,
|
|
153
|
+
const { asChild, children, ...rest } = props;
|
|
154
154
|
const { address } = useLocationContext();
|
|
155
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
155
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.locationAddress, customElement: children, customElementProps: { address }, children: address ? (_jsx("span", { children: _jsx(Address.Root, { address: address, children: _jsx(Address.Formatted, {}) }) })) : null }));
|
|
156
156
|
});
|
|
157
157
|
LocationAddress.displayName = 'Location.Address';
|
|
158
158
|
// Export as Address (avoiding name collision with imported Address)
|
|
@@ -173,9 +173,9 @@ export { LocationAddress as Address };
|
|
|
173
173
|
* ```
|
|
174
174
|
*/
|
|
175
175
|
export const Phone = React.forwardRef((props, ref) => {
|
|
176
|
-
const { asChild, children,
|
|
176
|
+
const { asChild, children, ...rest } = props;
|
|
177
177
|
const { phone } = useLocationContext();
|
|
178
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
178
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.locationPhone, customElement: children, customElementProps: { phone }, children: phone ? _jsx("span", { children: phone }) : null }));
|
|
179
179
|
});
|
|
180
180
|
Phone.displayName = 'Location.Phone';
|
|
181
181
|
/**
|
|
@@ -194,9 +194,9 @@ Phone.displayName = 'Location.Phone';
|
|
|
194
194
|
* ```
|
|
195
195
|
*/
|
|
196
196
|
export const Email = React.forwardRef((props, ref) => {
|
|
197
|
-
const { asChild, children,
|
|
197
|
+
const { asChild, children, ...rest } = props;
|
|
198
198
|
const { email } = useLocationContext();
|
|
199
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
199
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.locationEmail, customElement: children, customElementProps: { email }, children: email ? _jsx("span", { children: email }) : null }));
|
|
200
200
|
});
|
|
201
201
|
Email.displayName = 'Location.Email';
|
|
202
202
|
/**
|
|
@@ -244,7 +244,7 @@ Raw.displayName = 'Location.Raw';
|
|
|
244
244
|
* ```
|
|
245
245
|
*/
|
|
246
246
|
const Select = React.forwardRef((props, ref) => {
|
|
247
|
-
const { asChild, children, onClick, label, className, ...
|
|
247
|
+
const { asChild, children, onClick, label, className, ...rest } = props;
|
|
248
248
|
return (_jsx(CoreLocation.Actions, { children: ({ select, selected, rawLocation }) => {
|
|
249
249
|
const handleClick = () => {
|
|
250
250
|
select();
|
|
@@ -252,11 +252,11 @@ const Select = React.forwardRef((props, ref) => {
|
|
|
252
252
|
onClick?.(rawLocation);
|
|
253
253
|
}
|
|
254
254
|
};
|
|
255
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.locationActionSelect, "data-selected": selected, customElement: children, customElementProps: {
|
|
255
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, "data-testid": TestIds.locationActionSelect, "data-selected": selected, customElement: children, customElementProps: {
|
|
256
256
|
onClick: handleClick,
|
|
257
257
|
selected,
|
|
258
258
|
location: rawLocation,
|
|
259
|
-
}, children: _jsx("button", {
|
|
259
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
260
260
|
} }));
|
|
261
261
|
});
|
|
262
262
|
Select.displayName = 'Location.Actions.Select';
|
|
@@ -77,13 +77,12 @@ export declare const LocationRepeater: React.ForwardRefExoticComponent<LocationR
|
|
|
77
77
|
/**
|
|
78
78
|
* Props for LocationList.Totals component
|
|
79
79
|
*/
|
|
80
|
-
export interface TotalsProps {
|
|
80
|
+
export interface TotalsProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
81
81
|
asChild?: boolean;
|
|
82
82
|
children?: React.ReactNode | AsChildChildren<{
|
|
83
83
|
count: number;
|
|
84
84
|
hasLocations: boolean;
|
|
85
85
|
}>;
|
|
86
|
-
className?: string;
|
|
87
86
|
}
|
|
88
87
|
/**
|
|
89
88
|
* Displays the total count of locations.
|
|
@@ -43,6 +43,7 @@ var TestIds;
|
|
|
43
43
|
TestIds["locationListLocations"] = "location-list-locations";
|
|
44
44
|
TestIds["locationListLocation"] = "location-list-location";
|
|
45
45
|
TestIds["locationListActionClear"] = "location-list-action-clear";
|
|
46
|
+
TestIds["locationListTotals"] = "location-list-totals";
|
|
46
47
|
})(TestIds || (TestIds = {}));
|
|
47
48
|
/**
|
|
48
49
|
* Root component that provides the LocationList service context for rendering locations lists.
|
|
@@ -133,10 +134,10 @@ LocationRepeater.displayName = 'LocationList.LocationRepeater';
|
|
|
133
134
|
* ```
|
|
134
135
|
*/
|
|
135
136
|
export const Totals = React.forwardRef((props, ref) => {
|
|
136
|
-
const { asChild, children,
|
|
137
|
+
const { asChild, children, ...rest } = props;
|
|
137
138
|
return (_jsx(CoreLocationList.Locations, { children: ({ displayLocations, hasLocations }) => {
|
|
138
139
|
const count = displayLocations.length;
|
|
139
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
140
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.locationListTotals, customElement: children, customElementProps: { count, hasLocations }, children: _jsx("span", { children: count }) }));
|
|
140
141
|
} }));
|
|
141
142
|
});
|
|
142
143
|
Totals.displayName = 'LocationList.Totals';
|
|
@@ -170,7 +171,7 @@ Totals.displayName = 'LocationList.Totals';
|
|
|
170
171
|
* ```
|
|
171
172
|
*/
|
|
172
173
|
const Clear = React.forwardRef((props, ref) => {
|
|
173
|
-
const { asChild, children, className, label, onClick, ...
|
|
174
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
174
175
|
return (_jsx(CoreLocationList.Actions, { children: ({ selectedLocation }) => {
|
|
175
176
|
let bookingService = null;
|
|
176
177
|
try {
|
|
@@ -183,9 +184,9 @@ const Clear = React.forwardRef((props, ref) => {
|
|
|
183
184
|
bookingService?.actions.clearLocation();
|
|
184
185
|
onClick?.(selectedLocation);
|
|
185
186
|
};
|
|
186
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.locationListActionClear, customElement: children, customElementProps: {
|
|
187
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, "data-testid": TestIds.locationListActionClear, customElement: children, customElementProps: {
|
|
187
188
|
onClick: handleClick,
|
|
188
|
-
}, children: _jsx("button", {
|
|
189
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
189
190
|
} }));
|
|
190
191
|
});
|
|
191
192
|
Clear.displayName = 'LocationList.Actions.Clear';
|
|
@@ -59,13 +59,12 @@ export declare const Root: React.ForwardRefExoticComponent<RootProps & React.Ref
|
|
|
59
59
|
/**
|
|
60
60
|
* Props for Payment.Subtotal component
|
|
61
61
|
*/
|
|
62
|
-
export interface SubtotalProps {
|
|
62
|
+
export interface SubtotalProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
63
63
|
asChild?: boolean;
|
|
64
64
|
children?: AsChildChildren<{
|
|
65
65
|
subtotal: MoneyData | null;
|
|
66
66
|
customPrice: string | null;
|
|
67
67
|
}>;
|
|
68
|
-
className?: string;
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* Displays the payment subtotal.
|
|
@@ -91,12 +90,11 @@ export declare const Subtotal: React.ForwardRefExoticComponent<SubtotalProps & R
|
|
|
91
90
|
/**
|
|
92
91
|
* Props for Payment.Tax component
|
|
93
92
|
*/
|
|
94
|
-
export interface TaxProps {
|
|
93
|
+
export interface TaxProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
95
94
|
asChild?: boolean;
|
|
96
95
|
children?: AsChildChildren<{
|
|
97
96
|
tax: MoneyData | null;
|
|
98
97
|
}>;
|
|
99
|
-
className?: string;
|
|
100
98
|
}
|
|
101
99
|
/**
|
|
102
100
|
* Displays the payment tax.
|
|
@@ -112,13 +110,12 @@ export declare const Tax: React.ForwardRefExoticComponent<TaxProps & React.RefAt
|
|
|
112
110
|
/**
|
|
113
111
|
* Props for Payment.Total component
|
|
114
112
|
*/
|
|
115
|
-
export interface TotalProps {
|
|
113
|
+
export interface TotalProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
116
114
|
asChild?: boolean;
|
|
117
115
|
children?: AsChildChildren<{
|
|
118
116
|
total: MoneyData | null;
|
|
119
117
|
customPrice: string | null;
|
|
120
118
|
}>;
|
|
121
|
-
className?: string;
|
|
122
119
|
}
|
|
123
120
|
/**
|
|
124
121
|
* Displays the payment total.
|
|
@@ -144,13 +141,12 @@ export declare const Total: React.ForwardRefExoticComponent<TotalProps & React.R
|
|
|
144
141
|
/**
|
|
145
142
|
* Props for Payment.PayNow component
|
|
146
143
|
*/
|
|
147
|
-
export interface PayNowProps {
|
|
144
|
+
export interface PayNowProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
148
145
|
asChild?: boolean;
|
|
149
146
|
children?: AsChildChildren<{
|
|
150
147
|
payNow: MoneyData | null;
|
|
151
148
|
isDeposit: boolean;
|
|
152
149
|
}>;
|
|
153
|
-
className?: string;
|
|
154
150
|
}
|
|
155
151
|
/**
|
|
156
152
|
* Displays the pay now amount (amount to pay upfront in deposit scenarios).
|
|
@@ -166,13 +162,12 @@ export declare const PayNow: React.ForwardRefExoticComponent<PayNowProps & React
|
|
|
166
162
|
/**
|
|
167
163
|
* Props for Payment.PayLater component
|
|
168
164
|
*/
|
|
169
|
-
export interface PayLaterProps {
|
|
165
|
+
export interface PayLaterProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
170
166
|
asChild?: boolean;
|
|
171
167
|
children?: AsChildChildren<{
|
|
172
168
|
payLater: MoneyData | null;
|
|
173
169
|
isDeposit: boolean;
|
|
174
170
|
}>;
|
|
175
|
-
className?: string;
|
|
176
171
|
}
|
|
177
172
|
/**
|
|
178
173
|
* Displays the pay later amount (for deposit scenarios).
|
|
@@ -266,13 +261,12 @@ export declare const LineItemRepeater: React.ForwardRefExoticComponent<LineItemR
|
|
|
266
261
|
/**
|
|
267
262
|
* Props for Payment.LineItemTotal component
|
|
268
263
|
*/
|
|
269
|
-
export interface LineItemTotalProps {
|
|
264
|
+
export interface LineItemTotalProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
270
265
|
asChild?: boolean;
|
|
271
266
|
children?: AsChildChildren<{
|
|
272
267
|
totalPrice: MoneyData | null;
|
|
273
268
|
customPrice: string | null;
|
|
274
269
|
}>;
|
|
275
|
-
className?: string;
|
|
276
270
|
}
|
|
277
271
|
/**
|
|
278
272
|
* Displays the line item total (total price after tax).
|
|
@@ -288,13 +282,12 @@ export declare const LineItemTotal: React.ForwardRefExoticComponent<LineItemTota
|
|
|
288
282
|
/**
|
|
289
283
|
* Props for Payment.LineItemSubtotal component
|
|
290
284
|
*/
|
|
291
|
-
export interface LineItemSubtotalProps {
|
|
285
|
+
export interface LineItemSubtotalProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
292
286
|
asChild?: boolean;
|
|
293
287
|
children?: AsChildChildren<{
|
|
294
288
|
subtotal: MoneyData | null;
|
|
295
289
|
customPrice: string | null;
|
|
296
290
|
}>;
|
|
297
|
-
className?: string;
|
|
298
291
|
}
|
|
299
292
|
/**
|
|
300
293
|
* Displays the line item subtotal (full price before discounts).
|
|
@@ -310,12 +303,11 @@ export declare const LineItemSubtotal: React.ForwardRefExoticComponent<LineItemS
|
|
|
310
303
|
/**
|
|
311
304
|
* Props for Payment.LineItemDeposit component
|
|
312
305
|
*/
|
|
313
|
-
export interface LineItemDepositProps {
|
|
306
|
+
export interface LineItemDepositProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
314
307
|
asChild?: boolean;
|
|
315
308
|
children?: AsChildChildren<{
|
|
316
309
|
deposit: MoneyData | null;
|
|
317
310
|
}>;
|
|
318
|
-
className?: string;
|
|
319
311
|
}
|
|
320
312
|
/**
|
|
321
313
|
* Displays the line item deposit amount.
|
|
@@ -83,10 +83,10 @@ Root.displayName = 'Payment.Root';
|
|
|
83
83
|
*/
|
|
84
84
|
export const Subtotal = React.forwardRef((props, ref) => {
|
|
85
85
|
const { asChild, children, className } = props;
|
|
86
|
-
return (_jsx(CorePayment.Data, { children: ({ subtotal, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className,
|
|
86
|
+
return (_jsx(CorePayment.Data, { children: ({ subtotal, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, customElementProps: {
|
|
87
87
|
subtotal,
|
|
88
88
|
customPrice,
|
|
89
|
-
}, children: subtotal && _jsx(Money, { money: subtotal }) })) }));
|
|
89
|
+
}, "data-testid": TestIds.paymentSubtotal, "data-has-custom-price": !!customPrice, children: subtotal && _jsx(Money, { money: subtotal }) })) }));
|
|
90
90
|
});
|
|
91
91
|
Subtotal.displayName = 'Payment.Subtotal';
|
|
92
92
|
/**
|
|
@@ -101,7 +101,7 @@ Subtotal.displayName = 'Payment.Subtotal';
|
|
|
101
101
|
*/
|
|
102
102
|
export const Tax = React.forwardRef((props, ref) => {
|
|
103
103
|
const { asChild, children, className } = props;
|
|
104
|
-
return (_jsx(CorePayment.Data, { children: ({ tax, hasTax }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentTax, "data-has-tax": hasTax,
|
|
104
|
+
return (_jsx(CorePayment.Data, { children: ({ tax, hasTax }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, customElementProps: { tax }, "data-testid": TestIds.paymentTax, "data-has-tax": hasTax, children: hasTax && _jsx(Money, { money: tax }) })) }));
|
|
105
105
|
});
|
|
106
106
|
Tax.displayName = 'Payment.Tax';
|
|
107
107
|
/**
|
|
@@ -126,10 +126,10 @@ Tax.displayName = 'Payment.Tax';
|
|
|
126
126
|
*/
|
|
127
127
|
export const Total = React.forwardRef((props, ref) => {
|
|
128
128
|
const { asChild, children, className } = props;
|
|
129
|
-
return (_jsx(CorePayment.Data, { children: ({ total, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className,
|
|
129
|
+
return (_jsx(CorePayment.Data, { children: ({ total, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, customElementProps: {
|
|
130
130
|
total,
|
|
131
131
|
customPrice,
|
|
132
|
-
}, children: total && _jsx(Money, { money: total }) })) }));
|
|
132
|
+
}, "data-testid": TestIds.paymentTotal, "data-has-custom-price": !!customPrice, children: total && _jsx(Money, { money: total }) })) }));
|
|
133
133
|
});
|
|
134
134
|
Total.displayName = 'Payment.Total';
|
|
135
135
|
/**
|
|
@@ -144,7 +144,7 @@ Total.displayName = 'Payment.Total';
|
|
|
144
144
|
*/
|
|
145
145
|
export const PayNow = React.forwardRef((props, ref) => {
|
|
146
146
|
const { asChild, children, className } = props;
|
|
147
|
-
return (_jsx(CorePayment.Data, { children: ({ payNow, isDeposit }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentPayNow, "data-has-deposit": isDeposit,
|
|
147
|
+
return (_jsx(CorePayment.Data, { children: ({ payNow, isDeposit }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, customElementProps: { payNow, isDeposit }, "data-testid": TestIds.paymentPayNow, "data-has-deposit": isDeposit, children: isDeposit && payNow && payNow.amount > 0 && (_jsx(Money, { money: payNow })) })) }));
|
|
148
148
|
});
|
|
149
149
|
PayNow.displayName = 'Payment.PayNow';
|
|
150
150
|
/**
|
|
@@ -159,7 +159,7 @@ PayNow.displayName = 'Payment.PayNow';
|
|
|
159
159
|
*/
|
|
160
160
|
export const PayLater = React.forwardRef((props, ref) => {
|
|
161
161
|
const { asChild, children, className } = props;
|
|
162
|
-
return (_jsx(CorePayment.Data, { children: ({ payLater, isDeposit }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentPayLater, "data-has-deposit": isDeposit,
|
|
162
|
+
return (_jsx(CorePayment.Data, { children: ({ payLater, isDeposit }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, customElementProps: { payLater, isDeposit }, "data-testid": TestIds.paymentPayLater, "data-has-deposit": isDeposit, children: isDeposit && payLater && payLater.amount > 0 && (_jsx(Money, { money: payLater })) })) }));
|
|
163
163
|
});
|
|
164
164
|
PayLater.displayName = 'Payment.PayLater';
|
|
165
165
|
/**
|
|
@@ -184,8 +184,8 @@ PayLater.displayName = 'Payment.PayLater';
|
|
|
184
184
|
* ```
|
|
185
185
|
*/
|
|
186
186
|
export const LineItems = React.forwardRef((props, ref) => {
|
|
187
|
-
const { asChild, children, className, ...
|
|
188
|
-
return (_jsx(CorePayment.LineItems, { children: ({ lineItems, currency, isLoading, error }) => (_jsx(GenericList.Root, { items: lineItems, isLoading: isLoading, error: error, children: _jsx(LineItemsContext.Provider, { value: { currency }, children: _jsx(AsChildSlot, { ...
|
|
187
|
+
const { asChild, children, className, ...rest } = props;
|
|
188
|
+
return (_jsx(CorePayment.LineItems, { children: ({ lineItems, currency, isLoading, error }) => (_jsx(GenericList.Root, { items: lineItems, isLoading: isLoading, error: error, children: _jsx(LineItemsContext.Provider, { value: { currency }, children: _jsx(AsChildSlot, { ...rest, ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItems, "data-loading": isLoading, "data-error": !!error, customElement: children, customElementProps: { lineItems, currency, isLoading, error }, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }) })) }));
|
|
189
189
|
});
|
|
190
190
|
LineItems.displayName = 'Payment.LineItems';
|
|
191
191
|
// Context for line items currency
|
|
@@ -252,8 +252,8 @@ LineItemRepeater.displayName = 'Payment.LineItemRepeater';
|
|
|
252
252
|
* ```
|
|
253
253
|
*/
|
|
254
254
|
export const LineItemTotal = React.forwardRef((props, ref) => {
|
|
255
|
-
const { asChild, children,
|
|
256
|
-
return (_jsx(CorePayment.LineItemInfo, { children: ({ totalPrice, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
255
|
+
const { asChild, children, ...rest } = props;
|
|
256
|
+
return (_jsx(CorePayment.LineItemInfo, { children: ({ totalPrice, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.paymentLineItemTotal, "data-has-custom-price": !!customPrice, customElement: children, customElementProps: { totalPrice, customPrice }, children: customPrice ? (_jsx("span", { children: customPrice })) : (totalPrice && _jsx(Money, { money: totalPrice })) })) }));
|
|
257
257
|
});
|
|
258
258
|
LineItemTotal.displayName = 'Payment.LineItemTotal';
|
|
259
259
|
/**
|
|
@@ -267,8 +267,8 @@ LineItemTotal.displayName = 'Payment.LineItemTotal';
|
|
|
267
267
|
* ```
|
|
268
268
|
*/
|
|
269
269
|
export const LineItemSubtotal = React.forwardRef((props, ref) => {
|
|
270
|
-
const { asChild, children,
|
|
271
|
-
return (_jsx(CorePayment.LineItemInfo, { children: ({ subtotal, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
270
|
+
const { asChild, children, ...rest } = props;
|
|
271
|
+
return (_jsx(CorePayment.LineItemInfo, { children: ({ subtotal, customPrice }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "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 })) })) }));
|
|
272
272
|
});
|
|
273
273
|
LineItemSubtotal.displayName = 'Payment.LineItemSubtotal';
|
|
274
274
|
/**
|
|
@@ -283,6 +283,6 @@ LineItemSubtotal.displayName = 'Payment.LineItemSubtotal';
|
|
|
283
283
|
*/
|
|
284
284
|
export const LineItemDeposit = React.forwardRef((props, ref) => {
|
|
285
285
|
const { asChild, children, className } = props;
|
|
286
|
-
return (_jsx(CorePayment.LineItemInfo, { children: ({ deposit, hasDeposit }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItemDeposit, "data-has-deposit": hasDeposit,
|
|
286
|
+
return (_jsx(CorePayment.LineItemInfo, { children: ({ deposit, hasDeposit }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, customElementProps: { deposit }, "data-testid": TestIds.paymentLineItemDeposit, "data-has-deposit": hasDeposit, children: hasDeposit && _jsx(Money, { money: deposit }) })) }));
|
|
287
287
|
});
|
|
288
288
|
LineItemDeposit.displayName = 'Payment.LineItemDeposit';
|