@pisell/pisellos 2.3.71 → 2.3.73

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 (43) hide show
  1. package/dist/modules/OpenData/types.d.ts +1 -0
  2. package/dist/modules/Order/utils.js +6 -1
  3. package/dist/modules/ResourcePlanner/index.d.ts +0 -22
  4. package/dist/modules/ResourcePlanner/index.js +1 -180
  5. package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
  6. package/dist/modules/ResourcePlanner/localClock.js +183 -0
  7. package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
  8. package/dist/modules/ResourcePlanner/planner.js +2019 -936
  9. package/dist/modules/ResourcePlanner/types.d.ts +346 -187
  10. package/dist/modules/ResourcePlanner/types.js +33 -1
  11. package/dist/server/index.js +2 -1
  12. package/dist/solution/BookingTicket/index.d.ts +13 -1
  13. package/dist/solution/BookingTicket/index.js +4 -2
  14. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  15. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -2
  16. package/dist/solution/UnifiedBookingSales/index.d.ts +110 -73
  17. package/dist/solution/UnifiedBookingSales/index.js +3349 -971
  18. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  19. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
  20. package/dist/solution/UnifiedBookingSales/types.d.ts +133 -76
  21. package/dist/solution/UnifiedBookingSales/types.js +4 -9
  22. package/lib/modules/OpenData/types.d.ts +1 -0
  23. package/lib/modules/Order/utils.js +5 -1
  24. package/lib/modules/ResourcePlanner/index.d.ts +0 -22
  25. package/lib/modules/ResourcePlanner/index.js +0 -123
  26. package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
  27. package/lib/modules/ResourcePlanner/localClock.js +270 -0
  28. package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
  29. package/lib/modules/ResourcePlanner/planner.js +1903 -798
  30. package/lib/modules/ResourcePlanner/types.d.ts +346 -187
  31. package/lib/modules/ResourcePlanner/types.js +19 -0
  32. package/lib/server/index.js +2 -1
  33. package/lib/solution/BookingTicket/index.d.ts +13 -1
  34. package/lib/solution/BookingTicket/index.js +2 -1
  35. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  36. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -0
  37. package/lib/solution/UnifiedBookingSales/index.d.ts +110 -73
  38. package/lib/solution/UnifiedBookingSales/index.js +2289 -374
  39. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  40. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +376 -0
  41. package/lib/solution/UnifiedBookingSales/types.d.ts +133 -76
  42. package/lib/solution/UnifiedBookingSales/types.js +3 -2
  43. package/package.json +1 -1
