@pisell/pisellos 0.10.77 → 0.10.79

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 (51) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +5 -4
  2. package/dist/modules/Discount/types.d.ts +4 -0
  3. package/dist/modules/Order/index.js +27 -13
  4. package/dist/modules/Product/index.d.ts +1 -1
  5. package/dist/modules/ProductList/index.d.ts +2 -0
  6. package/dist/modules/ProductList/index.js +125 -39
  7. package/dist/modules/ResourcePlanner/planner.js +5 -0
  8. package/dist/modules/Rules/index.d.ts +3 -10
  9. package/dist/modules/Rules/index.js +164 -82
  10. package/dist/modules/Rules/promotionSelection.d.ts +14 -0
  11. package/dist/modules/Rules/promotionSelection.js +390 -0
  12. package/dist/modules/Rules/types.d.ts +9 -0
  13. package/dist/solution/BaseSales/index.d.ts +12 -1
  14. package/dist/solution/BaseSales/index.js +316 -206
  15. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
  16. package/dist/solution/BookingByStep/index.d.ts +2 -2
  17. package/dist/solution/BookingTicket/index.d.ts +1 -13
  18. package/dist/solution/UnifiedBookingSales/index.d.ts +23 -1
  19. package/dist/solution/UnifiedBookingSales/index.js +1307 -635
  20. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  21. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  22. package/dist/solution/UnifiedBookingSales/types.d.ts +25 -2
  23. package/dist/solution/UnifiedBookingSales/types.js +2 -0
  24. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  25. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
  26. package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
  27. package/lib/modules/Discount/types.d.ts +4 -0
  28. package/lib/modules/Order/index.js +11 -0
  29. package/lib/modules/Product/index.d.ts +1 -1
  30. package/lib/modules/ProductList/index.d.ts +2 -0
  31. package/lib/modules/ProductList/index.js +56 -0
  32. package/lib/modules/ResourcePlanner/planner.js +4 -0
  33. package/lib/modules/Rules/index.d.ts +3 -10
  34. package/lib/modules/Rules/index.js +62 -22
  35. package/lib/modules/Rules/promotionSelection.d.ts +14 -0
  36. package/lib/modules/Rules/promotionSelection.js +230 -0
  37. package/lib/modules/Rules/types.d.ts +9 -0
  38. package/lib/solution/BaseSales/index.d.ts +12 -1
  39. package/lib/solution/BaseSales/index.js +84 -5
  40. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  41. package/lib/solution/BookingByStep/index.d.ts +2 -2
  42. package/lib/solution/BookingTicket/index.d.ts +1 -13
  43. package/lib/solution/UnifiedBookingSales/index.d.ts +23 -1
  44. package/lib/solution/UnifiedBookingSales/index.js +359 -5
  45. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  46. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  47. package/lib/solution/UnifiedBookingSales/types.d.ts +25 -2
  48. package/lib/solution/UnifiedBookingSales/types.js +1 -0
  49. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  50. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
  51. package/package.json +1 -1
@@ -41,6 +41,7 @@ import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
41
41
  import { PickupTimingController } from "./pickupTiming";
42
42
  import { getProductHolderRelations, hasProductBooking } from "../../modules/Order/holderRelations";
43
43
  import { resolveContactInfoConfig, getMissingContactInfoFields, ContactInfoRequiredError } from "../../modules/OpenData/contactInfo";
44
+ import { getExclusivePromotion, isPromotionDiscountCard } from "../../modules/Rules/promotionSelection";
44
45
  import Decimal from 'decimal.js';
45
46
  import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
46
47
  import { createModule } from "../BookingByStep/types";
@@ -1458,13 +1459,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1458
1459
  var preparedProduct = this.prepareRawProductForPriceQuery(params.rawProduct, params.selectedProduct);
1459
1460
  if (!preparedProduct) return null;
1460
1461
  var scheduleList = this.getPriceQueryScheduleList();
1461
- var result = tryResolveClientDataVariants(_objectSpread({
1462
+ var result = tryResolveClientDataVariants(_objectSpread(_objectSpread({
1462
1463
  core: this.core,
1463
1464
  otherParams: this.otherParams,
1464
1465
  products: [preparedProduct],
1465
1466
  queryPayload: params.queryPayload,
1466
1467
  handledByOsServer: false
1467
- }, scheduleList ? {
1468
+ }, params.menuList ? {
1469
+ menuList: params.menuList
1470
+ } : {}), scheduleList ? {
1468
1471
  scheduleList: scheduleList
1469
1472
  } : {}));
1470
1473
  if (result.status !== 'resolved') return null;
@@ -1553,13 +1556,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1553
1556
  return _loadProductsForPriceQuery.apply(this, arguments);
1554
1557
  }
1555
1558
  return loadProductsForPriceQuery;
1556
- }()
1559
+ }() /** Opt-in subclasses may supply page-owned raw pools; ordinary sales keep remote fallback. */
1560
+ }, {
1561
+ key: "isVenueCatalogLocalPricingActive",
1562
+ value: function isVenueCatalogLocalPricingActive() {
1563
+ return false;
1564
+ }
1565
+ }, {
1566
+ key: "getVenueCatalogLocalPriceSource",
1567
+ value: function getVenueCatalogLocalPriceSource(_productId, _selectedProduct) {
1568
+ return undefined;
1569
+ }
1557
1570
  }, {
1558
1571
  key: "resolveProductsForPriceQuery",
1559
1572
  value: function () {
1560
1573
  var _resolveProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
1561
1574
  var _this8 = this;
1562
- var selectedProducts, productIds, ids, handledByOsServer, canUseLocalFastPath, productsById, queryPayload, cachedRawProducts, authoritativeProducts, missingIds, remoteRawProducts;
1575
+ var selectedProducts, productIds, ids, _queryPayload, handledByOsServer, canUseLocalFastPath, productsById, queryPayload, cachedRawProducts, authoritativeProducts, missingIds, remoteRawProducts;
1563
1576
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1564
1577
  while (1) switch (_context12.prev = _context12.next) {
1565
1578
  case 0:
@@ -1580,33 +1593,57 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1580
1593
  return null;
1581
1594
  }));
1582
1595
  case 5:
