@pisell/pisellos 2.2.222 → 2.2.224

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 (61) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
  3. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
  4. package/dist/modules/Customer/index.d.ts +7 -0
  5. package/dist/modules/Customer/index.js +16 -0
  6. package/dist/modules/OpenData/index.d.ts +7 -0
  7. package/dist/modules/OpenData/index.js +16 -1
  8. package/dist/modules/Order/index.d.ts +43 -0
  9. package/dist/modules/Order/index.js +296 -112
  10. package/dist/modules/Order/types.d.ts +16 -0
  11. package/dist/modules/Order/utils.js +7 -4
  12. package/dist/modules/Payment/index.d.ts +7 -0
  13. package/dist/modules/Payment/index.js +12 -0
  14. package/dist/modules/ProductList/index.d.ts +7 -0
  15. package/dist/modules/ProductList/index.js +11 -0
  16. package/dist/modules/SalesSummary/index.d.ts +7 -0
  17. package/dist/modules/SalesSummary/index.js +61 -26
  18. package/dist/modules/Schedule/index.d.ts +7 -0
  19. package/dist/modules/Schedule/index.js +16 -0
  20. package/dist/modules/Summary/index.js +2 -1
  21. package/dist/server/modules/order/types.d.ts +2 -0
  22. package/dist/server/modules/order/utils/filterBookings.js +25 -2
  23. package/dist/server/utils/small-ticket.js +160 -30
  24. package/dist/solution/BaseSales/index.d.ts +17 -0
  25. package/dist/solution/BaseSales/index.js +524 -439
  26. package/dist/solution/BaseSales/utils/cartPromotion.js +24 -7
  27. package/dist/solution/BookingByStep/index.d.ts +1 -1
  28. package/dist/solution/BookingTicket/index.d.ts +0 -8
  29. package/dist/solution/BookingTicket/index.js +41 -75
  30. package/dist/types/index.d.ts +10 -0
  31. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  32. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
  33. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
  34. package/lib/modules/Customer/index.d.ts +7 -0
  35. package/lib/modules/Customer/index.js +12 -0
  36. package/lib/modules/OpenData/index.d.ts +7 -0
  37. package/lib/modules/OpenData/index.js +13 -1
  38. package/lib/modules/Order/index.d.ts +43 -0
  39. package/lib/modules/Order/index.js +145 -3
  40. package/lib/modules/Order/types.d.ts +16 -0
  41. package/lib/modules/Order/utils.js +6 -2
  42. package/lib/modules/Payment/index.d.ts +7 -0
  43. package/lib/modules/Payment/index.js +9 -0
  44. package/lib/modules/ProductList/index.d.ts +7 -0
  45. package/lib/modules/ProductList/index.js +9 -0
  46. package/lib/modules/SalesSummary/index.d.ts +7 -0
  47. package/lib/modules/SalesSummary/index.js +15 -1
  48. package/lib/modules/Schedule/index.d.ts +7 -0
  49. package/lib/modules/Schedule/index.js +12 -0
  50. package/lib/modules/Summary/index.js +2 -1
  51. package/lib/server/modules/order/types.d.ts +2 -0
  52. package/lib/server/modules/order/utils/filterBookings.js +17 -2
  53. package/lib/server/utils/small-ticket.js +141 -32
  54. package/lib/solution/BaseSales/index.d.ts +17 -0
  55. package/lib/solution/BaseSales/index.js +48 -10
  56. package/lib/solution/BaseSales/utils/cartPromotion.js +28 -2
  57. package/lib/solution/BookingByStep/index.d.ts +1 -1
  58. package/lib/solution/BookingTicket/index.d.ts +0 -8
  59. package/lib/solution/BookingTicket/index.js +0 -12
  60. package/lib/types/index.d.ts +10 -0
  61. package/package.json +1 -1
