@pisell/pisellos 2.3.6 → 2.3.8

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 (38) hide show
  1. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
  2. package/dist/modules/Order/index.d.ts +18 -2
  3. package/dist/modules/Order/index.js +392 -222
  4. package/dist/modules/Order/types.d.ts +15 -2
  5. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  6. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  7. package/dist/modules/Order/utils.d.ts +4 -0
  8. package/dist/modules/Order/utils.js +114 -28
  9. package/dist/modules/Product/index.d.ts +1 -1
  10. package/dist/modules/Rules/index.d.ts +3 -3
  11. package/dist/modules/Rules/index.js +8 -3
  12. package/dist/modules/Rules/types.d.ts +2 -1
  13. package/dist/server/index.js +1 -0
  14. package/dist/server/modules/order/index.d.ts +4 -4
  15. package/dist/server/modules/order/index.js +4 -4
  16. package/dist/solution/BaseSales/index.d.ts +8 -1
  17. package/dist/solution/BaseSales/index.js +145 -104
  18. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -2
  19. package/dist/solution/BookingByStep/index.d.ts +1 -1
  20. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
  21. package/lib/modules/Order/index.d.ts +18 -2
  22. package/lib/modules/Order/index.js +229 -40
  23. package/lib/modules/Order/types.d.ts +15 -2
  24. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  25. package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
  26. package/lib/modules/Order/utils.d.ts +4 -0
  27. package/lib/modules/Order/utils.js +84 -2
  28. package/lib/modules/Product/index.d.ts +1 -1
  29. package/lib/modules/Rules/index.d.ts +3 -3
  30. package/lib/modules/Rules/index.js +4 -3
  31. package/lib/modules/Rules/types.d.ts +2 -1
  32. package/lib/server/modules/order/index.d.ts +4 -4
  33. package/lib/server/modules/order/index.js +4 -4
  34. package/lib/solution/BaseSales/index.d.ts +8 -1
  35. package/lib/solution/BaseSales/index.js +58 -22
  36. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -5
  37. package/lib/solution/BookingByStep/index.d.ts +1 -1
  38. package/package.json +1 -1
@@ -36,7 +36,7 @@ import { OrderModule } from "../../modules/Order";
36
36
  import Decimal from 'decimal.js';
37
37
  import { cloneDeep, mergeWith } from 'lodash-es';
38
38
  import { createModule } from "../BookingByStep/types";
39
- import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
39
+ import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
40
40
  import dayjs from 'dayjs';
41
41
  export * from "./types";
42
42
  import { QuotationModule } from "../../modules/Quotation";
@@ -168,9 +168,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
168
168
  }, {
169
169
  key: "getReusableSharedSubModule",
170
170
  value: function getReusableSharedSubModule(moduleName) {
171
- var _this$core;
171
+ var _this$core, _this$core$getModule;
172
172
  if (moduleName !== 'schedule' && moduleName !== 'quotation') return null;
173
- return ((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.getModule(moduleName)) || null;
173
+ return ((_this$core = this.core) === null || _this$core === void 0 || (_this$core$getModule = _this$core.getModule) === null || _this$core$getModule === void 0 ? void 0 : _this$core$getModule.call(_this$core, moduleName)) || null;
174
174
  }
175
175
  }, {
176
176
  key: "isScheduleListLoaded",
@@ -1489,7 +1489,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1489
1489
  value: function () {
1490
1490
  var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1491
1491
  var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
1492
- var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result, _iterator, _step, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
1492
+ var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder, _orderStore$summary, holders, orderTotalAmount, result, _iterator, _step, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
1493
1493
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1494
1494
  while (1) switch (_context15.prev = _context15.next) {
1495
1495
  case 0:
@@ -1583,18 +1583,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1583
1583
  });
1584
1584
  case 40:
1585
1585
  if (!rulesModule) {
1586
- _context15.next = 76;
1586
+ _context15.next = 78;
1587
1587
  break;
1588
1588
  }
1589
- holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
1590
- form_record_id: tempOrder.holder.form_record_id
1591
- }] : [];
1589
+ holders = ((_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.form_record) || [];
1590
+ orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
1591
+ console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
1592
1592
  result = rulesModule.calcDiscount({
1593
1593
  productList: tempOrder.products,
1594
1594
  discountList: nextDiscountList,
1595
1595
  holders: holders,
1596
- isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form',
1597
- orderTotalAmount: Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0)
1596
+ isFormSubject: function isFormSubject(product) {
1597
+ return resolveIsFormSubject(tempOrder, product);
1598
+ },
1599
+ orderTotalAmount: orderTotalAmount
1598
1600
  }) || {
1599
1601
  productList: tempOrder.products,
1600
1602
  discountList: nextDiscountList
@@ -1603,22 +1605,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1603
1605
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
1604
1606
  }
