@pisell/pisellos 2.3.44 → 2.3.46

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 (147) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Discount/index.d.ts +0 -1
  3. package/dist/modules/Discount/index.js +11 -40
  4. package/dist/modules/Discount/types.d.ts +0 -1
  5. package/dist/modules/OpenData/index.js +2 -2
  6. package/dist/modules/Order/index.d.ts +2 -4
  7. package/dist/modules/Order/index.js +25 -54
  8. package/dist/modules/Order/types.d.ts +0 -9
  9. package/dist/modules/Order/utils.d.ts +0 -10
  10. package/dist/modules/Order/utils.js +3 -35
  11. package/dist/modules/Product/types.d.ts +0 -1
  12. package/dist/modules/ProductList/index.js +14 -33
  13. package/dist/modules/Quotation/index.d.ts +1 -1
  14. package/dist/modules/Quotation/index.js +2 -2
  15. package/dist/modules/Rules/index.js +13 -47
  16. package/dist/modules/SalesSummary/index.js +13 -12
  17. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  18. package/dist/modules/ScanOrderLogger/index.js +2 -15
  19. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  20. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  21. package/dist/modules/Schedule/index.d.ts +1 -3
  22. package/dist/modules/Schedule/index.js +16 -21
  23. package/dist/modules/Summary/utils.js +13 -38
  24. package/dist/modules/index.d.ts +0 -2
  25. package/dist/modules/index.js +1 -3
  26. package/dist/plugins/window.d.ts +0 -1
  27. package/dist/server/index.d.ts +0 -14
  28. package/dist/server/index.js +657 -772
  29. package/dist/solution/BaseSales/index.d.ts +0 -7
  30. package/dist/solution/BaseSales/index.js +42 -64
  31. package/dist/solution/BookingByStep/index.d.ts +1 -16
  32. package/dist/solution/BookingByStep/index.js +215 -294
  33. package/dist/solution/BookingByStep/types.d.ts +1 -2
  34. package/dist/solution/BookingByStep/types.js +1 -3
  35. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  36. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  37. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  38. package/dist/solution/BookingTicket/index.d.ts +2 -14
  39. package/dist/solution/BookingTicket/index.js +2 -2
  40. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  41. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  42. package/dist/solution/ScanOrder/index.d.ts +14 -26
  43. package/dist/solution/ScanOrder/index.js +739 -1142
  44. package/dist/solution/ScanOrder/types.d.ts +1 -21
  45. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  46. package/dist/solution/ScanOrder/utils.js +25 -66
  47. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  48. package/dist/solution/ShopDiscount/index.js +87 -125
  49. package/dist/solution/VenueBooking/index.d.ts +11 -39
  50. package/dist/solution/VenueBooking/index.js +841 -1167
  51. package/dist/solution/VenueBooking/types.d.ts +0 -3
  52. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  53. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  54. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  55. package/dist/solution/index.d.ts +0 -1
  56. package/dist/solution/index.js +1 -2
  57. package/dist/types/index.d.ts +0 -1
  58. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  59. package/lib/modules/Discount/index.d.ts +0 -1
  60. package/lib/modules/Discount/index.js +0 -9
  61. package/lib/modules/Discount/types.d.ts +0 -1
  62. package/lib/modules/OpenData/index.js +1 -1
  63. package/lib/modules/Order/index.d.ts +2 -4
  64. package/lib/modules/Order/index.js +10 -26
  65. package/lib/modules/Order/types.d.ts +0 -9
  66. package/lib/modules/Order/utils.d.ts +0 -10
  67. package/lib/modules/Order/utils.js +5 -36
  68. package/lib/modules/Product/types.d.ts +0 -1
  69. package/lib/modules/ProductList/index.js +31 -40
  70. package/lib/modules/Quotation/index.d.ts +1 -1
  71. package/lib/modules/Quotation/index.js +2 -2
  72. package/lib/modules/Rules/index.js +16 -33
  73. package/lib/modules/SalesSummary/index.js +7 -6
  74. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  75. package/lib/modules/ScanOrderLogger/index.js +1 -13
  76. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  77. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  78. package/lib/modules/Schedule/index.d.ts +1 -3
  79. package/lib/modules/Schedule/index.js +8 -10
  80. package/lib/modules/Summary/utils.js +1 -21
  81. package/lib/modules/index.d.ts +0 -2
  82. package/lib/modules/index.js +1 -5
  83. package/lib/plugins/window.d.ts +0 -1
  84. package/lib/server/index.d.ts +0 -14
  85. package/lib/server/index.js +5 -65
  86. package/lib/solution/BaseSales/index.d.ts +0 -7
  87. package/lib/solution/BaseSales/index.js +8 -24
  88. package/lib/solution/BookingByStep/index.d.ts +1 -16
  89. package/lib/solution/BookingByStep/index.js +18 -60
  90. package/lib/solution/BookingByStep/types.d.ts +1 -2
  91. package/lib/solution/BookingByStep/types.js +0 -5
  92. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  93. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  94. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  95. package/lib/solution/BookingTicket/index.d.ts +2 -14
  96. package/lib/solution/BookingTicket/index.js +2 -10
  97. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  98. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  99. package/lib/solution/ScanOrder/index.d.ts +14 -26
  100. package/lib/solution/ScanOrder/index.js +182 -449
  101. package/lib/solution/ScanOrder/types.d.ts +1 -21
  102. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  103. package/lib/solution/ScanOrder/utils.js +0 -31
  104. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  105. package/lib/solution/ShopDiscount/index.js +0 -14
  106. package/lib/solution/VenueBooking/index.d.ts +11 -39
  107. package/lib/solution/VenueBooking/index.js +110 -322
  108. package/lib/solution/VenueBooking/types.d.ts +0 -3
  109. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  110. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  111. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  112. package/lib/solution/index.d.ts +0 -1
  113. package/lib/solution/index.js +1 -3
  114. package/lib/types/index.d.ts +0 -1
  115. package/package.json +1 -1
  116. package/dist/modules/Holder/index.d.ts +0 -48
  117. package/dist/modules/Holder/index.js +0 -640
  118. package/dist/modules/Holder/types.d.ts +0 -123
  119. package/dist/modules/Holder/types.js +0 -1
  120. package/dist/modules/Holder/utils.d.ts +0 -13
  121. package/dist/modules/Holder/utils.js +0 -34
  122. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  123. package/dist/modules/ResourcePlanner/index.js +0 -181
  124. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  125. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  126. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  127. package/dist/modules/ResourcePlanner/types.js +0 -1
  128. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  129. package/dist/solution/UnifiedBookingSales/index.js +0 -1891
  130. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  131. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  132. package/lib/modules/Holder/index.d.ts +0 -48
  133. package/lib/modules/Holder/index.js +0 -402
  134. package/lib/modules/Holder/types.d.ts +0 -123
  135. package/lib/modules/Holder/types.js +0 -17
  136. package/lib/modules/Holder/utils.d.ts +0 -13
  137. package/lib/modules/Holder/utils.js +0 -71
  138. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  139. package/lib/modules/ResourcePlanner/index.js +0 -148
  140. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  141. package/lib/modules/ResourcePlanner/planner.js +0 -933
  142. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  143. package/lib/modules/ResourcePlanner/types.js +0 -17
  144. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  145. package/lib/solution/UnifiedBookingSales/index.js +0 -1084
  146. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  147. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -305,8 +305,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
