@wix/headless-bookings 0.0.50 → 0.0.52
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/Booking.d.ts +213 -2
- package/cjs/dist/react/booking/Booking.js +226 -0
- package/cjs/dist/react/core/booking/Booking.d.ts +139 -11
- package/cjs/dist/react/core/booking/Booking.js +219 -1
- package/cjs/dist/react/index.d.ts +1 -0
- package/cjs/dist/react/index.js +1 -0
- package/cjs/dist/react/location/Location.js +2 -2
- package/cjs/dist/services/payment/payment.def.d.ts +1 -1
- package/cjs/dist/services/payment/payment.js +11 -5
- package/dist/react/booking/Booking.d.ts +213 -2
- package/dist/react/booking/Booking.js +226 -0
- package/dist/react/core/booking/Booking.d.ts +139 -11
- package/dist/react/core/booking/Booking.js +219 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/location/Location.js +2 -2
- package/dist/services/payment/payment.def.d.ts +1 -1
- package/dist/services/payment/payment.js +11 -5
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
|
8
8
|
/**
|
|
9
9
|
* Payment option for line items
|
|
10
10
|
*/
|
|
11
|
-
export type PaymentOption = 'FULL_PAYMENT_ONLINE' | 'FULL_PAYMENT_OFFLINE';
|
|
11
|
+
export type PaymentOption = 'FULL_PAYMENT_ONLINE' | 'FULL_PAYMENT_OFFLINE' | 'DEPOSIT_ONLINE';
|
|
12
12
|
/**
|
|
13
13
|
* Additional computed info for a line item (not in SDK response)
|
|
14
14
|
*/
|
|
@@ -25,11 +25,15 @@ function getAdditionalInfo(service, lineItemId) {
|
|
|
25
25
|
: undefined;
|
|
26
26
|
return { lineItemId, priceText };
|
|
27
27
|
}
|
|
28
|
-
function getPaymentOption(service) {
|
|
28
|
+
function getPaymentOption(service, hasDeposit) {
|
|
29
29
|
const options = service.payment?.options;
|
|
30
30
|
if (options?.inPerson) {
|
|
31
31
|
return 'FULL_PAYMENT_OFFLINE';
|
|
32
32
|
}
|
|
33
|
+
// If deposit is configured, use DEPOSIT_ONLINE to get correct payNow/payLater split
|
|
34
|
+
if (hasDeposit) {
|
|
35
|
+
return 'DEPOSIT_ONLINE';
|
|
36
|
+
}
|
|
33
37
|
return 'FULL_PAYMENT_ONLINE';
|
|
34
38
|
}
|
|
35
39
|
function buildLineItem(service, numberOfParticipants, lineItemId) {
|
|
@@ -37,11 +41,13 @@ function buildLineItem(service, numberOfParticipants, lineItemId) {
|
|
|
37
41
|
const servicePrice = service.payment?.fixed?.price?.value;
|
|
38
42
|
const price = Number(servicePrice || 0) * numberOfParticipants;
|
|
39
43
|
// Get deposit if configured
|
|
40
|
-
const
|
|
41
|
-
|
|
44
|
+
const depositValue = service.payment?.fixed?.deposit?.value;
|
|
45
|
+
const hasDeposit = !!depositValue && Number(depositValue) > 0;
|
|
46
|
+
const deposit = hasDeposit
|
|
47
|
+
? Number(depositValue) * numberOfParticipants
|
|
42
48
|
: undefined;
|
|
43
|
-
// Get payment option from service configuration
|
|
44
|
-
const paymentOption = getPaymentOption(service);
|
|
49
|
+
// Get payment option from service configuration (pass hasDeposit for correct API behavior)
|
|
50
|
+
const paymentOption = getPaymentOption(service, hasDeposit);
|
|
45
51
|
return {
|
|
46
52
|
_id: lineItemId,
|
|
47
53
|
catalogReference: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
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": "fff74fd1bb0bfaf2ca7466dbd98448f8c2358d827e7a6dfa72fad3a4"
|
|
76
76
|
}
|