1596
+ if (!this.isVenueCatalogLocalPricingActive()) {
1597
+ _context12.next = 8;
1598
+ break;
1599
+ }
1600
+ _queryPayload = this.buildPriceQueryPayload({
1601
+ ids: ids,
1602
+ schedule: params.schedule,
1603
+ customerId: params.customerId,
1604
+ channel: params.channel
1605
+ });
1606
+ return _context12.abrupt("return", selectedProducts.map(function (selectedProduct, index) {
1607
+ var source = productIds[index] == null ? undefined : _this8.getVenueCatalogLocalPriceSource(productIds[index], selectedProduct);
1608
+ var resolved = source && _this8.resolveLocalProductForPriceQuery({
1609
+ selectedProduct: selectedProduct,
1610
+ rawProduct: source.product,
1611
+ menuList: source.menuList,
1612
+ queryPayload: _queryPayload
1613
+ });
1614
+ if (!resolved) throw Object.assign(new Error('The complete venue product or pricing rules are not ready. Reload the catalog before continuing.'), {
1615
+ code: 'VENUE_LOCAL_PRICE_UNAVAILABLE'
1616
+ });
1617
+ return resolved;
1618
+ }));
1619
+ case 8:
1583
1620
  handledByOsServer = this.request ? isProductQueryHandledByOsServer(this.core, this.request) : false;
1584
1621
  canUseLocalFastPath = this.isCustomerUserPriceQuery() && !handledByOsServer;
1585
1622
  if (canUseLocalFastPath) {
1586
- _context12.next = 14;
1623
+ _context12.next = 17;
1587
1624
  break;
1588
1625
  }
1589
1626
  if (this.request) {
1590
- _context12.next = 10;
1627
+ _context12.next = 13;
1591
1628
  break;
1592
1629
  }
1593
1630
  return _context12.abrupt("return", selectedProducts.map(function () {
1594
1631
  return null;
1595
1632
  }));
1596
- case 10:
1597
- _context12.next = 12;
1633
+ case 13:
1634
+ _context12.next = 15;
1598
1635
  return this.loadProductsForPriceQuery({
1599
1636
  ids: ids,
1600
1637
  schedule: params.schedule,
1601
1638
  customerId: params.customerId,
1602
1639
  channel: params.channel
1603
1640
  });
1604
- case 12:
1641
+ case 15:
1605
1642
  productsById = _context12.sent;
1606
1643
  return _context12.abrupt("return", productIds.map(function (productId) {
1607
1644
  return productId === null ? null : productsById.get(productId) || null;
1608
1645
  }));
1609
- case 14:
1646
+ case 17:
1610
1647
  queryPayload = this.buildPriceQueryPayload({
1611
1648
  ids: ids,
1612
1649
  schedule: params.schedule,
@@ -1626,25 +1663,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1626
1663
  return productId !== null && !authoritativeProducts[index];
1627
1664
  })));
1628
1665
  if (missingIds.length) {
1629
- _context12.next = 20;
1666
+ _context12.next = 23;
1630
1667
  break;
1631
1668
  }
1632
1669
  return _context12.abrupt("return", authoritativeProducts);
1633
- case 20:
1670
+ case 23:
1634
1671
  if (this.request) {
1635
- _context12.next = 22;
1672
+ _context12.next = 25;
1636
1673
  break;
1637
1674
  }
1638
1675
  return _context12.abrupt("return", authoritativeProducts);
1639
- case 22:
1640
- _context12.next = 24;
1676
+ case 25:
1677
+ _context12.next = 27;
1641
1678
  return this.loadProductsForPriceQuery({
1642
1679
  ids: missingIds,
1643
1680
  schedule: params.schedule,
1644
1681
  customerId: params.customerId,
1645
1682
  channel: params.channel
1646
1683
  });
1647
- case 24:
1684
+ case 27:
1648
1685
  remoteRawProducts = _context12.sent;
1649
1686
  authoritativeProducts.forEach(function (authoritativeProduct, index) {
1650
1687
  if (authoritativeProduct) return;
@@ -1666,7 +1703,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1666
1703
  authoritativeProducts[index] = rawProduct ? _this8.prepareRawProductForPriceQuery(rawProduct, selectedProducts[index]) || rawProduct : null;
1667
1704
  });
1668
1705
  return _context12.abrupt("return", authoritativeProducts);
1669
- case 27:
1706
+ case 30:
1670
1707
  case "end":
1671
1708
  return _context12.stop();
1672
1709
  }
@@ -3395,16 +3432,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3395
3432
  if (currentDiscount.isManualSelect) {
3396
3433
  return _objectSpread(_objectSpread({}, discount), {}, {
3397
3434
  isSelected: false,
3398
- isManualSelect: true
3435
+ isManualSelect: true,
3436
+ promotionSelection: currentDiscount.promotionSelection,
3437
+ promotionSelectionStrategyIds: currentDiscount.promotionSelectionStrategyIds
3399
3438
  });
3400
3439
  }
3401
3440
  if (currentDiscount.isSelected) {
3402
3441
  return _objectSpread(_objectSpread({}, discount), {}, {
3403
3442
  isSelected: true,
3404
- isManualSelect: false
3443
+ isManualSelect: false,
3444
+ promotionSelection: currentDiscount.promotionSelection,
3445
+ promotionSelectionStrategyIds: currentDiscount.promotionSelectionStrategyIds
3405
3446
  });
3406
3447
  }
3407
- return discount;
3448
+ return currentDiscount.promotionSelection ? _objectSpread(_objectSpread({}, discount), {}, {
3449
+ promotionSelection: currentDiscount.promotionSelection,
3450
+ promotionSelectionStrategyIds: currentDiscount.promotionSelectionStrategyIds
3451
+ }) : discount;
3408
3452
  });
3409
3453
  }
3410
3454
  }, {
@@ -3826,9 +3870,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3826
3870
  }
3827
3871
  throw new Error('order 模块未初始化');
3828
3872
  case 2:
3873
+ this.hasManualDiscountSelection = false;
3829
3874
  tempOrder = this.store.order.ensureTempOrder();
3830
3875
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
3831
- _context34.next = 7;
3876
+ _context34.next = 8;
3832
3877
  break;
3833
3878
  }
