@wix/headless-bookings 0.0.89 → 0.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/cjs/dist/react/booking/Book.d.ts +11 -19
  2. package/cjs/dist/react/booking/Book.js +17 -13
  3. package/cjs/dist/react/booking/Booking.d.ts +1 -1
  4. package/cjs/dist/react/booking/Booking.js +1 -1
  5. package/cjs/dist/react/booking-form/BookingForm.d.ts +5 -2
  6. package/cjs/dist/react/booking-form/BookingForm.js +3 -2
  7. package/cjs/dist/react/location/Location.d.ts +3 -4
  8. package/cjs/dist/react/location/Location.js +6 -6
  9. package/cjs/dist/react/location/LocationList.d.ts +2 -4
  10. package/cjs/dist/react/location/LocationList.js +22 -15
  11. package/cjs/dist/react/service/Service.d.ts +18 -33
  12. package/cjs/dist/react/service/Service.js +20 -33
  13. package/cjs/dist/react/staff-member/StaffMember.d.ts +9 -4
  14. package/cjs/dist/react/staff-member/StaffMember.js +7 -7
  15. package/cjs/dist/react/staff-member/StaffMemberList.d.ts +9 -4
  16. package/cjs/dist/react/staff-member/StaffMemberList.js +23 -16
  17. package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +17 -21
  18. package/cjs/dist/react/time-slot-list/TimeSlot.js +18 -22
  19. package/cjs/dist/services/booking/book-action/types.d.ts +3 -3
  20. package/dist/react/booking/Book.d.ts +11 -19
  21. package/dist/react/booking/Book.js +17 -13
  22. package/dist/react/booking/Booking.d.ts +1 -1
  23. package/dist/react/booking/Booking.js +1 -1
  24. package/dist/react/booking-form/BookingForm.d.ts +5 -2
  25. package/dist/react/booking-form/BookingForm.js +3 -2
  26. package/dist/react/location/Location.d.ts +3 -4
  27. package/dist/react/location/Location.js +6 -6
  28. package/dist/react/location/LocationList.d.ts +2 -4
  29. package/dist/react/location/LocationList.js +22 -15
  30. package/dist/react/service/Service.d.ts +18 -33
  31. package/dist/react/service/Service.js +20 -33
  32. package/dist/react/staff-member/StaffMember.d.ts +9 -4
  33. package/dist/react/staff-member/StaffMember.js +7 -7
  34. package/dist/react/staff-member/StaffMemberList.d.ts +9 -4
  35. package/dist/react/staff-member/StaffMemberList.js +23 -16
  36. package/dist/react/time-slot-list/TimeSlot.d.ts +17 -21
  37. package/dist/react/time-slot-list/TimeSlot.js +18 -22
  38. package/dist/services/booking/book-action/types.d.ts +3 -3
  39. package/package.json +5 -5
@@ -7,28 +7,23 @@ import type { BookChildProps, BookingError } from '../../services/booking/book-a
7
7
  /**
8
8
  * Props for the high-level Book component
9
9
  */
