@pisell/pisellos 2.3.233 → 2.3.234

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 (30) hide show
  1. package/dist/modules/Order/index.d.ts +9 -8
  2. package/dist/modules/Order/index.js +273 -255
  3. package/dist/modules/Order/utils.d.ts +1 -0
  4. package/dist/modules/Order/utils.js +3 -2
  5. package/dist/shared/payment/loadPaymentMethods.d.ts +2 -1
  6. package/dist/shared/payment/loadPaymentMethods.js +13 -12
  7. package/dist/solution/BaseSales/index.d.ts +3 -0
  8. package/dist/solution/BaseSales/index.js +445 -402
  9. package/dist/solution/BookingTicket/index.d.ts +3 -1
  10. package/dist/solution/BookingTicket/index.js +49 -43
  11. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
  12. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +69 -13
  13. package/dist/utils/platform.d.ts +2 -0
  14. package/dist/utils/platform.js +4 -0
  15. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  16. package/lib/modules/Order/index.d.ts +9 -8
  17. package/lib/modules/Order/index.js +57 -43
  18. package/lib/modules/Order/utils.d.ts +1 -0
  19. package/lib/modules/Order/utils.js +2 -1
  20. package/lib/shared/payment/loadPaymentMethods.d.ts +2 -1
  21. package/lib/shared/payment/loadPaymentMethods.js +10 -9
  22. package/lib/solution/BaseSales/index.d.ts +3 -0
  23. package/lib/solution/BaseSales/index.js +45 -22
  24. package/lib/solution/BookingTicket/index.d.ts +3 -1
  25. package/lib/solution/BookingTicket/index.js +4 -1
  26. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
  27. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +44 -5
  28. package/lib/utils/platform.d.ts +2 -0
  29. package/lib/utils/platform.js +5 -0
  30. package/package.json +1 -1
@@ -85,7 +85,9 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
85
85
  * 让现有 setActiveCustomer / getActiveCustomer 调用方零成本拿到详情态客户。
86
86
  */
87
87
  loadSalesDetail(orderIdOrParams: number | string | LoadSalesDetailParams): Promise<ISalesDetail>;
88
- scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
88
+ scanPromotionCode(code: string, customerId?: number, options?: {
89
+ productVouchersOnly?: boolean;
90
+ }): Promise<BaseSalesScanCodeResult>;
89
91
  private hydrateOrderCustomerFromScanDiscounts;
90
92
  private getDiscountCustomerId;
91
93
  resolveCustomerById(customerId: string | number): Promise<ICustomer | null>;
@@ -822,63 +822,69 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
822
822
  }, {
823
823
  key: "scanPromotionCode",
824
824
  value: function () {
825
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
825
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId, options) {
826
826
  var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
827
827
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
828
828
  while (1) switch (_context12.prev = _context12.next) {
829
829
  case 0:
830
- if (this.store.order) {
830
+ if (!(options !== null && options !== void 0 && options.productVouchersOnly && (customerId === 0 || customerId === 1))) {
831
831
  _context12.next = 2;
832
832
  break;
833
833
  }
834
- throw new Error('order 模块未初始化');
834
+ return _context12.abrupt("return", _get(_getPrototypeOf(BookingTicketImpl.prototype), "scanPromotionCode", this).call(this, code, customerId, options));
835
835
  case 2:
836
- _context12.next = 4;
837
- return this.store.order.scanCode(code, customerId);
836
+ if (this.store.order) {
837
+ _context12.next = 4;
838
+ break;
839
+ }
840
+ throw new Error('order 模块未初始化');
838
841
  case 4:
842
+ _context12.next = 6;
843
+ return this.store.order.scanCode(code, customerId);
844
+ case 6:
839
845
  raw = _context12.sent;
840
846
  scannedList = raw.scannedDiscountList || [];
841
847
  extractedCustomerId = this.getDiscountCustomerId(scannedList);
842
848
  hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
843
849
  isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
844
850
  if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
845
- _context12.next = 18;
851
+ _context12.next = 20;
846
852
  break;
847
853
  }
848
- _context12.prev = 10;
849
- _context12.next = 13;
854
+ _context12.prev = 12;
855
+ _context12.next = 15;
850
856
  return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
851
- case 13:
852
- _context12.next = 18;
853
- break;
854
857
  case 15:
855
- _context12.prev = 15;
856
- _context12.t0 = _context12["catch"](10);
858
+ _context12.next = 20;
859
+ break;
860
+ case 17:
861
+ _context12.prev = 17;
862
+ _context12.t0 = _context12["catch"](12);
857
863
  // 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
858
864
  console.warn('[BookingTicket] scan discount customer resolve failed', {
859
865
  customerId: extractedCustomerId,
860
866
  error: _context12.t0
861
867
  });
862
- case 18:
868
+ case 20:
863
869
  if (!raw.isAvailable) {
864
- _context12.next = 25;
870
+ _context12.next = 27;
865
871
  break;
866
872
  }
867
- _context12.next = 21;
873
+ _context12.next = 23;
868
874
  return this.store.order.recalculateSummary({
869
875
  createIfMissing: true
870
876
  });
871
- case 21:
877
+ case 23:
872
878
  this.store.order.persistTempOrder();
873
879
  tempOrder = this.store.order.ensureTempOrder();
874
- _context12.next = 25;
880
+ _context12.next = 27;
875
881
  return this.effectsEmit('onDiscountApplied', {
876
882
  productList: tempOrder.products || [],
877
883
  discountList: this.store.order.getDiscountList(),
878
884
  selectedDiscountList: tempOrder.discount_list || [],
879
885
  tempOrder: tempOrder
880
886
  });
881
- case 25:
887
+ case 27:
882
888
  return _context12.abrupt("return", _objectSpread(_objectSpread({
883
889
  isAvailable: raw.isAvailable
884
890
  }, raw.isAccepted !== undefined ? {
@@ -889,13 +895,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
889
895
  unavailableReasonKey: raw.unavailableReasonKey,
890
896
  scannedDiscountList: raw.scannedDiscountList
891
897
  }));
892
- case 26:
898
+ case 28:
893
899
  case "end":
894
900
  return _context12.stop();
895
901
  }
896
- }, _callee12, this, [[10, 15]]);
902
+ }, _callee12, this, [[12, 17]]);
897
903
  }));
