@pisell/pisellos 2.3.171 → 2.3.172

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 (62) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/inventory/index.d.ts +92 -0
  4. package/dist/inventory/index.js +509 -0
  5. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  6. package/dist/modules/Discount/index.js +1 -0
  7. package/dist/modules/Order/index.d.ts +25 -3
  8. package/dist/modules/Order/index.js +1770 -1311
  9. package/dist/modules/Order/types.d.ts +7 -0
  10. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  11. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  12. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  13. package/dist/modules/Payment/walletpass.js +32 -6
  14. package/dist/modules/ProductList/index.js +33 -12
  15. package/dist/modules/Rules/index.d.ts +2 -0
  16. package/dist/modules/Rules/index.js +29 -21
  17. package/dist/solution/BaseSales/index.d.ts +16 -1
  18. package/dist/solution/BaseSales/index.js +1511 -1325
  19. package/dist/solution/BookingTicket/index.js +200 -108
  20. package/dist/solution/BookingTicket/types.d.ts +14 -2
  21. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  22. package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
  23. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +94 -58
  24. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
  25. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +117 -0
  26. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  27. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  28. package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
  29. package/dist/solution/UnifiedBookingSales/index.js +69 -49
  30. package/dist/utils/platform.d.ts +2 -0
  31. package/dist/utils/platform.js +6 -0
  32. package/lib/index.d.ts +1 -0
  33. package/lib/index.js +12 -0
  34. package/lib/inventory/index.d.ts +92 -0
  35. package/lib/inventory/index.js +287 -0
  36. package/lib/modules/Discount/index.js +1 -0
  37. package/lib/modules/Order/index.d.ts +25 -3
  38. package/lib/modules/Order/index.js +192 -38
  39. package/lib/modules/Order/types.d.ts +7 -0
  40. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  41. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  42. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  43. package/lib/modules/Payment/walletpass.js +23 -1
  44. package/lib/modules/ProductList/index.js +15 -0
  45. package/lib/modules/Rules/index.d.ts +2 -0
  46. package/lib/modules/Rules/index.js +6 -0
  47. package/lib/solution/BaseSales/index.d.ts +16 -1
  48. package/lib/solution/BaseSales/index.js +89 -9
  49. package/lib/solution/BookingTicket/index.js +38 -2
  50. package/lib/solution/BookingTicket/types.d.ts +14 -2
  51. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  52. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
  53. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +14 -2
  54. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
  55. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +71 -0
  56. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  57. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  58. package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
  59. package/lib/solution/UnifiedBookingSales/index.js +14 -3
  60. package/lib/utils/platform.d.ts +2 -0
  61. package/lib/utils/platform.js +7 -0
  62. package/package.json +1 -1
@@ -42,6 +42,7 @@ import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./uti
42
42
  import scanCache from "./utils/scan/scanCache";
43
43
  import { formatGlobalScanResult } from "./utils/scan/formatGlobalScan";
44
44
  import { applyGlobalScan } from "./utils/scan/applyGlobalScan";
45
+ import { applyProductVoucherCollectionScan } from "./utils/scan/applyProductVoucherCollectionScan";
45
46
  import { buildCartView, isWalkInCustomer } from "./utils/cartView";
46
47
  import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
47
48
  import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
