@pisell/pisellos 2.3.74 → 2.3.76

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 (283) hide show
  1. package/dist/core/index.js +6 -10
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  4. package/dist/model/strategy/strategy-example.js +5 -19
  5. package/dist/modules/Cart/index.js +0 -3
  6. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  7. package/dist/modules/Date/index.js +1 -5
  8. package/dist/modules/Discount/index.js +2 -4
  9. package/dist/modules/OpenData/index.js +0 -2
  10. package/dist/modules/Order/index.d.ts +1 -1
  11. package/dist/modules/Order/index.js +75 -91
  12. package/dist/modules/Order/types.d.ts +3 -1
  13. package/dist/modules/Payment/index.js +97 -162
  14. package/dist/modules/Rules/index.js +1 -4
  15. package/dist/modules/Schedule/index.js +0 -1
  16. package/dist/modules/Schedule/utils.js +0 -1
  17. package/dist/modules/Step/index.js +0 -1
  18. package/dist/plugins/request.js +1 -4
  19. package/dist/plugins/window.js +2 -6
  20. package/dist/server/index.js +97 -129
  21. package/dist/server/modules/menu/index.js +32 -41
  22. package/dist/server/modules/order/index.js +2 -4
  23. package/dist/server/modules/products/index.js +24 -42
  24. package/dist/server/modules/quotation/index.js +29 -38
  25. package/dist/server/modules/resource/index.js +3 -4
  26. package/dist/server/modules/schedule/index.js +27 -35
  27. package/dist/server/utils/product.js +0 -1
  28. package/dist/solution/BaseSales/index.js +100 -72
  29. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  30. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  31. package/dist/solution/BookingByStep/index.js +7 -59
  32. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  33. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  34. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  35. package/dist/solution/BookingTicket/index.js +0 -2
  36. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  37. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  38. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  39. package/dist/solution/BuyTickets/index.js +9 -12
  40. package/dist/solution/Checkout/index.js +177 -252
  41. package/dist/solution/Checkout/utils/index.js +4 -16
  42. package/dist/solution/RegisterAndLogin/index.js +30 -76
  43. package/dist/solution/ScanOrder/index.js +50 -60
  44. package/dist/solution/ShopDiscount/index.js +2 -7
  45. package/dist/solution/VenueBooking/index.js +45 -55
  46. package/dist/utils/task.js +15 -18
  47. package/dist/utils/watch.js +0 -1
  48. package/lib/apis/picoding.js +2 -0
  49. package/lib/core/index.js +134 -134
  50. package/lib/effects/index.js +46 -57
  51. package/lib/index.js +82 -49
  52. package/lib/model/index.js +14 -21
  53. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  54. package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
  55. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  56. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  57. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  58. package/lib/model/strategy/adapter/index.js +100 -64
  59. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  60. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  61. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  62. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  63. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  64. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  65. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  66. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  67. package/lib/model/strategy/adapter/promotion/index.js +1 -0
  68. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  69. package/lib/model/strategy/adapter/type.js +4 -16
  70. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  71. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  72. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  73. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  74. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  75. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  76. package/lib/model/strategy/engine.js +270 -168
  77. package/lib/model/strategy/index.js +49 -34
  78. package/lib/model/strategy/strategy-example.js +243 -239
  79. package/lib/model/strategy/type.js +100 -40
  80. package/lib/modules/Account/index.js +39 -53
  81. package/lib/modules/Account/types.js +20 -33
  82. package/lib/modules/AccountList/index.js +116 -154
  83. package/lib/modules/AccountList/types.js +30 -31
  84. package/lib/modules/AccountList/utils.js +18 -30
  85. package/lib/modules/BaseModule.js +23 -42
  86. package/lib/modules/BookingContext/index.js +158 -136
  87. package/lib/modules/BookingContext/types.js +46 -32
  88. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  89. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  90. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  91. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  92. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  93. package/lib/modules/BookingContext/utils/index.js +124 -41
  94. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  95. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  96. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  97. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  98. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  99. package/lib/modules/BookingContext/utils/resources.js +209 -167
  100. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  101. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  102. package/lib/modules/Cart/index.js +170 -124
  103. package/lib/modules/Cart/types.js +46 -51
  104. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  105. package/lib/modules/Cart/utils/cartDate.js +56 -61
  106. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  107. package/lib/modules/Cart/utils/cartNote.js +27 -32
  108. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  109. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  110. package/lib/modules/Cart/utils/cartResource.js +70 -78
  111. package/lib/modules/Cart/utils/changePrice.js +22 -50
  112. package/lib/modules/Cart/utils/index.js +106 -48
  113. package/lib/modules/Customer/constants.js +13 -34
  114. package/lib/modules/Customer/index.js +235 -172
  115. package/lib/modules/Customer/types.js +38 -35
  116. package/lib/modules/Date/index.js +116 -115
  117. package/lib/modules/Date/types.js +16 -28
  118. package/lib/modules/Date/utils.js +174 -123
  119. package/lib/modules/Discount/index.js +122 -127
  120. package/lib/modules/Discount/types.js +9 -31
  121. package/lib/modules/Guests/index.js +30 -56
  122. package/lib/modules/Guests/types.js +23 -33
  123. package/lib/modules/Holder/index.js +209 -189
  124. package/lib/modules/Holder/types.js +4 -16
  125. package/lib/modules/Holder/utils.js +20 -49
  126. package/lib/modules/OpenData/index.js +70 -76
  127. package/lib/modules/OpenData/types.js +4 -16
  128. package/lib/modules/OpenData/utils.js +44 -78
  129. package/lib/modules/Order/index.d.ts +1 -1
  130. package/lib/modules/Order/index.js +1733 -2121
  131. package/lib/modules/Order/payment-utils.js +77 -120
  132. package/lib/modules/Order/types.d.ts +3 -1
  133. package/lib/modules/Order/types.js +88 -35
  134. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  135. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  136. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  137. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  138. package/lib/modules/Order/utils.js +814 -647
  139. package/lib/modules/Payment/cash.js +20 -33
  140. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  141. package/lib/modules/Payment/eftpos.js +16 -30
  142. package/lib/modules/Payment/index.js +532 -399
  143. package/lib/modules/Payment/mx51.js +1 -0
  144. package/lib/modules/Payment/types.js +230 -108
  145. package/lib/modules/Payment/utils.js +52 -51
  146. package/lib/modules/Payment/walletpass.js +485 -660
  147. package/lib/modules/Product/index.js +51 -46
  148. package/lib/modules/Product/types.js +4 -16
  149. package/lib/modules/Product/utils.js +32 -33
  150. package/lib/modules/ProductList/index.js +113 -123
  151. package/lib/modules/ProductList/types.js +9 -31
  152. package/lib/modules/Quotation/index.js +81 -118
  153. package/lib/modules/Quotation/types.js +4 -16
  154. package/lib/modules/Resource/index.js +27 -59
  155. package/lib/modules/Resource/types.js +22 -32
  156. package/lib/modules/Resource/utils.js +30 -38
  157. package/lib/modules/ResourcePlanner/index.js +25 -23
  158. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  159. package/lib/modules/ResourcePlanner/planner.js +589 -770
  160. package/lib/modules/ResourcePlanner/types.js +10 -29
  161. package/lib/modules/Rules/index.js +1218 -959
  162. package/lib/modules/Rules/types.js +17 -40
  163. package/lib/modules/SalesSummary/index.js +85 -90
  164. package/lib/modules/SalesSummary/types.js +4 -16
  165. package/lib/modules/SalesSummary/utils.js +355 -430
  166. package/lib/modules/ScanOrderLogger/index.js +59 -79
  167. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  168. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  169. package/lib/modules/ScanOrderLogger/types.js +4 -16
  170. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  171. package/lib/modules/Schedule/index.js +100 -114
  172. package/lib/modules/Schedule/type.js +4 -16
  173. package/lib/modules/Schedule/types.js +4 -16
  174. package/lib/modules/Schedule/utils.js +433 -291
  175. package/lib/modules/Step/index.js +40 -52
  176. package/lib/modules/Step/tyeps.js +4 -16
  177. package/lib/modules/Summary/index.js +66 -71
  178. package/lib/modules/Summary/types.js +4 -16
  179. package/lib/modules/Summary/utils.js +773 -418
  180. package/lib/modules/SurchargeList/index.js +46 -60
  181. package/lib/modules/SurchargeList/types.js +4 -16
  182. package/lib/modules/index.js +245 -63
  183. package/lib/plugins/app.js +4 -16
  184. package/lib/plugins/index.js +36 -25
  185. package/lib/plugins/request.js +137 -126
  186. package/lib/plugins/shopStore.js +4 -16
  187. package/lib/plugins/user.js +4 -16
  188. package/lib/plugins/window.js +171 -179
  189. package/lib/server/index.js +3050 -2665
  190. package/lib/server/modules/floor-plan/index.js +118 -134
  191. package/lib/server/modules/floor-plan/types.js +15 -30
  192. package/lib/server/modules/index.js +106 -68
  193. package/lib/server/modules/menu/index.js +142 -122
  194. package/lib/server/modules/menu/types.js +18 -31
  195. package/lib/server/modules/order/index.js +784 -1002
  196. package/lib/server/modules/order/types.js +122 -33
  197. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  198. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  199. package/lib/server/modules/payment/index.js +59 -83
  200. package/lib/server/modules/payment/types.js +4 -16
  201. package/lib/server/modules/products/index.js +583 -471
  202. package/lib/server/modules/products/types.js +44 -34
  203. package/lib/server/modules/quotation/index.js +137 -172
  204. package/lib/server/modules/quotation/types.js +21 -31
  205. package/lib/server/modules/resource/index.js +220 -186
  206. package/lib/server/modules/resource/types.js +42 -33
  207. package/lib/server/modules/schedule/index.js +135 -123
  208. package/lib/server/modules/schedule/types.js +14 -21
  209. package/lib/server/modules/schedule/utils.js +334 -163
  210. package/lib/server/types.js +4 -16
  211. package/lib/server/utils/index.js +25 -23
  212. package/lib/server/utils/product.js +196 -139
  213. package/lib/server/utils/schedule.js +34 -41
  214. package/lib/server/utils/small-ticket.js +479 -456
  215. package/lib/server/utils/time.js +40 -49
  216. package/lib/solution/BaseSales/index.js +1220 -1412
  217. package/lib/solution/BaseSales/types.js +42 -38
  218. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  219. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  220. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  221. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  222. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
  223. package/lib/solution/BaseSales/utils.js +158 -143
  224. package/lib/solution/BookingByStep/index.js +1527 -1340
  225. package/lib/solution/BookingByStep/types.js +40 -99
  226. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  227. package/lib/solution/BookingByStep/utils/products.js +42 -52
  228. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  229. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  230. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  231. package/lib/solution/BookingTicket/index.js +607 -522
  232. package/lib/solution/BookingTicket/types.js +99 -77
  233. package/lib/solution/BookingTicket/utils/addProductDecision.js +226 -189
  234. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  235. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  236. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  237. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  238. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  239. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  240. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  241. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  242. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  243. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  244. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  245. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  246. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  247. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  248. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  249. package/lib/solution/BuyTickets/index.js +67 -70
  250. package/lib/solution/BuyTickets/types.js +22 -38
  251. package/lib/solution/Checkout/index.js +1451 -1158
  252. package/lib/solution/Checkout/types.js +91 -61
  253. package/lib/solution/Checkout/utils/index.js +228 -156
  254. package/lib/solution/PlaceOrder/index.js +55 -0
  255. package/lib/solution/RegisterAndLogin/config.js +493 -460
  256. package/lib/solution/RegisterAndLogin/index.js +633 -630
  257. package/lib/solution/RegisterAndLogin/types.js +189 -76
  258. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  259. package/lib/solution/Sales/index.js +328 -324
  260. package/lib/solution/Sales/types.js +27 -33
  261. package/lib/solution/ScanOrder/index.js +832 -864
  262. package/lib/solution/ScanOrder/types.js +33 -34
  263. package/lib/solution/ScanOrder/utils.js +409 -374
  264. package/lib/solution/ShopDiscount/index.js +226 -232
  265. package/lib/solution/ShopDiscount/types.js +15 -37
  266. package/lib/solution/ShopDiscount/utils.js +300 -172
  267. package/lib/solution/UnifiedBookingSales/index.js +1035 -1201
  268. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  269. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  270. package/lib/solution/VenueBooking/index.js +811 -879
  271. package/lib/solution/VenueBooking/types.js +19 -39
  272. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  273. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  274. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  275. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  276. package/lib/solution/VenueBooking/utils.js +130 -67
  277. package/lib/solution/index.js +124 -41
  278. package/lib/store/createStore.js +32 -29
  279. package/lib/types/index.js +4 -16
  280. package/lib/utils/payment-number.js +26 -46
  281. package/lib/utils/task.js +36 -36
  282. package/lib/utils/watch.js +81 -47
  283. package/package.json +2 -1
