@pisell/pisellos 2.2.276 → 2.2.800

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 (119) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +0 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  12. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  13. package/dist/modules/OpenData/index.d.ts +0 -2
  14. package/dist/modules/OpenData/index.js +0 -8
  15. package/dist/modules/Order/index.d.ts +8 -28
  16. package/dist/modules/Order/index.js +496 -808
  17. package/dist/modules/Order/types.d.ts +1 -35
  18. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  19. package/dist/modules/Order/utils.js +6 -10
  20. package/dist/modules/Payment/index.d.ts +0 -2
  21. package/dist/modules/Payment/index.js +49 -78
  22. package/dist/modules/Payment/types.d.ts +25 -104
  23. package/dist/modules/Payment/types.js +0 -17
  24. package/dist/modules/Payment/walletpass.d.ts +1 -38
  25. package/dist/modules/Payment/walletpass.js +114 -917
  26. package/dist/modules/Rules/index.d.ts +0 -3
  27. package/dist/modules/Rules/index.js +70 -100
  28. package/dist/server/index.d.ts +0 -25
  29. package/dist/server/index.js +1069 -2001
  30. package/dist/server/modules/index.d.ts +1 -1
  31. package/dist/server/modules/order/index.d.ts +4 -70
  32. package/dist/server/modules/order/index.js +728 -1816
  33. package/dist/server/modules/order/types.d.ts +3 -25
  34. package/dist/server/modules/order/types.js +1 -7
  35. package/dist/server/utils/small-ticket.js +2 -1
  36. package/dist/solution/BaseSales/index.d.ts +5 -104
  37. package/dist/solution/BaseSales/index.js +436 -1767
  38. package/dist/solution/BaseSales/types.d.ts +1 -55
  39. package/dist/solution/BaseSales/types.js +1 -2
  40. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  41. package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
  42. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  43. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -7
  44. package/dist/solution/BookingByStep/index.d.ts +1 -1
  45. package/dist/solution/BookingTicket/index.d.ts +5 -21
  46. package/dist/solution/BookingTicket/index.js +56 -139
  47. package/dist/solution/BookingTicket/types.d.ts +0 -1
  48. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  49. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +83 -173
  50. package/dist/solution/Sales/index.d.ts +0 -2
  51. package/dist/solution/Sales/index.js +4 -26
  52. package/dist/solution/ScanOrder/index.js +20 -31
  53. package/dist/solution/VenueBooking/index.d.ts +0 -1
  54. package/dist/solution/VenueBooking/index.js +19 -30
  55. package/dist/types/index.d.ts +0 -1
  56. package/lib/core/index.d.ts +0 -2
  57. package/lib/core/index.js +0 -4
  58. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  59. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  60. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  61. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  62. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  63. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  64. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  65. package/lib/model/strategy/adapter/promotion/index.js +0 -2
  66. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  67. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  68. package/lib/modules/OpenData/index.d.ts +0 -2
  69. package/lib/modules/OpenData/index.js +0 -5
  70. package/lib/modules/Order/index.d.ts +8 -28
  71. package/lib/modules/Order/index.js +69 -231
  72. package/lib/modules/Order/types.d.ts +1 -35
  73. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  74. package/lib/modules/Order/utils.js +4 -11
  75. package/lib/modules/Payment/index.d.ts +0 -2
  76. package/lib/modules/Payment/index.js +12 -33
  77. package/lib/modules/Payment/types.d.ts +25 -104
  78. package/lib/modules/Payment/types.js +0 -1
  79. package/lib/modules/Payment/walletpass.d.ts +1 -38
  80. package/lib/modules/Payment/walletpass.js +21 -730
  81. package/lib/modules/Rules/index.d.ts +0 -3
  82. package/lib/modules/Rules/index.js +9 -38
  83. package/lib/server/index.d.ts +0 -25
  84. package/lib/server/index.js +31 -726
  85. package/lib/server/modules/index.d.ts +1 -1
  86. package/lib/server/modules/order/index.d.ts +4 -70
  87. package/lib/server/modules/order/index.js +69 -818
  88. package/lib/server/modules/order/types.d.ts +3 -25
  89. package/lib/server/modules/order/types.js +0 -1
  90. package/lib/server/utils/small-ticket.js +1 -1
  91. package/lib/solution/BaseSales/index.d.ts +5 -104
  92. package/lib/solution/BaseSales/index.js +27 -858
  93. package/lib/solution/BaseSales/types.d.ts +1 -55
  94. package/lib/solution/BaseSales/types.js +1 -2
  95. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  96. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
  97. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  98. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -4
  99. package/lib/solution/BookingByStep/index.d.ts +1 -1
  100. package/lib/solution/BookingTicket/index.d.ts +5 -21
  101. package/lib/solution/BookingTicket/index.js +13 -64
  102. package/lib/solution/BookingTicket/types.d.ts +0 -1
  103. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  104. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +5 -37
  105. package/lib/solution/Sales/index.d.ts +0 -2
  106. package/lib/solution/Sales/index.js +6 -20
  107. package/lib/solution/ScanOrder/index.js +0 -8
  108. package/lib/solution/VenueBooking/index.d.ts +0 -1
  109. package/lib/solution/VenueBooking/index.js +0 -8
  110. package/lib/types/index.d.ts +0 -1
  111. package/package.json +1 -1
  112. package/dist/modules/Order/payment-utils.d.ts +0 -26
  113. package/dist/modules/Order/payment-utils.js +0 -225
  114. package/dist/utils/payment-number.d.ts +0 -9
  115. package/dist/utils/payment-number.js +0 -69
  116. package/lib/modules/Order/payment-utils.d.ts +0 -26
  117. package/lib/modules/Order/payment-utils.js +0 -224
  118. package/lib/utils/payment-number.d.ts +0 -9
  119. package/lib/utils/payment-number.js +0 -64