@@ -2986,24 +2987,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2986
2987
  }, {
2987
2988
  key: "handleGlobalScanCode",
2988
2989
  value: (function () {
2989
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(code, bridge) {
2990
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code, bridge) {
2990
2991
  var _this8 = this;
2991
- var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result8, _bridge$onNotify3;
2992
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2993
- while (1) switch (_context39.prev = _context39.next) {
2992
+ var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, host, _result8, _bridge$onNotify3, _bridge$isCurrent;
2993
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
2994
+ while (1) switch (_context40.prev = _context40.next) {
2994
2995
  case 0:
2995
2996
  trimmed = typeof code === 'string' ? code.trim() : '';
2996
2997
  if (trimmed) {
2997
- _context39.next = 4;
2998
+ _context40.next = 4;
2998
2999
  break;
2999
3000
  }
3000
3001
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
3001
- return _context39.abrupt("return", {
3002
+ return _context40.abrupt("return", {
3002
3003
  status: 'failed',
3003
3004
  reason: 'empty_code'
3004
3005
  });
3005
3006
  case 4:
3006
- _context39.prev = 4;
3007
+ _context40.prev = 4;
3007
3008
  // Capture before lookup/UI awaits, so a result cannot land in a new cart.
3008
3009
  // Unscoped POS Order modules return a no-op guard.
3009
3010
  beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
@@ -3029,30 +3030,54 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3029
3030
  return bridge.openBookingEdit(payload);
3030
3031
  } : undefined
3031
3032
  }) : undefined;
3033
+ if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
3034
+ _context40.next = 16;
3035
+ break;
3036
+ }
3037
+ if (guardedBridge.applyPromotionCode) {
3038
+ _context40.next = 12;
3039
+ break;
3040
+ }
3041
+ return _context40.abrupt("return", {
3042
+ status: 'failed',
3043
+ reason: 'no_bridge'
3044
+ });
3045
+ case 12:
3046
+ _context40.next = 14;
3047
+ return guardedBridge.applyPromotionCode(trimmed);
3048
+ case 14:
3049
+ promotion = _context40.sent;
3050
+ return _context40.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
3051
+ status: 'success',
3052
+ kind: 'promotion'
3053
+ } : {
3054
+ status: 'failed',
3055
+ reason: 'not_found'
3056
+ });
3057
+ case 16:
3032
3058
  localSearch = function localSearch(v) {
3033
3059
  return _this8.store.products.findProductsByCodeOrBarcode(v);
3034
3060
  };
3035
3061
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
3036
- _context39.next = 13;
3062
+ _context40.next = 20;
3037
3063
  return scanCallback({
3038
3064
  type: 'nativeScanner',
3039
3065
  value: trimmed
3040
3066
  });
3041
- case 13:
3042
- raw = _context39.sent;
3067
+ case 20:
3068
+ raw = _context40.sent;
3043
3069
  formatted = formatGlobalScanResult(raw, trimmed);
3044
3070
  if (formatted) {
3045
- _context39.next = 18;
3071
+ _context40.next = 25;
3046
3072
  break;
3047
3073
  }
3048
3074
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
3049
- return _context39.abrupt("return", {
3075
+ return _context40.abrupt("return", {
3050
3076
  status: 'failed',
3051
3077
  reason: 'not_found'
3052
3078
  });
3053
- case 18:
3054
- _context39.next = 20;
3055
- return applyGlobalScan({
3079
+ case 25:
3080
+ host = {
3056
3081
  setOrderCustomer: function setOrderCustomer(customer) {
3057
3082
  beforeScanCommit();
3058
3083
  _this8.setOrderCustomer(customer);
@@ -3090,25 +3115,92 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3090
3115
  beforeScanCommit();
3091
3116
  return _this8.scanWalletAsset(scanCode);
3092
3117
  }
3093
- }, formatted, guardedBridge);
3094
- case 20:
3095
- _result8 = _context39.sent;
3118
+ };
3119
+ if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
3120
+ _context40.next = 32;
3121
+ break;
3122
+ }
3123
+ _context40.next = 29;
3124
+ return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
3125
+ waitForCustomerDiscounts: function waitForCustomerDiscounts() {
3126
+ return _this8.orderCustomerDiscountRefreshInFlight || Promise.resolve();
3127
+ },
3128
+ loadCustomerDiscounts: function () {
3129
+ var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3130
+ var _this8$getOrderCustom;
3131
+ var customerId;
3132
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3133
+ while (1) switch (_context39.prev = _context39.next) {
3134
+ case 0:
3135
+ beforeScanCommit();
3136
+ customerId = Number(((_this8$getOrderCustom = _this8.getOrderCustomer()) === null || _this8$getOrderCustom === void 0 ? void 0 : _this8$getOrderCustom.customer_id) || 0);
3137
+ if (!(customerId <= 1)) {
3138
+ _context39.next = 4;
3139
+ break;
3140
+ }
3141
+ return _context39.abrupt("return", []);
3142
+ case 4:
3143
+ _context39.next = 6;
3144
+ return _this8.refreshDiscountConfigAfterOrderCustomerChange(customerId);
3145
+ case 6:
3146
+ beforeScanCommit();
3147
+ return _context39.abrupt("return", _this8.getDiscountList());
3148
+ case 8:
3149
+ case "end":
3150
+ return _context39.stop();
3151
+ }
3152
+ }, _callee39);
3153
+ }));
3154
+ function loadCustomerDiscounts() {
3155
+ return _loadCustomerDiscounts.apply(this, arguments);
3156
+ }
3157
+ return loadCustomerDiscounts;
3158
+ }()
3159
+ }), formatted, guardedBridge);
3160
+ case 29:
3161
+ _context40.t0 = _context40.sent;
3162
+ _context40.next = 35;
3163
+ break;
3164
+ case 32:
3165
+ _context40.next = 34;
3166
+ return applyGlobalScan(host, formatted, guardedBridge);
3167
+ case 34:
3168
+ _context40.t0 = _context40.sent;
3169
+ case 35:
3170
+ _result8 = _context40.t0;
3096
3171
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
3097
- return _context39.abrupt("return", _result8);
3098
- case 25:
3099
- _context39.prev = 25;
3100
- _context39.t0 = _context39["catch"](4);
3101
- console.error('[BookingTicket] handleGlobalScanCode failed', _context39.t0);
3172
+ return _context40.abrupt("return", _result8);
3173
+ case 40:
3174
+ _context40.prev = 40;
3175
+ _context40.t1 = _context40["catch"](4);
3176
+ if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection')) {
3177
+ _context40.next = 46;
3178
+ break;
3179
+ }
3180
+ if (!(((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false)) {
3181
+ _context40.next = 45;
3182
+ break;
3183
+ }
3184
+ return _context40.abrupt("return", {
3185
+ status: 'cancelled'
3186
+ });
3187
+ case 45:
3188
+ return _context40.abrupt("return", {
3189
+ status: 'failed',
3190
+ reason: 'entry_resolution_failed'
3191
+ });
3192
+ case 46:
3193
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context40.t1);
3102
3194
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
3103
- return _context39.abrupt("return", {
3195
+ return _context40.abrupt("return", {
3104
3196
  status: 'failed',
3105
3197
  reason: 'not_found'
3106
3198
  });
3107
- case 30:
3199
+ case 49:
3108
3200
  case "end":
3109
- return _context39.stop();
3201
+ return _context40.stop();
3110
3202
  }
3111
- }, _callee39, this, [[4, 25]]);
3203
+ }, _callee40, this, [[4, 40]]);
3112
3204
  }));