@@ -244,9 +244,10 @@ export function mergeIdenticalPromotionCartLines(products) {
244
244
  var fingerprint = buildProductLineFingerprint(getProductSkuOptions(line), line.product_bundle);
245
245
  var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
246
246
  var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
247
+ var noteSignature = getProductLineNoteSignature(line);
247
248
  var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
248
249
  var orderDetailId = (_line$order_detail_id = line === null || line === void 0 ? void 0 : line.order_detail_id) !== null && _line$order_detail_id !== void 0 ? _line$order_detail_id : line === null || line === void 0 ? void 0 : line.orderDetailId;
249
- var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
250
+ var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, noteSignature, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
250
251
  var hitIndex = indexByKey.get(mergeKey);
251
252
  if (hitIndex === undefined) {
252
253
  indexByKey.set(mergeKey, merged.length);
@@ -414,6 +415,12 @@ function getGiftInfo(product) {
414
415
  var _product$metadata2;
415
416
  return (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._giftInfo) || (product === null || product === void 0 ? void 0 : product._giftInfo) || null;
416
417
  }
418
+ function getProductLineNoteSignature(product) {
419
+ var note = product === null || product === void 0 ? void 0 : product.note;
420
+ if (typeof note !== 'string') return '';
421
+ var normalizedNote = note.trim();
422
+ return normalizedNote ? "note:".concat(normalizedNote) : '';
423
+ }
417
424
  function isPersistedGeneratedVoucher(product) {
418
425
  var _product$order_detail;
419
426
  var orderDetailId = (_product$order_detail = product === null || product === void 0 ? void 0 : product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product === null || product === void 0 ? void 0 : product.orderDetailId;
@@ -453,17 +460,18 @@ function getProductBundleForEvaluator(product) {
453
460
  export function buildConsolidateKeyForPromotion(item) {
454
461
  var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
455
462
  var fingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
463
+ var noteSignature = getProductLineNoteSignature(item);
456
464
  var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
457
465
  var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
458
466
  if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
459
467
  var _item$product_variant;
460
- return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, String(orderDetailId)].join('#');
468
+ return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, noteSignature, String(orderDetailId)].join('#');
461
469
  }
462
470
  if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
463
471
  var _item$product_variant2;
464
- return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, String(bookingUid)].join('#');
472
+ return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, noteSignature, String(bookingUid)].join('#');
465
473
  }
466
- return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint].join('#');
474
+ return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint, noteSignature].join('#');
467
475
  }
