@pisell/pisellos 2.2.292 → 2.2.293

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 (173) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +108 -65
  3. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  4. package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
  5. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  6. package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
  7. package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
  8. package/dist/model/strategy/adapter/itemRule/type.js +19 -1
  9. package/dist/modules/BookingContext/index.d.ts +3 -0
  10. package/dist/modules/BookingContext/index.js +42 -13
  11. package/dist/modules/BookingContext/types.d.ts +4 -4
  12. package/dist/modules/BookingContext/types.js +3 -3
  13. package/dist/modules/OpenData/types.d.ts +1 -0
  14. package/dist/modules/Order/index.d.ts +19 -4
  15. package/dist/modules/Order/index.js +885 -485
  16. package/dist/modules/Order/salesNotes.d.ts +31 -0
  17. package/dist/modules/Order/salesNotes.js +492 -0
  18. package/dist/modules/Order/types.d.ts +93 -5
  19. package/dist/modules/Order/types.js +5 -0
  20. package/dist/modules/Order/utils.d.ts +12 -0
  21. package/dist/modules/Order/utils.js +96 -31
  22. package/dist/modules/Product/types.d.ts +2 -0
  23. package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
  24. package/dist/modules/ProductList/clientDataVariants.js +216 -0
  25. package/dist/modules/ProductList/index.d.ts +18 -3
  26. package/dist/modules/ProductList/index.js +220 -38
  27. package/dist/modules/ProductList/types.d.ts +10 -0
  28. package/dist/modules/Quotation/index.d.ts +22 -0
  29. package/dist/modules/Quotation/index.js +293 -28
  30. package/dist/modules/ResourcePlanner/index.d.ts +0 -22
  31. package/dist/modules/ResourcePlanner/index.js +1 -180
  32. package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
  33. package/dist/modules/ResourcePlanner/localClock.js +183 -0
  34. package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
  35. package/dist/modules/ResourcePlanner/planner.js +2111 -958
  36. package/dist/modules/ResourcePlanner/types.d.ts +359 -187
  37. package/dist/modules/ResourcePlanner/types.js +33 -1
  38. package/dist/plugins/request.d.ts +1 -0
  39. package/dist/server/index.d.ts +17 -2
  40. package/dist/server/index.js +1134 -932
  41. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  42. package/dist/server/modules/floor-plan/index.js +240 -98
  43. package/dist/server/modules/menu/index.js +48 -23
  44. package/dist/server/modules/order/index.d.ts +17 -7
  45. package/dist/server/modules/order/index.js +419 -207
  46. package/dist/server/modules/products/index.d.ts +10 -4
  47. package/dist/server/modules/products/index.js +177 -84
  48. package/dist/server/modules/resource/index.js +21 -13
  49. package/dist/server/utils/product.d.ts +1 -1
  50. package/dist/server/utils/product.js +186 -22
  51. package/dist/server/utils/small-ticket.d.ts +9 -1
  52. package/dist/server/utils/small-ticket.js +136 -41
  53. package/dist/solution/BaseSales/index.d.ts +26 -3
  54. package/dist/solution/BaseSales/index.js +1384 -905
  55. package/dist/solution/BaseSales/types.d.ts +2 -0
  56. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  57. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +10 -3
  58. package/dist/solution/BaseSales/utils.js +6 -3
  59. package/dist/solution/BookingByStep/index.d.ts +4 -4
  60. package/dist/solution/BookingTicket/index.d.ts +1 -1
  61. package/dist/solution/BookingTicket/index.js +4 -2
  62. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  63. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -3
  64. package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
  65. package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
  66. package/dist/solution/RegisterAndLogin/config.js +95 -40
  67. package/dist/solution/RegisterAndLogin/index.js +4 -1
  68. package/dist/solution/ScanOrder/index.d.ts +1 -0
  69. package/dist/solution/ScanOrder/index.js +31 -27
  70. package/dist/solution/ScanOrder/types.d.ts +2 -0
  71. package/dist/solution/ScanOrder/utils.d.ts +1 -0
  72. package/dist/solution/ScanOrder/utils.js +8 -3
  73. package/dist/solution/UnifiedBookingSales/index.d.ts +128 -74
  74. package/dist/solution/UnifiedBookingSales/index.js +3877 -963
  75. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  76. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
  77. package/dist/solution/UnifiedBookingSales/types.d.ts +161 -77
  78. package/dist/solution/UnifiedBookingSales/types.js +4 -9
  79. package/dist/solution/VenueBooking/index.d.ts +3 -0
  80. package/dist/solution/VenueBooking/index.js +549 -497
  81. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  82. package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
  83. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  84. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
  85. package/dist/utils/platform.d.ts +8 -0
  86. package/dist/utils/platform.js +15 -0
  87. package/lib/core/index.d.ts +7 -0
  88. package/lib/core/index.js +20 -2
  89. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  90. package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
  91. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  92. package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
  93. package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
  94. package/lib/model/strategy/adapter/itemRule/type.js +19 -1
  95. package/lib/modules/BookingContext/index.d.ts +3 -0
  96. package/lib/modules/BookingContext/index.js +35 -8
  97. package/lib/modules/BookingContext/types.d.ts +4 -4
  98. package/lib/modules/BookingContext/types.js +3 -3
  99. package/lib/modules/OpenData/types.d.ts +1 -0
  100. package/lib/modules/Order/index.d.ts +19 -4
  101. package/lib/modules/Order/index.js +325 -28
  102. package/lib/modules/Order/salesNotes.d.ts +31 -0
  103. package/lib/modules/Order/salesNotes.js +382 -0
  104. package/lib/modules/Order/types.d.ts +93 -5
  105. package/lib/modules/Order/types.js +4 -0
  106. package/lib/modules/Order/utils.d.ts +12 -0
  107. package/lib/modules/Order/utils.js +85 -16
  108. package/lib/modules/Product/types.d.ts +2 -0
  109. package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
  110. package/lib/modules/ProductList/clientDataVariants.js +204 -0
  111. package/lib/modules/ProductList/index.d.ts +18 -3
  112. package/lib/modules/ProductList/index.js +137 -8
  113. package/lib/modules/ProductList/types.d.ts +10 -0
  114. package/lib/modules/Quotation/index.d.ts +22 -0
  115. package/lib/modules/Quotation/index.js +158 -11
  116. package/lib/modules/ResourcePlanner/index.d.ts +0 -22
  117. package/lib/modules/ResourcePlanner/index.js +9 -129
  118. package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
  119. package/lib/modules/ResourcePlanner/localClock.js +205 -0
  120. package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
  121. package/lib/modules/ResourcePlanner/planner.js +1807 -783
  122. package/lib/modules/ResourcePlanner/types.d.ts +359 -187
  123. package/lib/modules/ResourcePlanner/types.js +13 -1
  124. package/lib/plugins/request.d.ts +1 -0
  125. package/lib/server/index.d.ts +17 -2
  126. package/lib/server/index.js +149 -21
  127. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  128. package/lib/server/modules/floor-plan/index.js +60 -7
  129. package/lib/server/modules/menu/index.js +26 -4
  130. package/lib/server/modules/order/index.d.ts +17 -7
  131. package/lib/server/modules/order/index.js +194 -57
  132. package/lib/server/modules/products/index.d.ts +10 -4
  133. package/lib/server/modules/products/index.js +93 -23
  134. package/lib/server/modules/resource/index.js +12 -2
  135. package/lib/server/utils/product.d.ts +1 -1
  136. package/lib/server/utils/product.js +163 -3
  137. package/lib/server/utils/small-ticket.d.ts +9 -1
  138. package/lib/server/utils/small-ticket.js +126 -33
  139. package/lib/solution/BaseSales/index.d.ts +26 -3
  140. package/lib/solution/BaseSales/index.js +396 -70
  141. package/lib/solution/BaseSales/types.d.ts +2 -0
  142. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  143. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +9 -2
  144. package/lib/solution/BaseSales/utils.js +3 -0
  145. package/lib/solution/BookingByStep/index.d.ts +4 -4
  146. package/lib/solution/BookingTicket/index.d.ts +1 -1
  147. package/lib/solution/BookingTicket/index.js +2 -1
  148. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  149. package/lib/solution/BookingTicket/utils/addProductDecision.js +5 -2
  150. package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
  151. package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
  152. package/lib/solution/RegisterAndLogin/config.js +49 -8
  153. package/lib/solution/RegisterAndLogin/index.js +4 -1
  154. package/lib/solution/ScanOrder/index.d.ts +1 -0
  155. package/lib/solution/ScanOrder/index.js +5 -1
  156. package/lib/solution/ScanOrder/types.d.ts +2 -0
  157. package/lib/solution/ScanOrder/utils.d.ts +1 -0
  158. package/lib/solution/ScanOrder/utils.js +4 -0
  159. package/lib/solution/UnifiedBookingSales/index.d.ts +128 -74
  160. package/lib/solution/UnifiedBookingSales/index.js +2592 -424
  161. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  162. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +316 -0
  163. package/lib/solution/UnifiedBookingSales/types.d.ts +161 -77
  164. package/lib/solution/UnifiedBookingSales/types.js +4 -6
  165. package/lib/solution/VenueBooking/index.d.ts +3 -0
  166. package/lib/solution/VenueBooking/index.js +33 -9
  167. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  168. package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
  169. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  170. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
  171. package/lib/utils/platform.d.ts +8 -0
  172. package/lib/utils/platform.js +22 -0
  173. package/package.json +1 -1