10
- export interface BookProps {
10
+ export interface BookProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onError' | 'onClick'> {
11
11
  asChild?: boolean;
12
12
  children?: React.ReactNode | ((props: BookChildProps) => React.ReactNode);
13
- className?: string;
14
13
  label?: string;
15
14
  loadingState?: string;
16
15
  disabled?: boolean;
17
- /**
18
- * URL to redirect to after the checkout flow completes.
19
- * Required for navigating to checkout.
20
- */
21
- postFlowUrl: string;
22
16
  /**
23
17
  * Called when checkout is required for payment.
18
+ * Receives navigateToCheckout function that accepts postFlowUrl.
24
19
  * The navigateToCheckout function already has the checkoutId captured - just call it to navigate.
25
20
  *
26
21
  * To keep loading active during navigation, return navigateToCheckout():
27
- * `onCheckout={({ navigateToCheckout }) => navigateToCheckout()}`
22
+ * `onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}`
28
23
  */
29
- onCheckout?: (result: {
30
- navigateToCheckout: () => Promise<void>;
31
- }) => void | Promise<unknown>;
24
+ onCheckout?: (navigateToCheckout: (options: {
25
+ postFlowUrl: string;
26
+ }) => Promise<void>) => void | Promise<unknown>;
32
27
  /**
33
28
  * Called when booking completes without requiring checkout (free/offline services).
34
29
  * Receives the orderId which can be used to display confirmation or navigate to a thank you page.
@@ -39,6 +34,7 @@ export interface BookProps {
39
34
  orderId: string;
40
35
  }) => void | Promise<unknown>;
41
36
  onError?: (error: BookingError) => void;
37
+ onClick?: (data: BookChildProps) => void;
42
38
  }
43
39
  /**
44
40
  * Book action button component with AsChildSlot pattern.
@@ -53,22 +49,19 @@ export interface BookProps {
53
49
  * ```tsx
54
50
  * // Basic usage - call navigateToCheckout when ready
55
51
  * <Booking.Actions.Book
56
- * postFlowUrl="/thank-you"
57
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
52
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
58
53
  * />
59
54
  *
60
55
  * // With callbacks
61
56
  * <Booking.Actions.Book
62
- * postFlowUrl="/thank-you"
63
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
57
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
64
58
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
65
59
  * onError={(error) => console.error(error.message)}
66
60
  * />
67
61
  *
68
62
  * // With render function
69
63
  * <Booking.Actions.Book
70
- * postFlowUrl="/thank-you"
71
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
64
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
72
65
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
73
66
  * >
74
67
  * {({ isLoading, error, canBook, onClick, disabled }) => (
@@ -81,8 +74,7 @@ export interface BookProps {
81
74
  * // With asChild
82
75
  * <Booking.Actions.Book
83
76
  * asChild
84
- * postFlowUrl="/thank-you"
85
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
77
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
86
78
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
87
79
  * >
88
80
  * <CustomBookButton />
@@ -24,22 +24,19 @@ var TestIds;
24
24
  * ```tsx
25
25
  * // Basic usage - call navigateToCheckout when ready
26
26
  * <Booking.Actions.Book
27
- * postFlowUrl="/thank-you"
28
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
27
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
29
28
  * />
30
29
  *
31
30
  * // With callbacks
32
31
  * <Booking.Actions.Book
33
- * postFlowUrl="/thank-you"
34
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
32
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
35
33
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
36
34
  * onError={(error) => console.error(error.message)}
37
35
  * />
38
36
  *
39
37
  * // With render function
40
38
  * <Booking.Actions.Book
41
- * postFlowUrl="/thank-you"
42
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
39
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
43
40
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
44
41
  * >
45
42
  * {({ isLoading, error, canBook, onClick, disabled }) => (
@@ -52,8 +49,7 @@ var TestIds;
52
49
  * // With asChild
53
50
  * <Booking.Actions.Book
54
51
  * asChild
55
- * postFlowUrl="/thank-you"
56
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
52
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
57
53
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
58
54
  * >
59
55
  * <CustomBookButton />
@@ -61,17 +57,25 @@ var TestIds;
61
57
  * ```
62
58
  */
63
59
  export const Book = React.forwardRef((props, ref) => {
64
- const { asChild, children, className, label = 'Book Now', loadingState = 'Booking...', disabled, postFlowUrl, onCheckout, onComplete, onError, } = props;
60
+ const { asChild, children, className, label, loadingState, disabled, onCheckout, onComplete, onError, onClick, ...buttonProps } = props;
65
61
  return (_jsx(CoreBook.Book, { onCheckout: (result) => {
66
62
  // Create navigateToCheckout with checkoutId captured
67
- const navigateToCheckout = () => navigateToCheckoutUtil({
63
+ const navigateToCheckout = (options) => navigateToCheckoutUtil({
68
64
  checkoutId: result.checkoutId,
69
- navigationInfo: { postFlowUrl },
65
+ navigationInfo: { postFlowUrl: options.postFlowUrl },
70
66
  });
71
67
  // Return user's callback result so core can await it
72
- return onCheckout?.({ navigateToCheckout });
68
+ return onCheckout?.(navigateToCheckout);
73
69
  }, onComplete: (result) => {
74
70
  return onComplete?.({ orderId: result.orderId });
75
- }, onError: onError, disabled: disabled, children: (childProps) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.bookingActionBook, "data-in-progress": childProps.isLoading, customElement: children, customElementProps: childProps, children: _jsx("button", { onClick: childProps.onClick, disabled: childProps.disabled, children: childProps.isLoading ? loadingState : label }) })) }));
71
+ }, onError: onError, disabled: disabled, children: (childProps) => {
72
+ const handleClick = () => {
73
+ childProps.onClick();
74
+ onClick?.(childProps);
75
+ };
76
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.bookingActionBook, "data-in-progress": childProps.isLoading, customElement: children, customElementProps: childProps, children: _jsx("button", { ...buttonProps, onClick: handleClick, disabled: childProps.disabled, children: childProps.isLoading
77
+ ? loadingState
78
+ : children || label }) }));
79
+ } }));
76
80
  });