@@ -157,9 +157,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
157
157
  app = appPlugin.getApp();
158
158
  this.dbManager = app.sqlite;
159
159
  this.logger = app.logger;
160
- if (this.dbManager) {
161
- console.log('[Schedule] SQLite 已初始化');
162
- } else {
160
+ if (this.dbManager) {} else {
163
161
  console.warn('[Schedule] SQLite 未找到');
164
162
  }
165
163
  }
@@ -323,7 +321,6 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
323
321
  } finally {
324
322
  _iterator2.f();
325
323
  }
326
- console.log("[Schedule] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u65E5\u7A0B"));
327
324
  }
328
325
 
329
326
  /**
@@ -344,32 +341,31 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
344
341
  this.store.map.clear();
345
342
  // 同时清空 SQLite 中的数据
346
343
  if (!this.dbManager) {
347
- _context3.next = 16;
344
+ _context3.next = 15;
348
345
  break;
349
346
  }
350
347
  _context3.prev = 4;
351
348
  _context3.next = 7;
352
349
  return this.dbManager.clear(SCHEDULE_STORE_NAME);
353
350
  case 7:
354
- console.log('[Schedule] SQLite 缓存已清空');
355
351
  this.logInfo('SQLite 缓存已清空');
356
- _context3.next = 16;
352
+ _context3.next = 15;
357
353
  break;
358
- case 11:
359
- _context3.prev = 11;
354
+ case 10:
355
+ _context3.prev = 10;
360
356
  _context3.t0 = _context3["catch"](4);
361
357
  errorMessage = _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0);
362
358
  console.error('[Schedule] 清空 SQLite 缓存失败:', _context3.t0);
363
359
  this.logError('清空 SQLite 缓存失败', {
364
360
  error: errorMessage
365
361
  });
366
- case 16:
362
+ case 15:
367
363
  this.logInfo('缓存清空完成');
368
- case 17:
364
+ case 16:
369
365
  case "end":
370
366
  return _context3.stop();
371
367
  }
372
- }, _callee3, this, [[4, 11]]);
368
+ }, _callee3, this, [[4, 10]]);
373
369
  }));
374
370
  function clear() {
375
371
  return _clear.apply(this, arguments);
@@ -509,14 +505,13 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
509
505
  return _this4.dbManager.add(SCHEDULE_STORE_NAME, schedule);
510
506
  }));
511
507
  case 20:
512
- console.log("[Schedule] \u5DF2\u5C06 ".concat(scheduleList.length, " \u6761\u65E5\u7A0B\u6570\u636E\u4FDD\u5B58\u5230 SQLite"));
513
508
  this.logInfo('日程数据已保存到 SQLite', {
514
509
  scheduleCount: scheduleList.length
515
510
  });
516
- _context5.next = 29;
511
+ _context5.next = 28;
517
512
  break;
518
- case 24:
519
- _context5.prev = 24;
513
+ case 23:
514
+ _context5.prev = 23;
520
515
  _context5.t0 = _context5["catch"](4);
521
516
  errorMessage = _context5.t0 instanceof Error ? _context5.t0.message : String(_context5.t0);
522
517
  console.error('[Schedule] 保存数据到 SQLite 失败:', _context5.t0);
@@ -524,11 +519,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
524
519
  scheduleCount: scheduleList.length,
525
520
  error: errorMessage
526
521
  });
527
- case 29:
522
+ case 28:
528
523
  case "end":
529
524
  return _context5.stop();
530
525
  }
531
- }, _callee5, this, [[4, 24]]);
526
+ }, _callee5, this, [[4, 23]]);
532
527
  }));
533
528
  function saveScheduleToSQLite(_x3) {
534
529
  return _saveScheduleToSQLite.apply(this, arguments);
@@ -548,19 +543,17 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
548
543
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
549
544
  while (1) switch (_context6.prev = _context6.next) {
550
545
  case 0:
551
- console.log('[Schedule] 开始预加载数据...');
552
546
  startTime = Date.now();
553
547
  this.logInfo('开始预加载数据');
554
- _context6.prev = 3;
555
- _context6.next = 6;
548
+ _context6.prev = 2;
549
+ _context6.next = 5;
556
550
  return this.loadScheduleFromSQLite();
557
- case 6:
551
+ case 5:
558
552
  cachedData = _context6.sent;
559
553
  if (!(cachedData && cachedData.length > 0)) {
560
- _context6.next = 14;
554
+ _context6.next = 12;
561
555
  break;
562
556
  }
563
- console.log("[Schedule] \u4ECE SQLite \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u65E5\u7A0B\u6570\u636E"));
564
557
  // 将缓存数据放入 store
565
558
  this.store.scheduleList = cloneDeep(cachedData);
566
559
  // 同步更新 Map 缓存
@@ -572,23 +565,22 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
572
565
  source: 'SQLite'
573
566
  });
574
567
  return _context6.abrupt("return");
575
- case 14:
576
- console.log('[Schedule] SQLite 中没有缓存数据,从服务器加载...');
568
+ case 12:
577
569
  this.logInfo('SQLite 中没有缓存数据,准备从服务器加载');
578
- _context6.next = 23;
570
+ _context6.next = 20;
579
571
  break;
580
- case 18:
581
- _context6.prev = 18;
582
- _context6.t0 = _context6["catch"](3);
572
+ case 15:
573
+ _context6.prev = 15;
574
+ _context6.t0 = _context6["catch"](2);
583
575
  errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
584
576
  console.warn('[Schedule] 从 SQLite 加载数据失败:', _context6.t0);
585
577
  this.logWarning('从 SQLite 加载数据失败,准备从服务器加载', {
586
578
  error: errorMessage
587
579
  });
588
- case 23:
589
- _context6.next = 25;
580
+ case 20:
581
+ _context6.next = 22;
590
582
  return this.loadAllSchedule();
591
- case 25:
583
+ case 22:
592
584
  scheduleList = _context6.sent;
593
585
  // 3. 将服务器数据放入 store
594
586
  if (scheduleList && scheduleList.length > 0) {
@@ -607,11 +599,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
607
599
  duration: "".concat(_duration3, "ms")
608
600
  });
609
601
  }
610
- case 27:
602
+ case 24:
611
603
  case "end":
612
604
  return _context6.stop();
613
605
  }
614
- }, _callee6, this, [[3, 18]]);
606
+ }, _callee6, this, [[2, 15]]);
615
607
  }));
616
608
  function preload() {
617
609
  return _preload.apply(this, arguments);
@@ -82,7 +82,6 @@ function buildPriceIndexMap(priceData) {
82
82
  export function applyPriceDataToProducts(products, priceData) {
83
83
  var t0 = performance.now();
84
84
  if (!priceData || priceData.length === 0) {
85
- console.log('[applyPriceDataToProducts] 没有价格数据,返回原商品');
86
85
  return products;
87
86
  }
88
87
  var t1 = performance.now();
@@ -370,6 +370,24 @@ function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
370
370
  }
371
371
  return record;
372
372
  }
373
+
374
+ /**
375
+ * merge hydrate 不会统一给所有商品补 saved 标记,因此先只标记远端已保存商品。
376
+ * 当前 tempOrder 中尚未提交的本地商品会在 merge 后继续保持 current item 语义。
377
+ */
378
+ function markLoadedSalesDetailProductsAsSaved(sourceRecord) {
379
+ if (!sourceRecord || _typeof(sourceRecord) !== 'object') return sourceRecord;
380
+ if (!Array.isArray(sourceRecord.products)) return sourceRecord;
381
+ return _objectSpread(_objectSpread({}, sourceRecord), {}, {
382
+ products: sourceRecord.products.map(function (product) {
383
+ return _objectSpread(_objectSpread({}, product || {}), {}, {
384
+ metadata: _objectSpread(_objectSpread({}, product !== null && product !== void 0 && product.metadata && _typeof(product.metadata) === 'object' ? product.metadata : {}), {}, {
385
+ is_edit_for_runtime: true
386
+ })
387
+ });
388
+ })
389
+ });
390
+ }
373
391
  export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
