@pisell/pisellos 2.3.38 → 2.3.39

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 (225) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +0 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  11. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  12. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
  13. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
  14. package/dist/modules/Discount/index.d.ts +1 -0
  15. package/dist/modules/Discount/index.js +40 -11
  16. package/dist/modules/Discount/types.d.ts +1 -0
  17. package/dist/modules/Holder/index.d.ts +48 -0
  18. package/dist/modules/Holder/index.js +640 -0
  19. package/dist/modules/Holder/types.d.ts +123 -0
  20. package/dist/modules/Holder/types.js +1 -0
  21. package/dist/modules/Holder/utils.d.ts +13 -0
  22. package/dist/modules/Holder/utils.js +34 -0
  23. package/dist/modules/OpenData/index.d.ts +0 -2
  24. package/dist/modules/OpenData/index.js +2 -10
  25. package/dist/modules/Order/index.d.ts +11 -28
  26. package/dist/modules/Order/index.js +509 -750
  27. package/dist/modules/Order/types.d.ts +10 -33
  28. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  29. package/dist/modules/Order/utils.d.ts +10 -0
  30. package/dist/modules/Order/utils.js +41 -13
  31. package/dist/modules/Payment/index.d.ts +0 -2
  32. package/dist/modules/Payment/index.js +50 -79
  33. package/dist/modules/Payment/types.d.ts +28 -99
  34. package/dist/modules/Payment/types.js +3 -20
  35. package/dist/modules/Payment/walletpass.d.ts +1 -25
  36. package/dist/modules/Payment/walletpass.js +157 -707
  37. package/dist/modules/Product/types.d.ts +1 -0
  38. package/dist/modules/ProductList/index.js +33 -14
  39. package/dist/modules/Quotation/index.d.ts +1 -1
  40. package/dist/modules/Quotation/index.js +2 -2
  41. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  42. package/dist/modules/ResourcePlanner/index.js +181 -0
  43. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  44. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  45. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  46. package/dist/modules/ResourcePlanner/types.js +1 -0
  47. package/dist/modules/Rules/index.d.ts +0 -1
  48. package/dist/modules/Rules/index.js +96 -89
  49. package/dist/modules/SalesSummary/index.js +12 -13
  50. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  51. package/dist/modules/ScanOrderLogger/index.js +15 -2
  52. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  53. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  54. package/dist/modules/Schedule/index.d.ts +3 -1
  55. package/dist/modules/Schedule/index.js +21 -16
  56. package/dist/modules/Summary/utils.js +38 -13
  57. package/dist/modules/index.d.ts +2 -0
  58. package/dist/modules/index.js +3 -1
  59. package/dist/plugins/window.d.ts +1 -0
  60. package/dist/server/index.d.ts +14 -16
  61. package/dist/server/index.js +1148 -1930
  62. package/dist/server/modules/order/index.d.ts +4 -54
  63. package/dist/server/modules/order/index.js +695 -1595
  64. package/dist/server/modules/order/types.d.ts +3 -11
  65. package/dist/server/modules/order/types.js +1 -1
  66. package/dist/solution/BaseSales/index.d.ts +20 -109
  67. package/dist/solution/BaseSales/index.js +481 -1797
  68. package/dist/solution/BaseSales/types.d.ts +0 -52
  69. package/dist/solution/BaseSales/types.js +1 -2
  70. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  71. package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
  72. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  73. package/dist/solution/BookingByStep/index.d.ts +17 -2
  74. package/dist/solution/BookingByStep/index.js +294 -215
  75. package/dist/solution/BookingByStep/types.d.ts +2 -1
  76. package/dist/solution/BookingByStep/types.js +3 -1
  77. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  78. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  79. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  80. package/dist/solution/BookingTicket/index.d.ts +3 -7
  81. package/dist/solution/BookingTicket/index.js +49 -132
  82. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
  83. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  84. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
  85. package/dist/solution/Sales/index.d.ts +0 -1
  86. package/dist/solution/Sales/index.js +2 -10
  87. package/dist/solution/ScanOrder/index.d.ts +26 -14
  88. package/dist/solution/ScanOrder/index.js +1148 -756
  89. package/dist/solution/ScanOrder/types.d.ts +21 -1
  90. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  91. package/dist/solution/ScanOrder/utils.js +66 -25
  92. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  93. package/dist/solution/ShopDiscount/index.js +125 -87
  94. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  95. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  96. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  97. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  98. package/dist/solution/VenueBooking/index.d.ts +39 -11
  99. package/dist/solution/VenueBooking/index.js +1176 -860
  100. package/dist/solution/VenueBooking/types.d.ts +3 -0
  101. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  102. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  103. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  104. package/dist/solution/index.d.ts +1 -0
  105. package/dist/solution/index.js +2 -1
  106. package/dist/types/index.d.ts +1 -1
  107. package/lib/core/index.d.ts +0 -2
  108. package/lib/core/index.js +0 -4
  109. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  110. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  111. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  112. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  113. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  114. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  115. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  116. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  117. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  118. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  119. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
  120. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
  121. package/lib/modules/Discount/index.d.ts +1 -0
  122. package/lib/modules/Discount/index.js +9 -0
  123. package/lib/modules/Discount/types.d.ts +1 -0
  124. package/lib/modules/Holder/index.d.ts +48 -0
  125. package/lib/modules/Holder/index.js +402 -0
  126. package/lib/modules/Holder/types.d.ts +123 -0
  127. package/lib/modules/Holder/types.js +17 -0
  128. package/lib/modules/Holder/utils.d.ts +13 -0
  129. package/lib/modules/Holder/utils.js +71 -0
  130. package/lib/modules/OpenData/index.d.ts +0 -2
  131. package/lib/modules/OpenData/index.js +1 -6
  132. package/lib/modules/Order/index.d.ts +11 -28
  133. package/lib/modules/Order/index.js +86 -196
  134. package/lib/modules/Order/types.d.ts +10 -33
  135. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  136. package/lib/modules/Order/utils.d.ts +10 -0
  137. package/lib/modules/Order/utils.js +40 -16
  138. package/lib/modules/Payment/index.d.ts +0 -2
  139. package/lib/modules/Payment/index.js +13 -34
  140. package/lib/modules/Payment/types.d.ts +28 -99
  141. package/lib/modules/Payment/types.js +3 -4
  142. package/lib/modules/Payment/walletpass.d.ts +1 -25
  143. package/lib/modules/Payment/walletpass.js +21 -470
  144. package/lib/modules/Product/types.d.ts +1 -0
  145. package/lib/modules/ProductList/index.js +40 -31
  146. package/lib/modules/Quotation/index.d.ts +1 -1
  147. package/lib/modules/Quotation/index.js +2 -2
  148. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  149. package/lib/modules/ResourcePlanner/index.js +148 -0
  150. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  151. package/lib/modules/ResourcePlanner/planner.js +933 -0
  152. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  153. package/lib/modules/ResourcePlanner/types.js +17 -0
  154. package/lib/modules/Rules/index.d.ts +0 -1
  155. package/lib/modules/Rules/index.js +40 -47
  156. package/lib/modules/SalesSummary/index.js +6 -7
  157. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  158. package/lib/modules/ScanOrderLogger/index.js +13 -1
  159. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  160. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  161. package/lib/modules/Schedule/index.d.ts +3 -1
  162. package/lib/modules/Schedule/index.js +10 -8
  163. package/lib/modules/Summary/utils.js +21 -1
  164. package/lib/modules/index.d.ts +2 -0
  165. package/lib/modules/index.js +5 -1
  166. package/lib/plugins/window.d.ts +1 -0
  167. package/lib/server/index.d.ts +14 -16
  168. package/lib/server/index.js +83 -675
  169. package/lib/server/modules/order/index.d.ts +4 -54
  170. package/lib/server/modules/order/index.js +66 -679
  171. package/lib/server/modules/order/types.d.ts +3 -11
  172. package/lib/solution/BaseSales/index.d.ts +20 -109
  173. package/lib/solution/BaseSales/index.js +70 -881
  174. package/lib/solution/BaseSales/types.d.ts +0 -52
  175. package/lib/solution/BaseSales/types.js +1 -2
  176. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  177. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
  178. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  179. package/lib/solution/BookingByStep/index.d.ts +17 -2
  180. package/lib/solution/BookingByStep/index.js +60 -18
  181. package/lib/solution/BookingByStep/types.d.ts +2 -1
  182. package/lib/solution/BookingByStep/types.js +5 -0
  183. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  184. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  185. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  186. package/lib/solution/BookingTicket/index.d.ts +3 -7
  187. package/lib/solution/BookingTicket/index.js +9 -62
  188. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
  189. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  190. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
  191. package/lib/solution/Sales/index.d.ts +0 -1
  192. package/lib/solution/Sales/index.js +3 -5
  193. package/lib/solution/ScanOrder/index.d.ts +26 -14
  194. package/lib/solution/ScanOrder/index.js +449 -190
  195. package/lib/solution/ScanOrder/types.d.ts +21 -1
  196. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  197. package/lib/solution/ScanOrder/utils.js +31 -0
  198. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  199. package/lib/solution/ShopDiscount/index.js +14 -0
  200. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  201. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  202. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  203. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  204. package/lib/solution/VenueBooking/index.d.ts +39 -11
  205. package/lib/solution/VenueBooking/index.js +328 -123
  206. package/lib/solution/VenueBooking/types.d.ts +3 -0
  207. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  208. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  209. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  210. package/lib/solution/index.d.ts +1 -0
  211. package/lib/solution/index.js +3 -1
  212. package/lib/types/index.d.ts +1 -1
  213. package/package.json +1 -1
  214. package/dist/modules/Order/payment-utils.d.ts +0 -26
  215. package/dist/modules/Order/payment-utils.js +0 -225
  216. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  217. package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
  218. package/dist/utils/payment-number.d.ts +0 -9
  219. package/dist/utils/payment-number.js +0 -69
  220. package/lib/modules/Order/payment-utils.d.ts +0 -26
  221. package/lib/modules/Order/payment-utils.js +0 -224
  222. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  223. package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
  224. package/lib/utils/payment-number.d.ts +0 -9
  225. package/lib/utils/payment-number.js +0 -64