3113
3205
  function handleGlobalScanCode(_x23, _x24) {
3114
3206
  return _handleGlobalScanCode.apply(this, arguments);
@@ -3118,37 +3210,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3118
3210
  }, {
3119
3211
  key: "getGlobalScanCodeType",
3120
3212
  value: (function () {
3121
- var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code) {
3213
+ var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(code) {
3122
3214
  var _this9 = this,
3123
3215
  _formatGlobalScanResu,
3124
3216
  _formatGlobalScanResu2;
3125
3217
  var trimmed, scan, raw;
3126
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3127
- while (1) switch (_context40.prev = _context40.next) {
3218
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3219
+ while (1) switch (_context41.prev = _context41.next) {
3128
3220
  case 0:
3129
3221
  trimmed = typeof code === 'string' ? code.trim() : '';
3130
3222
  if (trimmed) {
3131
- _context40.next = 3;
3223
+ _context41.next = 3;
3132
3224
  break;
3133
3225
  }
3134
- return _context40.abrupt("return", null);
3226
+ return _context41.abrupt("return", null);
3135
3227
  case 3:
3136
3228
  scan = handleGlobalScan(this.request, function (value) {
3137
3229
  return _this9.store.products.findProductsByCodeOrBarcode(value);
3138
3230
  }, this.getSubmitOrderSalesChannel());
3139
- _context40.next = 6;
3231
+ _context41.next = 6;
3140
3232
  return scan({
3141
3233
  type: 'nativeScanner',
3142
3234
  value: trimmed
3143
3235
  });
3144
3236
  case 6:
3145
- raw = _context40.sent;
3146
- return _context40.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
3237
+ raw = _context41.sent;
3238
+ return _context41.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
3147
3239
  case 8:
3148
3240
  case "end":
3149
- return _context40.stop();
3241
+ return _context41.stop();
3150
3242
  }
3151
- }, _callee40, this);
3243
+ }, _callee41, this);
3152
3244
  }));