@@ -191,300 +191,210 @@ 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 _callee5(host, formatted, bridge) {
195
- var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _host$refreshWalletAs, _bridge$onNotify5, snapshot, scannedCustomerIsWalkIn, trySelectWalletAsset, _result$isAccepted, _walletSelection, result, walletSelection, _data$id, _promotionResult$isAc, 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) {
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) {
198
198
  case 0:
199
199
  searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode;
200
200
  if (!(searchType === 'wallet')) {
201
- _context5.next = 8;
201
+ _context4.next = 8;
202
202
  break;
203
203
  }
204
204
  if (data) {
205
- _context5.next = 5;
205
+ _context4.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 _context5.abrupt("return", {
209
+ return _context4.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 _context5.abrupt("return", {
216
+ return _context4.abrupt("return", {
217
217
  status: 'success',
218
218
  kind: 'customer'
219
219
  });
220
220
  case 8:
221
221
  if (!(searchType === 'walletPass')) {
222
- _context5.next = 42;
222
+ _context4.next = 26;
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:
225
235
  snapshot = host.getOrderCustomerSnapshot();
226
236
  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
- }();
285
237
  if (!(isWalkInCustomer(snapshot) || scannedCustomerIsWalkIn)) {
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;
238
+ _context4.next = 23;
295
239
  break;
296
240
  }
297
- return _context5.abrupt("return", _walletSelection);
298
- case 18:
299
241
  if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
300
- _context5.next = 20;
242
+ _context4.next = 17;
301
243
  break;
302
244
  }
303
- return _context5.abrupt("return", {
245
+ return _context4.abrupt("return", {
304
246
  status: 'failed',
305
247
  reason: 'no_bridge'
306
248
  });
307
- case 20:
308
- _context5.next = 22;
249
+ case 17:
250
+ _context4.next = 19;
309
251
  return bridge.applyPromotionCode(scanCode);
310
- case 22:
311
- result = _context5.sent;
312
- if (!((_result$isAccepted = result === null || result === void 0 ? void 0 : result.isAccepted) !== null && _result$isAccepted !== void 0 ? _result$isAccepted : result === null || result === void 0 ? void 0 : result.isAvailable)) {
313
- _context5.next = 25;
252
+ case 19:
253
+ result = _context4.sent;
254
+ if (!(result !== null && result !== void 0 && result.isAvailable)) {
255
+ _context4.next = 22;
314
256
  break;
315
257
  }
316
- return _context5.abrupt("return", {
258
+ return _context4.abrupt("return", {
317
259
  status: 'success',
318
260
  kind: 'promotion'
319
261
  });
320
- case 25:
321
- return _context5.abrupt("return", {
262
+ case 22:
263
+ return _context4.abrupt("return", {
322
264
  status: 'failed',
323
265
  reason: 'invalid_data'
324
266
  });
325
- case 26:
267
+ case 23:
326
268
  host.setOrderCustomer(data);
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$isAc = promotionResult === null || promotionResult === void 0 ? void 0 : promotionResult.isAccepted) !== null && _promotionResult$isAc !== void 0 ? _promotionResult$isAc : promotionResult === null || promotionResult === void 0 ? 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", {
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", {
361
271
  status: 'success',
362
272
  kind: 'customer'
363
273
  });
364
- case 42:
274
+ case 26:
365
275
  if (!(searchType === 'product' || searchType === 'local_product')) {
366
- _context5.next = 75;
276
+ _context4.next = 59;
367
277
  break;
368
278
  }
369
279
  list = data === null || data === void 0 ? void 0 : data.list;
370
280
  if (!(!Array.isArray(list) || list.length === 0)) {
371
- _context5.next = 47;
281
+ _context4.next = 31;
372
282
  break;
373
283
  }
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", {
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", {
376
286
  status: 'failed',
377
287
  reason: 'invalid_data'
378
288
  });
379
- case 47:
289
+ case 31:
380
290
  addedCount = 0;
381
291
  _iterator = _createForOfIteratorHelper(list);
382
- _context5.prev = 49;
292
+ _context4.prev = 33;
383
293
  _iterator.s();
384
- case 51:
294
+ case 35:
385
295
  if ((_step = _iterator.n()).done) {
386
- _context5.next = 63;
296
+ _context4.next = 47;
387
297
  break;
388
298
  }
389
299
  _item = _step.value;
390
- _context5.next = 55;
300
+ _context4.next = 39;
391
301
  return processScannedProductItem(host, _item, scanCode, bridge);
392
- case 55:
393
- outcome = _context5.sent;
302
+ case 39:
303
+ outcome = _context4.sent;
394
304
  if (outcome === 'added') {
395
305
  addedCount += 1;
396
306
  }
397
307
  if (!(outcome === 'cancelled')) {
398
- _context5.next = 59;
308
+ _context4.next = 43;
399
309
  break;
400
310
  }
401
- return _context5.abrupt("return", {
311
+ return _context4.abrupt("return", {
402
312
  status: 'cancelled'
403
313
  });
404
- case 59:
314
+ case 43:
405
315
  if (!(outcome === 'pending')) {
406
- _context5.next = 61;
316
+ _context4.next = 45;
407
317
  break;
408
318
  }
409
- return _context5.abrupt("return", {
319
+ return _context4.abrupt("return", {
410
320
  status: 'pending',
411
321
  kind: 'requiresDetail'
412
322
  });
413
- case 61:
414
- _context5.next = 51;
323
+ case 45:
324
+ _context4.next = 35;
415
325
  break;
416
- case 63:
417
- _context5.next = 68;
326
+ case 47:
327
+ _context4.next = 52;
418
328
  break;
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;
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;
425
335
  _iterator.f();
426
- return _context5.finish(68);
427
- case 71:
336
+ return _context4.finish(52);
337
+ case 55:
428
338
  if (!(addedCount > 0)) {
429
- _context5.next = 74;
339
+ _context4.next = 58;
430
340
  break;
431
341
  }
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", {
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", {
434
344
  status: 'success',
435
345
  kind: 'products',
436
346
  meta: {
437
347
  count: addedCount
438
348
  }
439
349
  });
440
- case 74:
441
- return _context5.abrupt("return", {
350
+ case 58:
351
+ return _context4.abrupt("return", {
442
352
  status: 'failed',
443
353
  reason: 'no_bridge'
444
354
  });
445
- case 75:
355
+ case 59:
446
356
  if (!(searchType === 'order')) {
447
- _context5.next = 84;
357
+ _context4.next = 68;
448
358
  break;
449
359
  }
450
360
  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;
451
361
  if (orderId) {
452
- _context5.next = 80;
362
+ _context4.next = 64;
453
363
  break;
454
364
  }
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", {
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", {
457
367
  status: 'failed',
458
368
  reason: 'invalid_data'
459
369
  });
460
- case 80:
370
+ case 64:
461
371
  if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
462
- _context5.next = 82;
372
+ _context4.next = 66;
463
373
  break;
464
374
  }
465
- return _context5.abrupt("return", {
375
+ return _context4.abrupt("return", {
466
376
  status: 'pending',
467
377
  kind: 'openOrder'
468
378
  });
469
- case 82:
379
+ case 66:
470
380
  bridge.openOrder({
471
381
  order_id: Number(orderId),
472
382
  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()
473
383
  });
474
- return _context5.abrupt("return", {
384
+ return _context4.abrupt("return", {
475
385
  status: 'pending',
476
386
  kind: 'openOrder'
477
387
  });
478
- case 84:
479
- return _context5.abrupt("return", {
388
+ case 68:
389
+ return _context4.abrupt("return", {
480
390
  status: 'failed',
481
391
  reason: 'invalid_data'
482
392
  });
483
- case 85:
393
+ case 69:
484
394
  case "end":
485
- return _context5.stop();
395
+ return _context4.stop();
486
396
  }
487
- }, _callee5, null, [[49, 65, 68, 71]]);
397
+ }, _callee4, null, [[33, 49, 52, 55]]);
488
398
  }));
489
399
  return _applyGlobalScan.apply(this, arguments);
490
400
  }
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
- private isUnpaidBooking;
87
86
  private countBookingOrders;
88
87
  private countCompletedBookings;
89
88
  private groupBookingsByResource;
@@ -95,7 +94,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
95
94
  * 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
96
95
  * 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
97
96
  * 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
98
- * - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
99
97
  */
100
98
  private pickBookingsForCurrentPoint;
101
99
  /**
@@ -29,7 +29,6 @@ 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']);
33
32
 
34
33
  /**
35
34
  * Sales 解决方案基础骨架
@@ -416,11 +415,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
416
415
  var _booking$order$paymen, _booking$order;
417
416
  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 : '');
418
417
  }
419
- }, {
420
- key: "isUnpaidBooking",
421
- value: function isUnpaidBooking(booking) {
422
- return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
423
- }
424
418
  }, {
425
419
  key: "countBookingOrders",
426
420
  value: function countBookingOrders(bookings) {
@@ -485,13 +479,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
485
479
  * 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
486
480
  * 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
487
481
  * 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
488
- * - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
489
482
  */
490
483
  }, {
491
484
  key: "pickBookingsForCurrentPoint",
492
485
  value: function pickBookingsForCurrentPoint(current, bookings) {
493
486
  var _this4 = this;
494
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
495
487
  if (bookings.length === 0) return [];
496
488
  var currentDayStart = current.startOf('day');
497
489
  var currentDayEnd = current.endOf('day');
@@ -506,13 +498,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
506
498
  if (dayScopedBookings.length === 0) return [];
507
499
  var appendNextStartGroupIfNeeded = function appendNextStartGroupIfNeeded(selectedBookings) {
508
500
  if (selectedBookings.length === 0) return selectedBookings;
509
- if (options.includeAllFuture) {
510
- var allFutureBookings = dayScopedBookings.filter(function (booking) {
511
- var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
512
- return startAt.isValid() && startAt.isAfter(current);
513
- });
514
- return [].concat(_toConsumableArray(selectedBookings), _toConsumableArray(allFutureBookings));
515
- }
516
501
  var shouldAppendNextGroup = selectedBookings.some(function (booking) {
517
502
  return booking.status === 'reserved' || booking.status === 'occupied';
518
503
  });
@@ -563,7 +548,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
563
548
  return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current, 'day');
564
549
  });
565
550
  if (upcoming.length > 0) {
566
- if (options.includeAllFuture) return upcoming;
567
551
  var firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
568
552
  var upcomingStartGroup = upcoming.filter(function (booking) {
569
553
  var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
@@ -911,15 +895,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
911
895
  });
912
896
  completedBookingList = matchedBookingList.filter(function (booking) {
913
897
  return _this7.getBookingAppointmentStatus(booking) === 'completed';
914
- }); // const unpaidBookingList = matchedBookingList.filter(
915
- // (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
916
- // );
917
- unpaidBookingList = matchedBookingList.filter(function (booking) {
918
- return _this7.isUnpaidBooking(booking);
919
898
  });
920
- bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList), {
921
- includeAllFuture: true
899
+ unpaidBookingList = matchedBookingList.filter(function (booking) {
900
+ return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
922
901
  });
902
+ bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
923
903
  completedBookings = completedBookingList.map(function (booking) {
924
904
  return _objectSpread(_objectSpread({}, booking), {}, {
925
905
  status: 'compelete',
@@ -931,9 +911,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
931
911
  remainingReserveTime: undefined
932
912
  });
933
913
  });
934
- unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList), {
935
- includeAllFuture: true
936
- });
914
+ unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList));
937
915
  orderCount = this.countBookingOrders(statsBookingList);
938
916
  bookingCount = statsBookingList.length;
939
917
  compeleteBookingCount = this.countCompletedBookings(statsBookingList);
@@ -41,10 +41,6 @@ import { composeLinePrice, createUuidV4, getProductSkuOptions, normalizeSubmitCo
41
41
  import dayjs from 'dayjs';
42
42
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
43
43
  export * from "./types";
44
- function isItemRewardProductDiscount(discount) {
45
- var _discount$metadata, _discount$metadata2;
46
- return (discount === null || discount === void 0 ? void 0 : discount.type) === 'product' && (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.source) === 'promotion' && (discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.actionType) === 'ITEM_REWARD';
47
- }
48
44
  export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
49
45
  _inherits(ScanOrderImpl, _BaseModule);
50
46
  var _super = _createSuper(ScanOrderImpl);
@@ -1181,7 +1177,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1181
1177
  _iterator3.s();
1182
1178
  case 19:
1183
1179
  if ((_step3 = _iterator3.n()).done) {
1184
- _context15.next = 36;
1180
+ _context15.next = 33;
1185
1181
  break;
1186
1182
  }
1187
1183
  product = _step3.value;
@@ -1189,15 +1185,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1189
1185
  _context15.next = 23;
1190
1186
  break;
1191
1187
  }
1192
- return _context15.abrupt("continue", 34);
1188
+ return _context15.abrupt("continue", 31);
1193
1189
  case 23:
1194
- if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
1195
- _context15.next = 26;
1196
- break;
1197
- }
1198
- product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
1199
- return _context15.abrupt("continue", 34);
1200
- case 26:
1201
1190
  product.discount_list = (product.discount_list || []).filter(function (pd) {
1202
1191
  var _pd$discount$resource, _pd$discount;
1203
1192
  var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
@@ -1221,47 +1210,47 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1221
1210
  mainPrice: newMainSellingPrice,
1222
1211
  bundle: product.product_bundle
1223
1212
  });