3834
3879
  _result2 = {
@@ -3837,7 +3882,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3837
3882
  };
3838
3883
  cb === null || cb === void 0 || cb(_result2);
3839
3884
  return _context34.abrupt("return", _result2);
3840
- case 7:
3885
+ case 8:
3841
3886
  orderStore = this.store.order.store || {};
3842
3887
  discountModule = orderStore.discount;
3843
3888
  rulesModule = orderStore.rules;
@@ -3848,11 +3893,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3848
3893
  productList: tempOrder.products || [],
3849
3894
  discountList: nextDiscountList
3850
3895
  };
3851
- _context34.next = 16;
3896
+ _context34.next = 17;
3852
3897
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3853
- case 16:
3898
+ case 17:
3854
3899
  if (!rulesModule) {
3855
- _context34.next = 27;
3900
+ _context34.next = 28;
3856
3901
  break;
3857
3902
  }
3858
3903
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
@@ -3871,14 +3916,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3871
3916
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3872
3917
  }
3873
3918
  if (!result.discountList) {
3874
- _context34.next = 27;
3919
+ _context34.next = 28;
3875
3920
  break;
3876
3921
  }
3877
3922
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
3878
3923
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3879
- _context34.next = 25;
3924
+ _context34.next = 26;
3880
3925
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3881
- case 25:
3926
+ case 26:
3882
3927
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
3883
3928
  return discount.isSelected;
3884
3929
  });
@@ -3886,24 +3931,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3886
3931
  productList: tempOrder.products,
3887
3932
  discountList: nextDiscountList
3888
3933
  };
3889
- case 27:
3890
- _context34.next = 29;
3934
+ case 28:
3935
+ _context34.next = 30;
3891
3936
  return this.store.order.recalculateSummary({
3892
3937
  createIfMissing: true
3893
3938
  });
3894
- case 29:
3939
+ case 30:
3895
3940
  this.store.order.persistTempOrder();
3896
- _context34.next = 32;
3941
+ _context34.next = 33;
3897
3942
  return this.effectsEmit('onDiscountApplied', {
3898
3943
  productList: tempOrder.products || [],
3899
3944
  discountList: nextDiscountList,
3900
3945
  selectedDiscountList: tempOrder.discount_list || [],
3901
3946
  tempOrder: tempOrder
3902
3947
  });
3903
- case 32:
3948
+ case 33:
3904
3949
  cb === null || cb === void 0 || cb(result);
3905
3950
  return _context34.abrupt("return", result);
3906
- case 34:
3951
+ case 35:
3907
3952
  case "end":
3908
3953
  return _context34.stop();
3909
3954
  }
@@ -4043,7 +4088,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4043
4088
  key: "setDiscountSelected",
4044
4089
  value: function () {
4045
4090
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4046
- var currentOrder, _store3, _store3$setDiscountLi, list, updated, tempOrder, orderStore, _discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator6, _step6, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator7, _step7, _product$metadata8, _tempOrder$_extend7, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
4091
+ var currentOrder, _store3, _store3$setDiscountLi, list, updated, tempOrder, orderStore, _discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, promotionCardIds, _iterator6, _step6, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator7, _step7, _product$metadata8, _tempOrder$_extend7, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
4047
4092
  return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4048
4093
  while (1) switch (_context37.prev = _context37.next) {
4049
4094
  case 0:
@@ -4115,12 +4160,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4115
4160
  return d.isSelected;
4116
4161
  }).map(function (d) {
4117
4162
  return d.id;
4163
+ })); // Rules 已对促销组完成互斥报价,不能再移除其选中的卡而留下已取消的促销。
4164
+ promotionCardIds = new Set((result.productList || []).filter(function (product) {
4165
+ var _getExclusivePromotio;
4166
+ return (_getExclusivePromotio = getExclusivePromotion(product)) === null || _getExclusivePromotio === void 0 ? void 0 : _getExclusivePromotio.excludedByDiscountCard;
4167
+ }).flatMap(function (product) {
4168
+ return (product.discount_list || []).filter(isPromotionDiscountCard).map(function (discount) {
4169
+ var _discount$discount$re, _discount$discount5;
4170
+ return String((_discount$discount$re = (_discount$discount5 = discount.discount) === null || _discount$discount5 === void 0 ? void 0 : _discount$discount5.resource_id) !== null && _discount$discount$re !== void 0 ? _discount$discount$re : discount.id);
4171
+ });
4118
4172
  }));
4119
4173
  _iterator6 = _createForOfIteratorHelper(nextDiscountList);
4120
4174
  try {
4121
4175
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
4122
4176
  d = _step6.value;
4123
- if (d.isSelected && !beforeSelectedIds.has(d.id)) {
4177
+ if (d.isSelected && !beforeSelectedIds.has(d.id) && !promotionCardIds.has(String(d.id))) {
4124
4178
  d.isSelected = false;
4125
4179
  d.isManualSelect = true;
4126
4180
  d.appliedProductDetails = [];
@@ -4141,7 +4195,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4141
4195
  }));
4142
4196
  filterSelectedDiscountDetails = function filterSelectedDiscountDetails(discountList) {
4143
4197
  return (discountList || []).filter(function (pd) {
4144
- var _pd$discount$resource, _pd$discount;
4198
+ var _pd$metadata, _pd$discount$resource, _pd$discount;
4199
+ // 互斥计算保留/恢复的系统促销没有钱包 resource_id,不能按已选卡列表移除。
4200
+ if (pd.type === 'promotion' || pd.type === 'product' && ((_pd$metadata = pd.metadata) === null || _pd$metadata === void 0 ? void 0 : _pd$metadata.source) === 'promotion') return true;
4145
4201
  var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
4146
4202
  return rid != null && selectedResourceIds.has(rid);
4147
4203
  });
@@ -4182,7 +4238,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4182
4238
  // 券作用于 source(不含 option、不含 bundle);算出新 source 折后价后补回 options
4183
4239
  // 写入含 option 的 main_product_selling_price,再合成 composite 回写 selling_price。
4184
4240
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
4185
- return sum + (pd.amount || 0);
4241
+ return sum + Number(pd.amount || 0);
4186
4242
  }, 0); // TODO 这块逻辑需要拿掉
4187
4243
  optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