77
81
  Book.displayName = 'Booking.Actions.Book';
@@ -46,7 +46,7 @@ export declare const Root: {
46
46
  *
47
47
  * // With callbacks - navigateToCheckout has checkoutId captured, triggers loading when called
48
48
  * <Booking.Actions.Book
49
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
49
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
50
50
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
51
51
  * onError={(error) => toast.error(error.message)}
52
52
  * />
@@ -61,7 +61,7 @@ Root.displayName = 'Booking.Root';
61
61
  *
62
62
  * // With callbacks - navigateToCheckout has checkoutId captured, triggers loading when called
63
63
  * <Booking.Actions.Book
64
- * onCheckout={({ navigateToCheckout }) => navigateToCheckout()}
64
+ * onCheckout={(navigateToCheckout) => navigateToCheckout({ postFlowUrl: '/thank-you' })}
65
65
  * onComplete={({ orderId }) => navigate(`/thank-you?orderId=${orderId}`)}
66
66
  * onError={(error) => toast.error(error.message)}
67
67
  * />
@@ -105,20 +105,23 @@ export declare const Fields: React.ForwardRefExoticComponent<FieldsProps & React
105
105
  /**
106
106
  * Props for BookingForm.Actions.ValidateFormSubmission component
107
107
  */
108
- export interface ValidateFormSubmissionProps {
108
+ export interface ValidateFormSubmissionProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
109
109
  asChild?: boolean;
110
110
  children?: React.ReactNode | ((props: {
111
111
  onClick: () => Promise<void>;
112
112
  valid: boolean | null;
113
113
  validationFailures: string[];
114
114
  }) => React.ReactNode);
115
- className?: string;
116
115
  label?: string;
117
116
  /** Callback when validation completes */
118
117
  onValidationComplete?: (result: {
119
118
  valid: boolean;
120
119
  validationFailures: string[];
121
120
  }) => void;
121
+ onClick?: (result: {
122
+ valid: boolean;
123
+ validationFailures: string[];
124
+ }) => void;
122
125
  }
123
126
  /**
124
127
  * Button to validate the booking form submission.
@@ -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, className, label = 'Validate', onValidationComplete, } = props;
174
+ const { asChild, children, className, label, onValidationComplete, onClick, ...buttonProps } = props;
175
175
  const [valid, setValid] = React.useState(null);
176
176
  const [validationFailures, setValidationFailures] = React.useState([]);
177
177
  return (_jsx(CoreBookingForm.Actions, { children: ({ validateFormSubmission }) => {
@@ -182,12 +182,13 @@ export const ValidateFormSubmission = React.forwardRef((props, ref) => {
182
182
  if (onValidationComplete) {
183
183
  onValidationComplete(result);
184
184
  }
185
+ onClick?.(result);
185
186
  };
186
187
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.bookingFormActionValidateFormSubmission, "data-valid": valid, customElement: children, customElementProps: {
187
188
  onClick: handleClick,
188
189
  valid,
189
190
  validationFailures,
190
- }, children: _jsx("button", { onClick: handleClick, children: label }) }));
191
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, children: children || label }) }));
191
192
  } }));
192
193
  });
193
194
  ValidateFormSubmission.displayName =
@@ -229,18 +229,17 @@ export declare const Raw: React.FC<RawProps>;
229
229
  /**
230
230
  * Props for Location.Actions.Select component
231
231
  */
232
- export interface SelectProps {
232
+ export interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
233
233
  asChild?: boolean;
234
234
  children?: React.ReactNode | AsChildChildren<{
235
235
  onClick: () => void;
236
236
  selected: boolean;
237
237
  location: CoreLocation.Location | null;
238
238
  }>;
239
- /** Callback fired after location is selected - receives the location */
240
- onClicked?: (location: CoreLocation.Location) => void;
241
239
  /** Label for the button */
242
240
  label?: string;
243
- className?: string;
241
+ /** Called after selection with the selected location */
242
+ onClick?: (location: CoreLocation.Location) => void;
244
243
  }
245
244
  /**
246
245
  * Actions namespace for location-related actions
@@ -227,10 +227,10 @@ Raw.displayName = 'Location.Raw';
227
227
  * ```tsx
228
228
  * <Location.Actions.Select label="Choose Location" />
229
229
  *
230
- * // With onClicked callback for navigation
230
+ * // With onClick callback
231
231
  * <Location.Actions.Select
232
232
  * label="Select"
233
- * onClicked={(location) => navigate('/time-slots')}
233
+ * onClick={() => navigate('/time-slots')}
234
234
  * />
235
235
  *
236
236
  * // With asChild
@@ -244,19 +244,19 @@ Raw.displayName = 'Location.Raw';
244
244
  * ```
245
245
  */
246
246
  const Select = React.forwardRef((props, ref) => {
247
- const { asChild, children, onClicked, label = 'Select', className, ...attrs } = props;
247
+ const { asChild, children, onClick, label, className, ...buttonProps } = props;
248
248
  return (_jsx(CoreLocation.Actions, { children: ({ select, selected, rawLocation }) => {
249
249
  const handleClick = () => {
250
250
  select();
251
- if (onClicked && rawLocation) {
252
- onClicked(rawLocation);
251
+ if (rawLocation) {
252
+ onClick?.(rawLocation);
253
253
  }
254
254
  };
255
255
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.locationActionSelect, "data-selected": selected, customElement: children, customElementProps: {
256
256
  onClick: handleClick,
257
257
  selected,
258
258
  location: rawLocation,
259
- }, ...attrs, children: _jsx("button", { type: "button", onClick: handleClick, children: label }) }));
259
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, children: children || label }) }));
260
260
  } }));