374
392
  _inherits(BaseSalesImpl, _BaseModule);
375
393
  var _super = _createSuper(BaseSalesImpl);
@@ -669,7 +687,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
669
687
  }, {
670
688
  key: "hydrateLatestLoadedSalesDetail",
671
689
  value: function () {
672
- var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(record, loadSequence, hydrateSource) {
690
+ var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(record, loadSequence, options) {
673
691
  var _this4 = this;
674
692
  var hydratedSales, skippedBeforeHydrate, hydrateTask, queuedTask;
675
693
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -679,7 +697,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
679
697
  skippedBeforeHydrate = false;
680
698
  hydrateTask = /*#__PURE__*/function () {
681
699
  var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
682
- var sales;
700
+ var hydrateOptions, sales;
683
701
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
684
702
  while (1) switch (_context4.prev = _context4.next) {
685
703
  case 0:
@@ -696,30 +714,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
696
714
  }
697
715
  throw new Error('order 模块未初始化');
698
716
  case 5:
699
- _context4.next = 7;
700
- return _this4.store.order.hydrateTempOrderFromRecord(record, hydrateSource === 'sessionStorage' ? {
701
- recalcOnHydrate: true,
702
- source: 'sessionStorage'
703
- } : {
717
+ hydrateOptions = {
704
718
  recalcOnHydrate: false
705
- });
706
- case 7:
719
+ };
720
+ if ((options === null || options === void 0 ? void 0 : options.hydrateSource) === 'sessionStorage') {
721
+ hydrateOptions = {
722
+ recalcOnHydrate: true,
723
+ source: 'sessionStorage'
724
+ };
725
+ } else if (options !== null && options !== void 0 && options.merge) {
726
+ hydrateOptions = {
727
+ recalcOnHydrate: true,
728
+ source: 'mergedSalesDetail'
729
+ };
730
+ }
731
+ _context4.next = 9;
732
+ return _this4.store.order.hydrateTempOrderFromRecord(record, hydrateOptions);
733
+ case 9:
707
734
  sales = _context4.sent;
708
735
  hydratedSales = sales;
709
736
 
710
737
  // hydrate 期间可能又发起了更新请求;后续任务已串行排队,将负责最终状态。
711
738
  if (!(loadSequence !== _this4.salesDetailLoadSequence)) {
712
- _context4.next = 11;
739
+ _context4.next = 13;
713
740
  break;
714
741
  }
715
742
  return _context4.abrupt("return");
716
- case 11:
743
+ case 13:
717
744
  _this4.currentSalesDetail = sales;
718
- _context4.next = 14;
745
+ _context4.next = 16;
719
746
  return _this4.core.effects.emit("".concat(_this4.name, ":onSalesOrderLoaded"), {
720
747
  sales: sales
721
748
  });
722
- case 14:
749
+ case 16:
723
750
  case "end":
724
751
  return _context4.stop();
725
752
  }
@@ -1534,7 +1561,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1534
1561
  key: "loadSalesDetail",
1535
1562
  value: (function () {
1536
1563
  var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
1537
- var loadSequence, _ref27, _ref28, _ref29, _ref30, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, currentTempOrder, mergedRecord, record;
1564
+ var loadSequence, _ref27, _ref28, _ref29, _ref30, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
1538
1565
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1539
1566
  while (1) switch (_context14.prev = _context14.next) {
1540
1567
  case 0:
@@ -1586,39 +1613,43 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1586
1613
  loadedSalesDetail = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data; // payment_pending 只存在于本地;远端详情需过滤,但会话快照必须完整恢复。
1587
1614
  shouldFilterPendingPayments = params.hydrateSource !== 'sessionStorage';
1588
1615
  remoteRecord = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(loadedSalesDetail) : loadedSalesDetail;
1616
+ mergeSourceRecord = params.merge ? markLoadedSalesDetailProductsAsSaved(remoteRecord) : remoteRecord;
1589
1617
  currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
1590
- mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord, 'preserve-local') : remoteRecord;
1618
+ mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, mergeSourceRecord, 'preserve-local') : mergeSourceRecord;
1591
1619
  record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
1592
- _context14.next = 30;
1593
- return this.hydrateLatestLoadedSalesDetail(record, loadSequence, params.hydrateSource);
1594
- case 30:
1595
- return _context14.abrupt("return", _context14.sent);
1620
+ _context14.next = 31;
1621
+ return this.hydrateLatestLoadedSalesDetail(record, loadSequence, {
1622
+ hydrateSource: params.hydrateSource,
1623
+ merge: params.merge
1624
+ });
1596
1625
  case 31:
1597
- _context14.prev = 31;
1626
+ return _context14.abrupt("return", _context14.sent);
1627
+ case 32:
1628
+ _context14.prev = 32;
1598
1629
  this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
1599
1630
  if (!(this.salesDetailLoadInFlightCount === 0)) {
1600
- _context14.next = 42;
1631
+ _context14.next = 43;
1601
1632
  break;
1602
1633
  }
1603
- _context14.prev = 34;
1604
- _context14.next = 37;
1634
+ _context14.prev = 35;
1635
+ _context14.next = 38;
1605
1636
  return this.drainQueuedServerOrderChanges();
1606
- case 37:
1607
- _context14.next = 42;
1637
+ case 38:
1638
+ _context14.next = 43;
1608
1639
  break;
1609
- case 39:
1610
- _context14.prev = 39;
1611
- _context14.t1 = _context14["catch"](34);
1640
+ case 40:
1641
+ _context14.prev = 40;
1642
+ _context14.t1 = _context14["catch"](35);
1612
1643
  this.logError('drain queued server order changes failed', {
1613
1644
  error: _context14.t1 instanceof Error ? _context14.t1.message : String(_context14.t1)
1614
1645
  });
1615
- case 42:
1616
- return _context14.finish(31);
1617
1646
  case 43:
1647
+ return _context14.finish(32);
1648
+ case 44:
1618
1649
  case "end":
1619
1650
  return _context14.stop();
1620
1651
  }
1621
- }, _callee14, this, [[4,, 31, 43], [34, 39]]);
1652
+ }, _callee14, this, [[4,, 32, 44], [35, 40]]);
1622
1653
  }));
