@pisell/pisellos 2.3.19 → 2.3.21

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 (35) hide show
  1. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -10
  2. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Order/index.js +48 -31
  5. package/dist/modules/Order/types.d.ts +1 -0
  6. package/dist/modules/Order/utils.js +10 -2
  7. package/dist/modules/Product/index.d.ts +1 -1
  8. package/dist/server/index.d.ts +4 -0
  9. package/dist/server/index.js +392 -253
  10. package/dist/server/modules/order/types.d.ts +2 -0
  11. package/dist/server/modules/products/index.d.ts +5 -1
  12. package/dist/server/modules/products/index.js +383 -315
  13. package/dist/server/modules/products/types.d.ts +4 -0
  14. package/dist/solution/BaseSales/index.js +144 -127
  15. package/dist/solution/BaseSales/types.d.ts +2 -0
  16. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -1
  17. package/dist/solution/BookingByStep/index.d.ts +1 -1
  18. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -0
  19. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
  20. package/lib/modules/Order/index.d.ts +1 -1
  21. package/lib/modules/Order/index.js +34 -12
  22. package/lib/modules/Order/types.d.ts +1 -0
  23. package/lib/modules/Order/utils.js +10 -1
  24. package/lib/modules/Product/index.d.ts +1 -1
  25. package/lib/server/index.d.ts +4 -0
  26. package/lib/server/index.js +83 -2
  27. package/lib/server/modules/order/types.d.ts +2 -0
  28. package/lib/server/modules/products/index.d.ts +5 -1
  29. package/lib/server/modules/products/index.js +20 -0
  30. package/lib/server/modules/products/types.d.ts +4 -0
  31. package/lib/solution/BaseSales/index.js +40 -22
  32. package/lib/solution/BaseSales/types.d.ts +2 -0
  33. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +2 -0
  34. package/lib/solution/BookingByStep/index.d.ts +1 -1
  35. package/package.json +1 -1
@@ -1332,6 +1332,74 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1332
1332
  }
1333
1333
  return getProducts;
1334
1334
  }()
