@pisell/pisellos 2.2.259 → 2.2.261

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 (43) hide show
  1. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  2. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  3. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  4. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  5. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  6. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  7. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  8. package/dist/model/strategy/adapter/promotion/index.js +1 -1
  9. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  10. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  11. package/dist/modules/Order/index.d.ts +1 -1
  12. package/dist/modules/Order/utils.js +2 -1
  13. package/dist/modules/Product/index.d.ts +1 -1
  14. package/dist/modules/Rules/index.d.ts +1 -0
  15. package/dist/modules/Rules/index.js +34 -14
  16. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  17. package/dist/solution/BaseSales/utils/cartPromotion.js +74 -29
  18. package/dist/solution/BookingByStep/index.d.ts +1 -1
  19. package/dist/solution/BookingTicket/index.d.ts +1 -1
  20. package/dist/solution/ScanOrder/index.js +31 -20
  21. package/dist/solution/VenueBooking/index.js +30 -19
  22. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  23. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  24. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  25. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  26. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  27. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  28. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  29. package/lib/model/strategy/adapter/promotion/index.js +2 -0
  30. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  31. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  32. package/lib/modules/Order/index.d.ts +1 -1
  33. package/lib/modules/Order/utils.js +6 -1
  34. package/lib/modules/Product/index.d.ts +1 -1
  35. package/lib/modules/Rules/index.d.ts +1 -0
  36. package/lib/modules/Rules/index.js +23 -4
  37. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  38. package/lib/solution/BaseSales/utils/cartPromotion.js +59 -16
  39. package/lib/solution/BookingByStep/index.d.ts +1 -1
  40. package/lib/solution/BookingTicket/index.d.ts +1 -1
  41. package/lib/solution/ScanOrder/index.js +8 -0
  42. package/lib/solution/VenueBooking/index.js +8 -0
  43. package/package.json +1 -1
@@ -167,6 +167,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
167
167
  resolveDiscountListForManualOverride(discountList) {
168
168
  return this.excludeDiscountListByType(discountList, "promotion");
169
169
  }
170
+ isItemRewardProductDiscount(product) {
171
+ var _a;
172
+ const discountList = Array.isArray(product == null ? void 0 : product.discount_list) ? product.discount_list : [];
173
+ return ((_a = product == null ? void 0 : product._promotion) == null ? void 0 : _a.actionType) === "ITEM_REWARD" && discountList.some(
174
+ (item) => {
175
+ var _a2, _b;
176
+ return (item == null ? void 0 : item.type) === "product" && ((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
177
+ }
178
+ );
179
+ }
170
180
  // 获取券不可用的原因
171
181
  getUnavailableReason(discountList, productList) {
172
182
  var _a;
@@ -465,6 +475,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
465
475
  startDate: (_a2 = flatItem.parentProduct) == null ? void 0 : _a2.startDate
466
476
  };
467
477
  }
478
+ if (this.isItemRewardProductDiscount(product)) {
479
+ return false;
480
+ }
468
481
  const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.length) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.every((d) => d.id && ["good_pass", "discount_card", "product_discount_card"].includes(d.tag || d.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_e = (_d = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _d.discount_list) == null ? void 0 : _e.length) && ((_g = (_f = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _f.discount_list) == null ? void 0 : _g.every((d) => d.id)));
469
482
  if (!isAvailableProduct) {
470
483
  return false;
@@ -590,6 +603,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
590
603
  };
591
604
  originProduct = flatItem.originProduct;
592
605
  }
606
+ const isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
593
607
  addModeDiscount.forEach((discount) => {
594
608
  var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
595
609
  const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
@@ -613,7 +627,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
613
627
  ].includes(discount2.tag || discount2.type)
614
628
  ))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.discount_list) == null ? void 0 : _d.length) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.discount_list) == null ? void 0 : _f.every((discount2) => discount2.id)));
615
629
  const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
616
- if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
630
+ if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
617
631
  (_h = discountApplicability.get(discount.id)) == null ? void 0 : _h.push(product.id);
618
632
  const applicableProducts = discountApplicableProducts.get(discount.id) || [];
619
633
  const discountType = discount.tag || discount.type;
@@ -736,6 +750,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
736
750
  }