261
261
  });
262
262
  Select.displayName = 'Location.Actions.Select';
@@ -103,15 +103,13 @@ export declare const Totals: React.ForwardRefExoticComponent<TotalsProps & React
103
103
  /**
104
104
  * Props for LocationList.Actions.Clear component
105
105
  */
106
- export interface ClearProps {
106
+ export interface ClearProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
107
107
  asChild?: boolean;
108
108
  children?: React.ReactNode | ((props: {
109
109
  onClick: () => void;
110
110
  }) => React.ReactNode);
111
- className?: string;
112
111
  label?: string;
113
- /** Callback fired when the clear button is clicked */
114
- onClicked?: () => void;
112
+ onClick?: (location: Location | null) => void;
115
113
  }
116
114
  /**
117
115
  * Actions namespace for location list-level actions
@@ -153,6 +153,11 @@ Totals.displayName = 'LocationList.Totals';
153
153
  * // With custom label
154
154
  * <LocationList.Actions.Clear label="Clear selection" />
155
155
  *
156
+ * // With children as button content
157
+ * <LocationList.Actions.Clear className="text-destructive">
158
+ * <span>Reset Location</span>
159
+ * </LocationList.Actions.Clear>
160
+ *
156
161
  * // With asChild
157
162
  * <LocationList.Actions.Clear asChild>
158
163
  * <button className="btn-secondary">Clear location</button>
@@ -165,21 +170,23 @@ Totals.displayName = 'LocationList.Totals';
165
170
  * ```
166
171
  */
167
172
  const Clear = React.forwardRef((props, ref) => {
168
- const { asChild, children, className, label = 'Clear', onClicked } = props;
169
- let bookingService = null;
170
- try {
171
- bookingService = useService(BookingServiceDefinition);
172
- }
173
- catch {
174
- // BookingService not available - likely no ServiceManagerProvider
175
- }
176
- const handleClick = () => {
177
- bookingService?.actions.clearLocation();
178
- onClicked?.();
179
- };
180
- return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.locationListActionClear, customElement: children, customElementProps: {
181
- onClick: handleClick,
182
- }, children: _jsx("button", { type: "button", onClick: handleClick, children: label }) }));
173
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
174
+ return (_jsx(CoreLocationList.Actions, { children: ({ selectedLocation }) => {
175
+ let bookingService = null;
176
+ try {
177
+ bookingService = useService(BookingServiceDefinition);
178
+ }
179
+ catch {
180
+ // BookingService not available - likely no ServiceManagerProvider
181
+ }
182
+ const handleClick = () => {
183
+ bookingService?.actions.clearLocation();
184
+ onClick?.(selectedLocation);
185
+ };
186
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.locationListActionClear, customElement: children, customElementProps: {
187
+ onClick: handleClick,
188
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, children: children || label }) }));
189
+ } }));
183
190
  });