468
476
  function consolidateMainProductsForPromotion(entries) {
469
477
  if (!Array.isArray(entries) || entries.length <= 1) {
@@ -474,10 +482,12 @@ function consolidateMainProductsForPromotion(entries) {
474
482
  _step5;
475
483
  try {
476
484
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
485
+ var _item$metadata2;
477
486
  var _step5$value = _step5.value,
478
487
  item = _step5$value.item,
479
488
  originalListIndex = _step5$value.originalListIndex;
480
489
  var key = buildConsolidateKeyForPromotion(item);
490
+ var wasInPromotion = (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 || (_item$metadata2 = _item$metadata2._promotion) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.inPromotion) === true;
481
491
  var existing = groups.get(key);
482
492
  if (!existing) {
483
493
  var mergedItem = cloneDeep(item);
@@ -498,6 +508,9 @@ function consolidateMainProductsForPromotion(entries) {
498
508
  _iterator6.f();
499
509
  }
500
510
  }
511
+ if (wasInPromotion) {
512
+ mergedItem._wasInPromotionBeforeConsolidate = true;
513
+ }
501
514
  groups.set(key, {
502
515
  item: mergedItem,
503
516
  originalListIndex: originalListIndex
@@ -505,6 +518,9 @@ function consolidateMainProductsForPromotion(entries) {
505
518
  continue;
506
519
  }
507
520
  existing.item.num = getSafeProductNum(Number(existing.item.num || 0) + Number(item.num || 0));
521
+ if (wasInPromotion) {
522
+ existing.item._wasInPromotionBeforeConsolidate = true;
523
+ }
508
524
  }
509
525
  } catch (err) {
510
526
  _iterator5.e(err);
@@ -1059,13 +1075,13 @@ export function processCartPromotion(list, evaluator, options) {
1059
1075
  var promotionProducts = [];
1060
1076
  var originalItemMap = new Map();
1061
1077
  var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
1062
- var _item$product_id, _item$product_variant5, _item$metadata2, _item$num;
1078
+ var _item$product_id, _item$product_variant5, _item$metadata3, _item$num;
1063
1079
  var item = _ref16.item;
1064
1080
  return {
1065
1081
  id: i,
1066
1082
  product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : 0) || 0,
1067
1083
  product_variant_id: Number((_item$product_variant5 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant5 !== void 0 ? _item$product_variant5 : 0) || 0,
1068
- name: (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
1084
+ name: (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
1069
1085
  price: getOrderProductBasePrice(item),
1070
1086
  quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
1071
1087
  bundle: getProductBundleForEvaluator(item)
@@ -1195,7 +1211,7 @@ export function processCartPromotion(list, evaluator, options) {
1195
1211
  newItem._sourceCartNum = sourceCartNum;
1196
1212
 
1197
1213
  // 清掉历史促销字段
1198
- var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true;
1214
+ var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true || originalItem._wasInPromotionBeforeConsolidate === true;
1199
1215
  delete metadata._promotion;
1200
1216
  if (Array.isArray(newItem.product_bundle)) {
1201
1217
  var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
@@ -1408,6 +1424,7 @@ export function processCartPromotion(list, evaluator, options) {
1408
1424
  delete product._sortSubIndex;
1409
1425
  delete product._originalProductUid;
1410
1426
  delete product._sourceCartNum;
1427
+ delete product._wasInPromotionBeforeConsolidate;
1411
1428
  }
1412
1429
  return {
1413
1430
  products: processedProducts,
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 2 | 3 | 5 | 4 | 6;
314
+ weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -359,14 +359,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
359
359
  * 清空所有扫描监听对应的任务执行队列
360
360
  */
361
361
  clearAllScanListenersTaskQueue(): void;
362
- /**
363
- * 设置其他参数
364
- * @param params 参数
365
- * @param options 选项
366
- */
367
- setOtherParams(params: Record<string, any>, { cover }?: {
368
- cover?: boolean;
369
- }): Promise<void>;
370
362
  /**
371
363
  * 获取其他参数
372
364
  * @returns 其他参数
@@ -1717,57 +1717,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1717
1717
  this.scan.clearTaskQueue();
1718
1718
  }
1719
1719
 
1720
- /**
1721
- * 设置其他参数
1722
- * @param params 参数
1723
- * @param options 选项
1724
- */
1725
- }, {
1726
- key: "setOtherParams",
1727
- value: (function () {
1728
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
1729
- var _ref10,
1730
- _ref10$cover,
1731
- cover,
1732
- _args24 = arguments;
1733
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1734
- while (1) switch (_context24.prev = _context24.next) {
1735
- case 0:
1736
- _ref10 = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
1737
- if (cover) {
1738
- this.otherParams = params;
1739
- } else {
1740
- this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
1741
- }
1742
- case 2:
1743
- case "end":
1744
- return _context24.stop();
1745
- }
1746
- }, _callee24, this);
1747
- }));
1748
- function setOtherParams(_x17) {
1749
- return _setOtherParams.apply(this, arguments);
1750
- }
1751
- return setOtherParams;
1752
- }()
1753
1720
  /**
1754
1721
  * 获取其他参数
1755
1722
  * @returns 其他参数
1756
1723
  */
1757
- )
1758
1724
  }, {
1759
1725
  key: "getOtherParams",
1760
1726
  value: (function () {
1761
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1762
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1763
- while (1) switch (_context25.prev = _context25.next) {
1727
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1728
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1729
+ while (1) switch (_context24.prev = _context24.next) {
1764
1730
  case 0:
1765
- return _context25.abrupt("return", this.otherParams);
1731
+ return _context24.abrupt("return", this.otherParams);
1766
1732
  case 1:
1767
1733
  case "end":
1768
- return _context25.stop();
1734
+ return _context24.stop();
1769
1735
  }
1770
- }, _callee25, this);
1736
+ }, _callee24, this);
1771
1737
  }));
1772
1738
  function getOtherParams() {
1773
1739
  return _getOtherParams.apply(this, arguments);
@@ -1976,10 +1942,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1976
1942
  }, {
1977
1943
  key: "buildAddProductCtx",
1978
1944
  value: function buildAddProductCtx(extra) {
1979
- var _extra$date2, _ref11, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
1945
+ var _extra$date2, _ref10, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
1980
1946
  var bookingContextState = this.store.bookingContext.getState();
1981
1947
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
1982
- var orderCustomerId = (_ref11 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref11 !== void 0 ? _ref11 : undefined;
1948
+ var orderCustomerId = (_ref10 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref10 !== void 0 ? _ref10 : undefined;
1983
1949
  return _objectSpread({
1984
1950
  bookingConfig: bookingContextState.bookingConfig,
1985
1951
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2085,18 +2051,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2085
2051
  }, {
2086
2052
  key: "updateProductInOrder",
2087
2053
  value: (function () {
2088
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2089
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2090
- while (1) switch (_context26.prev = _context26.next) {
2054
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2055
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2056
+ while (1) switch (_context25.prev = _context25.next) {
2091
2057
  case 0:
2092
- return _context26.abrupt("return", this.updateOrderProduct(params));
2058
+ return _context25.abrupt("return", this.updateOrderProduct(params));
2093
2059
  case 1:
2094
2060
  case "end":
2095
- return _context26.stop();
2061
+ return _context25.stop();
2096
2062
  }
2097
- }, _callee26, this);
2063
+ }, _callee25, this);
2098
2064
  }));
2099
- function updateProductInOrder(_x18) {
2065
+ function updateProductInOrder(_x17) {
2100
2066
  return _updateProductInOrder.apply(this, arguments);
2101
2067
  }
2102
2068
  return updateProductInOrder;
@@ -2118,47 +2084,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2118
2084
  }, {
2119
2085
  key: "handleGlobalScanCode",
2120
2086
  value: (function () {
2121
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(code, bridge) {
2087
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(code, bridge) {
2122
2088
  var _this6 = this;
2123
2089
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2124
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2125
- while (1) switch (_context27.prev = _context27.next) {
2090
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2091
+ while (1) switch (_context26.prev = _context26.next) {
2126
2092
  case 0:
2127
2093
  trimmed = typeof code === 'string' ? code.trim() : '';
2128
2094
  if (trimmed) {
2129
- _context27.next = 4;
2095
+ _context26.next = 4;
2130
2096
  break;
2131
2097
  }
2132
2098
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2133
- return _context27.abrupt("return", {
2099
+ return _context26.abrupt("return", {
2134
2100
  status: 'failed',
2135
2101
  reason: 'empty_code'
2136
2102
  });
2137
2103
  case 4:
2138
- _context27.prev = 4;
2104
+ _context26.prev = 4;
2139
2105
  localSearch = function localSearch(v) {
2140
2106
  return _this6.store.products.findProductsByCodeOrBarcode(v);
2141
2107
  };
2142
2108
  scanCallback = handleGlobalScan(this.request, localSearch);
2143
- _context27.next = 9;
2109
+ _context26.next = 9;
2144
2110
  return scanCallback({
2145
2111
  type: 'nativeScanner',
2146
2112
  value: trimmed
2147
2113
  });
2148
2114
  case 9:
2149
- raw = _context27.sent;
2115
+ raw = _context26.sent;
2150
2116
  formatted = formatGlobalScanResult(raw, trimmed);
2151
2117
  if (formatted) {
2152
- _context27.next = 14;
2118
+ _context26.next = 14;
2153
2119
  break;
2154
2120
  }
2155
2121
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2156
- return _context27.abrupt("return", {
2122
+ return _context26.abrupt("return", {
2157
2123
  status: 'failed',
2158
2124
  reason: 'not_found'
2159
2125
  });
2160
2126
  case 14:
2161
- _context27.next = 16;
2127
+ _context26.next = 16;
2162
2128
  return applyGlobalScan({
2163
2129
  setOrderCustomer: function setOrderCustomer(customer) {
2164
2130
  return _this6.setOrderCustomer(customer);
@@ -2187,25 +2153,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2187
2153
  }
2188
2154
  }, formatted, bridge);
2189
2155
  case 16:
2190
- _result7 = _context27.sent;
2156
+ _result7 = _context26.sent;
2191
2157
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2192
- return _context27.abrupt("return", _result7);
2158
+ return _context26.abrupt("return", _result7);
2193
2159
  case 21:
2194
- _context27.prev = 21;
2195
- _context27.t0 = _context27["catch"](4);
2196
- console.error('[BookingTicket] handleGlobalScanCode failed', _context27.t0);
2160
+ _context26.prev = 21;
2161
+ _context26.t0 = _context26["catch"](4);
2162
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context26.t0);
2197
2163
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2198
- return _context27.abrupt("return", {
2164
+ return _context26.abrupt("return", {
2199
2165
  status: 'failed',
2200
2166
  reason: 'not_found'
2201
2167
  });
2202
2168
  case 26:
2203
2169
  case "end":
2204
- return _context27.stop();
2170
+ return _context26.stop();
2205
2171
  }
2206
- }, _callee27, this, [[4, 21]]);
2172
+ }, _callee26, this, [[4, 21]]);
2207
2173
  }));
2208
- function handleGlobalScanCode(_x19, _x20) {
2174
+ function handleGlobalScanCode(_x18, _x19) {
2209
2175
  return _handleGlobalScanCode.apply(this, arguments);
2210
2176
  }
2211
2177
  return handleGlobalScanCode;
@@ -2218,12 +2184,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2218
2184
  }, {
2219
2185
  key: "destroy",
2220
2186
  value: (function () {
2221
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2187
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2222
2188
  var _this$scan;
2223
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2224
- while (1) switch (_context28.prev = _context28.next) {
2189
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2190
+ while (1) switch (_context27.prev = _context27.next) {
2225
2191
  case 0:
2226
- _context28.next = 2;
2192
+ _context27.next = 2;
2227
2193
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2228
2194
  case 2:
2229
2195
  try {
@@ -2234,9 +2200,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2234
2200
  scanCache.clear();
2235
2201
  case 4:
2236
2202
  case "end":
2237
- return _context28.stop();
2203
+ return _context27.stop();
2238
2204
  }
2239
- }, _callee28, this);
2205
+ }, _callee27, this);
2240
2206
  }));
2241
2207
  function destroy() {
2242
2208
  return _destroy.apply(this, arguments);
@@ -14,6 +14,16 @@ export interface Module {
14
14
  name: string;
15
15
  version: string;
16
16
  initialize: (core: PisellCore, options: ModuleOptions) => Promise<void> | void;
17
+ /**
18
+ * 父级解决方案运行时更新 otherParams 后,显式通知子模块刷新自己的运行态参数。
19
+ *
20
+ * @example
21
+ * await module.updateOtherParams?.({ channel: 'pos' }, { changedParams: { channel: 'pos' } });
22
+ */
23
+ updateOtherParams?: (params: Record<string, any>, meta?: {
24
+ changedParams?: Record<string, any>;
25
+ cover?: boolean;
26
+ }) => Promise<void> | void;
17
27
  destroy?: () => Promise<void> | void;
18
28
  exports?: Record<string, any>;
19
29
  isSolution?: boolean;
@@ -0,0 +1,49 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
34
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
+ default: () => import_adapter2.default
37
+ });
38
+ module.exports = __toCommonJS(promotion_exports);
39
+ var import_evaluator = require("./evaluator");
40
+ var import_adapter = require("./adapter");
41
+ var import_adapter2 = __toESM(require("./adapter"));
42
+ var import_examples = require("./examples");
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ BUY_X_GET_Y_FREE_STRATEGY,
46
+ PromotionAdapter,
47
+ PromotionEvaluator,
48
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
49
+ });
@@ -67,6 +67,7 @@ export interface BookingMetadataInput {
67
67
  capacity?: number | BookingCapacityMetadataItem[];
68
68
  /** 协议要求始终提交(即使为 null)。 */
69
69
  holder_id: any;
70
+ holder?: any;
70
71
  resource_select_type?: 'single' | 'multiple' | string;
71
72
  }
72
73
  /**
@@ -174,6 +174,9 @@ function cacheItemToBookingInput(cacheItem, options) {
174
174
  if (ext.holder_id !== void 0 && ext.holder_id !== null) {
175
175
  metadata.holder_id = ext.holder_id;
176
176
  }
177
+ if (ext.holder !== void 0) {
178
+ metadata.holder = ext.holder;
179
+ }
177
180
  if (ext.collect_pax !== void 0)
178
181
  metadata.collect_pax = ext.collect_pax;
179
182
  const extendCapacity = normalizeExtendCapacityForMetadata(ext.capacity);
@@ -19,6 +19,13 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
19
19
  private otherParams;
20
20
  constructor(name?: string, version?: string);
21
21
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
22
+ /**
23
+ * 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
24
+ *
25
+ * @example
26
+ * customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
27
+ */
28
+ updateOtherParams(params: Record<string, any>): void;
22
29
  /**
23
30
  * 获取客户列表数据(内部方法)
24
31
  * @param params 查询参数
@@ -114,6 +114,18 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
114
114
  this.fatherModule = options.otherParams.fatherModule;
115
115
  }
116
116
  }
117
+ /**
118
+ * 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
119
+ *
120
+ * @example
121
+ * customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
122
+ */
123
+ updateOtherParams(params) {
124
+ this.otherParams = params || {};
125
+ this.openCache = this.otherParams.openCache ?? false;
126
+ this.cacheId = this.otherParams.cacheId;
127
+ this.fatherModule = this.otherParams.fatherModule;
128
+ }
117
129
  /**
118
130
  * 获取客户列表数据(内部方法)
119
131
  * @param params 查询参数
@@ -17,6 +17,13 @@ export declare class OpenDataModule extends BaseModule implements Module {
17
17
  private otherParams;
18
18
  constructor(name?: string, version?: string);
19
19
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
20
+ /**
21
+ * 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
22
+ *
23
+ * @example
24
+ * openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
25
+ */
26
+ updateOtherParams(params: Record<string, any>): void;
20
27
  fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
21
28
  getOpenData(): OpenDataConfig | null;
22
29
  getLastFetchedAt(): number | null;
@@ -59,6 +59,18 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
59
59
  throw new Error("OpenDataModule 需要 window 插件支持");
60
60
  console.log("[OpenDataModule] 初始化完成");
61
61
  }
62
+ /**
63
+ * 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
64
+ *
65
+ * @example
66
+ * openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
67
+ */
68
+ updateOtherParams(params) {
69
+ this.otherParams = params || {};
70
+ this.openCache = this.otherParams.openCache ?? false;
71
+ this.cacheId = this.otherParams.cacheId;
72
+ this.fatherModule = this.otherParams.fatherModule;
73
+ }
62
74
  async fetchOpenData(params) {
63
75
  var _a, _b;
64
76
  const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
@@ -94,7 +106,7 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
94
106
  }
95
107
  checkAvailability(scheduleModule) {
96
108
  var _a;
97
- const scheduleList = scheduleModule ? scheduleModule.getScheduleListByIds(
109
+ const scheduleList = scheduleModule ? scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(
98
110
  ((_a = this.store.data) == null ? void 0 : _a["availability.operating_hours"]) || []
99
111
  ) : void 0;
100
112
  return (0, import_utils.computeAvailability)({
@@ -17,6 +17,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
17
17
  private cacheId;
18
18
  private salesSummaryModuleName;
19
19
  private rulesHooksOverride?;
20
+ private moduleHooksOverride?;
20
21
  private orderHooks?;
21
22
  private otherParams?;
22
23
  /** 评估器引用;由 SalesSdkProvider 注入,未注入时 applyPromotion 静默跳过 */
@@ -43,6 +44,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
43
44
  private applyProductDiscountPrices;
44
45
  constructor(name?: string, version?: string);
45
46
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
47
+ /**
48
+ * 更新父级解决方案透传的运行态参数,并同步 Order 内部依赖的派生字段。
49
+ *
50
+ * @example
51
+ * orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
52
+ */
53
+ updateOtherParams(params: Record<string, any>): void;
46
54
  /**
47
55
  * 记录信息日志
48
56
  */
@@ -186,6 +194,41 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
186
194
  private ensureExtend;
187
195
  private captureProductRuntime;
188
196
  private createLinkedProductAndBooking;
197
+ /**
198
+ * booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
199
+ *
200
+ * @example
201
+ * this.syncBookingMetadataHolder(booking, metadata);
202
+ */
203
+ private syncBookingMetadataHolder;
204
+ /**
205
+ * 从单条 booking 的 holder / metadata 中收集 holder form_record。
206
+ *
207
+ * @example
208
+ * const ids = this.collectBookingHolderRecords(booking);
209
+ */
210
+ private collectBookingHolderRecords;
211
+ /**
212
+ * 按 form_record 顺序读取 booking holder 的主字段名称。
213
+ *
214
+ * @example
215
+ * const names = this.collectBookingHolderNames(booking);
216
+ */
217
+ private collectBookingHolderNames;
218
+ /**
219
+ * 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
220
+ *
221
+ * @example
222
+ * const holder = this.buildTempOrderHolderFromBookings(tempOrder);
223
+ */
224
+ private buildTempOrderHolderFromBookings;
225
+ /**
226
+ * 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
227
+ *
228
+ * @example
229
+ * this.syncTempOrderHolderFromBookings(tempOrder);
230
+ */
231
+ private syncTempOrderHolderFromBookings;
189
232
  private getBookingUniqueIdentificationNumber;
190
233
  private findBookingIndexByUniqueIdentificationNumber;
191
234
  private removeLinkedBookingsForProduct;