4188
4244
  sourcePrice = (_product$metadata$sou2 = (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.source_product_price) !== null && _product$metadata$sou2 !== void 0 ? _product$metadata$sou2 : ((_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : '0';
@@ -6694,23 +6750,77 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6694
6750
  value: function transformBaseProductToOrderProduct(params) {
6695
6751
  return _transformBaseProductToOrderProduct(params);
6696
6752
  }
6753
+
6754
+ /** Explicit pool source avoids races between two simultaneous Venue pricing contexts. */
6697
6755
  }, {
6698
- key: "calculateProductBookingPrice",
6699
- value: function () {
6700
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6756
+ key: "calculateVenueCatalogProductBookingPrice",
6757
+ value: (function () {
6758
+ var _calculateVenueCatalogProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params, source) {
6701
6759
  var _params$customer_id;
6702
- var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
6760
+ var customerId, channel, queryPayload, authoritativeProduct;
6703
6761
  return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6704
6762
  while (1) switch (_context67.prev = _context67.next) {
6763
+ case 0:
6764
+ customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
6765
+ _context67.next = 3;
6766
+ return this.prepareProductPriceQueryContext(customerId);
6767
+ case 3:
6768
+ channel = this.getPriceQueryChannel(params.channel);
6769
+ queryPayload = this.buildPriceQueryPayload({
6770
+ ids: [Number(source.product.id)],
6771
+ schedule: this.getPriceQuerySchedule(params),
6772
+ customerId: customerId,
6773
+ channel: channel
6774
+ });
6775
+ authoritativeProduct = this.resolveLocalProductForPriceQuery({
6776
+ selectedProduct: params.product,
6777
+ rawProduct: source.product,
6778
+ menuList: source.menuList,
6779
+ queryPayload: queryPayload
6780
+ });
6781
+ if (authoritativeProduct) {
6782
+ _context67.next = 8;
6783
+ break;
6784
+ }
6785
+ throw Object.assign(new Error('Complete product pricing rules are not ready. Please retry.'), {
6786
+ code: 'VENUE_LOCAL_PRICE_UNAVAILABLE'
6787
+ });
6788
+ case 8:
6789
+ return _context67.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6790
+ channel: channel,
6791
+ customer_id: customerId,
6792
+ product: this.mergeProductForPriceQuery(params.product, authoritativeProduct),
6793
+ fallback_price: undefined,
6794
+ quotation: undefined
6795
+ })));
6796
+ case 9:
6797
+ case "end":
6798
+ return _context67.stop();
6799
+ }
6800
+ }, _callee67, this);
6801
+ }));
6802
+ function calculateVenueCatalogProductBookingPrice(_x53, _x54) {
6803
+ return _calculateVenueCatalogProductBookingPrice.apply(this, arguments);
6804
+ }
6805
+ return calculateVenueCatalogProductBookingPrice;
6806
+ }())
6807
+ }, {
6808
+ key: "calculateProductBookingPrice",
6809
+ value: function () {
6810
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
6811
+ var _params$customer_id2;
6812
+ var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
6813
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6814
+ while (1) switch (_context68.prev = _context68.next) {
6705
6815
  case 0:
6706
6816
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6707
6817
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
6708
- customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
6709
- _context67.next = 5;
6818
+ customerId = (_params$customer_id2 = params.customer_id) !== null && _params$customer_id2 !== void 0 ? _params$customer_id2 : this.getCurrentOrderCustomerId();
6819
+ _context68.next = 5;
6710
6820
  return this.prepareProductPriceQueryContext(customerId);
6711
6821
  case 5:
6712
6822
  channel = this.getPriceQueryChannel(params.channel);
6713
- _context67.next = 8;
6823
+ _context68.next = 8;
6714
6824
  return this.resolveProductsForPriceQuery({
6715
6825
  priceQueries: [params],
6716
6826
  schedule: this.getPriceQuerySchedule(params),
@@ -6718,22 +6828,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6718
6828
  channel: channel
6719
6829
  });
6720
6830
  case 8:
6721
- _yield$this$resolvePr = _context67.sent;
6831
+ _yield$this$resolvePr = _context68.sent;
6722
6832
  _yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
6723
6833
  authoritativeProduct = _yield$this$resolvePr2[0];
6724
6834
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
6725
6835
  if (useCustomerUserPricing) {
6726
- _context67.next = 15;
6836
+ _context68.next = 15;
6727
6837
  break;
6728
6838
  }
6729
- _context67.next = 15;
6839
+ _context68.next = 15;
6730
6840
  return this.loadQuotationForPriceQuery({
6731
6841
  quotation: quotation,
6732
6842
  customer_id: customerId,
6733
6843
  channel: channel
6734
6844
  });
6735
6845
  case 15:
6736
- return _context67.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6846
+ return _context68.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6737
6847
  channel: channel,
6738
6848
  product: product,
6739
6849
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
@@ -6742,11 +6852,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6742
6852
  })));
6743
6853
  case 16:
6744
6854
  case "end":
6745
- return _context67.stop();
6855
+ return _context68.stop();
6746
6856
  }
6747
- }, _callee67, this);
6857
+ }, _callee68, this);
6748
6858
  }));