3153
3245
  function getGlobalScanCodeType(_x25) {
3154
3246
  return _getGlobalScanCodeType.apply(this, arguments);
@@ -3232,11 +3324,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3232
3324
  }, {
3233
3325
  key: "addAddTimeProductToBooking",
3234
3326
  value: (function () {
3235
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(input) {
3236
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3237
- while (1) switch (_context41.prev = _context41.next) {
3327
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
3328
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3329
+ while (1) switch (_context42.prev = _context42.next) {
3238
3330
  case 0:
3239
- return _context41.abrupt("return", this.addAddTimeProductsToBooking({
3331
+ return _context42.abrupt("return", this.addAddTimeProductsToBooking({
3240
3332
  booking: input.booking,
3241
3333
  products: [input],
3242
3334
  coveredMinutes: input.coveredMinutes,
@@ -3244,9 +3336,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3244
3336
  }));
3245
3337
  case 1:
3246
3338
  case "end":
3247
- return _context41.stop();
3339
+ return _context42.stop();
3248
3340
  }
3249
- }, _callee41, this);
3341
+ }, _callee42, this);
3250
3342
  }));
3251
3343
  function addAddTimeProductToBooking(_x26) {
3252
3344
  return _addAddTimeProductToBooking.apply(this, arguments);
@@ -3266,16 +3358,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3266
3358
  }, {
3267
3359
  key: "addAddTimeProductsToBooking",
3268
3360
  value: (function () {
3269
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
3361
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(input) {
3270
3362
  var _this10 = this,
3271
3363
  _input$bookingPatch;
3272
3364
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
3273
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3274
- while (1) switch (_context42.prev = _context42.next) {
3365
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3366
+ while (1) switch (_context43.prev = _context43.next) {
3275
3367
  case 0:
3276
3368
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
3277
3369
  if (bookingUid) {
3278
- _context42.next = 3;
3370
+ _context43.next = 3;
3279
3371
  break;
3280
3372
  }
3281
3373
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
@@ -3286,7 +3378,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3286
3378
  };
3287
3379
  });
3288
3380
  if (this.store.order) {
3289
- _context42.next = 6;
3381
+ _context43.next = 6;
3290
3382
  break;
3291
3383
  }
3292
3384
  throw new Error('order 模块未初始化');
@@ -3300,53 +3392,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3300
3392
  });
3301
3393
  }
3302
3394
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
3303
- _context42.next = 11;
3395
+ _context43.next = 11;
3304
3396
  break;
3305
3397
  }
3306
- return _context42.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3398
+ return _context43.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3307
3399
  case 11:
3308
3400
  result = [];
3309
3401
  _iterator2 = _createForOfIteratorHelper(orderLines);
3310
- _context42.prev = 13;
3402
+ _context43.prev = 13;
3311
3403
  _iterator2.s();
3312
3404
  case 15:
3313
3405
  if ((_step2 = _iterator2.n()).done) {
3314
- _context42.next = 29;
3406
+ _context43.next = 29;
3315
3407
  break;
3316
3408
  }
3317
3409
  line = _step2.value;