1623
1654
  function loadSalesDetail(_x13) {
1624
1655
  return _loadSalesDetail.apply(this, arguments);
@@ -2272,11 +2303,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2272
2303
  });
2273
2304
  case 40:
2274
2305
  if (!rulesModule) {
2275
- _context21.next = 77;
2306
+ _context21.next = 76;
2276
2307
  break;
2277
2308
  }
2278
2309
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
2279
- console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
2280
2310
  result = rulesModule.calcDiscount({
2281
2311
  productList: tempOrder.products,
2282
2312
  discountList: nextDiscountList,
@@ -2293,22 +2323,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2293
2323
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2294
2324
  }
2295
2325
  _iterator2 = _createForOfIteratorHelper(tempOrder.products || []);
2296
- _context21.prev = 46;
2326
+ _context21.prev = 45;
2297
2327
  _iterator2.s();
2298
- case 48:
2328
+ case 47:
2299
2329
  if ((_step2 = _iterator2.n()).done) {
2300
- _context21.next = 63;
2330
+ _context21.next = 62;
2301
2331
  break;
2302
2332
  }
2303
2333
  product = _step2.value;
2304
2334
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
2305
2335
  runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
2306
2336
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
2307
- _context21.next = 54;
2337
+ _context21.next = 53;
2308
2338
  break;
2309
2339
  }
