@pisell/pisellos 2.2.172 → 2.2.173

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.
@@ -277,7 +277,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
277
277
  value: (function () {
278
278
  var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
279
279
  var _this$otherParams;
280
- var channel, quotation;
280
+ var channel, quotation, scheduleCache, hasLoadedScheduleList;
281
281
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
282
282
  while (1) switch (_context3.prev = _context3.next) {
283
283
  case 0:
@@ -301,15 +301,32 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
301
301
  this.quotationPriceBridge = quotation;
302
302
  case 10:
303
303
  if (params.scheduleModule) {
304
+ scheduleCache = new Map();
305
+ hasLoadedScheduleList = false;
304
306
  this.quotationPriceBridge.setScheduleResolver(function (id) {
305
- var _params$scheduleModul, _params$scheduleModul2, _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
307
+ var _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
306
308
  var scheduleId = String(id);
307
- var scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
308
- var schedule = scheduleList.find(function (item) {
309
- return String(item.id) === scheduleId;
310
- });
311
- if (schedule) return schedule;
309
+ if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
310
+ if (!hasLoadedScheduleList) {
311
+ var _params$scheduleModul, _params$scheduleModul2;
312
+ var scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
313
+ var _iterator = _createForOfIteratorHelper(scheduleList),
314
+ _step;
315
+ try {
316
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
317
+ var schedule = _step.value;
318
+ scheduleCache.set(String(schedule.id), schedule);
319
+ }
320
+ } catch (err) {
321
+ _iterator.e(err);
322
+ } finally {
323
+ _iterator.f();
324
+ }
325
+ hasLoadedScheduleList = true;
326
+ }
327
+ if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
312
328
  var schedules = ((_params$scheduleModul3 = (_params$scheduleModul4 = params.scheduleModule).getScheduleListByIds) === null || _params$scheduleModul3 === void 0 ? void 0 : _params$scheduleModul3.call(_params$scheduleModul4, [id])) || ((_params$scheduleModul5 = (_params$scheduleModul6 = params.scheduleModule).getScheduleByIds) === null || _params$scheduleModul5 === void 0 ? void 0 : _params$scheduleModul5.call(_params$scheduleModul6, [id])) || [];
329
+ if (schedules[0]) scheduleCache.set(scheduleId, schedules[0]);
313
330
  return schedules[0];
314
331
  });
315
332
  }
@@ -442,17 +459,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
442
459
  }, {
443
460
  key: "buildPriceDataFromQuotation",
444
461
  value: function buildPriceDataFromQuotation(product, datetime, customerId) {
445
- var _this$quotationPriceB, _ref2, _product$base_price;
462
+ var _this$quotationPriceB, _ref2, _ref3;
446
463
  var quotedPrice = (_this$quotationPriceB = this.quotationPriceBridge) === null || _this$quotationPriceB === void 0 ? void 0 : _this$quotationPriceB.getPriceForProduct({
447
464
  productId: product.id,
448
465
  datetime: datetime,
449
466
  customer_id: customerId
450
467
  });
451
468
  var productPrice = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.price;
469
+ var productBasePrice = (_ref2 = (_ref3 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.base_price) !== null && _ref3 !== void 0 ? _ref3 : product.price) !== null && _ref2 !== void 0 ? _ref2 : 0;
452
470
  return {
453
471
  id: product.id,
454
472
  price: String(productPrice !== null && productPrice !== void 0 ? productPrice : 0),
455
- base_price: String((_ref2 = (_product$base_price = product.base_price) !== null && _product$base_price !== void 0 ? _product$base_price : product.price) !== null && _ref2 !== void 0 ? _ref2 : 0),
473
+ base_price: String(productBasePrice),
456
474
  variant: this.buildVariantPriceData(product, datetime, customerId),
457
475
  bundle_group: this.buildBundleGroupPriceData(product, datetime, customerId)
458
476
  };
@@ -463,15 +481,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
463
481
  var _this4 = this;
464
482
  if (!Array.isArray(product.variant)) return [];
465
483
  return product.variant.map(function (variant) {
466
- var _this4$quotationPrice, _ref3, _ref4, _ref5, _ref6, _ref7, _variant$base_price, _variant$product_id;
484
+ var _this4$quotationPrice, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _variant$product_id;
467
485
  var quotedPrice = (_this4$quotationPrice = _this4.quotationPriceBridge) === null || _this4$quotationPrice === void 0 ? void 0 : _this4$quotationPrice.getPriceForProduct({
468
486
  productId: product.id,
469
487
  variantId: Number(variant.id),
470
488
  datetime: datetime,
471
489
  customer_id: customerId
472
490
  });
473
- var price = (_ref3 = (_ref4 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.price) !== null && _ref4 !== void 0 ? _ref4 : product.price) !== null && _ref3 !== void 0 ? _ref3 : 0;
474
- var basePrice = (_ref5 = (_ref6 = (_ref7 = (_variant$base_price = variant.base_price) !== null && _variant$base_price !== void 0 ? _variant$base_price : variant.price) !== null && _ref7 !== void 0 ? _ref7 : product.base_price) !== null && _ref6 !== void 0 ? _ref6 : product.price) !== null && _ref5 !== void 0 ? _ref5 : 0;
491
+ var price = (_ref4 = (_ref5 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.price) !== null && _ref5 !== void 0 ? _ref5 : product.price) !== null && _ref4 !== void 0 ? _ref4 : 0;
492
+ var basePrice = (_ref6 = (_ref7 = (_ref8 = (_ref9 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.base_price) !== null && _ref9 !== void 0 ? _ref9 : variant.price) !== null && _ref8 !== void 0 ? _ref8 : product.base_price) !== null && _ref7 !== void 0 ? _ref7 : product.price) !== null && _ref6 !== void 0 ? _ref6 : 0;
475
493
  return {
476
494
  id: Number(variant.id),
477
495
  product_id: Number((_variant$product_id = variant.product_id) !== null && _variant$product_id !== void 0 ? _variant$product_id : product.id),
@@ -489,7 +507,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
489
507
  return {
490
508
  id: Number(group.id),
491
509
  bundle_item: (group.bundle_item || []).map(function (item) {
492
- var _this5$quotationPrice, _ref8, _ref9, _item$base_price, _item$product_id, _item$group_id;
510
+ var _this5$quotationPrice, _ref10, _ref11, _ref12, _item$product_id, _item$group_id;
493
511
  var bundleProductId = Number(item.bundle_product_id);
494
512
  var bundleVariantId = Number(item.bundle_variant_id || 0);
495
513
  var quotedPrice = (_this5$quotationPrice = _this5.quotationPriceBridge) === null || _this5$quotationPrice === void 0 ? void 0 : _this5$quotationPrice.getPriceForProduct({
@@ -498,8 +516,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
498
516
  datetime: datetime,
499
517
  customer_id: customerId
500
518
  });
501
- var price = (_ref8 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref8 !== void 0 ? _ref8 : 0;
502
- var basePrice = (_ref9 = (_item$base_price = item.base_price) !== null && _item$base_price !== void 0 ? _item$base_price : item.price) !== null && _ref9 !== void 0 ? _ref9 : 0;
519
+ var price = (_ref10 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0;
520
+ var basePrice = (_ref11 = (_ref12 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.base_price) !== null && _ref12 !== void 0 ? _ref12 : item.price) !== null && _ref11 !== void 0 ? _ref11 : 0;
503
521
  return {
504
522
  id: Number(item.id),
505
523
  product_id: Number((_item$product_id = item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : product.id),
@@ -532,7 +550,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
532
550
  value: (function () {
533
551
  var _getProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(schedule_date, extraContext, options) {
534
552
  var _options$changedIds;
535
- var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator, _step, p, _iterator2, _step2, _p, errorMessage, result;
553
+ var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator2, _step2, p, _iterator3, _step3, _p, errorMessage, result;
536
554
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
537
555
  while (1) switch (_context6.prev = _context6.next) {
538
556
  case 0:
@@ -573,10 +591,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
573
591
  return [p.id, p];
574
592
  }));
575
593
  mergedCache = [];
576
- _iterator = _createForOfIteratorHelper(cachedProducts);
594
+ _iterator2 = _createForOfIteratorHelper(cachedProducts);
577
595
  try {
578
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
579
- p = _step.value;
596
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
597
+ p = _step2.value;
580
598
  if (updatedMap.has(p.id)) {
581
599
  mergedCache.push(updatedMap.get(p.id));
582
600
  updatedMap.delete(p.id);
@@ -586,20 +604,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
586
604
  }
587
605
  // 剩余的是新增商品(create 场景)
588
606
  } catch (err) {
589
- _iterator.e(err);
607
+ _iterator2.e(err);
590
608
  } finally {
591
- _iterator.f();
609
+ _iterator2.f();
592
610
  }
593
- _iterator2 = _createForOfIteratorHelper(updatedMap.values());
611
+ _iterator3 = _createForOfIteratorHelper(updatedMap.values());
594
612
  try {
595
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
596
- _p = _step2.value;
613
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
614
+ _p = _step3.value;
597
615
  mergedCache.push(_p);
598
616
  }
599
617
  } catch (err) {
600
- _iterator2.e(err);
618
+ _iterator3.e(err);
601
619
  } finally {
602
- _iterator2.f();
620
+ _iterator3.f();
603
621
  }
604
622
  this.productsPriceCache.set(cacheKey, mergedCache);
605
623
  this.logInfo('增量更新完成', {
@@ -834,25 +852,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
834
852
  }
835
853
  if (productIds.length === 0 && collectionIds.length === 0) return [];
836
854
  var result = new Set();
837
- var _iterator3 = _createForOfIteratorHelper(productIds),
838
- _step3;
855
+ var _iterator4 = _createForOfIteratorHelper(productIds),
856
+ _step4;
839
857
  try {
840
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
841
- var id = _step3.value;
858
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
859
+ var id = _step4.value;
842
860
  if (this.store.map.has(id)) result.add(id);
843
861
  }
844
862
  } catch (err) {
845
- _iterator3.e(err);
863
+ _iterator4.e(err);
846
864
  } finally {
847
- _iterator3.f();
865
+ _iterator4.f();
848
866
  }
849
867
  if (collectionIds.length === 0) return Array.from(result);
850
868
  var collectionIdSet = new Set(collectionIds);
851
- var _iterator4 = _createForOfIteratorHelper(this.getProductsRef()),
852
- _step4;
869
+ var _iterator5 = _createForOfIteratorHelper(this.getProductsRef()),
870
+ _step5;
853
871
  try {
854
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
855
- var product = _step4.value;
872
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
873
+ var product = _step5.value;
856
874
  if (result.has(product.id)) continue;
857
875
  if (!Array.isArray(product.collection)) continue;
858
876
  var isInCollection = product.collection.some(function (collection) {
@@ -861,9 +879,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
861
879
  if (isInCollection) result.add(product.id);
862
880
  }
863
881
  } catch (err) {
864
- _iterator4.e(err);
882
+ _iterator5.e(err);
865
883
  } finally {
866
- _iterator4.f();
884
+ _iterator5.f();
867
885
  }
868
886
  return Array.from(result);
869
887
  }
@@ -1142,11 +1160,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1142
1160
  key: "fetchProductsByHttp",
1143
1161
  value: (function () {
1144
1162
  var _fetchProductsByHttp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
1145
- var _ref10, _ref10$category_ids, category_ids, _ref10$product_ids, product_ids, _ref10$collection, collection, customer_id, cacheId, startTime, _this$otherParams3, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
1163
+ var _ref13, _ref13$category_ids, category_ids, _ref13$product_ids, product_ids, _ref13$collection, collection, customer_id, cacheId, startTime, _this$otherParams3, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
1146
1164
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1147
1165
  while (1) switch (_context10.prev = _context10.next) {
1148
1166
  case 0:
1149
- _ref10 = params || {}, _ref10$category_ids = _ref10.category_ids, category_ids = _ref10$category_ids === void 0 ? [] : _ref10$category_ids, _ref10$product_ids = _ref10.product_ids, product_ids = _ref10$product_ids === void 0 ? [] : _ref10$product_ids, _ref10$collection = _ref10.collection, collection = _ref10$collection === void 0 ? [] : _ref10$collection, customer_id = _ref10.customer_id, cacheId = _ref10.cacheId;
1167
+ _ref13 = params || {}, _ref13$category_ids = _ref13.category_ids, category_ids = _ref13$category_ids === void 0 ? [] : _ref13$category_ids, _ref13$product_ids = _ref13.product_ids, product_ids = _ref13$product_ids === void 0 ? [] : _ref13$product_ids, _ref13$collection = _ref13.collection, collection = _ref13$collection === void 0 ? [] : _ref13$collection, customer_id = _ref13.customer_id, cacheId = _ref13.cacheId;
1150
1168
  this.logInfo('fetchProductsByHttp: 开始请求', {
1151
1169
  categoryIdsCount: category_ids.length,
1152
1170
  productIdsCount: product_ids.length,
@@ -1294,18 +1312,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1294
1312
  key: "getProductsRefByIds",
1295
1313
  value: function getProductsRefByIds(ids) {
1296
1314
  var products = [];
1297
- var _iterator5 = _createForOfIteratorHelper(ids),
1298
- _step5;
1315
+ var _iterator6 = _createForOfIteratorHelper(ids),
1316
+ _step6;
1299
1317
  try {
1300
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1301
- var id = _step5.value;
1318
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1319
+ var id = _step6.value;
1302
1320
  var product = this.store.map.get(id);
1303
1321
  if (product) products.push(product);
1304
1322
  }
1305
1323
  } catch (err) {
1306
- _iterator5.e(err);
1324
+ _iterator6.e(err);
1307
1325
  } finally {
1308
- _iterator5.f();
1326
+ _iterator6.f();
1309
1327
  }
1310
1328
  return products;
1311
1329
  }
@@ -1344,7 +1362,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1344
1362
  key: "removeProductsByIds",
1345
1363
  value: (function () {
1346
1364
  var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(ids) {
1347
- var idSet, _iterator6, _step6, _id, _iterator7, _step7, id, errorMessage, _iterator8, _step8, _step8$value, dateKey, cachedProducts;
1365
+ var idSet, _iterator7, _step7, _id, _iterator8, _step8, id, errorMessage, _iterator9, _step9, _step9$value, dateKey, cachedProducts;
1348
1366
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1349
1367
  while (1) switch (_context14.prev = _context14.next) {
1350
1368
  case 0:
@@ -1356,31 +1374,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1356
1374
  this.store.list = this.store.list.filter(function (p) {
1357
1375
  return !idSet.has(p.id);
1358
1376
  });
1359
- _iterator6 = _createForOfIteratorHelper(ids);
1377
+ _iterator7 = _createForOfIteratorHelper(ids);
1360
1378
  try {
1361
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1362
- _id = _step6.value;
1379
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1380
+ _id = _step7.value;
1363
1381
  this.store.map.delete(_id);
1364
1382
  }
1365
1383
  } catch (err) {
1366
- _iterator6.e(err);
1384
+ _iterator7.e(err);
1367
1385
  } finally {
1368
- _iterator6.f();
1386
+ _iterator7.f();
1369
1387
  }
1370
1388
  if (!this.dbManager) {
1371
1389
  _context14.next = 30;
1372
1390
  break;
1373
1391
  }
1374
1392
  _context14.prev = 6;
1375
- _iterator7 = _createForOfIteratorHelper(ids);
1393
+ _iterator8 = _createForOfIteratorHelper(ids);
1376
1394
  _context14.prev = 8;
1377
- _iterator7.s();
1395
+ _iterator8.s();
1378
1396
  case 10:
1379
- if ((_step7 = _iterator7.n()).done) {
1397
+ if ((_step8 = _iterator8.n()).done) {
1380
1398
  _context14.next = 16;
1381
1399
  break;
1382
1400
  }
1383
- id = _step7.value;
1401
+ id = _step8.value;
1384
1402
  _context14.next = 14;
1385
1403
  return this.dbManager.delete(INDEXDB_STORE_NAME, id);
1386
1404
  case 14:
@@ -1392,10 +1410,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1392
1410
  case 18:
1393
1411
  _context14.prev = 18;
1394
1412
  _context14.t0 = _context14["catch"](8);
1395
- _iterator7.e(_context14.t0);
1413
+ _iterator8.e(_context14.t0);
1396
1414
  case 21:
1397
1415
  _context14.prev = 21;
1398
- _iterator7.f();
1416
+ _iterator8.f();
1399
1417
  return _context14.finish(21);
1400
1418
  case 24:
1401
1419
  _context14.next = 30;
@@ -1409,18 +1427,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1409
1427
  error: errorMessage
1410
1428
  });
1411
1429
  case 30:
1412
- _iterator8 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1430
+ _iterator9 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1413
1431
  try {
1414
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1415
- _step8$value = _slicedToArray(_step8.value, 2), dateKey = _step8$value[0], cachedProducts = _step8$value[1];
1432
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1433
+ _step9$value = _slicedToArray(_step9.value, 2), dateKey = _step9$value[0], cachedProducts = _step9$value[1];
1416
1434
  this.productsPriceCache.set(dateKey, cachedProducts.filter(function (p) {
1417
1435
  return !idSet.has(p.id);
1418
1436
  }));
1419
1437
  }
1420
1438
  } catch (err) {
1421
- _iterator8.e(err);
1439
+ _iterator9.e(err);
1422
1440
  } finally {
1423
- _iterator8.f();
1441
+ _iterator9.f();
1424
1442
  }
1425
1443
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
1426
1444
  this.logInfo('removeProductsByIds 完成', {
@@ -1660,17 +1678,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1660
1678
  value: function syncProductsMap() {
1661
1679
  var t0 = performance.now();
1662
1680
  this.store.map.clear();
1663
- var _iterator9 = _createForOfIteratorHelper(this.store.list),
1664
- _step9;
1681
+ var _iterator10 = _createForOfIteratorHelper(this.store.list),
1682
+ _step10;
1665
1683
  try {
1666
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1667
- var product = _step9.value;
1684
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1685
+ var product = _step10.value;
1668
1686
  this.store.map.set(product.id, product);
1669
1687
  }
1670
1688
  } catch (err) {
1671
- _iterator9.e(err);
1689
+ _iterator10.e(err);
1672
1690
  } finally {
1673
- _iterator9.f();
1691
+ _iterator10.f();
1674
1692
  }
1675
1693
  perfMark('syncProductsMap', performance.now() - t0, {
1676
1694
  count: this.store.map.size
@@ -1882,7 +1900,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1882
1900
  key: "processProductSyncMessages",
1883
1901
  value: (function () {
1884
1902
  var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1885
- var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator10, _step10, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, allChangedIds, hasChanges, errorMessage;
1903
+ var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator11, _step11, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, allChangedIds, hasChanges, errorMessage;
1886
1904
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1887
1905
  while (1) switch (_context20.prev = _context20.next) {
1888
1906
  case 0:
@@ -1902,15 +1920,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1902
1920
  sseRefreshIds = [];
1903
1921
  priceRefreshIds = [];
1904
1922
  shouldClearPriceCache = false;
1905
- _iterator10 = _createForOfIteratorHelper(messages);
1923
+ _iterator11 = _createForOfIteratorHelper(messages);
1906
1924
  _context20.prev = 11;
1907
- _iterator10.s();
1925
+ _iterator11.s();
1908
1926
  case 13:
1909
- if ((_step10 = _iterator10.n()).done) {
1927
+ if ((_step11 = _iterator11.n()).done) {
1910
1928
  _context20.next = 36;
1911
1929
  break;
1912
1930
  }
1913
- msg = _step10.value;
1931
+ msg = _step11.value;
1914
1932
  channelKey = msg._channelKey || msg.module || 'product';
1915
1933
  if (!(channelKey === 'product')) {
1916
1934
  _context20.next = 33;
@@ -1976,10 +1994,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1976
1994
  case 38:
1977
1995
  _context20.prev = 38;
1978
1996
  _context20.t0 = _context20["catch"](11);
1979
- _iterator10.e(_context20.t0);
1997
+ _iterator11.e(_context20.t0);
1980
1998
  case 41:
1981
1999
  _context20.prev = 41;
1982
- _iterator10.f();
2000
+ _iterator11.f();
1983
2001
  return _context20.finish(41);
1984
2002
  case 44:
1985
2003
  uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
@@ -2150,7 +2168,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2150
2168
  key: "applyBodyUpdatesToStore",
2151
2169
  value: (function () {
2152
2170
  var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(bodyUpdates) {
2153
- var updatedCount, newCount, appliedIds, _iterator11, _step11, _step11$value, id, body;
2171
+ var updatedCount, newCount, appliedIds, _iterator12, _step12, _step12$value, id, body;
2154
2172
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2155
2173
  while (1) switch (_context22.prev = _context22.next) {
2156
2174
  case 0:
@@ -2168,19 +2186,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2168
2186
  }
2169
2187
  return p;
2170
2188
  });
2171
- _iterator11 = _createForOfIteratorHelper(bodyUpdates);
2189
+ _iterator12 = _createForOfIteratorHelper(bodyUpdates);
2172
2190
  try {
2173
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
2174
- _step11$value = _slicedToArray(_step11.value, 2), id = _step11$value[0], body = _step11$value[1];
2191
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2192
+ _step12$value = _slicedToArray(_step12.value, 2), id = _step12$value[0], body = _step12$value[1];
2175
2193
  if (!appliedIds.has(id)) {
2176
2194
  this.store.list.push(body);
2177
2195
  newCount++;
2178
2196
  }
2179
2197
  }
2180
2198
  } catch (err) {
2181
- _iterator11.e(err);
2199
+ _iterator12.e(err);
2182
2200
  } finally {
2183
- _iterator11.f();
2201
+ _iterator12.f();
2184
2202
  }
2185
2203
  this.syncProductsMap();
2186
2204
  _context22.next = 10;
@@ -2213,21 +2231,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2213
2231
  key: "mergeProductsToStore",
2214
2232
  value: (function () {
2215
2233
  var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(freshProducts) {
2216
- var freshMap, _iterator12, _step12, p, updatedList, newCount, _iterator13, _step13, _p2, updatedCount;
2234
+ var freshMap, _iterator13, _step13, p, updatedList, newCount, _iterator14, _step14, _p2, updatedCount;
2217
2235
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2218
2236
  while (1) switch (_context23.prev = _context23.next) {
2219
2237
  case 0:
2220
2238
  freshMap = new Map();
2221
- _iterator12 = _createForOfIteratorHelper(freshProducts);
2239
+ _iterator13 = _createForOfIteratorHelper(freshProducts);
2222
2240
  try {
2223
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2224
- p = _step12.value;
2241
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2242
+ p = _step13.value;
2225
2243
  freshMap.set(p.id, p);
2226
2244
  }
2227
2245
  } catch (err) {
2228
- _iterator12.e(err);
2246
+ _iterator13.e(err);
2229
2247
  } finally {
2230
- _iterator12.f();
2248
+ _iterator13.f();
2231
2249
  }
2232
2250
  updatedList = this.store.list.map(function (p) {
2233
2251
  if (freshMap.has(p.id)) {
@@ -2238,16 +2256,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2238
2256
  return p;
2239
2257
  }); // freshMap 中剩余的是新商品(create 场景)
2240
2258
  newCount = freshMap.size;
2241
- _iterator13 = _createForOfIteratorHelper(freshMap.values());
2259
+ _iterator14 = _createForOfIteratorHelper(freshMap.values());
2242
2260
  try {
2243
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2244
- _p2 = _step13.value;
2261
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2262
+ _p2 = _step14.value;
2245
2263
  updatedList.push(_p2);
2246
2264
  }
2247
2265
  } catch (err) {
2248
- _iterator13.e(err);
2266
+ _iterator14.e(err);
2249
2267
  } finally {
2250
- _iterator13.f();
2268
+ _iterator14.f();
2251
2269
  }
2252
2270
  updatedCount = freshProducts.length - newCount;
2253
2271
  this.store.list = updatedList;
@@ -39,6 +39,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
39
39
  window: WindowPlugin;
40
40
  request: RequestPlugin;
41
41
  protected currentSalesDetail: ISalesDetail | null;
42
+ protected discountConfigCacheKey: string | null;
43
+ protected hasManualDiscountSelection: boolean;
42
44
  constructor(name?: string, version?: string);
43
45
  /**
44
46
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
@@ -113,23 +115,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
113
115
  updateRemoteOrderNote(orderId: number | string, note: string): void;
114
116
  updateTempOrderShopDiscount(amount: string | number): string;
115
117
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
116
- /**
117
- * 运行时切换 tempOrder 是否写入 localStorage(委托 OrderModule)。
118
- * SalesSdk 等内存态场景可在挂载后设为 false,避免污染本地缓存。
119
- *
120
- * @example
121
- * bookingTicket.setEnableTempOrderPersist(false);
122
- * await bookingTicket.addProductToOrder(product);
123
- */
118
+ /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
124
119
  setEnableTempOrderPersist(enabled: boolean): void;
125
- /**
126
- * 读取当前 tempOrder localStorage 持久化开关(委托 OrderModule)。
127
- *
128
- * @example
129
- * if (bookingTicket.isTempOrderPersistEnabled()) {
130
- * bookingTicket.restoreOrder();
131
- * }
132
- */
120
+ /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
133
121
  isTempOrderPersistEnabled(): boolean;
134
122
  private ensureTempOrder;
135
123
  addNewOrder(): Promise<OrderTempOrder>;