6749
- function calculateProductBookingPrice(_x53) {
6859
+ function calculateProductBookingPrice(_x55) {
6750
6860
  return _calculateProductBookingPrice.apply(this, arguments);
6751
6861
  }
6752
6862
  return calculateProductBookingPrice;
@@ -6830,17 +6940,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6830
6940
  }, {
6831
6941
  key: "calculateProductBookingPrices",
6832
6942
  value: function () {
6833
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(paramsList) {
6943
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(paramsList) {
6834
6944
  var _this22 = this;
6835
6945
  var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
6836
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6837
- while (1) switch (_context69.prev = _context69.next) {
6946
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6947
+ while (1) switch (_context70.prev = _context70.next) {
6838
6948
  case 0:
6839
6949
  if (paramsList.length) {
6840
- _context69.next = 2;
6950
+ _context70.next = 2;
6841
6951
  break;
6842
6952
  }
6843
- return _context69.abrupt("return", []);
6953
+ return _context70.abrupt("return", []);
6844
6954
  case 2:
6845
6955
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
6846
6956
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
@@ -6853,10 +6963,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6853
6963
  });
6854
6964
  groups = new Map();
6855
6965
  paramsList.forEach(function (params, index) {
6856
- var _params$customer_id2;
6966
+ var _params$customer_id3;
6857
6967
  var schedule = _this22.getPriceQuerySchedule(params);
6858
6968
  var channel = resolvedChannels[index];
6859
- var customerId = (_params$customer_id2 = params.customer_id) !== null && _params$customer_id2 !== void 0 ? _params$customer_id2 : currentOrderCustomerId;
6969
+ var customerId = (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId;
6860
6970
  var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this22.normalizePriceContextCustomerId(customerId) || ''].join('|');
6861
6971
  var group = groups.get(groupKey) || {
6862
6972
  indices: [],
@@ -6867,20 +6977,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6867
6977
  group.indices.push(index);
6868
6978
  groups.set(groupKey, group);
6869
6979
  });
6870
- _context69.next = 11;
6980
+ _context70.next = 11;
6871
6981
  return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
6872
- var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(group) {
6982
+ var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(group) {
6873
6983
  var priceQueries, resolvedProducts;
6874
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6875
- while (1) switch (_context68.prev = _context68.next) {
6984
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6985
+ while (1) switch (_context69.prev = _context69.next) {
6876
6986
  case 0:
6877
- _context68.next = 2;
6987
+ _context69.next = 2;
6878
6988
  return _this22.prepareProductPriceQueryContext(group.customerId);
6879
6989
  case 2:
6880
6990
  priceQueries = group.indices.map(function (index) {
6881
6991
  return paramsList[index];
6882
6992
  });
6883
- _context68.next = 5;
6993
+ _context69.next = 5;
6884
6994
  return _this22.resolveProductsForPriceQuery({
6885
6995
  priceQueries: priceQueries,
6886
6996
  schedule: group.schedule,
@@ -6888,49 +6998,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6888
6998
  channel: group.channel
6889
6999
  });
6890
7000
  case 5:
6891
- resolvedProducts = _context68.sent;
7001
+ resolvedProducts = _context69.sent;
6892
7002
  group.indices.forEach(function (originalIndex, groupIndex) {
6893
7003
  authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
6894
7004
  });
6895
7005
  case 7:
6896
7006
  case "end":
6897
- return _context68.stop();
7007
+ return _context69.stop();
6898
7008
  }
6899
- }, _callee68);
7009
+ }, _callee69);
6900
7010
  }));
6901
- return function (_x55) {
7011
+ return function (_x57) {
6902
7012
  return _ref56.apply(this, arguments);
6903
7013
  };
6904
7014
  }()));
6905
7015
  case 11:
6906
7016
  if (useCustomerUserPricing) {
6907
- _context69.next = 16;
7017
+ _context70.next = 16;
6908
7018
  break;
6909
7019
  }
6910
7020
  quotationContexts = new Map();
6911
7021
  paramsList.forEach(function (params, index) {
6912
- var _params$customer_id3;
7022
+ var _params$customer_id4;
6913
7023
  var channel = resolvedChannels[index];
6914
7024
  var key = channel || '';
6915
7025
  if (quotationContexts.has(key)) return;
6916
7026
  quotationContexts.set(key, {
6917
7027
  channel: channel,
6918
- customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
7028
+ customer_id: (_params$customer_id4 = params.customer_id) !== null && _params$customer_id4 !== void 0 ? _params$customer_id4 : currentOrderCustomerId
6919
7029
  });
6920
7030
  });
6921
- _context69.next = 16;
7031
+ _context70.next = 16;
6922
7032
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
6923
7033
  return _this22.loadQuotationForPriceQuery(_objectSpread({
6924
7034
  quotation: quotation
6925
7035
  }, context));
6926
7036
  }));
6927
7037
  case 16:
6928
- return _context69.abrupt("return", paramsList.map(function (params, index) {
6929
- var _params$customer_id4;
7038
+ return _context70.abrupt("return", paramsList.map(function (params, index) {
7039
+ var _params$customer_id5;
6930
7040
  var productInput = params.product || {};
6931
7041
  var authoritativeProduct = authoritativeProducts[index];
6932
7042
  var product = _this22.mergeProductForPriceQuery(productInput, authoritativeProduct);
6933
- var customerId = (_params$customer_id4 = params.customer_id) !== null && _params$customer_id4 !== void 0 ? _params$customer_id4 : currentOrderCustomerId;
7043
+ var customerId = (_params$customer_id5 = params.customer_id) !== null && _params$customer_id5 !== void 0 ? _params$customer_id5 : currentOrderCustomerId;
6934
7044
  var channel = resolvedChannels[index];
6935
7045
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
6936
7046
  channel: channel,
@@ -6942,11 +7052,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6942
7052
  }));
6943
7053
  case 17:
6944
7054
  case "end":
6945
- return _context69.stop();
7055
+ return _context70.stop();
6946
7056
  }
6947
- }, _callee69, this);
7057
+ }, _callee70, this);
6948
7058
  }));