@@ -1,227 +1,386 @@
1
- export type ResourcePlannerMode = 'appointment' | 'scan_order' | 'venue_grid';
2
- export type ResourcePlannerProductKind = 'normal' | 'duration' | 'session' | 'venue_slot';
3
- export type ResourcePlannerResourceType = 'single' | 'multiple' | 'capacity';
4
- export type ResourcePlannerStatus = 'available' | 'limited' | 'full' | 'conflict' | 'unavailable' | 'past';
5
- export interface ResourcePlannerTimeRange {
6
- start_at: string;
7
- end_at: string;
8
- }
9
- export interface ResourcePlannerEvent extends ResourcePlannerTimeRange {
10
- resourceId?: number | string;
11
- resource_id?: number | string;
12
- pax?: number;
13
- product_uid?: string;
14
- source?: 'remote' | 'cart' | 'selection';
15
- [key: string]: any;
1
+ export type AvailabilityId = number | string;
2
+ export type AvailabilityMode = 'appointment' | 'scan_order' | 'venue_grid';
3
+ export type AvailabilityProductKind = 'normal' | 'duration' | 'session' | 'venue_slot';
4
+ export type AvailabilityResourceType = 'single' | 'multiple' | 'capacity';
5
+ export type AvailabilityStatus = 'available' | 'limited' | 'full' | 'conflict' | 'unavailable' | 'past';
6
+ export type AvailabilityScheduleMode = 'daily' | 'weekly' | 'designation';
7
+ export type AvailabilityErrorCode = 'MISSING_ANCHOR' | 'MISSING_CATALOG_SCOPE' | 'AVAILABILITY_CONTEXT_NOT_FOUND' | 'AVAILABILITY_SELECTION_STALE' | 'AVAILABILITY_COMMIT_IN_PROGRESS' | 'OPERATING_HOURS_RESOLVE_FAILED' | 'INVALID_DATE_RANGE' | 'RANGE_TOO_LARGE' | 'OUT_OF_PROJECTION_COVERAGE' | 'STALE_PROJECTION' | 'INVALID_TARGET_FILTER' | 'MISSING_TIME_CANDIDATES' | 'MISSING_SELECTED_RANGE' | 'PRODUCT_LINE_NOT_FOUND' | 'SELF_EXCLUSION_RESOLVE_FAILED' | 'INVALID_RESERVATION_QUANTITY' | 'REVALIDATION_FAILED';
8
+ export interface AvailabilityAbsoluteRange {
9
+ startAt: string;
10
+ endAt: string;
16
11
  }
17
- export interface ResourcePlannerResourceRequirement {
18
- formId?: number | string;
19
- resourceIds?: Array<number | string>;
20
- resourceType?: ResourcePlannerResourceType;
21
- capacityRequired?: number;
12
+ export interface AvailabilityDisplayRange extends AvailabilityAbsoluteRange {
13
+ date: string;
14
+ startTime: string;
15
+ endTime: string;
16
+ timezone: string;
17
+ }
18
+ export interface AvailabilityDateRange {
19
+ startDate: string;
20
+ endDate: string;
21
+ }
22
+ export interface AvailabilityScheduleRef {
23
+ scheduleId?: AvailabilityId;
24
+ timeSlotId?: AvailabilityId;
25
+ ruleId?: string;
26
+ source?: string;
27
+ label?: string;
28
+ }
29
+ export interface AvailabilityScheduleRule {
30
+ id: string;
31
+ mode: AvailabilityScheduleMode;
32
+ startTime: string;
33
+ endTime: string;
34
+ startDate?: string;
35
+ endDate?: string;
36
+ frequency?: number;
37
+ weekdays?: number[];
38
+ dates?: string[];
39
+ includeDates?: string[];
40
+ excludeDates?: string[];
41
+ scheduleRef?: AvailabilityScheduleRef;
42
+ }
43
+ export interface AvailabilitySessionRange extends AvailabilityAbsoluteRange {
44
+ scheduleRefs?: AvailabilityScheduleRef[];
45
+ }
46
+ export interface AvailabilityRequirementGroup {
47
+ id: string;
48
+ formId?: AvailabilityId;
49
+ title?: string;
50
+ code?: string;
51
+ resourceType: AvailabilityResourceType;
22
52
  required?: boolean;
53
+ min?: number;
54
+ max?: number;
55
+ resourceIds?: AvailabilityId[];
56
+ capacityRequired?: number;
57
+ raw?: Record<string, any>;
23
58
  }
24
- export interface ResourcePlannerProduct {
25
- id: number | string;
59
+ export type AvailabilityCutOffPolicy = {
60
+ type: 'ongoing';
61
+ mode: 'before_end';
62
+ futureDay?: number;
63
+ } | {
64
+ type: 'ongoing';
65
+ mode: 'after_start';
66
+ graceMinutes: number;
67
+ futureDay?: number;
68
+ } | {
69
+ type: 'before_start';
70
+ futureDay?: number;
71
+ } | {
72
+ type: 'advance';
73
+ unit: number;
74
+ unitType: 'days' | 'hours' | 'minutes';
75
+ futureDay?: number;
76
+ } | {
77
+ type: 'invalid';
78
+ reason: string;
79
+ };
80
+ export interface AvailabilityProduct {
81
+ id: AvailabilityId;
26
82
  title?: string;
27
- kind: ResourcePlannerProductKind;
83
+ kind: AvailabilityProductKind;
28
84
  durationMinutes?: number;
29
- schedule?: ResourcePlannerTimeRange[];
30
- resourceRequirements?: ResourcePlannerResourceRequirement[];
31
- capacityRequired?: number;
32
85
  quantity?: number;
33
- price?: string | number | null;
86
+ capacityRequired?: number;
87
+ cutOffPolicy?: AvailabilityCutOffPolicy;
88
+ requirementGroups?: AvailabilityRequirementGroup[];
89
+ sessionRules?: AvailabilityScheduleRule[];
90
+ sessionRanges?: AvailabilitySessionRange[];
91
+ raw?: Record<string, any>;
92
+ }
93
+ export interface AvailabilityResourceWindow extends AvailabilityAbsoluteRange {
94
+ source?: string;
34
95
  raw?: Record<string, any>;
35
96
  }
36
- export interface ResourcePlannerResource {
37
- id: number | string;
38
- formId?: number | string;
97
+ export type AvailabilityOperatingHoursSource = 'prepare_business_hours' | 'open_data_schedule' | 'default_business_hours';
98
+ export interface AvailabilityOperatingHoursSnapshot {
99
+ source: AvailabilityOperatingHoursSource;
100
+ scheduleIds: AvailabilityId[];
101
+ missingScheduleIds: AvailabilityId[];
102
+ windows: AvailabilityResourceWindow[];
103
+ }
104
+ export interface AvailabilityResource {
105
+ id: AvailabilityId;
106
+ formId?: AvailabilityId;
39
107
  name?: string;
40
- resourceType: ResourcePlannerResourceType;
108
+ code?: string;
109
+ resourceType: AvailabilityResourceType;
41
110
  capacity: number;
42
- times: Array<ResourcePlannerTimeRange & {
43
- event_list?: ResourcePlannerEvent[];
44
- [key: string]: any;
45
- }>;
46
- childResourceIds?: Array<number | string>;
111
+ windows: AvailabilityResourceWindow[];
47
112
  raw?: Record<string, any>;
48
113
  }
49
- export interface ResourcePlannerContextInput {
50
- products?: ResourcePlannerProduct[];
51
- resources?: ResourcePlannerResource[];
52
- externalEvents?: ResourcePlannerEvent[];
53
- slotDurationMinutes?: number;
54
- businessStartTime?: string;
55
- businessEndTime?: string;
56
- }
57
- export interface ResourcePlannerQuery {
58
- mode?: ResourcePlannerMode;
59
- productIds?: Array<number | string>;
60
- date?: string;
61
- dateRange?: {
62
- start: string;
63
- end: string;
64
- };
65
- startTime?: string;
66
- endTime?: string;
67
- resourceIds?: Array<number | string>;
68
- serviceObjectIds?: Array<number | string>;
69
- holderIds?: Array<number | string>;
114
+ export interface AvailabilityOccupancy extends AvailabilityAbsoluteRange {
115
+ id?: string;
116
+ resourceId: AvailabilityId;
70
117
  pax?: number;
71
- slotDurationMinutes?: number;
72
- }
73
- export interface ResourcePlannerSelection {
74
- productIds: Array<number | string>;
75
- date?: string;
76
- startTime?: string;
77
- endTime?: string;
78
- resourceIds: Array<number | string>;
79
- assignments: ResourcePlannerAssignment[];
80
- mode?: ResourcePlannerMode;
118
+ source?: 'remote' | 'cart' | 'selection';
119
+ serverEventId?: AvailabilityId;
120
+ bookingUid?: AvailabilityId;
121
+ productUid?: AvailabilityId;
122
+ scheduleEventId?: AvailabilityId;
123
+ raw?: Record<string, any>;
81
124
  }
82
- export interface ResourcePlannerSelectionPatch extends Partial<ResourcePlannerSelection> {
83
- replaceAssignments?: boolean;
125
+ export interface AvailabilityProjectionMeta {
126
+ readonly snapshotId: string;
127
+ readonly preparedAt: string;
128
+ readonly timezone: string;
129
+ readonly orderRevision?: AvailabilityId;
130
+ readonly mode: AvailabilityMode;
131
+ readonly coverage: Readonly<AvailabilityDateRange & AvailabilityAbsoluteRange>;
132
+ readonly defaults: {
133
+ readonly slotStepMinutes: number;
134
+ readonly businessHours: {
135
+ readonly startTime: string;
136
+ readonly endTime: string;
137
+ };
138
+ readonly operatingHours: Readonly<AvailabilityOperatingHoursSnapshot>;
139
+ };
140
+ readonly now: string;
141
+ readonly durationCandidateAnchorAt: string;
142
+ readonly prepareParams?: Readonly<Record<string, any>>;
143
+ readonly anchors?: {
144
+ readonly productIds?: readonly AvailabilityId[];
145
+ readonly resourceIds?: readonly AvailabilityId[];
146
+ readonly dateRange?: Readonly<AvailabilityDateRange>;
147
+ };
84
148
  }
85
- export interface ResourcePlannerDemandInterval {
86
- id: string;
87
- productId: number | string;
88
- source: Extract<ResourcePlannerProductKind, 'duration' | 'session' | 'venue_slot'>;
89
- date: string;
90
- start_at: string;
91
- end_at: string;
92
- durationMinutes: number;
93
- quantity: number;
94
- capacityRequired: number;
95
- resourceRequirements: ResourcePlannerResourceRequirement[];
96
- }
97
- export interface ResourcePlannerConflict {
98
- type: 'outside_resource_time' | 'remote_event_overlap' | 'cart_overlap' | 'capacity_full' | 'missing_time' | 'missing_resource' | 'missing_assignment' | 'past';
99
- message: string;
100
- event?: ResourcePlannerEvent;
101
- resourceId?: number | string;
102
- productId?: number | string;
149
+ export interface AvailabilityProjectionInput {
150
+ products: AvailabilityProduct[];
151
+ resources: AvailabilityResource[];
152
+ resourceOccupancies?: AvailabilityOccupancy[];
153
+ mode?: AvailabilityMode;
154
+ timezone: string;
155
+ coverage: AvailabilityDateRange;
156
+ slotStepMinutes?: number;
157
+ businessHours?: {
158
+ startTime: string;
159
+ endTime: string;
160
+ };
161
+ operatingHours?: AvailabilityOperatingHoursSnapshot;
162
+ snapshotId?: string;
163
+ preparedAt?: string;
164
+ now?: string;
165
+ durationCandidateAnchorAt?: string;
166
+ orderRevision?: AvailabilityId;
167
+ anchors?: AvailabilityProjectionMeta['anchors'];
168
+ prepareParams?: Record<string, any>;
103
169
  }
104
- export interface ResourcePlannerAvailabilityCell {
170
+ export interface AvailabilityCell extends AvailabilityDisplayRange {
105
171
  key: string;
106
- productId: number | string;
107
- resourceId?: number | string;
108
- date?: string;
109
- start_at: string;
110
- end_at: string;
111
- startTime?: string;
112
- endTime?: string;
113
- durationMinutes?: number;
114
- cellType: 'availability_range' | 'fixed_interval' | 'unavailable';
115
- status: ResourcePlannerStatus;
172
+ productId: AvailabilityId;
173
+ requirementGroupId?: string;
174
+ requirementFormId?: AvailabilityId;
175
+ resourceId?: AvailabilityId;
176
+ resourceName?: string;
177
+ resourceType?: AvailabilityResourceType;
178
+ status: AvailabilityStatus;
116
179
  remainingCapacity?: number;
117
180
  maxCapacity?: number;
118
181
  reasonCodes: string[];
119
- conflicts: ResourcePlannerConflict[];
182
+ occupancyRefs: Array<{
183
+ id?: string;
184
+ resourceId: AvailabilityId;
185
+ source?: AvailabilityOccupancy['source'];
186
+ serverEventId?: AvailabilityId;
187
+ bookingUid?: AvailabilityId;
188
+ productUid?: AvailabilityId;
189
+ scheduleEventId?: AvailabilityId;
190
+ }>;
191
+ }
192
+ export interface AvailabilityProjection {
193
+ readonly meta: AvailabilityProjectionMeta;
194
+ readonly products: readonly AvailabilityProduct[];
195
+ readonly resources: readonly AvailabilityResource[];
196
+ readonly resourceOccupancies: readonly AvailabilityOccupancy[];
197
+ readonly cells: readonly AvailabilityCell[];
120
198
  }
121
- export interface ResourcePlannerProductOption {
122
- productId: number | string;
199
+ export interface ProductTimeRange extends AvailabilityDisplayRange {
200
+ key: string;
201
+ productId: AvailabilityId;
202
+ source: 'session_schedule' | 'duration_window';
203
+ /** Actual interval start used by availability evaluation, assignments, and cart booking. */
204
+ bookingStartAt: string;
205
+ /** Actual interval end kept explicitly for availability evaluation and cart compatibility. */
206
+ bookingEndAt: string;
207
+ scheduleRefs: AvailabilityScheduleRef[];
208
+ primaryScheduleRef?: AvailabilityScheduleRef;
209
+ }
210
+ export interface ProductTimeRangeGroup {
211
+ productId: AvailabilityId;
123
212
  title?: string;
124
- status: ResourcePlannerStatus;
125
- reasonCodes: string[];
213
+ kind: AvailabilityProductKind;
214
+ ranges: ProductTimeRange[];
215
+ }
216
+ export interface AvailabilityAssignment extends AvailabilityAbsoluteRange {
217
+ productId: AvailabilityId;
218
+ resourceId: AvailabilityId;
219
+ formId?: AvailabilityId;
220
+ capacityRequired?: number;
221
+ scheduleId?: AvailabilityId;
222
+ timeSlotId?: AvailabilityId;
126
223
  }
127
- export interface ResourcePlannerResourceOption {
128
- resourceId: number | string;
224
+ export interface AvailabilityRequirementSelection {
225
+ requirementGroupId?: string;
226
+ formId?: AvailabilityId;
227
+ resourceIds: AvailabilityId[];
228
+ }
229
+ export interface GetProductTimeRangesRequest {
230
+ productIds?: AvailabilityId[];
231
+ dateRange?: Partial<AvailabilityDateRange>;
232
+ resourceIds?: AvailabilityId[];
233
+ partySize?: number;
234
+ }
235
+ export interface QueryAvailabilityBaseRequest {
236
+ productIds?: AvailabilityId[];
237
+ resourceIds?: AvailabilityId[];
238
+ partySize?: number;
239
+ }
240
+ export interface ProductAvailabilityQuery extends QueryAvailabilityBaseRequest {
241
+ target: 'product';
242
+ dateRange?: Partial<AvailabilityDateRange>;
243
+ }
244
+ export interface DateAvailabilityQuery extends QueryAvailabilityBaseRequest {
245
+ target: 'date';
246
+ dateRange?: Partial<AvailabilityDateRange>;
247
+ }
248
+ export interface TimeAvailabilityQuery extends QueryAvailabilityBaseRequest {
249
+ target: 'time';
250
+ candidates: ProductTimeRange[];
251
+ }
252
+ export interface ResourceAvailabilityQuery extends QueryAvailabilityBaseRequest {
253
+ target: 'resource';
254
+ selectedRanges: ProductTimeRange[];
255
+ }
256
+ export type AvailabilityQuery = ProductAvailabilityQuery | DateAvailabilityQuery | TimeAvailabilityQuery | ResourceAvailabilityQuery;
257
+ export interface AvailabilityResourceOption {
258
+ resourceId: AvailabilityId;
129
259
  resourceName?: string;
130
- resourceFormId?: number | string;
131
- resourceType: ResourcePlannerResourceType;
132
- status: ResourcePlannerStatus;
260
+ resourceFormId?: AvailabilityId;
261
+ resourceType: AvailabilityResourceType;
262
+ status: AvailabilityStatus;
263
+ remainingCapacity?: number;
264
+ maxCapacity?: number;
265
+ maxPartySize: number;
266
+ reasonCodes: string[];
267
+ }
268
+ export interface AvailabilityRequirementGroupResult {
269
+ groupId: string;
270
+ formId?: AvailabilityId;
271
+ title?: string;
272
+ code?: string;
273
+ resourceType: AvailabilityResourceType;
274
+ required: boolean;
275
+ min: number;
276
+ max: number;
277
+ status: AvailabilityStatus;
278
+ availableResourceCount: number;
279
+ totalResourceCount: number;
280
+ maxPartySize: number;
133
281
  remainingCapacity?: number;
134
282
  maxCapacity?: number;
135
283
  reasonCodes: string[];
284
+ options: AvailabilityResourceOption[];
285
+ }
286
+ export interface TimeAvailabilityItem extends ProductTimeRange {
287
+ status: AvailabilityStatus;
288
+ maxPartySize: number;
289
+ reasonCodes: string[];
290
+ requirementGroups: AvailabilityRequirementGroupResult[];
291
+ }
292
+ export interface ProductAvailabilityItem {
293
+ productId: AvailabilityId;
294
+ title?: string;
295
+ status: AvailabilityStatus;
296
+ reasonCodes: string[];
297
+ availableDateCount: number;
298
+ totalDateCount: number;
299
+ availableTimeCount: number;
300
+ totalTimeCount: number;
301
+ maxPartySize: number;
136
302
  }
137
- export interface ResourcePlannerDateSummary {
303
+ export interface DateAvailabilityItem {
138
304
  date: string;
139
- status: ResourcePlannerStatus;
305
+ status: AvailabilityStatus;
140
306
  availableCount: number;
141
307
  totalCount: number;
308
+ maxPartySize: number;
309
+ remainingCapacity: number;
310
+ maxCapacity: number;
311
+ reasonCodes: string[];
142
312
  }
143
- export interface ResourcePlannerTimeSlot {
144
- startTime: string;
145
- endTime: string;
146
- status: ResourcePlannerStatus;
147
- resourceId: number | string;
148
- productId?: number | string;
149
- remainingCapacity?: number;
150
- maxCapacity?: number;
313
+ export interface ProductAvailabilityGroup {
314
+ productId: AvailabilityId;
315
+ title?: string;
316
+ item: ProductAvailabilityItem;
317
+ }
318
+ export interface DateAvailabilityGroup {
319
+ productId: AvailabilityId;
320
+ title?: string;
321
+ dates: DateAvailabilityItem[];
322
+ }
323
+ export interface TimeAvailabilityGroup {
324
+ productId: AvailabilityId;
325
+ title?: string;
326
+ times: TimeAvailabilityItem[];
327
+ }
328
+ export interface ResourceAvailabilityRangeGroup {
329
+ range: ProductTimeRange;
330
+ status: AvailabilityStatus;
331
+ maxPartySize: number;
151
332
  reasonCodes: string[];
333
+ requirementGroups: AvailabilityRequirementGroupResult[];
152
334
  }
153
- export interface ResourcePlannerTimeGridRow {
154
- resourceId: number | string;
155
- resourceName?: string;
156
- resourceFormId?: number | string;
157
- slots: ResourcePlannerTimeSlot[];
158
- }
159
- export interface ResourcePlannerTimeGrid {
160
- date?: string;
161
- timeLabels: string[];
162
- resources: ResourcePlannerTimeGridRow[];
163
- }
164
- export interface ResourcePlannerProjection {
165
- query: ResourcePlannerQuery;
166
- demandIntervals: ResourcePlannerDemandInterval[];
167
- productOptions: ResourcePlannerProductOption[];
168
- resourceOptions: ResourcePlannerResourceOption[];
169
- dateSummary: ResourcePlannerDateSummary[];
170
- timeGrid: ResourcePlannerTimeGrid;
171
- cells: ResourcePlannerAvailabilityCell[];
172
- }
173
- export interface ResourcePlannerAssignment {
174
- productId: number | string;
175
- resourceId: number | string;
176
- start_at: string;
177
- end_at: string;
178
- capacityRequired?: number;
335
+ export interface ResourceAvailabilityGroup {
336
+ productId: AvailabilityId;
337
+ title?: string;
338
+ ranges: ResourceAvailabilityRangeGroup[];
179
339
  }
180
- export interface ResourcePlannerAssignableSlotResource {
181
- resourceId: number | string;
340
+ export interface AvailabilityQueryResultBase<TTarget extends AvailabilityQuery['target'], TData> {
341
+ target: TTarget;
342
+ evaluatedAt: string;
343
+ snapshotId: string;
344
+ data: TData;
345
+ }
346
+ export type ProductAvailabilityQueryResult = AvailabilityQueryResultBase<'product', ProductAvailabilityGroup[]>;
347
+ export type DateAvailabilityQueryResult = AvailabilityQueryResultBase<'date', DateAvailabilityGroup[]>;
348
+ export type TimeAvailabilityQueryResult = AvailabilityQueryResultBase<'time', TimeAvailabilityGroup[]>;
349
+ export type ResourceAvailabilityQueryResult = AvailabilityQueryResultBase<'resource', ResourceAvailabilityGroup[]>;
350
+ export type AvailabilityQueryResult = ProductAvailabilityQueryResult | DateAvailabilityQueryResult | TimeAvailabilityQueryResult | ResourceAvailabilityQueryResult;
351
+ export interface AvailabilityValidationConflict {
352
+ code: string;
353
+ message: string;
354
+ reasonCodes?: string[];
355
+ productId?: AvailabilityId;
356
+ requirementGroupId?: string;
357
+ formId?: AvailabilityId;
358
+ resourceId?: AvailabilityId;
182
359
  resourceName?: string;
183
- resourceFormId?: number | string;
184
- resourceType?: ResourcePlannerResourceType;
185
- capacityRequired?: number;
360
+ candidateKey?: string;
361
+ requestedQuantity?: number;
362
+ availableQuantity?: number;
186
363
  remainingCapacity?: number;
187
- maxCapacity?: number;
364
+ capacityPerBooking?: number;
188
365
  }
189
- export interface ResourcePlannerAssignableSlot {
190
- key: string;
191
- productId: number | string;
192
- date: string;
193
- start_at: string;
194
- end_at: string;
195
- startTime: string;
196
- endTime: string;
197
- durationMinutes: number;
198
- status: ResourcePlannerStatus;
199
- resources: ResourcePlannerAssignableSlotResource[];
200
- assignments: ResourcePlannerAssignment[];
201
- conflicts: ResourcePlannerConflict[];
202
- }
203
- export interface ResourcePlannerAssignableSlotResult {
204
- projection: ResourcePlannerProjection;
205
- slots: ResourcePlannerAssignableSlot[];
206
- conflicts: ResourcePlannerConflict[];
207
- }
208
- export interface ResourcePlannerAssignmentResult {
209
- assignments: ResourcePlannerAssignment[];
210
- conflicts: ResourcePlannerConflict[];
211
- }
212
- export interface ResourcePlannerValidationResult {
366
+ export interface AvailabilitySelectionValidationParams {
367
+ candidate: ProductTimeRange;
368
+ partySize?: number;
369
+ bookingCount?: number;
370
+ requirementSelections: AvailabilityRequirementSelection[];
371
+ }
372
+ export interface AvailabilitySelectionValidationResult {
213
373
  ok: boolean;
214
- conflicts: ResourcePlannerConflict[];
215
- }
216
- export interface ResourcePlannerSnapshot {
217
- context: Required<ResourcePlannerContextInput>;
218
- selection: ResourcePlannerSelection;
219
- projection: ResourcePlannerProjection | null;
220
- version: number;
221
- }
222
- export interface ResourcePlannerState {
223
- context: Required<ResourcePlannerContextInput>;
224
- selection: ResourcePlannerSelection;
225
- projection: ResourcePlannerProjection | null;
226
- version: number;
374
+ status: AvailabilityStatus;
375
+ assignments: AvailabilityAssignment[];
376
+ conflicts: AvailabilityValidationConflict[];
377
+ availability: TimeAvailabilityItem;
378
+ }
379
+ export interface AvailabilityErrorDetails {
380
+ [key: string]: any;
381
+ }
382
+ export declare class AvailabilityError extends Error {
383
+ code: AvailabilityErrorCode;
384
+ details?: AvailabilityErrorDetails;
385
+ constructor(code: AvailabilityErrorCode, message: string, details?: AvailabilityErrorDetails);
227
386
  }
@@ -1 +1,33 @@
1
- export {};
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
8
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
9
+ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
10
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
11
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
+ function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ export var AvailabilityError = /*#__PURE__*/function (_Error) {
19
+ _inherits(AvailabilityError, _Error);
20
+ var _super = _createSuper(AvailabilityError);
21
+ function AvailabilityError(code, message, details) {
22
+ var _this;
23
+ _classCallCheck(this, AvailabilityError);
24
+ _this = _super.call(this, message);
25
+ _defineProperty(_assertThisInitialized(_this), "code", void 0);
26
+ _defineProperty(_assertThisInitialized(_this), "details", void 0);
27
+ _this.name = 'AvailabilityError';
28
+ _this.code = code;
29
+ _this.details = details;
30
+ return _this;
31
+ }
32
+ return _createClass(AvailabilityError);
33
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
@@ -5628,7 +5628,8 @@ var Server = /*#__PURE__*/function () {
5628
5628
  order_id: printIdentity,
5629
5629
  small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data,
5630
5630
  skip_wristband: true,
5631
- skip_voucher: true
5631
+ skip_voucher: true,
5632
+ skip_discount: true
5632
5633
  } : {
5633
5634
  order_id: printIdentity,
5634
5635
  machine_code_print_info: (_params$syncedOrder2 = params.syncedOrder) === null || _params$syncedOrder2 === void 0 || (_params$syncedOrder2 = _params$syncedOrder2.payment_info) === null || _params$syncedOrder2 === void 0 ? void 0 : _params$syncedOrder2.machine_code_print_info,
@@ -453,7 +453,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
453
453
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
454
454
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
455
455
  */
456
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
456
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
457
+ action: "reloadCatalog";
458
+ } | {
459
+ action: "add";
460
+ cacheItem: any;
461
+ } | {
462
+ action: "requiresDetail";
463
+ payload: AddProductRequiresDetailPayload;
464
+ } | {
465
+ action: "requiresBookingEdit";
466
+ cacheItem: any;
467
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
468
+ };
457
469
  /** 规格弹窗 callback 后的第二段决策。 */
458
470
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
459
471
  /**
@@ -2337,14 +2337,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2337
2337
  var bookingContextState = this.store.bookingContext.getState();
2338
2338
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2339
2339
  var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2340
- return _objectSpread({
2340
+ return _objectSpread(_objectSpread({
2341
2341
  bookingConfig: bookingContextState.bookingConfig,
2342
2342
  resourcesOrigin: bookingContextState.resourcesOrigin,
2343
2343
  resourcesOriginMap: bookingContextState.resourcesOriginMap,
2344
2344
  date: date,
2345
2345
  presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
2346
2346
  customerId: orderCustomerId
2347
- }, extra || {});
2347
+ }, extra || {}), {}, {
2348
+ channel: this.getSubmitOrderSalesChannel()
2349
+ });
2348
2350
  }
2349
2351
 
2350
2352
  /**