1335
+ /**
1336
+ * 批量获取商品轻量快照,供订单详情等响应补齐展示协议字段。
1337
+ */
1338
+ )
1339
+ }, {
1340
+ key: "getProductSnapshotsByIds",
1341
+ value: (function () {
1342
+ var _getProductSnapshotsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(ids) {
1343
+ var snapshots, seen, _iterator6, _step6, id, product;
1344
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1345
+ while (1) switch (_context13.prev = _context13.next) {
1346
+ case 0:
1347
+ snapshots = {};
1348
+ seen = new Set();
1349
+ _iterator6 = _createForOfIteratorHelper(ids);
1350
+ _context13.prev = 3;
1351
+ _iterator6.s();
1352
+ case 5:
1353
+ if ((_step6 = _iterator6.n()).done) {
1354
+ _context13.next = 16;
1355
+ break;
1356
+ }
1357
+ id = _step6.value;
1358
+ if (!(!Number.isFinite(id) || seen.has(id))) {
1359
+ _context13.next = 9;
1360
+ break;
1361
+ }
1362
+ return _context13.abrupt("continue", 14);
1363
+ case 9:
1364
+ seen.add(id);
1365
+ product = this.store.map.get(id);
1366
+ if (product) {
1367
+ _context13.next = 13;
1368
+ break;
1369
+ }
1370
+ return _context13.abrupt("continue", 14);
1371
+ case 13:
1372
+ snapshots[String(id)] = {
1373
+ cover: product.cover,
1374
+ holder_config: product.holder_config
1375
+ };
1376
+ case 14:
1377
+ _context13.next = 5;
1378
+ break;
1379
+ case 16:
1380
+ _context13.next = 21;
1381
+ break;
1382
+ case 18:
1383
+ _context13.prev = 18;
1384
+ _context13.t0 = _context13["catch"](3);
1385
+ _iterator6.e(_context13.t0);
1386
+ case 21:
1387
+ _context13.prev = 21;
1388
+ _iterator6.f();
1389
+ return _context13.finish(21);
1390
+ case 24:
1391
+ return _context13.abrupt("return", snapshots);
1392
+ case 25:
1393
+ case "end":
1394
+ return _context13.stop();
1395
+ }
1396
+ }, _callee13, this, [[3, 18, 21, 24]]);
1397
+ }));
1398
+ function getProductSnapshotsByIds(_x17) {
1399
+ return _getProductSnapshotsByIds.apply(this, arguments);
1400
+ }
1401
+ return getProductSnapshotsByIds;
1402
+ }()
1335
1403
  /**
1336
1404
  * 内部获取商品列表的直接引用(无拷贝)
1337
1405
  * 仅供内部 formatter 流程使用,因为 formatter 会创建新对象
@@ -1350,18 +1418,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1350
1418
  key: "getProductsRefByIds",
1351
1419
  value: function getProductsRefByIds(ids) {
1352
1420
  var products = [];
1353
- var _iterator6 = _createForOfIteratorHelper(ids),
1354
- _step6;
1421
+ var _iterator7 = _createForOfIteratorHelper(ids),
1422
+ _step7;
1355
1423
  try {
1356
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1357
- var id = _step6.value;
1424
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1425
+ var id = _step7.value;
1358
1426
  var product = this.store.map.get(id);
1359
1427
  if (product) products.push(product);
1360
1428
  }
1361
1429
  } catch (err) {
1362
- _iterator6.e(err);
1430
+ _iterator7.e(err);
1363
1431
  } finally {
1364
- _iterator6.f();
1432
+ _iterator7.f();
1365
1433
  }
1366
1434
  return products;
1367
1435
  }
@@ -1373,20 +1441,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1373
1441
  }, {
1374
1442
  key: "getProductById",
1375
1443
  value: (function () {
1376
- var _getProductById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(id) {
1444
+ var _getProductById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(id) {
1377
1445
  var product;
1378
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1379
- while (1) switch (_context13.prev = _context13.next) {
1446
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1447
+ while (1) switch (_context14.prev = _context14.next) {
1380
1448
  case 0:
1381
1449
  product = this.store.map.get(id);
1382
- return _context13.abrupt("return", product ? structuredClone(product) : undefined);
1450
+ return _context14.abrupt("return", product ? structuredClone(product) : undefined);
1383
1451
  case 2:
1384
1452
  case "end":
1385
- return _context13.stop();
1453
+ return _context14.stop();
1386
1454
  }
1387
- }, _callee13, this);
1455
+ }, _callee14, this);
1388
1456
  }));
1389
- function getProductById(_x17) {
1457
+ function getProductById(_x18) {
1390
1458
  return _getProductById.apply(this, arguments);
1391
1459
  }
1392
1460
  return getProductById;
@@ -1399,10 +1467,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1399
1467
  }, {
1400
1468
  key: "removeProductsByIds",
1401
1469
  value: (function () {
1402
- var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(ids) {
1403
- var idSet, _iterator7, _step7, _id, _iterator8, _step8, id, errorMessage, _iterator9, _step9, _step9$value, dateKey, cachedProducts;
1404
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1405
- while (1) switch (_context14.prev = _context14.next) {
1470
+ var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(ids) {
1471
+ var idSet, _iterator8, _step8, _id, _iterator9, _step9, id, errorMessage, _iterator10, _step10, _step10$value, dateKey, cachedProducts;
1472
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1473
+ while (1) switch (_context15.prev = _context15.next) {
1406
1474
  case 0:
1407
1475
  idSet = new Set(ids);
1408
1476
  this.logInfo('removeProductsByIds', {
@@ -1412,71 +1480,71 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1412
1480
  this.store.list = this.store.list.filter(function (p) {
1413
1481
  return !idSet.has(p.id);
1414
1482
  });
1415
- _iterator7 = _createForOfIteratorHelper(ids);
1483
+ _iterator8 = _createForOfIteratorHelper(ids);
1416
1484
  try {
1417
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1418
- _id = _step7.value;
1485
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1486
+ _id = _step8.value;
1419
1487
  this.store.map.delete(_id);
1420
1488
  }
1421
1489
  } catch (err) {
1422
- _iterator7.e(err);
1490
+ _iterator8.e(err);
1423
1491
  } finally {
1424
- _iterator7.f();
1492
+ _iterator8.f();
1425
1493
  }
1426
1494
  if (!this.dbManager) {
1427
- _context14.next = 30;
1495
+ _context15.next = 30;
1428
1496
  break;
1429
1497
  }
1430
- _context14.prev = 6;
1431
- _iterator8 = _createForOfIteratorHelper(ids);
1432
- _context14.prev = 8;
1433
- _iterator8.s();
1498
+ _context15.prev = 6;
1499
+ _iterator9 = _createForOfIteratorHelper(ids);
1500
+ _context15.prev = 8;
1501
+ _iterator9.s();
1434
1502
  case 10:
1435
- if ((_step8 = _iterator8.n()).done) {
1436
- _context14.next = 16;
1503
+ if ((_step9 = _iterator9.n()).done) {
1504
+ _context15.next = 16;
1437
1505
  break;
1438
1506
  }
1439
- id = _step8.value;
1440
- _context14.next = 14;
1507
+ id = _step9.value;
1508
+ _context15.next = 14;
1441
1509
  return this.dbManager.delete(INDEXDB_STORE_NAME, id);
1442
1510
  case 14:
1443
- _context14.next = 10;
1511
+ _context15.next = 10;
1444
1512
  break;
1445
1513
  case 16:
1446
- _context14.next = 21;
1514
+ _context15.next = 21;
1447
1515
  break;
1448
1516
  case 18:
1449
- _context14.prev = 18;
1450
- _context14.t0 = _context14["catch"](8);
1451
- _iterator8.e(_context14.t0);
1517
+ _context15.prev = 18;
1518
+ _context15.t0 = _context15["catch"](8);
1519
+ _iterator9.e(_context15.t0);
1452
1520
  case 21:
1453
- _context14.prev = 21;
1454
- _iterator8.f();
1455
- return _context14.finish(21);
1521
+ _context15.prev = 21;
1522
+ _iterator9.f();
1523
+ return _context15.finish(21);
1456
1524
  case 24:
1457
- _context14.next = 30;
1525
+ _context15.next = 30;
1458
1526
  break;
1459
1527
  case 26:
1460
- _context14.prev = 26;
1461
- _context14.t1 = _context14["catch"](6);
1462
- errorMessage = _context14.t1 instanceof Error ? _context14.t1.message : String(_context14.t1);
1528
+ _context15.prev = 26;
1529
+ _context15.t1 = _context15["catch"](6);
1530
+ errorMessage = _context15.t1 instanceof Error ? _context15.t1.message : String(_context15.t1);
1463
1531
  this.logError('removeProductsByIds: IndexDB 删除失败', {
1464
1532
  ids: ids,
1465
1533
  error: errorMessage
1466
1534
  });
1467
1535
  case 30:
1468
- _iterator9 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1536
+ _iterator10 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1469
1537
  try {
1470
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1471
- _step9$value = _slicedToArray(_step9.value, 2), dateKey = _step9$value[0], cachedProducts = _step9$value[1];
1538
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1539
+ _step10$value = _slicedToArray(_step10.value, 2), dateKey = _step10$value[0], cachedProducts = _step10$value[1];
1472
1540
  this.productsPriceCache.set(dateKey, cachedProducts.filter(function (p) {
1473
1541
  return !idSet.has(p.id);
1474
1542
  }));
1475
1543
  }
1476
1544
  } catch (err) {
1477
- _iterator9.e(err);
1545
+ _iterator10.e(err);
1478
1546
  } finally {
1479
- _iterator9.f();
1547
+ _iterator10.f();
1480
1548
  }
1481
1549
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
1482
1550
  this.logInfo('removeProductsByIds 完成', {
@@ -1484,11 +1552,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1484
1552
  });
1485
1553
  case 34:
1486
1554
  case "end":
1487
- return _context14.stop();
1555
+ return _context15.stop();
1488
1556
  }
1489
- }, _callee14, this, [[6, 26], [8, 18, 21, 24]]);
1557
+ }, _callee15, this, [[6, 26], [8, 18, 21, 24]]);
1490
1558
  }));
1491
- function removeProductsByIds(_x18) {
1559
+ function removeProductsByIds(_x19) {
1492
1560
  return _removeProductsByIds.apply(this, arguments);
1493
1561
  }
1494
1562
  return removeProductsByIds;
@@ -1501,17 +1569,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1501
1569
  }, {
1502
1570
  key: "refreshProducts",
1503
1571
  value: (function () {
1504
- var _refreshProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1572
+ var _refreshProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1505
1573
  var tTotal, products;
1506
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1507
- while (1) switch (_context15.prev = _context15.next) {
1574
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1575
+ while (1) switch (_context16.prev = _context16.next) {
1508
1576
  case 0:
1509
1577
  tTotal = performance.now();
1510
1578
  this.logInfo('refreshProducts 开始');
1511
- _context15.next = 4;
1579
+ _context16.next = 4;
1512
1580
  return this.loadProductsByServer();
1513
1581
  case 4:
1514
- products = _context15.sent;
1582
+ products = _context16.sent;
1515
1583
  if (products && products.length > 0) {
1516
1584
  // 服务器返回的数据已经是全新的,无需 cloneDeep
1517
1585
  this.store.list = products;
@@ -1526,12 +1594,12 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1526
1594
  perfMark('refreshProducts', performance.now() - tTotal, {
1527
1595
  count: this.store.list.length
1528
1596
  });
1529
- return _context15.abrupt("return", this.store.list);
1597
+ return _context16.abrupt("return", this.store.list);
1530
1598
  case 8:
1531
1599
  case "end":
1532
- return _context15.stop();
1600
+ return _context16.stop();
1533
1601
  }
1534
- }, _callee15, this);
1602
+ }, _callee16, this);
1535
1603
  }));
1536
1604
  function refreshProducts() {
1537
1605
  return _refreshProducts.apply(this, arguments);
@@ -1545,10 +1613,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1545
1613
  }, {
1546
1614
  key: "clear",
1547
1615
  value: (function () {
1548
- var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1616
+ var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1549
1617
  var errorMessage;
1550
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1551
- while (1) switch (_context16.prev = _context16.next) {
1618
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1619
+ while (1) switch (_context17.prev = _context17.next) {
1552
1620
  case 0:
1553
1621
  this.logInfo('开始清空缓存', {
1554
1622
  currentProductCount: this.store.list.length,
@@ -1559,22 +1627,22 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1559
1627
 
1560
1628
  // 同时清空 IndexDB 中的所有数据(包括商品和元数据)
1561
1629
  if (!this.dbManager) {
1562
- _context16.next = 16;
1630
+ _context17.next = 16;
1563
1631
  break;
1564
1632
  }
1565
- _context16.prev = 4;
1566
- _context16.next = 7;
1633
+ _context17.prev = 4;
1634
+ _context17.next = 7;
1567
1635
  return this.dbManager.clear(INDEXDB_STORE_NAME);
1568
1636
  case 7:
1569
1637
  console.log('[Products] IndexDB 缓存已清空');
1570
1638
  this.logInfo('IndexDB 缓存已清空');
1571
- _context16.next = 16;
1639
+ _context17.next = 16;
1572
1640
  break;
1573
1641
  case 11:
1574
- _context16.prev = 11;
1575
- _context16.t0 = _context16["catch"](4);
1576
- errorMessage = _context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0);
1577
- console.error('[Products] 清空 IndexDB 缓存失败:', _context16.t0);
1642
+ _context17.prev = 11;
1643
+ _context17.t0 = _context17["catch"](4);
1644
+ errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1645
+ console.error('[Products] 清空 IndexDB 缓存失败:', _context17.t0);
1578
1646
  this.logError('清空 IndexDB 缓存失败', {
1579
1647
  error: errorMessage
1580
1648
  });
@@ -1583,9 +1651,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1583
1651
  this.logInfo('缓存清空完成');
1584
1652
  case 18:
1585
1653
  case "end":
1586
- return _context16.stop();
1654
+ return _context17.stop();
1587
1655
  }
1588
- }, _callee16, this, [[4, 11]]);
1656
+ }, _callee17, this, [[4, 11]]);
1589
1657
  }));
1590
1658
  function clear() {
1591
1659
  return _clear.apply(this, arguments);
@@ -1600,45 +1668,45 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1600
1668
  }, {
1601
1669
  key: "loadProductsFromIndexDB",
1602
1670
  value: (function () {
1603
- var _loadProductsFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1671
+ var _loadProductsFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1604
1672
  var _products$length, _products$length2, t0, products, errorMessage;
1605
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1606
- while (1) switch (_context17.prev = _context17.next) {
1673
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1674
+ while (1) switch (_context18.prev = _context18.next) {
1607
1675
  case 0:
1608
1676
  if (this.dbManager) {
1609
- _context17.next = 3;
1677
+ _context18.next = 3;
1610
1678
  break;
1611
1679
  }
1612
1680
  this.logWarning('loadProductsFromIndexDB: dbManager 不可用');
1613
- return _context17.abrupt("return", []);
1681
+ return _context18.abrupt("return", []);
1614
1682
  case 3:
1615
- _context17.prev = 3;
1683
+ _context18.prev = 3;
1616
1684
  t0 = performance.now();
1617
- _context17.next = 7;
1685
+ _context18.next = 7;
1618
1686
  return this.dbManager.getAll(INDEXDB_STORE_NAME);
1619
1687
  case 7:
1620
- products = _context17.sent;
1688
+ products = _context18.sent;
1621
1689
  perfMark('loadProductsFromIndexDB', performance.now() - t0, {
1622
1690
  count: (_products$length = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length !== void 0 ? _products$length : 0
1623
1691
  });
1624
1692
  this.logInfo('从 IndexDB 加载商品数据', {
1625
1693
  productCount: (_products$length2 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length2 !== void 0 ? _products$length2 : 0
1626
1694
  });
1627
- return _context17.abrupt("return", products || []);
1695
+ return _context18.abrupt("return", products || []);
1628
1696
  case 13:
1629
- _context17.prev = 13;
1630
- _context17.t0 = _context17["catch"](3);
1631
- errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1632
- console.error('[Products] 从 IndexDB 读取数据失败:', _context17.t0);
1697
+ _context18.prev = 13;
1698
+ _context18.t0 = _context18["catch"](3);
1699
+ errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
1700
+ console.error('[Products] 从 IndexDB 读取数据失败:', _context18.t0);
1633
1701
  this.logError('从 IndexDB 读取数据失败', {
1634
1702
  error: errorMessage
1635
1703
  });
1636
- return _context17.abrupt("return", []);
1704
+ return _context18.abrupt("return", []);
1637
1705
  case 19:
1638
1706
  case "end":
1639
- return _context17.stop();
1707
+ return _context18.stop();
1640
1708
  }
1641
- }, _callee17, this, [[3, 13]]);
1709
+ }, _callee18, this, [[3, 13]]);
1642
1710
  }));
1643
1711
  function loadProductsFromIndexDB() {
1644
1712
  return _loadProductsFromIndexDB.apply(this, arguments);
@@ -1657,10 +1725,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1657
1725
  }, {
1658
1726
  key: "runInProductIndexDBSaveQueue",
1659
1727
  value: (function () {
1660
- var _runInProductIndexDBSaveQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(task) {
1728
+ var _runInProductIndexDBSaveQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(task) {
1661
1729
  var queuedTask;
1662
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1663
- while (1) switch (_context18.prev = _context18.next) {
1730
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1731
+ while (1) switch (_context19.prev = _context19.next) {
1664
1732
  case 0:
1665
1733
  queuedTask = this.productIndexDBSaveQueue.then(task, task);
1666
1734
  this.productIndexDBSaveQueue = queuedTask.then(function () {
@@ -1668,14 +1736,14 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1668
1736
  }, function () {
1669
1737
  return undefined;
1670
1738
  });
1671
- return _context18.abrupt("return", queuedTask);
1739
+ return _context19.abrupt("return", queuedTask);
1672
1740
  case 3:
1673
1741
  case "end":
1674
- return _context18.stop();
1742
+ return _context19.stop();
1675
1743
  }
1676
- }, _callee18, this);
1744
+ }, _callee19, this);
1677
1745
  }));
1678
- function runInProductIndexDBSaveQueue(_x19) {
1746
+ function runInProductIndexDBSaveQueue(_x20) {
1679
1747
  return _runInProductIndexDBSaveQueue.apply(this, arguments);
1680
1748
  }
1681
1749
  return runInProductIndexDBSaveQueue;
@@ -1690,39 +1758,39 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1690
1758
  }, {
1691
1759
  key: "replaceProductsSnapshotInIndexDB",
1692
1760
  value: (function () {
1693
- var _replaceProductsSnapshotInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(products, source) {
1761
+ var _replaceProductsSnapshotInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(products, source) {
1694
1762
  var _this7 = this;
1695
1763
  var errorMessage;
1696
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1697
- while (1) switch (_context20.prev = _context20.next) {
1764
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1765
+ while (1) switch (_context21.prev = _context21.next) {
1698
1766
  case 0:
1699
1767
  if (this.dbManager) {
1700
- _context20.next = 3;
1768
+ _context21.next = 3;
1701
1769
  break;
1702
1770
  }
1703
1771
  this.logWarning('replaceProductsSnapshotInIndexDB: dbManager 不可用');
1704
- return _context20.abrupt("return");
1772
+ return _context21.abrupt("return");
1705
1773
  case 3:
1706
- _context20.prev = 3;
1707
- _context20.next = 6;
1708
- return this.runInProductIndexDBSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1774
+ _context21.prev = 3;
1775
+ _context21.next = 6;
1776
+ return this.runInProductIndexDBSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1709
1777
  var t0;
1710
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1711
- while (1) switch (_context19.prev = _context19.next) {
1778
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1779
+ while (1) switch (_context20.prev = _context20.next) {
1712
1780
  case 0:
1713
1781
  _this7.logInfo('replaceProductsSnapshotInIndexDB 开始', {
1714
1782
  source: source,
1715
1783
  productCount: products.length
1716
1784
  });
1717
1785
  t0 = performance.now();
1718
- _context19.next = 4;
1786
+ _context20.next = 4;
1719
1787
  return _this7.dbManager.clear(INDEXDB_STORE_NAME);
1720
1788
  case 4:
1721
1789
  if (!(products.length > 0)) {
1722
- _context19.next = 7;
1790
+ _context20.next = 7;
1723
1791
  break;
1724
1792
  }
1725
- _context19.next = 7;
1793
+ _context20.next = 7;
1726
1794
  return _this7.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1727
1795
  case 7:
1728
1796
  perfMark('replaceProductsSnapshotInIndexDB', performance.now() - t0, {
@@ -1734,17 +1802,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1734
1802
  });
1735
1803
  case 9:
1736
1804
  case "end":
1737
- return _context19.stop();
1805
+ return _context20.stop();
1738
1806
  }
1739
- }, _callee19);
1807
+ }, _callee20);
1740
1808
  })));
1741
1809
  case 6:
1742
- _context20.next = 12;
1810
+ _context21.next = 12;
1743
1811
  break;
1744
1812
  case 8:
1745
- _context20.prev = 8;
1746
- _context20.t0 = _context20["catch"](3);
1747
- errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0);
1813
+ _context21.prev = 8;
1814
+ _context21.t0 = _context21["catch"](3);
1815
+ errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
1748
1816
  this.logError('全量保存商品到 IndexDB 失败', {
1749
1817
  source: source,
1750
1818
  productCount: products.length,
@@ -1752,11 +1820,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1752
1820
  });
1753
1821
  case 12:
1754
1822
  case "end":
1755
- return _context20.stop();
1823
+ return _context21.stop();
1756
1824
  }
1757
- }, _callee20, this, [[3, 8]]);
1825
+ }, _callee21, this, [[3, 8]]);
1758
1826
  }));
1759
- function replaceProductsSnapshotInIndexDB(_x20, _x21) {
1827
+ function replaceProductsSnapshotInIndexDB(_x21, _x22) {
1760
1828
  return _replaceProductsSnapshotInIndexDB.apply(this, arguments);
1761
1829
  }
1762
1830
  return replaceProductsSnapshotInIndexDB;
@@ -1771,37 +1839,37 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1771
1839
  }, {
1772
1840
  key: "patchProductsInIndexDB",
1773
1841
  value: (function () {
1774
- var _patchProductsInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(products, source) {
1842
+ var _patchProductsInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(products, source) {
1775
1843
  var _this8 = this;
1776
1844
  var mergeActions,
1777
1845
  validProducts,
1778
1846
  errorMessage,
1779
- _args22 = arguments;
1780
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1781
- while (1) switch (_context22.prev = _context22.next) {
1847
+ _args23 = arguments;
1848
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1849
+ while (1) switch (_context23.prev = _context23.next) {
1782
1850
  case 0:
1783
- mergeActions = _args22.length > 2 && _args22[2] !== undefined ? _args22[2] : {};
1851
+ mergeActions = _args23.length > 2 && _args23[2] !== undefined ? _args23[2] : {};
1784
1852
  if (!(!this.dbManager || products.length === 0)) {
1785
- _context22.next = 3;
1853
+ _context23.next = 3;
1786
1854
  break;
1787
1855
  }
1788
- return _context22.abrupt("return");
1856
+ return _context23.abrupt("return");
1789
1857
  case 3:
1790
1858
  validProducts = products.filter(function (p) {
1791
1859
  return (p === null || p === void 0 ? void 0 : p.id) !== undefined && (p === null || p === void 0 ? void 0 : p.id) !== null;
1792
1860
  });
1793
1861
  if (!(validProducts.length === 0)) {
1794
- _context22.next = 6;
1862
+ _context23.next = 6;
1795
1863
  break;
1796
1864
  }
1797
- return _context22.abrupt("return");
1865
+ return _context23.abrupt("return");
1798
1866
  case 6:
1799
- _context22.prev = 6;
1800
- _context22.next = 9;
1801
- return this.runInProductIndexDBSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1802
- var t0, _iterator10, _step10, product;
1803
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1804
- while (1) switch (_context21.prev = _context21.next) {
1867
+ _context23.prev = 6;
1868
+ _context23.next = 9;
1869
+ return this.runInProductIndexDBSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1870
+ var t0, _iterator11, _step11, product;
1871
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1872
+ while (1) switch (_context22.prev = _context22.next) {
1805
1873
  case 0:
1806
1874
  _this8.logInfo('patchProductsInIndexDB 开始', {
1807
1875
  source: source,
@@ -1809,44 +1877,44 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1809
1877
  });
1810
1878
  t0 = performance.now();
1811
1879
  if (!(typeof _this8.dbManager.bulkUpdate === 'function')) {
1812
- _context21.next = 7;
1880
+ _context22.next = 7;
1813
1881
  break;
1814
1882
  }
1815
- _context21.next = 5;
1883
+ _context22.next = 5;
1816
1884
  return _this8.dbManager.bulkUpdate(INDEXDB_STORE_NAME, validProducts);
1817
1885
  case 5:
1818
- _context21.next = 25;
1886
+ _context22.next = 25;
1819
1887
  break;
1820
1888
  case 7:
1821
1889
  if (!(typeof _this8.dbManager.update === 'function')) {
1822
- _context21.next = 25;
1890
+ _context22.next = 25;
1823
1891
  break;
1824
1892
  }
1825
- _iterator10 = _createForOfIteratorHelper(validProducts);
1826
- _context21.prev = 9;
1827
- _iterator10.s();
1893
+ _iterator11 = _createForOfIteratorHelper(validProducts);
1894
+ _context22.prev = 9;
1895
+ _iterator11.s();
1828
1896
  case 11:
1829
- if ((_step10 = _iterator10.n()).done) {
1830
- _context21.next = 17;
1897
+ if ((_step11 = _iterator11.n()).done) {
1898
+ _context22.next = 17;
1831
1899
  break;
1832
1900
  }
1833
- product = _step10.value;
1834
- _context21.next = 15;
1901
+ product = _step11.value;
1902
+ _context22.next = 15;
1835
1903
  return _this8.dbManager.update(INDEXDB_STORE_NAME, product);
1836
1904
  case 15:
1837
- _context21.next = 11;
1905
+ _context22.next = 11;
1838
1906
  break;
1839
1907
  case 17:
1840
- _context21.next = 22;
1908
+ _context22.next = 22;
1841
1909
  break;
1842
1910
  case 19:
1843
- _context21.prev = 19;
1844
- _context21.t0 = _context21["catch"](9);
1845
- _iterator10.e(_context21.t0);
1911
+ _context22.prev = 19;
1912
+ _context22.t0 = _context22["catch"](9);
1913
+ _iterator11.e(_context22.t0);
1846
1914
  case 22:
1847
- _context21.prev = 22;
1848
- _iterator10.f();
1849
- return _context21.finish(22);
1915
+ _context22.prev = 22;
1916
+ _iterator11.f();
1917
+ return _context22.finish(22);
1850
1918
  case 25:
1851
1919
  perfMark('patchProductsInIndexDB', performance.now() - t0, {
1852
1920
  count: validProducts.length
@@ -1857,17 +1925,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1857
1925
  });
1858
1926
  case 27:
1859
1927
  case "end":
1860
- return _context21.stop();
1928
+ return _context22.stop();
1861
1929
  }
1862
- }, _callee21, null, [[9, 19, 22, 25]]);
1930
+ }, _callee22, null, [[9, 19, 22, 25]]);
1863
1931
  })));
1864
1932
  case 9:
1865
- _context22.next = 15;
1933
+ _context23.next = 15;
1866
1934
  break;
1867
1935
  case 11:
1868
- _context22.prev = 11;
1869
- _context22.t0 = _context22["catch"](6);
1870
- errorMessage = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
1936
+ _context23.prev = 11;
1937
+ _context23.t0 = _context23["catch"](6);
1938
+ errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
1871
1939
  this.logError('增量保存商品到 IndexDB 失败', {
1872
1940
  source: source,
1873
1941
  error: errorMessage,
@@ -1875,11 +1943,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1875
1943
  });
1876
1944
  case 15:
1877
1945
  case "end":
1878
- return _context22.stop();
1946
+ return _context23.stop();
1879
1947
  }
1880
- }, _callee22, this, [[6, 11]]);
1948
+ }, _callee23, this, [[6, 11]]);
1881
1949
  }));
1882
- function patchProductsInIndexDB(_x22, _x23) {
1950
+ function patchProductsInIndexDB(_x23, _x24) {
1883
1951
  return _patchProductsInIndexDB.apply(this, arguments);
1884
1952
  }
1885
1953
  return patchProductsInIndexDB;
@@ -1895,17 +1963,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1895
1963
  value: function syncProductsMap() {
1896
1964
  var t0 = performance.now();
1897
1965
  this.store.map.clear();
1898
- var _iterator11 = _createForOfIteratorHelper(this.store.list),
1899
- _step11;
1966
+ var _iterator12 = _createForOfIteratorHelper(this.store.list),
1967
+ _step12;
1900
1968
  try {
1901
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
1902
- var product = _step11.value;
1969
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
1970
+ var product = _step12.value;
1903
1971
  this.store.map.set(product.id, product);
1904
1972
  }
1905
1973
  } catch (err) {
1906
- _iterator11.e(err);
1974
+ _iterator12.e(err);
1907
1975
  } finally {
1908
- _iterator11.f();
1976
+ _iterator12.f();
1909
1977
  }
1910
1978
  perfMark('syncProductsMap', performance.now() - t0, {
1911
1979
  count: this.store.map.size
@@ -1919,26 +1987,26 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1919
1987
  }, {
1920
1988
  key: "preload",
1921
1989
  value: (function () {
1922
- var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1990
+ var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1923
1991
  var _products$length3;
1924
1992
  var tTotal, _cachedData$length, tIndexDB, cachedData, tSync, errorMessage, tServer, products, _tSync;
1925
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1926
- while (1) switch (_context23.prev = _context23.next) {
1993
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1994
+ while (1) switch (_context24.prev = _context24.next) {
1927
1995
  case 0:
1928
1996
  console.log('[Products] 开始预加载数据...');
1929
1997
  tTotal = performance.now();
1930
1998
  this.logInfo('开始预加载数据');
1931
- _context23.prev = 3;
1999
+ _context24.prev = 3;
1932
2000
  tIndexDB = performance.now();
1933
- _context23.next = 7;
2001
+ _context24.next = 7;
1934
2002
  return this.loadProductsFromIndexDB();
1935
2003
  case 7:
1936
- cachedData = _context23.sent;
2004
+ cachedData = _context24.sent;
1937
2005
  perfMark('preload.loadFromIndexDB', performance.now() - tIndexDB, {
1938
2006
  count: (_cachedData$length = cachedData === null || cachedData === void 0 ? void 0 : cachedData.length) !== null && _cachedData$length !== void 0 ? _cachedData$length : 0
1939
2007
  });
1940
2008
  if (!(cachedData && cachedData.length > 0)) {
1941
- _context23.next = 20;
2009
+ _context24.next = 20;
1942
2010
  break;
1943
2011
  }
1944
2012
  console.log("[Products] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u4E2A\u5546\u54C1"));
@@ -1960,26 +2028,26 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1960
2028
  source: 'IndexDB'
1961
2029
  });
1962
2030
  this.lastPreloadCompletedAtMs = Date.now();
1963
- return _context23.abrupt("return");
2031
+ return _context24.abrupt("return");
1964
2032
  case 20:
1965
2033
  console.log('[Products] IndexDB 中没有缓存数据,从服务器加载...');
1966
2034
  this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
1967
- _context23.next = 29;
2035
+ _context24.next = 29;
1968
2036
  break;
1969
2037
  case 24:
1970
- _context23.prev = 24;
1971
- _context23.t0 = _context23["catch"](3);
1972
- errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
1973
- console.warn('[Products] 从 IndexDB 加载数据失败:', _context23.t0);
2038
+ _context24.prev = 24;
2039
+ _context24.t0 = _context24["catch"](3);
2040
+ errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
2041
+ console.warn('[Products] 从 IndexDB 加载数据失败:', _context24.t0);
1974
2042
  this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
1975
2043
  error: errorMessage
1976
2044
  });
1977
2045
  case 29:
1978
2046
  tServer = performance.now();
1979
- _context23.next = 32;
2047
+ _context24.next = 32;
1980
2048
  return this.loadProductsByServer();
1981
2049
  case 32:
1982
- products = _context23.sent;
2050
+ products = _context24.sent;
1983
2051
  perfMark('preload.loadFromServer', performance.now() - tServer, {
1984
2052
  count: (_products$length3 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length3 !== void 0 ? _products$length3 : 0
1985
2053
  });
@@ -2012,9 +2080,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2012
2080
  }
2013
2081
  case 35:
2014
2082
  case "end":
2015
- return _context23.stop();
2083
+ return _context24.stop();
2016
2084
  }
2017
- }, _callee23, this, [[3, 24]]);
2085
+ }, _callee24, this, [[3, 24]]);
2018
2086
  }));
2019
2087
  function preload() {
2020
2088
  return _preload.apply(this, arguments);
@@ -2118,18 +2186,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2118
2186
  }, {
2119
2187
  key: "processProductSyncMessages",
2120
2188
  value: (function () {
2121
- var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2122
- var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator12, _step12, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, patchProductMap, patchMergeActions, storeMutated, bodyResult, _iterator13, _step13, product, freshProducts, mergeResult, _iterator14, _step14, _product, patchProducts, allChangedIds, hasChanges, errorMessage;
2123
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2124
- while (1) switch (_context24.prev = _context24.next) {
2189
+ var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2190
+ var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator13, _step13, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, patchProductMap, patchMergeActions, storeMutated, bodyResult, _iterator14, _step14, product, freshProducts, mergeResult, _iterator15, _step15, _product, patchProducts, allChangedIds, hasChanges, errorMessage;
2191
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2192
+ while (1) switch (_context25.prev = _context25.next) {
2125
2193
  case 0:
2126
2194
  messages = _toConsumableArray(this.pendingSyncMessages);
2127
2195
  this.pendingSyncMessages = [];
2128
2196
  if (!(messages.length === 0)) {
2129
- _context24.next = 4;
2197
+ _context25.next = 4;
2130
2198
  break;
2131
2199
  }
2132
- return _context24.abrupt("return");
2200
+ return _context25.abrupt("return");
2133
2201
  case 4:
2134
2202
  this.logInfo('processProductSyncMessages: 开始处理', {
2135
2203
  count: messages.length
@@ -2139,18 +2207,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2139
2207
  sseRefreshIds = [];
2140
2208
  priceRefreshIds = [];
2141
2209
  shouldClearPriceCache = false;
2142
- _iterator12 = _createForOfIteratorHelper(messages);
2143
- _context24.prev = 11;
2144
- _iterator12.s();
2210
+ _iterator13 = _createForOfIteratorHelper(messages);
2211
+ _context25.prev = 11;
2212
+ _iterator13.s();
2145
2213
  case 13:
2146
- if ((_step12 = _iterator12.n()).done) {
2147
- _context24.next = 36;
2214
+ if ((_step13 = _iterator13.n()).done) {
2215
+ _context25.next = 36;
2148
2216
  break;
2149
2217
  }
2150
- msg = _step12.value;
2218
+ msg = _step13.value;
2151
2219
  channelKey = msg._channelKey || msg.module || 'product';
2152
2220
  if (!(channelKey === 'product')) {
2153
- _context24.next = 33;
2221
+ _context25.next = 33;
2154
2222
  break;
2155
2223
  }
2156
2224
  if ((_msg$relation_product = msg.relation_product_ids) !== null && _msg$relation_product !== void 0 && _msg$relation_product.length) {
@@ -2158,14 +2226,14 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2158
2226
  }
2159
2227
  // 1. 删除场景:operation === 'delete' 或 action === 'delete'
2160
2228
  if (!(msg.operation === 'delete' || msg.action === 'delete')) {
2161
- _context24.next = 21;
2229
+ _context25.next = 21;
2162
2230
  break;
2163
2231
  }
2164
2232
  if ((_msg$ids = msg.ids) !== null && _msg$ids !== void 0 && _msg$ids.length) deleteIds.push.apply(deleteIds, _toConsumableArray(msg.ids));else if (msg.id) deleteIds.push(msg.id);
2165
- return _context24.abrupt("continue", 34);
2233
+ return _context25.abrupt("continue", 34);
2166
2234
  case 21:
2167
2235
  if (!((_msg$change_types = msg.change_types) !== null && _msg$change_types !== void 0 && _msg$change_types.includes('price'))) {
2168
- _context24.next = 26;
2236
+ _context25.next = 26;
2169
2237
  break;
2170
2238
  }
2171
2239
  ids = msg.ids || (msg.id ? [msg.id] : []);
@@ -2174,15 +2242,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2174
2242
  bodyId = msg.body.id;
2175
2243
  if (bodyId) bodyUpdates.set(bodyId, msg.body);
2176
2244
  }
2177
- return _context24.abrupt("continue", 34);
2245
+ return _context25.abrupt("continue", 34);
2178
2246
  case 26:
2179
2247
  if (!msg.body) {
2180
- _context24.next = 30;
2248
+ _context25.next = 30;
2181
2249
  break;
2182
2250
  }
2183
2251
  _bodyId = msg.body.id || msg.id;
2184
2252
  if (_bodyId) bodyUpdates.set(_bodyId, msg.body);
2185
- return _context24.abrupt("continue", 34);
2253
+ return _context25.abrupt("continue", 34);
2186
2254
  case 30:
2187
2255
  // 4. 其他情况(有 ids 无 body 无 change_types)→ SSE 拉取
2188
2256
  if ((_msg$ids2 = msg.ids) !== null && _msg$ids2 !== void 0 && _msg$ids2.length) {
@@ -2190,7 +2258,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2190
2258
  } else if (msg.id) {
2191
2259
  sseRefreshIds.push(msg.id);
2192
2260
  }
2193
- _context24.next = 34;
2261
+ _context25.next = 34;
2194
2262
  break;
2195
2263
  case 33:
2196
2264
  if (channelKey === 'product_quotation') {
@@ -2205,28 +2273,28 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2205
2273
  }
2206
2274
  }
2207
2275
  case 34:
2208
- _context24.next = 13;
2276
+ _context25.next = 13;
2209
2277
  break;
2210
2278
  case 36:
2211
- _context24.next = 41;
2279
+ _context25.next = 41;
2212
2280
  break;
2213
2281
  case 38:
2214
- _context24.prev = 38;
2215
- _context24.t0 = _context24["catch"](11);
2216
- _iterator12.e(_context24.t0);
2282
+ _context25.prev = 38;
2283
+ _context25.t0 = _context25["catch"](11);
2284
+ _iterator13.e(_context25.t0);
2217
2285
  case 41:
2218
- _context24.prev = 41;
2219
- _iterator12.f();
2220
- return _context24.finish(41);
2286
+ _context25.prev = 41;
2287
+ _iterator13.f();
2288
+ return _context25.finish(41);
2221
2289
  case 44:
2222
2290
  uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
2223
2291
  uniqueSSEIds = _toConsumableArray(new Set(sseRefreshIds));
2224
2292
  uniquePriceIds = _toConsumableArray(new Set(priceRefreshIds)); // 1. 处理删除
2225
2293
  if (!(uniqueDeleteIds.length > 0)) {
2226
- _context24.next = 50;
2294
+ _context25.next = 50;
2227
2295
  break;
2228
2296
  }
2229
- _context24.next = 50;
2297
+ _context25.next = 50;
2230
2298
  return this.removeProductsByIds(uniqueDeleteIds);
2231
2299
  case 50:
2232
2300
  /** 本批次待 patch 的商品(按 id 去重,SSE 覆盖 body) */
