@pisell/pisellos 2.3.73 → 2.3.75

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 (296) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +111 -71
  3. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  4. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  5. package/dist/model/strategy/strategy-example.js +5 -19
  6. package/dist/modules/Cart/index.js +0 -3
  7. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  8. package/dist/modules/Date/index.js +1 -5
  9. package/dist/modules/Discount/index.js +2 -4
  10. package/dist/modules/OpenData/index.js +0 -2
  11. package/dist/modules/Order/index.d.ts +1 -1
  12. package/dist/modules/Order/index.js +36 -64
  13. package/dist/modules/Payment/index.js +97 -162
  14. package/dist/modules/Quotation/index.d.ts +6 -0
  15. package/dist/modules/Quotation/index.js +75 -19
  16. package/dist/modules/Rules/index.js +1 -4
  17. package/dist/modules/Schedule/index.js +0 -1
  18. package/dist/modules/Schedule/utils.js +0 -1
  19. package/dist/modules/Step/index.js +0 -1
  20. package/dist/plugins/request.d.ts +1 -0
  21. package/dist/plugins/request.js +1 -4
  22. package/dist/plugins/window.js +2 -6
  23. package/dist/server/index.d.ts +8 -2
  24. package/dist/server/index.js +303 -269
  25. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  26. package/dist/server/modules/floor-plan/index.js +240 -98
  27. package/dist/server/modules/menu/index.js +75 -59
  28. package/dist/server/modules/order/index.d.ts +17 -7
  29. package/dist/server/modules/order/index.js +421 -211
  30. package/dist/server/modules/products/index.d.ts +8 -2
  31. package/dist/server/modules/products/index.js +191 -117
  32. package/dist/server/modules/quotation/index.js +29 -38
  33. package/dist/server/modules/resource/index.js +24 -17
  34. package/dist/server/modules/schedule/index.js +27 -35
  35. package/dist/server/utils/product.js +0 -1
  36. package/dist/solution/BaseSales/index.js +38 -41
  37. package/dist/solution/BookingByStep/index.d.ts +1 -1
  38. package/dist/solution/BookingByStep/index.js +7 -59
  39. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  40. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  41. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  42. package/dist/solution/BookingTicket/index.js +0 -2
  43. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  44. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  45. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  46. package/dist/solution/BuyTickets/index.js +9 -12
  47. package/dist/solution/Checkout/index.js +177 -252
  48. package/dist/solution/Checkout/utils/index.js +4 -16
  49. package/dist/solution/RegisterAndLogin/index.js +30 -76
  50. package/dist/solution/ScanOrder/index.js +50 -60
  51. package/dist/solution/ShopDiscount/index.js +2 -7
  52. package/dist/solution/VenueBooking/index.js +45 -55
  53. package/dist/utils/task.js +15 -18
  54. package/dist/utils/watch.js +0 -1
  55. package/lib/apis/picoding.js +2 -0
  56. package/lib/core/index.d.ts +7 -0
  57. package/lib/core/index.js +149 -131
  58. package/lib/effects/index.js +46 -57
  59. package/lib/index.js +82 -49
  60. package/lib/model/index.js +14 -21
  61. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  62. package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
  63. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  64. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  65. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  66. package/lib/model/strategy/adapter/index.js +100 -64
  67. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  68. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  69. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  70. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  71. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  72. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  73. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  74. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  75. package/lib/model/strategy/adapter/promotion/index.js +1 -0
  76. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  77. package/lib/model/strategy/adapter/type.js +4 -16
  78. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  79. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  80. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  81. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  82. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  83. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  84. package/lib/model/strategy/engine.js +270 -168
  85. package/lib/model/strategy/index.js +49 -34
  86. package/lib/model/strategy/strategy-example.js +243 -239
  87. package/lib/model/strategy/type.js +100 -40
  88. package/lib/modules/Account/index.js +39 -53
  89. package/lib/modules/Account/types.js +20 -33
  90. package/lib/modules/AccountList/index.js +116 -154
  91. package/lib/modules/AccountList/types.js +30 -31
  92. package/lib/modules/AccountList/utils.js +18 -30
  93. package/lib/modules/BaseModule.js +23 -42
  94. package/lib/modules/BookingContext/index.js +158 -136
  95. package/lib/modules/BookingContext/types.js +46 -32
  96. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  97. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  98. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  99. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  100. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  101. package/lib/modules/BookingContext/utils/index.js +124 -41
  102. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  103. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  104. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  105. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  106. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  107. package/lib/modules/BookingContext/utils/resources.js +209 -167
  108. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  109. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  110. package/lib/modules/Cart/index.js +170 -124
  111. package/lib/modules/Cart/types.js +46 -51
  112. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  113. package/lib/modules/Cart/utils/cartDate.js +56 -61
  114. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  115. package/lib/modules/Cart/utils/cartNote.js +27 -32
  116. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  117. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  118. package/lib/modules/Cart/utils/cartResource.js +70 -78
  119. package/lib/modules/Cart/utils/changePrice.js +22 -50
  120. package/lib/modules/Cart/utils/index.js +106 -48
  121. package/lib/modules/Customer/constants.js +13 -34
  122. package/lib/modules/Customer/index.js +235 -172
  123. package/lib/modules/Customer/types.js +38 -35
  124. package/lib/modules/Date/index.js +116 -115
  125. package/lib/modules/Date/types.js +16 -28
  126. package/lib/modules/Date/utils.js +174 -123
  127. package/lib/modules/Discount/index.js +122 -127
  128. package/lib/modules/Discount/types.js +9 -31
  129. package/lib/modules/Guests/index.js +30 -56
  130. package/lib/modules/Guests/types.js +23 -33
  131. package/lib/modules/Holder/index.js +209 -189
  132. package/lib/modules/Holder/types.js +4 -16
  133. package/lib/modules/Holder/utils.js +20 -49
  134. package/lib/modules/OpenData/index.js +70 -76
  135. package/lib/modules/OpenData/types.js +4 -16
  136. package/lib/modules/OpenData/utils.js +44 -78
  137. package/lib/modules/Order/index.d.ts +1 -1
  138. package/lib/modules/Order/index.js +1713 -2118
  139. package/lib/modules/Order/payment-utils.js +77 -120
  140. package/lib/modules/Order/types.js +88 -35
  141. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  142. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  143. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  144. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  145. package/lib/modules/Order/utils.js +814 -647
  146. package/lib/modules/Payment/cash.js +20 -33
  147. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  148. package/lib/modules/Payment/eftpos.js +16 -30
  149. package/lib/modules/Payment/index.js +532 -399
  150. package/lib/modules/Payment/mx51.js +1 -0
  151. package/lib/modules/Payment/types.js +230 -108
  152. package/lib/modules/Payment/utils.js +52 -51
  153. package/lib/modules/Payment/walletpass.js +485 -660
  154. package/lib/modules/Product/index.js +51 -46
  155. package/lib/modules/Product/types.js +4 -16
  156. package/lib/modules/Product/utils.js +32 -33
  157. package/lib/modules/ProductList/index.js +113 -123
  158. package/lib/modules/ProductList/types.js +9 -31
  159. package/lib/modules/Quotation/index.d.ts +6 -0
  160. package/lib/modules/Quotation/index.js +110 -103
  161. package/lib/modules/Quotation/types.js +4 -16
  162. package/lib/modules/Resource/index.js +27 -59
  163. package/lib/modules/Resource/types.js +22 -32
  164. package/lib/modules/Resource/utils.js +30 -38
  165. package/lib/modules/ResourcePlanner/index.js +25 -23
  166. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  167. package/lib/modules/ResourcePlanner/planner.js +589 -770
  168. package/lib/modules/ResourcePlanner/types.js +10 -29
  169. package/lib/modules/Rules/index.js +1218 -959
  170. package/lib/modules/Rules/types.js +17 -40
  171. package/lib/modules/SalesSummary/index.js +85 -90
  172. package/lib/modules/SalesSummary/types.js +4 -16
  173. package/lib/modules/SalesSummary/utils.js +355 -430
  174. package/lib/modules/ScanOrderLogger/index.js +59 -79
  175. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  176. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  177. package/lib/modules/ScanOrderLogger/types.js +4 -16
  178. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  179. package/lib/modules/Schedule/index.js +100 -114
  180. package/lib/modules/Schedule/type.js +4 -16
  181. package/lib/modules/Schedule/types.js +4 -16
  182. package/lib/modules/Schedule/utils.js +433 -291
  183. package/lib/modules/Step/index.js +40 -52
  184. package/lib/modules/Step/tyeps.js +4 -16
  185. package/lib/modules/Summary/index.js +66 -71
  186. package/lib/modules/Summary/types.js +4 -16
  187. package/lib/modules/Summary/utils.js +773 -418
  188. package/lib/modules/SurchargeList/index.js +46 -60
  189. package/lib/modules/SurchargeList/types.js +4 -16
  190. package/lib/modules/index.js +245 -63
  191. package/lib/plugins/app.js +4 -16
  192. package/lib/plugins/index.js +36 -25
  193. package/lib/plugins/request.d.ts +1 -0
  194. package/lib/plugins/request.js +137 -126
  195. package/lib/plugins/shopStore.js +4 -16
  196. package/lib/plugins/user.js +4 -16
  197. package/lib/plugins/window.js +171 -179
  198. package/lib/server/index.d.ts +8 -2
  199. package/lib/server/index.js +3083 -2663
  200. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  201. package/lib/server/modules/floor-plan/index.js +159 -127
  202. package/lib/server/modules/floor-plan/types.js +15 -30
  203. package/lib/server/modules/index.js +106 -68
  204. package/lib/server/modules/menu/index.js +170 -124
  205. package/lib/server/modules/menu/types.js +18 -31
  206. package/lib/server/modules/order/index.d.ts +17 -7
  207. package/lib/server/modules/order/index.js +916 -977
  208. package/lib/server/modules/order/types.js +122 -33
  209. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  210. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  211. package/lib/server/modules/payment/index.js +59 -83
  212. package/lib/server/modules/payment/types.js +4 -16
  213. package/lib/server/modules/products/index.d.ts +8 -2
  214. package/lib/server/modules/products/index.js +656 -471
  215. package/lib/server/modules/products/types.js +44 -34
  216. package/lib/server/modules/quotation/index.js +137 -172
  217. package/lib/server/modules/quotation/types.js +21 -31
  218. package/lib/server/modules/resource/index.js +225 -186
  219. package/lib/server/modules/resource/types.js +42 -33
  220. package/lib/server/modules/schedule/index.js +135 -123
  221. package/lib/server/modules/schedule/types.js +14 -21
  222. package/lib/server/modules/schedule/utils.js +334 -163
  223. package/lib/server/types.js +4 -16
  224. package/lib/server/utils/index.js +25 -23
  225. package/lib/server/utils/product.js +196 -139
  226. package/lib/server/utils/schedule.js +34 -41
  227. package/lib/server/utils/small-ticket.js +479 -456
  228. package/lib/server/utils/time.js +40 -49
  229. package/lib/solution/BaseSales/index.js +1186 -1410
  230. package/lib/solution/BaseSales/types.js +42 -38
  231. package/lib/solution/BaseSales/utils/cartPromotion.js +642 -498
  232. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  233. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  234. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
  235. package/lib/solution/BaseSales/utils.js +158 -143
  236. package/lib/solution/BookingByStep/index.d.ts +1 -1
  237. package/lib/solution/BookingByStep/index.js +1527 -1340
  238. package/lib/solution/BookingByStep/types.js +40 -99
  239. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  240. package/lib/solution/BookingByStep/utils/products.js +42 -52
  241. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  242. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  243. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  244. package/lib/solution/BookingTicket/index.js +607 -522
  245. package/lib/solution/BookingTicket/types.js +99 -77
  246. package/lib/solution/BookingTicket/utils/addProductDecision.js +226 -189
  247. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  248. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  249. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  250. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  251. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  252. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  253. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  254. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  255. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  256. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  257. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  258. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  259. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  260. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  261. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  262. package/lib/solution/BuyTickets/index.js +67 -70
  263. package/lib/solution/BuyTickets/types.js +22 -38
  264. package/lib/solution/Checkout/index.js +1451 -1158
  265. package/lib/solution/Checkout/types.js +91 -61
  266. package/lib/solution/Checkout/utils/index.js +228 -156
  267. package/lib/solution/PlaceOrder/index.js +55 -0
  268. package/lib/solution/RegisterAndLogin/config.js +493 -460
  269. package/lib/solution/RegisterAndLogin/index.js +633 -630
  270. package/lib/solution/RegisterAndLogin/types.js +189 -76
  271. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  272. package/lib/solution/Sales/index.js +328 -324
  273. package/lib/solution/Sales/types.js +27 -33
  274. package/lib/solution/ScanOrder/index.js +832 -864
  275. package/lib/solution/ScanOrder/types.js +33 -34
  276. package/lib/solution/ScanOrder/utils.js +409 -374
  277. package/lib/solution/ShopDiscount/index.js +226 -232
  278. package/lib/solution/ShopDiscount/types.js +15 -37
  279. package/lib/solution/ShopDiscount/utils.js +300 -172
  280. package/lib/solution/UnifiedBookingSales/index.js +1035 -1201
  281. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  282. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  283. package/lib/solution/VenueBooking/index.js +811 -879
  284. package/lib/solution/VenueBooking/types.js +19 -39
  285. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  286. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  287. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  288. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  289. package/lib/solution/VenueBooking/utils.js +130 -67
  290. package/lib/solution/index.js +124 -41
  291. package/lib/store/createStore.js +32 -29
  292. package/lib/types/index.js +4 -16
  293. package/lib/utils/payment-number.js +26 -46
  294. package/lib/utils/task.js +36 -36
  295. package/lib/utils/watch.js +81 -47
  296. package/package.json +2 -1