6949
- function calculateProductBookingPrices(_x54) {
7059
+ function calculateProductBookingPrices(_x56) {
6950
7060
  return _calculateProductBookingPrices.apply(this, arguments);
6951
7061
  }
6952
7062
  return calculateProductBookingPrices;
@@ -6966,47 +7076,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6966
7076
  }, {
6967
7077
  key: "addProductToOrder",
6968
7078
  value: function () {
6969
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(product, booking, options) {
7079
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(product, booking, options) {
6970
7080
  var products;
6971
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6972
- while (1) switch (_context70.prev = _context70.next) {
7081
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7082
+ while (1) switch (_context71.prev = _context71.next) {
6973
7083
  case 0:
6974
- _context70.prev = 0;
7084
+ _context71.prev = 0;
6975
7085
  if (this.store.order) {
6976
- _context70.next = 3;
7086
+ _context71.next = 3;
6977
7087
  break;
6978
7088
  }
6979
7089
  throw new Error('order 模块未初始化');
6980
7090
  case 3:
6981
7091
  if (!(options === undefined)) {
6982
- _context70.next = 9;
7092
+ _context71.next = 9;
6983
7093
  break;
6984
7094
  }
6985
- _context70.next = 6;
7095
+ _context71.next = 6;
6986
7096
  return this.store.order.addProductToOrder(product, booking);
6987
7097
  case 6:
6988
- _context70.t0 = _context70.sent;
6989
- _context70.next = 12;
7098
+ _context71.t0 = _context71.sent;
7099
+ _context71.next = 12;
6990
7100
  break;
6991
7101
  case 9:
6992
- _context70.next = 11;
7102
+ _context71.next = 11;
6993
7103
  return this.store.order.addProductToOrder(product, booking, options);
6994
7104
  case 11:
6995
- _context70.t0 = _context70.sent;
7105
+ _context71.t0 = _context71.sent;
6996
7106
  case 12:
6997
- products = _context70.t0;
6998
- return _context70.abrupt("return", products);
7107
+ products = _context71.t0;
7108
+ return _context71.abrupt("return", products);
6999
7109
  case 16:
7000
- _context70.prev = 16;
7001
- _context70.t1 = _context70["catch"](0);
7002
- throw _context70.t1;
7110
+ _context71.prev = 16;
7111
+ _context71.t1 = _context71["catch"](0);
7112
+ throw _context71.t1;
7003
7113
  case 19:
7004
7114
  case "end":
7005
- return _context70.stop();
7115
+ return _context71.stop();
7006
7116
  }
7007
- }, _callee70, this, [[0, 16]]);
7117
+ }, _callee71, this, [[0, 16]]);
7008
7118
  }));
7009
- function addProductToOrder(_x56, _x57, _x58) {
7119
+ function addProductToOrder(_x58, _x59, _x60) {
7010
7120
  return _addProductToOrder.apply(this, arguments);
7011
7121
  }
7012
7122
  return addProductToOrder;
@@ -7014,34 +7124,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7014
7124
  }, {
7015
7125
  key: "updateOrderProduct",
7016
7126
  value: function () {
7017
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params) {
7127
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(params) {
7018
7128
  var products;
7019
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7020
- while (1) switch (_context71.prev = _context71.next) {
7129
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7130
+ while (1) switch (_context72.prev = _context72.next) {
7021
7131
  case 0:
7022
- _context71.prev = 0;
7132
+ _context72.prev = 0;
7023
7133
  if (this.store.order) {
7024
- _context71.next = 3;
7134
+ _context72.next = 3;
7025
7135
  break;
7026
7136
  }
7027
7137
  throw new Error('order 模块未初始化');
7028
7138
  case 3:
7029
- _context71.next = 5;
7139
+ _context72.next = 5;
7030
7140
  return this.store.order.updateOrderProduct(params);
7031
7141
  case 5:
7032
- products = _context71.sent;
7033
- return _context71.abrupt("return", products);
7142
+ products = _context72.sent;
7143
+ return _context72.abrupt("return", products);
7034
7144
  case 9:
7035
- _context71.prev = 9;
7036
- _context71.t0 = _context71["catch"](0);
7037
- throw _context71.t0;
7145
+ _context72.prev = 9;
7146
+ _context72.t0 = _context72["catch"](0);
7147
+ throw _context72.t0;
7038
7148
  case 12:
7039
7149
  case "end":
7040
- return _context71.stop();
7150
+ return _context72.stop();
7041
7151
  }
7042
- }, _callee71, this, [[0, 9]]);
7152
+ }, _callee72, this, [[0, 9]]);
7043
7153
  }));
7044
- function updateOrderProduct(_x59) {
7154
+ function updateOrderProduct(_x61) {
7045
7155
  return _updateOrderProduct.apply(this, arguments);
7046
7156
  }
7047
7157
  return updateOrderProduct;
@@ -7049,34 +7159,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7049
7159
  }, {
7050
7160
  key: "updateOrderProducts",
7051
7161
  value: function () {
7052
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(paramsList, options) {
7162
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(paramsList, options) {
7053
7163
  var products;
7054
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7055
- while (1) switch (_context72.prev = _context72.next) {
7164
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7165
+ while (1) switch (_context73.prev = _context73.next) {
7056
7166
  case 0:
7057
- _context72.prev = 0;
7167
+ _context73.prev = 0;
7058
7168
  if (this.store.order) {
7059
- _context72.next = 3;
7169
+ _context73.next = 3;
7060
7170
  break;
7061
7171
  }
7062
7172
  throw new Error('order 模块未初始化');
7063
7173
  case 3:
7064
- _context72.next = 5;
7174
+ _context73.next = 5;
7065
7175
  return this.store.order.updateOrderProducts(paramsList, options);
7066
7176
  case 5:
7067
- products = _context72.sent;
7068
- return _context72.abrupt("return", products);
7177
+ products = _context73.sent;
7178
+ return _context73.abrupt("return", products);
7069
7179
  case 9:
7070
- _context72.prev = 9;
7071
- _context72.t0 = _context72["catch"](0);
7072
- throw _context72.t0;
7180
+ _context73.prev = 9;
7181
+ _context73.t0 = _context73["catch"](0);
7182
+ throw _context73.t0;
7073
7183
  case 12:
7074
7184
  case "end":
7075
- return _context72.stop();
7185
+ return _context73.stop();
7076
7186
  }
7077
- }, _callee72, this, [[0, 9]]);
7187
+ }, _callee73, this, [[0, 9]]);
7078
7188
  }));
