@pisell/pisellos 2.3.115 → 2.3.117

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.
@@ -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;
@@ -21,15 +21,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
21
21
  import dayjs from 'dayjs';
22
22
  import Decimal from 'decimal.js';
23
23
  var DEFAULT_LOCALES = ['en', 'zh_CN'];
24
+ var SERVICE_TYPE_LABEL_KEYS = {
25
+ takeaway: 'takeAway',
26
+ pick_up: 'pickUp',
27
+ table_service: 'tableService',
28
+ delivery: 'delivery',
29
+ room_service: 'roomService',
30
+ dine_in: 'dineIn',
31
+ delivery_by_uber: 'deliveryByUber',
32
+ delivery_by_panda: 'deliveryByPanda',
33
+ delivery_by_merchant: 'deliveryByMerchant'
34
+ };
24
35
  var LABELS = {
25
36
  en: {
26
37
  contactName: 'Contact name',
27
38
  contactMobile: 'Contact Mobile',
28
39
  email: 'email',
29
- dineIn: 'Dine-in',
30
- takeAway: 'Take away',
40
+ dineIn: 'Dine in',
41
+ takeAway: 'Takeaway',
31
42
  delivery: 'Delivery',
32
- pickUp: 'Pick-up',
43
+ pickUp: 'Pickup',
44
+ tableService: 'Table Service',
45
+ roomService: 'Room Service',
46
+ deliveryByUber: 'Uber Eats Delivery',
47
+ deliveryByPanda: 'HungryPanda Delivery',
48
+ deliveryByMerchant: 'Merchant Delivery',
33
49
  shopService: 'Dine-in',
34
50
  pickUpTime: 'Pick-up time',
35
51
  asap: 'ASAP',
@@ -68,7 +84,12 @@ var LABELS = {
68
84
  dineIn: '堂食',
69
85
  takeAway: '外带',
70
86
  delivery: '配送',
71
- pickUp: '自提',
87
+ pickUp: '自取',
88
+ tableService: '送餐到桌',
89
+ roomService: '客房服务',
90
+ deliveryByUber: 'Uber 配送',
91
+ deliveryByPanda: '熊猫外卖配送',
92
+ deliveryByMerchant: '商家配送',
72
93
  shopService: '堂食',
73
94
  pickUpTime: '取餐时间',
74
95
  asap: '尽快',
@@ -108,6 +129,11 @@ var LABELS = {
108
129
  takeAway: '外帶',
109
130
  delivery: '配送',
110
131
  pickUp: '自取',
132
+ tableService: '送餐到桌',
133
+ roomService: '客房服務',
134
+ deliveryByUber: 'Uber 配送',
135
+ deliveryByPanda: '熊貓外賣配送',
136
+ deliveryByMerchant: '商家配送',
111
137
  shopService: '堂食',
112
138
  pickUpTime: '取餐時間',
113
139
  asap: '盡快',
@@ -147,6 +173,11 @@ var LABELS = {
147
173
  takeAway: 'テイクアウト',
148
174
  delivery: '配達',
149
175
  pickUp: '受け取り',
176
+ tableService: 'テーブルサービス',
177
+ roomService: 'ルームサービス',
178
+ deliveryByUber: 'Uber Eats 配達',
179
+ deliveryByPanda: 'HungryPanda 配達',
180
+ deliveryByMerchant: '店舗による配達',
150
181
  shopService: '店内飲食',
151
182
  pickUpTime: '受取時間',
152
183
  asap: 'できるだけ早く',
@@ -185,6 +216,11 @@ var LABELS = {
185
216
  takeAway: 'Para levar',
186
217
  delivery: 'Entrega',
187
218
  pickUp: 'Recolha',
219
+ tableService: 'Serviço à mesa',
220
+ roomService: 'Serviço de quarto',
221
+ deliveryByUber: 'Entrega pela Uber Eats',
222
+ deliveryByPanda: 'Entrega pela HungryPanda',
223
+ deliveryByMerchant: 'Entrega pelo comerciante',
188
224
  shopService: 'Consumo no local',
189
225
  pickUpTime: 'Hora de recolha',
190
226
  asap: 'Assim que possível',
@@ -1198,9 +1234,8 @@ function normalizeCustomerDisplayValue(value) {
1198
1234
  }
1199
1235
  function buildDelivery(order, locale) {
1200
1236
  var _order$metadata2, _order$metadata3, _order$metadata4, _order$metadata5, _order$metadata6, _order$metadata7, _order$metadata8, _order$metadata9, _order$metadata10, _order$metadata11, _order$metadata12;
1201
- var deliveryType = stringify(order.delivery_type).trim();
1202
- var serviceType = deliveryType || stringify(firstPresentValue((_order$metadata2 = order.metadata) === null || _order$metadata2 === void 0 ? void 0 : _order$metadata2.service_type, order.service_type)).trim();
1203
- var serviceTypeLabelKey = resolveServiceTypeLabelKey(serviceType, order);
1237
+ var serviceType = stringify((_order$metadata2 = order.metadata) === null || _order$metadata2 === void 0 || (_order$metadata2 = _order$metadata2.shop_service_data) === null || _order$metadata2 === void 0 ? void 0 : _order$metadata2.service_type).trim();
1238
+ var serviceTypeLabelKey = resolveServiceTypeLabelKey(serviceType);
1204
1239
  if (!serviceTypeLabelKey) return [];
1205
1240
  var items = [{
1206
1241
  item: '',
@@ -2018,26 +2053,8 @@ function getLocalizedValue(value, locale) {
2018
2053
  var underscoredLocale = locale.replace('-', '_');
2019
2054
  return stringify((_ref60 = (_ref61 = (_ref62 = (_ref63 = (_ref64 = (_ref65 = (_value$locale2 = value[locale]) !== null && _value$locale2 !== void 0 ? _value$locale2 : value[dashedLocale]) !== null && _ref65 !== void 0 ? _ref65 : value[underscoredLocale]) !== null && _ref64 !== void 0 ? _ref64 : value.original) !== null && _ref63 !== void 0 ? _ref63 : value.auto) !== null && _ref62 !== void 0 ? _ref62 : value.default) !== null && _ref61 !== void 0 ? _ref61 : value.en) !== null && _ref60 !== void 0 ? _ref60 : '');
2020
2055
  }
2021
- function resolveServiceTypeLabelKey(serviceType, order) {
2022
- var normalized = serviceType.trim().toLowerCase().replace(/[\s-]+/g, '_');
2023
- if (['', 'nil', 'none', 'unknown'].includes(normalized)) return null;
2024
- if (['pickup', 'pick_up', 'self_pickup'].includes(normalized)) return 'pickUp';
2025
- if (['delivery', 'shipping', 'local_delivery'].includes(normalized)) return 'delivery';
2026
- if (['takeaway', 'take_away'].includes(normalized)) return 'takeAway';
2027
- if (['dine_in', 'dinein'].includes(normalized)) return 'dineIn';
2028
- if (['shop_service', 'shop_server'].includes(normalized)) {
2029
- return resolveShopServiceLabelKey(order);
2030
- }
2031
- return null;
2032
- }
2033
- function resolveShopServiceLabelKey(order) {
2034
- var _order$metadata15, _order$shop_service_t;
2035
- var rawShopServiceType = firstPresentValue((_order$metadata15 = order.metadata) === null || _order$metadata15 === void 0 || (_order$metadata15 = _order$metadata15.shop_service_type) === null || _order$metadata15 === void 0 ? void 0 : _order$metadata15.server_type, (_order$shop_service_t = order.shop_service_type) === null || _order$shop_service_t === void 0 ? void 0 : _order$shop_service_t.server_type, typeof order.shop_service_type === 'string' ? order.shop_service_type : undefined);
2036
- if (!isPresentId(rawShopServiceType)) return 'dineIn';
2037
- var normalized = stringify(rawShopServiceType).trim().toLowerCase().replace(/[\s-]+/g, '_');
2038
- if (['takeaway', 'take_away'].includes(normalized)) return 'takeAway';
2039
- if (['dine_in', 'dinein'].includes(normalized)) return 'dineIn';
2040
- return null;
2056
+ function resolveServiceTypeLabelKey(serviceType) {
2057
+ return SERVICE_TYPE_LABEL_KEYS[serviceType] || null;
2041
2058
  }
2042
2059
  function normalizeBooleanFlag(value) {
2043
2060
  if (value === true || value === 1 || stringify(value).trim() === '1') return 1;
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 6 | 5 | 1 | 2 | 3 | 4;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -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';
@@ -346,7 +347,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
346
347
  * 获取当前的客户搜索条件
347
348
  * @returns 当前搜索条件
348
349
  */
349
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
350
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
350
351
  /**
351
352
  * 获取客户列表状态(包含滚动加载相关状态)
352
353
  * @returns 客户状态
@@ -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;
@@ -9,15 +9,31 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
9
9
  var _decimal = _interopRequireDefault(require("decimal.js"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  const DEFAULT_LOCALES = ['en', 'zh_CN'];
12
+ const SERVICE_TYPE_LABEL_KEYS = {
13
+ takeaway: 'takeAway',
14
+ pick_up: 'pickUp',
15
+ table_service: 'tableService',
16
+ delivery: 'delivery',
17
+ room_service: 'roomService',
18
+ dine_in: 'dineIn',
19
+ delivery_by_uber: 'deliveryByUber',
20
+ delivery_by_panda: 'deliveryByPanda',
21
+ delivery_by_merchant: 'deliveryByMerchant'
22
+ };
12
23
  const LABELS = {
13
24
  en: {
14
25
  contactName: 'Contact name',
15
26
  contactMobile: 'Contact Mobile',
16
27
  email: 'email',
17
- dineIn: 'Dine-in',
18
- takeAway: 'Take away',
28
+ dineIn: 'Dine in',
29
+ takeAway: 'Takeaway',
19
30
  delivery: 'Delivery',
20
- pickUp: 'Pick-up',
31
+ pickUp: 'Pickup',
32
+ tableService: 'Table Service',
33
+ roomService: 'Room Service',
34
+ deliveryByUber: 'Uber Eats Delivery',
35
+ deliveryByPanda: 'HungryPanda Delivery',
36
+ deliveryByMerchant: 'Merchant Delivery',
21
37
  shopService: 'Dine-in',
22
38
  pickUpTime: 'Pick-up time',
23
39
  asap: 'ASAP',
@@ -56,7 +72,12 @@ const LABELS = {
56
72
  dineIn: '堂食',
57
73
  takeAway: '外带',
58
74
  delivery: '配送',
59
- pickUp: '自提',
75
+ pickUp: '自取',
76
+ tableService: '送餐到桌',
77
+ roomService: '客房服务',
78
+ deliveryByUber: 'Uber 配送',
79
+ deliveryByPanda: '熊猫外卖配送',
80
+ deliveryByMerchant: '商家配送',
60
81
  shopService: '堂食',
61
82
  pickUpTime: '取餐时间',
62
83
  asap: '尽快',
@@ -96,6 +117,11 @@ const LABELS = {
96
117
  takeAway: '外帶',
97
118
  delivery: '配送',
98
119
  pickUp: '自取',
120
+ tableService: '送餐到桌',
121
+ roomService: '客房服務',
122
+ deliveryByUber: 'Uber 配送',
123
+ deliveryByPanda: '熊貓外賣配送',
124
+ deliveryByMerchant: '商家配送',
99
125
  shopService: '堂食',
100
126
  pickUpTime: '取餐時間',
101
127
  asap: '盡快',
@@ -135,6 +161,11 @@ const LABELS = {
135
161
  takeAway: 'テイクアウト',
136
162
  delivery: '配達',
137
163
  pickUp: '受け取り',
164
+ tableService: 'テーブルサービス',
165
+ roomService: 'ルームサービス',
166
+ deliveryByUber: 'Uber Eats 配達',
167
+ deliveryByPanda: 'HungryPanda 配達',
168
+ deliveryByMerchant: '店舗による配達',
138
169
  shopService: '店内飲食',
139
170
  pickUpTime: '受取時間',
140
171
  asap: 'できるだけ早く',
@@ -173,6 +204,11 @@ const LABELS = {
173
204
  takeAway: 'Para levar',
174
205
  delivery: 'Entrega',
175
206
  pickUp: 'Recolha',
207
+ tableService: 'Serviço à mesa',
208
+ roomService: 'Serviço de quarto',
209
+ deliveryByUber: 'Entrega pela Uber Eats',
210
+ deliveryByPanda: 'Entrega pela HungryPanda',
211
+ deliveryByMerchant: 'Entrega pelo comerciante',
176
212
  shopService: 'Consumo no local',
177
213
  pickUpTime: 'Hora de recolha',
178
214
  asap: 'Assim que possível',
@@ -1128,9 +1164,8 @@ function normalizeCustomerDisplayValue(value) {
1128
1164
  return text;
1129
1165
  }
1130
1166
  function buildDelivery(order, locale) {
1131
- const deliveryType = stringify(order.delivery_type).trim();
1132
- const serviceType = deliveryType || stringify(firstPresentValue(order.metadata?.service_type, order.service_type)).trim();
1133
- const serviceTypeLabelKey = resolveServiceTypeLabelKey(serviceType, order);
1167
+ const serviceType = stringify(order.metadata?.shop_service_data?.service_type).trim();
1168
+ const serviceTypeLabelKey = resolveServiceTypeLabelKey(serviceType);
1134
1169
  if (!serviceTypeLabelKey) return [];
1135
1170
  const items = [{
1136
1171
  item: '',
@@ -1896,25 +1931,8 @@ function getLocalizedValue(value, locale) {
1896
1931
  const underscoredLocale = locale.replace('-', '_');
1897
1932
  return stringify(value[locale] ?? value[dashedLocale] ?? value[underscoredLocale] ?? value.original ?? value.auto ?? value.default ?? value.en ?? '');
1898
1933
  }
1899
- function resolveServiceTypeLabelKey(serviceType, order) {
1900
- const normalized = serviceType.trim().toLowerCase().replace(/[\s-]+/g, '_');
1901
- if (['', 'nil', 'none', 'unknown'].includes(normalized)) return null;
1902
- if (['pickup', 'pick_up', 'self_pickup'].includes(normalized)) return 'pickUp';
1903
- if (['delivery', 'shipping', 'local_delivery'].includes(normalized)) return 'delivery';
1904
- if (['takeaway', 'take_away'].includes(normalized)) return 'takeAway';
1905
- if (['dine_in', 'dinein'].includes(normalized)) return 'dineIn';
1906
- if (['shop_service', 'shop_server'].includes(normalized)) {
1907
- return resolveShopServiceLabelKey(order);
1908
- }
1909
- return null;
1910
- }
1911
- function resolveShopServiceLabelKey(order) {
1912
- const rawShopServiceType = firstPresentValue(order.metadata?.shop_service_type?.server_type, order.shop_service_type?.server_type, typeof order.shop_service_type === 'string' ? order.shop_service_type : undefined);
1913
- if (!isPresentId(rawShopServiceType)) return 'dineIn';
1914
- const normalized = stringify(rawShopServiceType).trim().toLowerCase().replace(/[\s-]+/g, '_');
1915
- if (['takeaway', 'take_away'].includes(normalized)) return 'takeAway';
1916
- if (['dine_in', 'dinein'].includes(normalized)) return 'dineIn';
1917
- return null;
1934
+ function resolveServiceTypeLabelKey(serviceType) {
1935
+ return SERVICE_TYPE_LABEL_KEYS[serviceType] || null;
1918
1936
  }
1919
1937
  function normalizeBooleanFlag(value) {
1920
1938
  if (value === true || value === 1 || stringify(value).trim() === '1') return 1;
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 6 | 5 | 1 | 2 | 3 | 4;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -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';
@@ -346,7 +347,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
346
347
  * 获取当前的客户搜索条件
347
348
  * @returns 当前搜索条件
348
349
  */
349
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
350
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
350
351
  /**
351
352
  * 获取客户列表状态(包含滚动加载相关状态)
352
353
  * @returns 客户状态
@@ -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.117",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",