@wix/headless-bookings 0.0.97 → 0.0.99

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 (45) hide show
  1. package/cjs/dist/__mocks__/booking/booking-client-service.d.ts +9 -0
  2. package/cjs/dist/__mocks__/booking/booking-client-service.js +55 -0
  3. package/cjs/dist/__mocks__/booking/booking-mocks.d.ts +20 -0
  4. package/cjs/dist/__mocks__/booking/booking-mocks.js +76 -0
  5. package/{dist/__mocks__/services.d.ts → cjs/dist/__mocks__/services/services-mocks.d.ts} +5 -17
  6. package/cjs/dist/__mocks__/{services.js → services/services-mocks.js} +1 -27
  7. package/cjs/dist/__mocks__/time-slots/time-slots-client-service.d.ts +79 -0
  8. package/cjs/dist/__mocks__/time-slots/time-slots-client-service.js +120 -0
  9. package/{dist/__mocks__/time-slots.d.ts → cjs/dist/__mocks__/time-slots/time-slots-core.d.ts} +1 -28
  10. package/cjs/dist/__mocks__/{time-slots.js → time-slots/time-slots-core.js} +1 -115
  11. package/cjs/dist/__mocks__/time-slots/time-slots-mocks.d.ts +14 -0
  12. package/cjs/dist/__mocks__/time-slots/time-slots-mocks.js +50 -0
  13. package/cjs/dist/services/booking/booking.js +2 -1
  14. package/cjs/dist/services/constants.d.ts +12 -0
  15. package/cjs/dist/services/constants.js +11 -0
  16. package/cjs/dist/services/service-list/service-list.js +1 -0
  17. package/cjs/dist/services/time-slot-list/time-slot-list.def.js +2 -1
  18. package/cjs/dist/services/time-slot-list/time-slot.js +2 -1
  19. package/dist/__mocks__/booking/booking-client-service.d.ts +9 -0
  20. package/dist/__mocks__/booking/booking-client-service.js +55 -0
  21. package/dist/__mocks__/booking/booking-mocks.d.ts +20 -0
  22. package/dist/__mocks__/booking/booking-mocks.js +76 -0
  23. package/{cjs/dist/__mocks__/services.d.ts → dist/__mocks__/services/services-mocks.d.ts} +5 -17
  24. package/dist/__mocks__/{services.js → services/services-mocks.js} +1 -27
  25. package/dist/__mocks__/time-slots/time-slots-client-service.d.ts +79 -0
  26. package/dist/__mocks__/time-slots/time-slots-client-service.js +120 -0
  27. package/{cjs/dist/__mocks__/time-slots.d.ts → dist/__mocks__/time-slots/time-slots-core.d.ts} +1 -28
  28. package/dist/__mocks__/{time-slots.js → time-slots/time-slots-core.js} +1 -115
  29. package/dist/__mocks__/time-slots/time-slots-mocks.d.ts +14 -0
  30. package/dist/__mocks__/time-slots/time-slots-mocks.js +50 -0
  31. package/dist/services/booking/booking.js +2 -1
  32. package/dist/services/constants.d.ts +12 -0
  33. package/dist/services/constants.js +11 -0
  34. package/dist/services/service-list/service-list.js +1 -0
  35. package/dist/services/time-slot-list/time-slot-list.def.js +2 -1
  36. package/dist/services/time-slot-list/time-slot.js +2 -1
  37. package/package.json +2 -2
  38. package/cjs/dist/__mocks__/booking.d.ts +0 -87
  39. package/cjs/dist/__mocks__/booking.js +0 -229
  40. package/dist/__mocks__/booking.d.ts +0 -87
  41. package/dist/__mocks__/booking.js +0 -229
  42. /package/cjs/dist/__mocks__/{payment.d.ts → payment/payment-mocks.d.ts} +0 -0
  43. /package/cjs/dist/__mocks__/{payment.js → payment/payment-mocks.js} +0 -0
  44. /package/dist/__mocks__/{payment.d.ts → payment/payment-mocks.d.ts} +0 -0
  45. /package/dist/__mocks__/{payment.js → payment/payment-mocks.js} +0 -0