7079
- function updateOrderProducts(_x60, _x61) {
7189
+ function updateOrderProducts(_x62, _x63) {
7080
7190
  return _updateOrderProducts.apply(this, arguments);
7081
7191
  }
7082
7192
  return updateOrderProducts;
@@ -7084,34 +7194,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7084
7194
  }, {
7085
7195
  key: "updateOrderProductQuantity",
7086
7196
  value: function () {
7087
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(params) {
7197
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(params) {
7088
7198
  var products;
7089
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7090
- while (1) switch (_context73.prev = _context73.next) {
7199
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7200
+ while (1) switch (_context74.prev = _context74.next) {
7091
7201
  case 0:
7092
- _context73.prev = 0;
7202
+ _context74.prev = 0;
7093
7203
  if (this.store.order) {
7094
- _context73.next = 3;
7204
+ _context74.next = 3;
7095
7205
  break;
7096
7206
  }
7097
7207
  throw new Error('order 模块未初始化');
7098
7208
  case 3:
7099
- _context73.next = 5;
7209
+ _context74.next = 5;
7100
7210
  return this.store.order.updateOrderProductQuantity(params);
7101
7211
  case 5:
7102
- products = _context73.sent;
7103
- return _context73.abrupt("return", products);
7212
+ products = _context74.sent;
7213
+ return _context74.abrupt("return", products);
7104
7214
  case 9:
7105
- _context73.prev = 9;
7106
- _context73.t0 = _context73["catch"](0);
7107
- throw _context73.t0;
7215
+ _context74.prev = 9;
7216
+ _context74.t0 = _context74["catch"](0);
7217
+ throw _context74.t0;
7108
7218
  case 12:
7109
7219
  case "end":
7110
- return _context73.stop();
7220
+ return _context74.stop();
7111
7221
  }
7112
- }, _callee73, this, [[0, 9]]);
7222
+ }, _callee74, this, [[0, 9]]);
7113
7223
  }));
7114
- function updateOrderProductQuantity(_x62) {
7224
+ function updateOrderProductQuantity(_x64) {
7115
7225
  return _updateOrderProductQuantity.apply(this, arguments);
7116
7226
  }
7117
7227
  return updateOrderProductQuantity;
@@ -7134,12 +7244,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7134
7244
  }, {
7135
7245
  key: "setOrderProductLineNote",
7136
7246
  value: (function () {
7137
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(identity, note) {
7247
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(identity, note) {
7138
7248
  var params, products;
7139
- return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7140
- while (1) switch (_context74.prev = _context74.next) {
7249
+ return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7250
+ while (1) switch (_context75.prev = _context75.next) {
7141
7251
  case 0:
7142
- _context74.prev = 0;
7252
+ _context75.prev = 0;
7143
7253
  params = {
7144
7254
  product_id: identity.product_id,
7145
7255
  product_variant_id: identity.product_variant_id,
@@ -7154,22 +7264,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7154
7264
  params.product_sku = identity.product_sku;
7155
7265
  }
7156
7266
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
7157
- _context74.next = 7;
7267
+ _context75.next = 7;
7158
7268
  return this.updateOrderProduct(params);
7159
7269
  case 7:
7160
- products = _context74.sent;
7161
- return _context74.abrupt("return", products);
7270
+ products = _context75.sent;
7271
+ return _context75.abrupt("return", products);
7162
7272
  case 11:
7163
- _context74.prev = 11;
7164
- _context74.t0 = _context74["catch"](0);
7165
- throw _context74.t0;
7273
+ _context75.prev = 11;
7274
+ _context75.t0 = _context75["catch"](0);
7275
+ throw _context75.t0;
7166
7276
  case 14:
7167
7277
  case "end":
7168
- return _context74.stop();
7278
+ return _context75.stop();
7169
7279
  }
7170
- }, _callee74, this, [[0, 11]]);
7280
+ }, _callee75, this, [[0, 11]]);
7171
7281
  }));
7172
- function setOrderProductLineNote(_x63, _x64) {
7282
+ function setOrderProductLineNote(_x65, _x66) {
7173
7283
  return _setOrderProductLineNote.apply(this, arguments);
7174
7284
  }
7175
7285
  return setOrderProductLineNote;
@@ -7184,45 +7294,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7184
7294
  }, {
7185
7295
  key: "removeProductsFromOrder",
7186
7296
  value: (function () {
7187
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(identities, options) {
7188
- return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7189
- while (1) switch (_context75.prev = _context75.next) {
7297
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(identities, options) {
7298
+ return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7299
+ while (1) switch (_context76.prev = _context76.next) {
7190
7300
  case 0:
7191
- _context75.prev = 0;
7301
+ _context76.prev = 0;
7192
7302
  if (this.store.order) {
7193
- _context75.next = 3;
7303
+ _context76.next = 3;
7194
7304
  break;
7195
7305
  }
7196
7306
  throw new Error('order 模块未初始化');
7197
7307
  case 3:
7198
7308
  if (!(options === undefined)) {
7199
- _context75.next = 9;
7309
+ _context76.next = 9;
7200
7310
  break;
7201
7311
  }
7202
- _context75.next = 6;
7312
+ _context76.next = 6;
7203
7313
  return this.store.order.removeProductsFromOrder(identities);
7204
7314
  case 6:
7205
- _context75.t0 = _context75.sent;
7206
- _context75.next = 12;
7315
+ _context76.t0 = _context76.sent;
7316
+ _context76.next = 12;
7207
7317
  break;
7208
7318
  case 9:
7209
- _context75.next = 11;
7319
+ _context76.next = 11;
7210
7320
  return this.store.order.removeProductsFromOrder(identities, options);
7211
7321
  case 11:
7212
- _context75.t0 = _context75.sent;
7322
+ _context76.t0 = _context76.sent;
7213
7323
  case 12:
7214
- return _context75.abrupt("return", _context75.t0);
7324
+ return _context76.abrupt("return", _context76.t0);
7215
7325
  case 15:
7216
- _context75.prev = 15;
7217
- _context75.t1 = _context75["catch"](0);
7218
- throw _context75.t1;
7326
+ _context76.prev = 15;
7327
+ _context76.t1 = _context76["catch"](0);
7328
+ throw _context76.t1;
7219
7329
  case 18:
7220
7330
  case "end":
7221
- return _context75.stop();
7331
+ return _context76.stop();
7222
7332
  }
7223
- }, _callee75, this, [[0, 15]]);
7333
+ }, _callee76, this, [[0, 15]]);
7224
7334
  }));
7225
- function removeProductsFromOrder(_x65, _x66) {
7335
+ function removeProductsFromOrder(_x67, _x68) {
7226
7336
  return _removeProductsFromOrder.apply(this, arguments);
7227
7337
  }
7228
7338
  return removeProductsFromOrder;
@@ -7230,18 +7340,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7230
7340
  }, {
7231
7341
  key: "removeProductFromOrder",
7232
7342
  value: function () {
7233
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(identity, options) {
7234
- return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7235
- while (1) switch (_context76.prev = _context76.next) {
7343
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(identity, options) {
7344
+ return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7345
+ while (1) switch (_context77.prev = _context77.next) {
7236
7346
  case 0:
7237
- return _context76.abrupt("return", this.removeProductsFromOrder([identity], options));
7347
+ return _context77.abrupt("return", this.removeProductsFromOrder([identity], options));
7238
7348
  case 1:
7239
7349
  case "end":
7240
- return _context76.stop();
7350
+ return _context77.stop();
7241
7351
  }
7242
- }, _callee76, this);
7352
+ }, _callee77, this);
7243
7353
  }));
