@wix/headless-bookings 1.0.2 → 1.0.3

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.
@@ -98,13 +98,14 @@ function buildLineItem(service, totalParticipants, lineItemId) {
98
98
  function getDurationRange(service) {
99
99
  return service.schedule?.availabilityConstraints?.durationRange;
100
100
  }
101
- async function getPreviewedPrice(service, localStartDate, localEndDate, timeZone) {
101
+ async function getPreviewedPrice(service, localStartDate, localEndDate, timeZone, numberOfParticipants) {
102
102
  if (!service._id)
103
103
  return null;
104
104
  const lineItemInput = {
105
105
  serviceId: service._id,
106
106
  localStartDate,
107
107
  localEndDate,
108
+ numberOfParticipants,
108
109
  ...(timeZone ? { timeZone } : {}),
109
110
  };
110
111
  const result = await (0, auto_sdk_bookings_pricing_1.previewPrice)([lineItemInput]);
@@ -114,7 +115,7 @@ async function buildLineItemWithPreview(item, totalParticipants) {
114
115
  if (item.localStartDate &&
115
116
  item.localEndDate &&
116
117
  getDurationRange(item.service)) {
117
- const previewedPrice = await getPreviewedPrice(item.service, item.localStartDate, item.localEndDate, item.timeZone).catch(() => null);
118
+ const previewedPrice = await getPreviewedPrice(item.service, item.localStartDate, item.localEndDate, item.timeZone, totalParticipants).catch(() => null);
118
119
  if (previewedPrice != null) {
119
120
  const depositValue = item.service.payment?.fixed?.deposit?.value;
120
121
  const hasDeposit = !!depositValue && Number(depositValue) > 0;
@@ -93,13 +93,14 @@ function buildLineItem(service, totalParticipants, lineItemId) {
93
93
  function getDurationRange(service) {
94
94
  return service.schedule?.availabilityConstraints?.durationRange;
95
95
  }
96
- async function getPreviewedPrice(service, localStartDate, localEndDate, timeZone) {
96
+ async function getPreviewedPrice(service, localStartDate, localEndDate, timeZone, numberOfParticipants) {
97
97
  if (!service._id)
98
98
  return null;
99
99
  const lineItemInput = {
100
100
  serviceId: service._id,
101
101
  localStartDate,
102
102
  localEndDate,
103
+ numberOfParticipants,
103
104
  ...(timeZone ? { timeZone } : {}),
104
105
  };
105
106
  const result = await previewPrice([lineItemInput]);
@@ -109,7 +110,7 @@ async function buildLineItemWithPreview(item, totalParticipants) {
109
110
  if (item.localStartDate &&
110
111
  item.localEndDate &&
111
112
  getDurationRange(item.service)) {
112
- const previewedPrice = await getPreviewedPrice(item.service, item.localStartDate, item.localEndDate, item.timeZone).catch(() => null);
113
+ const previewedPrice = await getPreviewedPrice(item.service, item.localStartDate, item.localEndDate, item.timeZone, totalParticipants).catch(() => null);
113
114
  if (previewedPrice != null) {
114
115
  const depositValue = item.service.payment?.fixed?.deposit?.value;
115
116
  const hasDeposit = !!depositValue && Number(depositValue) > 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-bookings",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -75,5 +75,5 @@
75
75
  "groupId": "com.wixpress.headless-components"
76
76
  }
77
77
  },
78
- "falconPackageHash": "402687344b7c916e00531f83dab622fae9b9efda7b82abadc49c484b"
78
+ "falconPackageHash": "60d159ffa08e430dd4c999859e909d281cd9262b93a577989e8de015"
79
79
  }