1224
- case 34:
1213
+ case 31:
1225
1214
  _context15.next = 19;
1226
1215
  break;
1227
- case 36:
1228
- _context15.next = 41;
1216
+ case 33:
1217
+ _context15.next = 38;
1229
1218
  break;
1230
- case 38:
1231
- _context15.prev = 38;
1219
+ case 35:
1220
+ _context15.prev = 35;
1232
1221
  _context15.t0 = _context15["catch"](17);
1233
1222
  _iterator3.e(_context15.t0);
1234
- case 41:
1235
- _context15.prev = 41;
1223
+ case 38:
1224
+ _context15.prev = 38;
1236
1225
  _iterator3.f();
1237
- return _context15.finish(41);
1238
- case 44:
1226
+ return _context15.finish(38);
1227
+ case 41:
1239
1228
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1240
- _context15.next = 47;
1229
+ _context15.next = 44;
1241
1230
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1242
- case 47:
1231
+ case 44:
1243
1232
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1244
1233
  return d.isSelected;
1245
1234
  });
1246
- _context15.next = 50;
1235
+ _context15.next = 47;
1247
1236
  return this.store.order.recalculateSummary({
1248
1237
  createIfMissing: true
1249
1238
  });
1250
- case 50:
1239
+ case 47:
1251
1240
  this.store.order.persistTempOrder();
