@pisell/pisellos 0.0.480 → 0.0.481

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/core/index.d.ts +3 -2
  2. package/dist/core/index.js +7 -0
  3. package/dist/effects/index.d.ts +2 -2
  4. package/dist/effects/index.js +34 -81
  5. package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
  6. package/dist/model/strategy/adapter/walletPass/type.d.ts +9 -2
  7. package/dist/model/strategy/adapter/walletPass/utils.d.ts +6 -6
  8. package/dist/model/strategy/adapter/walletPass/utils.js +104 -77
  9. package/dist/modules/Customer/index.js +1 -1
  10. package/dist/modules/Discount/index.d.ts +6 -2
  11. package/dist/modules/Discount/index.js +14 -8
  12. package/dist/modules/Order/index.d.ts +1 -1
  13. package/dist/modules/Order/index.js +18 -13
  14. package/dist/modules/Payment/index.d.ts +4 -0
  15. package/dist/modules/Payment/index.js +774 -649
  16. package/dist/modules/Payment/walletpass.js +44 -17
  17. package/dist/modules/Product/index.d.ts +1 -1
  18. package/dist/modules/Product/types.d.ts +2 -0
  19. package/dist/modules/ProductList/index.d.ts +3 -0
  20. package/dist/modules/ProductList/index.js +9 -7
  21. package/dist/modules/Rules/index.d.ts +2 -2
  22. package/dist/modules/Rules/index.js +37 -31
  23. package/dist/modules/Rules/types.d.ts +2 -2
  24. package/dist/modules/Schedule/index.d.ts +9 -0
  25. package/dist/modules/Schedule/index.js +15 -2
  26. package/dist/plugins/app-types/app/app.d.ts +1 -0
  27. package/dist/plugins/request.d.ts +2 -0
  28. package/dist/server/index.d.ts +107 -2
  29. package/dist/server/index.js +1507 -279
  30. package/dist/server/modules/index.d.ts +6 -0
  31. package/dist/server/modules/index.js +7 -0
  32. package/dist/server/modules/menu/index.d.ts +19 -0
  33. package/dist/server/modules/menu/index.js +221 -71
  34. package/dist/server/modules/order/index.d.ts +87 -0
  35. package/dist/server/modules/order/index.js +916 -0
  36. package/dist/server/modules/order/types.d.ts +530 -0
  37. package/dist/server/modules/order/types.js +141 -0
  38. package/dist/server/modules/order/utils/filterBookings.d.ts +6 -0
  39. package/dist/server/modules/order/utils/filterBookings.js +350 -0
  40. package/dist/server/modules/order/utils/filterOrders.d.ts +15 -0
  41. package/dist/server/modules/order/utils/filterOrders.js +226 -0
  42. package/dist/server/modules/products/index.d.ts +117 -5
  43. package/dist/server/modules/products/index.js +1450 -240
  44. package/dist/server/modules/products/types.d.ts +25 -1
  45. package/dist/server/modules/products/types.js +3 -0
  46. package/dist/server/modules/resource/index.d.ts +86 -0
  47. package/dist/server/modules/resource/index.js +1128 -0
  48. package/dist/server/modules/resource/types.d.ts +121 -0
  49. package/dist/server/modules/resource/types.js +47 -0
  50. package/dist/server/modules/schedule/index.d.ts +19 -0
  51. package/dist/server/modules/schedule/index.js +229 -68
  52. package/dist/server/utils/product.d.ts +5 -0
  53. package/dist/server/utils/product.js +71 -31
  54. package/dist/solution/BookingTicket/index.d.ts +10 -2
  55. package/dist/solution/BookingTicket/index.js +41 -28
  56. package/dist/solution/BookingTicket/utils/scan/index.js +1 -1
  57. package/dist/solution/Checkout/index.d.ts +1 -0
  58. package/dist/solution/Checkout/index.js +286 -188
  59. package/dist/solution/Checkout/utils/index.d.ts +2 -1
  60. package/dist/solution/Checkout/utils/index.js +6 -4
  61. package/dist/solution/RegisterAndLogin/config.js +340 -1
  62. package/dist/solution/Sales/index.d.ts +96 -0
  63. package/dist/solution/Sales/index.js +566 -0
  64. package/dist/solution/Sales/types.d.ts +67 -0
  65. package/dist/solution/Sales/types.js +26 -0
  66. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  67. package/dist/solution/ShopDiscount/index.js +35 -22
  68. package/dist/solution/ShopDiscount/types.d.ts +6 -0
  69. package/dist/solution/ShopDiscount/utils.d.ts +9 -0
  70. package/dist/solution/ShopDiscount/utils.js +21 -27
  71. package/dist/solution/index.d.ts +2 -1
  72. package/dist/solution/index.js +2 -1
  73. package/dist/types/index.d.ts +5 -0
  74. package/lib/core/index.d.ts +3 -2
  75. package/lib/core/index.js +4 -0
  76. package/lib/effects/index.d.ts +2 -2
  77. package/lib/effects/index.js +22 -31
  78. package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
  79. package/lib/model/strategy/adapter/walletPass/type.d.ts +9 -2
  80. package/lib/model/strategy/adapter/walletPass/utils.d.ts +6 -6
  81. package/lib/model/strategy/adapter/walletPass/utils.js +113 -49
  82. package/lib/modules/Customer/index.js +1 -1
  83. package/lib/modules/Discount/index.d.ts +6 -2
  84. package/lib/modules/Discount/index.js +3 -1
  85. package/lib/modules/Order/index.d.ts +1 -1
  86. package/lib/modules/Order/index.js +20 -18
  87. package/lib/modules/Payment/index.d.ts +4 -0
  88. package/lib/modules/Payment/index.js +134 -66
  89. package/lib/modules/Payment/walletpass.js +23 -4
  90. package/lib/modules/Product/index.d.ts +1 -1
  91. package/lib/modules/Product/types.d.ts +2 -0
  92. package/lib/modules/ProductList/index.d.ts +3 -0
  93. package/lib/modules/ProductList/index.js +2 -2
  94. package/lib/modules/Rules/index.d.ts +2 -2
  95. package/lib/modules/Rules/index.js +69 -73
  96. package/lib/modules/Rules/types.d.ts +2 -2
  97. package/lib/modules/Schedule/index.d.ts +9 -0
  98. package/lib/modules/Schedule/index.js +11 -0
  99. package/lib/plugins/app-types/app/app.d.ts +1 -0
  100. package/lib/plugins/request.d.ts +2 -0
  101. package/lib/server/index.d.ts +107 -2
  102. package/lib/server/index.js +773 -51
  103. package/lib/server/modules/index.d.ts +6 -0
  104. package/lib/server/modules/index.js +16 -2
  105. package/lib/server/modules/menu/index.d.ts +19 -0
  106. package/lib/server/modules/menu/index.js +121 -2
  107. package/lib/server/modules/order/index.d.ts +87 -0
  108. package/lib/server/modules/order/index.js +543 -0
  109. package/lib/server/modules/order/types.d.ts +530 -0
  110. package/lib/server/modules/order/types.js +34 -0
  111. package/lib/server/modules/order/utils/filterBookings.d.ts +6 -0
  112. package/lib/server/modules/order/utils/filterBookings.js +320 -0
  113. package/lib/server/modules/order/utils/filterOrders.d.ts +15 -0
  114. package/lib/server/modules/order/utils/filterOrders.js +197 -0
  115. package/lib/server/modules/products/index.d.ts +117 -5
  116. package/lib/server/modules/products/index.js +799 -62
  117. package/lib/server/modules/products/types.d.ts +25 -1
  118. package/lib/server/modules/products/types.js +1 -0
  119. package/lib/server/modules/resource/index.d.ts +86 -0
  120. package/lib/server/modules/resource/index.js +557 -0
  121. package/lib/server/modules/resource/types.d.ts +121 -0
  122. package/lib/server/modules/resource/types.js +35 -0
  123. package/lib/server/modules/schedule/index.d.ts +19 -0
  124. package/lib/server/modules/schedule/index.js +141 -12
  125. package/lib/server/utils/product.d.ts +5 -0
  126. package/lib/server/utils/product.js +56 -27
  127. package/lib/solution/BookingTicket/index.d.ts +10 -2
  128. package/lib/solution/BookingTicket/index.js +10 -2
  129. package/lib/solution/BookingTicket/utils/scan/index.js +0 -1
  130. package/lib/solution/Checkout/index.d.ts +1 -0
  131. package/lib/solution/Checkout/index.js +399 -331
  132. package/lib/solution/Checkout/utils/index.d.ts +2 -1
  133. package/lib/solution/Checkout/utils/index.js +6 -4
  134. package/lib/solution/RegisterAndLogin/config.js +266 -1
  135. package/lib/solution/Sales/index.d.ts +96 -0
  136. package/lib/solution/Sales/index.js +416 -0
  137. package/lib/solution/Sales/types.d.ts +67 -0
  138. package/lib/solution/Sales/types.js +35 -0
  139. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  140. package/lib/solution/ShopDiscount/index.js +14 -6
  141. package/lib/solution/ShopDiscount/types.d.ts +6 -0
  142. package/lib/solution/ShopDiscount/utils.d.ts +9 -0
  143. package/lib/solution/ShopDiscount/utils.js +6 -10
  144. package/lib/solution/index.d.ts +2 -1
  145. package/lib/solution/index.js +4 -2
  146. package/lib/types/index.d.ts +5 -0
  147. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { ProductData } from '../../modules/Product/types';