@@ -2234,62 +2302,62 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2234
2302
  patchMergeActions = {};
2235
2303
  storeMutated = uniqueDeleteIds.length > 0; // 2. 处理 body 直接覆盖(仅内存,IndexDB 批次末统一 patch)
2236
2304
  if (!(bodyUpdates.size > 0)) {
2237
- _context24.next = 60;
2305
+ _context25.next = 60;
2238
2306
  break;
2239
2307
  }
2240
- _context24.next = 56;
2308
+ _context25.next = 56;
2241
2309
  return this.applyBodyUpdatesToStore(bodyUpdates, {
2242
2310
  skipIndexDB: true,
2243
2311
  skipEmit: true
2244
2312
  });
2245
2313
  case 56:
2246
- bodyResult = _context24.sent;
2247
- _iterator13 = _createForOfIteratorHelper(bodyResult.changedProducts);
2314
+ bodyResult = _context25.sent;
2315
+ _iterator14 = _createForOfIteratorHelper(bodyResult.changedProducts);
2248
2316
  try {
2249
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2250
- product = _step13.value;
2317
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2318
+ product = _step14.value;
2251
2319
  patchProductMap.set(product.id, product);
2252
2320
  patchMergeActions[product.id] = bodyResult.mergeActions[product.id];
2253
2321
  }