184
191
  Clear.displayName = 'LocationList.Actions.Clear';
185
192
  /**
@@ -646,7 +646,7 @@ export declare namespace Actions {
646
646
  /**
647
647
  * Props for Select action component
648
648
  */
649
- interface SelectProps {
649
+ interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick'> {
650
650
  asChild?: boolean;
651
651
  children?: React.ReactNode | ((props: {
652
652
  bookable: boolean;
@@ -655,9 +655,9 @@ export declare namespace Actions {
655
655
  onClick: () => void;
656
656
  service: Service;
657
657
  }) => React.ReactNode);
658
- className?: string;
659
658
  label?: string;
660
- onClicked?: (service: Service) => void;
659
+ /** Called after selection with the selected service */
660
+ onClick?: (service: Service) => void;
661
661
  }
662
662
  /**
663
663
  * Select action component - replaces selection with only this service.
@@ -673,15 +673,10 @@ export declare namespace Actions {
673
673
  * <Button variant="primary">Select Service</Button>
674
674
  * </Service.Actions.Select>
675
675
  *
676
- * // With onClicked callback for navigation
676
+ * // With onClick callback for navigation
677
677
  * <Service.Actions.Select
678
- * asChild
679
- * onClicked={(service) => {
680
- * router.push(`/booking/time-slots/${service._id}`);
681
- * }}
682
- * >
683
- * <Button variant="primary">Select Service</Button>
684
- * </Service.Actions.Select>
678
+ * onClick={() => router.push('/booking/time-slots')}
679
+ * />
685
680
  *
686
681
  * // Using render prop pattern to access bookable state
687
682
  * <Service.Actions.Select>
@@ -697,7 +692,7 @@ export declare namespace Actions {
697
692
  /**
698
693
  * Props for Add action component
699
694
  */
700
- interface AddProps {
695
+ interface AddProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick'> {
701
696
  asChild?: boolean;
702
697
  children?: React.ReactNode | ((props: {
703
698
  bookable: boolean;
@@ -706,9 +701,9 @@ export declare namespace Actions {
706
701
  onClick: () => void;
707
702
  service: Service;
708
703
  }) => React.ReactNode);
709
- className?: string;
710
704
  label?: string;
711
- onClicked?: (service: Service) => void;
705
+ /** Called after adding with the added service */
706
+ onClick?: (service: Service) => void;
712
707
  }
713
708
  /**
714
709
  * Add action component - adds service to selection array.
@@ -724,15 +719,10 @@ export declare namespace Actions {
724
719
  * <Button variant="secondary">Add Service</Button>
725
720
  * </Service.Actions.Add>
726
721
  *
727
- * // With onClicked callback for custom behavior after adding
722
+ * // With onClick callback
728
723
  * <Service.Actions.Add
729
- * asChild
730
- * onClicked={(service) => {
731
- * console.log(`Added service: ${service.name}`);
732
- * }}
733
- * >
734
- * <Button variant="secondary">Add Service</Button>
735
- * </Service.Actions.Add>
724
+ * onClick={() => console.log('Service added')}
725
+ * />
736
726
  *
737
727
  * // Using render prop pattern to access bookable state
738
728
  * <Service.Actions.Add>
@@ -748,7 +738,7 @@ export declare namespace Actions {
748
738
  /**
749
739
  * Props for Remove action component
750
740
  */
751
- interface RemoveProps {
741
+ interface RemoveProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick'> {
752
742
  asChild?: boolean;
753
743
  children?: React.ReactNode | ((props: {
754
744
  bookable: boolean;
@@ -757,9 +747,9 @@ export declare namespace Actions {
757
747
  onClick: () => void;
758
748
  service: Service;
759
749
  }) => React.ReactNode);
760
- className?: string;
761
750
  label?: string;
762
- onClicked?: (service: Service) => void;
751
+ /** Called after removing with the removed service */
752
+ onClick?: (service: Service) => void;
763
753
  }
764
754
  /**
765
755
  * Remove action component - removes service from selection array.
@@ -775,15 +765,10 @@ export declare namespace Actions {
775
765
  * <Button variant="destructive">Remove Service</Button>
776
766
  * </Service.Actions.Remove>
777
767
  *
778
- * // With onClicked callback for custom behavior after removing
768
+ * // With onClick callback
779
769
  * <Service.Actions.Remove
780
- * asChild
781
- * onClicked={(service) => {
782
- * console.log(`Removed service: ${service.name}`);
783
- * }}
784
- * >
785
- * <Button variant="destructive">Remove Service</Button>
786
- * </Service.Actions.Remove>
770
+ * onClick={() => console.log('Service removed')}
771
+ * />
787
772
  *
788
773
  * // Using render prop pattern to access bookable state
789
774
  * <Service.Actions.Remove>
@@ -602,15 +602,10 @@ export var Actions;
602
602
  * <Button variant="primary">Select Service</Button>
603
603
  * </Service.Actions.Select>
604
604
  *
605
- * // With onClicked callback for navigation
605
+ * // With onClick callback for navigation
606
606
  * <Service.Actions.Select
607
- * asChild
608
- * onClicked={(service) => {
609
- * router.push(`/booking/time-slots/${service._id}`);
610
- * }}
611
- * >
612
- * <Button variant="primary">Select Service</Button>
613
- * </Service.Actions.Select>
607
+ * onClick={() => router.push('/booking/time-slots')}
608
+ * />
614
609
  *
615
610
  * // Using render prop pattern to access bookable state
616
611
  * <Service.Actions.Select>
@@ -623,11 +618,11 @@ export var Actions;
623
618
  * ```
624
619
  */
625
620
  Actions.Select = React.forwardRef((props, ref) => {
626
- const { asChild, children, className, label = 'Select Service', onClicked, } = props;
621
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
627
622
  return (_jsx(CoreService.Actions, { children: ({ select, rawService, bookable, selected, requiresAvailability, }) => {
628
623
  const handleClick = () => {
629
624
  select();
630
- onClicked?.(rawService);
625
+ onClick?.(rawService);
631
626
  };
632
627
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceActionSelect, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
633
628
  onClick: handleClick,
@@ -636,7 +631,7 @@ export var Actions;
636
631
  bookable,
637
632
  requiresAvailability,
638
633
  service: rawService,
639
- }, children: _jsx("button", { onClick: handleClick, disabled: !bookable, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: label }) }));
634
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, disabled: !bookable, "data-testid": TestIds.serviceActionSelect, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: children || label }) }));
640
635
  } }));