898
- function scanPromotionCode(_x4, _x5) {
904
+ function scanPromotionCode(_x4, _x5, _x6) {
899
905
  return _scanPromotionCode.apply(this, arguments);
900
906
  }
901
907
  return scanPromotionCode;
@@ -940,7 +946,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
940
946
  }
941
947
  }, _callee13, this);
942
948
  }));
943
- function hydrateOrderCustomerFromScanDiscounts(_x6) {
949
+ function hydrateOrderCustomerFromScanDiscounts(_x7) {
944
950
  return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
945
951
  }
946
952
  return hydrateOrderCustomerFromScanDiscounts;
@@ -1021,7 +1027,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1021
1027
  }
1022
1028
  }, _callee14, this);
1023
1029
  }));
1024
- function resolveCustomerById(_x7) {
1030
+ function resolveCustomerById(_x8) {
1025
1031
  return _resolveCustomerById.apply(this, arguments);
1026
1032
  }
1027
1033
  return resolveCustomerById;
@@ -1126,7 +1132,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1126
1132
  }
1127
1133
  }, _callee15, this, [[11, 21]]);
1128
1134
  }));
1129
- function setBookingStatus(_x8) {
1135
+ function setBookingStatus(_x9) {
1130
1136
  return _setBookingStatus.apply(this, arguments);
1131
1137
  }
1132
1138
  return setBookingStatus;
@@ -1221,7 +1227,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1221
1227
  }
1222
1228
  }, _callee16, this, [[14, 24]]);
1223
1229
  }));
1224
- function transitionChildBooking(_x9) {
1230
+ function transitionChildBooking(_x10) {
1225
1231
  return _transitionChildBooking.apply(this, arguments);
1226
1232
  }
1227
1233
  return transitionChildBooking;
@@ -1427,7 +1433,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1427
1433
  }
1428
1434
  }, _callee20, this, [[1, 9]]);
1429
1435
  }));
1430
- function queryProductDetail(_x10, _x11) {
1436
+ function queryProductDetail(_x11, _x12) {
1431
1437
  return _queryProductDetail.apply(this, arguments);
1432
1438
  }
1433
1439
  return queryProductDetail;
@@ -1461,7 +1467,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1461
1467
  }
1462
1468
  }, _callee21, this);
1463
1469
  }));
1464
- function loadProductDetail(_x12, _x13) {
1470
+ function loadProductDetail(_x13, _x14) {
1465
1471
  return _loadProductDetail.apply(this, arguments);
1466
1472
  }
1467
1473
  return loadProductDetail;
@@ -1643,7 +1649,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1643
1649
  }
