@pisell/pisellos 2.3.72 → 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 (42) 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/solution/BookingByStep/index.d.ts +1 -1
  12. package/dist/solution/BookingTicket/index.js +4 -2
  13. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  14. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -2
  15. package/dist/solution/UnifiedBookingSales/index.d.ts +110 -73
  16. package/dist/solution/UnifiedBookingSales/index.js +3349 -971
  17. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  18. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
  19. package/dist/solution/UnifiedBookingSales/types.d.ts +133 -76
  20. package/dist/solution/UnifiedBookingSales/types.js +4 -9
  21. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  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/solution/BookingByStep/index.d.ts +1 -1
  33. package/lib/solution/BookingTicket/index.js +2 -1
  34. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  35. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -0
  36. package/lib/solution/UnifiedBookingSales/index.d.ts +110 -73
  37. package/lib/solution/UnifiedBookingSales/index.js +2289 -374
  38. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  39. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +376 -0
  40. package/lib/solution/UnifiedBookingSales/types.d.ts +133 -76
  41. package/lib/solution/UnifiedBookingSales/types.js +3 -2
  42. 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
  }
@@ -2,6 +2,10 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
5
9
  var __copyProps = (to, from, except, desc) => {
6
10
  if (from && typeof from === "object" || typeof from === "function") {
7
11
  for (let key of __getOwnPropNames(from))
@@ -14,4 +18,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
14
18
 
15
19
  // src/modules/ResourcePlanner/types.ts
16
20
  var types_exports = {};
21
+ __export(types_exports, {
22
+ AvailabilityError: () => AvailabilityError
23
+ });
17
24
  module.exports = __toCommonJS(types_exports);
25
+ var AvailabilityError = class extends Error {
26
+ constructor(code, message, details) {
27
+ super(message);
28
+ this.name = "AvailabilityError";
29
+ this.code = code;
30
+ this.details = details;
31
+ }
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ AvailabilityError
36
+ });
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 6 | 4 | 3 | 5;
329
+ weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -1398,7 +1398,8 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1398
1398
  date,
1399
1399
  presetStartTime: (extra == null ? void 0 : extra.presetStartTime) ?? (0, import_BookingContext.derivePresetStartTimeFromDate)(date),
1400
1400
  customerId: orderCustomerId,
1401
- ...extra || {}
1401
+ ...extra || {},
1402
+ channel: this.getSubmitOrderSalesChannel()
1402
1403
  };
1403
1404
  }
1404
1405
  /**
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
5
5
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
6
6
  *
7
7
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
8
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(门禁:`getIsAutoClose` on prepared cacheItem)
8
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
9
9
  * 3. `add`:两关均通过,直接 transform + 加车
10
10
  */
11
11
  export type AddProductDecision = {
@@ -65,6 +65,7 @@ export interface AddProductDecideContext extends BookingCalcContext {
65
65
  type?: 'select' | 'detail';
66
66
  quantity?: number;
67
67
  customerId?: number | string;
68
+ channel?: string;
68
69
  }
69
70
  /**
70
71
  * 统一补齐预约商品的运行态字段。
@@ -57,6 +57,8 @@ function needsSpecDetailModal(item) {
57
57
  function needsBookingEdit(cacheItem, ctx) {
58
58
  if (isNormalBookingProduct(cacheItem))
59
59
  return false;
60
+ if ((ctx == null ? void 0 : ctx.channel) === "kiosk")
61
+ return true;
60
62
  const isAutoAllocationOn = (ctx == null ? void 0 : ctx.isAutoAllocationOn) || (() => true);
61
63
  return !(0, import_BookingContext.getIsAutoClose)(cacheItem, isAutoAllocationOn);
62
64
  }