@@ -78,6 +78,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
78
78
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeLoadedKey", '');
79
79
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshPromise", void 0);
80
80
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshKey", void 0);
81
+ _defineProperty(_assertThisInitialized(_this), "quotationBridgeUpdatedCallback", void 0);
81
82
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCache", new Map());
82
83
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheSource", null);
83
84
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheLoaded", false);
@@ -124,9 +125,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
124
125
  app = appPlugin.getApp();
125
126
  this.dbManager = app.dbManager;
126
127
  this.logger = app.logger;
127
- if (this.dbManager) {
128
- console.log('[Products] IndexDB Manager 已初始化');
129
- } else {
128
+ if (this.dbManager) {} else {
130
129
  console.warn('[Products] IndexDB Manager 未找到');
131
130
  }
132
131
  }
@@ -290,7 +289,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
290
289
  value: (function () {
291
290
  var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
292
291
  var _this$otherParams,
293
- _this3 = this;
292
+ _this3 = this,
293
+ _this$quotationPriceB,
294
+ _this$quotationPriceB2;
294
295
  var channel, quotation;
295
296
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
296
297
  while (1) switch (_context3.prev = _context3.next) {
@@ -351,11 +352,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
351
352
  return schedules[0];
352
353
  });
353
354
  }
354
- _context3.next = 13;
355
+ if (params.onQuotationUpdated) {
356
+ this.quotationBridgeUpdatedCallback = params.onQuotationUpdated;
357
+ }
358
+ (_this$quotationPriceB = (_this$quotationPriceB2 = this.quotationPriceBridge).setQuotationListUpdatedListener) === null || _this$quotationPriceB === void 0 || _this$quotationPriceB.call(_this$quotationPriceB2, function () {
359
+ var _this3$quotationBridg;
360
+ _this3.quotationBridgeLoadedKey = _this3.getQuotationBridgeScopeKey();
361
+ _this3.clearPriceCache();
362
+ (_this3$quotationBridg = _this3.quotationBridgeUpdatedCallback) === null || _this3$quotationBridg === void 0 || _this3$quotationBridg.call(_this3);
363
+ });
364
+ _context3.next = 15;
355
365
  return this.refreshQuotationPriceBridge({
356
366
  customer_id: params.customer_id
357
367
  });