1644
1650
  }, _callee23, this);
1645
1651
  }));
1646
- function getProductByIds(_x14, _x15) {
1652
+ function getProductByIds(_x15, _x16) {
1647
1653
  return _getProductByIds.apply(this, arguments);
1648
1654
  }
1649
1655
  return getProductByIds;
@@ -1677,7 +1683,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1677
1683
  }
1678
1684
  }, _callee24, this);
1679
1685
  }));
1680
- function getScheduleTimePoints(_x16) {
1686
+ function getScheduleTimePoints(_x17) {
1681
1687
  return _getScheduleTimePoints.apply(this, arguments);
1682
1688
  }
1683
1689
  return getScheduleTimePoints;
@@ -2042,7 +2048,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2042
2048
  }
2043
2049
  }, _callee29, this);
2044
2050
  }));
2045
- function applyDefaultOrderCustomerContactInfo(_x17) {
2051
+ function applyDefaultOrderCustomerContactInfo(_x18) {
2046
2052
  return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
2047
2053
  }
2048
2054
  return applyDefaultOrderCustomerContactInfo;
@@ -2204,7 +2210,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2204
2210
  }
2205
2211
  }, _callee31);
2206
2212
  }));
2207
- return function (_x18) {
2213
+ return function (_x19) {
2208
2214
  return _ref13.apply(this, arguments);
2209
2215
  };
2210
2216
  }()).catch(function () {
@@ -2501,7 +2507,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2501
2507
  }
2502
2508
  }, _callee36, this);
2503
2509
  }));
2504
- function prepareProductPriceQueryContext(_x19) {
2510
+ function prepareProductPriceQueryContext(_x20) {
2505
2511
  return _prepareProductPriceQueryContext.apply(this, arguments);
2506
2512
  }
2507
2513
  return prepareProductPriceQueryContext;
@@ -2576,7 +2582,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2576
2582
  }
2577
2583
  }, _callee37, this, [[0, 7]]);
2578
2584
  }));
2579
- function changeCustomerPage(_x20, _x21) {
2585
+ function changeCustomerPage(_x21, _x22) {
2580
2586
  return _changeCustomerPage.apply(this, arguments);
2581
2587
  }
2582
2588
  return changeCustomerPage;
@@ -3178,7 +3184,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3178
3184
  }
3179
3185
  }, _callee41, this);
3180
3186
  }));
3181
- function updateProductInOrder(_x22) {
3187
+ function updateProductInOrder(_x23) {
3182
3188
  return _updateProductInOrder.apply(this, arguments);
3183
3189
  }
3184
3190
  return updateProductInOrder;
@@ -3412,7 +3418,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3412
3418
  }
3413
3419
  }, _callee43, this, [[4, 40]]);
3414
3420
  }));
3415
- function handleGlobalScanCode(_x23, _x24) {
3421
+ function handleGlobalScanCode(_x24, _x25) {
3416
3422
  return _handleGlobalScanCode.apply(this, arguments);
3417
3423
  }
3418
3424
  return handleGlobalScanCode;
@@ -3452,7 +3458,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3452
3458
  }
3453
3459
  }, _callee44, this);
3454
3460
  }));
3455
- function getGlobalScanCodeType(_x25) {
3461
+ function getGlobalScanCodeType(_x26) {
3456
3462
  return _getGlobalScanCodeType.apply(this, arguments);
3457
3463
  }
3458
3464
  return getGlobalScanCodeType;
@@ -3550,7 +3556,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3550
3556
  }
3551
3557
  }, _callee45, this);
3552
3558
  }));
3553
- function addAddTimeProductToBooking(_x26) {
3559
+ function addAddTimeProductToBooking(_x27) {
3554
3560
  return _addAddTimeProductToBooking.apply(this, arguments);
3555
3561
  }
3556
3562
  return addAddTimeProductToBooking;
@@ -3650,7 +3656,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3650
3656
  }
3651
3657
  }, _callee46, this, [[13, 31, 34, 37]]);
3652
3658
  }));
3653
- function addAddTimeProductsToBooking(_x27) {
3659
+ function addAddTimeProductsToBooking(_x28) {
3654
3660
  return _addAddTimeProductsToBooking.apply(this, arguments);
3655
3661
  }
3656
3662
  return addAddTimeProductsToBooking;
@@ -3700,7 +3706,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3700
3706
  }
3701
3707
  }, _callee47, this);