737
751
  const applicableDiscounts = sortedDiscountList.filter((discount) => {
738
752
  var _a3, _b2, _c2, _d2;
753
+ if (this.isItemRewardProductDiscount(product))
754
+ return false;
739
755
  const discountType = discount.tag || discount.type;
740
756
  if (["good_pass", "discount_card", "product_discount_card"].includes(
741
757
  discountType
@@ -801,6 +817,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
801
817
  );
802
818
  const selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
803
819
  let isManualDiscount = false;
820
+ let isItemRewardProductDiscount = false;
804
821
  if (flatItem.type === "main") {
805
822
  isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : ((_g = product.discount_list) == null ? void 0 : _g.some((item) => item.type === "product")) || product.total != product.origin_total && (product.bundle || []).every(
806
823
  (item) => {
@@ -811,7 +828,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
811
828
  _i,
812
829
  (item) => item.type === "product"
813
830
  )));
814
- if (product.inPromotion) {
831
+ isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
832
+ if (product.inPromotion && !isItemRewardProductDiscount) {
815
833
  isManualDiscount = false;
816
834
  }
817
835
  } else {
@@ -925,7 +943,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
925
943
  } else {
926
944
  let total = product.inPromotion ? ((_w = product == null ? void 0 : product._promotion) == null ? void 0 : _w.finalPrice) ?? product.origin_total ?? product.total : product.origin_total ?? product.total;
927
945
  let main_product_selling_price = product.price;
928
- if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
946
+ if ((product.discount_list || []).some((item) => item.type === "promotion") || isItemRewardProductDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
929
947
  total = product.total ?? product.origin_total;
930
948
  main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
931
949
  }
@@ -933,7 +951,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
933
951
  this.hooks.setProduct(originProduct, {
934
952
  ...isManualDiscount ? {
935
953
  price: product.price,
936
- main_product_selling_price: product.price
954
+ main_product_selling_price: isItemRewardProductDiscount ? main_product_selling_price : product.price,
955
+ ...isItemRewardProductDiscount ? { total } : {}
937
956
  } : {
938
957
  _id: product._id.split("___")[0] + "___" + index,
939
958
  total,
@@ -78,6 +78,7 @@ export interface CartPromotionEvaluator {
78
78
  }>;
79
79
  hasApplicableStrategy: boolean;
80
80
  }>;
81
+ getStrategyConfigs?: () => unknown[];
81
82
  }
82
83
  /** 单个赠品减量项 */
83
84
  export interface GiftReduceItem {
@@ -267,7 +268,8 @@ export declare function appendPromotionTags<T extends Record<string, any>>(produ
267
268
  * 处理购物车的促销计算与赠品差异化。
268
269
  *
269
270
  * 流程:
270
- * 1. 分离 main / gift / edit-product 三类(带 `booking_id` 的编辑态商品不参与促销)
271
+ * 1. 分离 main / gift / edit-product 三类(普通促销下带 `booking_id` 的编辑态商品不参与;
272
+ * 配置 ITEM_REWARD 时,编辑态商品也参与商品奖励重算)
271
273
  * 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
272
274
  * 3. 把 PricedProduct 映射回 OrderProduct 形态:
273
275
  * - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
@@ -77,19 +77,34 @@ function getOrderProductOriginalPriceForPromotion(product) {
77
77
  }
78
78
  return getOrderProductBasePrice(product);
79
79
  }
80
- function updatePromotionDiscountList(item, promotionDiscount) {
80
+ var X_ITEMS_FOR_Y_PRICE = "X_ITEMS_FOR_Y_PRICE";
81
+ var ITEM_REWARD = "ITEM_REWARD";
82
+ function isManagedPromotionDiscountItem(item) {
83
+ var _a, _b;
84
+ if ((item == null ? void 0 : item.type) === "promotion")
85
+ return true;
86
+ return (item == null ? void 0 : item.type) === "product" && ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === ITEM_REWARD;
87
+ }
88
+ function updatePromotionDiscountList(item, promotionDiscount, options) {
81
89
  let discountList = Array.isArray(item.discount_list) ? [...item.discount_list] : [];
82
- discountList = discountList.filter((d) => (d == null ? void 0 : d.type) !== "promotion");
90
+ discountList = discountList.filter((d) => !isManagedPromotionDiscountItem(d));
83
91
  if (promotionDiscount) {
92
+ const discountType = (options == null ? void 0 : options.discountType) || "promotion";
84
93
  discountList.push({
85
- type: "promotion",
94
+ type: discountType,
86
95
  amount: promotionDiscount.amount,
87
96
  discount: {
88
97
  original_amount: promotionDiscount.original_amount,
89
98
  fixed_amount: promotionDiscount.fixed_amount,
90
99
  title: promotionDiscount.title,
91
100
  resource_id: ""
92
- }
101
+ },
102
+ ...discountType === "product" ? {
103
+ metadata: {
104
+ source: "promotion",
105
+ actionType: (options == null ? void 0 : options.actionType) || ITEM_REWARD
106
+ }
107
+ } : {}
93
108
  });
94
109
  }
95
110
  if (discountList.length > 0) {
@@ -98,7 +113,15 @@ function updatePromotionDiscountList(item, promotionDiscount) {
98
113
  delete item.discount_list;
99
114
  }
100
115
  }
101
- var X_ITEMS_FOR_Y_PRICE = "X_ITEMS_FOR_Y_PRICE";
116
+ function evaluatorHasActionType(evaluator, actionType) {
117
+ var _a;
118
+ const configs = (_a = evaluator == null ? void 0 : evaluator.getStrategyConfigs) == null ? void 0 : _a.call(evaluator);
119
+ if (!Array.isArray(configs))
120
+ return false;
121
+ return configs.some(
122
+ (config) => ((config == null ? void 0 : config.actions) || []).some((action) => (action == null ? void 0 : action.type) === actionType)
123
+ );
124
+ }
102
125
  function applyPromoUnitPriceToLine(item, input) {
103
126
  const metadata = item.metadata || (item.metadata = {});
104
127
  const optionSum = (0, import_utils.sumOptionUnitPrice)((0, import_utils.getProductSkuOptions)(item)).toNumber();
@@ -125,6 +148,9 @@ function applyPromoUnitPriceToLine(item, input) {
125
148
  amount: discountAmount,
126
149
  original_amount: catalogSource,
127
150
  fixed_amount: discountAmount
151
+ }, {
152
+ actionType: input.actionType,
153
+ discountType: input.actionType === ITEM_REWARD ? "product" : "promotion"
128
154
  });
129
155
  } else {
130
156
  updatePromotionDiscountList(item, null);
@@ -457,6 +483,9 @@ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
457
483
  function generateNumericId() {
458
484
  return Math.floor(Math.random() * 1e9) + Date.now();
459
485
  }
486
+ function isBookingEditProductLine(product) {
487
+ return (product == null ? void 0 : product.booking_id) !== void 0 && (product == null ? void 0 : product.booking_id) !== null && product.booking_id !== 0 && product.booking_id !== "0";
488
+ }
460
489
  function convertToPromotionProduct(product, index) {
461
490
  const metadata = (product == null ? void 0 : product.metadata) || {};
462
491
  const numericId = generateNumericId();
@@ -469,6 +498,7 @@ function convertToPromotionProduct(product, index) {
469
498
  price: getOrderProductOriginalPriceForPromotion(product),
470
499
  quantity: Number((product == null ? void 0 : product.num) ?? 1) || 1,
471
500
  bundle: getProductBundleForEvaluator(product),
501
+ _promotionOnlyForItemReward: isBookingEditProductLine(product),
472
502
  _originalItem: originalItem,
473
503
  _originalId: getOrderProductUid(product),
474
504
  _originalIndex: index
@@ -570,6 +600,9 @@ function resolveStrategyRequiredQuantity(matched) {
570
600
  if (matched.actionType === "BUY_X_GET_Y_FREE") {
571
601
  return Number(detail.buyQuantity) || 1;
572
602
  }
603
+ if (matched.actionType === "ITEM_REWARD") {
604
+ return Number(detail.triggerQuantity) || 1;
605
+ }
573
606
  return 1;
574
607
  }
575
608
  function resolveStrategyEligibleProducts(matched) {
@@ -670,7 +703,7 @@ function appendPromotionTags(products, evaluator) {
670
703
  });
671
704
  }
672
705
  function processCartPromotion(list, evaluator, options) {
673
- var _a, _b, _c, _d, _e, _f, _g, _h;
706
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
674
707
  const empty = {
675
708
  products: Array.isArray(list) ? [...list] : [],
676
709
  totalDiscount: 0,
@@ -680,6 +713,10 @@ function processCartPromotion(list, evaluator, options) {
680
713
  };
681
714
  if (!list || list.length === 0 || !evaluator)
682
715
  return empty;
716
+ const shouldIncludeEditProductsForItemReward = evaluatorHasActionType(
717
+ evaluator,
718
+ ITEM_REWARD
719
+ );
683
720
  const mainProductsWithIndex = [];
684
721
  const existingGiftsWithIndex = [];
685
722
  const editProductsWithIndex = [];
@@ -690,8 +727,12 @@ function processCartPromotion(list, evaluator, options) {
690
727
  editProductsWithIndex.push({ item, originalListIndex: i });
691
728
  } else if (giftInfo) {
692
729
  existingGiftsWithIndex.push({ item, originalListIndex: i });
693
- } else if ((item == null ? void 0 : item.booking_id) !== void 0 && (item == null ? void 0 : item.booking_id) !== null && item.booking_id !== 0 && item.booking_id !== "0") {
694
- editProductsWithIndex.push({ item, originalListIndex: i });
730
+ } else if (isBookingEditProductLine(item)) {
731
+ if (shouldIncludeEditProductsForItemReward) {
732
+ mainProductsWithIndex.push({ item, originalListIndex: i });
733
+ } else {
734
+ editProductsWithIndex.push({ item, originalListIndex: i });
735
+ }
695
736
  } else {
696
737
  mainProductsWithIndex.push({ item, originalListIndex: i });
697
738
  }
@@ -734,7 +775,8 @@ function processCartPromotion(list, evaluator, options) {
734
775
  name: ((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.product_name) || (item == null ? void 0 : item.title) || "",
735
776
  price: getOrderProductBasePrice(item),
736
777
  quantity: Number((item == null ? void 0 : item.num) ?? 1) || 1,
737
- bundle: getProductBundleForEvaluator(item)
778
+ bundle: getProductBundleForEvaluator(item),
779
+ _promotionOnlyForItemReward: isBookingEditProductLine(item)
738
780
  };
739
781
  });
740
782
  for (let i = 0; i < consolidatedMainProductsWithIndex.length; i++) {
@@ -820,7 +862,8 @@ function processCartPromotion(list, evaluator, options) {
820
862
  applyPromoUnitPriceToLine(newItem, {
821
863
  promoUnitPrice,
822
864
  originalBasePrice,
823
- strategyTitle: (_b = priced.strategyMetadata) == null ? void 0 : _b.name
865
+ strategyTitle: (_b = priced.strategyMetadata) == null ? void 0 : _b.name,
866
+ actionType: priced.strategyId ? (_c = strategyActionMap.get(priced.strategyId)) == null ? void 0 : _c.actionType : void 0
824
867
  });
825
868
  } else {
826
869
  const optionSum = (0, import_utils.sumOptionUnitPrice)((0, import_utils.getProductSkuOptions)(newItem)).toNumber();
@@ -868,7 +911,7 @@ function processCartPromotion(list, evaluator, options) {
868
911
  giftOptions: gift.giftOptions
869
912
  };
870
913
  const bundleIdx = priced.matchedBundleIndex;
871
- if (bundleIdx !== void 0 && Array.isArray(newItem.product_bundle) && ((_c = newItem.product_bundle[bundleIdx]) == null ? void 0 : _c._promotion)) {
914
+ if (bundleIdx !== void 0 && Array.isArray(newItem.product_bundle) && ((_d = newItem.product_bundle[bundleIdx]) == null ? void 0 : _d._promotion)) {
872
915
  newItem.product_bundle[bundleIdx]._promotion.giftInfo = giftInfoData;
873
916
  } else if (metadata._promotion) {
874
917
  metadata._promotion.giftInfo = giftInfoData;
@@ -888,14 +931,14 @@ function processCartPromotion(list, evaluator, options) {
888
931
  const next = item;
889
932
  next._sortIndex = originalListIndex;
890
933
  next._sortSubIndex = 0;
891
- const strategyId = (_d = getGiftInfo(next)) == null ? void 0 : _d.strategyId;
934
+ const strategyId = (_e = getGiftInfo(next)) == null ? void 0 : _e.strategyId;
892
935
  if (strategyId) {
893
936
  const latest = strategyGiftInfoMap.get(strategyId);
894
937
  const owner = strategyGiftInfoOwner.get(strategyId);
895
- if (latest && ((_e = next.metadata) == null ? void 0 : _e._giftInfo)) {
938
+ if (latest && ((_f = next.metadata) == null ? void 0 : _f._giftInfo)) {
896
939
  next.metadata._giftInfo.sourceProductIds = latest.sourceProductIds;
897
940
  }
898
- if (owner && ((_f = next.metadata) == null ? void 0 : _f._giftInfo)) {
941
+ if (owner && ((_g = next.metadata) == null ? void 0 : _g._giftInfo)) {
899
942
  next.metadata._giftInfo.sourceProductId = owner;
900
943
  }
901
944
  }
@@ -948,11 +991,11 @@ function processCartPromotion(list, evaluator, options) {
948
991
  }
949
992
  const giftActions = calculateGiftActions(extendedGifts, existingGifts);
950
993
  for (const gift of existingGifts) {
951
- const strategyId = (_g = getGiftInfo(gift)) == null ? void 0 : _g.strategyId;
994
+ const strategyId = (_h = getGiftInfo(gift)) == null ? void 0 : _h.strategyId;
952
995
  if (!strategyId)
953
996
  continue;
954
997
  const latest = strategyGiftInfoMap.get(strategyId);
955
- if (latest && ((_h = gift.metadata) == null ? void 0 : _h._giftInfo)) {
998
+ if (latest && ((_i = gift.metadata) == null ? void 0 : _i._giftInfo)) {
956
999
  gift.metadata._giftInfo.lastEvaluatedGiftCount = latest.giftCount;
957
1000
  }
958
1001
  }
@@ -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 | 4 | 5 | 6;
314
+ weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -48,6 +48,10 @@ var import_utils2 = require("../../modules/Order/utils");
48
48
  var import_dayjs = __toESM(require("dayjs"));
49
49
  var import_itemRule = require("../../model/strategy/adapter/itemRule");
50
50
  __reExport(ScanOrder_exports, require("./types"), module.exports);
51
+ function isItemRewardProductDiscount(discount) {
52
+ var _a, _b;
53
+ return (discount == null ? void 0 : discount.type) === "product" && ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.source) === "promotion" && ((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
54
+ }
51
55
  var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
52
56
  constructor(name, version) {
53
57
  super(name, version);
@@ -742,6 +746,10 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
742
746
  for (const product of tempOrder.products) {
743
747
  if ((_c = product._origin) == null ? void 0 : _c.isManualDiscount)
744
748
  continue;
749
+ if ((product.discount_list || []).some(isItemRewardProductDiscount)) {
750
+ product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
751
+ continue;
752
+ }
745
753
  product.discount_list = (product.discount_list || []).filter((pd) => {
746
754
  var _a2;
747
755
  const rid = ((_a2 = pd.discount) == null ? void 0 : _a2.resource_id) ?? pd.id;
@@ -65,6 +65,10 @@ var OPEN_DATA_SECTION_CODES = [
65
65
  "workflow",
66
66
  "checkout"
67
67
  ];
68
+ function isItemRewardProductDiscount(discount) {
69
+ var _a, _b;
70
+ return (discount == null ? void 0 : discount.type) === "product" && ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.source) === "promotion" && ((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
71
+ }
68
72
  function cloneCustomDepositData(customDepositData) {
69
73
  if (!customDepositData || typeof customDepositData !== "object")
70
74
  return void 0;
@@ -1339,6 +1343,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1339
1343
  for (const product of tempOrder.products) {
1340
1344
  if ((_c = product._origin) == null ? void 0 : _c.isManualDiscount)
1341
1345
  continue;
1346
+ if ((product.discount_list || []).some(isItemRewardProductDiscount)) {
1347
+ product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
1348
+ continue;
1349
+ }
1342
1350
  product.discount_list = (product.discount_list || []).filter((pd) => {
1343
1351
  var _a2;
1344
1352
  const rid = ((_a2 = pd.discount) == null ? void 0 : _a2.resource_id) ?? pd.id;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.259",
4
+ "version": "2.2.261",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",