@pisell/pisellos 2.3.39 → 2.3.41

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 (226) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/Discount/index.d.ts +0 -1
  16. package/dist/modules/Discount/index.js +11 -40
  17. package/dist/modules/Discount/types.d.ts +0 -1
  18. package/dist/modules/OpenData/index.d.ts +2 -0
  19. package/dist/modules/OpenData/index.js +10 -2
  20. package/dist/modules/Order/index.d.ts +29 -12
  21. package/dist/modules/Order/index.js +750 -509
  22. package/dist/modules/Order/payment-utils.d.ts +26 -0
  23. package/dist/modules/Order/payment-utils.js +225 -0
  24. package/dist/modules/Order/types.d.ts +33 -10
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  26. package/dist/modules/Order/utils.d.ts +0 -10
  27. package/dist/modules/Order/utils.js +13 -41
  28. package/dist/modules/Payment/index.d.ts +2 -0
  29. package/dist/modules/Payment/index.js +79 -50
  30. package/dist/modules/Payment/types.d.ts +99 -28
  31. package/dist/modules/Payment/types.js +20 -3
  32. package/dist/modules/Payment/walletpass.d.ts +25 -1
  33. package/dist/modules/Payment/walletpass.js +707 -157
  34. package/dist/modules/Product/types.d.ts +0 -1
  35. package/dist/modules/ProductList/index.js +14 -33
  36. package/dist/modules/Quotation/index.d.ts +1 -1
  37. package/dist/modules/Quotation/index.js +2 -2
  38. package/dist/modules/Rules/index.d.ts +1 -0
  39. package/dist/modules/Rules/index.js +89 -96
  40. package/dist/modules/SalesSummary/index.js +13 -12
  41. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  42. package/dist/modules/ScanOrderLogger/index.js +2 -15
  43. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  44. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  45. package/dist/modules/Schedule/index.d.ts +1 -3
  46. package/dist/modules/Schedule/index.js +16 -21
  47. package/dist/modules/Summary/utils.js +13 -38
  48. package/dist/modules/index.d.ts +0 -2
  49. package/dist/modules/index.js +1 -3
  50. package/dist/plugins/window.d.ts +0 -1
  51. package/dist/server/index.d.ts +16 -14
  52. package/dist/server/index.js +1925 -1143
  53. package/dist/server/modules/order/index.d.ts +54 -4
  54. package/dist/server/modules/order/index.js +1600 -700
  55. package/dist/server/modules/order/types.d.ts +11 -3
  56. package/dist/server/modules/order/types.js +1 -1
  57. package/dist/solution/BaseSales/index.d.ts +109 -20
  58. package/dist/solution/BaseSales/index.js +1800 -480
  59. package/dist/solution/BaseSales/types.d.ts +52 -0
  60. package/dist/solution/BaseSales/types.js +2 -1
  61. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  63. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  64. package/dist/solution/BookingByStep/index.d.ts +2 -17
  65. package/dist/solution/BookingByStep/index.js +215 -294
  66. package/dist/solution/BookingByStep/types.d.ts +1 -2
  67. package/dist/solution/BookingByStep/types.js +1 -3
  68. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  69. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  70. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  71. package/dist/solution/BookingTicket/index.d.ts +7 -3
  72. package/dist/solution/BookingTicket/index.js +132 -49
  73. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  75. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  76. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  77. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  78. package/dist/solution/Sales/index.d.ts +1 -0
  79. package/dist/solution/Sales/index.js +10 -2
  80. package/dist/solution/ScanOrder/index.d.ts +14 -26
  81. package/dist/solution/ScanOrder/index.js +756 -1148
  82. package/dist/solution/ScanOrder/types.d.ts +1 -21
  83. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  84. package/dist/solution/ScanOrder/utils.js +25 -66
  85. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  86. package/dist/solution/ShopDiscount/index.js +87 -125
  87. package/dist/solution/VenueBooking/index.d.ts +11 -39
  88. package/dist/solution/VenueBooking/index.js +860 -1176
  89. package/dist/solution/VenueBooking/types.d.ts +0 -3
  90. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  93. package/dist/solution/index.d.ts +0 -1
  94. package/dist/solution/index.js +1 -2
  95. package/dist/types/index.d.ts +1 -1
  96. package/dist/utils/payment-number.d.ts +9 -0
  97. package/dist/utils/payment-number.js +69 -0
  98. package/lib/core/index.d.ts +2 -0
  99. package/lib/core/index.js +4 -0
  100. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  101. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  102. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  103. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  104. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  105. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  106. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  107. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  108. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  109. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  110. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  111. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  112. package/lib/modules/Discount/index.d.ts +0 -1
  113. package/lib/modules/Discount/index.js +0 -9
  114. package/lib/modules/Discount/types.d.ts +0 -1
  115. package/lib/modules/OpenData/index.d.ts +2 -0
  116. package/lib/modules/OpenData/index.js +6 -1
  117. package/lib/modules/Order/index.d.ts +29 -12
  118. package/lib/modules/Order/index.js +196 -86
  119. package/lib/modules/Order/payment-utils.d.ts +26 -0
  120. package/lib/modules/Order/payment-utils.js +224 -0
  121. package/lib/modules/Order/types.d.ts +33 -10
  122. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  123. package/lib/modules/Order/utils.d.ts +0 -10
  124. package/lib/modules/Order/utils.js +16 -40
  125. package/lib/modules/Payment/index.d.ts +2 -0
  126. package/lib/modules/Payment/index.js +34 -13
  127. package/lib/modules/Payment/types.d.ts +99 -28
  128. package/lib/modules/Payment/types.js +4 -3
  129. package/lib/modules/Payment/walletpass.d.ts +25 -1
  130. package/lib/modules/Payment/walletpass.js +470 -21
  131. package/lib/modules/Product/types.d.ts +0 -1
  132. package/lib/modules/ProductList/index.js +31 -40
  133. package/lib/modules/Quotation/index.d.ts +1 -1
  134. package/lib/modules/Quotation/index.js +2 -2
  135. package/lib/modules/Rules/index.d.ts +1 -0
  136. package/lib/modules/Rules/index.js +47 -40
  137. package/lib/modules/SalesSummary/index.js +7 -6
  138. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  139. package/lib/modules/ScanOrderLogger/index.js +1 -13
  140. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  141. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  142. package/lib/modules/Schedule/index.d.ts +1 -3
  143. package/lib/modules/Schedule/index.js +8 -10
  144. package/lib/modules/Summary/utils.js +1 -21
  145. package/lib/modules/index.d.ts +0 -2
  146. package/lib/modules/index.js +1 -5
  147. package/lib/plugins/window.d.ts +0 -1
  148. package/lib/server/index.d.ts +16 -14
  149. package/lib/server/index.js +675 -83
  150. package/lib/server/modules/order/index.d.ts +54 -4
  151. package/lib/server/modules/order/index.js +679 -66
  152. package/lib/server/modules/order/types.d.ts +11 -3
  153. package/lib/solution/BaseSales/index.d.ts +109 -20
  154. package/lib/solution/BaseSales/index.js +883 -70
  155. package/lib/solution/BaseSales/types.d.ts +52 -0
  156. package/lib/solution/BaseSales/types.js +2 -1
  157. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  158. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  159. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  160. package/lib/solution/BookingByStep/index.d.ts +2 -17
  161. package/lib/solution/BookingByStep/index.js +18 -60
  162. package/lib/solution/BookingByStep/types.d.ts +1 -2
  163. package/lib/solution/BookingByStep/types.js +0 -5
  164. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  165. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  166. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  167. package/lib/solution/BookingTicket/index.d.ts +7 -3
  168. package/lib/solution/BookingTicket/index.js +62 -9
  169. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  170. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  171. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  172. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  173. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  174. package/lib/solution/Sales/index.d.ts +1 -0
  175. package/lib/solution/Sales/index.js +5 -3
  176. package/lib/solution/ScanOrder/index.d.ts +14 -26
  177. package/lib/solution/ScanOrder/index.js +190 -449
  178. package/lib/solution/ScanOrder/types.d.ts +1 -21
  179. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  180. package/lib/solution/ScanOrder/utils.js +0 -31
  181. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  182. package/lib/solution/ShopDiscount/index.js +0 -14
  183. package/lib/solution/VenueBooking/index.d.ts +11 -39
  184. package/lib/solution/VenueBooking/index.js +123 -328
  185. package/lib/solution/VenueBooking/types.d.ts +0 -3
  186. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  187. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  188. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  189. package/lib/solution/index.d.ts +0 -1
  190. package/lib/solution/index.js +1 -3
  191. package/lib/types/index.d.ts +1 -1
  192. package/lib/utils/payment-number.d.ts +9 -0
  193. package/lib/utils/payment-number.js +64 -0
  194. package/package.json +1 -1
  195. package/dist/modules/Holder/index.d.ts +0 -48
  196. package/dist/modules/Holder/index.js +0 -640
  197. package/dist/modules/Holder/types.d.ts +0 -123
  198. package/dist/modules/Holder/types.js +0 -1
  199. package/dist/modules/Holder/utils.d.ts +0 -13
  200. package/dist/modules/Holder/utils.js +0 -34
  201. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  202. package/dist/modules/ResourcePlanner/index.js +0 -181
  203. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  204. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  205. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  206. package/dist/modules/ResourcePlanner/types.js +0 -1
  207. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  208. package/dist/solution/UnifiedBookingSales/index.js +0 -1871
  209. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  210. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  211. package/lib/modules/Holder/index.d.ts +0 -48
  212. package/lib/modules/Holder/index.js +0 -402
  213. package/lib/modules/Holder/types.d.ts +0 -123
  214. package/lib/modules/Holder/types.js +0 -17
  215. package/lib/modules/Holder/utils.d.ts +0 -13
  216. package/lib/modules/Holder/utils.js +0 -71
  217. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  218. package/lib/modules/ResourcePlanner/index.js +0 -148
  219. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  220. package/lib/modules/ResourcePlanner/planner.js +0 -933
  221. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  222. package/lib/modules/ResourcePlanner/types.js +0 -17
  223. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  224. package/lib/solution/UnifiedBookingSales/index.js +0 -1076
  225. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  226. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -191,210 +191,300 @@ export function applyGlobalScan(_x14, _x15, _x16) {
191
191
  return _applyGlobalScan.apply(this, arguments);
192
192
  }