2254
2322
  } catch (err) {
2255
- _iterator13.e(err);
2323
+ _iterator14.e(err);
2256
2324
  } finally {
2257
- _iterator13.f();
2325
+ _iterator14.f();
2258
2326
  }
2259
2327
  storeMutated = true;
2260
2328
  case 60:
2261
2329
  // 3. 处理 SSE 增量拉取(仅内存,IndexDB 批次末统一 patch)
2262
2330
  freshProducts = [];
2263
2331
  if (!(uniqueSSEIds.length > 0)) {
2264
- _context24.next = 73;
2332
+ _context25.next = 73;
2265
2333
  break;
2266
2334
  }
2267
- _context24.next = 64;
2335
+ _context25.next = 64;
2268
2336
  return this.fetchProductsBySSE(uniqueSSEIds);
2269
2337
  case 64:
2270
- freshProducts = _context24.sent;
2338
+ freshProducts = _context25.sent;
2271
2339
  if (!(freshProducts.length > 0)) {
2272
- _context24.next = 72;
2340
+ _context25.next = 72;
2273
2341
  break;
2274
2342
  }
2275
- _context24.next = 68;
2343
+ _context25.next = 68;
2276
2344
  return this.mergeProductsToStore(freshProducts, {
2277
2345
  skipIndexDB: true,
2278
2346
  skipEmit: true
2279
2347
  });