1252
1241
  this.logMethodSuccess('setDiscountSelected', params);
1253
- _context15.next = 58;
1242
+ _context15.next = 55;
1254
1243
  break;
1255
- case 54:
1256
- _context15.prev = 54;
1244
+ case 51:
1245
+ _context15.prev = 51;
1257
1246
  _context15.t1 = _context15["catch"](1);
1258
1247
  this.logMethodError('setDiscountSelected', _context15.t1);
1259
1248
  throw _context15.t1;
1260
- case 58:
1249
+ case 55:
1261
1250
  case "end":
1262
1251
  return _context15.stop();
1263
1252
  }
1264
- }, _callee15, this, [[1, 54], [17, 38, 41, 44]]);
1253
+ }, _callee15, this, [[1, 51], [17, 35, 38, 41]]);
1265
1254
  }));
1266
1255
  function setDiscountSelected(_x8) {
1267
1256
  return _setDiscountSelected.apply(this, arguments);
@@ -152,7 +152,6 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
152
152
  private recalculateOrderPricesFromQuotation;
153
153
  scanCode(code: string, customerId?: number): Promise<{
154
154
  isAvailable: boolean;
155
- isAccepted?: boolean | undefined;
156
155
  discountList: import("../../modules/Discount").Discount[];
157
156
  type: "server" | "clientCalc";
158
157
  unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;