@wix/headless-bookings 1.0.6 → 1.0.7
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/create-bulk-booking/index.d.ts +9 -6
- package/cjs/dist/api/create-bulk-booking/index.js +2 -0
- package/cjs/dist/api/create-multi-service-booking/index.d.ts +7 -6
- package/cjs/dist/api/create-multi-service-booking/index.js +2 -0
- package/cjs/dist/services/booking/book-action/buildDayRangeBookingRequest.d.ts +3 -0
- package/cjs/dist/services/booking/book-action/buildDayRangeBookingRequest.js +1 -0
- package/cjs/dist/services/booking/book-action/createBookingsForCart.js +2 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.d.ts +1 -1
- package/cjs/dist/services/time-slot-list/time-slot-list.js +3 -3
- package/dist/api/create-bulk-booking/index.d.ts +9 -6
- package/dist/api/create-bulk-booking/index.js +2 -0
- package/dist/api/create-multi-service-booking/index.d.ts +7 -6
- package/dist/api/create-multi-service-booking/index.js +2 -0
- package/dist/services/booking/book-action/buildDayRangeBookingRequest.d.ts +3 -0
- package/dist/services/booking/book-action/buildDayRangeBookingRequest.js +1 -0
- package/dist/services/booking/book-action/createBookingsForCart.js +2 -0
- package/dist/services/time-slot-list/time-slot-list.d.ts +1 -1
- package/dist/services/time-slot-list/time-slot-list.js +1 -1
- package/package.json +4 -4
|
@@ -8,20 +8,22 @@
|
|
|
8
8
|
* createMultiServiceBooking.
|
|
9
9
|
*/
|
|
10
10
|
import { type CreateBookingInfo, type BulkCreateBookingResponse, type ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
11
|
+
import type { FormValues } from '@wix/forms/components';
|
|
11
12
|
/**
|
|
12
13
|
* Options for creating bookings in bulk.
|
|
13
14
|
*
|
|
14
|
-
* `formSubmission`
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* cart wiring.
|
|
15
|
+
* The SDK accepts `formSubmission` on each `CreateBookingInfo` entry, while
|
|
16
|
+
* this wrapper accepts one shared payload and applies it to every entry.
|
|
17
|
+
* We always set `returnFullEntity: true` so the response includes per-booking
|
|
18
|
+
* entities (with `contactDetails`) for cart wiring.
|
|
19
19
|
*/
|
|
20
20
|
export interface BulkCreateBookingOptions {
|
|
21
21
|
/** Notification settings for participants. Applied to every entry. */
|
|
22
22
|
participantNotification?: ParticipantNotification;
|
|
23
23
|
/** Whether to send SMS reminder. Applied to every entry. */
|
|
24
|
-
sendSmsReminder?: boolean;
|
|
24
|
+
sendSmsReminder?: boolean | null;
|
|
25
|
+
/** Form submission data. Applied to every entry. */
|
|
26
|
+
formSubmission?: FormValues | null;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Creates 1-8 bookings in a single bulk call.
|
|
@@ -44,6 +46,7 @@ export interface BulkCreateBookingOptions {
|
|
|
44
46
|
* {
|
|
45
47
|
* participantNotification: { notifyParticipants: true },
|
|
46
48
|
* sendSmsReminder: true,
|
|
49
|
+
* formSubmission: formValues,
|
|
47
50
|
* }
|
|
48
51
|
* );
|
|
49
52
|
* const ids = response.results
|
|
@@ -32,6 +32,7 @@ const auto_sdk_bookings_bookings_1 = require("@wix/auto_sdk_bookings_bookings");
|
|
|
32
32
|
* {
|
|
33
33
|
* participantNotification: { notifyParticipants: true },
|
|
34
34
|
* sendSmsReminder: true,
|
|
35
|
+
* formSubmission: formValues,
|
|
35
36
|
* }
|
|
36
37
|
* );
|
|
37
38
|
* const ids = response.results
|
|
@@ -47,6 +48,7 @@ function bulkCreateBooking(createBookingsInfo, options) {
|
|
|
47
48
|
...info,
|
|
48
49
|
participantNotification: info.participantNotification ?? options?.participantNotification,
|
|
49
50
|
sendSmsReminder: info.sendSmsReminder ?? options?.sendSmsReminder,
|
|
51
|
+
formSubmission: info.formSubmission ?? options?.formSubmission,
|
|
50
52
|
}));
|
|
51
53
|
return (0, auto_sdk_bookings_bookings_1.bulkCreateBooking)(enriched, {
|
|
52
54
|
returnFullEntity: true,
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
* picked slot.
|
|
9
9
|
*/
|
|
10
10
|
import { type Booking, type CreateMultiServiceBookingResponse, type ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
11
|
+
import type { FormValues } from '@wix/forms/components';
|
|
11
12
|
/**
|
|
12
13
|
* Options for creating a multi-service booking.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
* flow through the cart layer instead. We always set `returnFullEntity: true`
|
|
17
|
-
* so the response includes per-booking entities (with `contactDetails`) for
|
|
18
|
-
* cart wiring.
|
|
15
|
+
* We always set `returnFullEntity: true` so the response includes per-booking
|
|
16
|
+
* entities (with `contactDetails`) for cart wiring.
|
|
19
17
|
*/
|
|
20
18
|
export interface CreateMultiServiceBookingOptions {
|
|
21
19
|
/** Notification settings for participants */
|
|
22
20
|
participantNotification?: ParticipantNotification;
|
|
23
21
|
/** Whether to send SMS reminder */
|
|
24
|
-
sendSmsReminder?: boolean;
|
|
22
|
+
sendSmsReminder?: boolean | null;
|
|
23
|
+
/** Form submission data */
|
|
24
|
+
formSubmission?: FormValues | null;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Creates a multi-service booking from 2-8 single-service booking specs.
|
|
@@ -43,6 +43,7 @@ export interface CreateMultiServiceBookingOptions {
|
|
|
43
43
|
* {
|
|
44
44
|
* participantNotification: { notifyParticipants: true },
|
|
45
45
|
* sendSmsReminder: true,
|
|
46
|
+
* formSubmission: formValues,
|
|
46
47
|
* }
|
|
47
48
|
* );
|
|
48
49
|
* const ids = response.multiServiceBooking?.bookings
|
|
@@ -31,6 +31,7 @@ const auto_sdk_bookings_bookings_1 = require("@wix/auto_sdk_bookings_bookings");
|
|
|
31
31
|
* {
|
|
32
32
|
* participantNotification: { notifyParticipants: true },
|
|
33
33
|
* sendSmsReminder: true,
|
|
34
|
+
* formSubmission: formValues,
|
|
34
35
|
* }
|
|
35
36
|
* );
|
|
36
37
|
* const ids = response.multiServiceBooking?.bookings
|
|
@@ -42,6 +43,7 @@ function createMultiServiceBooking(bookings, options) {
|
|
|
42
43
|
return (0, auto_sdk_bookings_bookings_1.createMultiServiceBooking)(bookings, {
|
|
43
44
|
participantNotification: options?.participantNotification,
|
|
44
45
|
sendSmsReminder: options?.sendSmsReminder,
|
|
46
|
+
formSubmission: options?.formSubmission,
|
|
45
47
|
returnFullEntity: true,
|
|
46
48
|
});
|
|
47
49
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* The 8-day cap is enforced server-side; the builder does not gate on it.
|
|
13
13
|
*/
|
|
14
14
|
import type { Booking, ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
15
|
+
import type { FormValues } from '@wix/forms/components';
|
|
15
16
|
import type { BookActionParams } from './types.js';
|
|
16
17
|
export interface BuildDayRangeBookingRequest {
|
|
17
18
|
/**
|
|
@@ -23,6 +24,8 @@ export interface BuildDayRangeBookingRequest {
|
|
|
23
24
|
participantNotification?: ParticipantNotification;
|
|
24
25
|
/** Whether to send SMS reminder. */
|
|
25
26
|
sendSmsReminder: boolean;
|
|
27
|
+
/** Form submission data forwarded to booking creation. */
|
|
28
|
+
formSubmission?: FormValues | null;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Builds N Bookings from a DAY-range selection.
|
|
@@ -35,6 +35,7 @@ async function createBookingsForCart(params) {
|
|
|
35
35
|
const response = await (0, index_js_2.bulkCreateBooking)([{ booking: req.bookings[0] }], {
|
|
36
36
|
participantNotification: req.participantNotification,
|
|
37
37
|
sendSmsReminder: req.sendSmsReminder,
|
|
38
|
+
formSubmission: req.formSubmission,
|
|
38
39
|
});
|
|
39
40
|
const results = response.results ?? [];
|
|
40
41
|
return {
|
|
@@ -46,6 +47,7 @@ async function createBookingsForCart(params) {
|
|
|
46
47
|
const response = await (0, index_js_3.createMultiServiceBooking)(req.bookings, {
|
|
47
48
|
participantNotification: req.participantNotification,
|
|
48
49
|
sendSmsReminder: req.sendSmsReminder,
|
|
50
|
+
formSubmission: req.formSubmission,
|
|
49
51
|
});
|
|
50
52
|
const bookings = response.multiServiceBooking?.bookings ?? [];
|
|
51
53
|
return {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
6
6
|
import { type TimeSlotListServiceConfig, type TimeSlotsFilters } from './time-slot-list.def.js';
|
|
7
|
-
import { TimeSlot } from '@wix/
|
|
7
|
+
import { TimeSlot } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
8
8
|
/**
|
|
9
9
|
* Helper to get staff member name from time slots by ID
|
|
10
10
|
* @internal - exported for testing
|
|
@@ -9,7 +9,7 @@ exports.loadTimeSlotListConfig = loadTimeSlotListConfig;
|
|
|
9
9
|
const services_definitions_1 = require("@wix/services-definitions");
|
|
10
10
|
const signals_1 = require("@wix/services-definitions/core-services/signals");
|
|
11
11
|
const time_slot_list_def_js_1 = require("./time-slot-list.def.js");
|
|
12
|
-
const
|
|
12
|
+
const auto_sdk_bookings_availability_time_slots_1 = require("@wix/auto_sdk_bookings_availability-time-slots");
|
|
13
13
|
const index_js_1 = require("../../api/fetch-availability/index.js");
|
|
14
14
|
const booking_js_1 = require("../booking/booking.js");
|
|
15
15
|
// ============================================================================
|
|
@@ -61,8 +61,8 @@ exports.TimeSlotListService = services_definitions_1.implementService.withConfig
|
|
|
61
61
|
const getFilters = () => {
|
|
62
62
|
const baseFilters = config.filters ?? {};
|
|
63
63
|
const selectedLocation = bookingService.location.peek();
|
|
64
|
-
const isCustomOrCustomerLocation = selectedLocation?.type ===
|
|
65
|
-
selectedLocation?.type ===
|
|
64
|
+
const isCustomOrCustomerLocation = selectedLocation?.type === auto_sdk_bookings_availability_time_slots_1.LocationType.CUSTOM ||
|
|
65
|
+
selectedLocation?.type === auto_sdk_bookings_availability_time_slots_1.LocationType.CUSTOMER;
|
|
66
66
|
const location = selectedLocation
|
|
67
67
|
? {
|
|
68
68
|
id: isCustomOrCustomerLocation ? undefined : selectedLocation._id,
|
|
@@ -8,20 +8,22 @@
|
|
|
8
8
|
* createMultiServiceBooking.
|
|
9
9
|
*/
|
|
10
10
|
import { type CreateBookingInfo, type BulkCreateBookingResponse, type ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
11
|
+
import type { FormValues } from '@wix/forms/components';
|
|
11
12
|
/**
|
|
12
13
|
* Options for creating bookings in bulk.
|
|
13
14
|
*
|
|
14
|
-
* `formSubmission`
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* cart wiring.
|
|
15
|
+
* The SDK accepts `formSubmission` on each `CreateBookingInfo` entry, while
|
|
16
|
+
* this wrapper accepts one shared payload and applies it to every entry.
|
|
17
|
+
* We always set `returnFullEntity: true` so the response includes per-booking
|
|
18
|
+
* entities (with `contactDetails`) for cart wiring.
|
|
19
19
|
*/
|
|
20
20
|
export interface BulkCreateBookingOptions {
|
|
21
21
|
/** Notification settings for participants. Applied to every entry. */
|
|
22
22
|
participantNotification?: ParticipantNotification;
|
|
23
23
|
/** Whether to send SMS reminder. Applied to every entry. */
|
|
24
|
-
sendSmsReminder?: boolean;
|
|
24
|
+
sendSmsReminder?: boolean | null;
|
|
25
|
+
/** Form submission data. Applied to every entry. */
|
|
26
|
+
formSubmission?: FormValues | null;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Creates 1-8 bookings in a single bulk call.
|
|
@@ -44,6 +46,7 @@ export interface BulkCreateBookingOptions {
|
|
|
44
46
|
* {
|
|
45
47
|
* participantNotification: { notifyParticipants: true },
|
|
46
48
|
* sendSmsReminder: true,
|
|
49
|
+
* formSubmission: formValues,
|
|
47
50
|
* }
|
|
48
51
|
* );
|
|
49
52
|
* const ids = response.results
|
|
@@ -29,6 +29,7 @@ import { bulkCreateBooking as bulkCreateBookingSdk, } from '@wix/auto_sdk_bookin
|
|
|
29
29
|
* {
|
|
30
30
|
* participantNotification: { notifyParticipants: true },
|
|
31
31
|
* sendSmsReminder: true,
|
|
32
|
+
* formSubmission: formValues,
|
|
32
33
|
* }
|
|
33
34
|
* );
|
|
34
35
|
* const ids = response.results
|
|
@@ -44,6 +45,7 @@ export function bulkCreateBooking(createBookingsInfo, options) {
|
|
|
44
45
|
...info,
|
|
45
46
|
participantNotification: info.participantNotification ?? options?.participantNotification,
|
|
46
47
|
sendSmsReminder: info.sendSmsReminder ?? options?.sendSmsReminder,
|
|
48
|
+
formSubmission: info.formSubmission ?? options?.formSubmission,
|
|
47
49
|
}));
|
|
48
50
|
return bulkCreateBookingSdk(enriched, {
|
|
49
51
|
returnFullEntity: true,
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
* picked slot.
|
|
9
9
|
*/
|
|
10
10
|
import { type Booking, type CreateMultiServiceBookingResponse, type ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
11
|
+
import type { FormValues } from '@wix/forms/components';
|
|
11
12
|
/**
|
|
12
13
|
* Options for creating a multi-service booking.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
* flow through the cart layer instead. We always set `returnFullEntity: true`
|
|
17
|
-
* so the response includes per-booking entities (with `contactDetails`) for
|
|
18
|
-
* cart wiring.
|
|
15
|
+
* We always set `returnFullEntity: true` so the response includes per-booking
|
|
16
|
+
* entities (with `contactDetails`) for cart wiring.
|
|
19
17
|
*/
|
|
20
18
|
export interface CreateMultiServiceBookingOptions {
|
|
21
19
|
/** Notification settings for participants */
|
|
22
20
|
participantNotification?: ParticipantNotification;
|
|
23
21
|
/** Whether to send SMS reminder */
|
|
24
|
-
sendSmsReminder?: boolean;
|
|
22
|
+
sendSmsReminder?: boolean | null;
|
|
23
|
+
/** Form submission data */
|
|
24
|
+
formSubmission?: FormValues | null;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Creates a multi-service booking from 2-8 single-service booking specs.
|
|
@@ -43,6 +43,7 @@ export interface CreateMultiServiceBookingOptions {
|
|
|
43
43
|
* {
|
|
44
44
|
* participantNotification: { notifyParticipants: true },
|
|
45
45
|
* sendSmsReminder: true,
|
|
46
|
+
* formSubmission: formValues,
|
|
46
47
|
* }
|
|
47
48
|
* );
|
|
48
49
|
* const ids = response.multiServiceBooking?.bookings
|
|
@@ -28,6 +28,7 @@ import { createMultiServiceBooking as createMultiServiceBookingSdk, } from '@wix
|
|
|
28
28
|
* {
|
|
29
29
|
* participantNotification: { notifyParticipants: true },
|
|
30
30
|
* sendSmsReminder: true,
|
|
31
|
+
* formSubmission: formValues,
|
|
31
32
|
* }
|
|
32
33
|
* );
|
|
33
34
|
* const ids = response.multiServiceBooking?.bookings
|
|
@@ -39,6 +40,7 @@ export function createMultiServiceBooking(bookings, options) {
|
|
|
39
40
|
return createMultiServiceBookingSdk(bookings, {
|
|
40
41
|
participantNotification: options?.participantNotification,
|
|
41
42
|
sendSmsReminder: options?.sendSmsReminder,
|
|
43
|
+
formSubmission: options?.formSubmission,
|
|
42
44
|
returnFullEntity: true,
|
|
43
45
|
});
|
|
44
46
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* The 8-day cap is enforced server-side; the builder does not gate on it.
|
|
13
13
|
*/
|
|
14
14
|
import type { Booking, ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
15
|
+
import type { FormValues } from '@wix/forms/components';
|
|
15
16
|
import type { BookActionParams } from './types.js';
|
|
16
17
|
export interface BuildDayRangeBookingRequest {
|
|
17
18
|
/**
|
|
@@ -23,6 +24,8 @@ export interface BuildDayRangeBookingRequest {
|
|
|
23
24
|
participantNotification?: ParticipantNotification;
|
|
24
25
|
/** Whether to send SMS reminder. */
|
|
25
26
|
sendSmsReminder: boolean;
|
|
27
|
+
/** Form submission data forwarded to booking creation. */
|
|
28
|
+
formSubmission?: FormValues | null;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Builds N Bookings from a DAY-range selection.
|
|
@@ -32,6 +32,7 @@ export async function createBookingsForCart(params) {
|
|
|
32
32
|
const response = await bulkCreateBooking([{ booking: req.bookings[0] }], {
|
|
33
33
|
participantNotification: req.participantNotification,
|
|
34
34
|
sendSmsReminder: req.sendSmsReminder,
|
|
35
|
+
formSubmission: req.formSubmission,
|
|
35
36
|
});
|
|
36
37
|
const results = response.results ?? [];
|
|
37
38
|
return {
|
|
@@ -43,6 +44,7 @@ export async function createBookingsForCart(params) {
|
|
|
43
44
|
const response = await createMultiServiceBooking(req.bookings, {
|
|
44
45
|
participantNotification: req.participantNotification,
|
|
45
46
|
sendSmsReminder: req.sendSmsReminder,
|
|
47
|
+
formSubmission: req.formSubmission,
|
|
46
48
|
});
|
|
47
49
|
const bookings = response.multiServiceBooking?.bookings ?? [];
|
|
48
50
|
return {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
6
6
|
import { type TimeSlotListServiceConfig, type TimeSlotsFilters } from './time-slot-list.def.js';
|
|
7
|
-
import { TimeSlot } from '@wix/
|
|
7
|
+
import { TimeSlot } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
8
8
|
/**
|
|
9
9
|
* Helper to get staff member name from time slots by ID
|
|
10
10
|
* @internal - exported for testing
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { implementService } from '@wix/services-definitions';
|
|
6
6
|
import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
|
|
7
7
|
import { TimeSlotListServiceDefinition, ViewMode, } from './time-slot-list.def.js';
|
|
8
|
-
import { LocationType, } from '@wix/
|
|
8
|
+
import { LocationType, } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
9
9
|
import { fetchAvailability } from '../../api/fetch-availability/index.js';
|
|
10
10
|
import { BookingServiceDefinition, } from '../booking/booking.js';
|
|
11
11
|
// ============================================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@wix/auto_sdk_bookings_bookings": "^1.0.
|
|
38
|
-
"@wix/auto_sdk_bookings_event-time-slots": "^1.0.
|
|
37
|
+
"@wix/auto_sdk_bookings_bookings": "^1.0.192",
|
|
38
|
+
"@wix/auto_sdk_bookings_event-time-slots": "^1.0.112",
|
|
39
39
|
"@wix/auto_sdk_bookings_pricing": "^1.0.87",
|
|
40
40
|
"@wix/auto_sdk_bookings_services": "^1.0.226",
|
|
41
41
|
"@wix/auto_sdk_ecom_cart-v-2": "^1.0.86",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"groupId": "com.wixpress.headless-components"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"falconPackageHash": "
|
|
78
|
+
"falconPackageHash": "60796dfbabc73eb7b2ec7543eb4062986b78906203ede122471a8080"
|
|
79
79
|
}
|