@wix/headless-bookings 0.0.105 → 0.0.107

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 (76) 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.js +56 -15
  19. package/cjs/dist/react/booking-form/BookingForm.js +63 -21
  20. package/cjs/dist/react/core/booking/Book.js +14 -11
  21. package/cjs/dist/react/core/booking/Booking.js +35 -23
  22. package/cjs/dist/react/core/booking-form/BookingForm.js +63 -26
  23. package/cjs/dist/react/core/location/Location.js +60 -21
  24. package/cjs/dist/react/core/location-list/LocationList.js +15 -10
  25. package/cjs/dist/react/core/payment/Payment.js +41 -30
  26. package/cjs/dist/react/core/service/Service.js +28 -19
  27. package/cjs/dist/react/core/service/ServiceMediaCover.js +7 -4
  28. package/cjs/dist/react/core/service/ServiceMediaGallery.js +7 -4
  29. package/cjs/dist/react/core/service/ServiceMediaMain.js +7 -4
  30. package/cjs/dist/react/core/service-list/ServiceList.js +12 -8
  31. package/cjs/dist/react/core/service-list/ServiceListFilter.js +9 -6
  32. package/cjs/dist/react/core/staff-member/StaffMember.js +20 -14
  33. package/cjs/dist/react/core/staff-member-list/StaffMemberList.js +19 -14
  34. package/cjs/dist/react/core/time-slot-list/TimeSlot.js +41 -28
  35. package/cjs/dist/react/core/time-slot-list/TimeSlotList.js +21 -15
  36. package/cjs/dist/react/index.js +49 -13
  37. package/cjs/dist/react/location/Location.js +76 -36
  38. package/cjs/dist/react/location/LocationList.js +70 -31
  39. package/cjs/dist/react/payment/Payment.js +87 -48
  40. package/cjs/dist/react/service/Service.js +197 -158
  41. package/cjs/dist/react/service/ServiceMedia.js +56 -17
  42. package/cjs/dist/react/service-list/ServiceList.js +71 -32
  43. package/cjs/dist/react/staff-member/StaffMember.js +61 -20
  44. package/cjs/dist/react/staff-member/StaffMemberList.js +68 -29
  45. package/cjs/dist/react/time-slot-list/TimeSlot.js +95 -56
  46. package/cjs/dist/react/time-slot-list/TimeSlotList.js +87 -48
  47. package/cjs/dist/services/booking/book-action/bookAction.js +21 -18
  48. package/cjs/dist/services/booking/book-action/buildBookingRequest.js +18 -15
  49. package/cjs/dist/services/booking/book-action/buildCheckoutRequest.js +8 -5
  50. package/cjs/dist/services/booking/book-action/canBook.js +4 -1
  51. package/cjs/dist/services/booking/book-action/index.js +15 -6
  52. package/cjs/dist/services/booking/book-action/isCheckoutRequired.js +4 -1
  53. package/cjs/dist/services/booking/book-action/types.js +5 -2
  54. package/cjs/dist/services/booking/booking.js +11 -8
  55. package/cjs/dist/services/booking-form/booking-form.js +26 -18
  56. package/cjs/dist/services/booking-form/utils.js +10 -4
  57. package/cjs/dist/services/constants.js +6 -3
  58. package/cjs/dist/services/index.js +48 -10
  59. package/cjs/dist/services/location-list/location-list.def.js +7 -5
  60. package/cjs/dist/services/location-list/location-list.js +31 -23
  61. package/cjs/dist/services/payment/payment.def.js +5 -2
  62. package/cjs/dist/services/payment/payment.js +22 -17
  63. package/cjs/dist/services/service/service.js +33 -29
  64. package/cjs/dist/services/service-list/service-list.js +22 -18
  65. package/cjs/dist/services/staff-member-list/staff-member-list.def.js +5 -2
  66. package/cjs/dist/services/staff-member-list/staff-member-list.js +16 -10
  67. package/cjs/dist/services/time-slot-list/index.js +12 -3
  68. package/cjs/dist/services/time-slot-list/time-slot-list.def.js +8 -5
  69. package/cjs/dist/services/time-slot-list/time-slot-list.js +24 -19
  70. package/cjs/dist/services/time-slot-list/time-slot.js +9 -6
  71. package/cjs/dist/utils/dateAndTime.js +7 -2
  72. package/cjs/dist/utils/guid.js +4 -1
  73. package/cjs/dist/utils/index.js +5 -1
  74. package/cjs/dist/utils/money.js +6 -2
  75. package/cjs/dist/utils/navigation.js +6 -3
  76. package/package.json +4 -4