1605
1607
  _iterator = _createForOfIteratorHelper(tempOrder.products || []);
1606
- _context15.prev = 45;
1608
+ _context15.prev = 47;
1607
1609
  _iterator.s();
1608
- case 47:
1610
+ case 49:
1609
1611
  if ((_step = _iterator.n()).done) {
1610
- _context15.next = 62;
1612
+ _context15.next = 64;
1611
1613
  break;
1612
1614
  }
1613
1615
  product = _step.value;
1614
1616
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
1615
1617
  runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
1616
1618
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
1617
- _context15.next = 53;
1619
+ _context15.next = 55;
1618
1620
  break;
1619
1621
  }
1620
- return _context15.abrupt("continue", 60);
1621
- case 53:
1622
+ return _context15.abrupt("continue", 62);
1623
+ case 55:
1622
1624
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
1623
1625
  return sum + Number(pd.amount || 0);
1624
1626
  }, 0);
@@ -1634,58 +1636,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1634
1636
  mainPrice: newMainSellingPrice,
1635
1637
  bundle: product.product_bundle
1636
1638
  });
1637
- case 60:
1638
- _context15.next = 47;
1639
- break;
1640
1639
  case 62:
1641
- _context15.next = 67;
1640
+ _context15.next = 49;
1642
1641
  break;
1643
1642
  case 64:
1644
- _context15.prev = 64;
1645
- _context15.t0 = _context15["catch"](45);
1643
+ _context15.next = 69;
1644
+ break;
1645
+ case 66:
1646
+ _context15.prev = 66;
1647
+ _context15.t0 = _context15["catch"](47);
1646
1648
  _iterator.e(_context15.t0);
1647
- case 67:
1648
- _context15.prev = 67;
1649
+ case 69:
1650
+ _context15.prev = 69;
1649
1651
  _iterator.f();
1650
- return _context15.finish(67);
1651
- case 70:
1652
+ return _context15.finish(69);
1653
+ case 72:
1652
1654
  if (!result.discountList) {
1653
- _context15.next = 76;
1655
+ _context15.next = 78;
1654
1656
  break;
1655
1657
  }
1656
1658
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
1657
1659
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1658
- _context15.next = 75;
1660
+ _context15.next = 77;
1659
1661
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1660
- case 75:
1662
+ case 77:
1661
1663
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
1662
1664
  return discount.isSelected;
1663
1665
  });
1664
- case 76:
1665
- _context15.next = 78;
1666
+ case 78:
1667
+ _context15.next = 80;
1666
1668
  return this.store.order.recalculateSummary({
1667
1669
  createIfMissing: true
1668
1670
  });
1669
- case 78:
1671
+ case 80:
1670
1672
  summary = _context15.sent;
1671
1673
  this.store.order.persistTempOrder();
1672
- _context15.next = 82;
1674
+ _context15.next = 84;
1673
1675
  return this.effectsEmit('onDiscountApplied', {
1674
1676
  productList: tempOrder.products || [],
1675
1677
  discountList: nextDiscountList,
1676
1678
  selectedDiscountList: tempOrder.discount_list || [],
1677
1679
  tempOrder: tempOrder
1678
1680
  });
1679
- case 82:
1681
+ case 84:
1680
1682
  return _context15.abrupt("return", {
1681
1683
  productList: tempOrder.products || [],
1682
1684
  discountList: nextDiscountList
1683
1685
  });
1684
- case 83:
1686
+ case 85:
1685
1687
  case "end":
1686
1688
  return _context15.stop();
1687
1689
  }