2310
- return _context21.abrupt("continue", 61);
2311
- case 54:
2340
+ return _context21.abrupt("continue", 60);
2341
+ case 53:
2312
2342
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2313
2343
  return sum + Number(pd.amount || 0);
2314
2344
  }, 0);
@@ -2324,59 +2354,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2324
2354
  mainPrice: newMainSellingPrice,
2325
2355
  bundle: product.product_bundle
2326
2356
  });
2327
- case 61:
2328
- _context21.next = 48;
2357
+ case 60:
2358
+ _context21.next = 47;
2329
2359
  break;
2330
- case 63:
2331
- _context21.next = 68;
2360
+ case 62:
2361
+ _context21.next = 67;
2332
2362
  break;
2333
- case 65:
2334
- _context21.prev = 65;
2335
- _context21.t0 = _context21["catch"](46);
2363
+ case 64:
2364
+ _context21.prev = 64;
2365
+ _context21.t0 = _context21["catch"](45);
2336
2366
  _iterator2.e(_context21.t0);
2337
- case 68:
2338
- _context21.prev = 68;
2367
+ case 67:
2368
+ _context21.prev = 67;
2339
2369
  _iterator2.f();
2340
- return _context21.finish(68);
2341
- case 71:
2370
+ return _context21.finish(67);
2371
+ case 70:
2342
2372
  if (!result.discountList) {
2343
- _context21.next = 77;
2373
+ _context21.next = 76;
2344
2374
  break;
2345
2375
  }
