@wix/headless-bookings 0.0.25 → 0.0.26
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/api/fetch-availability/index.d.ts +5 -5
- package/cjs/dist/api/fetch-availability/index.js +9 -6
- package/cjs/dist/react/booking/Book.d.ts +49 -0
- package/cjs/dist/react/booking/Book.js +46 -0
- package/cjs/dist/react/booking/Booking.d.ts +18 -0
- package/cjs/dist/react/booking/Booking.js +19 -0
- package/cjs/dist/react/core/booking/Book.d.ts +41 -0
- package/cjs/dist/react/core/booking/Book.js +59 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlot.d.ts +4 -4
- package/cjs/dist/react/core/time-slot-list/TimeSlot.js +3 -10
- package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +3 -3
- package/cjs/dist/react/time-slot-list/TimeSlot.js +3 -3
- package/cjs/dist/react/time-slot-list/TimeSlotList.d.ts +5 -3
- package/cjs/dist/services/booking/book-action/bookAction.d.ts +21 -0
- package/cjs/dist/services/booking/book-action/bookAction.js +59 -0
- package/cjs/dist/services/booking/book-action/buildBookingRequest.d.ts +22 -0
- package/cjs/dist/services/booking/book-action/buildBookingRequest.js +81 -0
- package/cjs/dist/services/booking/book-action/buildCheckoutRequest.d.ts +26 -0
- package/cjs/dist/services/booking/book-action/buildCheckoutRequest.js +62 -0
- package/cjs/dist/services/booking/book-action/canBook.d.ts +23 -0
- package/cjs/dist/services/booking/book-action/canBook.js +19 -0
- package/cjs/dist/services/booking/book-action/index.d.ts +8 -0
- package/cjs/dist/services/booking/book-action/index.js +7 -0
- package/cjs/dist/services/booking/book-action/types.d.ts +50 -0
- package/cjs/dist/services/booking/book-action/types.js +4 -0
- package/cjs/dist/services/booking/booking.d.ts +2 -0
- package/cjs/dist/services/booking/booking.js +16 -0
- package/cjs/dist/services/index.d.ts +1 -0
- package/cjs/dist/services/index.js +1 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.def.d.ts +10 -2
- package/cjs/dist/services/time-slot-list/time-slot-list.js +9 -29
- package/dist/api/fetch-availability/index.d.ts +5 -5
- package/dist/api/fetch-availability/index.js +9 -6
- package/dist/react/booking/Book.d.ts +49 -0
- package/dist/react/booking/Book.js +46 -0
- package/dist/react/booking/Booking.d.ts +18 -0
- package/dist/react/booking/Booking.js +19 -0
- package/dist/react/core/booking/Book.d.ts +41 -0
- package/dist/react/core/booking/Book.js +59 -0
- package/dist/react/core/time-slot-list/TimeSlot.d.ts +4 -4
- package/dist/react/core/time-slot-list/TimeSlot.js +3 -10
- package/dist/react/time-slot-list/TimeSlot.d.ts +3 -3
- package/dist/react/time-slot-list/TimeSlot.js +3 -3
- package/dist/react/time-slot-list/TimeSlotList.d.ts +5 -3
- package/dist/services/booking/book-action/bookAction.d.ts +21 -0
- package/dist/services/booking/book-action/bookAction.js +59 -0
- package/dist/services/booking/book-action/buildBookingRequest.d.ts +22 -0
- package/dist/services/booking/book-action/buildBookingRequest.js +81 -0
- package/dist/services/booking/book-action/buildCheckoutRequest.d.ts +26 -0
- package/dist/services/booking/book-action/buildCheckoutRequest.js +62 -0
- package/dist/services/booking/book-action/canBook.d.ts +23 -0
- package/dist/services/booking/book-action/canBook.js +19 -0
- package/dist/services/booking/book-action/index.d.ts +8 -0
- package/dist/services/booking/book-action/index.js +7 -0
- package/dist/services/booking/book-action/types.d.ts +50 -0
- package/dist/services/booking/book-action/types.js +4 -0
- package/dist/services/booking/booking.d.ts +2 -0
- package/dist/services/booking/booking.js +16 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/time-slot-list/time-slot-list.def.d.ts +10 -2
- package/dist/services/time-slot-list/time-slot-list.js +9 -29
- package/package.json +4 -3
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
* Defines interfaces and service contract for time slot management
|
|
4
4
|
*/
|
|
5
5
|
import type { Signal } from '@wix/services-definitions/core-services/signals';
|
|
6
|
-
import type { TimeSlot as ApiTimeSlot,
|
|
6
|
+
import type { TimeSlot as ApiTimeSlot, LocationTypeWithLiterals } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
7
7
|
import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
8
|
+
/**
|
|
9
|
+
* Location filter input for availability calls.
|
|
10
|
+
* Require a stable `id` + `locationType` pair (no optional fields).
|
|
11
|
+
*/
|
|
12
|
+
export interface Location {
|
|
13
|
+
id: string;
|
|
14
|
+
locationType: LocationTypeWithLiterals;
|
|
15
|
+
}
|
|
8
16
|
export declare enum ViewMode {
|
|
9
17
|
CLASSIC = "classic",
|
|
10
18
|
AGENDA = "agenda"
|
|
@@ -48,7 +56,7 @@ export interface SlotSelection {
|
|
|
48
56
|
*/
|
|
49
57
|
export interface TimeSlotsFilters {
|
|
50
58
|
/** Filter by specific locations */
|
|
51
|
-
|
|
59
|
+
location?: Location;
|
|
52
60
|
/** Filter by specific staff member IDs */
|
|
53
61
|
staffMemberIds?: string[];
|
|
54
62
|
/** Filter by bookable status. If undefined, returns both bookable and non-bookable */
|
|
@@ -65,31 +65,13 @@ export const TimeSlotListService = implementService.withConfig()(TimeSlotListSer
|
|
|
65
65
|
* Helper: Get services from config or BookingService
|
|
66
66
|
*/
|
|
67
67
|
const getServices = () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const getFilters = () => {
|
|
76
|
-
// Get BookingService selections (these take priority)
|
|
77
|
-
const location = bookingService.location.get();
|
|
78
|
-
const serviceSelections = bookingService.serviceSelections.get();
|
|
79
|
-
const selectedStaffMemberIds = serviceSelections
|
|
80
|
-
.map((serviceSelection) => serviceSelection.resources.map((r) => r._id))
|
|
81
|
-
.flat();
|
|
82
|
-
const selectedLocation = location ? { _id: location.id } : null;
|
|
83
|
-
// Merge config filters with BookingService selections (selections win)
|
|
84
|
-
return {
|
|
85
|
-
...config.filters,
|
|
86
|
-
locations: selectedLocation
|
|
87
|
-
? [selectedLocation]
|
|
88
|
-
: config.filters?.locations,
|
|
89
|
-
staffMemberIds: selectedStaffMemberIds.length
|
|
90
|
-
? selectedStaffMemberIds
|
|
91
|
-
: config.filters?.staffMemberIds,
|
|
92
|
-
};
|
|
68
|
+
const selectedServices = bookingService.serviceSelections
|
|
69
|
+
.get()
|
|
70
|
+
.map((s) => s.service);
|
|
71
|
+
if (selectedServices.length) {
|
|
72
|
+
return selectedServices;
|
|
73
|
+
}
|
|
74
|
+
return config.services ?? [];
|
|
93
75
|
};
|
|
94
76
|
/**
|
|
95
77
|
* Fetch time slots from API
|
|
@@ -97,7 +79,6 @@ export const TimeSlotListService = implementService.withConfig()(TimeSlotListSer
|
|
|
97
79
|
*/
|
|
98
80
|
const fetchTimeSlots = async () => {
|
|
99
81
|
const selectedServices = getServices();
|
|
100
|
-
const filters = getFilters();
|
|
101
82
|
isLoadingSignal.set(true);
|
|
102
83
|
errorSignal.set(null);
|
|
103
84
|
cursorSignal.set(undefined);
|
|
@@ -110,7 +91,7 @@ export const TimeSlotListService = implementService.withConfig()(TimeSlotListSer
|
|
|
110
91
|
timeZone: bookingService.timezone.get(),
|
|
111
92
|
viewMode: viewModeSignal.get(),
|
|
112
93
|
cursor: cursorSignal.get(),
|
|
113
|
-
...filters,
|
|
94
|
+
...config.filters,
|
|
114
95
|
});
|
|
115
96
|
timeSlotsSignal.set(response.timeSlots);
|
|
116
97
|
const nextCursor = response.cursorPagingMetadata?.cursors?.next ?? undefined;
|
|
@@ -303,7 +284,6 @@ export const TimeSlotListService = implementService.withConfig()(TimeSlotListSer
|
|
|
303
284
|
if (!cursor || isLoadingSignal.get())
|
|
304
285
|
return;
|
|
305
286
|
const selectedServices = getServices();
|
|
306
|
-
const filters = getFilters();
|
|
307
287
|
isLoadingSignal.set(true);
|
|
308
288
|
try {
|
|
309
289
|
const response = await fetchAvailability({
|
|
@@ -313,7 +293,7 @@ export const TimeSlotListService = implementService.withConfig()(TimeSlotListSer
|
|
|
313
293
|
timeZone: bookingService.timezone.get(),
|
|
314
294
|
cursor,
|
|
315
295
|
viewMode: viewModeSignal.get(),
|
|
316
|
-
...filters,
|
|
296
|
+
...config.filters,
|
|
317
297
|
});
|
|
318
298
|
// API returns grouped slots, merge with existing
|
|
319
299
|
const existing = timeSlotsSignal.get();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -33,8 +33,9 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@wix/auto_sdk_bookings_bookings": "^1.0.103",
|
|
36
37
|
"@wix/auto_sdk_bookings_event-time-slots": "^1.0.64",
|
|
37
|
-
"@wix/
|
|
38
|
+
"@wix/auto_sdk_ecom_checkout": "^1.0.104",
|
|
38
39
|
"@wix/form-public": "^0.64.0",
|
|
39
40
|
"@wix/headless-forms": "0.0.20",
|
|
40
41
|
"@wix/headless-media": "0.0.18",
|
|
@@ -71,5 +72,5 @@
|
|
|
71
72
|
"groupId": "com.wixpress.headless-components"
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
|
-
"falconPackageHash": "
|
|
75
|
+
"falconPackageHash": "75acc1ea692508f639c9e8416715d9db8c2f40cc6a4bf7bfc7839a0e"
|
|
75
76
|
}
|