1688
- }, _callee15, this, [[45, 64, 67, 70]]);
1690
+ }, _callee15, this, [[47, 66, 69, 72]]);
1689
1691
  }));
1690
1692
  function loadDiscountConfig(_x10) {
1691
1693
  return _loadDiscountConfig.apply(this, arguments);
@@ -1697,7 +1699,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1697
1699
  value: function () {
1698
1700
  var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(cb) {
1699
1701
  var _discountModule$getOr2, _discountModule$getDi3;
1700
- var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
1702
+ var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder2, _orderStore$summary2, holders, orderTotalAmount;
1701
1703
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1702
1704
  while (1) switch (_context16.prev = _context16.next) {
1703
1705
  case 0:
@@ -1722,31 +1724,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1722
1724
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1723
1725
  case 12:
1724
1726
  if (!rulesModule) {
1725
- _context16.next = 23;
1727
+ _context16.next = 25;
1726
1728
  break;
1727
1729
  }
1728
- holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
1729
- form_record_id: tempOrder.holder.form_record_id
1730
- }] : [];
1730
+ holders = ((_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_record) || [];
1731
+ orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
1732
+ console.log('[BaseSales.bestDiscount.calcDiscount]');
1731
1733
  result = rulesModule.calcDiscount({
1732
1734
  productList: tempOrder.products,
1733
1735
  discountList: nextDiscountList,
1734
1736
  holders: holders,
1735
- isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
1736
- orderTotalAmount: Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0)
1737
+ isFormSubject: function isFormSubject(product) {
1738
+ return resolveIsFormSubject(tempOrder, product);
1739
+ },
1740
+ orderTotalAmount: orderTotalAmount
1737
1741
  }) || result;
1738
1742
  if (result.productList) {
1739
1743
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
1740
1744
  }
1741
1745
  if (!result.discountList) {
1742
- _context16.next = 23;
1746
+ _context16.next = 25;
1743
1747
  break;
1744
1748
  }
1745
1749
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
1746
1750
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1747
- _context16.next = 21;
1751
+ _context16.next = 23;
1748
1752
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1749
- case 21:
1753
+ case 23:
1750
1754
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
1751
1755
  return discount.isSelected;
1752
1756
  });
@@ -1754,16 +1758,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1754
1758
  productList: tempOrder.products,
1755
1759
  discountList: nextDiscountList
1756
1760
  };
1757
- case 23:
1758
- _context16.next = 25;
1761
+ case 25:
1762
+ _context16.next = 27;
1759
1763
  return this.store.order.recalculateSummary({
1760
1764
  createIfMissing: true
1761
1765
  });
1762
- case 25:
1766
+ case 27:
1763
1767
  this.store.order.persistTempOrder();
1764
1768
  cb === null || cb === void 0 || cb(result);
1765
1769
  return _context16.abrupt("return", result);
1766
- case 28:
1770
+ case 30:
1767
1771
  case "end":
1768
1772
  return _context16.stop();
1769
1773
  }
@@ -1834,7 +1838,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1834
1838
  key: "setDiscountSelected",