7244
- function removeProductFromOrder(_x67, _x68) {
7354
+ function removeProductFromOrder(_x69, _x70) {
7245
7355
  return _removeProductFromOrder.apply(this, arguments);
7246
7356
  }
7247
7357
  return removeProductFromOrder;
@@ -7291,23 +7401,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7291
7401
  }, {
7292
7402
  key: "applyPromotion",
7293
7403
  value: (function () {
7294
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77() {
7295
- return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7296
- while (1) switch (_context77.prev = _context77.next) {
7404
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78() {
7405
+ return _regeneratorRuntime().wrap(function _callee78$(_context78) {
7406
+ while (1) switch (_context78.prev = _context78.next) {
7297
7407
  case 0:
7298
7408
  if (this.store.order) {
7299
- _context77.next = 2;
7409
+ _context78.next = 2;
7300
7410
  break;
7301
7411
  }
7302
7412
  throw new Error('order 模块未初始化');
7303
7413
  case 2:
7304
- _context77.next = 4;
7414
+ _context78.next = 4;
7305
7415
  return this.store.order.applyPromotion();
7306
7416
  case 4:
7307
7417
  case "end":
7308
- return _context77.stop();
7418
+ return _context78.stop();
7309
7419
  }
7310
- }, _callee77, this);
7420
+ }, _callee78, this);
7311
7421
  }));
7312
7422
  function applyPromotion() {
7313
7423
  return _applyPromotion.apply(this, arguments);
@@ -7334,18 +7444,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7334
7444
  }, {
7335
7445
  key: "getProductList",
7336
7446
  value: function () {
7337
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78() {
7447
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79() {
7338
7448
  var _this$otherParams41;
7339
7449
  var menu_list_ids, _this$store$products, res;
7340
- return _regeneratorRuntime().wrap(function _callee78$(_context78) {
7341
- while (1) switch (_context78.prev = _context78.next) {
7450
+ return _regeneratorRuntime().wrap(function _callee79$(_context79) {
7451
+ while (1) switch (_context79.prev = _context79.next) {
7342
7452
  case 0:
7343
7453
  // 可以直接通过配置里的 menu 读取
7344
7454
  menu_list_ids = ((_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 || (_this$otherParams41 = _this$otherParams41.dineInConfig) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41['menu.associated_menus'].map(function (n) {
7345
7455
  return Number(n.value);
7346
7456
  })) || [];
7347
- _context78.prev = 1;
7348
- _context78.next = 4;
7457
+ _context79.prev = 1;
7458
+ _context79.next = 4;
7349
7459
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
7350
7460
  menu_list_ids: menu_list_ids,
7351
7461
  cacheId: this.cacheId,
@@ -7353,17 +7463,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7353
7463
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
7354
7464
  });
7355
7465
  case 4:
7356
- res = _context78.sent;
7357
- return _context78.abrupt("return", res);
7466
+ res = _context79.sent;
7467
+ return _context79.abrupt("return", res);
7358
7468
  case 8:
7359
- _context78.prev = 8;
7360
- _context78.t0 = _context78["catch"](1);
7361
- throw _context78.t0;
7469
+ _context79.prev = 8;
7470
+ _context79.t0 = _context79["catch"](1);
7471
+ throw _context79.t0;
7362
7472
  case 11:
7363
7473
  case "end":
7364
- return _context78.stop();
7474
+ return _context79.stop();
7365
7475
  }
7366
- }, _callee78, this, [[1, 8]]);
7476
+ }, _callee79, this, [[1, 8]]);
7367
7477
  }));
7368
7478
  function getProductList() {
7369
7479
  return _getProductList.apply(this, arguments);
@@ -7378,17 +7488,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7378
7488
  }, {
7379
7489
  key: "setOtherParams",
7380
7490
  value: function () {
7381
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(params) {
7491
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(params) {
7382
7492
  var _this$otherParams42;
7383
7493
  var _ref57,
7384
7494
  _ref57$cover,
7385
7495
  cover,
7386
7496
  previousPickupTimingScope,
7387
- _args79 = arguments;
7388
- return _regeneratorRuntime().wrap(function _callee79$(_context79) {
7389
- while (1) switch (_context79.prev = _context79.next) {
7497
+ _args80 = arguments;
7498
+ return _regeneratorRuntime().wrap(function _callee80$(_context80) {
7499
+ while (1) switch (_context80.prev = _context80.next) {
7390
7500
  case 0:
7391
- _ref57 = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {}, _ref57$cover = _ref57.cover, cover = _ref57$cover === void 0 ? false : _ref57$cover;
7501
+ _ref57 = _args80.length > 1 && _args80[1] !== undefined ? _args80[1] : {}, _ref57$cover = _ref57.cover, cover = _ref57$cover === void 0 ? false : _ref57$cover;
7392
7502
  previousPickupTimingScope = this.getPickupTimingScope();
7393
7503
  if (cover) {
7394
7504
  this.otherParams = _objectSpread({}, params);
@@ -7397,17 +7507,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7397
7507
  }
7398
7508
  this.cacheId = (_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42.cacheId;
7399
7509
  if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
7400
- _context79.next = 7;
7510
+ _context80.next = 7;
7401
7511
  return this.syncOtherParamsToSubModules(params, {
7402
7512
  cover: cover
7403
7513
  });
7404
7514
  case 7:
7405
7515
  case "end":
7406
- return _context79.stop();
7516
+ return _context80.stop();
7407
7517
  }
7408
- }, _callee79, this);
7518
+ }, _callee80, this);
7409
7519
  }));
7410
- function setOtherParams(_x69) {
7520
+ function setOtherParams(_x71) {
7411
7521
  return _setOtherParams.apply(this, arguments);
7412
7522
  }
7413
7523
  return setOtherParams;