@wix/headless-bookings 0.0.104 → 0.0.106

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.
Files changed (82) hide show
  1. package/cjs/dist/__mocks__/booking/booking-client-service.js +25 -20
  2. package/cjs/dist/__mocks__/booking/booking-mocks.js +28 -20
  3. package/cjs/dist/__mocks__/payment/payment-mocks.js +6 -3
  4. package/cjs/dist/__mocks__/services/services-mocks.js +79 -74
  5. package/cjs/dist/__mocks__/time-slots/time-slots-client-service.js +39 -33
  6. package/cjs/dist/__mocks__/time-slots/time-slots-core.js +43 -33
  7. package/cjs/dist/__mocks__/time-slots/time-slots-mocks.js +18 -13
  8. package/cjs/dist/api/create-booking/index.js +6 -3
  9. package/cjs/dist/api/create-checkout/index.js +9 -4
  10. package/cjs/dist/api/create-order/index.js +6 -3
  11. package/cjs/dist/api/fetch-availability/index.js +18 -15
  12. package/cjs/dist/api/index.js +24 -7
  13. package/cjs/dist/api/query-categories/index.js +6 -3
  14. package/cjs/dist/api/query-locations/index.js +9 -5
  15. package/cjs/dist/api/query-services/index.js +24 -17
  16. package/cjs/dist/react/booking/Book.js +51 -12
  17. package/cjs/dist/react/booking/Booking.js +68 -26
  18. package/cjs/dist/react/booking/BookingItem.d.ts +2 -0
  19. package/cjs/dist/react/booking/BookingItem.js +57 -16
  20. package/cjs/dist/react/booking-form/BookingForm.js +63 -21
  21. package/cjs/dist/react/core/booking/Book.js +14 -11
  22. package/cjs/dist/react/core/booking/Booking.d.ts +3 -1
  23. package/cjs/dist/react/core/booking/Booking.js +38 -25
  24. package/cjs/dist/react/core/booking-form/BookingForm.js +63 -26
  25. package/cjs/dist/react/core/location/Location.js +60 -21
  26. package/cjs/dist/react/core/location-list/LocationList.js +15 -10
  27. package/cjs/dist/react/core/payment/Payment.js +41 -30
  28. package/cjs/dist/react/core/service/Service.js +28 -19
  29. package/cjs/dist/react/core/service/ServiceMediaCover.js +7 -4
  30. package/cjs/dist/react/core/service/ServiceMediaGallery.js +7 -4
  31. package/cjs/dist/react/core/service/ServiceMediaMain.js +7 -4
  32. package/cjs/dist/react/core/service-list/ServiceList.js +12 -8
  33. package/cjs/dist/react/core/service-list/ServiceListFilter.js +9 -6
  34. package/cjs/dist/react/core/staff-member/StaffMember.js +20 -14
  35. package/cjs/dist/react/core/staff-member-list/StaffMemberList.js +19 -14
  36. package/cjs/dist/react/core/time-slot-list/TimeSlot.js +41 -28
  37. package/cjs/dist/react/core/time-slot-list/TimeSlotList.js +21 -15
  38. package/cjs/dist/react/index.js +49 -13
  39. package/cjs/dist/react/location/Location.js +76 -36
  40. package/cjs/dist/react/location/LocationList.js +70 -31
  41. package/cjs/dist/react/payment/Payment.js +87 -48
  42. package/cjs/dist/react/service/Service.js +197 -158
  43. package/cjs/dist/react/service/ServiceMedia.js +56 -17
  44. package/cjs/dist/react/service-list/ServiceList.js +71 -32
  45. package/cjs/dist/react/staff-member/StaffMember.js +61 -20
  46. package/cjs/dist/react/staff-member/StaffMemberList.js +68 -29
  47. package/cjs/dist/react/time-slot-list/TimeSlot.js +95 -56
  48. package/cjs/dist/react/time-slot-list/TimeSlotList.js +87 -48
  49. package/cjs/dist/services/booking/book-action/bookAction.js +21 -18
  50. package/cjs/dist/services/booking/book-action/buildBookingRequest.js +18 -15
  51. package/cjs/dist/services/booking/book-action/buildCheckoutRequest.js +8 -5
  52. package/cjs/dist/services/booking/book-action/canBook.js +4 -1
  53. package/cjs/dist/services/booking/book-action/index.js +15 -6
  54. package/cjs/dist/services/booking/book-action/isCheckoutRequired.js +4 -1
  55. package/cjs/dist/services/booking/book-action/types.js +5 -2
  56. package/cjs/dist/services/booking/booking.js +11 -8
  57. package/cjs/dist/services/booking-form/booking-form.js +26 -18
  58. package/cjs/dist/services/booking-form/utils.js +10 -4
  59. package/cjs/dist/services/constants.js +6 -3
  60. package/cjs/dist/services/index.js +48 -10
  61. package/cjs/dist/services/location-list/location-list.def.js +7 -5
  62. package/cjs/dist/services/location-list/location-list.js +31 -23
  63. package/cjs/dist/services/payment/payment.def.js +5 -2
  64. package/cjs/dist/services/payment/payment.js +22 -17
  65. package/cjs/dist/services/service/service.js +33 -29
  66. package/cjs/dist/services/service-list/service-list.js +22 -18
  67. package/cjs/dist/services/staff-member-list/staff-member-list.def.js +5 -2
  68. package/cjs/dist/services/staff-member-list/staff-member-list.js +16 -10
  69. package/cjs/dist/services/time-slot-list/index.js +12 -3
  70. package/cjs/dist/services/time-slot-list/time-slot-list.def.js +8 -5
  71. package/cjs/dist/services/time-slot-list/time-slot-list.js +24 -19
  72. package/cjs/dist/services/time-slot-list/time-slot.js +9 -6
  73. package/cjs/dist/utils/dateAndTime.js +7 -2
  74. package/cjs/dist/utils/guid.js +4 -1
  75. package/cjs/dist/utils/index.js +5 -1
  76. package/cjs/dist/utils/money.js +6 -2
  77. package/cjs/dist/utils/navigation.js +6 -3
  78. package/dist/react/booking/BookingItem.d.ts +2 -0
  79. package/dist/react/booking/BookingItem.js +2 -2
  80. package/dist/react/core/booking/Booking.d.ts +3 -1
  81. package/dist/react/core/booking/Booking.js +3 -2
  82. package/package.json +3 -3
