@wix/headless-bookings 0.0.104 → 0.0.105
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/BookingItem.d.ts +2 -0
- package/cjs/dist/react/booking/BookingItem.js +2 -2
- package/cjs/dist/react/core/booking/Booking.d.ts +3 -1
- package/cjs/dist/react/core/booking/Booking.js +3 -2
- package/dist/react/booking/BookingItem.d.ts +2 -0
- package/dist/react/booking/BookingItem.js +2 -2
- package/dist/react/core/booking/Booking.d.ts +3 -1
- package/dist/react/core/booking/Booking.js +3 -2
- package/package.json +2 -2
|
@@ -54,6 +54,8 @@ export interface StaffNameProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
|
54
54
|
children?: AsChildChildren<{
|
|
55
55
|
name: string;
|
|
56
56
|
}>;
|
|
57
|
+
/** Label to display when no specific staff member is assigned */
|
|
58
|
+
anyStaffLabel?: string;
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
59
61
|
* Displays the staff member's name from the current booking item.
|
|
@@ -60,8 +60,8 @@ TimeSlot.displayName = 'BookingItem.TimeSlot';
|
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
62
|
export const StaffName = React.forwardRef((props, ref) => {
|
|
63
|
-
const { asChild, children, ...rest } = props;
|
|
64
|
-
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ staffName }) => {
|
|
63
|
+
const { asChild, children, anyStaffLabel, ...rest } = props;
|
|
64
|
+
return (_jsx(CoreBooking.BookingItemInfo, { anyStaffLabel: anyStaffLabel, children: ({ staffName }) => {
|
|
65
65
|
if (!staffName)
|
|
66
66
|
return null;
|
|
67
67
|
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.bookingItemStaffName, customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) }));
|
|
@@ -98,12 +98,14 @@ export declare function BookingItemProvider(props: BookingItemProviderProps): Re
|
|
|
98
98
|
* Props for BookingItemInfo render prop component
|
|
99
99
|
*/
|
|
100
100
|
export interface BookingItemInfoProps {
|
|
101
|
+
/** Label to display when no specific staff member is assigned */
|
|
102
|
+
anyStaffLabel?: string;
|
|
101
103
|
children: (data: {
|
|
102
104
|
/** SDK Service object */
|
|
103
105
|
service: Service;
|
|
104
106
|
/** Adapted SDK TimeSlot (or null if no time slot selected) */
|
|
105
107
|
timeSlot: TimeSlot | null;
|
|
106
|
-
/** First staff member's name,
|
|
108
|
+
/** First staff member's name, or anyStaffLabel if none */
|
|
107
109
|
staffName: string;
|
|
108
110
|
/** Unique identifier for this booking instance */
|
|
109
111
|
instanceId: string;
|
|
@@ -159,9 +159,10 @@ export function BookingItemProvider(props) {
|
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
161
|
export function BookingItemInfo(props) {
|
|
162
|
+
const { anyStaffLabel = '', children } = props;
|
|
162
163
|
const item = useBookingItemContext();
|
|
163
|
-
const staffName = item.staff?.[0]?.name ||
|
|
164
|
-
return
|
|
164
|
+
const staffName = item.staff?.[0]?.name || anyStaffLabel;
|
|
165
|
+
return children({
|
|
165
166
|
service: item.service,
|
|
166
167
|
timeSlot: item.timeSlot,
|
|
167
168
|
staffName,
|
|
@@ -54,6 +54,8 @@ export interface StaffNameProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
|
54
54
|
children?: AsChildChildren<{
|
|
55
55
|
name: string;
|
|
56
56
|
}>;
|
|
57
|
+
/** Label to display when no specific staff member is assigned */
|
|
58
|
+
anyStaffLabel?: string;
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
59
61
|
* Displays the staff member's name from the current booking item.
|
|
@@ -60,8 +60,8 @@ TimeSlot.displayName = 'BookingItem.TimeSlot';
|
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
62
|
export const StaffName = React.forwardRef((props, ref) => {
|
|
63
|
-
const { asChild, children, ...rest } = props;
|
|
64
|
-
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ staffName }) => {
|
|
63
|
+
const { asChild, children, anyStaffLabel, ...rest } = props;
|
|
64
|
+
return (_jsx(CoreBooking.BookingItemInfo, { anyStaffLabel: anyStaffLabel, children: ({ staffName }) => {
|
|
65
65
|
if (!staffName)
|
|
66
66
|
return null;
|
|
67
67
|
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.bookingItemStaffName, customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) }));
|
|
@@ -98,12 +98,14 @@ export declare function BookingItemProvider(props: BookingItemProviderProps): Re
|
|
|
98
98
|
* Props for BookingItemInfo render prop component
|
|
99
99
|
*/
|
|
100
100
|
export interface BookingItemInfoProps {
|
|
101
|
+
/** Label to display when no specific staff member is assigned */
|
|
102
|
+
anyStaffLabel?: string;
|
|
101
103
|
children: (data: {
|
|
102
104
|
/** SDK Service object */
|
|
103
105
|
service: Service;
|
|
104
106
|
/** Adapted SDK TimeSlot (or null if no time slot selected) */
|
|
105
107
|
timeSlot: TimeSlot | null;
|
|
106
|
-
/** First staff member's name,
|
|
108
|
+
/** First staff member's name, or anyStaffLabel if none */
|
|
107
109
|
staffName: string;
|
|
108
110
|
/** Unique identifier for this booking instance */
|
|
109
111
|
instanceId: string;
|
|
@@ -159,9 +159,10 @@ export function BookingItemProvider(props) {
|
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
161
|
export function BookingItemInfo(props) {
|
|
162
|
+
const { anyStaffLabel = '', children } = props;
|
|
162
163
|
const item = useBookingItemContext();
|
|
163
|
-
const staffName = item.staff?.[0]?.name ||
|
|
164
|
-
return
|
|
164
|
+
const staffName = item.staff?.[0]?.name || anyStaffLabel;
|
|
165
|
+
return children({
|
|
165
166
|
service: item.service,
|
|
166
167
|
timeSlot: item.timeSlot,
|
|
167
168
|
staffName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"groupId": "com.wixpress.headless-components"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"falconPackageHash": "
|
|
75
|
+
"falconPackageHash": "54c7e2d376062948c7e9f262d02f40bb1d5738753368c392727d2679"
|
|
76
76
|
}
|