@@ -1,25 +1,30 @@
1
+ "use strict";
1
2
  /**
2
3
  * Query Services API
3
4
  * Fetches single or multiple services with pagination and sorting
4
5
  */
5
- import { queryServices as queryServicesApi, LocationType, } from '@wix/auto_sdk_bookings_services';
6
- import { BOOKING_APP_ID } from '../../services/constants.js';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getServiceBySlug = exports.getServiceById = exports.SYNTHETIC_CUSTOMER_ID = exports.SYNTHETIC_CUSTOM_ID = void 0;
8
+ exports.convertPlatformFilterToApiFilter = convertPlatformFilterToApiFilter;
9
+ exports.queryServices = queryServices;
10
+ const auto_sdk_bookings_services_1 = require("@wix/auto_sdk_bookings_services");
11
+ const constants_js_1 = require("../../services/constants.js");
7
12
  /**
8
13
  * Synthetic location ID constants for non-business locations
9
14
  */
10
- export const SYNTHETIC_CUSTOM_ID = 'custom';
11
- export const SYNTHETIC_CUSTOMER_ID = 'customer';
15
+ exports.SYNTHETIC_CUSTOM_ID = 'custom';
16
+ exports.SYNTHETIC_CUSTOMER_ID = 'customer';
12
17
  /**
13
18
  * Fetches a service by its ID
14
19
  * @param id - The service ID
15
20
  * @param appId - Optional app ID, defaults to booking app ID
16
21
  * @returns Object containing the service or null if not found
17
22
  */
