@wix/headless-bookings 1.0.12 → 1.0.14

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.
@@ -64,6 +64,10 @@ function buildBookingRequest(params) {
64
64
  deriveSelectedPaymentOption(item.service),
65
65
  // Participants
66
66
  totalParticipants: item.totalParticipants || 1,
67
+ // App that created the booking (used to filter bookings by source app).
68
+ ...(params.appSourceId && {
69
+ bookingSource: { appDefId: params.appSourceId },
70
+ }),
67
71
  // Booked entity slot
68
72
  bookedEntity: {
69
73
  slot: {
@@ -28,6 +28,11 @@ function buildCartShape(params) {
28
28
  }
29
29
  if (contactDetails) {
30
30
  cart.customerInfo = {
31
+ ...(contactDetails.firstName
32
+ ? { firstName: contactDetails.firstName }
33
+ : {}),
34
+ ...(contactDetails.lastName ? { lastName: contactDetails.lastName } : {}),
35
+ ...(contactDetails.phone ? { phone: contactDetails.phone } : {}),
31
36
  ...(contactDetails.email ? { email: contactDetails.email } : {}),
32
37
  };
33
38
  if (contactDetails.fullAddress?.country) {
@@ -46,6 +46,12 @@ export interface BookActionParams {
46
46
  timezone?: string;
47
47
  /** Optional app ID override for the catalog reference. Defaults to the bookings app ID. */
48
48
  appId?: string;
49
+ /**
50
+ * Optional app source ID. When provided, sets the created booking's
51
+ * `bookingSource.appDefId` (the ID of the app that created the booking),
52
+ * allowing bookings to be filtered by source app later.
53
+ */
54
+ appSourceId?: string;
49
55
  /**
50
56
  * Optional consumer-selected payment option. When provided, overrides the
51
57
  * heuristic derived from `service.payment.options` in `buildBookingRequest`
@@ -148,6 +148,12 @@ export interface BookingServiceConfig {
148
148
  selectedPaymentOption?: SelectedPaymentOption;
149
149
  /** Optional app ID override for the catalog reference. Defaults to the bookings app ID. */
150
150
  appId?: string;
151
+ /**
152
+ * Optional app source ID. When provided, sets the created booking's
153
+ * `bookingSource.appDefId` (the ID of the app that created the booking),
154
+ * allowing bookings to be filtered by source app later.
155
+ */
156
+ appSourceId?: string;
151
157
  }
152
158
  /**
153
159
  * Implementation of BookingService
@@ -203,6 +203,7 @@ exports.BookingService = services_definitions_1.implementService.withConfig()(ex
203
203
  location,
204
204
  timezone,
205
205
  appId: config.appId,
206
+ appSourceId: config.appSourceId,
206
207
  selectedPaymentOption,
207
208
  allDay,
208
209
  });
@@ -61,6 +61,10 @@ export function buildBookingRequest(params) {
61
61
  deriveSelectedPaymentOption(item.service),
62
62
  // Participants
63
63
  totalParticipants: item.totalParticipants || 1,
64
+ // App that created the booking (used to filter bookings by source app).
65
+ ...(params.appSourceId && {
66
+ bookingSource: { appDefId: params.appSourceId },
67
+ }),
64
68
  // Booked entity slot
65
69
  bookedEntity: {
66
70
  slot: {
@@ -25,6 +25,11 @@ function buildCartShape(params) {
25
25
  }
26
26
  if (contactDetails) {
27
27
  cart.customerInfo = {
28
+ ...(contactDetails.firstName
29
+ ? { firstName: contactDetails.firstName }
30
+ : {}),
31
+ ...(contactDetails.lastName ? { lastName: contactDetails.lastName } : {}),
32
+ ...(contactDetails.phone ? { phone: contactDetails.phone } : {}),
28
33
  ...(contactDetails.email ? { email: contactDetails.email } : {}),
29
34
  };
30
35
  if (contactDetails.fullAddress?.country) {
@@ -46,6 +46,12 @@ export interface BookActionParams {
46
46
  timezone?: string;
47
47
  /** Optional app ID override for the catalog reference. Defaults to the bookings app ID. */
48
48
  appId?: string;
49
+ /**
50
+ * Optional app source ID. When provided, sets the created booking's
51
+ * `bookingSource.appDefId` (the ID of the app that created the booking),
52
+ * allowing bookings to be filtered by source app later.
53
+ */
54
+ appSourceId?: string;
49
55
  /**
50
56
  * Optional consumer-selected payment option. When provided, overrides the
51
57
  * heuristic derived from `service.payment.options` in `buildBookingRequest`
@@ -148,6 +148,12 @@ export interface BookingServiceConfig {
148
148
  selectedPaymentOption?: SelectedPaymentOption;
149
149
  /** Optional app ID override for the catalog reference. Defaults to the bookings app ID. */
150
150
  appId?: string;
151
+ /**
152
+ * Optional app source ID. When provided, sets the created booking's
153
+ * `bookingSource.appDefId` (the ID of the app that created the booking),
154
+ * allowing bookings to be filtered by source app later.
155
+ */
156
+ appSourceId?: string;
151
157
  }
152
158
  /**
153
159
  * Implementation of BookingService
@@ -200,6 +200,7 @@ export const BookingService = implementService.withConfig()(BookingServiceDefini
200
200
  location,
201
201
  timezone,
202
202
  appId: config.appId,
203
+ appSourceId: config.appSourceId,
203
204
  selectedPaymentOption,
204
205
  allDay,
205
206
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-bookings",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -91,5 +91,5 @@
91
91
  "groupId": "com.wixpress.headless-components"
92
92
  }
93
93
  },
94
- "falconPackageHash": "a3b1cc5e12b33bd58dd7a4e7bacc6a47fc3ab1a8b16aa142e6302570"
94
+ "falconPackageHash": "a46181a3961b30abe8eff9e922340b833ee536437f39b21c18667c07"
95
95
  }