@wix/headless-bookings 0.0.47 → 0.0.48
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Builds the createBooking request from BookActionParams
|
|
3
3
|
*/
|
|
4
|
+
import { LocationType as TimeSlotLocationType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
5
|
+
import { LocationType as BookingLocationType } from '@wix/auto_sdk_bookings_bookings';
|
|
4
6
|
/**
|
|
5
7
|
* Derives the selected payment option from service payment settings.
|
|
6
8
|
* Maps service.payment.options to booking API's selectedPaymentOption.
|
|
@@ -69,7 +71,11 @@ export function buildBookingRequest(params) {
|
|
|
69
71
|
? { _id: resource._id, name: resource.name }
|
|
70
72
|
: undefined,
|
|
71
73
|
location: slotLocation
|
|
72
|
-
? {
|
|
74
|
+
? {
|
|
75
|
+
_id: slotLocation._id,
|
|
76
|
+
name: slotLocation.name,
|
|
77
|
+
locationType: mapTimeSlotLocationTypeToBookingLocationType(slotLocation.locationType),
|
|
78
|
+
}
|
|
73
79
|
: undefined,
|
|
74
80
|
},
|
|
75
81
|
},
|
|
@@ -81,3 +87,17 @@ export function buildBookingRequest(params) {
|
|
|
81
87
|
formSubmission: formSubmission ?? undefined,
|
|
82
88
|
};
|
|
83
89
|
}
|
|
90
|
+
function mapTimeSlotLocationTypeToBookingLocationType(slotLocationType) {
|
|
91
|
+
switch (slotLocationType) {
|
|
92
|
+
case TimeSlotLocationType.BUSINESS:
|
|
93
|
+
return BookingLocationType.OWNER_BUSINESS;
|
|
94
|
+
case TimeSlotLocationType.CUSTOMER:
|
|
95
|
+
return BookingLocationType.CUSTOM;
|
|
96
|
+
case TimeSlotLocationType.CUSTOM:
|
|
97
|
+
return BookingLocationType.OWNER_CUSTOM;
|
|
98
|
+
case TimeSlotLocationType.UNKNOWN_LOCATION_TYPE:
|
|
99
|
+
return BookingLocationType.UNDEFINED;
|
|
100
|
+
default:
|
|
101
|
+
return BookingLocationType.OWNER_BUSINESS;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Builds the createBooking request from BookActionParams
|
|
3
3
|
*/
|
|
4
|
+
import { LocationType as TimeSlotLocationType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
5
|
+
import { LocationType as BookingLocationType } from '@wix/auto_sdk_bookings_bookings';
|
|
4
6
|
/**
|
|
5
7
|
* Derives the selected payment option from service payment settings.
|
|
6
8
|
* Maps service.payment.options to booking API's selectedPaymentOption.
|
|
@@ -69,7 +71,11 @@ export function buildBookingRequest(params) {
|
|
|
69
71
|
? { _id: resource._id, name: resource.name }
|
|
70
72
|
: undefined,
|
|
71
73
|
location: slotLocation
|
|
72
|
-
? {
|
|
74
|
+
? {
|
|
75
|
+
_id: slotLocation._id,
|
|
76
|
+
name: slotLocation.name,
|
|
77
|
+
locationType: mapTimeSlotLocationTypeToBookingLocationType(slotLocation.locationType),
|
|
78
|
+
}
|
|
73
79
|
: undefined,
|
|
74
80
|
},
|
|
75
81
|
},
|
|
@@ -81,3 +87,17 @@ export function buildBookingRequest(params) {
|
|
|
81
87
|
formSubmission: formSubmission ?? undefined,
|
|
82
88
|
};
|
|
83
89
|
}
|
|
90
|
+
function mapTimeSlotLocationTypeToBookingLocationType(slotLocationType) {
|
|
91
|
+
switch (slotLocationType) {
|
|
92
|
+
case TimeSlotLocationType.BUSINESS:
|
|
93
|
+
return BookingLocationType.OWNER_BUSINESS;
|
|
94
|
+
case TimeSlotLocationType.CUSTOMER:
|
|
95
|
+
return BookingLocationType.CUSTOM;
|
|
96
|
+
case TimeSlotLocationType.CUSTOM:
|
|
97
|
+
return BookingLocationType.OWNER_CUSTOM;
|
|
98
|
+
case TimeSlotLocationType.UNKNOWN_LOCATION_TYPE:
|
|
99
|
+
return BookingLocationType.UNDEFINED;
|
|
100
|
+
default:
|
|
101
|
+
return BookingLocationType.OWNER_BUSINESS;
|
|
102
|
+
}
|
|
103
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.48",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"groupId": "com.wixpress.headless-components"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"falconPackageHash": "
|
|
75
|
+
"falconPackageHash": "d03db7a127ec41055bfdd5c0e6e6b7aa2c7446d3a1c8f69a4ff8aa57"
|
|
76
76
|
}
|