305
305
  _id: product._id,
306
306
  parentId: product._id,
307
307
  quantity: product.quantity,
308
- num: product.num,
309
- booking_id: product.booking_id
308
+ num: product.num
310
309
  });
311
310
  if (product.bundle && Array.isArray(product.bundle) && product.bundle.length > 0) {
312
311
  product.bundle.forEach((bundleItem, bundleIndex) => {
@@ -327,7 +326,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
327
326
  origin_total: new import_decimal.default(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
328
327
  original_price: bundleItem.original_price,
329
328
  // 继承主商品属性
330
- booking_id: bundleItem.booking_id,
329
+ booking_id: product.booking_id,
331
330
  discount_list: bundleItem.discount_list || []
332
331
  });
333
332
  });
@@ -689,8 +688,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
689
688
  discount_product_id: discount.product_id
690
689
  },
691
690
  metadata: {
692
- num,
693
- discount_rule_uncheck_flag: discount == null ? void 0 : discount.discount_rule_uncheck_flag
691
+ num
694
692
  }
695
693
  };
696
694
  applicableProducts.push(productData);
@@ -1138,7 +1136,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1138
1136
  config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
1139
1137
  metadata: {
1140
1138
  num: 1,
1141
- discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1142
1139
  // 🔥 order_level 分摊差值
1143
1140
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference },
1144
1141
  /** 仅主商品上的优惠金额(不含 option) */