3318
- _context42.t0 = result.splice;
3319
- _context42.t1 = result;
3320
- _context42.t2 = [0, result.length];
3321
- _context42.t3 = _toConsumableArray;
3322
- _context42.next = 23;
3410
+ _context43.t0 = result.splice;
3411
+ _context43.t1 = result;
3412
+ _context43.t2 = [0, result.length];
3413
+ _context43.t3 = _toConsumableArray;
3414
+ _context43.next = 23;
3323
3415
  return this.addProductToOrder(line.product);
3324
3416
  case 23:
3325
- _context42.t4 = _context42.sent;
3326
- _context42.t5 = (0, _context42.t3)(_context42.t4);
3327
- _context42.t6 = _context42.t2.concat.call(_context42.t2, _context42.t5);
3328
- _context42.t0.apply.call(_context42.t0, _context42.t1, _context42.t6);
3417
+ _context43.t4 = _context43.sent;
3418
+ _context43.t5 = (0, _context43.t3)(_context43.t4);
3419
+ _context43.t6 = _context43.t2.concat.call(_context43.t2, _context43.t5);
3420
+ _context43.t0.apply.call(_context43.t0, _context43.t1, _context43.t6);
3329
3421
  case 27:
3330
- _context42.next = 15;
3422
+ _context43.next = 15;
3331
3423
  break;
3332
3424
  case 29:
3333
- _context42.next = 34;
3425
+ _context43.next = 34;
3334
3426
  break;
3335
3427
  case 31:
3336
- _context42.prev = 31;
3337
- _context42.t7 = _context42["catch"](13);
3338
- _iterator2.e(_context42.t7);
3428
+ _context43.prev = 31;
3429
+ _context43.t7 = _context43["catch"](13);
3430
+ _iterator2.e(_context43.t7);
3339
3431
  case 34:
3340
- _context42.prev = 34;
3432
+ _context43.prev = 34;
3341
3433
  _iterator2.f();
3342
- return _context42.finish(34);
3434
+ return _context43.finish(34);
3343
3435
  case 37:
3344
- return _context42.abrupt("return", result);
3436
+ return _context43.abrupt("return", result);
3345
3437
  case 38:
3346
3438
  case "end":
3347
- return _context42.stop();
3439
+ return _context43.stop();
3348
3440
  }
3349
- }, _callee42, this, [[13, 31, 34, 37]]);
3441
+ }, _callee43, this, [[13, 31, 34, 37]]);
3350
3442
  }));
3351
3443
  function addAddTimeProductsToBooking(_x27) {
3352
3444
  return _addAddTimeProductsToBooking.apply(this, arguments);
@@ -3356,47 +3448,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3356
3448
  }, {
3357
3449
  key: "setOtherParams",
3358
3450
  value: function () {
3359
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3451
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3360
3452
  var _this11 = this;
3361
3453
  var _ref21,
3362
3454
  _ref21$cover,
3363
3455
  cover,
3364
3456
  nextParams,
3365
3457
  invoiceContextChanged,
3366
- _args43 = arguments;
3367
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3368
- while (1) switch (_context43.prev = _context43.next) {
3458
+ _args44 = arguments;
3459
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3460
+ while (1) switch (_context44.prev = _context44.next) {
3369
3461
  case 0:
3370
- _ref21 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
3462
+ _ref21 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
3371
3463
  nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
3372
3464
  if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
3373
3465
  var _this11$otherParams;
3374
3466
  return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
3375
3467
  })) this.orderCustomerContactRequest = null;
3376
- _context43.next = 5;
3468
+ _context44.next = 5;
3377
3469
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
3378
3470
  cover: cover
3379
3471
  });
3380
3472
  case 5:
3381
3473
  invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
3382
3474
  if (!invoiceContextChanged) {
3383
- _context43.next = 9;
3475
+ _context44.next = 9;
3384
3476
  break;
3385
3477
  }
3386
- _context43.next = 9;
3478
+ _context44.next = 9;
3387
3479
  return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
3388
3480
  case 9:
3389
3481
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
3390
- _context43.next = 12;
3482
+ _context44.next = 12;
3391
3483
  break;