@@ -0,0 +1,227 @@
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;
16
+ }
17
+ export interface ResourcePlannerResourceRequirement {
18
+ formId?: number | string;
19
+ resourceIds?: Array<number | string>;
20
+ resourceType?: ResourcePlannerResourceType;
21
+ capacityRequired?: number;
22
+ required?: boolean;
23
+ }
24
+ export interface ResourcePlannerProduct {
25
+ id: number | string;
26
+ title?: string;
27
+ kind: ResourcePlannerProductKind;
28
+ durationMinutes?: number;
29
+ schedule?: ResourcePlannerTimeRange[];
30
+ resourceRequirements?: ResourcePlannerResourceRequirement[];
31
+ capacityRequired?: number;
32
+ quantity?: number;
33
+ price?: string | number | null;
34
+ raw?: Record<string, any>;
35
+ }
36
+ export interface ResourcePlannerResource {
37
+ id: number | string;
38
+ formId?: number | string;
39
+ name?: string;
40
+ resourceType: ResourcePlannerResourceType;
41
+ capacity: number;
42
+ times: Array<ResourcePlannerTimeRange & {
43
+ event_list?: ResourcePlannerEvent[];
44
+ [key: string]: any;
45
+ }>;
46
+ childResourceIds?: Array<number | string>;
47
+ raw?: Record<string, any>;
48
+ }
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>;
70
+ 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;
81
+ }
82
+ export interface ResourcePlannerSelectionPatch extends Partial<ResourcePlannerSelection> {
83
+ replaceAssignments?: boolean;
84
+ }
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;
103
+ }
104
+ export interface ResourcePlannerAvailabilityCell {
105
+ 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;
116
+ remainingCapacity?: number;
117
+ maxCapacity?: number;
118
+ reasonCodes: string[];
119
+ conflicts: ResourcePlannerConflict[];
120
+ }
121
+ export interface ResourcePlannerProductOption {
122
+ productId: number | string;
123
+ title?: string;
124
+ status: ResourcePlannerStatus;
125
+ reasonCodes: string[];
126
+ }
127
+ export interface ResourcePlannerResourceOption {
128
+ resourceId: number | string;
129
+ resourceName?: string;
130
+ resourceFormId?: number | string;
131
+ resourceType: ResourcePlannerResourceType;
132
+ status: ResourcePlannerStatus;
133
+ remainingCapacity?: number;
134
+ maxCapacity?: number;
135
+ reasonCodes: string[];
136
+ }
137
+ export interface ResourcePlannerDateSummary {
138
+ date: string;
139
+ status: ResourcePlannerStatus;
140
+ availableCount: number;
141
+ totalCount: number;
142
+ }
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;
151
+ reasonCodes: string[];
152
+ }
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;
179
+ }
180
+ export interface ResourcePlannerAssignableSlotResource {
181
+ resourceId: number | string;
182
+ resourceName?: string;
183
+ resourceFormId?: number | string;
184
+ resourceType?: ResourcePlannerResourceType;
185
+ capacityRequired?: number;
186
+ remainingCapacity?: number;
187
+ maxCapacity?: number;
188
+ }
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 {
213
+ 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;
227
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/modules/ResourcePlanner/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
@@ -35,7 +35,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
35
35
  excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
36
36
  /** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
37
37
  resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
38
- private isItemRewardProductDiscount;
39
38
  private getUnavailableReason;
40
39
  calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
41
40
  discountList: Discount[];
@@ -167,16 +167,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
167
167
  resolveDiscountListForManualOverride(discountList) {
168
168
  return this.excludeDiscountListByType(discountList, "promotion");
169
169
  }
170
- isItemRewardProductDiscount(product) {
171
- var _a;
172
- const discountList = Array.isArray(product == null ? void 0 : product.discount_list) ? product.discount_list : [];
173
- return ((_a = product == null ? void 0 : product._promotion) == null ? void 0 : _a.actionType) === "ITEM_REWARD" && discountList.some(
174
- (item) => {
175
- var _a2, _b;
176
- return (item == null ? void 0 : item.type) === "product" && ((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
177
- }
178
- );
179
- }
180
170
  // 获取券不可用的原因
181
171
  getUnavailableReason(discountList, productList) {
182
172
  var _a;
@@ -300,7 +290,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
300
290
  _id: product._id,
301
291
  parentId: product._id,
302
292
  quantity: product.quantity,
303
- num: product.num
293
+ num: product.num,
294
+ booking_id: product.booking_id
304
295
  });
305
296
  if (product.bundle && Array.isArray(product.bundle) && product.bundle.length > 0) {
306
297
  product.bundle.forEach((bundleItem, bundleIndex) => {
@@ -312,7 +303,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
312
303
  bundleIndex,
313
304
  // 虚拟商品属性
314
305
  price: Number(bundleItem.price || 0),
315
- id: bundleItem.bundle_product_id ?? bundleItem._bundle_product_id ?? bundleItem.product_id,
306
+ id: bundleItem._bundle_product_id,
307
+ // 🔥 使用 _bundle_product_id
316
308
  _id: `${product._id}_bundle_${bundleIndex}`,
317
309
  parentId: product._id,
318
310
  num: bundleItem.num || 1,
@@ -321,7 +313,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
321
313
  origin_total: new import_decimal.default(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
322
314
  original_price: bundleItem.original_price,
323
315
  // 继承主商品属性
324
- booking_id: product.booking_id,
316
+ booking_id: bundleItem.booking_id,
325
317
  discount_list: bundleItem.discount_list || []
326
318
  });
327
319
  });
@@ -509,9 +501,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
509
501
  startDate: (_a2 = flatItem.parentProduct) == null ? void 0 : _a2.startDate
510
502
  };
511
503
  }
512
- if (this.isItemRewardProductDiscount(product)) {
513
- return false;
514
- }
515
504
  const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.length) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.every((d) => d.id && ["good_pass", "discount_card", "product_discount_card"].includes(d.tag || d.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_e = (_d = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _d.discount_list) == null ? void 0 : _e.length) && ((_g = (_f = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _f.discount_list) == null ? void 0 : _g.every((d) => d.id)));
516
505
  if (!isAvailableProduct) {
517
506
  return false;
@@ -637,7 +626,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
637
626
  };
638
627
  originProduct = flatItem.originProduct;
639
628
  }
640
- const isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
641
629
  addModeDiscount.forEach((discount) => {
642
630
  var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
643
631
  const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
@@ -661,7 +649,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
661
649
  ].includes(discount2.tag || discount2.type)
662
650
  ))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.discount_list) == null ? void 0 : _d.length) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.discount_list) == null ? void 0 : _f.every((discount2) => discount2.id)));
663
651
  const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
664
- if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
652
+ if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
665
653
  (_h = discountApplicability.get(discount.id)) == null ? void 0 : _h.push(product.id);
666
654
  const applicableProducts = discountApplicableProducts.get(discount.id) || [];
667
655
  const discountType = discount.tag || discount.type;
@@ -683,7 +671,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
683
671
  discount_product_id: discount.product_id
684
672
  },
685
673
  metadata: {
686
- num
674
+ num,
675
+ discount_rule_uncheck_flag: discount == null ? void 0 : discount.discount_rule_uncheck_flag
687
676
  }
688
677
  };
689
678
  applicableProducts.push(productData);
@@ -784,8 +773,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
784
773
  }
785
774
  const applicableDiscounts = sortedDiscountList.filter((discount) => {
786
775
  var _a3, _b2, _c2, _d2;
787
- if (this.isItemRewardProductDiscount(product))
788
- return false;
789
776
  const discountType = discount.tag || discount.type;
790
777
  const currentOriginUid = getOriginProductUid(originProduct);
791
778
  const isReapplyEditModeDiscountForProduct = discount.isEditMode && reapplyBookingDiscountProductUids.size > 0 && currentOriginUid && reapplyBookingDiscountProductUids.has(String(currentOriginUid)) && discount.isSelected === true;
@@ -855,17 +842,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
855
842
  }
856
843
  return false;
857
844
  });
858
- const explicitlySelectedDiscountCard = (options == null ? void 0 : options.isSelected) === true && options.discountId !== void 0 ? applicableDiscounts.find((discount) => {
859
- const discountType = discount.tag || discount.type;
860
- return String(discount.id) === String(options.discountId) && ["discount_card", "product_discount_card"].includes(discountType);
861
- }) : void 0;
862
- const scannedSelectedDiscountCard = applicableDiscounts.find(
845
+ const selectedDiscountCard = applicableDiscounts.find(
863
846
  (n) => n.isScan && n.isSelected && (n.tag || n.type) !== "good_pass"
864
847
  );
865
- const selectedDiscountCard = explicitlySelectedDiscountCard || scannedSelectedDiscountCard;
866
848
  const selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
867
849
  let isManualDiscount = false;
868
- let isItemRewardProductDiscount = false;
869
850
  if (flatItem.type === "main") {
870
851
  isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : ((_g = product.discount_list) == null ? void 0 : _g.some((item) => item.type === "product")) || product.total != product.origin_total && (product.bundle || []).every(
871
852
  (item) => {
@@ -876,8 +857,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
876
857
  _i,
877
858
  (item) => item.type === "product"
878
859
  )));
879
- isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
880
- if (product.inPromotion && !isItemRewardProductDiscount) {
860
+ if (product.inPromotion) {
881
861
  isManualDiscount = false;
882
862
  }
883
863
  } else {
@@ -991,16 +971,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
991
971
  } else {
992
972
  let total = product.inPromotion ? ((_w = product == null ? void 0 : product._promotion) == null ? void 0 : _w.finalPrice) ?? product.origin_total ?? product.total : product.origin_total ?? product.total;
993
973
  let main_product_selling_price = product.price;
994
- if ((product.discount_list || []).some((item) => item.type === "promotion") || isItemRewardProductDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
974
+ if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
995
975
  total = product.total ?? product.origin_total;
996
976
  main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
997
977
  }
998
978
  processedProductsMap.set(product._id, [
999
979
  this.hooks.setProduct(originProduct, {
1000
980
  ...isManualDiscount ? {
1001
- price: product.price,
1002
- main_product_selling_price: isItemRewardProductDiscount ? main_product_selling_price : product.price,
1003
- ...isItemRewardProductDiscount ? { total } : {}
981
+ price: product.price
1004
982
  } : {
1005
983
  _id: product._id.split("___")[0] + "___" + index,
1006
984
  total,
@@ -1131,6 +1109,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1131
1109
  config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
1132
1110
  metadata: {
1133
1111
  num: 1,
1112
+ discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1134
1113
  // 🔥 order_level 分摊差值
1135
1114
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference },
1136
1115
  /** 仅主商品上的优惠金额(不含 option) */
@@ -1211,6 +1190,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1211
1190
  metadata: {
1212
1191
  // 🔥 使用拆分后的唯一 _id
1213
1192
  custom_product_bundle_map_id: uniqueId,
1193
+ discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1214
1194
  num: 1
1215
1195
  },
1216
1196
  _num: 1,
@@ -1240,7 +1220,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1240
1220
  _id: `${flatItem._id}_split_rest`,
1241
1221
  num: normalNum,
1242
1222
  quantity: normalNum,
1243
- discount_list: [],
1223
+ discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion"),
1244
1224
  processed: true
1245
1225
  });