358
- case 13:
368
+ case 15:
359
369
  case "end":
360
370
  return _context3.stop();
361
371
  }
@@ -847,14 +857,13 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
847
857
  _context7.prev = 29;
848
858
  _context7.t0 = _context7["catch"](4);
849
859
  errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
850
- console.log("[ProductsModule] \uD83C\uDF10 ERROR", _context7.t0);
851
860
  this.logError('prepareProductsWithPrice 处理失败', {
852
861
  schedule_date: schedule_date,
853
862
  error: errorMessage
854
863
  });
855
- case 34:
864
+ case 33:
856
865
  return _context7.abrupt("return", []);
857
- case 35:
866
+ case 34:
858
867
  case "end":
859
868
  return _context7.stop();
860
869
  }
@@ -1083,10 +1092,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1083
1092
  // 创建 legacy 报价单格式化器
1084
1093
  var legacyPriceFormatter = function legacyPriceFormatter(products, context) {
1085
1094
  if (!context.priceData || context.priceData.length === 0) {
1086
- console.log('[ProductsModule] 💰 没有价格数据,跳过 legacy 报价单价格应用');
1087
1095
  return products;
1088
1096
  }
1089
- console.log("[ProductsModule] \uD83D\uDCB0 \u5E94\u7528 legacy \u62A5\u4EF7\u5355\u4EF7\u683C\u5230 ".concat(products.length, " \u4E2A\u5546\u54C1"));
1090
1097
  return applyPriceDataToProducts(products, context.priceData);
1091
1098
  };