2280
2348
  case 68:
2281
- mergeResult = _context24.sent;
2282
- _iterator14 = _createForOfIteratorHelper(mergeResult.changedProducts);
2349
+ mergeResult = _context25.sent;
2350
+ _iterator15 = _createForOfIteratorHelper(mergeResult.changedProducts);
2283
2351
  try {
2284
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2285
- _product = _step14.value;
2352
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
2353
+ _product = _step15.value;
2286
2354
  patchProductMap.set(_product.id, _product);
2287
2355
  patchMergeActions[_product.id] = mergeResult.mergeActions[_product.id];
2288
2356
  }
2289
2357
  } catch (err) {
2290
- _iterator14.e(err);
2358
+ _iterator15.e(err);
2291
2359
  } finally {
2292
- _iterator14.f();
2360
+ _iterator15.f();
2293
2361
  }
2294
2362
  storeMutated = true;
2295
2363
  case 72:
@@ -2300,10 +2368,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2300
2368
  case 73:
2301
2369
  patchProducts = _toConsumableArray(patchProductMap.values());
2302
2370
  if (!(patchProducts.length > 0)) {
2303
- _context24.next = 77;
2371
+ _context25.next = 77;
2304
2372
  break;
2305
2373
  }
2306
- _context24.next = 77;
2374
+ _context25.next = 77;
2307
2375
  return this.patchProductsInIndexDB(patchProducts, 'pubsub.processProductSyncMessages', patchMergeActions);