18
- export const getServiceById = async (id, appId) => {
23
+ const getServiceById = async (id, appId) => {
19
24
  try {
20
- const finalAppId = appId ?? BOOKING_APP_ID;
25
+ const finalAppId = appId ?? constants_js_1.BOOKING_APP_ID;
21
26
  // Query services where _id equals the provided id and appId matches
22
- const query = queryServicesApi({
27
+ const query = (0, auto_sdk_bookings_services_1.queryServices)({
23
28
  conditionalFields: ['STAFF_MEMBER_DETAILS'],
24
29
  });
25
30
  const result = await query
@@ -36,17 +41,18 @@ export const getServiceById = async (id, appId) => {
36
41
  return { service: null };
37
42
  }
38
43
  };
44
+ exports.getServiceById = getServiceById;
39
45
  /**
40
46
  * Fetches a service by its slug
41
47
  * @param slug - The service slug
42
48
  * @param appId - Optional app ID, defaults to booking app ID
43
49
  * @returns Object containing the service or null if not found
44
50
  */
45
- export const getServiceBySlug = async (slug, appId) => {
51
+ const getServiceBySlug = async (slug, appId) => {
46
52
  try {
47
- const finalAppId = appId ?? BOOKING_APP_ID;
53
+ const finalAppId = appId ?? constants_js_1.BOOKING_APP_ID;
48
54
  // Query services where mainSlug.name equals the provided slug and appId matches
49
- const query = queryServicesApi({
55
+ const query = (0, auto_sdk_bookings_services_1.queryServices)({
50
56
  conditionalFields: ['STAFF_MEMBER_DETAILS'],
51
57
  });
52
58
  const result = await query
@@ -63,6 +69,7 @@ export const getServiceBySlug = async (slug, appId) => {
63
69
  return { service: null };
64
70
  }
65
71
  };
72
+ exports.getServiceBySlug = getServiceBySlug;
66
73
  /**
67
74
  * Extracts an array of values from a platform Filter field that may use operators like $in or $hasSome.
68
75
  * @param fieldValue - The filter field value (can be direct value, array, or operator object)
@@ -120,7 +127,7 @@ function extractArrayFromFilterField(fieldValue) {
120
127
  * }
121
128
  * ```
122
129
  */
123
- export function convertPlatformFilterToApiFilter(platformFilter) {
130
+ function convertPlatformFilterToApiFilter(platformFilter) {
124
131
  if (!platformFilter)
125
132
  return {};
126
133
  const apiFilter = {};
@@ -135,11 +142,11 @@ export function convertPlatformFilterToApiFilter(platformFilter) {
135
142
  const syntheticTypes = [];
136
143
  const businessLocationIds = [];
137
144
  for (const id of locationIds) {
138
- if (id === SYNTHETIC_CUSTOM_ID) {
139
- syntheticTypes.push(LocationType.CUSTOM);
145
+ if (id === exports.SYNTHETIC_CUSTOM_ID) {
146
+ syntheticTypes.push(auto_sdk_bookings_services_1.LocationType.CUSTOM);
140
147
  }
141
- else if (id === SYNTHETIC_CUSTOMER_ID) {
142
- syntheticTypes.push(LocationType.CUSTOMER);
148
+ else if (id === exports.SYNTHETIC_CUSTOMER_ID) {
149
+ syntheticTypes.push(auto_sdk_bookings_services_1.LocationType.CUSTOMER);
143
150
  }
144
151
  else {
145
152
  businessLocationIds.push(id);
@@ -207,7 +214,7 @@ const buildServicesQueryRequest = ({ appId, filter: platformFilter, paging, sort
207
214
  * }
208
215
  * ```
209
216
  */
210
- export async function queryServices({ appId, filter, pagingMetadata, sort, }) {
217
+ async function queryServices({ appId, filter, pagingMetadata, sort, }) {
211
218
  try {
212
219
  const queryRequest = buildServicesQueryRequest({
213
220
  appId,
@@ -217,7 +224,7 @@ export async function queryServices({ appId, filter, pagingMetadata, sort, }) {
217
224
  });
218
225
  // Call queryServices with QueryServicesRequest and execute the query
219
226
  // Include conditionalFields to fetch staff member details
220
- const result = await queryServicesApi({
227
+ const result = await (0, auto_sdk_bookings_services_1.queryServices)({
221
228
  ...queryRequest,
222
229
  conditionalFields: ['STAFF_MEMBER_DETAILS'],
223
230
  }).find();
@@ -1,13 +1,52 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Book = exports.TestIds = void 0;
40
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
41
  /**
3
42
  * Book - High-level headless component for the book action button
4
43
  * Wraps core Book with AsChildSlot pattern for customization
5
44
  */
6
- import React from 'react';
7
- import { AsChildSlot } from '@wix/headless-utils/react';
8
- import * as CoreBook from '../core/booking/Book.js';
9
- import { navigateToCheckout as navigateToCheckoutUtil } from '../../utils/navigation.js';
10
- export const TestIds = {
45
+ const react_1 = __importDefault(require("react"));
46
+ const react_2 = require("@wix/headless-utils/react");
47
+ const CoreBook = __importStar(require("../core/booking/Book.js"));
48
+ const navigation_js_1 = require("../../utils/navigation.js");
49
+ exports.TestIds = {
11
50
  bookingActionBook: 'booking-action-book',
12
51
  };
13
52
  /**
@@ -55,11 +94,11 @@ export const TestIds = {
55
94
  * </Booking.Actions.Book>
56
95
  * ```
57
96
  */
58
- export const Book = React.forwardRef((props, ref) => {
97
+ exports.Book = react_1.default.forwardRef((props, ref) => {
59
98
  const { asChild, children, label, loadingState, disabled, onCheckout, onComplete, onError, onClick, ...rest } = props;
60
- return (_jsx(CoreBook.Book, { onCheckout: (result) => {
99
+ return ((0, jsx_runtime_1.jsx)(CoreBook.Book, { onCheckout: (result) => {
61
100
  // Create navigateToCheckout with checkoutId captured
62
- const navigateToCheckout = (options) => navigateToCheckoutUtil({
101
+ const navigateToCheckout = (options) => (0, navigation_js_1.navigateToCheckout)({
63
102
  checkoutId: result.checkoutId,
64
103
  navigationInfo: { postFlowUrl: options.postFlowUrl },
65
104
  });
@@ -72,12 +111,12 @@ export const Book = React.forwardRef((props, ref) => {
72
111
  await coreBookProps.onClick();
73
112
  onClick?.(coreBookProps);
74
113
  };
75
- return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, disabled: coreBookProps.disabled, "data-testid": TestIds.bookingActionBook, "data-in-progress": coreBookProps.isLoading, "data-can-book": coreBookProps.canBook, customElement: children, customElementProps: {
114
+ return ((0, jsx_runtime_1.jsx)(react_2.AsChildSlot, { ref: ref, asChild: asChild, ...rest, disabled: coreBookProps.disabled, "data-testid": exports.TestIds.bookingActionBook, "data-in-progress": coreBookProps.isLoading, "data-can-book": coreBookProps.canBook, customElement: children, customElementProps: {
76
115
  ...coreBookProps,
77
116
  onClick: handleClick,
78
- }, children: _jsx("button", { onClick: handleClick, children: coreBookProps.isLoading
117
+ }, children: (0, jsx_runtime_1.jsx)("button", { onClick: handleClick, children: coreBookProps.isLoading
79
118
  ? loadingState
80
119
  : children || label }) }));
81
120
  } }));
82
121
  });
83
- Book.displayName = 'Booking.Actions.Book';
122
+ exports.Book.displayName = 'Booking.Actions.Book';
@@ -1,18 +1,59 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.BookingItemRepeater = exports.BookingItems = exports.useBookingItem = exports.Actions = exports.Root = exports.TestIds = void 0;
40
+ exports.Payment = Payment;
41
+ exports.Location = Location;
42
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
43
  /**
3
44
  * Booking - High-level component for managing bookings
4
45
  * Provides root component for booking context and booking item display components
5
46
  */
6
- import React from 'react';
7
- import * as CoreBooking from '../core/booking/Booking.js';
8
- import { Book } from './Book.js';
9
- import * as PaymentComponent from '../payment/Payment.js';
10
- import * as CoreLocation from '../core/location/Location.js';
11
- import { GenericList } from '@wix/headless-components/react';
47
+ const react_1 = __importDefault(require("react"));
48
+ const CoreBooking = __importStar(require("../core/booking/Booking.js"));
49
+ const Book_js_1 = require("./Book.js");
50
+ const PaymentComponent = __importStar(require("../payment/Payment.js"));
51
+ const CoreLocation = __importStar(require("../core/location/Location.js"));
52
+ const react_2 = require("@wix/headless-components/react");
12
53
  // ============================================================================
13
54
  // TestIds
14
55
  // ============================================================================
15
- export const TestIds = {
56
+ exports.TestIds = {
16
57
  bookingItemsRoot: 'booking-items-root',
17
58
  bookingItems: 'booking-items',
18
59
  bookingItem: 'booking-item',
@@ -40,11 +81,12 @@ export const TestIds = {
40
81
  * }
41
82
  * ```
42
83
  */
43
- export const Root = (props) => {
84
+ const Root = (props) => {
44
85
  const { children, bookingServiceConfig = {} } = props;
45
- return (_jsx(CoreBooking.Root, { bookingServiceConfig: bookingServiceConfig, children: children }));
86
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.Root, { bookingServiceConfig: bookingServiceConfig, children: children }));
46
87
  };
47
- Root.displayName = 'Booking.Root';
88
+ exports.Root = Root;
89
+ exports.Root.displayName = 'Booking.Root';
48
90
  // ============================================================================
49
91
  // Actions Namespace
50
92
  // ============================================================================
@@ -64,8 +106,8 @@ Root.displayName = 'Booking.Root';
64
106
  * />
65
107
  * ```
66
108
  */
67
- export const Actions = {
68
- Book,
109
+ exports.Actions = {
110
+ Book: Book_js_1.Book,
69
111
  };
70
112
  // ============================================================================
71
113
  // BookingItem Context (re-export from core)
@@ -76,7 +118,7 @@ export const Actions = {
76
118
  *
77
119
  * @throws Error if used outside of BookingItemRepeater context
78
120
  */
79
- export const useBookingItem = CoreBooking.useBookingItemContext;
121
+ exports.useBookingItem = CoreBooking.useBookingItemContext;
80
122
  /**
81
123
  * Container component for booking items with emptyState support.
82
124
  * Provides GenericList context and renders items.
@@ -93,19 +135,19 @@ export const useBookingItem = CoreBooking.useBookingItemContext;
93
135
  * </Booking.BookingItems>
94
136
  * ```
95
137
  */
96
- export const BookingItems = React.forwardRef((props, ref) => {
138
+ exports.BookingItems = react_1.default.forwardRef((props, ref) => {
97
139
  const { children, emptyState, ...otherProps } = props;
98
- return (_jsx(CoreBooking.ItemsData, { children: ({ items }) => (_jsx(GenericList.Root, { ref: ref, items: items.map((item) => ({
140
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.ItemsData, { children: ({ items }) => ((0, jsx_runtime_1.jsx)(react_2.GenericList.Root, { ref: ref, items: items.map((item) => ({
99
141
  ...item,
100
142
  id: item.instanceId,
101
- })), hasMore: false, isLoading: false, "data-testid": TestIds.bookingItems, ...otherProps, children: _jsx(GenericList.Items, { emptyState: emptyState, children: children }) })) }));
143
+ })), hasMore: false, isLoading: false, "data-testid": exports.TestIds.bookingItems, ...otherProps, children: (0, jsx_runtime_1.jsx)(react_2.GenericList.Items, { emptyState: emptyState, children: children }) })) }));
102
144
  });
103
- BookingItems.displayName = 'Booking.BookingItems';
145
+ exports.BookingItems.displayName = 'Booking.BookingItems';
104
146
  /**
105
147
  * Internal component that wraps each booking item with context provider.
106
148
  */
107
149
  const BookingItemWrapper = ({ item, children, }) => {
108
- return (_jsx(CoreBooking.BookingItemProvider, { item: item, children: children }));
150
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.BookingItemProvider, { item: item, children: children }));
109
151
  };
110
152
  /**
111
153
  * Repeater component that maps over booking items and provides context per item.
@@ -129,11 +171,11 @@ const BookingItemWrapper = ({ item, children, }) => {
129
171
  * </Booking.BookingItemRepeater>
130
172
  * ```
131
173
  */
132
- export const BookingItemRepeater = React.forwardRef((props, ref) => {
174
+ exports.BookingItemRepeater = react_1.default.forwardRef((props, ref) => {
133
175
  const { children } = props;
134
- return (_jsx(GenericList.Repeater, { ref: ref, itemWrapper: ({ item }) => (_jsx(BookingItemWrapper, { item: item, children: children }, item.instanceId)), children: undefined }));
176
+ return ((0, jsx_runtime_1.jsx)(react_2.GenericList.Repeater, { ref: ref, itemWrapper: ({ item }) => ((0, jsx_runtime_1.jsx)(BookingItemWrapper, { item: item, children: children }, item.instanceId)), children: undefined }));
135
177
  });
136
- BookingItemRepeater.displayName = 'Booking.BookingItemRepeater';
178
+ exports.BookingItemRepeater.displayName = 'Booking.BookingItemRepeater';
137
179
  /**
138
180
  * Wraps Payment.Root with all services from all booking items.
139
181
  * Should be used outside of ItemRepeater - it calculates payment for all items.
@@ -155,9 +197,9 @@ BookingItemRepeater.displayName = 'Booking.BookingItemRepeater';
155
197
  * </Booking.Payment>
156
198
  * ```
157
199
  */
158
- export function Payment(props) {
200
+ function Payment(props) {
159
201
  const { children, asChild, className } = props;
160
- return (_jsx(CoreBooking.PaymentData, { children: ({ pricingServiceSelections }) => (_jsx(PaymentComponent.Root, { pricingServiceSelections: pricingServiceSelections, asChild: asChild, className: className, children: children })) }));
202
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.PaymentData, { children: ({ pricingServiceSelections }) => ((0, jsx_runtime_1.jsx)(PaymentComponent.Root, { pricingServiceSelections: pricingServiceSelections, asChild: asChild, className: className, children: children })) }));
161
203
  }
162
204
  /**
163
205
  * Wraps Location context with the location from the booking context.
@@ -174,7 +216,7 @@ export function Payment(props) {
174
216
  * </Booking.Location>
175
217
  * ```
176
218
  */
177
- export function Location(props) {
219
+ function Location(props) {
178
220
  const { children } = props;
179
- return (_jsx(CoreBooking.Data, { children: ({ location }) => location ? (_jsx(CoreLocation.Root, { location: location, children: children })) : null }));
221
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.Data, { children: ({ location }) => location ? ((0, jsx_runtime_1.jsx)(CoreLocation.Root, { location: location, children: children })) : null }));
180
222
  }
@@ -1,14 +1,55 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.StaffName = exports.TestIds = void 0;
40
+ exports.Service = Service;
41
+ exports.TimeSlot = TimeSlot;
42
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
43
  /**
3
44
  * BookingItem - Components for displaying booking item details
4
45
  * Must be used within Booking.BookingItemRepeater context
5
46
  */
6
- import React from 'react';
7
- import * as CoreBooking from '../core/booking/Booking.js';
8
- import { AsChildSlot } from '@wix/headless-utils/react';
9
- import * as ServiceComponent from '../service/Service.js';
10
- import * as TimeSlotComponent from '../time-slot-list/TimeSlot.js';
11
- export const TestIds = {
47
+ const react_1 = __importDefault(require("react"));
48
+ const CoreBooking = __importStar(require("../core/booking/Booking.js"));
49
+ const react_2 = require("@wix/headless-utils/react");
50
+ const ServiceComponent = __importStar(require("../service/Service.js"));
51
+ const TimeSlotComponent = __importStar(require("../time-slot-list/TimeSlot.js"));
52
+ exports.TestIds = {
12
53
  bookingItemService: 'booking-item-service',
13
54
  bookingItemTimeSlot: 'booking-item-time-slot',
14
55
  bookingItemStaffName: 'booking-item-staff-name',
@@ -26,9 +67,9 @@ export const TestIds = {
26
67
  * </BookingItem.Service>
27
68
  * ```
28
69
  */
29
- export function Service(props) {
70
+ function Service(props) {
30
71
  const { children } = props;
31
- return (_jsx(CoreBooking.BookingItemInfo, { children: ({ service }) => (_jsx(ServiceComponent.Root, { service: service, children: children })) }));
72
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.BookingItemInfo, { children: ({ service }) => ((0, jsx_runtime_1.jsx)(ServiceComponent.Root, { service: service, children: children })) }));
32
73
  }
33
74
  Service.displayName = 'BookingItem.Service';
34
75
  /**
@@ -44,9 +85,9 @@ Service.displayName = 'BookingItem.Service';
44
85
  * </BookingItem.TimeSlot>
45
86
  * ```
46
87
  */
47
- export function TimeSlot(props) {
88
+ function TimeSlot(props) {
48
89
  const { children } = props;
49
- return (_jsx(CoreBooking.BookingItemInfo, { children: ({ timeSlot }) => timeSlot ? (_jsx(TimeSlotComponent.Root, { timeSlot: timeSlot, children: children })) : null }));
90
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.BookingItemInfo, { children: ({ timeSlot }) => timeSlot ? ((0, jsx_runtime_1.jsx)(TimeSlotComponent.Root, { timeSlot: timeSlot, children: children })) : null }));
50
91
  }
51
92
  TimeSlot.displayName = 'BookingItem.TimeSlot';
52
93
  /**
@@ -59,12 +100,12 @@ TimeSlot.displayName = 'BookingItem.TimeSlot';
59
100
  * <BookingItem.StaffName className="text-foreground" />
60
101
  * ```
61
102
  */
62
- export const StaffName = React.forwardRef((props, ref) => {
103
+ exports.StaffName = react_1.default.forwardRef((props, ref) => {
63
104
  const { asChild, children, anyStaffLabel, ...rest } = props;
64
- return (_jsx(CoreBooking.BookingItemInfo, { anyStaffLabel: anyStaffLabel, children: ({ staffName }) => {
105
+ return ((0, jsx_runtime_1.jsx)(CoreBooking.BookingItemInfo, { anyStaffLabel: anyStaffLabel, children: ({ staffName }) => {
65
106
  if (!staffName)
66
107
  return null;
67
- return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.bookingItemStaffName, customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) }));
108
+ return ((0, jsx_runtime_1.jsx)(react_2.AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": exports.TestIds.bookingItemStaffName, customElement: children, customElementProps: { name: staffName }, children: (0, jsx_runtime_1.jsx)("span", { children: staffName }) }));
68
109
  } }));
69
110
  });
70
- StaffName.displayName = 'BookingItem.StaffName';
111
+ exports.StaffName.displayName = 'BookingItem.StaffName';
@@ -1,17 +1,56 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.BookingFormConfigurationError = exports.isBookingFormConfigurationError = exports.LoadError = exports.Fields = exports.Root = exports.TestIds = void 0;
40
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
41
  /**
3
42
  * BookingForm - High-level component for rendering booking forms
4
43
  * Provides components for displaying and managing booking form fields
5
44
  */
6
- import React from 'react';
7
- import { AsChildSlot } from '@wix/headless-utils/react';
8
- import { Form } from '@wix/headless-forms/react';
9
- import * as CoreBookingForm from '../core/booking-form/BookingForm.js';
10
- import { BookingFormConfigurationError } from '../../services/booking-form/booking-form.js';
45
+ const react_1 = __importDefault(require("react"));
46
+ const react_2 = require("@wix/headless-utils/react");
47
+ const react_3 = require("@wix/headless-forms/react");
48
+ const CoreBookingForm = __importStar(require("../core/booking-form/BookingForm.js"));
49
+ const booking_form_js_1 = require("../../services/booking-form/booking-form.js");
11
50
  /**
12
51
  * Internal ErrorBoundary for catching BookingFormConfigurationError
13
52
  */
14
- class BookingFormErrorBoundary extends React.Component {
53
+ class BookingFormErrorBoundary extends react_1.default.Component {
15
54
  constructor(props) {
16
55
  super(props);
17
56
  this.state = { error: null };
@@ -24,7 +63,7 @@ class BookingFormErrorBoundary extends React.Component {
24
63
  const { children, fallback } = this.props;
25
64
  if (error) {
26
65
  // If it's a configuration error, render the fallback
27
- if (error instanceof BookingFormConfigurationError) {
66
+ if (error instanceof booking_form_js_1.BookingFormConfigurationError) {
28
67
  if (typeof fallback === 'function') {
29
68
  return fallback(error);
30
69
  }
@@ -32,7 +71,7 @@ class BookingFormErrorBoundary extends React.Component {
32
71
  return fallback;
33
72
  }
34
73
  // Default fallback UI
35
- return _jsx("div", { "data-testid": "booking-form-load-error", children: error.message });
74
+ return (0, jsx_runtime_1.jsx)("div", { "data-testid": "booking-form-load-error", children: error.message });
36
75
  }
37
76
  // Re-throw non-configuration errors
38
77
  throw error;
@@ -40,7 +79,7 @@ class BookingFormErrorBoundary extends React.Component {
40
79
  return children;
41
80
  }
42
81
  }
43
- export const TestIds = {
82
+ exports.TestIds = {
44
83
  bookingFormRoot: 'booking-form-root',
45
84
  bookingFormFields: 'booking-form-fields',
46
85
  bookingFormActionValidateFormSubmission: 'booking-form-action-validate-form-submission',
@@ -111,29 +150,29 @@ export const TestIds = {
111
150
  * </BookingForm.Root>
112
151
  * ```
113
152
  */
114
- export const Root = React.forwardRef((props, ref) => {
153
+ exports.Root = react_1.default.forwardRef((props, ref) => {
115
154
  const { children, asChild, className, formId, serviceIds, additionalMetadata, fieldMap, rowGapClassname = 'gap-y-4', columnGapClassname = 'gap-x-2', loadErrorFallback, ...otherProps } = props;
116
- return (_jsx(BookingFormErrorBoundary, { fallback: loadErrorFallback, children: _jsx(CoreBookingForm.Root, { formId: formId, serviceIds: serviceIds, additionalMetadata: additionalMetadata, fieldMap: fieldMap, children: (renderProps) => {
155
+ return ((0, jsx_runtime_1.jsx)(BookingFormErrorBoundary, { fallback: loadErrorFallback, children: (0, jsx_runtime_1.jsx)(CoreBookingForm.Root, { formId: formId, serviceIds: serviceIds, additionalMetadata: additionalMetadata, fieldMap: fieldMap, children: (renderProps) => {
117
156
  // If children is a render prop function, call it with the render props
118
157
  if (typeof children === 'function') {
119
158
  return children(renderProps);
120
159
  }
121
160
  // Otherwise, use declarative pattern with context
122
- return (_jsx(BookingFormContext.Provider, { value: {
161
+ return ((0, jsx_runtime_1.jsx)(BookingFormContext.Provider, { value: {
123
162
  fields: renderProps.fields,
124
163
  rowGapClassname,
125
164
  columnGapClassname,
126
- }, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.bookingFormRoot, ...otherProps, children: _jsx("div", { children: children ?? (_jsxs(_Fragment, { children: [_jsx(Form.Loading, { className: "flex justify-center p-4 text-foreground" }), _jsx(Form.LoadingError, { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-lg mb-4" }), _jsx(Form.Fields, { fieldMap: renderProps.fields, rowGapClassname: rowGapClassname, columnGapClassname: columnGapClassname }), _jsx(Form.Error, { className: "mt-4 bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-lg" }), _jsx(Form.Submitted, { className: "mt-4 bg-green-500/10 border border-green-500/20 text-green-500 px-4 py-3 rounded-lg" })] })) }) }) }));
165
+ }, children: (0, jsx_runtime_1.jsx)(react_2.AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": exports.TestIds.bookingFormRoot, ...otherProps, children: (0, jsx_runtime_1.jsx)("div", { children: children ?? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_3.Form.Loading, { className: "flex justify-center p-4 text-foreground" }), (0, jsx_runtime_1.jsx)(react_3.Form.LoadingError, { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-lg mb-4" }), (0, jsx_runtime_1.jsx)(react_3.Form.Fields, { fieldMap: renderProps.fields, rowGapClassname: rowGapClassname, columnGapClassname: columnGapClassname }), (0, jsx_runtime_1.jsx)(react_3.Form.Error, { className: "mt-4 bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-lg" }), (0, jsx_runtime_1.jsx)(react_3.Form.Submitted, { className: "mt-4 bg-green-500/10 border border-green-500/20 text-green-500 px-4 py-3 rounded-lg" })] })) }) }) }));
127
166
  } }) }));
128
167
  });
129
- Root.displayName = 'BookingForm.Root';
130
- const BookingFormContext = React.createContext(null);
168
+ exports.Root.displayName = 'BookingForm.Root';
169
+ const BookingFormContext = react_1.default.createContext(null);
131
170
  /**
132
171
  * Hook to access BookingForm context
133
172
  * @internal
134
173
  */
135
174
  function useBookingFormContext() {
136
- const context = React.useContext(BookingFormContext);
175
+ const context = react_1.default.useContext(BookingFormContext);
137
176
  if (!context) {
138
177
  throw new Error('useBookingFormContext must be used within a BookingForm.Root component');
139
178
  }
@@ -153,16 +192,19 @@ function useBookingFormContext() {
153
192
  * </BookingForm.Root>
154
193
  * ```
155
194
  */
156
- export const Fields = React.forwardRef((props, ref) => {
195
+ exports.Fields = react_1.default.forwardRef((props, ref) => {
157
196
  const context = useBookingFormContext();
158
197
  const { rowGapClassname = context.rowGapClassname, columnGapClassname = context.columnGapClassname, className, ...otherProps } = props;
159
- return (_jsx("div", { ref: ref, className: className, "data-testid": TestIds.bookingFormFields, ...otherProps, children: _jsx(Form.Fields, { fieldMap: context.fields, rowGapClassname: rowGapClassname, columnGapClassname: columnGapClassname }) }));
198
+ return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: className, "data-testid": exports.TestIds.bookingFormFields, ...otherProps, children: (0, jsx_runtime_1.jsx)(react_3.Form.Fields, { fieldMap: context.fields, rowGapClassname: rowGapClassname, columnGapClassname: columnGapClassname }) }));
160
199
  });
161
- Fields.displayName = 'BookingForm.Fields';
200
+ exports.Fields.displayName = 'BookingForm.Fields';
162
201
  // ============================================================================
163
202
  // Error Handling
164
203
  // ============================================================================
165
204
  /**
166
205
  * Re-export LoadError component and utilities for error handling
167
206
  */
168
- export { LoadError, isBookingFormConfigurationError, BookingFormConfigurationError, } from '../core/booking-form/BookingForm.js';
207
+ var BookingForm_js_1 = require("../core/booking-form/BookingForm.js");
208
+ Object.defineProperty(exports, "LoadError", { enumerable: true, get: function () { return BookingForm_js_1.LoadError; } });
209
+ Object.defineProperty(exports, "isBookingFormConfigurationError", { enumerable: true, get: function () { return BookingForm_js_1.isBookingFormConfigurationError; } });
210
+ Object.defineProperty(exports, "BookingFormConfigurationError", { enumerable: true, get: function () { return BookingForm_js_1.BookingFormConfigurationError; } });