@pisell/pisellos 2.3.115 → 2.3.116

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.
@@ -0,0 +1,9 @@
1
+ // 导出评估器
2
+ export { PromotionEvaluator } from "./evaluator";
3
+
4
+ // 导出适配器
5
+ export { PromotionAdapter } from "./adapter";
6
+ export { default } from "./adapter";
7
+
8
+ // 导出策略配置示例常量
9
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -567,7 +567,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
567
567
  generateIdempotencyToken(): string;
568
568
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
569
569
  createOrder(params: CommitOrderParams['query']): {
570
- type: "virtual" | "appointment_booking";
570
+ type: "appointment_booking" | "virtual";
571
571
  platform: string;
572
572
  sales_channel: string;
573
573
  order_sales_channel: string;
@@ -8,6 +8,7 @@ import { BaseSalesImpl } from '../BaseSales';
8
8
  import type { BaseSalesScanCodeResult } from '../BaseSales/types';
9
9
  import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
10
10
  import type { LoadSalesDetailParams } from '../../modules/Order/types';
11
+ import type { GlobalScanSearchType } from './utils/scan/formatGlobalScan';
11
12
  import type { AddAddTimeProductToBookingInput, AddAddTimeProductsToBookingInput, GlobalScanHandleResult, GlobalScanHostBridge } from './types';
12
13
  import { AddProductDecideContext, AddProductRequiresDetailPayload } from './utils/addProductDecision';
13
14
  import { type BuildCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildCacheItemFromOrderLine';
@@ -538,6 +539,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
538
539
  * ```
539
540
  */
540
541
  handleGlobalScanCode(code: string, bridge?: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
542
+ /** 查询码类型;复用原有识别和缓存,不写订单、不打开选择 UI。 */
543
+ getGlobalScanCodeType(code: string): Promise<GlobalScanSearchType | null>;
541
544
  resolveBestAddTimePlan(addTimeProducts: any[], targetMinutes: number): any;
542
545
  /**
543
546
  * 构造一条绑定到已有 booking 的加时商品行。
@@ -2765,6 +2765,46 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2765
2765
  return _handleGlobalScanCode.apply(this, arguments);
2766
2766
  }
2767
2767
  return handleGlobalScanCode;
2768
+ }() /** 查询码类型;复用原有识别和缓存,不写订单、不打开选择 UI。 */)
2769
+ }, {
2770
+ key: "getGlobalScanCodeType",
2771
+ value: (function () {
2772
+ var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(code) {
2773
+ var _this8 = this,
2774
+ _formatGlobalScanResu,
2775
+ _formatGlobalScanResu2;
2776
+ var trimmed, scan, raw;
2777
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2778
+ while (1) switch (_context33.prev = _context33.next) {
2779
+ case 0:
2780
+ trimmed = typeof code === 'string' ? code.trim() : '';
2781
+ if (trimmed) {
2782
+ _context33.next = 3;
2783
+ break;
2784
+ }
2785
+ return _context33.abrupt("return", null);
2786
+ case 3:
2787
+ scan = handleGlobalScan(this.request, function (value) {
2788
+ return _this8.store.products.findProductsByCodeOrBarcode(value);
2789
+ }, this.getSubmitOrderSalesChannel());
2790
+ _context33.next = 6;
2791
+ return scan({
2792
+ type: 'nativeScanner',
2793
+ value: trimmed
2794
+ });
2795
+ case 6:
2796
+ raw = _context33.sent;
2797
+ return _context33.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
2798
+ case 8:
2799
+ case "end":
2800
+ return _context33.stop();
2801
+ }
2802
+ }, _callee33, this);
2803
+ }));
2804
+ function getGlobalScanCodeType(_x23) {
2805
+ return _getGlobalScanCodeType.apply(this, arguments);
2806
+ }
2807
+ return getGlobalScanCodeType;
2768
2808
  }())
2769
2809
  }, {
2770
2810
  key: "resolveBestAddTimePlan",
@@ -2843,11 +2883,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2843
2883
  }, {
2844
2884
  key: "addAddTimeProductToBooking",
2845
2885
  value: (function () {
2846
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(input) {
2847
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2848
- while (1) switch (_context33.prev = _context33.next) {
2886
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
2887
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2888
+ while (1) switch (_context34.prev = _context34.next) {
2849
2889
  case 0:
2850
- return _context33.abrupt("return", this.addAddTimeProductsToBooking({
2890
+ return _context34.abrupt("return", this.addAddTimeProductsToBooking({
2851
2891
  booking: input.booking,
2852
2892
  products: [input],
2853
2893
  coveredMinutes: input.coveredMinutes,
@@ -2855,11 +2895,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2855
2895
  }));
2856
2896
  case 1:
2857
2897
  case "end":
2858
- return _context33.stop();
2898
+ return _context34.stop();
2859
2899
  }
2860
- }, _callee33, this);
2900
+ }, _callee34, this);
2861
2901
  }));
2862
- function addAddTimeProductToBooking(_x23) {
2902
+ function addAddTimeProductToBooking(_x24) {
2863
2903
  return _addAddTimeProductToBooking.apply(this, arguments);
2864
2904
  }
2865
2905
  return addAddTimeProductToBooking;
@@ -2877,27 +2917,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2877
2917
  }, {
2878
2918
  key: "addAddTimeProductsToBooking",
2879
2919
  value: (function () {
2880
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
2881
- var _this8 = this,
2920
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(input) {
2921
+ var _this9 = this,
2882
2922
  _input$bookingPatch;
2883
2923
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
2884
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2885
- while (1) switch (_context34.prev = _context34.next) {
2924
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2925
+ while (1) switch (_context35.prev = _context35.next) {
2886
2926
  case 0:
2887
2927
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2888
2928
  if (bookingUid) {
2889
- _context34.next = 3;
2929
+ _context35.next = 3;
2890
2930
  break;
2891
2931
  }
2892
2932
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
2893
2933
  case 3:
2894
2934
  orderLines = (input.products || []).map(function (line) {
2895
2935
  return {
2896
- product: _this8.buildAddTimeOrderLine(line, bookingUid)
2936
+ product: _this9.buildAddTimeOrderLine(line, bookingUid)
2897
2937
  };
2898
2938
  });
2899
2939
  if (this.store.order) {
2900
- _context34.next = 6;
2940
+ _context35.next = 6;
2901
2941
  break;
2902
2942
  }
2903
2943
  throw new Error('order 模块未初始化');
@@ -2911,55 +2951,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2911
2951
  });
2912
2952
  }
2913
2953
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2914
- _context34.next = 11;
2954
+ _context35.next = 11;
2915
2955
  break;
2916
2956
  }
2917
- return _context34.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2957
+ return _context35.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2918
2958
  case 11:
2919
2959
  result = [];
2920
2960
  _iterator2 = _createForOfIteratorHelper(orderLines);
2921
- _context34.prev = 13;
2961
+ _context35.prev = 13;
2922
2962
  _iterator2.s();
2923
2963
  case 15:
2924
2964
  if ((_step2 = _iterator2.n()).done) {
2925
- _context34.next = 29;
2965
+ _context35.next = 29;
2926
2966
  break;
2927
2967
  }
2928
2968
  line = _step2.value;
2929
- _context34.t0 = result.splice;
2930
- _context34.t1 = result;
2931
- _context34.t2 = [0, result.length];
2932
- _context34.t3 = _toConsumableArray;
2933
- _context34.next = 23;
2969
+ _context35.t0 = result.splice;
2970
+ _context35.t1 = result;
2971
+ _context35.t2 = [0, result.length];
2972
+ _context35.t3 = _toConsumableArray;
2973
+ _context35.next = 23;
2934
2974
  return this.addProductToOrder(line.product);
2935
2975
  case 23:
2936
- _context34.t4 = _context34.sent;
2937
- _context34.t5 = (0, _context34.t3)(_context34.t4);
2938
- _context34.t6 = _context34.t2.concat.call(_context34.t2, _context34.t5);
2939
- _context34.t0.apply.call(_context34.t0, _context34.t1, _context34.t6);
2976
+ _context35.t4 = _context35.sent;
2977
+ _context35.t5 = (0, _context35.t3)(_context35.t4);
2978
+ _context35.t6 = _context35.t2.concat.call(_context35.t2, _context35.t5);
2979
+ _context35.t0.apply.call(_context35.t0, _context35.t1, _context35.t6);
2940
2980
  case 27:
2941
- _context34.next = 15;
2981
+ _context35.next = 15;
2942
2982
  break;
2943
2983
  case 29:
2944
- _context34.next = 34;
2984
+ _context35.next = 34;
2945
2985
  break;
2946
2986
  case 31:
2947
- _context34.prev = 31;
2948
- _context34.t7 = _context34["catch"](13);
2949
- _iterator2.e(_context34.t7);
2987
+ _context35.prev = 31;
2988
+ _context35.t7 = _context35["catch"](13);
2989
+ _iterator2.e(_context35.t7);
2950
2990
  case 34:
2951
- _context34.prev = 34;
2991
+ _context35.prev = 34;
2952
2992
  _iterator2.f();
2953
- return _context34.finish(34);
2993
+ return _context35.finish(34);
2954
2994
  case 37:
2955
- return _context34.abrupt("return", result);
2995
+ return _context35.abrupt("return", result);
2956
2996
  case 38:
2957
2997
  case "end":
2958
- return _context34.stop();
2998
+ return _context35.stop();
2959
2999
  }
2960
- }, _callee34, this, [[13, 31, 34, 37]]);
3000
+ }, _callee35, this, [[13, 31, 34, 37]]);
2961
3001
  }));
2962
- function addAddTimeProductsToBooking(_x24) {
3002
+ function addAddTimeProductsToBooking(_x25) {
2963
3003
  return _addAddTimeProductsToBooking.apply(this, arguments);
2964
3004
  }
2965
3005
  return addAddTimeProductsToBooking;
@@ -2967,42 +3007,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2967
3007
  }, {
2968
3008
  key: "setOtherParams",
2969
3009
  value: function () {
2970
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
3010
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
2971
3011
  var _ref19,
2972
3012
  _ref19$cover,
2973
3013
  cover,
2974
3014
  invoiceContextChanged,
2975
- _args35 = arguments;
2976
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2977
- while (1) switch (_context35.prev = _context35.next) {
3015
+ _args36 = arguments;
3016
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3017
+ while (1) switch (_context36.prev = _context36.next) {
2978
3018
  case 0:
2979
- _ref19 = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2980
- _context35.next = 3;
3019
+ _ref19 = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
3020
+ _context36.next = 3;
2981
3021
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2982
3022
  cover: cover
2983
3023
  });
2984
3024
  case 3:
2985
3025
  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');
2986
3026
  if (!invoiceContextChanged) {
2987
- _context35.next = 7;
3027
+ _context36.next = 7;
2988
3028
  break;
2989
3029
  }
2990
- _context35.next = 7;
3030
+ _context36.next = 7;
2991
3031
  return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
2992
3032
  case 7:
2993
3033
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2994
- _context35.next = 10;
3034
+ _context36.next = 10;
2995
3035
  break;
2996
3036
  }
2997
- _context35.next = 10;
3037
+ _context36.next = 10;
2998
3038
  return this.configureIdGeneratorFromOpenData();
2999
3039
  case 10:
3000
3040
  case "end":
3001
- return _context35.stop();
3041
+ return _context36.stop();
3002
3042
  }
3003
- }, _callee35, this);
3043
+ }, _callee36, this);
3004
3044
  }));
3005
- function setOtherParams(_x25) {
3045
+ function setOtherParams(_x26) {
3006
3046
  return _setOtherParams.apply(this, arguments);
3007
3047
  }
3008
3048
  return setOtherParams;
@@ -3019,15 +3059,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3019
3059
  }, {
3020
3060
  key: "handlePrintWristband",
3021
3061
  value: function () {
3022
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3062
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3023
3063
  var _this$getOrderIdentit2;
3024
3064
  var deviceTask, deviceId, idempotencyKey;
3025
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3026
- while (1) switch (_context36.prev = _context36.next) {
3065
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3066
+ while (1) switch (_context37.prev = _context37.next) {
3027
3067
  case 0:
3028
3068
  deviceTask = this.getDeviceTaskPlugin();
3029
3069
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3030
- _context36.next = 4;
3070
+ _context37.next = 4;
3031
3071
  break;
3032
3072
  }
3033
3073
  this.logger.addLog({
@@ -3037,7 +3077,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3037
3077
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3038
3078
  }
3039
3079
  });
3040
- return _context36.abrupt("return");
3080
+ return _context37.abrupt("return");
3041
3081
  case 4:
3042
3082
  this.logger.addLog({
3043
3083
  type: 'info',
@@ -3046,10 +3086,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3046
3086
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3047
3087
  }
3048
3088
  });
3049
- _context36.next = 7;
3089
+ _context37.next = 7;
3050
3090
  return this.getShortNumberOrDeviceId();
3051
3091
  case 7:
3052
- deviceId = _context36.sent;
3092
+ deviceId = _context37.sent;
3053
3093
  idempotencyKey = createUuidV4();
3054
3094
  deviceTask.dispatch({
3055
3095
  action: 'print_all',
@@ -3069,11 +3109,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3069
3109
  });
3070
3110
  case 10:
3071
3111
  case "end":
3072
- return _context36.stop();
3112
+ return _context37.stop();
3073
3113
  }
3074
- }, _callee36, this);
3114
+ }, _callee37, this);
3075
3115
  }));
3076
- function handlePrintWristband(_x26) {
3116
+ function handlePrintWristband(_x27) {
3077
3117
  return _handlePrintWristband.apply(this, arguments);
3078
3118
  }
3079
3119
  return handlePrintWristband;
@@ -3081,11 +3121,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3081
3121
  }, {
3082
3122
  key: "handleRedeem",
3083
3123
  value: function () {
3084
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3124
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
3085
3125
  var _this$store$order7, _this$store$order7$ge, _this$store$order8, _ref20, _tempOrder$order_id2;
3086
3126
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
3087
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3088
- while (1) switch (_context37.prev = _context37.next) {
3127
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3128
+ while (1) switch (_context38.prev = _context38.next) {
3089
3129
  case 0:
3090
3130
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
3091
3131
  status = params.is_checkin ? 'used' : 'unused';
@@ -3109,20 +3149,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3109
3149
  });
3110
3150
  });
3111
3151
  if (!(tempOrder && hasUpdatedVoucher)) {
3112
- _context37.next = 11;
3152
+ _context38.next = 11;
3113
3153
  break;
3114
3154
  }
3115
- _context37.next = 11;
3155
+ _context38.next = 11;
3116
3156
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
3117
3157
  vouchers: nextVouchers
3118
3158
  }));
3119
3159
  case 11:
3120
3160
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
3121
3161
  if (!(voucherIds.length === 0)) {
3122
- _context37.next = 14;
3162
+ _context38.next = 14;
3123
3163
  break;
3124
3164
  }
3125
- return _context37.abrupt("return", {
3165
+ return _context38.abrupt("return", {
3126
3166
  code: 200,
3127
3167
  status: true,
3128
3168
  message: '',
@@ -3133,7 +3173,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3133
3173
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
3134
3174
  orderId = (_ref20 = (_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 && _ref20 !== void 0 ? _ref20 : undefined;
3135
3175
  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;
3136
- return _context37.abrupt("return", this.request.post('/machinecode/batch', {
3176
+ return _context38.abrupt("return", this.request.post('/machinecode/batch', {
3137
3177
  ids: voucherIds,
3138
3178
  status: status,
3139
3179
  order_lookup: orderLookup,
@@ -3144,11 +3184,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3144
3184
  }));
3145
3185
  case 19:
3146
3186
  case "end":
3147
- return _context37.stop();
3187
+ return _context38.stop();
3148
3188
  }
3149
- }, _callee37, this);
3189
+ }, _callee38, this);
3150
3190
  }));
3151
- function handleRedeem(_x27) {
3191
+ function handleRedeem(_x28) {
3152
3192
  return _handleRedeem.apply(this, arguments);
3153
3193
  }
3154
3194
  return handleRedeem;
@@ -3160,12 +3200,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3160
3200
  }, {
3161
3201
  key: "destroy",
3162
3202
  value: (function () {
3163
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3203
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3164
3204
  var _this$scan;
3165
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3166
- while (1) switch (_context38.prev = _context38.next) {
3205
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3206
+ while (1) switch (_context39.prev = _context39.next) {
3167
3207
  case 0:
3168
- _context38.next = 2;
3208
+ _context39.next = 2;
3169
3209
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
3170
3210
  case 2:
3171
3211
  try {
@@ -3176,9 +3216,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3176
3216
  scanCache.clear();
3177
3217
  case 4:
3178
3218
  case "end":
3179
- return _context38.stop();
3219
+ return _context39.stop();
3180
3220
  }
3181
- }, _callee38, this);
3221
+ }, _callee39, this);
3182
3222
  }));
3183
3223
  function destroy() {
3184
3224
  return _destroy.apply(this, arguments);
@@ -567,7 +567,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
567
567
  generateIdempotencyToken(): string;
568
568
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
569
569
  createOrder(params: CommitOrderParams['query']): {
570
- type: "virtual" | "appointment_booking";
570
+ type: "appointment_booking" | "virtual";
571
571
  platform: string;
572
572
  sales_channel: string;
573
573
  order_sales_channel: string;
@@ -8,6 +8,7 @@ import { BaseSalesImpl } from '../BaseSales';
8
8
  import type { BaseSalesScanCodeResult } from '../BaseSales/types';
9
9
  import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
10
10
  import type { LoadSalesDetailParams } from '../../modules/Order/types';
11
+ import type { GlobalScanSearchType } from './utils/scan/formatGlobalScan';
11
12
  import type { AddAddTimeProductToBookingInput, AddAddTimeProductsToBookingInput, GlobalScanHandleResult, GlobalScanHostBridge } from './types';
12
13
  import { AddProductDecideContext, AddProductRequiresDetailPayload } from './utils/addProductDecision';
13
14
  import { type BuildCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildCacheItemFromOrderLine';
@@ -538,6 +539,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
538
539
  * ```
539
540
  */
540
541
  handleGlobalScanCode(code: string, bridge?: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
542
+ /** 查询码类型;复用原有识别和缓存,不写订单、不打开选择 UI。 */
543
+ getGlobalScanCodeType(code: string): Promise<GlobalScanSearchType | null>;
541
544
  resolveBestAddTimePlan(addTimeProducts: any[], targetMinutes: number): any;
542
545
  /**
543
546
  * 构造一条绑定到已有 booking 的加时商品行。
@@ -1707,6 +1707,18 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1707
1707
  };
1708
1708
  }
1709
1709
  }
1710
+
1711
+ /** 查询码类型;复用原有识别和缓存,不写订单、不打开选择 UI。 */
1712
+ async getGlobalScanCodeType(code) {
1713
+ const trimmed = typeof code === 'string' ? code.trim() : '';
1714
+ if (!trimmed) return null;
1715
+ const scan = (0, _handleScan.handleGlobalScan)(this.request, value => this.store.products.findProductsByCodeOrBarcode(value), this.getSubmitOrderSalesChannel());
1716
+ const raw = await scan({
1717
+ type: 'nativeScanner',
1718
+ value: trimmed
1719
+ });
1720
+ return (0, _formatGlobalScan.formatGlobalScanResult)(raw, trimmed)?.searchType ?? null;
1721
+ }
1710
1722
  resolveBestAddTimePlan(addTimeProducts, targetMinutes) {
1711
1723
  return (0, _resolveBestAddTimePlan.resolveBestAddTimePlan)(addTimeProducts, targetMinutes);
1712
1724
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.115",
4
+ "version": "2.3.116",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",