@@ -1,121 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { vi } from 'vitest';
3
3
  import React from 'react';
4
- import { TimeSlotListService } from '../services/time-slot-list/time-slot-list.js';
5
- import { createMockBookingService, createMockSignalsService, mockSignal, } from './booking.js';
6
- export function createTimeSlotListService(overrides = {}) {
7
- const config = createTimeSlotListConfig(overrides);
8
- const mockBookingService = createMockBookingService();
9
- const mockSignalsService = createMockSignalsService();
10
- const getService = (definition) => {
11
- const def = definition;
12
- if (def.name === 'signals') {
13
- return mockSignalsService;
14
- }
15
- if (def.name === 'booking') {
16
- return mockBookingService;
17
- }
18
- throw new Error(`Unknown service: ${def.name}`);
19
- };
20
- const service = TimeSlotListService({
21
- getService,
22
- config,
23
- });
24
- return {
25
- service,
26
- bookingService: mockBookingService,
27
- };
28
- }
29
- export function createTimeSlot(overrides = {}) {
30
- return {
31
- localStartDate: '2024-01-15T10:00:00',
32
- localEndDate: '2024-01-15T11:00:00',
33
- bookable: true,
34
- totalCapacity: 10,
35
- remainingCapacity: 5,
36
- scheduleId: 'schedule-1',
37
- location: { _id: 'loc-1', name: 'Main Office' },
38
- availableResources: [{ resources: [{ _id: 'staff-1', name: 'John Doe' }] }],
39
- ...overrides,
40
- };
41
- }
42
- export function createTimeSlots(count) {
43
- return Array.from({ length: count }, (_, i) => createTimeSlot({
44
- localStartDate: `2024-01-15T${String(9 + (i % 8)).padStart(2, '0')}:00:00`,
45
- localEndDate: `2024-01-15T${String(10 + (i % 8)).padStart(2, '0')}:00:00`,
46
- scheduleId: `schedule-${i}`,
47
- }));
48
- }
49
- export function createTimeSlotListConfig(overrides = {}) {
50
- const { startDate = new Date('2024-01-15T00:00:00'), endDate = new Date('2024-01-22T00:00:00'), timezone = 'America/New_York', timeSlots, ...rest } = overrides;
51
- return {
52
- startDate,
53
- endDate,
54
- timezone,
55
- ...rest,
56
- ...(timeSlots !== undefined ? { timeSlots } : {}),
57
- };
58
- }
59
- export const mockTimeSlot = createTimeSlot();
60
- export const mockTimeSlotMultipleStaff = createTimeSlot({
61
- availableResources: [
62
- {
63
- resources: [
64
- { _id: 'staff-1', name: 'John Doe' },
65
- { _id: 'staff-2', name: 'Jane Smith' },
66
- ],
67
- },
68
- ],
69
- });
70
- export const mockTimeSlotNotBookable = createTimeSlot({
71
- localStartDate: '2024-01-15T14:00:00',
72
- localEndDate: '2024-01-15T15:00:00',
73
- bookable: false,
74
- remainingCapacity: 0,
75
- location: { _id: 'loc-2', name: 'Downtown Branch' },
76
- });
77
- export const mockTimeSlots = [
78
- mockTimeSlot,
79
- mockTimeSlotMultipleStaff,
80
- mockTimeSlotNotBookable,
81
- ];
82
- export const mockStartDate = new Date('2024-01-15T00:00:00');
83
- export const mockEndDate = new Date('2024-01-22T00:00:00');
84
- export const mockTimezone = 'America/New_York';
85
- export const mockTimeSlotListConfig = createTimeSlotListConfig({
86
- timeSlots: mockTimeSlots,
87
- });
88
- export const mockEmptyTimeSlotListConfig = createTimeSlotListConfig();
89
- export const mockCursorPagingMetadataWithMore = {
90
- cursors: { next: 'next-cursor-token' },
91
- };
92
- export const mockCursorPagingMetadataNoMore = { cursors: {} };
93
- export function createMockTimeSlotListService(config = {}) {
94
- const timeSlotsSignal = mockSignal(config.timeSlots || []);
95
- const isLoadingSignal = mockSignal(false);
96
- const errorSignal = mockSignal(null);
97
- const hasMoreSignal = mockSignal(false);
98
- const dateRangeSignal = mockSignal({
99
- start: config.startDate || mockStartDate,
100
- end: config.endDate || mockEndDate,
101
- });
102
- return {
103
- timeSlots: timeSlotsSignal,
104
- isLoading: isLoadingSignal,
105
- error: errorSignal,
106
- hasMore: hasMoreSignal,
107
- dateRange: dateRangeSignal,
108
- actions: {
109
- selectSlot: vi.fn(),
110
- selectStaffMember: vi.fn(),
111
- clearStaffSelection: vi.fn(),
112
- loadMore: vi.fn(),
113
- setDateRange: vi.fn((start, end) => {
114
- dateRangeSignal.set({ start, end });
115
- }),
116
- },
117
- };
118
- }
4
+ import { mockTimeSlot, mockTimeSlots } from './time-slots-mocks.js';
119
5
  export function createCoreTimeSlotMock(config) {
120
6
  const { timeSlot, staffMembers, selectTimeSlot, clearStaffSelection, selectStaffMember, } = config;
121
7
  const startDate = new Date(timeSlot.localStartDate);
@@ -0,0 +1,14 @@
1
+ import type { TimeSlot } from '@wix/auto_sdk_bookings_availability-time-slots';
2
+ import type { TimeSlotListServiceConfig } from '../../services/time-slot-list/time-slot-list.def.js';
3
+ export declare function createTimeSlot(overrides?: Partial<TimeSlot>): TimeSlot;
4
+ export declare function createTimeSlotListConfig(overrides?: Partial<TimeSlotListServiceConfig>): TimeSlotListServiceConfig;
5
+ export declare const mockTimeSlot: TimeSlot;
6
+ export declare const mockTimeSlotMultipleStaff: TimeSlot;
7
+ export declare const mockTimeSlotNotBookable: TimeSlot;
8
+ export declare const mockTimeSlots: TimeSlot[];
9
+ export declare const mockStartDate: Date;
10
+ export declare const mockEndDate: Date;
11
+ export declare const mockTimezone = "America/New_York";
12
+ export declare const mockCursorPagingMetadataNoMore: {
13
+ cursors: {};
14
+ };
@@ -0,0 +1,50 @@
1
+ export function createTimeSlot(overrides = {}) {
2
+ return {
3
+ localStartDate: '2024-01-15T10:00:00',
4
+ localEndDate: '2024-01-15T11:00:00',
5
+ bookable: true,
6
+ totalCapacity: 10,
7
+ remainingCapacity: 5,
8
+ scheduleId: 'schedule-1',
9
+ location: { _id: 'loc-1', name: 'Main Office' },
10
+ availableResources: [{ resources: [{ _id: 'staff-1', name: 'John Doe' }] }],
11
+ ...overrides,
12
+ };
13
+ }
14
+ export function createTimeSlotListConfig(overrides = {}) {
15
+ const { startDate = new Date('2024-01-15T00:00:00'), endDate = new Date('2024-01-22T00:00:00'), timezone = 'America/New_York', timeSlots, ...rest } = overrides;
16
+ return {
17
+ startDate,
18
+ endDate,
19
+ timezone,
20
+ ...rest,
21
+ ...(timeSlots !== undefined ? { timeSlots } : {}),
22
+ };
23
+ }
24
+ export const mockTimeSlot = createTimeSlot();
25
+ export const mockTimeSlotMultipleStaff = createTimeSlot({
26
+ availableResources: [
27
+ {
28
+ resources: [
29
+ { _id: 'staff-1', name: 'John Doe' },
30
+ { _id: 'staff-2', name: 'Jane Smith' },
31
+ ],
32
+ },
33
+ ],
34
+ });
35
+ export const mockTimeSlotNotBookable = createTimeSlot({
36
+ localStartDate: '2024-01-15T14:00:00',
37
+ localEndDate: '2024-01-15T15:00:00',
38
+ bookable: false,
39
+ remainingCapacity: 0,
40
+ location: { _id: 'loc-2', name: 'Downtown Branch' },
41
+ });
42
+ export const mockTimeSlots = [
43
+ mockTimeSlot,
44
+ mockTimeSlotMultipleStaff,
45
+ mockTimeSlotNotBookable,
46
+ ];
47
+ export const mockStartDate = new Date('2024-01-15T00:00:00');
48
+ export const mockEndDate = new Date('2024-01-22T00:00:00');
49
+ export const mockTimezone = 'America/New_York';
50
+ export const mockCursorPagingMetadataNoMore = { cursors: {} };
@@ -6,6 +6,7 @@
6
6
  import { defineService, implementService } from '@wix/services-definitions';
7
7
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
8
8
  import { executeBookAction } from './book-action/bookAction.js';
9
+ import { ClientServiceIds } from '../constants.js';
9
10
  // ============================================================================
10
11
  // Constants
11
12
  // ============================================================================
@@ -29,7 +30,7 @@ function getClientTimezone() {
29
30
  /**
30
31
  * Service definition for Booking
31
32
  */
32
- export const BookingServiceDefinition = defineService('booking');
33
+ export const BookingServiceDefinition = defineService(ClientServiceIds.booking);
33
34
  // ============================================================================
34
35
  // Service Implementation
35
36
  // ============================================================================
@@ -7,3 +7,15 @@
7
7
  export declare const BOOKING_APP_ID = "13d21c63-b5ec-5912-8397-c3a5ddb27a97";
8
8
  /** Resource type ID for staff members */
9
9
  export declare const STAFF_MEMBER_RESOURCE_TYPE_ID = "1cd44cf8-756f-41c3-bd90-3e2ffcaf1155";
10
+ export declare const ClientServiceIds: {
11
+ readonly booking: "booking";
12
+ readonly bookingForm: "bookingForm";
13
+ readonly timeSlot: "time-slot";
14
+ readonly timeSlotList: "time-slot-list";
15
+ readonly service: "service";
16
+ readonly serviceList: "service-list";
17
+ readonly payment: "payment";
18
+ readonly staffMemberList: "staff-member-list";
19
+ readonly locationList: "location-list";
20
+ };
21
+ export type ClientServiceId = (typeof ClientServiceIds)[keyof typeof ClientServiceIds];
@@ -7,3 +7,14 @@
7
7
  export const BOOKING_APP_ID = '13d21c63-b5ec-5912-8397-c3a5ddb27a97';
8
8
  /** Resource type ID for staff members */
9
9
  export const STAFF_MEMBER_RESOURCE_TYPE_ID = '1cd44cf8-756f-41c3-bd90-3e2ffcaf1155';
10
+ export const ClientServiceIds = {
11
+ booking: 'booking',
12
+ bookingForm: 'bookingForm',
13
+ timeSlot: 'time-slot',
14
+ timeSlotList: 'time-slot-list',
15
+ service: 'service',
16
+ serviceList: 'service-list',
17
+ payment: 'payment',
18
+ staffMemberList: 'staff-member-list',
19
+ locationList: 'location-list',
20
+ };
@@ -223,6 +223,7 @@ export const ServiceListService = implementService.withConfig()(ServiceListServi
223
223
  const currentPaging = pagingMetadataSignal.peek();
224
224
  try {
225
225
  isLoadingSignal.set(true);
226
+ servicesSignal.set([]);
226
227
  errorSignal.set(null);
227
228
  const result = await queryServices({
228
229
  appId: queryOptions.appId,
@@ -3,6 +3,7 @@
3
3
  * Defines interfaces and service contract for time slot management
4
4
  */
5
5
  import { defineService } from '@wix/services-definitions';
6
+ import { ClientServiceIds } from '../constants.js';
6
7
  // ============================================================================
7
8
  // Enums
8
9
  // ============================================================================
@@ -14,4 +15,4 @@ export var ViewMode;
14
15
  // ============================================================================
15
16
  // Service Definition
16
17
  // ============================================================================
17
- export const TimeSlotListServiceDefinition = defineService('time-slot-list');
18
+ export const TimeSlotListServiceDefinition = defineService(ClientServiceIds.timeSlotList);
@@ -4,10 +4,11 @@
4
4
  */
5
5
  import { defineService, implementService } from '@wix/services-definitions';
6
6
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
7
+ import { ClientServiceIds } from '../constants.js';
7
8
  /**
8
9
  * Service definition for TimeSlot
9
10
  */
10
- export const TimeSlotServiceDefinition = defineService('time-slot');
11
+ export const TimeSlotServiceDefinition = defineService(ClientServiceIds.timeSlot);
11
12
  /**
12
13
  * Implementation of TimeSlotService
13
14
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-bookings",
3
- "version": "0.0.97",
3
+ "version": "0.0.99",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -72,5 +72,5 @@
72
72
  "groupId": "com.wixpress.headless-components"
73
73
  }
74
74
  },
75
- "falconPackageHash": "7e4084020a17ac4efa052dae5a1a2a9ace583d3ea7ed88f9ff71cc9f"
75
+ "falconPackageHash": "90e3b4c9be1e17b3645f7669a951edf6c8f479bb47d1dbaec549fd0c"
76
76
  }
@@ -1,87 +0,0 @@
1
- import type { FormValues } from '@wix/form-public';
2
- import type { Location } from '@wix/auto_sdk_bookings_services';
3
- import type { ServiceSelection, ServiceSelectionTimeSlot, BookingServiceConfig, BookingService, ExtendedResource } from '../services/booking/booking.js';
4
- import type { Signal } from '@wix/services-definitions/core-services/signals';
5
- export declare function mockSignal<T>(initialValue: T): Signal<T>;
6
- export declare function createMockSignalsService(): {
7
- signal: typeof mockSignal;
8
- computed: <T>(fn: () => T) => Signal<T>;
9
- effect: (fn: () => void) => void;
10
- };
11
- export declare function createMockBookingService(initialSelections?: ServiceSelection[]): BookingService;
12
- /**
13
- * Mock resource (staff member)
14
- */
15
- export declare const mockResource: ExtendedResource;
16
- /**
17
- * Mock resource (another staff member)
18
- */
19
- export declare const mockResourceTwo: ExtendedResource;
20
- /**
21
- * Mock resource (room)
22
- */
23
- export declare const mockResourceRoom: ExtendedResource;
24
- /**
25
- * Mock location (BUSINESS type with nested business object)
26
- */
27
- export declare const mockLocation: Location;
28
- /**
29
- * Mock location (second)
30
- */
31
- export declare const mockLocationTwo: Location;
32
- /**
33
- * Mock time slot data
34
- */
35
- export declare const mockTimeSlot: ServiceSelectionTimeSlot;
36
- /**
37
- * Mock time slot for afternoon
38
- */
39
- export declare const mockTimeSlotAfternoon: ServiceSelectionTimeSlot;
40
- /**
41
- * Mock service selection with all data
42
- */
43
- export declare const mockServiceSelection: ServiceSelection;
44
- /**
45
- * Mock service selection without time slot (incomplete)
46
- */
47
- export declare const mockServiceSelectionWithoutTimeSlot: ServiceSelection;
48
- /**
49
- * Mock service selection for class
50
- */
51
- export declare const mockServiceSelectionClass: ServiceSelection;
52
- /**
53
- * Mock form submission (contact info)
54
- */
55
- export declare const mockFormSubmission: FormValues;
56
- /**
57
- * Mock form submission (minimal)
58
- */
59
- export declare const mockFormSubmissionMinimal: FormValues;
60
- /**
61
- * Mock form submission with custom fields
62
- */
63
- export declare const mockFormSubmissionWithCustomFields: FormValues;
64
- /**
65
- * Default timezone for tests
66
- */
67
- export declare const mockTimezone = "America/New_York";
68
- /**
69
- * Mock booking service config (empty)
70
- */
71
- export declare const mockEmptyBookingConfig: BookingServiceConfig;
72
- /**
73
- * Mock booking service config with initial data
74
- */
75
- export declare const mockBookingConfigWithData: BookingServiceConfig;
76
- /**
77
- * Mock booking service config with multiple selections
78
- */
79
- export declare const mockBookingConfigMultipleSelections: BookingServiceConfig;
80
- /**
81
- * Helper to create a service selection with custom instanceId
82
- */
83
- export declare function createMockServiceSelection(overrides?: Partial<ServiceSelection>): Omit<ServiceSelection, 'instanceId'>;
84
- /**
85
- * Helper to create multiple service selections
86
- */
87
- export declare function createMockServiceSelections(count: number): ServiceSelection[];
@@ -1,229 +0,0 @@
1
- import { mockService, mockServiceClass } from './services.js';
2
- import { vi } from 'vitest';
3
- export function mockSignal(initialValue) {
4
- let value = initialValue;
5
- return {
6
- get: () => value,
7
- peek: () => value,
8
- set: (newValue) => {
9
- value = newValue;
10
- },
11
- };
12
- }
13
- export function createMockSignalsService() {
14
- return {
15
- signal: mockSignal,
16
- // Re-evaluate the computed function on every get/peek (like real computed signals)
17
- computed: (fn) => ({
18
- get: () => fn(),
19
- peek: () => fn(),
20
- set: () => { }, // no-op for computed
21
- }),
22
- effect: vi.fn((fn) => {
23
- fn();
24
- }),
25
- };
26
- }
27
- export function createMockBookingService(initialSelections = []) {
28
- const serviceSelectionsSignal = mockSignal(initialSelections);
29
- const locationSignal = mockSignal(null);
30
- const timezoneSignal = mockSignal('UTC');
31
- const formSubmissionSignal = mockSignal(null);
32
- return {
33
- serviceSelections: serviceSelectionsSignal,
34
- location: locationSignal,
35
- timezone: timezoneSignal,
36
- formSubmission: formSubmissionSignal,
37
- actions: {
38
- updateItem: vi.fn(),
39
- setItem: vi.fn(),
40
- addItem: vi.fn(),
41
- removeItem: vi.fn(),
42
- clearItems: vi.fn(),
43
- setResource: vi.fn(),
44
- getResourceByType: vi.fn(),
45
- clearResourceByType: vi.fn(),
46
- setLocation: vi.fn(),
47
- clearLocation: vi.fn(),
48
- setTimezone: vi.fn(),
49
- setFormSubmission: vi.fn(),
50
- clearFormSubmission: vi.fn(),
51
- clearAll: vi.fn(),
52
- book: vi.fn(),
53
- },
54
- };
55
- }
56
- /**
57
- * Mock resource (staff member)
58
- */
59
- export const mockResource = {
60
- _id: 'resource-1',
61
- name: 'John Doe',
62
- email: 'john.doe@example.com',
63
- tag: 'STAFF',
64
- type: 'staff',
65
- };
66
- /**
67
- * Mock resource (another staff member)
68
- */
69
- export const mockResourceTwo = {
70
- _id: 'resource-2',
71
- name: 'Jane Smith',
72
- email: 'jane.smith@example.com',
73
- tag: 'STAFF',
74
- type: 'staff',
75
- };
76
- /**
77
- * Mock resource (room)
78
- */
79
- export const mockResourceRoom = {
80
- _id: 'resource-room-1',
81
- name: 'Conference Room A',
82
- tag: 'RESOURCE',
83
- type: 'room',
84
- };
85
- /**
86
- * Mock location (BUSINESS type with nested business object)
87
- */
88
- export const mockLocation = {
89
- _id: 'location-1',
90
- type: 'BUSINESS',
91
- business: {
92
- _id: 'location-1',
93
- name: 'Main Office',
94
- },
95
- };
96
- /**
97
- * Mock location (second)
98
- */
99
- export const mockLocationTwo = {
100
- _id: 'location-2',
101
- type: 'BUSINESS',
102
- business: {
103
- _id: 'location-2',
104
- name: 'Downtown Branch',
105
- },
106
- };
107
- /**
108
- * Mock time slot data
109
- */
110
- export const mockTimeSlot = {
111
- startDate: '2024-03-15T10:00:00Z',
112
- endDate: '2024-03-15T11:00:00Z',
113
- totalCapacity: 10,
114
- remainingCapacity: 5,
115
- scheduleId: 'schedule-123',
116
- resources: [mockResource],
117
- location: mockLocation,
118
- };
119
- /**
120
- * Mock time slot for afternoon
121
- */
122
- export const mockTimeSlotAfternoon = {
123
- startDate: '2024-03-15T14:00:00Z',
124
- endDate: '2024-03-15T15:00:00Z',
125
- totalCapacity: 10,
126
- remainingCapacity: 8,
127
- scheduleId: 'schedule-456',
128
- resources: [mockResourceTwo],
129
- location: mockLocationTwo,
130
- };
131
- /**
132
- * Mock service selection with all data
133
- */
134
- export const mockServiceSelection = {
135
- instanceId: 'instance-1',
136
- service: mockService,
137
- resources: [mockResource],
138
- timeSlot: mockTimeSlot,
139
- totalParticipants: 1,
140
- };
141
- /**
142
- * Mock service selection without time slot (incomplete)
143
- */
144
- export const mockServiceSelectionWithoutTimeSlot = {
145
- instanceId: 'instance-2',
146
- service: mockService,
147
- resources: [],
148
- totalParticipants: 1,
149
- };
150
- /**
151
- * Mock service selection for class
152
- */
153
- export const mockServiceSelectionClass = {
154
- instanceId: 'instance-3',
155
- service: mockServiceClass,
156
- resources: [mockResource],
157
- timeSlot: mockTimeSlotAfternoon,
158
- totalParticipants: 3,
159
- };
160
- /**
161
- * Mock form submission (contact info)
162
- */
163
- export const mockFormSubmission = {
164
- firstName: 'John',
165
- lastName: 'Doe',
166
- email: 'john.doe@example.com',
167
- phone: '+1234567890',
168
- };
169
- /**
170
- * Mock form submission (minimal)
171
- */
172
- export const mockFormSubmissionMinimal = {
173
- email: 'test@example.com',
174
- };
175
- /**
176
- * Mock form submission with custom fields
177
- */
178
- export const mockFormSubmissionWithCustomFields = {
179
- firstName: 'Jane',
180
- lastName: 'Smith',
181
- email: 'jane.smith@example.com',
182
- notes: 'Please call before the appointment',
183
- customField1: 'Custom value 1',
184
- };
185
- /**
186
- * Default timezone for tests
187
- */
188
- export const mockTimezone = 'America/New_York';
189
- /**
190
- * Mock booking service config (empty)
191
- */
192
- export const mockEmptyBookingConfig = {};
193
- /**
194
- * Mock booking service config with initial data
195
- */
196
- export const mockBookingConfigWithData = {
197
- serviceSelections: [mockServiceSelection],
198
- location: mockLocation,
199
- timezone: mockTimezone,
200
- formSubmission: mockFormSubmission,
201
- };
202
- /**
203
- * Mock booking service config with multiple selections
204
- */
205
- export const mockBookingConfigMultipleSelections = {
206
- serviceSelections: [mockServiceSelection, mockServiceSelectionClass],
207
- location: mockLocation,
208
- timezone: mockTimezone,
209
- formSubmission: mockFormSubmission,
210
- };
211
- /**
212
- * Helper to create a service selection with custom instanceId
213
- */
214
- export function createMockServiceSelection(overrides = {}) {
215
- const { instanceId: _, ...base } = mockServiceSelection;
216
- return {
217
- ...base,
218
- ...overrides,
219
- };
220
- }
221
- /**
222
- * Helper to create multiple service selections
223
- */
224
- export function createMockServiceSelections(count) {
225
- return Array.from({ length: count }, (_, i) => ({
226
- ...mockServiceSelection,
227
- instanceId: `instance-${i + 1}`,
228
- }));
229
- }