2308
2376
  case 77:
2309
2377
  if (storeMutated) {
@@ -2322,41 +2390,41 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2322
2390
  });
2323
2391
  hasChanges = uniqueDeleteIds.length > 0 || allChangedIds.length > 0 || shouldClearPriceCache;
2324
2392
  if (hasChanges) {
2325
- _context24.next = 84;
2393
+ _context25.next = 84;
2326
2394
  break;
2327
2395
  }
2328
2396
  this.logInfo('processProductSyncMessages: 没有变更,不触发 onProductsSyncCompleted');
2329
- return _context24.abrupt("return");
2397
+ return _context25.abrupt("return");
2330
2398
  case 84:
2331
2399
  if (!shouldClearPriceCache) {
2332
- _context24.next = 95;
2400
+ _context25.next = 95;
2333
2401
  break;
2334
2402
  }
2335
- _context24.prev = 85;
2336
- _context24.next = 88;
2403
+ _context25.prev = 85;
2404
+ _context25.next = 88;
2337
2405
  return this.refreshQuotationPriceBridge();
2338
2406
  case 88:
2339
- _context24.next = 94;
2407
+ _context25.next = 94;
2340
2408
  break;
2341
2409
  case 90:
2342
- _context24.prev = 90;
2343
- _context24.t1 = _context24["catch"](85);
2344
- errorMessage = _context24.t1 instanceof Error ? _context24.t1.message : String(_context24.t1);
2410
+ _context25.prev = 90;
2411
+ _context25.t1 = _context25["catch"](85);
2412
+ errorMessage = _context25.t1 instanceof Error ? _context25.t1.message : String(_context25.t1);
2345
2413
  this.logError('报价单桥接刷新失败,将继续清理价格缓存', {
2346
2414
  error: errorMessage
2347
2415
  });