3702
3708
  }));
3703
- function setOtherParams(_x28) {
3709
+ function setOtherParams(_x29) {
3704
3710
  return _setOtherParams.apply(this, arguments);
3705
3711
  }
3706
3712
  return setOtherParams;
@@ -3774,7 +3780,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3774
3780
  }
3775
3781
  }, _callee48, this);
3776
3782
  }));
3777
- function handlePrintWristband(_x29) {
3783
+ function handlePrintWristband(_x30) {
3778
3784
  return _handlePrintWristband.apply(this, arguments);
3779
3785
  }
3780
3786
  return handlePrintWristband;
@@ -3871,7 +3877,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3871
3877
  }
3872
3878
  }, _callee49, this, [[11,, 14, 17]]);
3873
3879
  }));
3874
- function handleRedeem(_x30) {
3880
+ function handleRedeem(_x31) {
3875
3881
  return _handleRedeem.apply(this, arguments);
3876
3882
  }
3877
3883
  return handleRedeem;
@@ -4067,7 +4073,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
4067
4073
  }
4068
4074
  }, _callee51, this);
4069
4075
  }));
4070
- function updateTicketArrival(_x31) {
4076
+ function updateTicketArrival(_x32) {
4071
4077
  return _updateTicketArrival.apply(this, arguments);
4072
4078
  }
4073
4079
  return updateTicketArrival;
@@ -4,5 +4,5 @@ import type { GlobalScanFormattedResult } from './formatGlobalScan';
4
4
  export interface ProductVoucherCollectionScanHost extends GlobalScanApplyHost {
5
5
  loadCustomerDiscounts(): Promise<Record<string, any>[]>;
6
6
  }
7
- /** Resolve the scanned account, then collect all of that customer's vouchers. */
7
+ /** Collect vouchers by member account or by scan code for a walk-in. */
8
8
  export declare function applyProductVoucherCollectionScan(host: ProductVoucherCollectionScanHost, formatted: GlobalScanFormattedResult, bridge: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
@@ -7,15 +7,16 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  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); }
8
8
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
9
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
+ import { isWalkInCustomer } from "../cartView";
10
11
  import { applyGlobalScan } from "./applyGlobalScan";
11
- /** Resolve the scanned account, then collect all of that customer's vouchers. */
12
+ /** Collect vouchers by member account or by scan code for a walk-in. */
12
13
  export function applyProductVoucherCollectionScan(_x, _x2, _x3) {
13
14
  return _applyProductVoucherCollectionScan.apply(this, arguments);
14
15
  }
15
16
  function _applyProductVoucherCollectionScan() {
16
17
  _applyProductVoucherCollectionScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(host, formatted, bridge) {
17
18
  var _ref, _formatted$customerId, _formatted$data, _formatted$data2, _bridge$requestCustom;
18
- var assertCurrent, isPass, customerScan, result, vouchers;
19
+ var assertCurrent, isPass, customerId, _promotion$isAccepted, promotion, redemption, customerScan, result, vouchers;
19
20
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
20
21
  while (1) switch (_context2.prev = _context2.next) {
21
22
  case 0:
@@ -25,16 +26,71 @@ function _applyProductVoucherCollectionScan() {
25
26
  throw new DOMException('Scan session ended', 'AbortError');
26
27
  }
27
28
  };
28
- isPass = formatted.searchType === 'walletPass'; // Order numbers and wristbands resolve through batch-search. Their returned
29
- // passes identify the customer; they are not the collection's voucher list.
29
+ assertCurrent();
30
+ isPass = formatted.searchType === 'walletPass';
31
+ customerId = (_ref = (_formatted$customerId = formatted.customerId) !== null && _formatted$customerId !== void 0 ? _formatted$customerId : (_formatted$data = formatted.data) === null || _formatted$data === void 0 ? void 0 : _formatted$data.id) !== null && _ref !== void 0 ? _ref : (_formatted$data2 = formatted.data) === null || _formatted$data2 === void 0 ? void 0 : _formatted$data2.customer_id;
32
+ if (!(isPass && customerId != null && customerId !== '' && isWalkInCustomer({
33
+ id: customerId
34
+ }))) {
35
+ _context2.next = 17;
36
+ break;
37
+ }
38
+ if (!formatted.isWalletPassUnavailableAtStore) {
39
+ _context2.next = 7;
40
+ break;
41
+ }
42
+ return _context2.abrupt("return", {
43
+ status: 'failed',
44
+ reason: 'invalid_data'
45
+ });
46
+ case 7:
47
+ if (bridge.applyPromotionCode) {
48
+ _context2.next = 9;
49
+ break;
50
+ }
51
+ return _context2.abrupt("return", {
52
+ status: 'failed',
53
+ reason: 'no_bridge'
54
+ });
55
+ case 9:
56
+ _context2.next = 11;
57
+ return bridge.applyPromotionCode(formatted.scanCode, Number(customerId), {
58
+ productVouchersOnly: true,
59
+ suppressFailureNotification: true
60
+ });
61
+ case 11:
62
+ promotion = _context2.sent;
63
+ assertCurrent();
64
+ if (Array.isArray(promotion.scannedDiscountList)) {
65
+ _context2.next = 15;
66
+ break;
67
+ }
68
+ return _context2.abrupt("return", {
69
+ status: 'failed',
70
+ reason: 'entry_resolution_failed'
71
+ });
72
+ case 15:
73
+ redemption = {
74
+ source: 'scan',
75
+ vouchers: promotion.scannedDiscountList
76
+ };
77
+ return _context2.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
78
+ status: 'success',
79
+ kind: 'promotion',
80
+ redemption: redemption
81
+ } : {
82
+ status: 'failed',
83
+ reason: 'not_found',
84
+ redemption: redemption
85
+ });
86
+ case 17:
30
87
  // Resolve source-shop IDs before reusing the wallet customer-binding flow.