641
636
  });
642
637
  Actions.Select.displayName = 'Service.Actions.Select';
@@ -654,15 +649,10 @@ export var Actions;
654
649
  * <Button variant="secondary">Add Service</Button>
655
650
  * </Service.Actions.Add>
656
651
  *
657
- * // With onClicked callback for custom behavior after adding
652
+ * // With onClick callback
658
653
  * <Service.Actions.Add
659
- * asChild
660
- * onClicked={(service) => {
661
- * console.log(`Added service: ${service.name}`);
662
- * }}
663
- * >
664
- * <Button variant="secondary">Add Service</Button>
665
- * </Service.Actions.Add>
654
+ * onClick={() => console.log('Service added')}
655
+ * />
666
656
  *
667
657
  * // Using render prop pattern to access bookable state
668
658
  * <Service.Actions.Add>
@@ -675,13 +665,13 @@ export var Actions;
675
665
  * ```
676
666
  */
677
667
  Actions.Add = React.forwardRef((props, ref) => {
678
- const { asChild, children, className, label = 'Add Service', onClicked, } = props;
668
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
679
669
  return (_jsx(CoreService.Actions, { children: ({ add, rawService, bookable, selected, requiresAvailability }) => {
680
670
  // Disabled when already selected (can't add again) or not bookable
681
671
  const isDisabled = selected || !bookable;
682
672
  const handleClick = () => {
683
673
  add();
684
- onClicked?.(rawService);
674
+ onClick?.(rawService);
685
675
  };
686
676
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceActionAdd, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
687
677
  onClick: handleClick,
@@ -689,7 +679,8 @@ export var Actions;
689
679
  selected,
690
680
  bookable,
691
681
  requiresAvailability,
692
- }, children: _jsx("button", { onClick: handleClick, disabled: isDisabled, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: label }) }));
682
+ service: rawService,
683
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, disabled: isDisabled, "data-testid": TestIds.serviceActionAdd, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: children || label }) }));
693
684
  } }));
694
685
  });
695
686
  Actions.Add.displayName = 'Service.Actions.Add';
@@ -707,15 +698,10 @@ export var Actions;
707
698
  * <Button variant="destructive">Remove Service</Button>
708
699
  * </Service.Actions.Remove>
709
700
  *
710
- * // With onClicked callback for custom behavior after removing
701
+ * // With onClick callback
711
702
  * <Service.Actions.Remove
712
- * asChild
713
- * onClicked={(service) => {
714
- * console.log(`Removed service: ${service.name}`);
715
- * }}
716
- * >
717
- * <Button variant="destructive">Remove Service</Button>
718
- * </Service.Actions.Remove>
703
+ * onClick={() => console.log('Service removed')}
704
+ * />
719
705
  *
720
706
  * // Using render prop pattern to access bookable state
721
707
  * <Service.Actions.Remove>
@@ -728,13 +714,13 @@ export var Actions;
728
714
  * ```