2348
2416
  case 94:
2349
2417
  this.clearPriceCache();
2350
2418
  case 95:
2351
- _context24.next = 97;
2419
+ _context25.next = 97;
2352
2420
  return this.core.effects.emit(ProductsHooks.onProductsSyncCompleted, {
2353
2421
  changedIds: allChangedIds
2354
2422
  });
2355
2423
  case 97:
2356
2424
  case "end":
2357
- return _context24.stop();
2425
+ return _context25.stop();
2358
2426
  }
2359
- }, _callee24, this, [[11, 38, 41, 44], [85, 90]]);
2427
+ }, _callee25, this, [[11, 38, 41, 44], [85, 90]]);
2360
2428
  }));
2361
2429
  function processProductSyncMessages() {
2362
2430
  return _processProductSyncMessages.apply(this, arguments);
@@ -2371,25 +2439,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2371
2439
  }, {
2372
2440
  key: "fetchProductsBySSE",
2373
2441
  value: (function () {
2374
- var _fetchProductsBySSE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(ids) {
2442
+ var _fetchProductsBySSE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(ids) {
2375
2443
  var t0, productList, list, errorMessage;
2376
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2377
- while (1) switch (_context25.prev = _context25.next) {
2444
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2445
+ while (1) switch (_context26.prev = _context26.next) {
2378
2446
  case 0:
2379
2447
  if (this.productDataSource) {
2380
- _context25.next = 3;
2448
+ _context26.next = 3;
2381
2449
  break;
2382
2450
  }
2383
2451
  this.logWarning('fetchProductsBySSE: ProductDataSource 不可用');
2384
- return _context25.abrupt("return", []);
2452
+ return _context26.abrupt("return", []);
2385
2453
  case 3:
2386
2454
  this.logInfo('fetchProductsBySSE: 开始', {
2387
2455
  ids: ids,
2388
2456
  count: ids.length
2389
2457
  });
2390
2458
  t0 = performance.now();
2391
- _context25.prev = 5;
2392
- _context25.next = 8;
2459
+ _context26.prev = 5;
2460
+ _context26.next = 8;
2393
2461
  return this.productDataSource.run({
2394
2462
  sse: {
2395
2463
  query: {
@@ -2399,7 +2467,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2399
2467
  }
2400
2468
  });
2401
2469
  case 8:
2402
- productList = _context25.sent;
2470
+ productList = _context26.sent;
2403
2471
  list = productList || [];
2404
2472
  perfMark('fetchProductsBySSE', performance.now() - t0, {
2405
2473
  count: list.length
@@ -2409,23 +2477,23 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2409
2477
  receivedCount: list.length,
2410
2478
  duration: "".concat(Math.round(performance.now() - t0), "ms")
2411
2479
  });
2412
- return _context25.abrupt("return", list);
2480
+ return _context26.abrupt("return", list);
2413
2481
  case 15:
2414
- _context25.prev = 15;
2415
- _context25.t0 = _context25["catch"](5);
2416
- errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
2482
+ _context26.prev = 15;
2483
+ _context26.t0 = _context26["catch"](5);
2484
+ errorMessage = _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0);
2417
2485
  this.logError('fetchProductsBySSE: 失败', {
2418
2486
  ids: ids,
2419
2487
  error: errorMessage
2420
2488
  });
2421
- return _context25.abrupt("return", []);
2489
+ return _context26.abrupt("return", []);
2422
2490
  case 20:
2423
2491
  case "end":
2424
- return _context25.stop();
2492
+ return _context26.stop();
2425
2493
  }
2426
- }, _callee25, this, [[5, 15]]);
2494
+ }, _callee26, this, [[5, 15]]);
2427
2495
  }));
2428
- function fetchProductsBySSE(_x24) {
2496
+ function fetchProductsBySSE(_x25) {
2429
2497
  return _fetchProductsBySSE.apply(this, arguments);
2430
2498
  }
2431
2499
  return fetchProductsBySSE;
@@ -2441,10 +2509,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2441
2509
  }, {
2442
2510
  key: "applyBodyUpdatesToStore",
2443
2511
  value: (function () {
2444
- var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(bodyUpdates, options) {
2445
- var changedProductIds, updatedCount, newCount, appliedIds, mergeActions, changedProducts, _iterator15, _step15, _step15$value, id, body;
2446
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2447
- while (1) switch (_context26.prev = _context26.next) {
2512
+ var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(bodyUpdates, options) {
2513
+ var changedProductIds, updatedCount, newCount, appliedIds, mergeActions, changedProducts, _iterator16, _step16, _step16$value, id, body;
2514
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2515
+ while (1) switch (_context27.prev = _context27.next) {
2448
2516
  case 0:
2449
2517
  changedProductIds = _toConsumableArray(bodyUpdates.keys());
2450
2518
  this.logInfo('applyBodyUpdatesToStore: 开始', {
@@ -2466,10 +2534,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2466
2534
  }
2467
2535
  return p;
2468
2536
  });
2469
- _iterator15 = _createForOfIteratorHelper(bodyUpdates);
2537
+ _iterator16 = _createForOfIteratorHelper(bodyUpdates);
2470
2538
  try {
2471
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
2472
- _step15$value = _slicedToArray(_step15.value, 2), id = _step15$value[0], body = _step15$value[1];
2539
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
2540
+ _step16$value = _slicedToArray(_step16.value, 2), id = _step16$value[0], body = _step16$value[1];
2473
2541
  if (!appliedIds.has(id)) {
2474
2542
  this.store.list.push(body);
2475
2543
  newCount++;
@@ -2478,16 +2546,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2478
2546
  }
2479
2547
  }
2480
2548
  } catch (err) {
2481
- _iterator15.e(err);
2549
+ _iterator16.e(err);
2482
2550
  } finally {
2483
- _iterator15.f();
2551
+ _iterator16.f();
2484
2552
  }
2485
2553
  this.syncProductsMap();
2486
2554
  if (options !== null && options !== void 0 && options.skipIndexDB) {
2487
- _context26.next = 14;
2555
+ _context27.next = 14;
2488
2556
  break;
2489
2557
  }
2490
- _context26.next = 14;
2558
+ _context27.next = 14;
2491
2559
  return this.patchProductsInIndexDB(changedProducts, 'pubsub.bodyUpdate', mergeActions);
2492
2560
  case 14:
2493
2561
  if (!(options !== null && options !== void 0 && options.skipEmit)) {
@@ -2498,7 +2566,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2498
2566
  newCount: newCount,
2499
2567
  totalCount: this.store.list.length
2500
2568
  });
2501
- return _context26.abrupt("return", {
2569
+ return _context27.abrupt("return", {
2502
2570
  changedProducts: changedProducts,
2503
2571
  mergeActions: mergeActions,
2504
2572
  updatedCount: updatedCount,
@@ -2506,11 +2574,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2506
2574
  });
2507
2575
  case 17:
2508
2576
  case "end":
2509
- return _context26.stop();
2577
+ return _context27.stop();
2510
2578
  }
2511
- }, _callee26, this);
2579
+ }, _callee27, this);
2512
2580
  }));
