@wix/headless-bookings 0.0.68 → 0.0.70

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.
@@ -104,7 +104,7 @@ export interface ListDataRenderProps {
104
104
  isLoading: boolean;
105
105
  error: string | null;
106
106
  loadMore: () => Promise<void>;
107
- isSelectionComplete: boolean;
107
+ hasSelectedTimeSlot: boolean;
108
108
  }
109
109
  /**
110
110
  * Props for ListData render prop component
@@ -120,7 +120,7 @@ export interface ListDataProps {
120
120
  * @example
121
121
  * ```tsx
122
122
  * <ListData>
123
- * {({ timeSlots, hasMore, isLoading, loadMore, isSelectionComplete }) => (
123
+ * {({ timeSlots, hasMore, isLoading, loadMore, hasSelectedTimeSlot }) => (
124
124
  * <GenericList.Root items={timeSlots} hasMore={hasMore} isLoading={isLoading} loadMore={loadMore}>
125
125
  * {children}
126
126
  * </GenericList.Root>
@@ -129,7 +129,7 @@ export function Timezone(props) {
129
129
  * @example
130
130
  * ```tsx
131
131
  * <ListData>
132
- * {({ timeSlots, hasMore, isLoading, loadMore, isSelectionComplete }) => (
132
+ * {({ timeSlots, hasMore, isLoading, loadMore, hasSelectedTimeSlot }) => (
133
133
  * <GenericList.Root items={timeSlots} hasMore={hasMore} isLoading={isLoading} loadMore={loadMore}>
134
134
  * {children}
135
135
  * </GenericList.Root>
@@ -141,16 +141,13 @@ export function ListData(props) {
141
141
  const service = useService(TimeSlotListServiceDefinition);
142
142
  const bookingService = useService(BookingServiceDefinition);
143
143
  const selectedTimeSlot = bookingService.serviceSelections.get()[0]?.timeSlot;
144
- const hasTimeSlot = !!selectedTimeSlot;
145
- const hasSelectedStaffMember = (selectedTimeSlot?.resources?.length ?? 0) === 1;
146
- const isSelectionComplete = hasTimeSlot && hasSelectedStaffMember;
147
144
  return props.children({
148
145
  timeSlots: service.timeSlots.get(),
149
146
  hasMore: service.hasMore.get(),
150
147
  isLoading: service.isLoading.get(),
151
148
  error: service.error.get(),
152
149
  loadMore: service.actions.loadMore,
153
- isSelectionComplete,
150
+ hasSelectedTimeSlot: !!selectedTimeSlot,
154
151
  });
155
152
  }
156
153
  /**
@@ -105,10 +105,10 @@ Root.displayName = 'TimeSlotList.Root';
105
105
  */
106
106
  const RootContent = React.forwardRef((props, ref) => {
107
107
  const { children, className, variant } = props;
108
- return (_jsx(CoreTimeSlotList.ListData, { children: ({ timeSlots, hasMore, isLoading, error, loadMore, isSelectionComplete, }) => (_jsx(GenericList.Root, { items: timeSlots.map((slot) => ({
108
+ return (_jsx(CoreTimeSlotList.ListData, { children: ({ timeSlots, hasMore, isLoading, error, loadMore, hasSelectedTimeSlot, }) => (_jsx(GenericList.Root, { items: timeSlots.map((slot) => ({
109
109
  ...slot,
110
110
  id: generateSlotKey(slot),
111
- })), loadMore: loadMore, hasMore: hasMore, isLoading: isLoading, error: error, className: className, ref: ref, "data-testid": TestIds.timeSlotListRoot, "data-selection-complete": isSelectionComplete, variant: variant, children: children })) }));
111
+ })), loadMore: loadMore, hasMore: hasMore, isLoading: isLoading, error: error, className: className, ref: ref, "data-testid": TestIds.timeSlotListRoot, "data-has-selected-time-slot": hasSelectedTimeSlot, variant: variant, children: children })) }));
112
112
  });
113
113
  RootContent.displayName = 'TimeSlotList.RootContent';