31
88
  customerScan = isPass ? _objectSpread(_objectSpread({}, formatted), {}, {
32
89
  searchType: 'wallet',
33
- customerId: (_ref = (_formatted$customerId = formatted.customerId) !== null && _formatted$customerId !== void 0 ? _formatted$customerId : (_formatted$data = formatted.data) === null || _formatted$data === void 0 ? void 0 : _formatted$data.id) !== null && _ref !== void 0 ? _ref : (_formatted$data2 = formatted.data) === null || _formatted$data2 === void 0 ? void 0 : _formatted$data2.customer_id,
90
+ customerId: customerId,
34
91
  isCrossShopWallet: true
35
92
  }) : formatted;
36
- assertCurrent();
37
- _context2.next = 6;
93
+ _context2.next = 20;
38
94
  return applyGlobalScan(_objectSpread(_objectSpread({}, host), {}, {
39
95
  setOrderCustomer: function setOrderCustomer(customer) {
40
96
  assertCurrent();
@@ -58,16 +114,16 @@ function _applyProductVoucherCollectionScan() {
58
114
  }, _callee);
59
115
  }))
60
116
  }));
61
- case 6:
117
+ case 20:
62
118
  result = _context2.sent;
63
119
  assertCurrent();
64
120
  if (!(customerScan.searchType === 'wallet' && result.status === 'success')) {
65
- _context2.next = 14;
121
+ _context2.next = 28;
66
122
  break;
67
123
  }
68
- _context2.next = 11;
124
+ _context2.next = 25;
69
125
  return host.loadCustomerDiscounts();
70
- case 11:
126
+ case 25:
71
127
  vouchers = _context2.sent;
72
128
  assertCurrent();
73
129
  return _context2.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
@@ -76,9 +132,9 @@ function _applyProductVoucherCollectionScan() {
76
132
  vouchers: vouchers
77
133
  }
78
134
  }));
79
- case 14:
135
+ case 28:
80
136
  return _context2.abrupt("return", result);
81
- case 15:
137
+ case 29:
82
138
  case "end":
83
139
  return _context2.stop();
84
140
  }
@@ -3,6 +3,8 @@
3
3
  */
4
4
  export declare function normalizeRuntimePlatform(platform: unknown): string;
5
5
  export declare function isPosTerminalPlatform(platform: unknown): boolean;
6
+ export type TerminalVirtualCurrencyChannel = 'pos' | 'kiosk';
7
+ export declare function resolveTerminalVirtualCurrencyChannel(platform: unknown, businessCode: unknown): TerminalVirtualCurrencyChannel | undefined;
6
8
  /**
7
9
  * PC and H5 are authenticated-customer clients rather than staff terminals.
8
10
  */
@@ -11,6 +11,10 @@ export function isPosTerminalPlatform(platform) {
11
11
  var normalized = normalizeRuntimePlatform(platform);
12
12
  return normalized === 'pos' || normalized === 'webpos';
13
13
  }