@@ -1219,7 +1216,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1219
1216
  metadata: {
1220
1217
  // 🔥 使用拆分后的唯一 _id
1221
1218
  custom_product_bundle_map_id: uniqueId,
1222
- discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1223
1219
  num: 1
1224
1220
  },
1225
1221
  _num: 1,
@@ -1249,7 +1245,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1249
1245
  _id: `${flatItem._id}_split_rest`,
1250
1246
  num: normalNum,
1251
1247
  quantity: normalNum,
1252
- discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion"),
1248
+ discount_list: [],
1253
1249
  processed: true
1254
1250
  });
1255
1251
  }
@@ -1298,7 +1294,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1298
1294
  metadata: {
1299
1295
  // 🔥 使用唯一的 _id
1300
1296
  custom_product_bundle_map_id: uniqueId,
1301
- discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1302
1297
  num: product.num || 1,
1303
1298
  // 🔥 order_level 分摊差值
1304
1299
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
@@ -1313,7 +1308,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1313
1308
  ...flatItem,
1314
1309
  total: targetProductTotal,
1315
1310
  price: new import_decimal.default(productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
1316
- discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion").concat([discountDetail]),
1311
+ discount_list: [discountDetail],
1317
1312
  processed: true
1318
1313
  });
1319
1314
  }
@@ -1734,7 +1729,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1734
1729
  * @returns 是否可用
1735
1730
  */