2346
2376
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2347
2377
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2348
- _context21.next = 76;
2378
+ _context21.next = 75;
2349
2379
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2350
- case 76:
2380
+ case 75:
2351
2381
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2352
2382
  return discount.isSelected;
2353
2383
  });
2354
- case 77:
2355
- _context21.next = 79;
2384
+ case 76:
2385
+ _context21.next = 78;
2356
2386
  return this.store.order.recalculateSummary({
2357
2387
  createIfMissing: true
2358
2388
  });
2359
- case 79:
2389
+ case 78:
2360
2390
  summary = _context21.sent;
2361
2391
  this.store.order.persistTempOrder();
2362
- _context21.next = 83;
2392
+ _context21.next = 82;
2363
2393
  return this.effectsEmit('onDiscountApplied', {
2364
2394
  productList: tempOrder.products || [],
2365
2395
  discountList: nextDiscountList,
2366
2396
  selectedDiscountList: tempOrder.discount_list || [],
2367
2397
  tempOrder: tempOrder
2368
2398
  });
2369
- case 83:
2399
+ case 82:
2370
2400
  return _context21.abrupt("return", {
2371
2401
  productList: tempOrder.products || [],
2372
2402
  discountList: nextDiscountList,
2373
2403
  availableWalletIds: this.getAvailableWalletIds()
2374
2404
  });