3392
3484
  }
3393
- _context43.next = 12;
3485
+ _context44.next = 12;
3394
3486
  return this.configureIdGeneratorFromOpenData();
3395
3487
  case 12:
3396
3488
  case "end":
3397
- return _context43.stop();
3489
+ return _context44.stop();
3398
3490
  }
3399
- }, _callee43, this);
3491
+ }, _callee44, this);
3400
3492
  }));
3401
3493
  function setOtherParams(_x28) {
3402
3494
  return _setOtherParams.apply(this, arguments);
@@ -3415,15 +3507,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3415
3507
  }, {
3416
3508
  key: "handlePrintWristband",
3417
3509
  value: function () {
3418
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3510
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3419
3511
  var _this$getOrderIdentit2;
3420
3512
  var deviceTask, deviceId, idempotencyKey;
3421
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3422
- while (1) switch (_context44.prev = _context44.next) {
3513
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3514
+ while (1) switch (_context45.prev = _context45.next) {
3423
3515
  case 0:
3424
3516
  deviceTask = this.getDeviceTaskPlugin();
3425
3517
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3426
- _context44.next = 4;
3518
+ _context45.next = 4;
3427
3519
  break;
3428
3520
  }
3429
3521
  this.logger.addLog({
@@ -3433,7 +3525,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3433
3525
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3434
3526
  }
3435
3527
  });
3436
- return _context44.abrupt("return");
3528
+ return _context45.abrupt("return");
3437
3529
  case 4:
3438
3530
  this.logger.addLog({
3439
3531
  type: 'info',
@@ -3442,10 +3534,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3442
3534
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3443
3535
  }
3444
3536
  });
3445
- _context44.next = 7;
3537
+ _context45.next = 7;
3446
3538
  return this.getShortNumberOrDeviceId();
3447
3539
  case 7:
3448
- deviceId = _context44.sent;
3540
+ deviceId = _context45.sent;
3449
3541
  idempotencyKey = createUuidV4();
3450
3542
  deviceTask.dispatch({
3451
3543
  action: 'print_all',
@@ -3465,9 +3557,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3465
3557
  });
3466
3558
  case 10:
3467
3559
  case "end":
3468
- return _context44.stop();
3560
+ return _context45.stop();
3469
3561
  }
3470
- }, _callee44, this);
3562
+ }, _callee45, this);
3471
3563
  }));
3472
3564
  function handlePrintWristband(_x29) {
3473
3565
  return _handlePrintWristband.apply(this, arguments);
@@ -3477,11 +3569,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3477
3569
  }, {
3478
3570
  key: "handleRedeem",
3479
3571
  value: function () {
3480
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3572
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
3481
3573
  var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
3482
3574
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
3483
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3484
- while (1) switch (_context45.prev = _context45.next) {
3575
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3576
+ while (1) switch (_context46.prev = _context46.next) {
3485
3577
  case 0:
3486
3578
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
3487
3579
  status = params.is_checkin ? 'used' : 'unused';
@@ -3505,20 +3597,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3505
3597
  });
3506
3598
  });
3507
3599
  if (!(tempOrder && hasUpdatedVoucher)) {
3508
- _context45.next = 11;
3600
+ _context46.next = 11;
3509
3601
  break;
3510
3602
  }
3511
- _context45.next = 11;
3603
+ _context46.next = 11;
3512
3604
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
3513
3605
  vouchers: nextVouchers
3514
3606
  }));
3515
3607
  case 11:
3516
3608
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
3517
3609
  if (!(voucherIds.length === 0)) {
3518
- _context45.next = 14;
3610
+ _context46.next = 14;
3519
3611
  break;
3520
3612
  }