@@ -1,16 +1,21 @@
1
+ "use strict";
1
2
  /**
2
3
  * Location List Service Implementation
3
4
  * Manages location state, auto-detection, and BookingService integration
4
5
  *
5
6
  * @module Services/LocationList
6
7
  */
7
- import { implementService } from '@wix/services-definitions';
8
- import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
9
- import { LocationType } from '@wix/auto_sdk_bookings_services';
10
- import { LocationListServiceDefinition, } from './location-list.def.js';
11
- import { BookingServiceDefinition } from '../booking/booking.js';
12
- import { queryLocations } from '../../api/query-locations/index.js';
13
- export { getLocationById } from '../../api/query-locations/index.js';
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LocationType = exports.LocationListServiceDefinition = exports.locationListServiceBinding = exports.LocationListService = exports.getLocationById = void 0;
10
+ exports.loadLocationListServiceInitialData = loadLocationListServiceInitialData;
11
+ const services_definitions_1 = require("@wix/services-definitions");
12
+ const signals_1 = require("@wix/services-definitions/core-services/signals");
13
+ const auto_sdk_bookings_services_1 = require("@wix/auto_sdk_bookings_services");
14
+ const location_list_def_js_1 = require("./location-list.def.js");
15
+ const booking_js_1 = require("../booking/booking.js");
16
+ const index_js_1 = require("../../api/query-locations/index.js");
17
+ var index_js_2 = require("../../api/query-locations/index.js");
18
+ Object.defineProperty(exports, "getLocationById", { enumerable: true, get: function () { return index_js_2.getLocationById; } });
14
19
  // ============================================================================
15
20
  // Constants
16
21
  // ============================================================================