193
193
  function _applyGlobalScan() {
194
- _applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(host, formatted, bridge) {
195
- var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _bridge$onNotify4, _bridge$onNotify3, snapshot, scannedCustomerIsWalkIn, result, list, _bridge$onNotify5, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify6, _data$order_id, _data$business_code, orderId, _bridge$onNotify7;
196
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
197
- while (1) switch (_context4.prev = _context4.next) {
194
+ _applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(host, formatted, bridge) {
195
+ var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _host$refreshWalletAs, _bridge$onNotify5, snapshot, scannedCustomerIsWalkIn, trySelectWalletAsset, _walletSelection, result, walletSelection, _data$id, promotionResult, list, _bridge$onNotify6, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify7, _data$order_id, _data$business_code, orderId, _bridge$onNotify8;
196
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
197
+ while (1) switch (_context5.prev = _context5.next) {
198
198
  case 0:
199
199
  searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode;
200
200
  if (!(searchType === 'wallet')) {
201
- _context4.next = 8;
201
+ _context5.next = 8;
202
202
  break;
203
203
  }
204
204
  if (data) {
205
- _context4.next = 5;
205
+ _context5.next = 5;
206
206
  break;
207
207
  }
208
208
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
209
- return _context4.abrupt("return", {
209
+ return _context5.abrupt("return", {
210
210
  status: 'failed',
211
211
  reason: 'invalid_data'
212
212
  });
213
213
  case 5:
214
214
  host.setOrderCustomer(data);
215
215
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'success', 'pisell2.text.add-client-success');
216
- return _context4.abrupt("return", {
216
+ return _context5.abrupt("return", {
217
217
  status: 'success',
218
218
  kind: 'customer'
219
219
  });
220
220
  case 8:
221
221
  if (!(searchType === 'walletPass')) {
222
- _context4.next = 26;
222
+ _context5.next = 42;
223
223
  break;
224
224
  }
225
- if (data) {
226
- _context4.next = 12;
227
- break;
228
- }
229
- bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
230
- return _context4.abrupt("return", {
231
- status: 'failed',
232
- reason: 'invalid_data'
233
- });
234
- case 12:
235
225
  snapshot = host.getOrderCustomerSnapshot();
236
226
  scannedCustomerIsWalkIn = isWalkInCustomer(data);
227
+ trySelectWalletAsset = /*#__PURE__*/function () {
228
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
229
+ var _bridge$onNotify4;
230
+ var walletResult, _bridge$onNotify3;
231
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
232
+ while (1) switch (_context4.prev = _context4.next) {
233
+ case 0:
234
+ if (host.scanWalletAsset) {
235
+ _context4.next = 2;
236
+ break;
237
+ }
238
+ return _context4.abrupt("return", null);
239
+ case 2:
240
+ _context4.next = 4;
241
+ return host.scanWalletAsset(scanCode).catch(function (error) {
242
+ console.warn('[GlobalScan] Wallet asset lookup failed', error);
243
+ return null;
244
+ });
245
+ case 4:
246
+ walletResult = _context4.sent;
247
+ if (walletResult) {
248
+ _context4.next = 7;
249
+ break;
250
+ }
251
+ return _context4.abrupt("return", null);
252
+ case 7:
253
+ if (!(walletResult.type !== 'normalCode' || !walletResult.asset)) {
254
+ _context4.next = 9;
255
+ break;
256
+ }
257
+ return _context4.abrupt("return", null);
258
+ case 9:
259
+ if (!walletResult.selected) {
260
+ _context4.next = 12;
261
+ break;
262
+ }
263
+ bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'success');
264
+ return _context4.abrupt("return", {
265
+ status: 'success',
266
+ kind: 'promotion'
267
+ });
268
+ case 12:
269
+ // 已识别为 Wallet 支付资产但当前不可用:保留禁用展示,不回退优惠码。
270
+ bridge === null || bridge === void 0 || (_bridge$onNotify4 = bridge.onNotify) === null || _bridge$onNotify4 === void 0 || _bridge$onNotify4.call(bridge, 'fail', 'pisell2.text.goodpass.code-invalid-cart');
271
+ return _context4.abrupt("return", {
272
+ status: 'failed',
273
+ reason: 'invalid_data'
274
+ });
275
+ case 14:
276
+ case "end":
277
+ return _context4.stop();
278
+ }
279
+ }, _callee4);
280
+ }));
281
+ return function trySelectWalletAsset() {
282
+ return _ref2.apply(this, arguments);
283
+ };
284
+ }();
237
285
  if (!(isWalkInCustomer(snapshot) || scannedCustomerIsWalkIn)) {
238
- _context4.next = 23;
286
+ _context5.next = 26;
287
+ break;
288
+ }
289
+ _context5.next = 15;
290
+ return trySelectWalletAsset();
291
+ case 15:
292
+ _walletSelection = _context5.sent;
293
+ if (!_walletSelection) {
294
+ _context5.next = 18;
239
295
  break;
240
296
  }
297
+ return _context5.abrupt("return", _walletSelection);
298
+ case 18:
241
299
  if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
242
- _context4.next = 17;
300
+ _context5.next = 20;
243
301
  break;
244
302
  }
245
- return _context4.abrupt("return", {
303
+ return _context5.abrupt("return", {
246
304
  status: 'failed',
247
305
  reason: 'no_bridge'
248
306
  });
249
- case 17:
250
- _context4.next = 19;
307
+ case 20:
308
+ _context5.next = 22;
251
309
  return bridge.applyPromotionCode(scanCode);
252
- case 19:
253
- result = _context4.sent;
310
+ case 22:
311
+ result = _context5.sent;
254
312
  if (!(result !== null && result !== void 0 && result.isAvailable)) {
255
- _context4.next = 22;
313
+ _context5.next = 25;
256
314
  break;
257
315
  }
258
- return _context4.abrupt("return", {
316
+ return _context5.abrupt("return", {
259
317
  status: 'success',
260
318
  kind: 'promotion'
261
319
  });
262
- case 22:
263
- return _context4.abrupt("return", {
320
+ case 25:
321
+ return _context5.abrupt("return", {
264
322
  status: 'failed',
265
323
  reason: 'invalid_data'
266
324
  });
267
- case 23:
325
+ case 26:
268
326
  host.setOrderCustomer(data);
269
- bridge === null || bridge === void 0 || (_bridge$onNotify4 = bridge.onNotify) === null || _bridge$onNotify4 === void 0 || _bridge$onNotify4.call(bridge, 'success', 'pisell2.text.add-client-success');
270
- return _context4.abrupt("return", {
327
+ _context5.next = 29;
328
+ return (_host$refreshWalletAs = host.refreshWalletAssets) === null || _host$refreshWalletAs === void 0 ? void 0 : _host$refreshWalletAs.call(host, {
329
+ preserveSelection: false
330
+ });
331
+ case 29:
332
+ _context5.next = 31;
333
+ return trySelectWalletAsset();
334
+ case 31:
335
+ walletSelection = _context5.sent;
336
+ if (!walletSelection) {
337
+ _context5.next = 34;
338
+ break;
339
+ }
340
+ return _context5.abrupt("return", walletSelection);
341
+ case 34:
342
+ if (!(bridge !== null && bridge !== void 0 && bridge.applyPromotionCode)) {
343
+ _context5.next = 40;
344
+ break;
345
+ }
346
+ _context5.next = 37;
347
+ return bridge.applyPromotionCode(scanCode, Number((_data$id = data === null || data === void 0 ? void 0 : data.id) !== null && _data$id !== void 0 ? _data$id : data === null || data === void 0 ? void 0 : data.customer_id) || undefined);
348
+ case 37:
349
+ promotionResult = _context5.sent;
350
+ if (!(promotionResult !== null && promotionResult !== void 0 && promotionResult.isAvailable)) {
351
+ _context5.next = 40;
352
+ break;
353
+ }
354
+ return _context5.abrupt("return", {
355
+ status: 'success',
356
+ kind: 'promotion'
357
+ });
358
+ case 40:
359
+ bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'success', 'pisell2.text.add-client-success');
360
+ return _context5.abrupt("return", {
271
361
  status: 'success',
272
362
  kind: 'customer'
273
363
  });
274
- case 26:
364
+ case 42:
275
365
  if (!(searchType === 'product' || searchType === 'local_product')) {
276
- _context4.next = 59;
366
+ _context5.next = 75;
277
367
  break;
278
368
  }
279
369
  list = data === null || data === void 0 ? void 0 : data.list;
280
370
  if (!(!Array.isArray(list) || list.length === 0)) {
281
- _context4.next = 31;
371
+ _context5.next = 47;
282
372
  break;
283
373
  }
284
- bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
285
- return _context4.abrupt("return", {
374
+ bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
375
+ return _context5.abrupt("return", {
286
376
  status: 'failed',
287
377
  reason: 'invalid_data'
288
378
  });
289
- case 31:
379
+ case 47:
290
380
  addedCount = 0;
291
381
  _iterator = _createForOfIteratorHelper(list);
292
- _context4.prev = 33;
382
+ _context5.prev = 49;
293
383
  _iterator.s();
294
- case 35:
384
+ case 51:
295
385
  if ((_step = _iterator.n()).done) {
296
- _context4.next = 47;
386
+ _context5.next = 63;
297
387
  break;
298
388
  }
299
389
  _item = _step.value;
300
- _context4.next = 39;
390
+ _context5.next = 55;
301
391
  return processScannedProductItem(host, _item, scanCode, bridge);
302
- case 39:
303
- outcome = _context4.sent;
392
+ case 55:
393
+ outcome = _context5.sent;
304
394
  if (outcome === 'added') {
305
395
  addedCount += 1;
306
396
  }
307
397
  if (!(outcome === 'cancelled')) {
308
- _context4.next = 43;
398
+ _context5.next = 59;
309
399
  break;
310
400
  }
311
- return _context4.abrupt("return", {
401
+ return _context5.abrupt("return", {
312
402
  status: 'cancelled'
313
403
  });
314
- case 43:
404
+ case 59:
315
405
  if (!(outcome === 'pending')) {
316
- _context4.next = 45;
406
+ _context5.next = 61;
317
407
  break;
318
408
  }
319
- return _context4.abrupt("return", {
409
+ return _context5.abrupt("return", {
320
410
  status: 'pending',
321
411
  kind: 'requiresDetail'
322
412
  });
323
- case 45:
324
- _context4.next = 35;
413
+ case 61:
414
+ _context5.next = 51;
325
415
  break;
326
- case 47:
327
- _context4.next = 52;
416
+ case 63:
417
+ _context5.next = 68;
328
418
  break;
329
- case 49:
330
- _context4.prev = 49;
331
- _context4.t0 = _context4["catch"](33);
332
- _iterator.e(_context4.t0);
333
- case 52:
334
- _context4.prev = 52;
419
+ case 65:
420
+ _context5.prev = 65;
421
+ _context5.t0 = _context5["catch"](49);
422
+ _iterator.e(_context5.t0);
423
+ case 68:
424
+ _context5.prev = 68;
335
425
  _iterator.f();
336
- return _context4.finish(52);
337
- case 55:
426
+ return _context5.finish(68);
427
+ case 71:
338
428
  if (!(addedCount > 0)) {
339
- _context4.next = 58;
429
+ _context5.next = 74;
340
430
  break;
341
431
  }
342
- bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'success');
343
- return _context4.abrupt("return", {
432
+ bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'success');
433
+ return _context5.abrupt("return", {
344
434
  status: 'success',
345
435
  kind: 'products',
346
436
  meta: {
347
437
  count: addedCount
348
438
  }
349
439
  });
350
- case 58:
351
- return _context4.abrupt("return", {
440
+ case 74:
441
+ return _context5.abrupt("return", {
352
442
  status: 'failed',
353
443
  reason: 'no_bridge'
354
444
  });
355
- case 59:
445
+ case 75:
356
446
  if (!(searchType === 'order')) {
357
- _context4.next = 68;
447
+ _context5.next = 84;
358
448
  break;
359
449
  }
360
450
  orderId = (_data$order_id = data === null || data === void 0 ? void 0 : data.order_id) !== null && _data$order_id !== void 0 ? _data$order_id : data === null || data === void 0 ? void 0 : data.id;
361
451
  if (orderId) {
362
- _context4.next = 64;
452
+ _context5.next = 80;
363
453
  break;
364
454
  }
365
- bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
366
- return _context4.abrupt("return", {
455
+ bridge === null || bridge === void 0 || (_bridge$onNotify8 = bridge.onNotify) === null || _bridge$onNotify8 === void 0 || _bridge$onNotify8.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
456
+ return _context5.abrupt("return", {
367
457
  status: 'failed',
368
458
  reason: 'invalid_data'
369
459
  });
370
- case 64:
460
+ case 80:
371
461
  if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
372
- _context4.next = 66;
462
+ _context5.next = 82;
373
463
  break;
374
464
  }
375
- return _context4.abrupt("return", {
465
+ return _context5.abrupt("return", {
376
466
  status: 'pending',
377
467
  kind: 'openOrder'
378
468
  });
379
- case 66:
469
+ case 82:
380
470
  bridge.openOrder({
381
471
  order_id: Number(orderId),
382
472
  business_code: (_data$business_code = data === null || data === void 0 ? void 0 : data.business_code) !== null && _data$business_code !== void 0 ? _data$business_code : host.getBusinessCode()
383
473
  });
384
- return _context4.abrupt("return", {
474
+ return _context5.abrupt("return", {
385
475
  status: 'pending',
386
476
  kind: 'openOrder'
387
477
  });
388
- case 68:
389
- return _context4.abrupt("return", {
478
+ case 84:
479
+ return _context5.abrupt("return", {
390
480
  status: 'failed',
391
481
  reason: 'invalid_data'
392
482
  });
393
- case 69:
483
+ case 85:
394
484
  case "end":
395
- return _context4.stop();
485
+ return _context5.stop();
396
486
  }
397
- }, _callee4, null, [[33, 49, 52, 55]]);
487
+ }, _callee5, null, [[49, 65, 68, 71]]);
398
488
  }));
399
489
  return _applyGlobalScan.apply(this, arguments);
400
490
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 将规格弹窗的称重结果写入订单行权威字段 product_sku。
3
+ * 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
4
+ */
5
+ export declare function buildProductSkuFromCacheItem(cacheItem: Record<string, any> | null | undefined): Record<string, any> | undefined;
@@ -0,0 +1,45 @@
1
+ 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; }
2
+ 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; }
3
+ 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; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ 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); }
6
+ 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); }
7
+ var WEIGHT_UNIT_MAP = {
8
+ KILOGRAMS: 'kg',
9
+ GRAMS: 'g',
10
+ POUNDS: 'lb',
11
+ OUNCES: 'oz'
12
+ };
13
+ function isRecord(value) {
14
+ return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
15
+ }
16
+
17
+ /**
18
+ * 将规格弹窗的称重结果写入订单行权威字段 product_sku。
19
+ * 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
20
+ */
21
+ export function buildProductSkuFromCacheItem(cacheItem) {
22
+ var _cacheItem$_extend, _cacheItem$_extend2, _weighing$unit_weight, _weighing$tare$label, _weighing$tare, _weighing$tare$value, _weighing$tare2, _weighing$weight, _weighing$net_weight;
23
+ var currentSku = isRecord(cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_sku) ? cacheItem.product_sku : undefined;
24
+ var weighing = isRecord(cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.weighing) ? cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.weighing : undefined;
25
+ var hasRuntimeWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1 && ((currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.net_weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight_source) !== undefined);
26
+ var isWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1;
27
+
28
+ // 普通商品维持旧转换行为,不把目录侧完整 SKU 引入订单行。
29
+ if (!isWeighingSku && !weighing) return undefined;
30
+ // 新版 SkuDetailModal 已直接生成 product_sku;_extend.weighing 只作为旧调用方回退。
31
+ if (hasRuntimeWeighingSku) return _objectSpread({}, currentSku);
32
+ if (!weighing) return currentSku ? _objectSpread({}, currentSku) : undefined;
33
+ return _objectSpread(_objectSpread({}, currentSku || {}), {}, {
34
+ open_sold_weight: 1,
35
+ unit_data_snapshot: weighing.scalePriceProduct,
36
+ unit: WEIGHT_UNIT_MAP[String(weighing.unit)] || weighing.unit,
37
+ unit_weight: (_weighing$unit_weight = weighing.unit_weight) !== null && _weighing$unit_weight !== void 0 ? _weighing$unit_weight : '1.000',
38
+ unit_price: weighing.unit_price,
39
+ weight_source: weighing.mode,
40
+ tare_name: (_weighing$tare$label = (_weighing$tare = weighing.tare) === null || _weighing$tare === void 0 ? void 0 : _weighing$tare.label) !== null && _weighing$tare$label !== void 0 ? _weighing$tare$label : '',
41
+ tare_weight: (_weighing$tare$value = (_weighing$tare2 = weighing.tare) === null || _weighing$tare2 === void 0 ? void 0 : _weighing$tare2.value) !== null && _weighing$tare$value !== void 0 ? _weighing$tare$value : 0,
42
+ weight: (_weighing$weight = weighing.weight) !== null && _weighing$weight !== void 0 ? _weighing$weight : 0,
43
+ net_weight: (_weighing$net_weight = weighing.net_weight) !== null && _weighing$net_weight !== void 0 ? _weighing$net_weight : 0
44
+ });
45
+ }
@@ -83,6 +83,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
+ private isUnpaidBooking;
86
87
  private countBookingOrders;
87
88
  private countCompletedBookings;
88
89
  private groupBookingsByResource;
@@ -29,6 +29,7 @@ import dayjs from 'dayjs';
29
29
  import { BaseModule } from "../../modules/BaseModule";
30
30
  import { SalesHooks } from "./types";
31
31
  export * from "./types";
32
+ var UNPAID_PAYMENT_STATUSES = new Set(['unpaid', 'partially_paid', 'payment_processing']);
32
33
 
33
34
  /**
34
35
  * Sales 解决方案基础骨架
@@ -415,6 +416,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
415
416
  var _booking$order$paymen, _booking$order;
416
417
  return String((_booking$order$paymen = (_booking$order = booking.order) === null || _booking$order === void 0 ? void 0 : _booking$order.payment_status) !== null && _booking$order$paymen !== void 0 ? _booking$order$paymen : '');
417
418
  }
419
+ }, {
420
+ key: "isUnpaidBooking",
421
+ value: function isUnpaidBooking(booking) {
422
+ return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
423
+ }
418
424
  }, {
419
425
  key: "countBookingOrders",
420
426
  value: function countBookingOrders(bookings) {
@@ -895,9 +901,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
895
901
  });
896
902
  completedBookingList = matchedBookingList.filter(function (booking) {
897
903
  return _this7.getBookingAppointmentStatus(booking) === 'completed';
898
- });
904
+ }); // const unpaidBookingList = matchedBookingList.filter(
905
+ // (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
906
+ // );
899
907
  unpaidBookingList = matchedBookingList.filter(function (booking) {
900
- return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
908
+ return _this7.isUnpaidBooking(booking);
901
909
  });
902
910
  bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
903
911
  completedBookings = completedBookingList.map(function (booking) {
@@ -1,9 +1,8 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
- import { BaseSalesImpl } from '../BaseSales';
3
- import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderState, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult } from './types';
2
+ import { BaseModule } from '../../modules/BaseModule';
3
+ import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } from './types';
4
4
  import type { UpdateOrderProductParams } from '../../modules/Order/types';
5
5
  import type { Discount } from '../../modules/Discount/types';
6
- import { RequestPlugin, WindowPlugin } from '../../plugins';
7
6
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
8
7
  import type { StrategyConfig } from '../../model/strategy/type';
9
8
  import type { ProductData } from '../../modules/Product/types';
@@ -16,16 +15,16 @@ interface ScanOrderItemRuleRuntimeConfig {
16
15
  submissionIndex?: number;
17
16
  custom?: Record<string, any>;
18
17
  }
19
- export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
18
+ export declare class ScanOrderImpl extends BaseModule implements Module {
20
19
  protected defaultName: string;
21
20
  protected defaultVersion: string;
22
21
  isSolution: boolean;
23
- protected initializeOptions: ModuleOptions;
24
- protected store: ScanOrderState;
25
- protected otherParams: Record<string, any>;
26
- protected cacheId: string | undefined;
27
- window: WindowPlugin;
28
- request: RequestPlugin;
22
+ private initializeOptions;
23
+ private store;
24
+ private otherParams;
25
+ private cacheId;
26
+ private window;
27
+ private request;
29
28
  private itemRuleEvaluator;
30
29
  private itemRuleConfigs;
31
30
  private itemRuleConfigsPromise;
@@ -54,10 +53,9 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
54
53
  private registerCustomerLoginListeners;
55
54
  private refreshOrderMarketingAfterLogin;
56
55
  constructor(name?: string, version?: string);
57
- protected getRegisteredModuleNames(): readonly string[];
58
- protected createSubModule(moduleName: string): Module | null;
59
56
  /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
60
57
  getCacheId(): string | undefined;
58
+ private destroyRegisteredChildModules;
61
59
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
62
60
  destroy(): Promise<void>;
63
61
  retryInit(): Promise<void>;
@@ -73,14 +71,12 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
73
71
  };
74
72
  getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
75
73
  updateTempOrderNote(note: string): string;
76
- updateTempOrderNote(note: string, sync: true): Promise<string>;
77
- updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
78
74
  setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
79
- service_type: 'dine_in' | '';
75
+ service_type: 'dine_in';
80
76
  pickup_reference_mode: 'counter_pickup' | 'table_service';
81
77
  };
82
78
  setPickupRef(buzzer: string): string;
83
- private ensureScanOrderTempOrder;
79
+ private ensureTempOrder;
84
80
  addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
85
81
  restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
86
82
  getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
@@ -96,10 +92,7 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
96
92
  }): Promise<void>;
97
93
  private findReservationRuleResource;
98
94
  private buildScanOrderResourceMetadata;
99
- private prepareRetailAvailability;
100
95
  private buildSubmitPayloadEnhancer;
101
- private isScanOrderMoreMode;
102
- private submitScanOrderMore;
103
96
  submitScanOrder<T = any>(): Promise<T>;
104
97
  addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
105
98
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -124,10 +117,8 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
124
117
  setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
125
118
  private normalizeResourceState;
126
119
  private resolveResourceSelectType;
127
- private fetchResourceOccupyDetailsByResourceId;
128
- private resolveAdditionalOrderFromOccupyDetail;
129
- checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
130
- restorePreviousOrderData(): Promise<void>;
120
+ private fetchResourceOccupyDetailByResourceId;
121
+ checkResourceAvailable(resourceId: string, hasOrderId: boolean): Promise<ScanOrderAvailabilityInfo>;
131
122
  getAdditionalOrderInfo(): Promise<{
132
123
  orderId: string;
133
124
  orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
@@ -150,9 +141,6 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
150
141
  clearUIState(): void;
151
142
  setEntryPaxNumber(number: number): Promise<void>;
152
143
  getEntryPaxNumber(): number | null;
153
- syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
154
- getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
155
- checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
156
144
  getFulfillmentModes(): {
157
145
  enablePickup: boolean;
158
146
  enableTableService: boolean;