1835
1839
  value: function () {
1836
1840
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1837
- var _tempOrder$holder5, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder6, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1841
+ var _tempOrder$holder3, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1838
1842
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1839
1843
  while (1) switch (_context18.prev = _context18.next) {
1840
1844
  case 0:
@@ -1857,19 +1861,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1857
1861
  orderStore = this.store.order.store || {};
1858
1862
  discountModule = orderStore.discount;
1859
1863
  rulesModule = orderStore.rules;
1860
- holders = (_tempOrder$holder5 = tempOrder.holder) !== null && _tempOrder$holder5 !== void 0 && _tempOrder$holder5.form_record_id ? [{
1861
- form_record_id: tempOrder.holder.form_record_id
1862
- }] : [];
1864
+ holders = ((_tempOrder$holder3 = tempOrder.holder) === null || _tempOrder$holder3 === void 0 ? void 0 : _tempOrder$holder3.form_record) || [];
1863
1865
  nextDiscountList = updated;
1864
1866
  _context18.next = 14;
1865
1867
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
1866
1868
  case 14:
1867
1869
  if (rulesModule) {
1870
+ orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
1871
+ console.log('[BaseSales.setDiscountSelected.calcDiscount]');
1868
1872
  result = rulesModule.calcDiscount({
1869
1873
  productList: tempOrder.products,
1870
1874
  discountList: updated,
1871
1875
  holders: holders,
1872
- isFormSubject: !!((_tempOrder$holder6 = tempOrder.holder) !== null && _tempOrder$holder6 !== void 0 && _tempOrder$holder6.type) && tempOrder.holder.type === 'form'
1876
+ isFormSubject: function isFormSubject(product) {
1877
+ return resolveIsFormSubject(tempOrder, product);
1878
+ },
1879
+ orderTotalAmount: orderTotalAmount
1873
1880
  }, {
1874
1881
  discountId: params.discountId,
1875
1882
  isSelected: params.isSelected
@@ -1895,6 +1902,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1895
1902
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
1896
1903
  d.isSelected = false;
1897
1904
  d.isManualSelect = true;
1905
+ d.appliedProductDetails = [];
1898
1906
  }
1899
1907
  }
1900
1908
  } catch (err) {
@@ -1910,28 +1918,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1910
1918
  }).map(function (d) {
1911
1919
  return d.id;
1912
1920
  }));
1921
+ filterSelectedDiscountDetails = function filterSelectedDiscountDetails(discountList) {
1922
+ return (discountList || []).filter(function (pd) {
1923
+ var _pd$discount$resource, _pd$discount;
1924
+ 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;
1925
+ return rid != null && selectedResourceIds.has(rid);
1926
+ });
1927
+ };
1913
1928
  _iterator3 = _createForOfIteratorHelper(tempOrder.products);
1914
- _context18.prev = 17;
1929
+ _context18.prev = 18;
1915
1930
  _iterator3.s();
1916
- case 19:
1931
+ case 20:
1917
1932
  if ((_step3 = _iterator3.n()).done) {
1918
- _context18.next = 35;
1933
+ _context18.next = 37;
1919
1934
  break;
1920
1935
  }
1921
1936
  product = _step3.value;
1922
1937
  productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
1923
1938
  runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
1924
1939
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
1925
- _context18.next = 25;
1940
+ _context18.next = 26;
1926
1941
  break;
1927
1942
  }
1928
- return _context18.abrupt("continue", 33);
1929
- case 25:
1930
- product.discount_list = (product.discount_list || []).filter(function (pd) {
1931
- var _pd$discount$resource, _pd$discount;
1932
- 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;
1933
- return rid != null && selectedResourceIds.has(rid);
1934
- });
1943
+ return _context18.abrupt("continue", 35);
1944
+ case 26:
1945
+ product.discount_list = filterSelectedDiscountDetails(product.discount_list);
1946
+ if (Array.isArray(product.product_bundle)) {
1947
+ product.product_bundle = product.product_bundle.map(function (bundle) {
1948
+ var _ref18, _bundle$original_pric;
1949
+ var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
1950
+ var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
1951
+ var restoredBundlePrice = (_ref18 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref18 !== void 0 ? _ref18 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
1952
+ return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
1953
+ price: restoredBundlePrice,
1954
+ bundle_selling_price: restoredBundlePrice
1955
+ } : {}), {}, {
1956
+ discount_list: nextBundleDiscountList
1957
+ });
1958
+ });
1959
+ }
1935
1960
 
1936
1961
  // 券作用于 source(不含 option、不含 bundle);算出新 source 折后价后补回 options
1937
1962
  // 写入含 option 的 main_product_selling_price,再合成 composite 回写 selling_price。
@@ -1950,33 +1975,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1950
1975
  mainPrice: newMainSellingPrice,
1951
1976
  bundle: product.product_bundle
1952
1977
  });
1953
- case 33:
1954
- _context18.next = 19;
1955
- break;
1956
1978
  case 35:
1957
- _context18.next = 40;
1979
+ _context18.next = 20;
1958
1980
  break;
1959
1981
  case 37:
1960
- _context18.prev = 37;
1961
- _context18.t0 = _context18["catch"](17);
1982
+ _context18.next = 42;
1983
+ break;
1984
+ case 39:
1985
+ _context18.prev = 39;
1986
+ _context18.t0 = _context18["catch"](18);
1962
1987
  _iterator3.e(_context18.t0);