1092
1099
  var i18nFormatter = function i18nFormatter(products, context) {
@@ -1102,7 +1109,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1102
1109
  this.formatters.push(i18nFormatter);
1103
1110
  this.formatters.push(detailValueFormatter);
1104
1111
  this.isBuiltinFormatterRegistered = true;
1105
- console.log('[ProductsModule] ✅ 内置商品格式化器已注册(智能定价优先)');
1106
1112
  }
1107
1113
 
1108
1114
  /**
@@ -1150,11 +1156,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1150
1156
  // 插入到内置智能定价格式化器之后;legacy 报价单启用时需跳过它。
1151
1157
  var insertIndex = this.isBuiltinFormatterRegistered ? this.isLegacyPriceFormatterEnabled ? 2 : 1 : 0;
1152
1158
  this.formatters.splice(insertIndex, 0, formatter);
1153
- console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u5728\u4F4D\u7F6E ".concat(insertIndex + 1, " \u63D2\u5165\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ").concat(this.formatters.length, " \u4E2A"));
1154
1159
  } else {
1155
1160
  // 追加到末尾
1156
1161
  this.formatters.push(formatter);
1157
- console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u6CE8\u518C\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ".concat(this.formatters.length, " \u4E2A"));
1158
1162
  }
1159
1163
  }
1160
1164
 
@@ -1170,11 +1174,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1170
1174
  // 保留 legacy 兜底(如果启用)和智能定价格式化器。
1171
1175
  var builtinCount = this.isLegacyPriceFormatterEnabled ? 2 : 1;
1172
1176
  this.formatters = this.formatters.slice(0, builtinCount);
1173
- console.log('[ProductsModule] 🧹 已清空自定义格式化器,保留内置智能定价格式化器');
1174
1177
  } else {
1175
1178
  this.formatters = [];
1176
1179
  this.isBuiltinFormatterRegistered = false;
1177
- console.log('[ProductsModule] 🧹 已清空所有格式化器');
1178
1180
  }
1179
1181
  }
1180
1182
 
@@ -1190,7 +1192,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1190
1192
  var keys = Array.from(this.productsPriceCache.keys());
1191
1193
  var oldestKey = keys[0];
1192
1194
  this.productsPriceCache.delete(oldestKey);
1193
- console.log("[ProductsModule] \uD83E\uDDF9 \u6E05\u7406\u8FC7\u671F\u5546\u54C1\u4EF7\u683C\u7F13\u5B58: ".concat(oldestKey));
1194
1195
  }
1195
1196
  }
1196
1197
 
@@ -1202,7 +1203,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1202
1203
  key: "clearPriceCache",
1203
1204
  value: function clearPriceCache() {
1204
1205
  this.productsPriceCache.clear();
1205
- console.log('[ProductsModule] 🗑️ 商品价格缓存已清空');
1206
+ this.quotationScheduleCache.clear();
1207
+ this.quotationScheduleCacheLoaded = false;
1206
1208
  }
1207
1209
 
1208
1210
  /**
@@ -1212,62 +1214,76 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1212
1214
  key: "loadProductsByServer",
1213
1215
  value: (function () {
1214
1216
  var _loadProductsByServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1215
- var t0, tSSE, productList, list, duration, errorMessage;
1217
+ var options,
1218
+ trigger,
1219
+ t0,
1220
+ tSSE,
1221
+ productList,
1222
+ list,
1223
+ duration,
1224
+ errorMessage,
1225
+ _args9 = arguments;
1216
1226
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1217
1227
  while (1) switch (_context9.prev = _context9.next) {
1218
1228
  case 0:
1229
+ options = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
1219
1230
  if (this.productDataSource) {
1220
- _context9.next = 3;
1231
+ _context9.next = 4;
1221
1232
  break;
1222
1233
  }
1223
1234
  this.logWarning('loadProductsByServer: ProductDataSource 不可用');
1224
1235
  return _context9.abrupt("return", []);
1225
- case 3:
1226
- this.logInfo('开始通过 DataSource SSE 加载商品列表');
1236
+ case 4:
1237
+ trigger = options.trigger || 'unknown';
1238
+ this.logInfo('开始通过 DataSource SSE 加载商品列表', {
1239
+ trigger: trigger
1240
+ });
1227
1241
  t0 = performance.now();
1228
- _context9.prev = 5;
1242
+ _context9.prev = 7;
1229
1243
  tSSE = performance.now();
1230
- _context9.next = 9;
1244
+ _context9.next = 11;
1231
1245
  return this.productDataSource.run({
1232
1246
  sse: {}
1233
1247
  });
1234
- case 9:
1248
+ case 11:
1235
1249
  productList = _context9.sent;
1236
1250
  list = productList || [];
1237
1251
  perfMark('loadProductsByServer.SSE', performance.now() - tSSE, {
1238
1252
  count: list.length
1239
1253
  });
1240
1254
  this.logInfo('通过 DataSource SSE 加载商品列表成功', {
1255
+ trigger: trigger,
1241
1256
  productCount: list.length,
1242
1257
  duration: "".concat(Math.round(performance.now() - t0), "ms")
1243
1258
  });
1244
- _context9.next = 15;
1259
+ _context9.next = 17;
1245
1260
  return this.replaceProductsSnapshotInIndexDB(list, 'loadProductsByServer');
1246
- case 15:
1261
+ case 17:
1247
1262
  this.lastServerFullFetchAtMs = Date.now();
1248
- _context9.next = 18;
1263
+ _context9.next = 20;
1249
1264
  return this.core.effects.emit(ProductsHooks.onProductsLoaded, list);
1250
- case 18:
1265
+ case 20:
1251
1266
  perfMark('loadProductsByServer', performance.now() - t0, {
1252
1267
  count: list.length
1253
1268
  });
1254
1269
  return _context9.abrupt("return", list);
1255
- case 22:
1256
- _context9.prev = 22;
1257
- _context9.t0 = _context9["catch"](5);
1270
+ case 24:
1271
+ _context9.prev = 24;
1272
+ _context9.t0 = _context9["catch"](7);
1258
1273
  duration = Math.round(performance.now() - t0);
1259
1274
  errorMessage = _context9.t0 instanceof Error ? _context9.t0.message : String(_context9.t0);
1260
1275
  console.error('[Products] 加载商品数据失败:', _context9.t0);
1261
1276
  this.logError('通过 DataSource SSE 加载商品列表失败', {
1277
+ trigger: trigger,
1262
1278
  duration: "".concat(duration, "ms"),
1263
1279
  error: errorMessage
1264
1280
  });
1265
1281
  return _context9.abrupt("return", []);
1266
- case 29:
1282
+ case 31:
1267
1283
  case "end":
1268
1284
  return _context9.stop();
1269
1285
  }
1270
- }, _callee9, this, [[5, 22]]);
1286
+ }, _callee9, this, [[7, 24]]);
1271
1287
  }));
1272
1288
  function loadProductsByServer() {
1273
1289
  return _loadProductsByServer.apply(this, arguments);
@@ -1664,7 +1680,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1664
1680
  tTotal = performance.now();
1665
1681
  this.logInfo('refreshProducts 开始');
1666
1682
  _context16.next = 4;
1667
- return this.loadProductsByServer();
1683
+ return this.loadProductsByServer({
1684
+ trigger: 'product_sync'
1685
+ });
1668
1686
  case 4:
1669
1687
  products = _context16.sent;
1670
1688
  if (products && products.length > 0) {
@@ -1714,33 +1732,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1714
1732
 
1715
1733
  // 同时清空 IndexDB 中的所有数据(包括商品和元数据)
1716
1734
  if (!this.dbManager) {
1717
- _context17.next = 16;
1735
+ _context17.next = 15;
1718
1736
  break;
1719
1737
  }
1720
1738
  _context17.prev = 4;
1721
1739
  _context17.next = 7;
1722
1740
  return this.dbManager.clear(INDEXDB_STORE_NAME);
1723
1741
  case 7:
1724
- console.log('[Products] IndexDB 缓存已清空');
1725
1742
  this.logInfo('IndexDB 缓存已清空');
1726
- _context17.next = 16;
1743
+ _context17.next = 15;
1727
1744
  break;
1728
- case 11:
1729
- _context17.prev = 11;
1745
+ case 10:
1746
+ _context17.prev = 10;
1730
1747
  _context17.t0 = _context17["catch"](4);
1731
1748
  errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1732
1749
  console.error('[Products] 清空 IndexDB 缓存失败:', _context17.t0);
1733
1750
  this.logError('清空 IndexDB 缓存失败', {
1734
1751
  error: errorMessage
1735
1752
  });
1736
- case 16:
1737
- console.log('[Products] 缓存已清空');
1753
+ case 15:
1738
1754
  this.logInfo('缓存清空完成');
1739
- case 18:
1755
+ case 16:
1740
1756
  case "end":
1741
1757
  return _context17.stop();
1742
1758
  }
1743
- }, _callee17, this, [[4, 11]]);
1759
+ }, _callee17, this, [[4, 10]]);
1744
1760
  }));
1745
1761
  function clear() {
1746
1762
  return _clear.apply(this, arguments);
@@ -1756,7 +1772,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1756
1772
  key: "loadProductsFromIndexDB",
1757
1773
  value: (function () {
1758
1774
  var _loadProductsFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1759
- var _products$length, _products$length2, t0, products, errorMessage;
1775
+ var startedAt, _products$length, _products$length2, products, durationMs, errorMessage;
1760
1776
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1761
1777
  while (1) switch (_context18.prev = _context18.next) {
1762
1778
  case 0:
@@ -1767,33 +1783,36 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1767
1783
  this.logWarning('loadProductsFromIndexDB: dbManager 不可用');
1768
1784
  return _context18.abrupt("return", []);
1769
1785
  case 3:
1770
- _context18.prev = 3;
1771
- t0 = performance.now();
1786
+ startedAt = performance.now();
1787
+ _context18.prev = 4;
1772
1788
  _context18.next = 7;
1773
1789
  return this.dbManager.getAll(INDEXDB_STORE_NAME);
1774
1790
  case 7:
1775
1791
  products = _context18.sent;
1776
- perfMark('loadProductsFromIndexDB', performance.now() - t0, {
1792
+ durationMs = +(performance.now() - startedAt).toFixed(2);
1793
+ perfMark('loadProductsFromIndexDB', durationMs, {
1777
1794
  count: (_products$length = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length !== void 0 ? _products$length : 0
1778
1795
  });
1779
1796
  this.logInfo('从 IndexDB 加载商品数据', {
1780
- productCount: (_products$length2 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length2 !== void 0 ? _products$length2 : 0
1797
+ productCount: (_products$length2 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length2 !== void 0 ? _products$length2 : 0,
1798
+ durationMs: durationMs
1781
1799
  });
1782
1800
  return _context18.abrupt("return", products || []);
1783
- case 13:
1784
- _context18.prev = 13;
1785
- _context18.t0 = _context18["catch"](3);
1801
+ case 14:
1802
+ _context18.prev = 14;
1803
+ _context18.t0 = _context18["catch"](4);
1786
1804
  errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
1787
1805
  console.error('[Products] 从 IndexDB 读取数据失败:', _context18.t0);
1788
1806
  this.logError('从 IndexDB 读取数据失败', {
1807
+ durationMs: +(performance.now() - startedAt).toFixed(2),
1789
1808
  error: errorMessage
1790
1809
  });
1791
1810
  return _context18.abrupt("return", []);
1792
- case 19:
1811
+ case 20:
1793
1812
  case "end":
1794
1813
  return _context18.stop();
1795
1814
  }
1796
- }, _callee18, this, [[3, 13]]);
1815
+ }, _callee18, this, [[4, 14]]);
1797
1816
  }));
1798
1817
  function loadProductsFromIndexDB() {
1799
1818
  return _loadProductsFromIndexDB.apply(this, arguments);
@@ -1847,7 +1866,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1847
1866
  value: (function () {
1848
1867
  var _replaceProductsSnapshotInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(products, source) {
1849
1868
  var _this9 = this;
1850
- var errorMessage;
1869
+ var enqueuedAt, queueWaitMs, clearDurationMs, writeDurationMs, errorMessage;
1851
1870
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1852
1871
  while (1) switch (_context21.prev = _context21.next) {
1853
1872
  case 0:
@@ -1858,58 +1877,86 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1858
1877
  this.logWarning('replaceProductsSnapshotInIndexDB: dbManager 不可用');
1859
1878
  return _context21.abrupt("return");
1860
1879
  case 3:
1861
- _context21.prev = 3;
1862
- _context21.next = 6;
1880
+ enqueuedAt = performance.now();
1881
+ queueWaitMs = 0;
1882
+ clearDurationMs = 0;
1883
+ writeDurationMs = 0;
1884
+ _context21.prev = 7;
1885
+ _context21.next = 10;
1863
1886
  return this.runInProductIndexDBSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1864
- var t0;
1887
+ var operationStartedAt, clearStartedAt, writeStartedAt, executeDurationMs;
1865
1888
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1866
1889
  while (1) switch (_context20.prev = _context20.next) {
1867
1890
  case 0:
1891
+ operationStartedAt = performance.now();
1892
+ queueWaitMs = +(operationStartedAt - enqueuedAt).toFixed(2);
1868
1893
  _this9.logInfo('replaceProductsSnapshotInIndexDB 开始', {
1869
1894
  source: source,
1870
- productCount: products.length
1895
+ productCount: products.length,
1896
+ queueWaitMs: queueWaitMs
1871
1897
  });
1872
- t0 = performance.now();
1873
- _context20.next = 4;
1898
+ clearStartedAt = performance.now();
1899
+ _context20.prev = 4;
1900
+ _context20.next = 7;
1874
1901
  return _this9.dbManager.clear(INDEXDB_STORE_NAME);
1875
- case 4:
1902
+ case 7:
1903
+ _context20.prev = 7;
1904
+ clearDurationMs = +(performance.now() - clearStartedAt).toFixed(2);
1905
+ return _context20.finish(7);
1906
+ case 10:
1876
1907
  if (!(products.length > 0)) {
1877
- _context20.next = 7;
1908
+ _context20.next = 18;
1878
1909
  break;
1879
1910
  }
1880
- _context20.next = 7;
1911
+ writeStartedAt = performance.now();
1912
+ _context20.prev = 12;
1913
+ _context20.next = 15;
1881
1914
  return _this9.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1882
- case 7:
1883
- perfMark('replaceProductsSnapshotInIndexDB', performance.now() - t0, {
1915
+ case 15:
1916
+ _context20.prev = 15;
1917
+ writeDurationMs = +(performance.now() - writeStartedAt).toFixed(2);
1918
+ return _context20.finish(15);
1919
+ case 18:
1920
+ executeDurationMs = +(performance.now() - operationStartedAt).toFixed(2);
1921
+ perfMark('replaceProductsSnapshotInIndexDB', executeDurationMs, {
1884
1922
  count: products.length
1885
1923
  });
1886
1924
  _this9.logInfo('replaceProductsSnapshotInIndexDB 完成', {
1887
1925
  source: source,
1888
- productCount: products.length
1926
+ productCount: products.length,
1927
+ queueWaitMs: queueWaitMs,
1928
+ clearDurationMs: clearDurationMs,
1929
+ writeDurationMs: writeDurationMs,
1930
+ executeDurationMs: executeDurationMs,
1931
+ totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2)
1889
1932
  });
1890
- case 9:
1933
+ case 21:
1891
1934
  case "end":
1892
1935
  return _context20.stop();
1893
1936
  }
1894
- }, _callee20);
1937
+ }, _callee20, null, [[4,, 7, 10], [12,, 15, 18]]);
1895
1938
  })));
1896
- case 6:
1897
- _context21.next = 12;
1939
+ case 10:
1940
+ _context21.next = 16;
1898
1941
  break;
1899
- case 8:
1900
- _context21.prev = 8;
1901
- _context21.t0 = _context21["catch"](3);
1942
+ case 12:
1943
+ _context21.prev = 12;
1944
+ _context21.t0 = _context21["catch"](7);
1902
1945
  errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
1903
1946
  this.logError('全量保存商品到 IndexDB 失败', {
1904
1947
  source: source,
1905
1948
  productCount: products.length,
1949
+ queueWaitMs: queueWaitMs,
1950
+ clearDurationMs: clearDurationMs,
1951
+ writeDurationMs: writeDurationMs,
1952
+ totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2),
1906
1953
  error: errorMessage
1907
1954
  });
1908
- case 12:
1955
+ case 16:
1909
1956
  case "end":
1910
1957
  return _context21.stop();
1911
1958
  }
1912
- }, _callee21, this, [[3, 8]]);
1959
+ }, _callee21, this, [[7, 12]]);
1913
1960
  }));
1914
1961
  function replaceProductsSnapshotInIndexDB(_x21, _x22) {
1915
1962
  return _replaceProductsSnapshotInIndexDB.apply(this, arguments);
@@ -2080,23 +2127,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2080
2127
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2081
2128
  while (1) switch (_context24.prev = _context24.next) {
2082
2129
  case 0:
2083
- console.log('[Products] 开始预加载数据...');
2084
2130
  tTotal = performance.now();
2085
2131
  this.logInfo('开始预加载数据');
2086
- _context24.prev = 3;
2132
+ _context24.prev = 2;
2087
2133
  tIndexDB = performance.now();
2088
- _context24.next = 7;
2134
+ _context24.next = 6;
2089
2135
  return this.loadProductsFromIndexDB();
2090
- case 7:
2136
+ case 6:
2091
2137
  cachedData = _context24.sent;
2092
2138
  perfMark('preload.loadFromIndexDB', performance.now() - tIndexDB, {
2093
2139
  count: (_cachedData$length = cachedData === null || cachedData === void 0 ? void 0 : cachedData.length) !== null && _cachedData$length !== void 0 ? _cachedData$length : 0
2094
2140
  });
2095
2141
  if (!(cachedData && cachedData.length > 0)) {
2096
- _context24.next = 20;
2142
+ _context24.next = 18;
2097
2143
  break;
2098
2144
  }
2099
- console.log("[Products] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u4E2A\u5546\u54C1"));
2100
2145
  // IndexDB 反序列化的数据已经是全新的,无需 cloneDeep
2101
2146
  this.store.list = cachedData;
2102
2147
  tSync = performance.now();
@@ -2110,30 +2155,32 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2110
2155
  source: 'IndexDB'
2111
2156
  });
2112
2157
  this.logInfo('预加载完成(从 IndexDB)', {
2158
+ trigger: 'preload',
2113
2159
  productCount: cachedData.length,
2114
2160
  duration: "".concat(Math.round(performance.now() - tTotal), "ms"),
2115
2161
  source: 'IndexDB'
2116
2162
  });
2117
2163
  this.lastPreloadCompletedAtMs = Date.now();
2118
2164
  return _context24.abrupt("return");
2119
- case 20:
2120
- console.log('[Products] IndexDB 中没有缓存数据,从服务器加载...');
2165
+ case 18:
2121
2166
  this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
2122
- _context24.next = 29;
2167
+ _context24.next = 26;
2123
2168
  break;
2124
- case 24:
2125
- _context24.prev = 24;
2126
- _context24.t0 = _context24["catch"](3);
2169
+ case 21:
2170
+ _context24.prev = 21;
2171
+ _context24.t0 = _context24["catch"](2);
2127
2172
  errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
2128
2173
  console.warn('[Products] 从 IndexDB 加载数据失败:', _context24.t0);
2129
2174
  this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
2130
2175
  error: errorMessage
2131
2176
  });
2132
- case 29:
2177
+ case 26:
2133
2178
  tServer = performance.now();
2134
- _context24.next = 32;
2135
- return this.loadProductsByServer();
2136
- case 32:
2179
+ _context24.next = 29;
2180
+ return this.loadProductsByServer({
2181
+ trigger: 'preload'
2182
+ });
2183
+ case 29:
2137
2184
  products = _context24.sent;
2138
2185
  perfMark('preload.loadFromServer', performance.now() - tServer, {
2139
2186
  count: (_products$length3 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length3 !== void 0 ? _products$length3 : 0
@@ -2152,6 +2199,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2152
2199
  source: 'Server'
2153
2200
  });
2154
2201
  this.logInfo('预加载完成(从服务器)', {
2202
+ trigger: 'preload',
2155
2203
  productCount: products.length,
2156
2204
  duration: "".concat(Math.round(performance.now() - tTotal), "ms"),
2157
2205
  source: 'Server'
@@ -2165,11 +2213,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2165
2213
  duration: "".concat(Math.round(performance.now() - tTotal), "ms")
2166
2214
  });
2167
2215
  }
2168
- case 35:
2216
+ case 32:
2169
2217
  case "end":
2170
2218
  return _context24.stop();
2171
2219
  }
2172
- }, _callee24, this, [[3, 24]]);
2220
+ }, _callee24, this, [[2, 21]]);
2173
2221
  }));
2174
2222
  function preload() {
2175
2223
  return _preload.apply(this, arguments);
@@ -2213,7 +2261,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2213
2261
  return function (message) {
2214
2262
  var data = (message === null || message === void 0 ? void 0 : message.data) || message;
2215
2263
  if (!data) return;
2216
- console.log("[ProductsModule] \u6536\u5230\u540C\u6B65\u6D88\u606F [".concat(channelKey, "]:"), data);
2217
2264
  _this11.logInfo('收到同步消息', {
2218
2265
  channelKey: channelKey,
2219
2266
  action: data.action,
@@ -2776,64 +2823,91 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2776
2823
  key: "silentRefresh",
2777
2824
  value: (function () {
2778
2825
  var _silentRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2779
- var t0, now, elapsedSincePreload, elapsedSinceFullFetch, products, errorMessage;
2826
+ var options,
2827
+ t0,
2828
+ now,
2829
+ trigger,
2830
+ elapsedSincePreloadMs,
2831
+ elapsedSinceFullFetchMs,
2832
+ products,
2833
+ errorMessage,
2834
+ _args29 = arguments;
2780
2835
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2781
2836
  while (1) switch (_context29.prev = _context29.next) {
2782
2837
  case 0:
2838
+ options = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
2783
2839
  t0 = performance.now();
2784
2840
  now = Date.now();
2785
- elapsedSincePreload = now - this.lastPreloadCompletedAtMs;
2786
- elapsedSinceFullFetch = now - this.lastServerFullFetchAtMs;
2787
- if (!(this.lastPreloadCompletedAtMs > 0 && elapsedSincePreload < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS || this.lastServerFullFetchAtMs > 0 && elapsedSinceFullFetch < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS)) {
2788
- _context29.next = 6;
2841
+ trigger = options.trigger || 'background';
2842
+ elapsedSincePreloadMs = now - this.lastPreloadCompletedAtMs;
2843
+ elapsedSinceFullFetchMs = now - this.lastServerFullFetchAtMs;
2844
+ if (!(this.lastPreloadCompletedAtMs > 0 && elapsedSincePreloadMs < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS || this.lastServerFullFetchAtMs > 0 && elapsedSinceFullFetchMs < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS)) {
2845
+ _context29.next = 9;
2789
2846
  break;
2790
2847
  }
2848
+ this.logInfo('silentRefresh 跳过全量 SSE', {
2849
+ trigger: trigger,
2850
+ reason: 'within_min_interval',
2851
+ minIntervalMs: PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS,
2852
+ elapsedSincePreloadMs: elapsedSincePreloadMs,
2853
+ elapsedSinceFullFetchMs: elapsedSinceFullFetchMs,
2854
+ productCount: this.store.list.length
2855
+ });
2791
2856
  return _context29.abrupt("return", this.store.list);
2792
- case 6:
2793
- this.logInfo('silentRefresh 开始');
2794
- _context29.prev = 7;
2795
- _context29.next = 10;
2796
- return this.loadProductsByServer();
2797
- case 10:
2857
+ case 9:
2858
+ this.logInfo('silentRefresh 开始', {
2859
+ trigger: trigger,
2860
+ elapsedSincePreloadMs: elapsedSincePreloadMs,
2861
+ elapsedSinceFullFetchMs: elapsedSinceFullFetchMs,
2862
+ productCount: this.store.list.length
2863
+ });
2864
+ _context29.prev = 10;
2865
+ _context29.next = 13;
2866
+ return this.loadProductsByServer({
2867
+ trigger: trigger
2868
+ });
2869
+ case 13:
2798
2870
  products = _context29.sent;
2799
2871
  if (!(products && products.length > 0)) {
2800
- _context29.next = 21;
2872
+ _context29.next = 24;
2801
2873
  break;
2802
2874
  }
2803
2875
  this.store.list = products;
2804
2876
  this.syncProductsMap();
2805
2877
  this.clearPriceCache();
2806
2878
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
2807
- _context29.next = 18;
2879
+ _context29.next = 21;
2808
2880
  return this.core.effects.emit(ProductsHooks.onProductsSyncCompleted, null);
2809
- case 18:
2881
+ case 21:
2810
2882
  this.logInfo('silentRefresh 完成', {
2883
+ trigger: trigger,
2811
2884
  productCount: products.length,
2812
2885
  duration: "".concat(Math.round(performance.now() - t0), "ms")
2813
2886
  });
2814
- _context29.next = 22;
2887
+ _context29.next = 25;
2815
2888
  break;
2816
- case 21:
2889
+ case 24:
2817
2890
  this.logWarning('silentRefresh: 服务器未返回数据');
2818
- case 22:
2891
+ case 25:
2819
2892
  perfMark('silentRefresh', performance.now() - t0, {
2820
2893
  count: this.store.list.length
2821
2894
  });
2822
2895
  return _context29.abrupt("return", this.store.list);
2823
- case 26:
2824
- _context29.prev = 26;
2825
- _context29.t0 = _context29["catch"](7);
2896
+ case 29:
2897
+ _context29.prev = 29;
2898
+ _context29.t0 = _context29["catch"](10);
2826
2899
  errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
2827
2900
  this.logError('silentRefresh 失败', {
2901
+ trigger: trigger,
2828
2902
  duration: "".concat(Math.round(performance.now() - t0), "ms"),
2829
2903
  error: errorMessage
2830
2904
  });
2831
2905
  return _context29.abrupt("return", this.store.list);
2832
- case 31:
2906
+ case 34:
2833
2907
  case "end":
2834
2908
  return _context29.stop();
2835
2909
  }
2836
- }, _callee29, this, [[7, 26]]);
2910
+ }, _callee29, this, [[10, 29]]);
2837
2911
  }));
2838
2912
  function silentRefresh() {
2839
2913
  return _silentRefresh.apply(this, arguments);