2
2
  import { FormattedProductData, LoadProductsPriceData, ProductFormatterContext } from '../modules/products/types';
3
+ export declare function perfMark(label: string, durationMs: number, meta?: Record<string, any>): void;
3
4
  /**
4
5
  * 将价格数据应用到商品列表(高性能版本)
5
6
  * 通过预构建 Map 索引,将时间复杂度从 O(n×m) 优化到 O(n+m)
@@ -9,6 +10,10 @@ import { FormattedProductData, LoadProductsPriceData, ProductFormatterContext }
9
10
  */
10
11
  export declare function applyPriceDataToProducts(products: ProductData[], priceData: LoadProductsPriceData[]): ProductData[];
11
12
  export declare const getIsSessionProduct: (product: ProductData) => boolean;
13
+ /**
14
+ * 根据 locale 将商品的 i18n 字段覆盖到对应原始字段
15
+ */
16
+ export declare function applyI18nToProducts(products: ProductData[], locale?: string): ProductData[];
12
17
  /**
13
18
  * 将详情值数据应用到商品列表
14
19
  * @param products 商品列表
@@ -1,15 +1,32 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
5
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
11
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
- import Decimal from 'decimal.js';
11
14
  import { getScheduleStartEndTimePoints } from "../modules/schedule/utils";
12
15
  import { getUniqueId } from "../../modules/Cart/utils";
16
+ export function perfMark(label, durationMs, meta) {
17
+ try {
18
+ var w = typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : null;
19
+ if (!w) return;
20
+ if (!w.__PERF__) w.__PERF__ = {
21
+ records: []
22
+ };
23
+ w.__PERF__.records.push(_objectSpread({
24
+ label: label,
25
+ duration: Math.round(durationMs * 100) / 100,
26
+ ts: Date.now()
27
+ }, meta));
28
+ } catch (_unused) {/* noop */}
29
+ }
13
30
 