1736
1731
  checkPackageSubItemUsageRules(discount, flatItem) {
1737
- var _a, _b, _c, _d, _e, _f, _g, _h;
1732
+ var _a, _b, _c, _d, _e, _f, _g;
1738
1733
  const limitedData = discount.limited_relation_product_data;
1739
1734
  const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
1740
1735
  const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
@@ -1746,7 +1741,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1746
1741
  const { type: scopeType, exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
1747
1742
  const isMainProduct = flatItem.type === "main";
1748
1743
  const isBundleItem = flatItem.type === "bundle";
1749
- const bundleMainProductId = (_a = flatItem.product) == null ? void 0 : _a.product_id;
1750
1744
  if (isMainProduct) {
1751
1745
  return true;
1752
1746
  }
@@ -1755,9 +1749,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1755
1749
  return true;
1756
1750
  }
1757
1751
  if (isBundleItem) {
1758
- const priceType = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type;
1759
- const priceTypeExt = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type_ext;
1760
- const mainProductId = ((_e = (_d = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _d._productOrigin) == null ? void 0 : _e.id) || ((_f = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _f.id) || 0;
1752
+ const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
1753
+ const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
1754
+ const mainProductId = ((_d = (_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c._productOrigin) == null ? void 0 : _d.id) || ((_e = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _e.id) || 0;
1761
1755
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1762
1756
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1763
1757
  if (rules.length > 0) {
@@ -1769,11 +1763,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1769
1763
  if (!filter) {
1770
1764
  isScopeValid = true;
1771
1765
  } else {
1772
- isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
1766
+ isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
1773
1767
  }
1774
1768
  }
1775
1769
  if (scopeType === "specific_packages" || scopeType === "products") {
1776
- isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
1770
+ isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
1777
1771
  }
1778
1772
  if (isPriceValid && isScopeValid) {
1779
1773
  return true;
@@ -1789,26 +1783,15 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1789
1783
  return false;
1790
1784
  }
1791
1785
  if (isBundleItem) {
1792
- const priceType = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type;
1793
- const priceTypeExt = (_h = flatItem.bundleItem) == null ? void 0 : _h.price_type_ext;
1786
+ const priceType = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type;
1787
+ const priceTypeExt = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type_ext;
1794
1788
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1795
1789
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1796
1790
  if (rules.length > 0) {
1797
- const _isOriginalPrice = isOriginalPrice && rules.includes("original_price");
1798
- const _isMarkupPrice = isMarkupPrice && rules.includes("markup_price");
1799
- const isPriceValid = _isOriginalPrice || _isMarkupPrice;
1800
- let isScopeValid = false;
1801
- if (scopeType === "all_packages" || scopeType === "product_all") {
1802
- if (!filter) {
1803
- isScopeValid = true;
1804
- } else {
1805
- isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
1806
- }
1807
- }
1808
- if (scopeType === "specific_packages" || scopeType === "products") {
1809
- isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
1791
+ if (isOriginalPrice && rules.includes("original_price")) {
1792
+ return true;
1810
1793
  }
1811
- if (isPriceValid && isScopeValid) {
1794
+ if (isMarkupPrice && rules.includes("markup_price")) {
1812
1795
  return true;
1813
1796
  }
1814
1797
  return false;
@@ -53,6 +53,9 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
53
53
  this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
54
54
  this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
55
55
  this.surchargeListModuleName = ((_c = this.otherParams) == null ? void 0 : _c.surchargeListModuleName) || "surchargeList";
56
+ if (!this.appPlugin) {
57
+ throw new Error("SalesSummaryModule 需要 app 插件支持");
58
+ }
56
59
  if (!this.request) {
57
60
  throw new Error("SalesSummaryModule 需要 request 插件支持");
58
61
  }
@@ -106,14 +109,12 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
106
109
  }
107
110
  }
108
111
  getAppData(key) {
109
- var _a, _b, _c, _d, _e, _f, _g, _h;
110
- const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
112
+ var _a, _b, _c, _d, _e, _f;
113
+ const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
111
114
  if (typeof getData === "function")
112
115
  return getData(key);
113
- const app = (_d = (_c = this.appPlugin) == null ? void 0 : _c.getApp) == null ? void 0 : _d.call(_c);
114
- if (!app)
115
- return void 0;
116
- const coreData = (_h = (_f = (_e = app == null ? void 0 : app.models) == null ? void 0 : _e.getStore) == null ? void 0 : (_g = _f.call(_e)).getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
116
+ const app = this.appPlugin.getApp();
117
+ const coreData = (_f = (_d = (_c = app == null ? void 0 : app.models) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core", "core");
117
118
  return coreData == null ? void 0 : coreData[key];
118
119
  }
119
120
  getTaxConfig() {
@@ -11,12 +11,10 @@ export declare class ScanOrderLoggerModule extends BaseModule implements Module,
11
11
  protected defaultName: string;
12
12
  protected defaultVersion: string;
13
13
  private store;
14
- private window?;
15
14
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
16
15
  setContext(context: ScanOrderLoggerContext): void;
17
16
  setProvider(provider: ScanOrderLoggerProviderType): void;
18
17
  setProviderConfig(providerConfig: ScanOrderLoggerProviderConfig): void;
19
- private getCurrentHost;
20
18
  private buildRecord;
21
19
  addLog(params: ScanOrderLogInput): Promise<void>;
22
20
  }
@@ -60,7 +60,6 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
60
60
  var _a, _b, _c;
61
61
  this.core = core;
62
62
  this.store = options.store;
63
- this.window = core.getPlugin("window") || void 0;
64
63
  const provider = ((_a = options.otherParams) == null ? void 0 : _a.provider) || "feishu";
65
64
  const providerConfig = ((_b = options.otherParams) == null ? void 0 : _b.providerConfig) || {};
66
65
  const context = ((_c = options.otherParams) == null ? void 0 : _c.context) || {};
@@ -102,25 +101,14 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
102
101
  }
103
102
  };
104
103
  }
105
- getCurrentHost() {
106
- var _a, _b;
107
- const host = (_b = (_a = this.window) == null ? void 0 : _a.location) == null ? void 0 : _b.host;
108
- if (typeof host === "string" && host.length > 0)
109
- return host;
110
- return void 0;
111
- }
112
104
  buildRecord(params) {
113
- const host = this.getCurrentHost();
114
105
  return {
115
106
  level: params.level || "info",
116
107
  title: params.title,
117
108
  timestamp: params.timestamp || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
118
109
  payload: params.payload || {},
119
110
  extra: params.extra || {},
120
- context: {
121
- ...this.store.context || {},
122
- ...host ? { host } : {}
123
- }
111
+ context: this.store.context || {}
124
112
  };
125
113
  }
126
114
  async addLog(params) {
@@ -112,29 +112,20 @@ async function flushQueue() {
112
112
  }
113
113
  var feishuLoggerProvider = {
114
114
  async send(payload) {
115
- var _a, _b, _c, _d, _e, _f;
115
+ var _a, _b, _c, _d;
116
116
  cachedProviderConfig = payload.providerConfig;
117
117
  const webhook = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.feishu) == null ? void 0 : _b.webhook;
118
- const errorHook = (_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.errorHook;
119
- if (typeof fetch !== "function") {
120
- console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
121
- return;
122
- }
123
- if (payload.record.level === "error" && isWebhookUsable(errorHook)) {
124
- try {
125
- await postToFeishu(errorHook, buildFeishuBody([payload.record]));
126
- } catch (error) {
127
- console.warn("[ScanOrderLogger] Feishu errorHook 上报失败", error);
128
- }
129
- return;
130
- }
131
118
  if (!webhook) {
132
119
  console.warn("[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报");
133
120
  return;
134
121
  }
135
122
  if (!isWebhookUsable(webhook))
136
123
  return;
137
- const throttleMs = ((_f = (_e = payload.providerConfig) == null ? void 0 : _e.feishu) == null ? void 0 : _f.throttleMs) ?? DEFAULT_THROTTLE_MS;
124
+ if (typeof fetch !== "function") {
125
+ console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
126
+ return;
127
+ }
128
+ const throttleMs = ((_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.throttleMs) ?? DEFAULT_THROTTLE_MS;
138
129
  if (throttleMs <= 0) {
139
130
  try {
140
131
  await postToFeishu(webhook, buildFeishuBody([payload.record]));
@@ -2,7 +2,6 @@ export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
2
2
  export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
3
3
  export interface ScanOrderLoggerProviderFeishuConfig {
4
4
  webhook?: string;
5
- errorHook?: string;
6
5
  /**
7
6
  * 节流窗口毫秒数,默认 3000ms
8
7
  * - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
@@ -24,9 +24,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
24
24
  *
25
25
  * @memberof ScheduleModule
26
26
  */
27
- loadAllSchedule(options?: {
28
- useCache?: boolean;
29
- }): Promise<void>;
27
+ loadAllSchedule(): Promise<void>;
30
28
  setScheduleList(list: ScheduleItem[]): void;
31
29
  private syncScheduleMap;
32
30
  getScheduleList(): ScheduleItem[];
@@ -95,12 +95,12 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
95
95
  *
96
96
  * @memberof ScheduleModule
97
97
  */
98
- async loadAllSchedule(options = {}) {
98
+ async loadAllSchedule() {
99
99
  var _a;
100
100
  const scheduleList = await this.request.get(
101
101
  `/schedule`,
102
102
  { num: 999 },
103
- { useCache: options.useCache ?? true }
103
+ { useCache: true }
104
104
  );
105
105
  this.setScheduleList(((_a = scheduleList.data) == null ? void 0 : _a.list) || []);
106
106
  }
@@ -126,6 +126,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
126
126
  custom_page_id,
127
127
  channel
128
128
  }) {
129
+ var _a, _b, _c;
129
130
  if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
130
131
  startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
131
132
  }
@@ -143,20 +144,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
143
144
  channel
144
145
  }
145
146
  );
146
- const responseData = res.data || {};
147
- const dateList = Array.isArray(responseData.date_list) ? responseData.date_list : [];
148
- const otherProductIds = Array.isArray(responseData.other_product_ids) ? responseData.other_product_ids : [];
149
- this.setAvailabilityScheduleDateList(dateList);
150
- this.setOtherProductsIds(otherProductIds);
151
- if (!dateList.length && !otherProductIds.length || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
147
+ this.setAvailabilityScheduleDateList(res.data.date_list);
148
+ this.setOtherProductsIds(res.data.other_product_ids || []);
149
+ if (!((_a = res.data.date_list) == null ? void 0 : _a.length) && !((_b = res.data.other_product_ids) == null ? void 0 : _b.length) || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
152
150
  return dates;
153
151
  }
154
- if (otherProductIds.length) {
152
+ if ((_c = res.data.other_product_ids) == null ? void 0 : _c.length) {
155
153
  dates.forEach((n) => {
156
154
  n.status = "available";
157
155
  });
158
156
  } else {
159
- dateList.forEach((n) => {
157
+ res.data.date_list.forEach((n) => {
160
158
  const index = dates.findIndex((m) => m.date === n.date);
161
159
  if (index !== -1) {
162
160
  dates[index].status = "available";
@@ -437,31 +437,11 @@ var getBundleItemIsDiscountPrice = (item) => {
437
437
  var getBundleItemIsMarkupOrDiscountPrice = (item) => {
438
438
  return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
439
439
  };
440
- var getDiscountAmount = (discounts) => {
441
- return (discounts || []).reduce((total, discount) => {
442
- return total.add(new import_decimal.default(discount.amount || 0));
443
- }, new import_decimal.default(0)).toNumber();
444
- };
445
440
  var getMainProductTotal = (item) => {
446
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
441
+ var _a, _b;
447
442
  let total = new import_decimal.default(
448
443
  (item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.main_product_original_price) ?? 0
449
444
  );
450
- const hasMainProductPrice = (item == null ? void 0 : item.main_product_selling_price) != null || ((_c = item == null ? void 0 : item.metadata) == null ? void 0 : _c.main_product_selling_price) != null || ((_d = item == null ? void 0 : item.metadata) == null ? void 0 : _d.main_product_original_price) != null;
451
- if (!hasMainProductPrice) {
452
- total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_e = item == null ? void 0 : item.metadata) == null ? void 0 : _e.main_product_selling_price) ?? item.price ?? 0);
453
- const discount = ((_g = (_f = item == null ? void 0 : item._origin) == null ? void 0 : _f.product) == null ? void 0 : _g.discount_list) || ((_j = (_i = (_h = item == null ? void 0 : item._originData) == null ? void 0 : _h.product) == null ? void 0 : _i.discount_list) == null ? void 0 : _j.filter((item2) => {
454
- var _a2;
455
- return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
456
- })) || [];
457
- const mainProductDiscountAmount = getDiscountAmount(discount);
458
- total = total.minus(mainProductDiscountAmount);
459
- if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
460
- total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
461
- return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
462
- }, new import_decimal.default(0)));
463
- }
464
- }
465
445
  for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
466
446
  if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
467
447
  const bundleItemTotal = new import_decimal.default(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
@@ -18,5 +18,3 @@ export * from './Quotation';
18
18
  export * from './ScanOrderLogger';
19
19
  export * from './OpenData';
20
20
  export * from './BookingContext';
21
- export * from './Holder';
22
- export * from './ResourcePlanner';
@@ -36,8 +36,6 @@ __reExport(modules_exports, require("./Quotation"), module.exports);
36
36
  __reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
37
37
  __reExport(modules_exports, require("./OpenData"), module.exports);
38
38
  __reExport(modules_exports, require("./BookingContext"), module.exports);
39
- __reExport(modules_exports, require("./Holder"), module.exports);
40
- __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
41
39
  // Annotate the CommonJS export names for ESM import in node:
42
40
  0 && (module.exports = {
43
41
  ...require("./Product"),
@@ -59,7 +57,5 @@ __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
59
57
  ...require("./Quotation"),
60
58
  ...require("./ScanOrderLogger"),
61
59
  ...require("./OpenData"),
62
- ...require("./BookingContext"),
63
- ...require("./Holder"),
64
- ...require("./ResourcePlanner")
60
+ ...require("./BookingContext")
65
61
  });
@@ -16,7 +16,6 @@ export interface WindowPlugin extends Plugin {
16
16
  history: History;
17
17
  interaction?: any;
18
18
  getWalletPassEvaluator?: () => WalletPassEvaluator;
19
- getLocalStorage?: (key: string) => string | null;
20
19
  }
21
20
  /**
22
21
  * 简单的 Storage 接口实现
@@ -49,10 +49,6 @@ declare class Server {
49
49
  private productQuerySubscribers;
50
50
  /** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
51
51
  private productQueryScheduleTimers;
52
- /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
53
- private menuScheduleRefreshInFlight;
54
- private lastMenuScheduleRefreshAt;
55
- private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
56
52
  private orderQuerySubscribers;
57
53
  private bookingQuerySubscribers;
58
54
  private bookingRemoteQuerySubscribers;
@@ -266,16 +262,6 @@ declare class Server {
266
262
  * 存储订阅者信息,便于数据变更时推送最新结果
267
263
  */
268
264
  private handleProductQuery;
269
- /**
270
- * ProductList callers such as standalone retail pages do not always have a selected schedule.
271
- * In that case query against the current local time so menu availability can still be evaluated.
272
- */
273
- private resolveProductQueryScheduleContext;
274
- /**
275
- * OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
276
- * 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
277
- */
278
- private refreshMenuScheduleCacheAfterEmptyResult;
279
265
  /**
280
266
  * 按商品 id 查询单条(GET /shop/product/query/:productId)
281
267
  * schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。
@@ -82,10 +82,6 @@ var Server = class {
82
82
  this.productQuerySubscribers = /* @__PURE__ */ new Map();
83
83
  /** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
84
84
  this.productQueryScheduleTimers = /* @__PURE__ */ new Map();
85
- /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
86
- this.menuScheduleRefreshInFlight = null;
87
- this.lastMenuScheduleRefreshAt = 0;
88
- this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS = 30 * 1e3;
89
85
  // ---- 订单 / 预约列表查询订阅者 ----
90
86
  this.orderQuerySubscribers = /* @__PURE__ */ new Map();
91
87
  this.bookingQuerySubscribers = /* @__PURE__ */ new Map();
@@ -219,11 +215,7 @@ var Server = class {
219
215
  */
220
216
  this.handleProductQuery = async ({ url, method, data, config }) => {
221
217
  console.log("[Server] handleProductQuery:", url, method, data, config);
222
- const { menu_list_ids, customer_id, ids, extension_type, strategy_context } = data;
223
- const { schedule_date, schedule_datetime } = this.resolveProductQueryScheduleContext({
224
- schedule_date: data.schedule_date,
225
- schedule_datetime: data.schedule_datetime
226
- });
218
+ const { menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, extension_type, strategy_context } = data;
227
219
  const { callback, subscriberId } = config || {};
228
220
  this.logInfo("handleProductQuery: 开始处理商品查询请求", {
229
221
  menu_list_ids,
@@ -2285,43 +2277,6 @@ var Server = class {
2285
2277
  this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
2286
2278
  }
2287
2279
  }
2288
- /**
2289
- * ProductList callers such as standalone retail pages do not always have a selected schedule.
2290
- * In that case query against the current local time so menu availability can still be evaluated.
2291
- */
2292
- resolveProductQueryScheduleContext(params) {
2293
- const now = (0, import_dayjs.default)();
2294
- const schedule_datetime = typeof params.schedule_datetime === "string" && params.schedule_datetime.trim() ? params.schedule_datetime : now.format("YYYY-MM-DD HH:mm:ss");
2295
- const schedule_date = typeof params.schedule_date === "string" && params.schedule_date.trim() ? params.schedule_date : (0, import_dayjs.default)(schedule_datetime).isValid() ? (0, import_dayjs.default)(schedule_datetime).format("YYYY-MM-DD") : now.format("YYYY-MM-DD");
2296
- return { schedule_date, schedule_datetime };
2297
- }
2298
- /**
2299
- * OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
2300
- * 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
2301
- */
2302
- async refreshMenuScheduleCacheAfterEmptyResult() {
2303
- if (!this.menu || !this.schedule)
2304
- return false;
2305
- const now = Date.now();
2306
- if (now - this.lastMenuScheduleRefreshAt < this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS) {
2307
- return false;
2308
- }
2309
- if (!this.menuScheduleRefreshInFlight) {
2310
- this.lastMenuScheduleRefreshAt = now;
2311
- this.menuScheduleRefreshInFlight = Promise.all([
2312
- this.menu.loadMenuList(),
2313
- this.schedule.loadAllSchedule()
2314
- ]).then(() => void 0).catch((error) => {
2315
- this.logWarning("刷新菜单/日程缓存失败,继续使用现有缓存", {
2316
- error: error instanceof Error ? error.message : String(error)
2317
- });
2318
- }).finally(() => {
2319
- this.menuScheduleRefreshInFlight = null;
2320
- });
2321
- }
2322
- await this.menuScheduleRefreshInFlight;
2323
- return true;
2324
- }
2325
2280
  /**
2326
2281
  * 执行 sales 搜索并登记可见订单号。
2327
2282
  * 搜索参数完全透传后端,OS 不做过滤、筛选、排序。
@@ -3824,22 +3779,10 @@ var Server = class {
3824
3779
  data: (normalized == null ? void 0 : normalized.data) ?? null
3825
3780
  };
3826
3781
  }
3827
- const response = this.withSyncedOrderIdInCheckoutResponse(
3782
+ return this.withSyncedOrderIdInCheckoutResponse(
3828
3783
  syncResult.normalizedResponse,
3829
3784
  syncResult.syncedOrder
3830
3785
  );
3831
- const syncedOrder = syncResult.syncedOrder;
3832
- if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData) && this.isSalesOrderFullyPaid(syncedOrder)) {
3833
- await this.dispatchLocalReceiptPrint({
3834
- checkoutData: syncResult.checkoutData,
3835
- order: syncedOrder,
3836
- response: syncResult.normalizedResponse,
3837
- requireFullyPaid: true,
3838
- // print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
3839
- isManualPrint: true
3840
- });
3841
- }
3842
- return response;
3843
3786
  } catch (error) {
3844
3787
  const backendError = this.extractBackendErrorResponse(error);
3845
3788
  if (backendError) {
@@ -5129,16 +5072,13 @@ var Server = class {
5129
5072
  let activeMenuList = [];
5130
5073
  if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
5131
5074
  const tMenu = performance.now();
5132
- const getActiveMenus = () => this.menu.getMenuByIds(menu_list_ids).filter((menu) => {
5075
+ const menuList = this.menu.getMenuByIds(menu_list_ids);
5076
+ activeMenuList = menuList.filter((menu) => {
5133
5077
  var _a;
5134
5078
  return ((_a = this.schedule) == null ? void 0 : _a.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
5135
5079
  });
5136
- activeMenuList = getActiveMenus();
5137
- if (!activeMenuList.length && await this.refreshMenuScheduleCacheAfterEmptyResult()) {
5138
- activeMenuList = getActiveMenus();
5139
- }
5140
5080
  (0, import_product.perfMark)("computeQuery.filterActiveMenu", performance.now() - tMenu, {
5141
- totalMenu: menu_list_ids.length,
5081
+ totalMenu: menuList.length,
5142
5082
  activeMenu: activeMenuList.length
5143
5083
  });
5144
5084
  }
@@ -280,13 +280,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
280
280
  confirmPendingVoucherPayments?: boolean;
281
281
  enhancePayload?: SubmitPayloadEnhancer;
282
282
  }): Promise<T>;
283
- /**
284
- * 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
285
- * otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
286
- */
287
- protected shouldUseCheckoutSyncTask(): boolean;
288
- /** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
289
- protected getDefaultCheckoutSmallTicketDataFlag(): number | undefined;
290
283
  printLocalOrderReceipt<T = any>(lookup?: BaseSalesPrintLocalOrderReceiptParams): Promise<T>;
291
284
  private getSubmitPaymentStatus;
292
285
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;