114
114
  /**
@@ -104,7 +104,7 @@ export interface ListDataRenderProps {
104
104
  isLoading: boolean;
105
105
  error: string | null;
106
106
  loadMore: () => Promise<void>;
107
- isSelectionComplete: boolean;
107
+ hasSelectedTimeSlot: boolean;
108
108
  }
109
109
  /**
110
110
  * Props for ListData render prop component
@@ -120,7 +120,7 @@ export interface ListDataProps {
120
120
  * @example
121
121
  * ```tsx
122
122
  * <ListData>
123
- * {({ timeSlots, hasMore, isLoading, loadMore, isSelectionComplete }) => (
123
+ * {({ timeSlots, hasMore, isLoading, loadMore, hasSelectedTimeSlot }) => (
124
124
  * <GenericList.Root items={timeSlots} hasMore={hasMore} isLoading={isLoading} loadMore={loadMore}>
125
125
  * {children}
126
126
  * </GenericList.Root>
@@ -129,7 +129,7 @@ export function Timezone(props) {
129
129
  * @example
130
130
  * ```tsx
131
131
  * <ListData>
132
- * {({ timeSlots, hasMore, isLoading, loadMore, isSelectionComplete }) => (
132
+ * {({ timeSlots, hasMore, isLoading, loadMore, hasSelectedTimeSlot }) => (
133
133
  * <GenericList.Root items={timeSlots} hasMore={hasMore} isLoading={isLoading} loadMore={loadMore}>
134
134
  * {children}
135
135
  * </GenericList.Root>
@@ -141,16 +141,13 @@ export function ListData(props) {
141
141
  const service = useService(TimeSlotListServiceDefinition);
142
142
  const bookingService = useService(BookingServiceDefinition);
143
143
  const selectedTimeSlot = bookingService.serviceSelections.get()[0]?.timeSlot;
144
- const hasTimeSlot = !!selectedTimeSlot;
145
- const hasSelectedStaffMember = (selectedTimeSlot?.resources?.length ?? 0) === 1;
146
- const isSelectionComplete = hasTimeSlot && hasSelectedStaffMember;
147
144
  return props.children({
148
145
  timeSlots: service.timeSlots.get(),
149
146
  hasMore: service.hasMore.get(),
150
147
  isLoading: service.isLoading.get(),
151
148
  error: service.error.get(),
152
149
  loadMore: service.actions.loadMore,
153
- isSelectionComplete,
150
+ hasSelectedTimeSlot: !!selectedTimeSlot,
154
151
  });
155
152
  }
156
153
  /**
@@ -105,10 +105,10 @@ Root.displayName = 'TimeSlotList.Root';
105
105
  */
106
106
  const RootContent = React.forwardRef((props, ref) => {
107
107
  const { children, className, variant } = props;
108
- return (_jsx(CoreTimeSlotList.ListData, { children: ({ timeSlots, hasMore, isLoading, error, loadMore, isSelectionComplete, }) => (_jsx(GenericList.Root, { items: timeSlots.map((slot) => ({
108
+ return (_jsx(CoreTimeSlotList.ListData, { children: ({ timeSlots, hasMore, isLoading, error, loadMore, hasSelectedTimeSlot, }) => (_jsx(GenericList.Root, { items: timeSlots.map((slot) => ({
109
109
  ...slot,
110
110
  id: generateSlotKey(slot),
111
- })), loadMore: loadMore, hasMore: hasMore, isLoading: isLoading, error: error, className: className, ref: ref, "data-testid": TestIds.timeSlotListRoot, "data-selection-complete": isSelectionComplete, variant: variant, children: children })) }));
111
+ })), loadMore: loadMore, hasMore: hasMore, isLoading: isLoading, error: error, className: className, ref: ref, "data-testid": TestIds.timeSlotListRoot, "data-has-selected-time-slot": hasSelectedTimeSlot, variant: variant, children: children })) }));
112
112
  });
113
113
  RootContent.displayName = 'TimeSlotList.RootContent';
114
114
  /**
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@wix/headless-bookings",
3
- "version": "0.0.68",
4
- "license": "MIT",
3
+ "version": "0.0.70",
5
4
  "type": "module",
5
+ "license": "MIT",
6
6
  "scripts": {
7
7
  "prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",
8
8
  "build": "npm run build:esm && npm run build:cjs",
@@ -72,5 +72,5 @@
72
72
  "groupId": "com.wixpress.headless-components"
73
73
  }
74
74
  },
75
- "falconPackageHash": "3b008d24daecb8e73bbbb513fa6c77a3915d21d91e398a5574be74a6"
75
+ "falconPackageHash": "f52a35bc9181ed04c0310b7449e0422171fd803813aa9ac41a48e0c2"
76
76
  }