14
+ export function resolveTerminalVirtualCurrencyChannel(platform, businessCode) {
15
+ if (isPosTerminalPlatform(platform)) return 'pos';
16
+ if (normalizeRuntimePlatform(platform) === 'kiosk' && businessCode === 'retail') return 'kiosk';
17
+ }
14
18
 
15
19
  /**
16
20
  * PC and H5 are authenticated-customer clients rather than staff terminals.
@@ -1,46 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
7
- enumerable: true,
8
- get: function () {
9
- return _examples.BUY_X_GET_Y_FREE_STRATEGY;
10
- }
11
- });
12
- Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
13
- enumerable: true,
14
- get: function () {
15
- return _examples.ITEM_REWARD_STRATEGY;
16
- }
17
- });
18
- Object.defineProperty(exports, "PromotionAdapter", {
19
- enumerable: true,
20
- get: function () {
21
- return _adapter.PromotionAdapter;
22
- }
23
- });
24
- Object.defineProperty(exports, "PromotionEvaluator", {
25
- enumerable: true,
26
- get: function () {
27
- return _evaluator.PromotionEvaluator;
28
- }
29
- });
30
- Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
31
- enumerable: true,
32
- get: function () {
33
- return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
34
- }
35
- });
36
- Object.defineProperty(exports, "default", {
37
- enumerable: true,
38
- get: function () {
39
- return _adapter.default;
40
- }
41
- });
42
- var _evaluator = require("./evaluator");
43
- var _adapter = _interopRequireWildcard(require("./adapter"));
44
- var _examples = require("./examples");
45
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
46
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
1
+ "use strict";
@@ -7,6 +7,7 @@ import { type PickupTimingBooking, type PickupTimingBookingInput } from './picku
7
7
  import { type ProductVoucherGroup } from './utils/productVoucherGroups';
8
8
  import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, ReplaceBookingProductWithRelatedRetailParams, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, OrderHooksConfig, OrderCartIntentCommitContext, ReplaceTempOrderOptions, HydrateTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, PointCardSnapshotMergeContext, PointCardSnapshotItem, ShopServiceData, ShopServiceType } from './types';
9
9
  import type { ICustomer } from '../AccountList/types';
10
+ import { type TerminalVirtualCurrencyChannel } from '../../utils/platform';
10
11
  import type { PaymentMethod } from '../Payment/types';
11
12
  import type { Discount } from '../Discount/types';
12
13
  import { UnavailableReason } from '../Rules/types';
@@ -36,8 +37,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
36
37
  private moduleHooksOverride?;
37
38
  private orderHooks?;
38
39
  private cartCommandQueue;
39
- private posVirtualPaymentRevision;
40
- private posVirtualPaymentSnapshot?;
40
+ private terminalVirtualPaymentRevision;
41
+ private terminalVirtualPaymentSnapshots;
41
42
  private queueCartCommand;
42
43
  /** Use the exact Order normalizers/merge rules on a private draft, not a second projection. */
43
44
  private beginCartMutation;
@@ -480,12 +481,12 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
480
481
  */
481
482
  private hasLinkedBookingUid;
482
483
  private isMultiCurrencySettlementEnabled;
483
- private requiresPosVirtualCurrencyPayment;
484
- private getPosVirtualPaymentShopId;
485
- syncPosVirtualCurrencyPaymentMethods(methods: readonly PaymentMethod[]): void;
486
- getPosVirtualCurrencyPaymentMethod(initialMethods?: readonly PaymentMethod[]): PaymentMethod;
487
- refreshPosVirtualCurrencyPaymentMethod(): Promise<PaymentMethod>;
488
- private validatePosVirtualCurrencyCart;
484
+ private getVirtualCurrencyPaymentChannel;
485
+ private getVirtualPaymentShopId;
486
+ syncTerminalVirtualCurrencyPaymentMethods(channel: TerminalVirtualCurrencyChannel, methods: readonly PaymentMethod[]): void;
487
+ getTerminalVirtualCurrencyPaymentMethod(channel: TerminalVirtualCurrencyChannel, initialMethods?: readonly PaymentMethod[]): PaymentMethod;
488
+ refreshTerminalVirtualCurrencyPaymentMethod(channel: TerminalVirtualCurrencyChannel): Promise<PaymentMethod>;
489
+ private validateTerminalVirtualCurrencyCart;
489
490
  private isActiveVirtualSettlementOrder;
490
491
  private shouldUseVirtualSettlementSummary;
491
492
  private normalizeVirtualSettlementProductIfEnabled;