1246
1226
  }
@@ -1289,6 +1269,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1289
1269
  metadata: {
1290
1270
  // 🔥 使用唯一的 _id
1291
1271
  custom_product_bundle_map_id: uniqueId,
1272
+ discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1292
1273
  num: product.num || 1,
1293
1274
  // 🔥 order_level 分摊差值
1294
1275
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
@@ -1303,7 +1284,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1303
1284
  ...flatItem,
1304
1285
  total: targetProductTotal,
1305
1286
  price: new import_decimal.default(productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
1306
- discount_list: [discountDetail],
1287
+ discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion").concat([discountDetail]),
1307
1288
  processed: true
1308
1289
  });
1309
1290
  }
@@ -1724,7 +1705,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1724
1705
  * @returns 是否可用
1725
1706
  */
1726
1707
  checkPackageSubItemUsageRules(discount, flatItem) {
1727
- var _a, _b, _c, _d, _e, _f, _g;
1708
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1728
1709
  const limitedData = discount.limited_relation_product_data;
1729
1710
  const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
1730
1711
  const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
@@ -1736,6 +1717,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1736
1717
  const { type: scopeType, exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
1737
1718
  const isMainProduct = flatItem.type === "main";
1738
1719
  const isBundleItem = flatItem.type === "bundle";
1720
+ const bundleMainProductId = (_a = flatItem.product) == null ? void 0 : _a.product_id;
1739
1721
  if (isMainProduct) {
1740
1722
  return true;
1741
1723
  }
@@ -1744,9 +1726,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1744
1726
  return true;
1745
1727
  }
1746
1728
  if (isBundleItem) {
1747
- const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
1748
- const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
1749
- const mainProductId = ((_d = (_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c._productOrigin) == null ? void 0 : _d.id) || ((_e = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _e.id) || 0;
1729
+ const priceType = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type;
1730
+ const priceTypeExt = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type_ext;
1731
+ const mainProductId = ((_e = (_d = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _d._productOrigin) == null ? void 0 : _e.id) || ((_f = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _f.id) || 0;
1750
1732
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1751
1733
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1752
1734
  if (rules.length > 0) {
@@ -1758,11 +1740,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1758
1740
  if (!filter) {
1759
1741
  isScopeValid = true;
1760
1742
  } else {
1761
- isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
1743
+ isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
1762
1744
  }
1763
1745
  }
1764
1746
  if (scopeType === "specific_packages" || scopeType === "products") {
1765
- isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
1747
+ isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
1766
1748
  }
1767
1749
  if (isPriceValid && isScopeValid) {
1768
1750
  return true;
@@ -1778,15 +1760,26 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1778
1760
  return false;
1779
1761
  }
1780
1762
  if (isBundleItem) {
1781
- const priceType = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type;
1782
- const priceTypeExt = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type_ext;
1763
+ const priceType = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type;
1764
+ const priceTypeExt = (_h = flatItem.bundleItem) == null ? void 0 : _h.price_type_ext;
1783
1765
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1784
1766
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1785
1767
  if (rules.length > 0) {
1786
- if (isOriginalPrice && rules.includes("original_price")) {
1787
- return true;
1768
+ const _isOriginalPrice = isOriginalPrice && rules.includes("original_price");
1769
+ const _isMarkupPrice = isMarkupPrice && rules.includes("markup_price");
1770
+ const isPriceValid = _isOriginalPrice || _isMarkupPrice;
1771
+ let isScopeValid = false;
1772
+ if (scopeType === "all_packages" || scopeType === "product_all") {
1773
+ if (!filter) {
1774
+ isScopeValid = true;
1775
+ } else {
1776
+ isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
1777
+ }
1788
1778
  }
1789
- if (isMarkupPrice && rules.includes("markup_price")) {
1779
+ if (scopeType === "specific_packages" || scopeType === "products") {
1780
+ isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
1781
+ }
1782
+ if (isPriceValid && isScopeValid) {
1790
1783
  return true;
1791
1784
  }
1792
1785
  return false;
@@ -53,9 +53,6 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
53
53
  this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
54
54
  this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
55
55
  this.surchargeListModuleName = ((_c = this.otherParams) == null ? void 0 : _c.surchargeListModuleName) || "surchargeList";
56
- if (!this.appPlugin) {
57
- throw new Error("SalesSummaryModule 需要 app 插件支持");
58
- }
59
56
  if (!this.request) {
60
57
  throw new Error("SalesSummaryModule 需要 request 插件支持");
61
58
  }
@@ -109,12 +106,14 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
109
106
  }
110
107
  }
111
108
  getAppData(key) {
112
- var _a, _b, _c, _d, _e, _f;
113
- const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
109
+ var _a, _b, _c, _d, _e, _f, _g, _h;
110
+ const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
114
111
  if (typeof getData === "function")
115
112
  return getData(key);
116
- const app = this.appPlugin.getApp();
117
- const coreData = (_f = (_d = (_c = app == null ? void 0 : app.models) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core", "core");
113
+ const app = (_d = (_c = this.appPlugin) == null ? void 0 : _c.getApp) == null ? void 0 : _d.call(_c);
114
+ if (!app)
115
+ return void 0;
116
+ const coreData = (_h = (_f = (_e = app == null ? void 0 : app.models) == null ? void 0 : _e.getStore) == null ? void 0 : (_g = _f.call(_e)).getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
118
117
  return coreData == null ? void 0 : coreData[key];
119
118
  }
120
119
  getTaxConfig() {
@@ -11,10 +11,12 @@ export declare class ScanOrderLoggerModule extends BaseModule implements Module,
11
11
  protected defaultName: string;
12
12
  protected defaultVersion: string;
13
13
  private store;
14
+ private window?;
14
15
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
16
  setContext(context: ScanOrderLoggerContext): void;
16
17
  setProvider(provider: ScanOrderLoggerProviderType): void;
17
18
  setProviderConfig(providerConfig: ScanOrderLoggerProviderConfig): void;
19
+ private getCurrentHost;
18
20
  private buildRecord;
19
21
  addLog(params: ScanOrderLogInput): Promise<void>;
20
22
  }
@@ -60,6 +60,7 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
60
60
  var _a, _b, _c;
61
61
  this.core = core;
62
62
  this.store = options.store;
63
+ this.window = core.getPlugin("window") || void 0;
63
64
  const provider = ((_a = options.otherParams) == null ? void 0 : _a.provider) || "feishu";
64
65
  const providerConfig = ((_b = options.otherParams) == null ? void 0 : _b.providerConfig) || {};
65
66
  const context = ((_c = options.otherParams) == null ? void 0 : _c.context) || {};
@@ -101,14 +102,25 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
101
102
  }
102
103
  };
103
104
  }
105
+ getCurrentHost() {
106
+ var _a, _b;
107
+ const host = (_b = (_a = this.window) == null ? void 0 : _a.location) == null ? void 0 : _b.host;
108
+ if (typeof host === "string" && host.length > 0)
109
+ return host;
110
+ return void 0;
111
+ }
104
112
  buildRecord(params) {
113
+ const host = this.getCurrentHost();
105
114
  return {
106
115
  level: params.level || "info",
107
116
  title: params.title,
108
117
  timestamp: params.timestamp || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
109
118
  payload: params.payload || {},
110
119
  extra: params.extra || {},
111
- context: this.store.context || {}
120
+ context: {
121
+ ...this.store.context || {},
122
+ ...host ? { host } : {}
123
+ }
112
124
  };
113
125
  }
114
126
  async addLog(params) {
@@ -112,20 +112,29 @@ async function flushQueue() {
112
112
  }
113
113
  var feishuLoggerProvider = {
114
114
  async send(payload) {
115
- var _a, _b, _c, _d;
115
+ var _a, _b, _c, _d, _e, _f;
116
116
  cachedProviderConfig = payload.providerConfig;
117
117
  const webhook = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.feishu) == null ? void 0 : _b.webhook;
118
+ const errorHook = (_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.errorHook;
119
+ if (typeof fetch !== "function") {
120
+ console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
121
+ return;
122
+ }
123
+ if (payload.record.level === "error" && isWebhookUsable(errorHook)) {
124
+ try {
125
+ await postToFeishu(errorHook, buildFeishuBody([payload.record]));
126
+ } catch (error) {
127
+ console.warn("[ScanOrderLogger] Feishu errorHook 上报失败", error);
128
+ }
129
+ return;
130
+ }
118
131
  if (!webhook) {
119
132
  console.warn("[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报");
120
133
  return;
121
134
  }
122
135
  if (!isWebhookUsable(webhook))
123
136
  return;
124
- if (typeof fetch !== "function") {
125
- console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
126
- return;
127
- }
128
- const throttleMs = ((_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.throttleMs) ?? DEFAULT_THROTTLE_MS;
137
+ const throttleMs = ((_f = (_e = payload.providerConfig) == null ? void 0 : _e.feishu) == null ? void 0 : _f.throttleMs) ?? DEFAULT_THROTTLE_MS;
129
138
  if (throttleMs <= 0) {
130
139
  try {
131
140
  await postToFeishu(webhook, buildFeishuBody([payload.record]));
@@ -2,6 +2,7 @@ export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
2
2
  export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
3
3
  export interface ScanOrderLoggerProviderFeishuConfig {
4
4
  webhook?: string;
5
+ errorHook?: string;
5
6
  /**
6
7
  * 节流窗口毫秒数,默认 3000ms
7
8
  * - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
@@ -24,7 +24,9 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
24
24
  *
25
25
  * @memberof ScheduleModule
26
26
  */
27
- loadAllSchedule(): Promise<void>;
27
+ loadAllSchedule(options?: {
28
+ useCache?: boolean;
29
+ }): Promise<void>;
28
30
  setScheduleList(list: ScheduleItem[]): void;
29
31
  private syncScheduleMap;
30
32
  getScheduleList(): ScheduleItem[];