@wix/headless-bookings 0.0.24 → 0.0.25
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.
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mock data for booking service tests
|
|
3
|
+
*/
|
|
4
|
+
import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
5
|
+
import type { ServiceServiceConfig } from '../services/service/service.js';
|
|
6
|
+
import type { ServiceListServiceConfig } from '../services/service-list/service-list.js';
|
|
7
|
+
import type { PagingMetadata } from '../api/query-services/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Booking app ID constant
|
|
10
|
+
*/
|
|
11
|
+
export declare const BOOKING_APP_ID = "13d21c63-b5ec-5912-8397-c3a5ddb27a97";
|
|
12
|
+
/**
|
|
13
|
+
* Base mock service with all fields populated (APPOINTMENT type, FIXED pricing)
|
|
14
|
+
*/
|
|
15
|
+
export declare const mockService: Service;
|
|
16
|
+
/**
|
|
17
|
+
* Mock service with VARIED pricing
|
|
18
|
+
*/
|
|
19
|
+
export declare const mockServiceVariedPrice: Service;
|
|
20
|
+
/**
|
|
21
|
+
* Mock service with CUSTOM pricing
|
|
22
|
+
*/
|
|
23
|
+
export declare const mockServiceCustomPrice: Service;
|
|
24
|
+
/**
|
|
25
|
+
* Mock service with NO_FEE pricing (free)
|
|
26
|
+
*/
|
|
27
|
+
export declare const mockServiceNoFee: Service;
|
|
28
|
+
/**
|
|
29
|
+
* Mock CLASS type service
|
|
30
|
+
*/
|
|
31
|
+
export declare const mockServiceClass: Service;
|
|
32
|
+
/**
|
|
33
|
+
* Mock COURSE type service
|
|
34
|
+
*/
|
|
35
|
+
export declare const mockServiceCourse: Service;
|
|
36
|
+
/**
|
|
37
|
+
* Mock service without optional fields (minimal)
|
|
38
|
+
*/
|
|
39
|
+
export declare const mockServiceMinimal: Service;
|
|
40
|
+
/**
|
|
41
|
+
* Array of mock services for list tests
|
|
42
|
+
*/
|
|
43
|
+
export declare const mockServices: Service[];
|
|
44
|
+
/**
|
|
45
|
+
* Default paging metadata
|
|
46
|
+
*/
|
|
47
|
+
export declare const mockPagingMetadata: PagingMetadata;
|
|
48
|
+
/**
|
|
49
|
+
* Paging metadata with more items available
|
|
50
|
+
*/
|
|
51
|
+
export declare const mockPagingMetadataWithMore: PagingMetadata;
|
|
52
|
+
/**
|
|
53
|
+
* Empty paging metadata
|
|
54
|
+
*/
|
|
55
|
+
export declare const mockPagingMetadataEmpty: PagingMetadata;
|
|
56
|
+
/**
|
|
57
|
+
* Service list config with services
|
|
58
|
+
*/
|
|
59
|
+
export declare const mockServiceListConfig: ServiceListServiceConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Service list config with hasNext for pagination testing
|
|
62
|
+
*/
|
|
63
|
+
export declare const mockServiceListConfigWithMore: ServiceListServiceConfig;
|
|
64
|
+
/**
|
|
65
|
+
* Empty service list config
|
|
66
|
+
*/
|
|
67
|
+
export declare const mockEmptyServiceListConfig: ServiceListServiceConfig;
|
|
68
|
+
/**
|
|
69
|
+
* Service config for single service
|
|
70
|
+
*/
|
|
71
|
+
export declare const mockServiceConfig: ServiceServiceConfig;
|
|
72
|
+
/**
|
|
73
|
+
* Helper to create a large list of services for pagination tests
|
|
74
|
+
*/
|
|
75
|
+
export declare function createLargeServiceList(count: number): Service[];
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mock data for booking service tests
|
|
3
|
+
*/
|
|
4
|
+
import { RateType, ServiceType } from '@wix/auto_sdk_bookings_services';
|
|
5
|
+
/**
|
|
6
|
+
* Booking app ID constant
|
|
7
|
+
*/
|
|
8
|
+
export const BOOKING_APP_ID = '13d21c63-b5ec-5912-8397-c3a5ddb27a97';
|
|
9
|
+
/**
|
|
10
|
+
* Base mock service with all fields populated (APPOINTMENT type, FIXED pricing)
|
|
11
|
+
*/
|
|
12
|
+
export const mockService = {
|
|
13
|
+
_id: 'test-service-id',
|
|
14
|
+
name: 'Test Service Name',
|
|
15
|
+
description: 'Test service description',
|
|
16
|
+
tagLine: 'Test tagline',
|
|
17
|
+
type: ServiceType.APPOINTMENT,
|
|
18
|
+
category: {
|
|
19
|
+
_id: 'category-1',
|
|
20
|
+
name: 'Test Category',
|
|
21
|
+
},
|
|
22
|
+
payment: {
|
|
23
|
+
rateType: RateType.FIXED,
|
|
24
|
+
fixed: {
|
|
25
|
+
price: {
|
|
26
|
+
value: '50.00',
|
|
27
|
+
currency: 'USD',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
schedule: {
|
|
32
|
+
availabilityConstraints: {
|
|
33
|
+
sessionDurations: [60],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
locations: [
|
|
37
|
+
{
|
|
38
|
+
_id: 'location-1',
|
|
39
|
+
type: 'BUSINESS',
|
|
40
|
+
business: {
|
|
41
|
+
_id: 'business-loc-1',
|
|
42
|
+
name: 'Main Office',
|
|
43
|
+
address: {
|
|
44
|
+
formatted: '123 Main St, City, ST 12345',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
media: {
|
|
50
|
+
mainMedia: {
|
|
51
|
+
image: 'wix:image://v1/test-image.jpg',
|
|
52
|
+
},
|
|
53
|
+
coverMedia: {
|
|
54
|
+
image: 'wix:image://v1/test-cover.jpg',
|
|
55
|
+
},
|
|
56
|
+
items: [
|
|
57
|
+
{ image: 'wix:image://v1/image1.jpg' },
|
|
58
|
+
{ image: 'wix:image://v1/image2.jpg' },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
bookingPolicy: {
|
|
62
|
+
cancellationPolicy: {
|
|
63
|
+
enabled: true,
|
|
64
|
+
limitLatestCancellation: true,
|
|
65
|
+
latestCancellationInMinutes: 60,
|
|
66
|
+
},
|
|
67
|
+
limitLateBookingPolicy: {
|
|
68
|
+
enabled: true,
|
|
69
|
+
latestBookingInMinutes: 30,
|
|
70
|
+
},
|
|
71
|
+
limitEarlyBookingPolicy: {
|
|
72
|
+
enabled: true,
|
|
73
|
+
earliestBookingInMinutes: 10080, // 7 days
|
|
74
|
+
},
|
|
75
|
+
reschedulePolicy: {
|
|
76
|
+
enabled: true,
|
|
77
|
+
limitLatestReschedule: true,
|
|
78
|
+
latestRescheduleInMinutes: 120,
|
|
79
|
+
},
|
|
80
|
+
waitlistPolicy: {
|
|
81
|
+
enabled: true,
|
|
82
|
+
capacity: 10,
|
|
83
|
+
},
|
|
84
|
+
bookAfterStartPolicy: {
|
|
85
|
+
enabled: true,
|
|
86
|
+
},
|
|
87
|
+
participantsPolicy: {
|
|
88
|
+
maxParticipantsPerBooking: 5,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
defaultCapacity: 20,
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Mock service with VARIED pricing
|
|
95
|
+
*/
|
|
96
|
+
export const mockServiceVariedPrice = {
|
|
97
|
+
...mockService,
|
|
98
|
+
_id: 'test-service-varied',
|
|
99
|
+
name: 'Varied Price Service',
|
|
100
|
+
payment: {
|
|
101
|
+
rateType: RateType.VARIED,
|
|
102
|
+
varied: {
|
|
103
|
+
defaultPrice: {
|
|
104
|
+
value: '50.00',
|
|
105
|
+
currency: 'USD',
|
|
106
|
+
},
|
|
107
|
+
minPrice: {
|
|
108
|
+
value: '30.00',
|
|
109
|
+
currency: 'USD',
|
|
110
|
+
},
|
|
111
|
+
maxPrice: {
|
|
112
|
+
value: '100.00',
|
|
113
|
+
currency: 'USD',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Mock service with CUSTOM pricing
|
|
120
|
+
*/
|
|
121
|
+
export const mockServiceCustomPrice = {
|
|
122
|
+
...mockService,
|
|
123
|
+
_id: 'test-service-custom',
|
|
124
|
+
name: 'Custom Price Service',
|
|
125
|
+
payment: {
|
|
126
|
+
rateType: RateType.CUSTOM,
|
|
127
|
+
custom: {
|
|
128
|
+
description: 'Contact for pricing',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Mock service with NO_FEE pricing (free)
|
|
134
|
+
*/
|
|
135
|
+
export const mockServiceNoFee = {
|
|
136
|
+
...mockService,
|
|
137
|
+
_id: 'test-service-no-fee',
|
|
138
|
+
name: 'Free Service',
|
|
139
|
+
payment: {
|
|
140
|
+
rateType: RateType.NO_FEE,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Mock CLASS type service
|
|
145
|
+
*/
|
|
146
|
+
export const mockServiceClass = {
|
|
147
|
+
...mockService,
|
|
148
|
+
_id: 'test-service-class',
|
|
149
|
+
name: 'Class Service',
|
|
150
|
+
type: ServiceType.CLASS,
|
|
151
|
+
defaultCapacity: 15,
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Mock COURSE type service
|
|
155
|
+
*/
|
|
156
|
+
export const mockServiceCourse = {
|
|
157
|
+
...mockService,
|
|
158
|
+
_id: 'test-service-course',
|
|
159
|
+
name: 'Course Service',
|
|
160
|
+
type: ServiceType.COURSE,
|
|
161
|
+
defaultCapacity: 25,
|
|
162
|
+
schedule: {
|
|
163
|
+
...mockService.schedule,
|
|
164
|
+
firstSessionStart: new Date('2024-01-15T09:00:00Z'),
|
|
165
|
+
lastSessionEnd: new Date('2024-03-15T17:00:00Z'),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Mock service without optional fields (minimal)
|
|
170
|
+
*/
|
|
171
|
+
export const mockServiceMinimal = {
|
|
172
|
+
_id: 'test-service-minimal',
|
|
173
|
+
name: 'Minimal Service',
|
|
174
|
+
description: '',
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Array of mock services for list tests
|
|
178
|
+
*/
|
|
179
|
+
export const mockServices = [
|
|
180
|
+
{
|
|
181
|
+
_id: 'service-1',
|
|
182
|
+
name: 'Service One',
|
|
183
|
+
description: 'Description for service one',
|
|
184
|
+
type: ServiceType.APPOINTMENT,
|
|
185
|
+
payment: {
|
|
186
|
+
rateType: RateType.FIXED,
|
|
187
|
+
fixed: {
|
|
188
|
+
price: {
|
|
189
|
+
value: '50.00',
|
|
190
|
+
currency: 'USD',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
_id: 'service-2',
|
|
197
|
+
name: 'Service Two',
|
|
198
|
+
description: 'Description for service two',
|
|
199
|
+
type: ServiceType.CLASS,
|
|
200
|
+
payment: {
|
|
201
|
+
rateType: RateType.FIXED,
|
|
202
|
+
fixed: {
|
|
203
|
+
price: {
|
|
204
|
+
value: '75.00',
|
|
205
|
+
currency: 'USD',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
defaultCapacity: 15,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
_id: 'service-3',
|
|
213
|
+
name: 'Service Three',
|
|
214
|
+
description: 'Description for service three',
|
|
215
|
+
type: ServiceType.COURSE,
|
|
216
|
+
payment: {
|
|
217
|
+
rateType: RateType.CUSTOM,
|
|
218
|
+
custom: {
|
|
219
|
+
description: 'Contact for pricing',
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
defaultCapacity: 25,
|
|
223
|
+
},
|
|
224
|
+
];
|
|
225
|
+
/**
|
|
226
|
+
* Default paging metadata
|
|
227
|
+
*/
|
|
228
|
+
export const mockPagingMetadata = {
|
|
229
|
+
limit: 10,
|
|
230
|
+
offset: 0,
|
|
231
|
+
count: 3,
|
|
232
|
+
hasNext: false,
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Paging metadata with more items available
|
|
236
|
+
*/
|
|
237
|
+
export const mockPagingMetadataWithMore = {
|
|
238
|
+
limit: 10,
|
|
239
|
+
offset: 0,
|
|
240
|
+
count: 10,
|
|
241
|
+
hasNext: true,
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Empty paging metadata
|
|
245
|
+
*/
|
|
246
|
+
export const mockPagingMetadataEmpty = {
|
|
247
|
+
limit: 10,
|
|
248
|
+
offset: 0,
|
|
249
|
+
count: 0,
|
|
250
|
+
hasNext: false,
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Service list config with services
|
|
254
|
+
*/
|
|
255
|
+
export const mockServiceListConfig = {
|
|
256
|
+
services: mockServices,
|
|
257
|
+
options: {
|
|
258
|
+
appId: BOOKING_APP_ID,
|
|
259
|
+
pagingMetadata: mockPagingMetadata,
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Service list config with hasNext for pagination testing
|
|
264
|
+
*/
|
|
265
|
+
export const mockServiceListConfigWithMore = {
|
|
266
|
+
services: mockServices,
|
|
267
|
+
options: {
|
|
268
|
+
appId: BOOKING_APP_ID,
|
|
269
|
+
pagingMetadata: mockPagingMetadataWithMore,
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Empty service list config
|
|
274
|
+
*/
|
|
275
|
+
export const mockEmptyServiceListConfig = {
|
|
276
|
+
services: [],
|
|
277
|
+
options: {
|
|
278
|
+
appId: BOOKING_APP_ID,
|
|
279
|
+
pagingMetadata: mockPagingMetadataEmpty,
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Service config for single service
|
|
284
|
+
*/
|
|
285
|
+
export const mockServiceConfig = {
|
|
286
|
+
service: mockService,
|
|
287
|
+
appId: BOOKING_APP_ID,
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Helper to create a large list of services for pagination tests
|
|
291
|
+
*/
|
|
292
|
+
export function createLargeServiceList(count) {
|
|
293
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
294
|
+
_id: `service-${i}`,
|
|
295
|
+
name: `Service ${i}`,
|
|
296
|
+
description: `Description for service ${i}`,
|
|
297
|
+
type: ServiceType.APPOINTMENT,
|
|
298
|
+
payment: {
|
|
299
|
+
rateType: RateType.FIXED,
|
|
300
|
+
fixed: {
|
|
301
|
+
price: {
|
|
302
|
+
value: '50.00',
|
|
303
|
+
currency: 'USD',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
}));
|
|
308
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mock data for booking service tests
|
|
3
|
+
*/
|
|
4
|
+
import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
5
|
+
import type { ServiceServiceConfig } from '../services/service/service.js';
|
|
6
|
+
import type { ServiceListServiceConfig } from '../services/service-list/service-list.js';
|
|
7
|
+
import type { PagingMetadata } from '../api/query-services/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Booking app ID constant
|
|
10
|
+
*/
|
|
11
|
+
export declare const BOOKING_APP_ID = "13d21c63-b5ec-5912-8397-c3a5ddb27a97";
|
|
12
|
+
/**
|
|
13
|
+
* Base mock service with all fields populated (APPOINTMENT type, FIXED pricing)
|
|
14
|
+
*/
|
|
15
|
+
export declare const mockService: Service;
|
|
16
|
+
/**
|
|
17
|
+
* Mock service with VARIED pricing
|
|
18
|
+
*/
|
|
19
|
+
export declare const mockServiceVariedPrice: Service;
|
|
20
|
+
/**
|
|
21
|
+
* Mock service with CUSTOM pricing
|
|
22
|
+
*/
|
|
23
|
+
export declare const mockServiceCustomPrice: Service;
|
|
24
|
+
/**
|
|
25
|
+
* Mock service with NO_FEE pricing (free)
|
|
26
|
+
*/
|
|
27
|
+
export declare const mockServiceNoFee: Service;
|
|
28
|
+
/**
|
|
29
|
+
* Mock CLASS type service
|
|
30
|
+
*/
|
|
31
|
+
export declare const mockServiceClass: Service;
|
|
32
|
+
/**
|
|
33
|
+
* Mock COURSE type service
|
|
34
|
+
*/
|
|
35
|
+
export declare const mockServiceCourse: Service;
|
|
36
|
+
/**
|
|
37
|
+
* Mock service without optional fields (minimal)
|
|
38
|
+
*/
|
|
39
|
+
export declare const mockServiceMinimal: Service;
|
|
40
|
+
/**
|
|
41
|
+
* Array of mock services for list tests
|
|
42
|
+
*/
|
|
43
|
+
export declare const mockServices: Service[];
|
|
44
|
+
/**
|
|
45
|
+
* Default paging metadata
|
|
46
|
+
*/
|
|
47
|
+
export declare const mockPagingMetadata: PagingMetadata;
|
|
48
|
+
/**
|
|
49
|
+
* Paging metadata with more items available
|
|
50
|
+
*/
|
|
51
|
+
export declare const mockPagingMetadataWithMore: PagingMetadata;
|
|
52
|
+
/**
|
|
53
|
+
* Empty paging metadata
|
|
54
|
+
*/
|
|
55
|
+
export declare const mockPagingMetadataEmpty: PagingMetadata;
|
|
56
|
+
/**
|
|
57
|
+
* Service list config with services
|
|
58
|
+
*/
|
|
59
|
+
export declare const mockServiceListConfig: ServiceListServiceConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Service list config with hasNext for pagination testing
|
|
62
|
+
*/
|
|
63
|
+
export declare const mockServiceListConfigWithMore: ServiceListServiceConfig;
|
|
64
|
+
/**
|
|
65
|
+
* Empty service list config
|
|
66
|
+
*/
|
|
67
|
+
export declare const mockEmptyServiceListConfig: ServiceListServiceConfig;
|
|
68
|
+
/**
|
|
69
|
+
* Service config for single service
|
|
70
|
+
*/
|
|
71
|
+
export declare const mockServiceConfig: ServiceServiceConfig;
|
|
72
|
+
/**
|
|
73
|
+
* Helper to create a large list of services for pagination tests
|
|
74
|
+
*/
|
|
75
|
+
export declare function createLargeServiceList(count: number): Service[];
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mock data for booking service tests
|
|
3
|
+
*/
|
|
4
|
+
import { RateType, ServiceType } from '@wix/auto_sdk_bookings_services';
|
|
5
|
+
/**
|
|
6
|
+
* Booking app ID constant
|
|
7
|
+
*/
|
|
8
|
+
export const BOOKING_APP_ID = '13d21c63-b5ec-5912-8397-c3a5ddb27a97';
|
|
9
|
+
/**
|
|
10
|
+
* Base mock service with all fields populated (APPOINTMENT type, FIXED pricing)
|
|
11
|
+
*/
|
|
12
|
+
export const mockService = {
|
|
13
|
+
_id: 'test-service-id',
|
|
14
|
+
name: 'Test Service Name',
|
|
15
|
+
description: 'Test service description',
|
|
16
|
+
tagLine: 'Test tagline',
|
|
17
|
+
type: ServiceType.APPOINTMENT,
|
|
18
|
+
category: {
|
|
19
|
+
_id: 'category-1',
|
|
20
|
+
name: 'Test Category',
|
|
21
|
+
},
|
|
22
|
+
payment: {
|
|
23
|
+
rateType: RateType.FIXED,
|
|
24
|
+
fixed: {
|
|
25
|
+
price: {
|
|
26
|
+
value: '50.00',
|
|
27
|
+
currency: 'USD',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
schedule: {
|
|
32
|
+
availabilityConstraints: {
|
|
33
|
+
sessionDurations: [60],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
locations: [
|
|
37
|
+
{
|
|
38
|
+
_id: 'location-1',
|
|
39
|
+
type: 'BUSINESS',
|
|
40
|
+
business: {
|
|
41
|
+
_id: 'business-loc-1',
|
|
42
|
+
name: 'Main Office',
|
|
43
|
+
address: {
|
|
44
|
+
formatted: '123 Main St, City, ST 12345',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
media: {
|
|
50
|
+
mainMedia: {
|
|
51
|
+
image: 'wix:image://v1/test-image.jpg',
|
|
52
|
+
},
|
|
53
|
+
coverMedia: {
|
|
54
|
+
image: 'wix:image://v1/test-cover.jpg',
|
|
55
|
+
},
|
|
56
|
+
items: [
|
|
57
|
+
{ image: 'wix:image://v1/image1.jpg' },
|
|
58
|
+
{ image: 'wix:image://v1/image2.jpg' },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
bookingPolicy: {
|
|
62
|
+
cancellationPolicy: {
|
|
63
|
+
enabled: true,
|
|
64
|
+
limitLatestCancellation: true,
|
|
65
|
+
latestCancellationInMinutes: 60,
|
|
66
|
+
},
|
|
67
|
+
limitLateBookingPolicy: {
|
|
68
|
+
enabled: true,
|
|
69
|
+
latestBookingInMinutes: 30,
|
|
70
|
+
},
|
|
71
|
+
limitEarlyBookingPolicy: {
|
|
72
|
+
enabled: true,
|
|
73
|
+
earliestBookingInMinutes: 10080, // 7 days
|
|
74
|
+
},
|
|
75
|
+
reschedulePolicy: {
|
|
76
|
+
enabled: true,
|
|
77
|
+
limitLatestReschedule: true,
|
|
78
|
+
latestRescheduleInMinutes: 120,
|
|
79
|
+
},
|
|
80
|
+
waitlistPolicy: {
|
|
81
|
+
enabled: true,
|
|
82
|
+
capacity: 10,
|
|
83
|
+
},
|
|
84
|
+
bookAfterStartPolicy: {
|
|
85
|
+
enabled: true,
|
|
86
|
+
},
|
|
87
|
+
participantsPolicy: {
|
|
88
|
+
maxParticipantsPerBooking: 5,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
defaultCapacity: 20,
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Mock service with VARIED pricing
|
|
95
|
+
*/
|
|
96
|
+
export const mockServiceVariedPrice = {
|
|
97
|
+
...mockService,
|
|
98
|
+
_id: 'test-service-varied',
|
|
99
|
+
name: 'Varied Price Service',
|
|
100
|
+
payment: {
|
|
101
|
+
rateType: RateType.VARIED,
|
|
102
|
+
varied: {
|
|
103
|
+
defaultPrice: {
|
|
104
|
+
value: '50.00',
|
|
105
|
+
currency: 'USD',
|
|
106
|
+
},
|
|
107
|
+
minPrice: {
|
|
108
|
+
value: '30.00',
|
|
109
|
+
currency: 'USD',
|
|
110
|
+
},
|
|
111
|
+
maxPrice: {
|
|
112
|
+
value: '100.00',
|
|
113
|
+
currency: 'USD',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Mock service with CUSTOM pricing
|
|
120
|
+
*/
|
|
121
|
+
export const mockServiceCustomPrice = {
|
|
122
|
+
...mockService,
|
|
123
|
+
_id: 'test-service-custom',
|
|
124
|
+
name: 'Custom Price Service',
|
|
125
|
+
payment: {
|
|
126
|
+
rateType: RateType.CUSTOM,
|
|
127
|
+
custom: {
|
|
128
|
+
description: 'Contact for pricing',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Mock service with NO_FEE pricing (free)
|
|
134
|
+
*/
|
|
135
|
+
export const mockServiceNoFee = {
|
|
136
|
+
...mockService,
|
|
137
|
+
_id: 'test-service-no-fee',
|
|
138
|
+
name: 'Free Service',
|
|
139
|
+
payment: {
|
|
140
|
+
rateType: RateType.NO_FEE,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Mock CLASS type service
|
|
145
|
+
*/
|
|
146
|
+
export const mockServiceClass = {
|
|
147
|
+
...mockService,
|
|
148
|
+
_id: 'test-service-class',
|
|
149
|
+
name: 'Class Service',
|
|
150
|
+
type: ServiceType.CLASS,
|
|
151
|
+
defaultCapacity: 15,
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Mock COURSE type service
|
|
155
|
+
*/
|
|
156
|
+
export const mockServiceCourse = {
|
|
157
|
+
...mockService,
|
|
158
|
+
_id: 'test-service-course',
|
|
159
|
+
name: 'Course Service',
|
|
160
|
+
type: ServiceType.COURSE,
|
|
161
|
+
defaultCapacity: 25,
|
|
162
|
+
schedule: {
|
|
163
|
+
...mockService.schedule,
|
|
164
|
+
firstSessionStart: new Date('2024-01-15T09:00:00Z'),
|
|
165
|
+
lastSessionEnd: new Date('2024-03-15T17:00:00Z'),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Mock service without optional fields (minimal)
|
|
170
|
+
*/
|
|
171
|
+
export const mockServiceMinimal = {
|
|
172
|
+
_id: 'test-service-minimal',
|
|
173
|
+
name: 'Minimal Service',
|
|
174
|
+
description: '',
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Array of mock services for list tests
|
|
178
|
+
*/
|
|
179
|
+
export const mockServices = [
|
|
180
|
+
{
|
|
181
|
+
_id: 'service-1',
|
|
182
|
+
name: 'Service One',
|
|
183
|
+
description: 'Description for service one',
|
|
184
|
+
type: ServiceType.APPOINTMENT,
|
|
185
|
+
payment: {
|
|
186
|
+
rateType: RateType.FIXED,
|
|
187
|
+
fixed: {
|
|
188
|
+
price: {
|
|
189
|
+
value: '50.00',
|
|
190
|
+
currency: 'USD',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
_id: 'service-2',
|
|
197
|
+
name: 'Service Two',
|
|
198
|
+
description: 'Description for service two',
|
|
199
|
+
type: ServiceType.CLASS,
|
|
200
|
+
payment: {
|
|
201
|
+
rateType: RateType.FIXED,
|
|
202
|
+
fixed: {
|
|
203
|
+
price: {
|
|
204
|
+
value: '75.00',
|
|
205
|
+
currency: 'USD',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
defaultCapacity: 15,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
_id: 'service-3',
|
|
213
|
+
name: 'Service Three',
|
|
214
|
+
description: 'Description for service three',
|
|
215
|
+
type: ServiceType.COURSE,
|
|
216
|
+
payment: {
|
|
217
|
+
rateType: RateType.CUSTOM,
|
|
218
|
+
custom: {
|
|
219
|
+
description: 'Contact for pricing',
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
defaultCapacity: 25,
|
|
223
|
+
},
|
|
224
|
+
];
|
|
225
|
+
/**
|
|
226
|
+
* Default paging metadata
|
|
227
|
+
*/
|
|
228
|
+
export const mockPagingMetadata = {
|
|
229
|
+
limit: 10,
|
|
230
|
+
offset: 0,
|
|
231
|
+
count: 3,
|
|
232
|
+
hasNext: false,
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Paging metadata with more items available
|
|
236
|
+
*/
|
|
237
|
+
export const mockPagingMetadataWithMore = {
|
|
238
|
+
limit: 10,
|
|
239
|
+
offset: 0,
|
|
240
|
+
count: 10,
|
|
241
|
+
hasNext: true,
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Empty paging metadata
|
|
245
|
+
*/
|
|
246
|
+
export const mockPagingMetadataEmpty = {
|
|
247
|
+
limit: 10,
|
|
248
|
+
offset: 0,
|
|
249
|
+
count: 0,
|
|
250
|
+
hasNext: false,
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Service list config with services
|
|
254
|
+
*/
|
|
255
|
+
export const mockServiceListConfig = {
|
|
256
|
+
services: mockServices,
|
|
257
|
+
options: {
|
|
258
|
+
appId: BOOKING_APP_ID,
|
|
259
|
+
pagingMetadata: mockPagingMetadata,
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Service list config with hasNext for pagination testing
|
|
264
|
+
*/
|
|
265
|
+
export const mockServiceListConfigWithMore = {
|
|
266
|
+
services: mockServices,
|
|
267
|
+
options: {
|
|
268
|
+
appId: BOOKING_APP_ID,
|
|
269
|
+
pagingMetadata: mockPagingMetadataWithMore,
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Empty service list config
|
|
274
|
+
*/
|
|
275
|
+
export const mockEmptyServiceListConfig = {
|
|
276
|
+
services: [],
|
|
277
|
+
options: {
|
|
278
|
+
appId: BOOKING_APP_ID,
|
|
279
|
+
pagingMetadata: mockPagingMetadataEmpty,
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Service config for single service
|
|
284
|
+
*/
|
|
285
|
+
export const mockServiceConfig = {
|
|
286
|
+
service: mockService,
|
|
287
|
+
appId: BOOKING_APP_ID,
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Helper to create a large list of services for pagination tests
|
|
291
|
+
*/
|
|
292
|
+
export function createLargeServiceList(count) {
|
|
293
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
294
|
+
_id: `service-${i}`,
|
|
295
|
+
name: `Service ${i}`,
|
|
296
|
+
description: `Description for service ${i}`,
|
|
297
|
+
type: ServiceType.APPOINTMENT,
|
|
298
|
+
payment: {
|
|
299
|
+
rateType: RateType.FIXED,
|
|
300
|
+
fixed: {
|
|
301
|
+
price: {
|
|
302
|
+
value: '50.00',
|
|
303
|
+
currency: 'USD',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
}));
|
|
308
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"groupId": "com.wixpress.headless-components"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
"falconPackageHash": "
|
|
74
|
+
"falconPackageHash": "53ad05f1a9b4cbafe9436ee555493cc5284eb79a1b34b7f0ea78aa6a"
|
|
75
75
|
}
|