1963
- case 40:
1964
- _context18.prev = 40;
1988
+ case 42:
1989
+ _context18.prev = 42;
1965
1990
  _iterator3.f();
1966
- return _context18.finish(40);
1967
- case 43:
1991
+ return _context18.finish(42);
1992
+ case 45:
1968
1993
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1969
- _context18.next = 46;
1994
+ _context18.next = 48;
1970
1995
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1971
- case 46:
1996
+ case 48:
1972
1997
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1973
1998
  return d.isSelected;
1974
1999
  });
1975
- _context18.next = 49;
2000
+ _context18.next = 51;
1976
2001
  return this.store.order.recalculateSummary({
1977
2002
  createIfMissing: true
1978
2003
  });
1979
- case 49:
2004
+ case 51:
1980
2005
  this.store.order.persistTempOrder();
1981
2006
  this.effectsEmit('onDiscountApplied', {
1982
2007
  productList: tempOrder.products,
@@ -1984,17 +2009,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1984
2009
  selectedDiscountList: tempOrder.discount_list,
1985
2010
  tempOrder: tempOrder
1986
2011
  });
1987
- _context18.next = 56;
2012
+ _context18.next = 58;
1988
2013
  break;
1989
- case 53:
1990
- _context18.prev = 53;
2014
+ case 55:
2015
+ _context18.prev = 55;
1991
2016
  _context18.t1 = _context18["catch"](0);
1992
2017
  throw _context18.t1;
1993
- case 56:
2018
+ case 58:
1994
2019
  case "end":
1995
2020
  return _context18.stop();
1996
2021
  }
1997
- }, _callee18, this, [[0, 53], [17, 37, 40, 43]]);
2022
+ }, _callee18, this, [[0, 55], [18, 39, 42, 45]]);
1998
2023
  }));
1999
2024
  function setDiscountSelected(_x14) {
2000
2025
  return _setDiscountSelected.apply(this, arguments);
@@ -2105,7 +2130,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2105
2130
  case 2:
2106
2131
  // this.store.order.persistTempOrder();
2107
2132
  inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
2108
- submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
2133
+ submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
2109
2134
  cacheId: this.cacheId,
2110
2135
  platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
2111
2136
  businessCode: ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code),
@@ -2118,6 +2143,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2118
2143
  paymentStatus: inferredPaymentStatus
2119
2144
  } : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
2120
2145
  smallTicketDataFlag: params.smallTicketDataFlag
2146
+ } : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
2147
+ confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
2121
2148
  } : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
2122
2149
  enhancePayload: params.enhancePayload
2123
2150
  } : {});
@@ -2149,7 +2176,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2149
2176
  throw new Error('BaseSales 解决方案需要 order 模块支持');
2150
2177
  case 2:
2151
2178
  inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
2152
- submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
2179
+ submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
2153
2180
  cacheId: this.cacheId,
2154
2181
  platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
2155
2182
  businessCode: ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code),
@@ -2161,6 +2188,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2161
2188
  paymentStatus: inferredPaymentStatus
2162
2189
  } : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
2163
2190
  smallTicketDataFlag: params.smallTicketDataFlag
2191
+ } : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
2192
+ confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
2164
2193
  } : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
2165
2194
  enhancePayload: params.enhancePayload
2166
2195
  } : {});
@@ -2260,7 +2289,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2260
2289
  key: "syncPaymentsToOrder",