2513
- function applyBodyUpdatesToStore(_x25, _x26) {
2581
+ function applyBodyUpdatesToStore(_x26, _x27) {
2514
2582
  return _applyBodyUpdatesToStore.apply(this, arguments);
2515
2583
  }
2516
2584
  return applyBodyUpdatesToStore;
@@ -2526,22 +2594,22 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2526
2594
  }, {
2527
2595
  key: "mergeProductsToStore",
2528
2596
  value: (function () {
2529
- var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(freshProducts, options) {
2530
- var freshMap, _iterator16, _step16, p, mergeActions, changedProducts, updatedList, newCount, _iterator17, _step17, _p2, updatedCount, changedProductIds;
2531
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2532
- while (1) switch (_context27.prev = _context27.next) {
2597
+ var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(freshProducts, options) {
2598
+ var freshMap, _iterator17, _step17, p, mergeActions, changedProducts, updatedList, newCount, _iterator18, _step18, _p2, updatedCount, changedProductIds;
2599
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2600
+ while (1) switch (_context28.prev = _context28.next) {
2533
2601
  case 0:
2534
2602
  freshMap = new Map();
2535
- _iterator16 = _createForOfIteratorHelper(freshProducts);
2603
+ _iterator17 = _createForOfIteratorHelper(freshProducts);
2536
2604
  try {
2537
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
2538
- p = _step16.value;
2605
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
2606
+ p = _step17.value;
2539
2607
  freshMap.set(p.id, p);
2540
2608
  }
2541
2609
  } catch (err) {
2542
- _iterator16.e(err);
2610
+ _iterator17.e(err);
2543
2611
  } finally {
2544
- _iterator16.f();
2612
+ _iterator17.f();
2545
2613
  }
2546
2614
  mergeActions = {};
2547
2615
  changedProducts = [];
@@ -2556,18 +2624,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2556
2624
  return p;
2557
2625
  }); // freshMap 中剩余的是新商品(create 场景)
2558
2626
  newCount = freshMap.size;
2559
- _iterator17 = _createForOfIteratorHelper(freshMap.values());
2627
+ _iterator18 = _createForOfIteratorHelper(freshMap.values());
2560
2628
  try {
2561
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
2562
- _p2 = _step17.value;
2629
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
2630
+ _p2 = _step18.value;
2563
2631
  updatedList.push(_p2);
2564
2632
  mergeActions[_p2.id] = 'insert';
2565
2633
  changedProducts.push(_p2);
2566
2634
  }
2567
2635
  } catch (err) {
2568
- _iterator17.e(err);
2636
+ _iterator18.e(err);
2569
2637
  } finally {
2570
- _iterator17.f();
2638
+ _iterator18.f();
2571
2639
  }
2572
2640
  updatedCount = freshProducts.length - newCount;
2573
2641
  changedProductIds = freshProducts.map(function (p) {
@@ -2576,10 +2644,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2576
2644
  this.store.list = updatedList;
2577
2645
  this.syncProductsMap();
2578
2646
  if (options !== null && options !== void 0 && options.skipIndexDB) {
2579
- _context27.next = 16;
2647
+ _context28.next = 16;
2580
2648
  break;
2581
2649
  }
2582
- _context27.next = 16;
2650
+ _context28.next = 16;
2583
2651
  return this.patchProductsInIndexDB(changedProducts, 'pubsub.mergeProductsToStore', mergeActions);
2584
2652
  case 16:
2585
2653
  if (!(options !== null && options !== void 0 && options.skipEmit)) {
@@ -2590,7 +2658,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2590
2658
  newCount: newCount,
2591
2659
  totalCount: this.store.list.length
2592
2660
  });
2593
- return _context27.abrupt("return", {
2661
+ return _context28.abrupt("return", {
2594
2662
  changedProducts: changedProducts,
2595
2663
  mergeActions: mergeActions,
2596
2664
  updatedCount: updatedCount,
@@ -2598,11 +2666,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2598
2666
  });
2599
2667
  case 19:
2600
2668
  case "end":
2601
- return _context27.stop();
2669
+ return _context28.stop();
2602
2670
  }
2603
- }, _callee27, this);
2671
+ }, _callee28, this);
2604
2672
  }));
2605
- function mergeProductsToStore(_x27, _x28) {
2673
+ function mergeProductsToStore(_x28, _x29) {
2606
2674
  return _mergeProductsToStore.apply(this, arguments);
2607
2675
  }
2608
2676
  return mergeProductsToStore;
@@ -2616,43 +2684,43 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2616
2684
  }, {
2617
2685
  key: "silentRefresh",
2618
2686
  value: (function () {
2619
- var _silentRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2687
+ var _silentRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2620
2688
  var t0, now, elapsedSincePreload, elapsedSinceFullFetch, products, errorMessage;
2621
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2622
- while (1) switch (_context28.prev = _context28.next) {
2689
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2690
+ while (1) switch (_context29.prev = _context29.next) {
2623
2691
  case 0:
2624
2692
  t0 = performance.now();
2625
2693
  now = Date.now();
2626
2694
  elapsedSincePreload = now - this.lastPreloadCompletedAtMs;
2627
2695
  elapsedSinceFullFetch = now - this.lastServerFullFetchAtMs;
2628
2696
  if (!(this.lastPreloadCompletedAtMs > 0 && elapsedSincePreload < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS || this.lastServerFullFetchAtMs > 0 && elapsedSinceFullFetch < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS)) {
2629
- _context28.next = 6;
2697
+ _context29.next = 6;
2630
2698
  break;
2631
2699
  }
2632
- return _context28.abrupt("return", this.store.list);
2700
+ return _context29.abrupt("return", this.store.list);
2633
2701
  case 6:
2634
2702
  this.logInfo('silentRefresh 开始');
2635
- _context28.prev = 7;
2636
- _context28.next = 10;
2703
+ _context29.prev = 7;
2704
+ _context29.next = 10;
2637
2705
  return this.loadProductsByServer();
2638
2706
  case 10:
2639
- products = _context28.sent;
2707
+ products = _context29.sent;
2640
2708
  if (!(products && products.length > 0)) {
2641
- _context28.next = 21;
2709
+ _context29.next = 21;
2642
2710
  break;
2643
2711
  }
2644
2712
  this.store.list = products;
2645
2713
  this.syncProductsMap();
2646
2714
  this.clearPriceCache();
2647
2715
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
2648
- _context28.next = 18;
2716
+ _context29.next = 18;
2649
2717
  return this.core.effects.emit(ProductsHooks.onProductsSyncCompleted, null);
2650
2718
  case 18:
2651
2719
  this.logInfo('silentRefresh 完成', {
2652
2720
  productCount: products.length,
2653
2721
  duration: "".concat(Math.round(performance.now() - t0), "ms")
2654
2722
  });
2655
- _context28.next = 22;
2723
+ _context29.next = 22;
2656
2724
  break;
2657
2725
  case 21:
2658
2726
  this.logWarning('silentRefresh: 服务器未返回数据');
@@ -2660,21 +2728,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2660
2728
  perfMark('silentRefresh', performance.now() - t0, {
2661
2729
  count: this.store.list.length
2662
2730
  });
2663
- return _context28.abrupt("return", this.store.list);
2731
+ return _context29.abrupt("return", this.store.list);
2664
2732
  case 26:
2665
- _context28.prev = 26;
2666
- _context28.t0 = _context28["catch"](7);
2667
- errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0);
2733
+ _context29.prev = 26;
2734
+ _context29.t0 = _context29["catch"](7);
2735
+ errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
2668
2736
  this.logError('silentRefresh 失败', {
2669
2737
  duration: "".concat(Math.round(performance.now() - t0), "ms"),
2670
2738
  error: errorMessage
2671
2739
  });
2672
- return _context28.abrupt("return", this.store.list);
2740
+ return _context29.abrupt("return", this.store.list);
2673
2741
  case 31:
2674
2742
  case "end":
2675
- return _context28.stop();
2743
+ return _context29.stop();
2676
2744
  }
2677
- }, _callee28, this, [[7, 26]]);
2745
+ }, _callee29, this, [[7, 26]]);
2678
2746
  }));
2679
2747
  function silentRefresh() {
2680
2748
  return _silentRefresh.apply(this, arguments);