3521
- return _context45.abrupt("return", {
3613
+ return _context46.abrupt("return", {
3522
3614
  code: 200,
3523
3615
  status: true,
3524
3616
  message: '',
@@ -3529,7 +3621,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3529
3621
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
3530
3622
  orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
3531
3623
  orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
3532
- return _context45.abrupt("return", this.request.post('/machinecode/batch', {
3624
+ return _context46.abrupt("return", this.request.post('/machinecode/batch', {
3533
3625
  ids: voucherIds,
3534
3626
  status: status,
3535
3627
  order_lookup: orderLookup,
@@ -3540,9 +3632,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3540
3632
  }));
3541
3633
  case 19:
3542
3634
  case "end":
3543
- return _context45.stop();
3635
+ return _context46.stop();
3544
3636
  }
3545
- }, _callee45, this);
3637
+ }, _callee46, this);
3546
3638
  }));
3547
3639
  function handleRedeem(_x30) {
3548
3640
  return _handleRedeem.apply(this, arguments);
@@ -3556,13 +3648,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3556
3648
  }, {
3557
3649
  key: "destroy",
3558
3650
  value: (function () {
3559
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
3651
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
3560
3652
  var _this$scan;
3561
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3562
- while (1) switch (_context46.prev = _context46.next) {
3653
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
3654
+ while (1) switch (_context47.prev = _context47.next) {
3563
3655
  case 0:
3564
3656
  this.orderCustomerContactRequest = null;
3565
- _context46.next = 3;
3657
+ _context47.next = 3;
3566
3658
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
3567
3659
  case 3:
3568
3660
  try {
@@ -3573,9 +3665,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3573
3665
  scanCache.clear();
3574
3666
  case 5:
3575
3667
  case "end":
3576
- return _context46.stop();
3668
+ return _context47.stop();
3577
3669
  }
3578
- }, _callee46, this);
3670
+ }, _callee47, this);
3579
3671
  }));
3580
3672
  function destroy() {
3581
3673
  return _destroy.apply(this, arguments);
@@ -208,6 +208,10 @@ export interface AddAddTimeProductsToBookingInput {
208
208
  }
209
209
  /** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
210
210
  export interface GlobalScanHostBridge {
211
+ /** product-voucher handles voucher codes only; product-voucher-collection also resolves wallet customer vouchers. */
212
+ scanScope?: 'all' | 'product-voucher' | 'product-voucher-collection';
213
+ /** A one-shot entry may outlive its page while requests are in flight. */
214
+ isCurrent?: () => boolean;
211
215
  openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
212
216
  openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
213
217
  confirmDetail?: (input: {
@@ -232,11 +236,13 @@ export interface GlobalScanHostBridge {
232
236
  */
233
237
  applyPromotionCode?: (code: string, customerId?: number, options?: {
234
238
  suppressFailureNotification?: boolean;
239
+ productVouchersOnly?: boolean;
235
240
  }) => Promise<{
236
241
  isAvailable?: boolean;
237
242
  isAccepted?: boolean;
238
243
  type?: string;
239
244
  unavailableReason?: string;
245
+ scannedDiscountList?: Record<string, any>[];
240
246
  }>;
241
247
  /** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
242
248
  requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
@@ -244,7 +250,7 @@ export interface GlobalScanHostBridge {
244
250
  refresh?: () => void;
245
251
  }
246
252
  /** handleGlobalScanCode 结构化返回 */
247
- export type GlobalScanHandleResult = {
253
+ export type GlobalScanHandleResult = ({
248
254
  status: 'success';
249
255
  kind: 'customer' | 'products' | 'promotion';
250
256
  meta?: {
@@ -257,5 +263,11 @@ export type GlobalScanHandleResult = {
257
263
  status: 'cancelled';
258
264
  } | {
259
265
  status: 'failed';
260
- reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge';
266
+ reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge' | 'entry_resolution_failed';
267
+ }) & {
268
+ /** product-voucher-collection returns voucher candidates; the caller decides how to use them. */
269
+ redemption?: {
270
+ source: 'wallet' | 'scan';
271
+ vouchers: Record<string, any>[];
272
+ };
261
273
  };
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
5
5
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
6
6
  *
7
7
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
8
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
8
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
9
9
  * 3. `add`:两关均通过,直接 transform + 加车
10
10
  */
11
11
  export type AddProductDecision = {