2261
2290
  value: function () {
2262
2291
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
2263
- var _ref18, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
2292
+ var _ref19, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
2264
2293
  var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
2265
2294
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2266
2295
  while (1) switch (_context24.prev = _context24.next) {
@@ -2271,7 +2300,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2271
2300
  }
2272
2301
  throw new Error('order 模块未初始化');
2273
2302
  case 2:
2274
- businessCode = (_ref18 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref18 !== void 0 ? _ref18 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
2303
+ businessCode = (_ref19 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref19 !== void 0 ? _ref19 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
2275
2304
  channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
2276
2305
  syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
2277
2306
  businessCode: businessCode
@@ -2375,7 +2404,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2375
2404
  var _this$otherParams20,
2376
2405
  _paymentRecord$paymen,
2377
2406
  _paymentRecord$create,
2378
- _ref19,
2407
+ _ref20,
2379
2408
  _paymentRecord$origin,
2380
2409
  _this8 = this;
2381
2410
  if (!this.store.order) throw new Error('order 模块未初始化');
@@ -2399,7 +2428,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2399
2428
  var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
2400
2429
  var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
2401
2430
  var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
2402
- var calculatedServiceFee = serviceCharge ? new Decimal((_ref19 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref19 !== void 0 ? _ref19 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
2431
+ var calculatedServiceFee = serviceCharge ? new Decimal((_ref20 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref20 !== void 0 ? _ref20 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
2403
2432
  var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
2404
2433
  service_fee: calculatedServiceFee
2405
2434
  } : {}), {}, {
@@ -2445,9 +2474,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2445
2474
  /** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
2446
2475
  }, {
2447
2476
  key: "updateVoucherOrderPayments",
2448
- value: function updateVoucherOrderPayments(payments) {
2477
+ value: function updateVoucherOrderPayments(payments, options) {
2478
+ if (!this.store.order) throw new Error('order 模块未初始化');
2479
+ return this.store.order.updateVoucherOrderPayments(payments, options);
2480
+ }
2481
+ }, {
2482
+ key: "confirmPendingVoucherPayments",
2483
+ value: function confirmPendingVoucherPayments() {
2484
+ if (!this.store.order) throw new Error('order 模块未初始化');
2485
+ return this.store.order.confirmPendingVoucherPayments();
2486
+ }
2487
+ }, {
2488
+ key: "discardPendingVoucherPayments",
2489
+ value: function discardPendingVoucherPayments() {
2449
2490
  if (!this.store.order) throw new Error('order 模块未初始化');
2450
- return this.store.order.updateVoucherOrderPayments(payments);
2491
+ return this.store.order.discardPendingVoucherPayments();
2451
2492
  }
2452
2493
  }, {
2453
2494
  key: "getWalletProductList",
@@ -2511,7 +2552,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2511
2552
  key: "initWalletData",
2512
2553
  value: function () {
2513
2554
  var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2514
- var _params$order_wait_pa, _ref20, _tempOrder$is_price_i;
2555
+ var _params$order_wait_pa, _ref21, _tempOrder$is_price_i;
2515
2556
  var snapshot, tempOrder, amount, walletBusinessData, result;
2516
2557
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2517
2558
  while (1) switch (_context25.prev = _context25.next) {
@@ -2554,7 +2595,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2554
2595
  },
2555
2596
  products: this.getWalletProductList(),
2556
2597
  order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
2557
- is_price_include_tax: (_ref20 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref20 !== void 0 ? _ref20 : 1
2598
+ is_price_include_tax: (_ref21 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref21 !== void 0 ? _ref21 : 1
2558
2599
  }, snapshot.identity.orderId ? {
2559
2600
  payment_order_id: String(snapshot.identity.orderId)
2560
2601
  } : {});
@@ -2685,7 +2726,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2685
2726
  key: "sendCustomerPayLink",
2686
2727
  value: (function () {
2687
2728
  var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2688
- var orderIds, _ref21, _ref22, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
2729
+ var orderIds, _ref22, _ref23, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
2689
2730
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2690
2731
  while (1) switch (_context27.prev = _context27.next) {
2691
2732
  case 0:
@@ -2706,7 +2747,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2706
2747
  });
2707
2748
  case 6:
2708
2749
  submitResult = _context27.sent;
2709
- orderId = (_ref21 = (_ref22 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref22 !== void 0 ? _ref22 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref21 !== void 0 ? _ref21 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
2750
+ orderId = (_ref22 = (_ref23 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref23 !== void 0 ? _ref23 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref22 !== void 0 ? _ref22 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
2710
2751
  if (orderId) {
2711
2752
  _context27.next = 10;
2712
2753
  break;
@@ -2878,12 +2919,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2878
2919
  });
2879
2920
  _context30.next = 9;
2880
2921
  return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
2881
- var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(_ref23) {
2882
- var _ref25, groupKey, group, productsById;
2922
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(_ref24) {
2923
+ var _ref26, groupKey, group, productsById;
2883
2924
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2884
2925
  while (1) switch (_context29.prev = _context29.next) {
2885
2926
  case 0:
2886
- _ref25 = _slicedToArray(_ref23, 2), groupKey = _ref25[0], group = _ref25[1];
2927
+ _ref26 = _slicedToArray(_ref24, 2), groupKey = _ref26[0], group = _ref26[1];
2887
2928
  _context29.next = 3;
2888
2929
  return _this10.loadProductsForPriceQuery({
2889
2930
  ids: Array.from(group.ids),
@@ -2901,7 +2942,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2901
2942
  }, _callee29);
2902
2943
  }));
2903
2944
  return function (_x25) {
2904
- return _ref24.apply(this, arguments);
2945
+ return _ref25.apply(this, arguments);
2905
2946
  };
2906
2947
  }()));
2907
2948
  case 9:
@@ -3330,14 +3371,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3330
3371
  value: function () {
3331
3372
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
3332
3373
  var _this$otherParams22;
3333
- var _ref26,
3334
- _ref26$cover,
3374
+ var _ref27,
3375
+ _ref27$cover,
3335
3376
  cover,
3336
3377
  _args40 = arguments;
3337
3378
  return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3338
3379
  while (1) switch (_context40.prev = _context40.next) {
3339
3380
  case 0:
3340
- _ref26 = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {}, _ref26$cover = _ref26.cover, cover = _ref26$cover === void 0 ? false : _ref26$cover;
3381
+ _ref27 = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {}, _ref27$cover = _ref27.cover, cover = _ref27$cover === void 0 ? false : _ref27$cover;
3341
3382
  if (cover) {
3342
3383
  this.otherParams = _objectSpread({}, params);
3343
3384
  } else {
@@ -105,7 +105,9 @@ export function transformBaseProductToOrderProduct(params) {
105
105
  var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
106
106
  var matchedVariant = (_ref15 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref15 !== void 0 ? _ref15 : findVariantById(origin, productVariantId);
107
107
  var sourceProductPrice = toPriceString((_ref16 = (_ref17 = (_ref18 = (_ref19 = (_ref20 = (_ref21 = (_ref22 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref22 !== void 0 ? _ref22 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _ref21 !== void 0 ? _ref21 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref20 !== void 0 ? _ref20 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref17 !== void 0 ? _ref17 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price, '0.00');
108
- var lineCompositeTotal = toPriceString((_ref23 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref23 !== void 0 ? _ref23 : (_payload$_extend = payload._extend) === null || _payload$_extend === void 0 ? void 0 : _payload$_extend.total, sourceProductPrice);
108
+ var explicitLineTotal = (_ref23 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref23 !== void 0 ? _ref23 : (_payload$_extend = payload._extend) === null || _payload$_extend === void 0 ? void 0 : _payload$_extend.total;
109
+ var hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
110
+ var lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
109
111
  var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
110
112
  var productOptionItem = normalizeProductSkuOptions(normalizeOptionItems((_ref24 = (_ref25 = (_payload$product_sku$ = (_payload$product_sku = payload.product_sku) === null || _payload$product_sku === void 0 ? void 0 : _payload$product_sku.option) !== null && _payload$product_sku$ !== void 0 ? _payload$product_sku$ : payload.option) !== null && _ref25 !== void 0 ? _ref25 : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item));
111
113
  var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride);
@@ -148,7 +150,7 @@ export function transformBaseProductToOrderProduct(params) {
148
150
  mainPrice: 0,
149
151
  bundle: productBundle
150
152
  });
151
- var derivedMainSelling = Number(lineCompositeTotal) - Number(bundleOnlyComposite);
153
+ var derivedMainSelling = hasExplicitLineTotal ? Number(lineCompositeTotal) - Number(bundleOnlyComposite) : Number(mainProductOriginalPrice);
152
154
  var mainProductSellingPrice = toPriceString(Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice));
153
155
  var metadata = _objectSpread(_objectSpread({
154
156
  unique: payload.unique,
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 2 | 6 | 3 | 4 | 5;
314
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;