@@ -1,227 +1,399 @@
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;
84
+ isFlexibleDuration?: boolean;
28
85
  durationMinutes?: number;
29
- schedule?: ResourcePlannerTimeRange[];
30
- resourceRequirements?: ResourcePlannerResourceRequirement[];
31
- capacityRequired?: number;
32
86
  quantity?: number;
33
- price?: string | number | null;
87
+ capacityRequired?: number;
88
+ cutOffPolicy?: AvailabilityCutOffPolicy;
89
+ requirementGroups?: AvailabilityRequirementGroup[];
90
+ sessionRules?: AvailabilityScheduleRule[];
91
+ sessionRanges?: AvailabilitySessionRange[];
92
+ raw?: Record<string, any>;
93
+ }
94
+ export interface AvailabilityResourceWindow extends AvailabilityAbsoluteRange {
95
+ source?: string;
34
96
  raw?: Record<string, any>;
35
97
  }
36
- export interface ResourcePlannerResource {
37
- id: number | string;
38
- formId?: number | string;
98
+ export type AvailabilityOperatingHoursSource = 'prepare_business_hours' | 'open_data_schedule' | 'default_business_hours';
99
+ export interface AvailabilityOperatingHoursSnapshot {
100
+ source: AvailabilityOperatingHoursSource;
101
+ scheduleIds: AvailabilityId[];
102
+ missingScheduleIds: AvailabilityId[];
103
+ windows: AvailabilityResourceWindow[];
104
+ }
105
+ export interface AvailabilityResource {
106
+ id: AvailabilityId;
107
+ formId?: AvailabilityId;
39
108
  name?: string;
40
- resourceType: ResourcePlannerResourceType;
109
+ code?: string;
110
+ resourceType: AvailabilityResourceType;
41
111
  capacity: number;
42
- times: Array<ResourcePlannerTimeRange & {
43
- event_list?: ResourcePlannerEvent[];
44
- [key: string]: any;
45
- }>;
46
- childResourceIds?: Array<number | string>;
112
+ windows: AvailabilityResourceWindow[];
47
113
  raw?: Record<string, any>;
48
114
  }
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>;
115
+ export interface AvailabilityOccupancy extends AvailabilityAbsoluteRange {
116
+ id?: string;
117
+ resourceId: AvailabilityId;
70
118
  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;
119
+ source?: 'remote' | 'cart' | 'selection';
120
+ serverEventId?: AvailabilityId;
121
+ bookingUid?: AvailabilityId;
122
+ productUid?: AvailabilityId;
123
+ scheduleEventId?: AvailabilityId;
124
+ raw?: Record<string, any>;
81
125
  }
82
- export interface ResourcePlannerSelectionPatch extends Partial<ResourcePlannerSelection> {
83
- replaceAssignments?: boolean;
126
+ export interface AvailabilityProjectionMeta {
127
+ readonly snapshotId: string;
128
+ readonly preparedAt: string;
129
+ readonly timezone: string;
130
+ readonly orderRevision?: AvailabilityId;
131
+ readonly mode: AvailabilityMode;
132
+ readonly coverage: Readonly<AvailabilityDateRange & AvailabilityAbsoluteRange>;
133
+ readonly defaults: {
134
+ readonly slotStepMinutes: number;
135
+ readonly businessHours: {
136
+ readonly startTime: string;
137
+ readonly endTime: string;
138
+ };
139
+ readonly operatingHours: Readonly<AvailabilityOperatingHoursSnapshot>;
140
+ };
141
+ readonly now: string;
142
+ readonly durationCandidateAnchorAt: string;
143
+ readonly prepareParams?: Readonly<Record<string, any>>;
144
+ readonly anchors?: {
145
+ readonly productIds?: readonly AvailabilityId[];
146
+ readonly resourceIds?: readonly AvailabilityId[];
147
+ readonly dateRange?: Readonly<AvailabilityDateRange>;
148
+ };
84
149
  }
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;
150
+ export interface AvailabilityProjectionInput {
151
+ products: AvailabilityProduct[];
152
+ resources: AvailabilityResource[];
153
+ resourceOccupancies?: AvailabilityOccupancy[];
154
+ mode?: AvailabilityMode;
155
+ timezone: string;
156
+ coverage: AvailabilityDateRange;
157
+ slotStepMinutes?: number;
158
+ businessHours?: {
159
+ startTime: string;
160
+ endTime: string;
161
+ };
162
+ operatingHours?: AvailabilityOperatingHoursSnapshot;
163
+ snapshotId?: string;
164
+ preparedAt?: string;
165
+ now?: string;
166
+ durationCandidateAnchorAt?: string;
167
+ orderRevision?: AvailabilityId;
168
+ anchors?: AvailabilityProjectionMeta['anchors'];
169
+ prepareParams?: Record<string, any>;
103
170
  }
104
- export interface ResourcePlannerAvailabilityCell {
171
+ export interface AvailabilityCell extends AvailabilityDisplayRange {
105
172
  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;
173
+ productId: AvailabilityId;
174
+ requirementGroupId?: string;
175
+ requirementFormId?: AvailabilityId;
176
+ resourceId?: AvailabilityId;
177
+ resourceName?: string;
178
+ resourceType?: AvailabilityResourceType;
179
+ status: AvailabilityStatus;
116
180
  remainingCapacity?: number;
117
181
  maxCapacity?: number;
118
182
  reasonCodes: string[];
119
- conflicts: ResourcePlannerConflict[];
183
+ occupancyRefs: Array<{
184
+ id?: string;
185
+ resourceId: AvailabilityId;
186
+ source?: AvailabilityOccupancy['source'];
187
+ serverEventId?: AvailabilityId;
188
+ bookingUid?: AvailabilityId;
189
+ productUid?: AvailabilityId;
190
+ scheduleEventId?: AvailabilityId;
191
+ }>;
192
+ }
193
+ export interface AvailabilityProjection {
194
+ readonly meta: AvailabilityProjectionMeta;
195
+ readonly products: readonly AvailabilityProduct[];
196
+ readonly resources: readonly AvailabilityResource[];
197
+ readonly resourceOccupancies: readonly AvailabilityOccupancy[];
198
+ readonly cells: readonly AvailabilityCell[];
120
199
  }
121
- export interface ResourcePlannerProductOption {
122
- productId: number | string;
200
+ export interface ProductTimeRange extends AvailabilityDisplayRange {
201
+ key: string;
202
+ productId: AvailabilityId;
203
+ source: 'session_schedule' | 'duration_window';
204
+ /** Actual interval start used by availability evaluation, assignments, and cart booking. */
205
+ bookingStartAt: string;
206
+ /** Actual interval end kept explicitly for availability evaluation and cart compatibility. */
207
+ bookingEndAt: string;
208
+ scheduleRefs: AvailabilityScheduleRef[];
209
+ primaryScheduleRef?: AvailabilityScheduleRef;
210
+ }
211
+ export interface ProductTimeRangeGroup {
212
+ productId: AvailabilityId;
123
213
  title?: string;
124
- status: ResourcePlannerStatus;
125
- reasonCodes: string[];
214
+ kind: AvailabilityProductKind;
215
+ slotStepMinutes?: number;
216
+ ranges: ProductTimeRange[];
217
+ }
218
+ export interface AvailabilityAssignment extends AvailabilityAbsoluteRange {
219
+ productId: AvailabilityId;
220
+ resourceId: AvailabilityId;
221
+ formId?: AvailabilityId;
222
+ capacityRequired?: number;
223
+ scheduleId?: AvailabilityId;
224
+ timeSlotId?: AvailabilityId;
126
225
  }
127
- export interface ResourcePlannerResourceOption {
128
- resourceId: number | string;
226
+ export interface AvailabilityRequirementSelection {
227
+ requirementGroupId?: string;
228
+ formId?: AvailabilityId;
229
+ resourceIds: AvailabilityId[];
230
+ }
231
+ export interface GetProductTimeRangesRequest {
232
+ productIds?: AvailabilityId[];
233
+ dateRange?: Partial<AvailabilityDateRange>;
234
+ resourceIds?: AvailabilityId[];
235
+ partySize?: number;
236
+ durationMinutesByProductId?: Record<string, number>;
237
+ durationStartTimesByProductId?: Record<string, string[]>;
238
+ /**
239
+ * POS 手工输入时间的兼容开关:只为明确请求的 start time 补候选,
240
+ * 不改变常规候选列表仍按营业时间生成的规则。
241
+ */
242
+ allowOutsideOperatingHoursForRequestedStartTimes?: boolean;
243
+ }
244
+ export interface GetProductTimeRangesRuntimeOptions {
245
+ evaluatedAt?: string;
246
+ }
247
+ export interface QueryAvailabilityBaseRequest {
248
+ productIds?: AvailabilityId[];
249
+ resourceIds?: AvailabilityId[];
250
+ partySize?: number;
251
+ }
252
+ export interface ProductAvailabilityQuery extends QueryAvailabilityBaseRequest {
253
+ target: 'product';
254
+ dateRange?: Partial<AvailabilityDateRange>;
255
+ }
256
+ export interface DateAvailabilityQuery extends QueryAvailabilityBaseRequest {
257
+ target: 'date';
258
+ dateRange?: Partial<AvailabilityDateRange>;
259
+ }
260
+ export interface TimeAvailabilityQuery extends QueryAvailabilityBaseRequest {
261
+ target: 'time';
262
+ candidates: ProductTimeRange[];
263
+ }
264
+ export interface ResourceAvailabilityQuery extends QueryAvailabilityBaseRequest {
265
+ target: 'resource';
266
+ selectedRanges: ProductTimeRange[];
267
+ }
268
+ export type AvailabilityQuery = ProductAvailabilityQuery | DateAvailabilityQuery | TimeAvailabilityQuery | ResourceAvailabilityQuery;
269
+ export interface AvailabilityResourceOption {
270
+ resourceId: AvailabilityId;
129
271
  resourceName?: string;
130
- resourceFormId?: number | string;
131
- resourceType: ResourcePlannerResourceType;
132
- status: ResourcePlannerStatus;
272
+ resourceFormId?: AvailabilityId;
273
+ policyId?: AvailabilityId;
274
+ resourceType: AvailabilityResourceType;
275
+ status: AvailabilityStatus;
276
+ remainingCapacity?: number;
277
+ maxCapacity?: number;
278
+ maxPartySize: number;
279
+ reasonCodes: string[];
280
+ }
281
+ export interface AvailabilityRequirementGroupResult {
282
+ groupId: string;
283
+ formId?: AvailabilityId;
284
+ title?: string;
285
+ code?: string;
286
+ resourceType: AvailabilityResourceType;
287
+ required: boolean;
288
+ min: number;
289
+ max: number;
290
+ status: AvailabilityStatus;
291
+ availableResourceCount: number;
292
+ totalResourceCount: number;
293
+ maxPartySize: number;
133
294
  remainingCapacity?: number;
134
295
  maxCapacity?: number;
135
296
  reasonCodes: string[];
297
+ options: AvailabilityResourceOption[];
298
+ }
299
+ export interface TimeAvailabilityItem extends ProductTimeRange {
300
+ status: AvailabilityStatus;
301
+ maxPartySize: number;
302
+ reasonCodes: string[];
303
+ requirementGroups: AvailabilityRequirementGroupResult[];
136
304
  }
137
- export interface ResourcePlannerDateSummary {
305
+ export interface ProductAvailabilityItem {
306
+ productId: AvailabilityId;
307
+ title?: string;
308
+ status: AvailabilityStatus;
309
+ reasonCodes: string[];
310
+ availableDateCount: number;
311
+ totalDateCount: number;
312
+ availableTimeCount: number;
313
+ totalTimeCount: number;
314
+ maxPartySize: number;
315
+ }
316
+ export interface DateAvailabilityItem {
138
317
  date: string;
139
- status: ResourcePlannerStatus;
318
+ status: AvailabilityStatus;
140
319
  availableCount: number;
141
320
  totalCount: number;
321
+ maxPartySize: number;
322
+ remainingCapacity: number;
323
+ maxCapacity: number;
324
+ reasonCodes: string[];
142
325
  }
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;
326
+ export interface ProductAvailabilityGroup {
327
+ productId: AvailabilityId;
328
+ title?: string;
329
+ item: ProductAvailabilityItem;
330
+ }
331
+ export interface DateAvailabilityGroup {
332
+ productId: AvailabilityId;
333
+ title?: string;
334
+ dates: DateAvailabilityItem[];
335
+ }
336
+ export interface TimeAvailabilityGroup {
337
+ productId: AvailabilityId;
338
+ title?: string;
339
+ times: TimeAvailabilityItem[];
340
+ }
341
+ export interface ResourceAvailabilityRangeGroup {
342
+ range: ProductTimeRange;
343
+ status: AvailabilityStatus;
344
+ maxPartySize: number;
151
345
  reasonCodes: string[];
346
+ requirementGroups: AvailabilityRequirementGroupResult[];
152
347
  }
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;
348
+ export interface ResourceAvailabilityGroup {
349
+ productId: AvailabilityId;
350
+ title?: string;
351
+ ranges: ResourceAvailabilityRangeGroup[];
352
+ }
353
+ export interface AvailabilityQueryResultBase<TTarget extends AvailabilityQuery['target'], TData> {
354
+ target: TTarget;
355
+ evaluatedAt: string;
356
+ snapshotId: string;
357
+ data: TData;
179
358
  }
180
- export interface ResourcePlannerAssignableSlotResource {
181
- resourceId: number | string;
359
+ export type ProductAvailabilityQueryResult = AvailabilityQueryResultBase<'product', ProductAvailabilityGroup[]>;
360
+ export type DateAvailabilityQueryResult = AvailabilityQueryResultBase<'date', DateAvailabilityGroup[]>;
361
+ export type TimeAvailabilityQueryResult = AvailabilityQueryResultBase<'time', TimeAvailabilityGroup[]>;
362
+ export type ResourceAvailabilityQueryResult = AvailabilityQueryResultBase<'resource', ResourceAvailabilityGroup[]>;
363
+ export type AvailabilityQueryResult = ProductAvailabilityQueryResult | DateAvailabilityQueryResult | TimeAvailabilityQueryResult | ResourceAvailabilityQueryResult;
364
+ export interface AvailabilityValidationConflict {
365
+ code: string;
366
+ message: string;
367
+ reasonCodes?: string[];
368
+ productId?: AvailabilityId;
369
+ requirementGroupId?: string;
370
+ formId?: AvailabilityId;
371
+ resourceId?: AvailabilityId;
182
372
  resourceName?: string;
183
- resourceFormId?: number | string;
184
- resourceType?: ResourcePlannerResourceType;
185
- capacityRequired?: number;
373
+ candidateKey?: string;
374
+ requestedQuantity?: number;
375
+ availableQuantity?: number;
186
376
  remainingCapacity?: number;
187
- maxCapacity?: number;
377
+ capacityPerBooking?: number;
188
378
  }
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 {
379
+ export interface AvailabilitySelectionValidationParams {
380
+ candidate: ProductTimeRange;
381
+ partySize?: number;
382
+ bookingCount?: number;
383
+ requirementSelections: AvailabilityRequirementSelection[];
384
+ }
385
+ export interface AvailabilitySelectionValidationResult {
213
386
  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;
387
+ status: AvailabilityStatus;
388
+ assignments: AvailabilityAssignment[];
389
+ conflicts: AvailabilityValidationConflict[];
390
+ availability: TimeAvailabilityItem;
391
+ }
392
+ export interface AvailabilityErrorDetails {
393
+ [key: string]: any;
394
+ }
395
+ export declare class AvailabilityError extends Error {
396
+ code: AvailabilityErrorCode;
397
+ details?: AvailabilityErrorDetails;
398
+ constructor(code: AvailabilityErrorCode, message: string, details?: AvailabilityErrorDetails);
227
399
  }
@@ -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));
@@ -68,6 +68,7 @@ export interface RequestOptions {
68
68
  useCache?: boolean;
69
69
  customToast?: () => void;
70
70
  cache?: CacheProps;
71
+ cacheUpdateChange?: (data: any) => void;
71
72
  osServer?: boolean;
72
73
  prefix?: boolean;
73
74
  callback?: (res: any) => void;