2375
- case 84:
2405
+ case 83:
2376
2406
  case "end":
2377
2407
  return _context21.stop();
2378
2408
  }
2379
- }, _callee21, this, [[46, 65, 68, 71]]);
2409
+ }, _callee21, this, [[45, 64, 67, 70]]);
2380
2410
  }));
2381
2411
  function loadDiscountConfig(_x16) {
2382
2412
  return _loadDiscountConfig.apply(this, arguments);
@@ -2420,11 +2450,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2420
2450
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2421
2451
  case 12:
2422
2452
  if (!rulesModule) {
2423
- _context22.next = 24;
2453
+ _context22.next = 23;
2424
2454
  break;
2425
2455
  }
2426
2456
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
2427
- console.log('[BaseSales.bestDiscount.calcDiscount]');
2428
2457
  result = rulesModule.calcDiscount({
2429
2458
  productList: tempOrder.products,
2430
2459
  discountList: nextDiscountList,
@@ -2438,14 +2467,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2438
2467
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2439
2468
  }
2440
2469
  if (!result.discountList) {
2441
- _context22.next = 24;
2470
+ _context22.next = 23;
2442
2471
  break;
2443
2472
  }
2444
2473
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2445
2474
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2446
- _context22.next = 22;
2475
+ _context22.next = 21;
2447
2476
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2448
- case 22:
2477
+ case 21:
2449
2478
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2450
2479
  return discount.isSelected;
2451
2480
  });