@@ -30,13 +35,13 @@ const SYNTHETIC_CUSTOMER_ID = 'customer';
30
35
  function buildDisplayLocations(locations, hasCustomLocations, hasCustomerLocations) {
31
36
  const displayLocations = [];
32
37
  // 1. Add all BUSINESS locations directly
33
- const businessLocations = locations.filter((loc) => loc.type === LocationType.BUSINESS || loc.type === undefined);
38
+ const businessLocations = locations.filter((loc) => loc.type === auto_sdk_bookings_services_1.LocationType.BUSINESS || loc.type === undefined);
34
39
  for (const loc of businessLocations) {
35
40
  displayLocations.push(loc);
36
41
  }
37
42
  // Check for existing CUSTOM/CUSTOMER in array
38
- const customFromArray = locations.find((loc) => loc.type === LocationType.CUSTOM);
39
- const customerFromArray = locations.find((loc) => loc.type === LocationType.CUSTOMER);
43
+ const customFromArray = locations.find((loc) => loc.type === auto_sdk_bookings_services_1.LocationType.CUSTOM);
44
+ const customerFromArray = locations.find((loc) => loc.type === auto_sdk_bookings_services_1.LocationType.CUSTOMER);
40
45
  // 2. Add CUSTOM location (from array, or create placeholder)
41
46
  if (customFromArray) {
42
47
  displayLocations.push(customFromArray);
@@ -44,7 +49,7 @@ function buildDisplayLocations(locations, hasCustomLocations, hasCustomerLocatio
44
49
  else if (hasCustomLocations) {
45
50
  // Placeholder custom location (only from explicit flag, not array)
46
51
  const placeholderCustom = {
47
- type: LocationType.CUSTOM,
52
+ type: auto_sdk_bookings_services_1.LocationType.CUSTOM,
48
53
  _id: SYNTHETIC_CUSTOM_ID,
49
54
  };
50
55
  displayLocations.push(placeholderCustom);
@@ -56,7 +61,7 @@ function buildDisplayLocations(locations, hasCustomLocations, hasCustomerLocatio
56
61
  else if (hasCustomerLocations) {
57
62
  // Placeholder customer location (only from explicit flag, not array)
58
63
  const placeholderCustomer = {
59
- type: LocationType.CUSTOMER,
64
+ type: auto_sdk_bookings_services_1.LocationType.CUSTOMER,
60
65
  _id: SYNTHETIC_CUSTOMER_ID,
61
66
  };
62
67
  displayLocations.push(placeholderCustomer);
@@ -70,12 +75,12 @@ function buildDisplayLocations(locations, hasCustomLocations, hasCustomerLocatio
70
75
  * Implementation of the LocationList service
71
76
  * Manages location state and integrates with BookingService for selection (optional)
72
77
  */
73
- export const LocationListService = implementService.withConfig()(LocationListServiceDefinition, ({ getService, config }) => {
74
- const signalsService = getService(SignalsServiceDefinition);
78
+ exports.LocationListService = services_definitions_1.implementService.withConfig()(location_list_def_js_1.LocationListServiceDefinition, ({ getService, config }) => {
79
+ const signalsService = getService(signals_1.SignalsServiceDefinition);
75
80
  // Try to get BookingService - it's optional (Location can be standalone)
76
81
  let bookingService = null;
77
82
  try {
78
- bookingService = getService(BookingServiceDefinition);
83
+ bookingService = getService(booking_js_1.BookingServiceDefinition);
79
84
  }
80
85
  catch {
81
86
  // BookingService not available - Location is used standalone
@@ -84,8 +89,8 @@ export const LocationListService = implementService.withConfig()(LocationListSer
84
89
  // Initialize raw locations signal
85
90
  const locationsSignal = signalsService.signal(config.locations || []);
86
91
  // Auto-detect from array
87
- const hasCustomInArray = (config.locations || []).some((loc) => loc.type === LocationType.CUSTOM);
88
- const hasCustomerInArray = (config.locations || []).some((loc) => loc.type === LocationType.CUSTOMER);
92
+ const hasCustomInArray = (config.locations || []).some((loc) => loc.type === auto_sdk_bookings_services_1.LocationType.CUSTOM);
93
+ const hasCustomerInArray = (config.locations || []).some((loc) => loc.type === auto_sdk_bookings_services_1.LocationType.CUSTOMER);
89
94
  // Final flags: explicit config OR auto-detected
90
95
  const hasCustomLocationsSignal = signalsService.computed(() => config.hasCustomLocations ?? hasCustomInArray);
91
96
  const hasCustomerLocationsSignal = signalsService.computed(() => config.hasCustomerLocations ?? hasCustomerInArray);
@@ -151,7 +156,7 @@ export const LocationListService = implementService.withConfig()(LocationListSer
151
156
  * });
152
157
  * ```
153
158
  */
154
- export async function loadLocationListServiceInitialData(options) {
159
+ async function loadLocationListServiceInitialData(options) {
155
160
  try {
156
161
  // If locations are passed directly, use them (flags auto-detected if not provided)
157
162
  if (options?.locations) {
@@ -165,7 +170,7 @@ export async function loadLocationListServiceInitialData(options) {
165
170
  };
166
171
  }
167
172
  // Otherwise, fetch from API
168
- const result = await queryLocations();
173
+ const result = await (0, index_js_1.queryLocations)();
169
174
  return {
170
175
  type: 'success',
171
176
  config: {
@@ -199,14 +204,17 @@ export async function loadLocationListServiceInitialData(options) {
199
204
  * );
200
205
  * ```
201
206
  */
202
- export const locationListServiceBinding = (servicesConfigs) => {
207
+ const locationListServiceBinding = (servicesConfigs) => {
203
208
  return [
204
- LocationListServiceDefinition,
205
- LocationListService,
209
+ location_list_def_js_1.LocationListServiceDefinition,
210
+ exports.LocationListService,
206
211
  servicesConfigs['location-list'],
207
212
  ];
208
213
  };
214
+ exports.locationListServiceBinding = locationListServiceBinding;
209
215
  // ============================================================================
210
216
  // Re-exports
211
217
  // ============================================================================
212
- export { LocationListServiceDefinition, LocationType, } from './location-list.def.js';
218
+ var location_list_def_js_2 = require("./location-list.def.js");
219
+ Object.defineProperty(exports, "LocationListServiceDefinition", { enumerable: true, get: function () { return location_list_def_js_2.LocationListServiceDefinition; } });
220
+ Object.defineProperty(exports, "LocationType", { enumerable: true, get: function () { return location_list_def_js_2.LocationType; } });
@@ -1,9 +1,12 @@
1
+ "use strict";
1
2
  /**
2
3
  * Payment Service Definition
3
4
  * Defines interfaces and service contract for payment calculation management
4
5
  */
5
- import { defineService } from '@wix/services-definitions';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.PaymentServiceDefinition = void 0;
8
+ const services_definitions_1 = require("@wix/services-definitions");
6
9
  // ============================================================================
7
10
  // Service Definition
8
11
  // ============================================================================
9
- export const PaymentServiceDefinition = defineService('payment');
12
+ exports.PaymentServiceDefinition = (0, services_definitions_1.defineService)('payment');
@@ -1,23 +1,28 @@
1
+ "use strict";
1
2
  /**
2
3
  * Payment Service - Pricing calculation and payment details management
3
4
  * Handles calculating total prices, taxes, discounts, and deposit information
4
5
  * Supports two modes: SSR (config with pre-fetched data) and lazy loading (reactive)
5
6
  */
6
- import { implementService } from '@wix/services-definitions';
7
- import { SignalsServiceDefinition } from '@wix/services-definitions/core-services/signals';
8
- import { calculateTotals, } from '@wix/auto_sdk_ecom_totals-calculator';
9
- import { BookingServiceDefinition } from '../booking/booking.js';
10
- import { RateType } from '@wix/auto_sdk_bookings_services';
11
- import { PaymentServiceDefinition, } from './payment.def.js';
12
- import { generateLineItemId } from '../../utils/guid.js';
13
- export { PaymentServiceDefinition, } from './payment.def.js';
14
- import { BOOKING_APP_ID } from '../constants.js';
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PaymentService = exports.PaymentServiceDefinition = void 0;
9
+ exports.loadPaymentConfig = loadPaymentConfig;
10
+ const services_definitions_1 = require("@wix/services-definitions");
11
+ const signals_1 = require("@wix/services-definitions/core-services/signals");
12
+ const auto_sdk_ecom_totals_calculator_1 = require("@wix/auto_sdk_ecom_totals-calculator");
13
+ const booking_js_1 = require("../booking/booking.js");
14
+ const auto_sdk_bookings_services_1 = require("@wix/auto_sdk_bookings_services");
15
+ const payment_def_js_1 = require("./payment.def.js");
16
+ const guid_js_1 = require("../../utils/guid.js");
17
+ var payment_def_js_2 = require("./payment.def.js");
18
+ Object.defineProperty(exports, "PaymentServiceDefinition", { enumerable: true, get: function () { return payment_def_js_2.PaymentServiceDefinition; } });
19
+ const constants_js_1 = require("../constants.js");
15
20
  // ============================================================================
16
21
  // Helper Functions
17
22
  // ============================================================================
18
23
  function getAdditionalInfo(service, lineItemId) {
19
24
  const payment = service.payment;
20
- const customPrice = payment?.rateType === RateType.CUSTOM && payment.custom?.description
25
+ const customPrice = payment?.rateType === auto_sdk_bookings_services_1.RateType.CUSTOM && payment.custom?.description
21
26
  ? payment.custom.description
22
27
  : undefined;
23
28
  return { lineItemId, customPrice };
@@ -49,7 +54,7 @@ function buildLineItem(service, totalParticipants, lineItemId) {
49
54
  _id: lineItemId,
50
55
  catalogReference: {
51
56
  catalogItemId: service._id || '',
52
- appId: BOOKING_APP_ID,
57
+ appId: constants_js_1.BOOKING_APP_ID,
53
58
  },
54
59
  price: String(price),
55
60
  ...(deposit ? { depositAmount: String(deposit) } : {}),
@@ -61,10 +66,10 @@ async function calculatePaymentDetails(pricingServiceSelections, totalParticipan
61
66
  // Ensure all booking services have a lineItemId
62
67
  const data = pricingServiceSelections.map((selection) => ({
63
68
  ...selection,
64
- lineItemId: selection.lineItemId || generateLineItemId(),
69
+ lineItemId: selection.lineItemId || (0, guid_js_1.generateLineItemId)(),
65
70
  }));
66
71
  const lineItems = data.map((item) => buildLineItem(item.service, totalParticipants, item.lineItemId));
67
- const response = await calculateTotals({
72
+ const response = await (0, auto_sdk_ecom_totals_calculator_1.calculateTotals)({
68
73
  lineItems,
69
74
  });
70
75
  const additionalInfoList = data.map((item) => getAdditionalInfo(item.service, item.lineItemId));
@@ -78,12 +83,12 @@ async function calculatePaymentDetails(pricingServiceSelections, totalParticipan
78
83
  // ============================================================================
79
84
  // Service Implementation
80
85
  // ============================================================================
81
- export const PaymentService = implementService.withConfig()(PaymentServiceDefinition, ({ getService, config }) => {
82
- const signalsService = getService(SignalsServiceDefinition);
86
+ exports.PaymentService = services_definitions_1.implementService.withConfig()(payment_def_js_1.PaymentServiceDefinition, ({ getService, config }) => {
87
+ const signalsService = getService(signals_1.SignalsServiceDefinition);
83
88
  // Try to get BookingService (optional - for reactive mode)
84
89
  let bookingService = null;
85
90
  try {
86
- bookingService = getService(BookingServiceDefinition);
91
+ bookingService = getService(booking_js_1.BookingServiceDefinition);
87
92
  }
88
93
  catch {
89
94
  bookingService = null;
@@ -158,7 +163,7 @@ export const PaymentService = implementService.withConfig()(PaymentServiceDefini
158
163
  * @param params.pricingServiceSelections - Pricing service selections for calculation
159
164
  * @param params.totalParticipants - Number of participants (default: 1)
160
165
  */
161
- export async function loadPaymentConfig(params) {
166
+ async function loadPaymentConfig(params) {
162
167
  try {
163
168
  const { pricingServiceSelections, totalParticipants = 1 } = params;
164
169
  if (!pricingServiceSelections.length) {
@@ -1,24 +1,28 @@
1
+ "use strict";
1
2
  /**
2
3
  * Service Service - Reactive service data management
3
4
  * Handles loading and managing a single service's data, loading state, and errors.
4
5
  */
5
- import { defineService, implementService } from '@wix/services-definitions';
6
- import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
7
- import { ServiceType, RateType, } from '@wix/auto_sdk_bookings_services';
8
- import { getServiceById, getServiceBySlug, } from '../../api/query-services/index.js';
9
- import { BookingServiceDefinition } from '../booking/booking.js';
10
- import { convertToMoneyData } from '../../utils/money.js';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ServiceService = exports.ServiceServiceDefinition = void 0;
8
+ exports.loadServiceServiceInitialData = loadServiceServiceInitialData;
9
+ const services_definitions_1 = require("@wix/services-definitions");
10
+ const signals_1 = require("@wix/services-definitions/core-services/signals");
11
+ const auto_sdk_bookings_services_1 = require("@wix/auto_sdk_bookings_services");
12
+ const index_js_1 = require("../../api/query-services/index.js");
13
+ const booking_js_1 = require("../booking/booking.js");
14
+ const money_js_1 = require("../../utils/money.js");
11
15
  /**
12
16
  * Booking app ID constant
13
17
  */
14
- import { BOOKING_APP_ID } from '../constants.js';
18
+ const constants_js_1 = require("../constants.js");
15
19
  /**
16
20
  * Service definition for the Service service.
17
21
  * This defines the contract that the ServiceService must implement.
18
22
  *
19
23
  * @constant
20
24
  */
21
- export const ServiceServiceDefinition = defineService('service');
25
+ exports.ServiceServiceDefinition = (0, services_definitions_1.defineService)('service');
22
26
  /**
23
27
  * Implementation of the Service service that manages reactive service data.
24
28
  * This service provides signals for service data, loading state, and error handling,
@@ -52,14 +56,14 @@ export const ServiceServiceDefinition = defineService('service');
52
56
  * }
53
57
  * ```
54
58
  */
55
- export const ServiceService = implementService.withConfig()(ServiceServiceDefinition, ({ getService, config }) => {
56
- const signalsService = getService(SignalsServiceDefinition);
59
+ exports.ServiceService = services_definitions_1.implementService.withConfig()(exports.ServiceServiceDefinition, ({ getService, config }) => {
60
+ const signalsService = getService(signals_1.SignalsServiceDefinition);
57
61
  // Determine if we're in "from booking signal" mode (no service config provided)
58
62
  const noExplicitService = !config.service && !config.serviceId && !config.serviceSlug;
59
63
  // Try to get BookingService (optional dependency for showcase mode)
60
64
  let bookingService = null;
61
65
  try {
62
- bookingService = getService(BookingServiceDefinition);
66
+ bookingService = getService(booking_js_1.BookingServiceDefinition);
63
67
  }
64
68
  catch {
65
69
  // BookingService not available - showcase mode
@@ -89,10 +93,10 @@ export const ServiceService = implementService.withConfig()(ServiceServiceDefini
89
93
  const isLoadingSignal = signalsService.signal(!!config.serviceId);
90
94
  const errorSignal = signalsService.signal(null);
91
95
  // Default appId to BOOKING_APP_ID if not provided
92
- const appId = config.appId ?? BOOKING_APP_ID;
96
+ const appId = config.appId ?? constants_js_1.BOOKING_APP_ID;
93
97
  // bookable signal - true if appId equals booking app ID
94
98
  const bookableSignal = signalsService.computed(() => {
95
- return appId === BOOKING_APP_ID;
99
+ return appId === constants_js_1.BOOKING_APP_ID;
96
100
  });
97
101
  // selected signal - true if current service is in BookingService preferences
98
102
  const selectedSignal = signalsService.computed(() => {
@@ -108,8 +112,8 @@ export const ServiceService = implementService.withConfig()(ServiceServiceDefini
108
112
  const requiresAvailabilitySignal = signalsService.computed(() => {
109
113
  const currentService = serviceSignal.get();
110
114
  const serviceType = currentService.type;
111
- return (serviceType === ServiceType.APPOINTMENT ||
112
- serviceType === ServiceType.CLASS);
115
+ return (serviceType === auto_sdk_bookings_services_1.ServiceType.APPOINTMENT ||
116
+ serviceType === auto_sdk_bookings_services_1.ServiceType.CLASS);
113
117
  });
114
118
  // paymentData signal - computed payment data from service
115
119
  const paymentDataSignal = signalsService.computed(() => {
@@ -124,21 +128,21 @@ export const ServiceService = implementService.withConfig()(ServiceServiceDefini
124
128
  // Extract pricing based on rate type
125
129
  if (payment) {
126
130
  switch (rateType) {
127
- case RateType.FIXED:
131
+ case auto_sdk_bookings_services_1.RateType.FIXED:
128
132
  // FIXED: Use payment.fixed.price
129
- money = convertToMoneyData(payment.fixed?.price);
133
+ money = (0, money_js_1.convertToMoneyData)(payment.fixed?.price);
130
134
  break;
131
- case RateType.VARIED:
135
+ case auto_sdk_bookings_services_1.RateType.VARIED:
132
136
  // VARIED: Use defaultPrice as money, plus min/max for range
133
- money = convertToMoneyData(payment.varied?.defaultPrice);
134
- minPrice = convertToMoneyData(payment.varied?.minPrice);
135
- maxPrice = convertToMoneyData(payment.varied?.maxPrice);
137
+ money = (0, money_js_1.convertToMoneyData)(payment.varied?.defaultPrice);
138
+ minPrice = (0, money_js_1.convertToMoneyData)(payment.varied?.minPrice);
139
+ maxPrice = (0, money_js_1.convertToMoneyData)(payment.varied?.maxPrice);
136
140
  break;
137
- case RateType.CUSTOM:
141
+ case auto_sdk_bookings_services_1.RateType.CUSTOM:
138
142
  // CUSTOM: Use description text (no numeric price)
139
143
  priceDescription = payment.custom?.description || null;
140
144
  break;
141
- case RateType.NO_FEE:
145
+ case auto_sdk_bookings_services_1.RateType.NO_FEE:
142
146
  // NO_FEE: Free service (amount = 0)
143
147
  money = { amount: 0, currency: 'USD' };
144
148
  break;
@@ -164,7 +168,7 @@ export const ServiceService = implementService.withConfig()(ServiceServiceDefini
164
168
  const loadServiceById = async (id) => {
165
169
  isLoadingSignal.set(true);
166
170
  errorSignal.set(null);
167
- const serviceResponse = await getServiceById(id, appId);
171
+ const serviceResponse = await (0, index_js_1.getServiceById)(id, appId);
168
172
  if (!serviceResponse.service) {
169
173
  errorSignal.set('Service not found');
170
174
  isLoadingSignal.set(false);
@@ -178,7 +182,7 @@ export const ServiceService = implementService.withConfig()(ServiceServiceDefini
178
182
  const loadServiceBySlug = async (slug) => {
179
183
  isLoadingSignal.set(true);
180
184
  errorSignal.set(null);
181
- const serviceResponse = await getServiceBySlug(slug, appId);
185
+ const serviceResponse = await (0, index_js_1.getServiceBySlug)(slug, appId);
182
186
  if (!serviceResponse.service) {
183
187
  errorSignal.set('Service not found');
184
188
  isLoadingSignal.set(false);
@@ -271,16 +275,16 @@ export const ServiceService = implementService.withConfig()(ServiceServiceDefini
271
275
  * const serviceConfig = serviceResult.config;
272
276
  * ```
273
277
  */
274
- export async function loadServiceServiceInitialData(params) {
278
+ async function loadServiceServiceInitialData(params) {
275
279
  try {
276
280
  // Default appId to BOOKING_APP_ID if not provided
277
- const finalAppId = params.appId ?? BOOKING_APP_ID;
281
+ const finalAppId = params.appId ?? constants_js_1.BOOKING_APP_ID;
278
282
  let serviceResponse;
279
283
  if ('slug' in params) {
280
- serviceResponse = await getServiceBySlug(params.slug, finalAppId);
284
+ serviceResponse = await (0, index_js_1.getServiceBySlug)(params.slug, finalAppId);
281
285
  }
282
286
  else {
283
- serviceResponse = await getServiceById(params.serviceId, finalAppId);
287
+ serviceResponse = await (0, index_js_1.getServiceById)(params.serviceId, finalAppId);
284
288
  }
285
289
  if (!serviceResponse.service) {
286
290
  return { type: 'notFound' };
@@ -1,13 +1,17 @@
1
+ "use strict";
1
2
  /**
2
3
  * ServiceList Service - Reactive service list data management
3
4
  * Handles querying and pagination of services list (NO selection management)
4
5
  */
5
- import { defineService, implementService } from '@wix/services-definitions';
6
- import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
7
- import { queryServices } from '../../api/query-services/index.js';
8
- import { queryCategories, } from '../../api/query-categories/index.js';
9
- import { BookingServiceDefinition } from '../booking/booking.js';
10
- import { BOOKING_APP_ID } from '../constants.js';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ServiceListService = exports.ServiceListServiceDefinition = void 0;
8
+ exports.loadServiceListServiceInitialData = loadServiceListServiceInitialData;
9
+ const services_definitions_1 = require("@wix/services-definitions");
10
+ const signals_1 = require("@wix/services-definitions/core-services/signals");
11
+ const index_js_1 = require("../../api/query-services/index.js");
12
+ const index_js_2 = require("../../api/query-categories/index.js");
13
+ const booking_js_1 = require("../booking/booking.js");
14
+ const constants_js_1 = require("../constants.js");
11
15
  /**
12
16
  * Default query limit
13
17
  */
@@ -15,7 +19,7 @@ const DEFAULT_QUERY_LIMIT = 100;
15
19
  /**
16
20
  * Service definition for the ServiceList service
17
21
  */
18
- export const ServiceListServiceDefinition = defineService('service-list');
22
+ exports.ServiceListServiceDefinition = (0, services_definitions_1.defineService)('service-list');
19
23
  /**
20
24
  * Implementation of the ServiceList service that manages reactive services list data.
21
25
  * This service provides signals for services data, query options, pagination metadata
@@ -69,11 +73,11 @@ export const ServiceListServiceDefinition = defineService('service-list');
69
73
  * }
70
74
  * ```
71
75
  */
72
- export const ServiceListService = implementService.withConfig()(ServiceListServiceDefinition, ({ getService, config }) => {
73
- const signalsService = getService(SignalsServiceDefinition);
74
- const bookingService = getService(BookingServiceDefinition);
76
+ exports.ServiceListService = services_definitions_1.implementService.withConfig()(exports.ServiceListServiceDefinition, ({ getService, config }) => {
77
+ const signalsService = getService(signals_1.SignalsServiceDefinition);
78
+ const bookingService = getService(booking_js_1.BookingServiceDefinition);
75
79
  // Default appId to BOOKING_APP_ID if not provided
76
- const appId = config.options?.appId ?? BOOKING_APP_ID;
80
+ const appId = config.options?.appId ?? constants_js_1.BOOKING_APP_ID;
77
81
  // Check if services are provided (showcase mode vs query mode)
78
82
  const hasInitialServices = config.services && config.services.length > 0;
79
83
  // Check if categories are provided (from SSR prefetch)
@@ -180,7 +184,7 @@ export const ServiceListService = implementService.withConfig()(ServiceListServi
180
184
  const effectiveFilter = effectiveFilterSignal.peek();
181
185
  isLoadingSignal.set(true);
182
186
  Promise.all([
183
- queryServices({
187
+ (0, index_js_1.queryServices)({
184
188
  appId: initialQueryOptions.appId,
185
189
  filter: effectiveFilter,
186
190
  pagingMetadata: {
@@ -189,7 +193,7 @@ export const ServiceListService = implementService.withConfig()(ServiceListServi
189
193
  },
190
194
  sort: initialQueryOptions.sort,
191
195
  }),
192
- !hasInitialCategories ? queryCategories() : Promise.resolve(null),
196
+ !hasInitialCategories ? (0, index_js_2.queryCategories)() : Promise.resolve(null),
193
197
  ])
194
198
  .then(([servicesResult, categoriesResult]) => {
195
199
  servicesSignal.set(servicesResult.services);
@@ -225,7 +229,7 @@ export const ServiceListService = implementService.withConfig()(ServiceListServi
225
229
  isLoadingSignal.set(true);
226
230
  servicesSignal.set([]);
227
231
  errorSignal.set(null);
228
- const result = await queryServices({
232
+ const result = await (0, index_js_1.queryServices)({
229
233
  appId: queryOptions.appId,
230
234
  filter: effectiveFilter,
231
235
  pagingMetadata: {
@@ -260,7 +264,7 @@ export const ServiceListService = implementService.withConfig()(ServiceListServi
260
264
  try {
261
265
  isLoadingSignal.set(true);
262
266
  errorSignal.set(null);
263
- const result = await queryServices({
267
+ const result = await (0, index_js_1.queryServices)({
264
268
  appId: currentQueryOptions.appId,
265
269
  filter: effectiveFilter,
266
270
  pagingMetadata: nextPaging,
@@ -373,17 +377,17 @@ export const ServiceListService = implementService.withConfig()(ServiceListServi
373
377
  * }
374
378
  * ```
375
379
  */
376
- export async function loadServiceListServiceInitialData(options) {
380
+ async function loadServiceListServiceInitialData(options) {
377
381
  try {
378
382
  // Fetch services and categories in parallel
379
383
  const [servicesResult, categoriesResult] = await Promise.all([
380
- queryServices({
384
+ (0, index_js_1.queryServices)({
381
385
  appId: options.appId,
382
386
  filter: options.filter,
383
387
  pagingMetadata: options.pagingMetadata,
384
388
  sort: options.sort,
385
389
  }),
386
- queryCategories(),
390
+ (0, index_js_2.queryCategories)(),
387
391
  ]);
388
392
  return {
389
393
  type: 'success',
@@ -1,14 +1,17 @@
1
+ "use strict";
1
2
  /**
2
3
  * Staff Member List Service Definition
3
4
  * Defines types and service interface for managing staff member lists
4
5
  *
5
6
  * @module Services/StaffMemberList/Definition
6
7
  */
7
- import { defineService } from '@wix/services-definitions';
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.StaffMemberListServiceDefinition = void 0;
10
+ const services_definitions_1 = require("@wix/services-definitions");
8
11
  // ============================================================================
9
12
  // Service Definition
10
13
  // ============================================================================
11
14
  /**
12
15
  * Service definition for StaffMemberList
13
16
  */
14
- export const StaffMemberListServiceDefinition = defineService('staff-member-list');
17
+ exports.StaffMemberListServiceDefinition = (0, services_definitions_1.defineService)('staff-member-list');
@@ -1,12 +1,16 @@
1
+ "use strict";
1
2
  /**
2
3
  * Staff Member List Service Implementation
3
4
  * Manages staff member state and BookingService integration
4
5
  *
5
6
  * @module Services/StaffMemberList
6
7
  */
7
- import { implementService } from '@wix/services-definitions';
8
- import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
9
- import { StaffMemberListServiceDefinition, } from './staff-member-list.def.js';
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.StaffMemberListServiceDefinition = exports.staffMemberListServiceBinding = exports.StaffMemberListService = void 0;
10
+ exports.loadStaffMemberListServiceInitialData = loadStaffMemberListServiceInitialData;
11
+ const services_definitions_1 = require("@wix/services-definitions");
12
+ const signals_1 = require("@wix/services-definitions/core-services/signals");
13
+ const staff_member_list_def_js_1 = require("./staff-member-list.def.js");
10
14
  // ============================================================================
11
15
  // Service Implementation
12
16
  // ============================================================================
@@ -14,8 +18,8 @@ import { StaffMemberListServiceDefinition, } from './staff-member-list.def.js';
14
18
  * Implementation of the StaffMemberList service
15
19
  * Manages staff member state for display purposes
16
20
  */
17
- export const StaffMemberListService = implementService.withConfig()(StaffMemberListServiceDefinition, ({ getService, config }) => {
18
- const signalsService = getService(SignalsServiceDefinition);
21
+ exports.StaffMemberListService = services_definitions_1.implementService.withConfig()(staff_member_list_def_js_1.StaffMemberListServiceDefinition, ({ getService, config }) => {
22
+ const signalsService = getService(signals_1.SignalsServiceDefinition);
19
23
  // Initialize staff members signal
20
24
  const staffMembersSignal = signalsService.signal(config.staffMembers || []);
21
25
  // Has staff members signal
@@ -59,7 +63,7 @@ export const StaffMemberListService = implementService.withConfig()(StaffMemberL
59
63
  * const staffMemberListConfig = result.config;
60
64
  * ```
61
65
  */
62
- export async function loadStaffMemberListServiceInitialData(options) {
66
+ async function loadStaffMemberListServiceInitialData(options) {
63
67
  try {
64
68
  return {
65
69
  type: 'success',
@@ -92,14 +96,16 @@ export async function loadStaffMemberListServiceInitialData(options) {
92
96
  * );
93
97
  * ```
94
98
  */
95
- export const staffMemberListServiceBinding = (servicesConfigs) => {
99
+ const staffMemberListServiceBinding = (servicesConfigs) => {
96
100
  return [
97
- StaffMemberListServiceDefinition,
98
- StaffMemberListService,
101
+ staff_member_list_def_js_1.StaffMemberListServiceDefinition,
102
+ exports.StaffMemberListService,
99
103
  servicesConfigs['staff-member-list'],
100
104
  ];
101
105
  };
106
+ exports.staffMemberListServiceBinding = staffMemberListServiceBinding;
102
107
  // ============================================================================
103
108
  // Re-exports
104
109
  // ============================================================================
105
- export { StaffMemberListServiceDefinition, } from './staff-member-list.def.js';
110
+ var staff_member_list_def_js_2 = require("./staff-member-list.def.js");
111
+ Object.defineProperty(exports, "StaffMemberListServiceDefinition", { enumerable: true, get: function () { return staff_member_list_def_js_2.StaffMemberListServiceDefinition; } });
@@ -1,7 +1,16 @@
1
+ "use strict";
1
2
  /**
2
3
  * TimeSlotList Service
3
4
  * Main export file for time slot list service
4
5
  */
5
- export { TimeSlotListServiceDefinition, ViewMode, } from './time-slot-list.def.js';
6
- export { TimeSlotListService, loadTimeSlotListConfig, } from './time-slot-list.js';
7
- export { TimeSlotService, TimeSlotServiceDefinition, } from './time-slot.js';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.TimeSlotServiceDefinition = exports.TimeSlotService = exports.loadTimeSlotListConfig = exports.TimeSlotListService = exports.ViewMode = exports.TimeSlotListServiceDefinition = void 0;
8
+ var time_slot_list_def_js_1 = require("./time-slot-list.def.js");
9
+ Object.defineProperty(exports, "TimeSlotListServiceDefinition", { enumerable: true, get: function () { return time_slot_list_def_js_1.TimeSlotListServiceDefinition; } });
10
+ Object.defineProperty(exports, "ViewMode", { enumerable: true, get: function () { return time_slot_list_def_js_1.ViewMode; } });
11
+ var time_slot_list_js_1 = require("./time-slot-list.js");
12
+ Object.defineProperty(exports, "TimeSlotListService", { enumerable: true, get: function () { return time_slot_list_js_1.TimeSlotListService; } });
13
+ Object.defineProperty(exports, "loadTimeSlotListConfig", { enumerable: true, get: function () { return time_slot_list_js_1.loadTimeSlotListConfig; } });
14
+ var time_slot_js_1 = require("./time-slot.js");
15
+ Object.defineProperty(exports, "TimeSlotService", { enumerable: true, get: function () { return time_slot_js_1.TimeSlotService; } });
16
+ Object.defineProperty(exports, "TimeSlotServiceDefinition", { enumerable: true, get: function () { return time_slot_js_1.TimeSlotServiceDefinition; } });
@@ -1,18 +1,21 @@
1
+ "use strict";
1
2
  /**
2
3
  * TimeSlotList Service Definition
3
4
  * Defines interfaces and service contract for time slot management
4
5
  */
5
- import { defineService } from '@wix/services-definitions';
6
- import { ClientServiceIds } from '../constants.js';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.TimeSlotListServiceDefinition = exports.ViewMode = void 0;
8
+ const services_definitions_1 = require("@wix/services-definitions");
9
+ const constants_js_1 = require("../constants.js");
7
10
  // ============================================================================
8
11
  // Enums
9
12
  // ============================================================================
10
- export var ViewMode;
13
+ var ViewMode;
11
14
  (function (ViewMode) {
12
15
  ViewMode["CLASSIC"] = "classic";
13
16
  ViewMode["AGENDA"] = "agenda";
14
- })(ViewMode || (ViewMode = {}));
17
+ })(ViewMode || (exports.ViewMode = ViewMode = {}));
15
18
  // ============================================================================
16
19
  // Service Definition
17
20
  // ============================================================================
18
- export const TimeSlotListServiceDefinition = defineService(ClientServiceIds.timeSlotList);
21
+ exports.TimeSlotListServiceDefinition = (0, services_definitions_1.defineService)(constants_js_1.ClientServiceIds.timeSlotList);