14
31
  /**
15
32
  * 构建价格数据的 Map 索引结构
@@ -40,7 +57,7 @@ function buildPriceIndexMap(priceData) {
40
57
  if (p.bundle_group && p.bundle_group.length > 0) {
41
58
  var groupMap = new Map();
42
59
  p.bundle_group.forEach(function (bg) {
43
- var itemMap = new Map(bg.bundle_item.map(function (bi) {
60
+ var itemMap = new Map((bg.bundle_item || []).map(function (bi) {
44
61
  return [bi.id, bi];
45
62
  }));
46
63
  groupMap.set(bg.id, itemMap);
@@ -63,40 +80,33 @@ function buildPriceIndexMap(priceData) {
63
80
  * @returns 应用价格后的商品列表
64
81
  */
65
82
  export function applyPriceDataToProducts(products, priceData) {
66
- // 如果没有价格数据,直接返回原商品
83
+ var t0 = performance.now();
67
84
  if (!priceData || priceData.length === 0) {
68
85
  console.log('[applyPriceDataToProducts] 没有价格数据,返回原商品');
69
86
  return products;
70
87
  }
71
-
72
- // 预先构建 Map 索引(O(m) 时间)
88
+ var t1 = performance.now();
73
89
  var _buildPriceIndexMap = buildPriceIndexMap(priceData),
74
90
  priceMap = _buildPriceIndexMap.priceMap,
75
91
  variantMap = _buildPriceIndexMap.variantMap,
76
92
  bundleMap = _buildPriceIndexMap.bundleMap;
77
- console.log("[applyPriceDataToProducts] \u5DF2\u6784\u5EFA\u4EF7\u683C\u7D22\u5F15\uFF0C\u5171 ".concat(priceMap.size, " \u4E2A\u5546\u54C1\u4EF7\u683C"));
78
-
79
- // 应用价格到商品(O(n) 时间)
93
+ perfMark('buildPriceIndexMap', performance.now() - t1, {
94
+ priceCount: priceData.length
95
+ });
96
+ var t2 = performance.now();
80
97
  var updatedProducts = products.map(function (product) {
81
- // O(1) 查询商品价格
82
98
  var priceInfo = priceMap.get(product.id);
83
99
  if (!priceInfo) {
84
100
  return product;
85
101
  }
86
-
87
- // 深拷贝商品对象
88
102
  var updatedProduct = _objectSpread({}, product);
89
-
90
- // 1. 更新主价格(转换为 string 类型)
91
103
  updatedProduct.price = priceInfo.price;
92
104
  updatedProduct.base_price = priceInfo.base_price;
93
-
94
- // 2. 更新 variant 价格
95
105
  if (updatedProduct.variant && updatedProduct.variant.length > 0) {
96
106
  var productVariantMap = variantMap.get(product.id);
97
107
  if (productVariantMap) {
98
108
  updatedProduct.variant = updatedProduct.variant.map(function (v) {
99
- var priceVariant = productVariantMap.get(v.id); // O(1)
109
+ var priceVariant = productVariantMap.get(v.id);
100
110
  if (priceVariant) {
101
111
  return _objectSpread(_objectSpread({}, v), {}, {
102
112
  price: String(priceVariant.price),
@@ -107,23 +117,17 @@ export function applyPriceDataToProducts(products, priceData) {
107
117
  });
108
118
  }
109
119
  }
110
-
111
- // 3. 更新 bundle_groups 价格
112
- if (updatedProduct.bundle_groups && updatedProduct.bundle_groups.length > 0) {
120
+ if (updatedProduct.bundle_group && updatedProduct.bundle_group.length > 0) {
113
121
  var productBundleMap = bundleMap.get(product.id);
114
122
  if (productBundleMap) {
115
- updatedProduct.bundle_groups = updatedProduct.bundle_groups.map(function (bg) {
116
- var groupItemMap = productBundleMap.get(bg.id); // O(1)
123
+ updatedProduct.bundle_group = updatedProduct.bundle_group.map(function (bg) {
124
+ var groupItemMap = productBundleMap.get(bg.id);
117
125
  if (!groupItemMap) return bg;
118
126
  return _objectSpread(_objectSpread({}, bg), {}, {
119
127
  bundle_item: bg.bundle_item.map(function (bi) {
120
- var priceBi = groupItemMap.get(bi.id); // O(1)
128
+ var priceBi = groupItemMap.get(bi.id);
121
129
  if (priceBi) {
122
- // 处理 markdown 类型
123
130
  var price = priceBi.price;
124
- if (priceBi.price_type === 'markdown') {
125
- price = new Decimal(price || 0).mul(-1).toNumber();
126
- }
127
131
  return _objectSpread(_objectSpread({}, bi), {}, {
128
132
  price: String(price),
129
133
  base_price: String(priceBi.base_price)
@@ -137,7 +141,13 @@ export function applyPriceDataToProducts(products, priceData) {
137
141
  }
138
142
  return updatedProduct;
139
143
  });
140
- console.log("[applyPriceDataToProducts] \u5DF2\u5E94\u7528\u4EF7\u683C\u5230 ".concat(updatedProducts.length, " \u4E2A\u5546\u54C1"));
144
+ perfMark('applyPriceDataToProducts.mapProducts', performance.now() - t2, {
145
+ count: products.length
146
+ });
147
+ perfMark('applyPriceDataToProducts', performance.now() - t0, {
148
+ productCount: products.length,
149
+ priceCount: priceData.length
150
+ });
141
151
  return updatedProducts;
142
152
  }
143
153
  export var getIsSessionProduct = function getIsSessionProduct(product) {
@@ -180,6 +190,36 @@ var getIsOpenDetailModal = function getIsOpenDetailModal(product, context) {
180
190
  scheduleTimeSlots: scheduleTimeSlots
181
191
  };
182
192
  };
193
+ var I18N_FIELD_MAP = {
194
+ title_i18n: 'title',
195
+ subtitle_i18n: 'subtitle',
196
+ description_i18n: 'description',
197
+ cover_i18n: 'cover'
198
+ };
199
+
200
+ /**
201
+ * 根据 locale 将商品的 i18n 字段覆盖到对应原始字段
202
+ */
203
+ export function applyI18nToProducts(products, locale) {
204
+ if (!locale) return products;
205
+ return products.map(function (product) {
206
+ var _patched;
207
+ var patched = null;
208
+ for (var _i = 0, _Object$entries = Object.entries(I18N_FIELD_MAP); _i < _Object$entries.length; _i++) {
209
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
210
+ i18nKey = _Object$entries$_i[0],
211
+ originalKey = _Object$entries$_i[1];
212
+ var i18nDict = product[i18nKey];
213
+ if (!i18nDict) continue;
214
+ var localizedValue = i18nDict[locale];
215
+ if (localizedValue) {
216
+ if (!patched) patched = _objectSpread({}, product);
217
+ patched[originalKey] = localizedValue;
218
+ }
219
+ }
220
+ return (_patched = patched) !== null && _patched !== void 0 ? _patched : product;
221
+ });
222
+ }
183
223
  var formatDataKey = function formatDataKey(data) {
184
224
  var _data$option, _data$bundle;
185
225
  var _data = _objectSpread({}, data);
@@ -318,22 +358,22 @@ var genCartDetailValue = function genCartDetailValue(product, scheduleTimeSlots)
318
358
  * @returns 应用详情值后的商品列表
319
359
  */
320
360
  export function applyDetailValueToProducts(products, context) {
361
+ var t0 = performance.now();
321
362
  var newProducts = products.map(function (product) {
322
- /** 是否打开详情弹窗 套餐组、选项组、组合规格、日程商品、日程时间段大于1个 打开详情弹窗 */
323
363
  var _getIsOpenDetailModal = getIsOpenDetailModal(product, context),
324
364
  isOpenDetailModal = _getIsOpenDetailModal.isOpenDetailModal,
325
365
  scheduleTimeSlots = _getIsOpenDetailModal.scheduleTimeSlots;
326
366
  var cartDetailValue = null;
327
367
  if (!isOpenDetailModal) {
328
- // 生成购物车详情值
329
368
  cartDetailValue = genCartDetailValue(product, scheduleTimeSlots);
330
369
  }
331
370
  return _objectSpread(_objectSpread({}, product), {}, {
332
- // 是否打开详情弹窗
333
371
  isOpenDetailModal: isOpenDetailModal,
334
- // 购物车详情值
335
372
  cartDetailValue: cartDetailValue
336
373
  });
337
374
  });
375
+ perfMark('applyDetailValueToProducts', performance.now() - t0, {
376
+ count: products.length
377
+ });
338
378
  return newProducts;
339
379
  }
@@ -21,7 +21,15 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
21
21
  * @param params 包含 schedule_date 的参数
22
22
  * @returns 商品列表
23
23
  */
24
- loadProducts(params?: ILoadProductsParams): Promise<any>;
24
+ loadProducts(params?: ILoadProductsParams, options?: {
25
+ callback?: (result: any) => void;
26
+ subscriberId?: string;
27
+ }): Promise<any>;
28
+ /**
29
+ * 取消商品查询订阅
30
+ * @param subscriberId 订阅时传入的 subscriberId
31
+ */
32
+ unsubscribeProductQuery(subscriberId?: string): void;
25
33
  /**
26
34
  * 初始化外设扫码结果监听
27
35
  */
@@ -123,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
131
  * 获取当前的客户搜索条件
124
132
  * @returns 当前搜索条件
125
133
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
134
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
127
135
  /**
128
136
  * 获取客户列表状态(包含滚动加载相关状态)
129
137
  * @returns 客户状态
@@ -131,39 +131,41 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
131
131
  value: (function () {
132
132
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
133
133
  var params,
134
+ options,
134
135
  schedule_date,
135
136
  customer_id,
136
137
  menu_list_ids,
137
138
  schedule_datetime,
138
- result,
139
+ _result,
139
140
  _args2 = arguments;
140
141
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
141
142
  while (1) switch (_context2.prev = _context2.next) {
142
143
  case 0:
143
144
  params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
145
+ options = _args2.length > 1 ? _args2[1] : undefined;
144
146
  schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
145
- _context2.prev = 2;
146
- _context2.next = 5;
147
+ _context2.prev = 3;
148
+ _context2.next = 6;
147
149
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
148
150
  with_count: ['bundleGroup', 'optionGroup'],
149
151
  with_schedule: 1
150
152
  }, params), {}, {
151
153
  cacheId: this.cacheId
152
- }));
153
- case 5:
154
- result = _context2.sent;
155
- this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
156
- return _context2.abrupt("return", result);
157
- case 10:
158
- _context2.prev = 10;
159
- _context2.t0 = _context2["catch"](2);
154
+ }), options);
155
+ case 6:
156
+ _result = _context2.sent;
157
+ this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
158
+ return _context2.abrupt("return", _result);
159
+ case 11:
160
+ _context2.prev = 11;
161
+ _context2.t0 = _context2["catch"](3);
160
162
  console.error('Failed to load products:', _context2.t0);
161
163
  throw _context2.t0;
162
- case 14:
164
+ case 15:
163
165
  case "end":
164
166
  return _context2.stop();
165
167
  }
166
- }, _callee2, this, [[2, 10]]);
168
+ }, _callee2, this, [[3, 11]]);
167
169
  }));
168
170
  function loadProducts() {
169
171
  return _loadProducts.apply(this, arguments);
@@ -171,9 +173,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
171
173
  return loadProducts;
172
174
  }()
173
175
  /**
174
- * 初始化外设扫码结果监听
176
+ * 取消商品查询订阅
177
+ * @param subscriberId 订阅时传入的 subscriberId
175
178
  */
176
179
  )
180
+ }, {
181
+ key: "unsubscribeProductQuery",
182
+ value: function unsubscribeProductQuery(subscriberId) {
183
+ var _this$core$server;
184
+ (_this$core$server = this.core.server) === null || _this$core$server === void 0 || _this$core$server.removeProductQuerySubscriber(subscriberId);
185
+ }
186
+
187
+ /**
188
+ * 初始化外设扫码结果监听
189
+ */
177
190
  }, {
178
191
  key: "initPeripheralsListener",
179
192
  value: function initPeripheralsListener() {
@@ -248,7 +261,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
248
261
  value: (function () {
249
262
  var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
250
263
  var params,
251
- result,
264
+ _result2,
252
265
  _args5 = arguments;
253
266
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
254
267
  while (1) switch (_context5.prev = _context5.next) {
@@ -258,8 +271,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
258
271
  _context5.next = 4;
259
272
  return this.store.customer.getCustomerList(params);
260
273
  case 4:
261
- result = _context5.sent;
262
- return _context5.abrupt("return", result);
274
+ _result2 = _context5.sent;
275
+ return _context5.abrupt("return", _result2);
263
276
  case 8:
264
277
  _context5.prev = 8;
265
278
  _context5.t0 = _context5["catch"](1);
@@ -397,7 +410,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
397
410
  key: "changeCustomerPage",
398
411
  value: (function () {
399
412
  var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, pageSize) {
400
- var result;
413
+ var _result3;
401
414
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
402
415
  while (1) switch (_context6.prev = _context6.next) {
403
416
  case 0:
@@ -405,8 +418,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
405
418
  _context6.next = 3;
406
419
  return this.store.customer.changeCustomerPage(page, pageSize);
407
420
  case 3:
408
- result = _context6.sent;
409
- return _context6.abrupt("return", result);
421
+ _result3 = _context6.sent;
422
+ return _context6.abrupt("return", _result3);
410
423
  case 7:
411
424
  _context6.prev = 7;
412
425
  _context6.t0 = _context6["catch"](0);
@@ -432,7 +445,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
432
445
  key: "loadMoreCustomers",
433
446
  value: (function () {
434
447
  var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
435
- var result;
448
+ var _result4;
436
449
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
437
450
  while (1) switch (_context7.prev = _context7.next) {
438
451
  case 0:
@@ -440,9 +453,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
440
453
  _context7.next = 3;
441
454
  return this.store.customer.loadMoreCustomers();
442
455
  case 3:
443
- result = _context7.sent;
444
- this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), result);
445
- return _context7.abrupt("return", result);
456
+ _result4 = _context7.sent;
457
+ this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
458
+ return _context7.abrupt("return", _result4);
446
459
  case 8:
447
460
  _context7.prev = 8;
448
461
  _context7.t0 = _context7["catch"](0);
@@ -470,7 +483,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
470
483
  value: (function () {
471
484
  var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
472
485
  var params,
473
- result,
486
+ _result5,
474
487
  _args8 = arguments;
475
488
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
476
489
  while (1) switch (_context8.prev = _context8.next) {
@@ -480,9 +493,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
480
493
  _context8.next = 4;
481
494
  return this.store.customer.resetAndLoadCustomers(params);
482
495
  case 4:
483
- result = _context8.sent;
484
- this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), result);
485
- return _context8.abrupt("return", result);
496
+ _result5 = _context8.sent;
497
+ this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
498
+ return _context8.abrupt("return", _result5);
486
499
  case 9:
487
500
  _context8.prev = 9;
488
501
  _context8.t0 = _context8["catch"](1);
@@ -26,7 +26,7 @@ var Scan = /*#__PURE__*/function () {
26
26
  this.watchKey = watchKey;
27
27
 
28
28
  // 初始化扫码监听
29
- this.initPeripheralsListener();
29
+ // this.initPeripheralsListener();
30
30
  }
31
31
 
32
32
  /**
@@ -20,6 +20,7 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
20
20
  private otherParams;
21
21
  private logger;
22
22
  private calculationCache;
23
+ private syncOrderToBackendInFlightByOrderKey;
23
24
  order: OrderModule;
24
25
  payment: PaymentModule;
25
26
  constructor(name?: string, version?: string);