@@ -2453,24 +2482,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2453
2482
  productList: tempOrder.products,
2454
2483
  discountList: nextDiscountList
2455
2484
  };
2456
- case 24:
2457
- _context22.next = 26;
2485
+ case 23:
2486
+ _context22.next = 25;
2458
2487
  return this.store.order.recalculateSummary({
2459
2488
  createIfMissing: true
2460
2489
  });
2461
- case 26:
2490
+ case 25:
2462
2491
  this.store.order.persistTempOrder();
2463
- _context22.next = 29;
2492
+ _context22.next = 28;
2464
2493
  return this.effectsEmit('onDiscountApplied', {
2465
2494
  productList: tempOrder.products || [],
2466
2495
  discountList: nextDiscountList,
2467
2496
  selectedDiscountList: tempOrder.discount_list || [],
2468
2497
  tempOrder: tempOrder
2469
2498
  });
2470
- case 29:
2499
+ case 28:
2471
2500
  cb === null || cb === void 0 || cb(result);
2472
2501
  return _context22.abrupt("return", result);
2473
- case 31:
2502
+ case 30:
2474
2503
  case "end":
2475
2504
  return _context22.stop();
2476
2505
  }
@@ -2639,7 +2668,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2639
2668
  case 13:
2640
2669
  if (rulesModule) {
2641
2670
  orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
2642
- console.log('[BaseSales.setDiscountSelected.calcDiscount]');
2643
2671
  result = rulesModule.calcDiscount({
2644
2672
  productList: tempOrder.products,
2645
2673
  discountList: updated,
@@ -1,4 +1,9 @@
1
1
  import type { OrderProduct } from '../../../modules/Order/types';
2
+ /**
3
+ * 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
4
+ * `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
5
+ */
6
+ export declare const PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = "_productLineMergeDisabled";
2
7
  /**
3
8
  * Cart promotion 工具集(OS 内部纯函数)
4
9
  *
@@ -23,6 +23,12 @@ import { cloneDeep } from 'lodash-es';
23
23
  import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
24
24
  import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/utils";
25
25
 
26
+ /**
27
+ * 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
28
+ * `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
29
+ */
30
+ export var PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = '_productLineMergeDisabled';
31
+
26
32
  /**
27
33
  * Cart promotion 工具集(OS 内部纯函数)
28
34
  *
@@ -483,10 +489,13 @@ function hasGoodPassDiscount(product) {
483
489
  }
484
490
 
485
491
  /**
486
- * 商品券、自定义商品、称重行以及编辑订单历史行都有各自的促销合并边界。
492
+ * 不合并商品、商品券、自定义商品、称重行以及编辑订单历史行都有各自的促销合并边界。
487
493
  */
488
494
  function getPromotionLineMergeBoundary(product) {
489
- var _product$product_sku, _product$metadata3;
495
+ var _product$metadata3, _product$product_sku, _product$metadata4;
496
+ if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3[PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY]) === true) {
497
+ return "separate:".concat(getOrderProductUid(product));
498
+ }
490
499
  if ((product === null || product === void 0 ? void 0 : product.product_id) === undefined || (product === null || product === void 0 ? void 0 : product.product_id) === null) {
491
500
  return "custom:".concat(getOrderProductUid(product));
492
501
  }
@@ -496,7 +505,7 @@ function getPromotionLineMergeBoundary(product) {
496
505
  if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
497
506
  return "weighing:".concat(getOrderProductUid(product));
498
507
  }
499
- if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.is_edit_for_runtime) !== true) return '';
508
+ if ((product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.is_edit_for_runtime) !== true) return '';
500
509
  return "edit:".concat(getOrderProductUid(product));
501
510
  }
502
511
  function isPersistedGeneratedVoucher(product) {
@@ -921,13 +930,13 @@ export function resolveStrategyEligibleProducts(matched) {
921
930
  export function calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts) {
922
931
  var unfulfilledMap = new Map();
923
932
  var _loop2 = function _loop2() {
924
- var _product$metadata4, _ref13, _product$_originalPro, _product$metadata5, _product$num2;
933
+ var _product$metadata5, _ref13, _product$_originalPro, _product$metadata6, _product$num2;
925
934
  var product = processedProducts[i];
926
- var promotion = product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4._promotion;
935
+ var promotion = product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5._promotion;
927
936
  if (!promotion || promotion.inPromotion !== false) return 0; // continue
928
937
  var strategyId = promotion.strategyId;
929
938
  if (!strategyId) return 0; // continue
930
- var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
939
+ var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
931
940
  var originalIndex = mainProducts.findIndex(function (item) {
932
941
  return getOrderProductUid(item) === lookupUid;
933
942
  });