729
715
  */
730
716
  Actions.Remove = React.forwardRef((props, ref) => {
731
- const { asChild, children, className, label = 'Remove Service', onClicked, } = props;
717
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
732
718
  return (_jsx(CoreService.Actions, { children: ({ remove, rawService, bookable, selected, requiresAvailability, }) => {
733
719
  // Disabled when not selected (nothing to remove) or not bookable
734
720
  const isDisabled = !selected || !bookable;
735
721
  const handleClick = () => {
736
722
  remove();
737
- onClicked?.(rawService);
723
+ onClick?.(rawService);
738
724
  };
739
725
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceActionRemove, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
740
726
  onClick: handleClick,
@@ -742,7 +728,8 @@ export var Actions;
742
728
  selected,
743
729
  bookable,
744
730
  requiresAvailability,
745
- }, children: _jsx("button", { onClick: handleClick, disabled: isDisabled, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: label }) }));
731
+ service: rawService,
732
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, disabled: isDisabled, "data-testid": TestIds.serviceActionRemove, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: children || label }) }));
746
733
  } }));
747
734
  });
748
735
  Actions.Remove.displayName = 'Service.Actions.Remove';
@@ -8,6 +8,12 @@ import React from 'react';
8
8
  import * as CoreStaffMember from '../core/staff-member/StaffMember.js';
9
9
  import { type AsChildChildren } from '@wix/headless-utils/react';
10
10
  export { useStaffMemberContext } from '../core/staff-member/StaffMember.js';
11
+ export declare enum TestIds {
12
+ staffMemberRoot = "staff-member-root",
13
+ staffMemberName = "staff-member-name",
14
+ staffMemberRaw = "staff-member-raw",
15
+ staffMemberActionSelect = "staff-member-action-select"
16
+ }
11
17
  export type { StaffMemberData, StaffMemberRenderProps, } from '../core/staff-member/StaffMember.js';
12
18
  /**
13
19
  * Props for StaffMember.Root component
@@ -98,18 +104,17 @@ export declare const Raw: React.FC<RawProps>;
98
104
  /**
99
105
  * Props for StaffMember.Actions.Select component
100
106
  */
101
- export interface SelectProps {
107
+ export interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
102
108
  asChild?: boolean;
103
109
  children?: React.ReactNode | AsChildChildren<{
104
110
  onClick: () => void;
105
111
  selected: boolean;
106
112
  staffMember: CoreStaffMember.StaffMemberData | null;
107
113
  }>;
108
- /** Callback fired after staff member is selected - receives the staff member */
109
- onClicked?: (staffMember: CoreStaffMember.StaffMemberData) => void;
110
114
  /** Label for the button */
111
115
  label?: string;
112
- className?: string;
116
+ /** Called after selection with the selected staffMember */
117
+ onClick?: (staffMember: CoreStaffMember.StaffMemberData) => void;
113
118
  }
114
119
  /**
115
120
  * Actions namespace for staff member-related actions