@pisell/pisellos 2.2.263 → 2.2.264

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 (132) hide show
  1. package/dist/model/strategy/adapter/index.d.ts +0 -4
  2. package/dist/model/strategy/adapter/index.js +1 -5
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -16
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
  15. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  16. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +1 -32
  17. package/dist/modules/Discount/index.d.ts +2 -5
  18. package/dist/modules/Discount/index.js +7 -30
  19. package/dist/modules/Discount/types.d.ts +0 -4
  20. package/dist/modules/Order/index.d.ts +2 -14
  21. package/dist/modules/Order/index.js +736 -1035
  22. package/dist/modules/Order/types.d.ts +0 -16
  23. package/dist/modules/Order/utils.d.ts +3 -4
  24. package/dist/modules/Order/utils.js +61 -54
  25. package/dist/modules/Product/types.d.ts +0 -22
  26. package/dist/modules/ProductList/index.d.ts +1 -1
  27. package/dist/modules/ProductList/index.js +2 -4
  28. package/dist/modules/ProductList/types.d.ts +0 -2
  29. package/dist/modules/Rules/index.d.ts +9 -2
  30. package/dist/modules/Rules/index.js +43 -69
  31. package/dist/modules/Rules/types.d.ts +1 -10
  32. package/dist/server/index.d.ts +0 -55
  33. package/dist/server/index.js +753 -1173
  34. package/dist/server/modules/order/index.d.ts +4 -10
  35. package/dist/server/modules/order/index.js +399 -404
  36. package/dist/server/modules/order/types.d.ts +0 -4
  37. package/dist/server/modules/products/index.d.ts +8 -31
  38. package/dist/server/modules/products/index.js +390 -549
  39. package/dist/server/modules/products/types.d.ts +0 -18
  40. package/dist/solution/BaseSales/index.d.ts +1 -21
  41. package/dist/solution/BaseSales/index.js +789 -1136
  42. package/dist/solution/BaseSales/types.d.ts +1 -6
  43. package/dist/solution/BaseSales/types.js +1 -1
  44. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  45. package/dist/solution/BaseSales/utils/cartPromotion.js +97 -50
  46. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  47. package/dist/solution/BaseSales/utils/parseSalesResponse.js +8 -6
  48. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -14
  49. package/dist/solution/BookingByStep/index.d.ts +1 -1
  50. package/dist/solution/BookingTicket/index.js +25 -59
  51. package/dist/solution/BookingTicket/types.d.ts +0 -2
  52. package/dist/solution/ScanOrder/index.js +31 -20
  53. package/dist/solution/ShopDiscount/index.js +14 -15
  54. package/dist/solution/VenueBooking/index.js +30 -19
  55. package/lib/model/strategy/adapter/index.d.ts +0 -4
  56. package/lib/model/strategy/adapter/index.js +2 -13
  57. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  58. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  59. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  60. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  61. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  62. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  63. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  64. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  65. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  66. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  67. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -5
  68. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -1
  69. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  70. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +2 -23
  71. package/lib/modules/Discount/index.d.ts +2 -5
  72. package/lib/modules/Discount/index.js +3 -23
  73. package/lib/modules/Discount/types.d.ts +0 -4
  74. package/lib/modules/Order/index.d.ts +2 -14
  75. package/lib/modules/Order/index.js +60 -326
  76. package/lib/modules/Order/types.d.ts +0 -16
  77. package/lib/modules/Order/utils.d.ts +3 -4
  78. package/lib/modules/Order/utils.js +23 -22
  79. package/lib/modules/Product/types.d.ts +0 -22
  80. package/lib/modules/ProductList/index.d.ts +1 -1
  81. package/lib/modules/ProductList/index.js +2 -4
  82. package/lib/modules/ProductList/types.d.ts +0 -2
  83. package/lib/modules/Rules/index.d.ts +9 -2
  84. package/lib/modules/Rules/index.js +29 -61
  85. package/lib/modules/Rules/types.d.ts +1 -10
  86. package/lib/server/index.d.ts +0 -55
  87. package/lib/server/index.js +34 -332
  88. package/lib/server/modules/order/index.d.ts +4 -10
  89. package/lib/server/modules/order/index.js +139 -198
  90. package/lib/server/modules/order/types.d.ts +0 -4
  91. package/lib/server/modules/products/index.d.ts +8 -31
  92. package/lib/server/modules/products/index.js +35 -134
  93. package/lib/server/modules/products/types.d.ts +0 -18
  94. package/lib/solution/BaseSales/index.d.ts +1 -21
  95. package/lib/solution/BaseSales/index.js +72 -313
  96. package/lib/solution/BaseSales/types.d.ts +1 -6
  97. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  98. package/lib/solution/BaseSales/utils/cartPromotion.js +64 -25
  99. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  100. package/lib/solution/BaseSales/utils/parseSalesResponse.js +5 -4
  101. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -8
  102. package/lib/solution/BookingByStep/index.d.ts +1 -1
  103. package/lib/solution/BookingTicket/index.js +8 -33
  104. package/lib/solution/BookingTicket/types.d.ts +0 -2
  105. package/lib/solution/ScanOrder/index.js +8 -0
  106. package/lib/solution/ShopDiscount/index.js +1 -2
  107. package/lib/solution/VenueBooking/index.js +8 -0
  108. package/package.json +1 -1
  109. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  110. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
  111. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  112. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
  113. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  114. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
  115. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  116. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  117. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  118. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  119. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
  120. package/dist/modules/Order/utils/orderCollectionIdentity.js +0 -405
  121. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  122. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
  123. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  124. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
  125. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  126. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
  127. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  128. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  129. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  130. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
  131. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
  132. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -415
@@ -12,6 +12,8 @@ export declare const PROMOTION_ACTION_TYPES: {
12
12
  readonly X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE";
13
13
  /** 买X送Y(买X件送Y件,可累计) */
14
14
  readonly BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE";
15
+ /** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
16
+ readonly ITEM_REWARD: "ITEM_REWARD";
15
17
  /** 固定折扣 */
16
18
  readonly DISCOUNT_RATE: "DISCOUNT_RATE";
17
19
  /** 固定减价 */
@@ -66,6 +68,59 @@ export interface BuyXGetYFreeConfig {
66
68
  /** 可选的赠品列表 */
67
69
  giftProducts?: ProductIdentifier[];
68
70
  }
71
+ /**
72
+ * 商品奖励优惠方式
73
+ *
74
+ * - free: 目标商品最终价为 0
75
+ * - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
76
+ * - amount_off: 每个目标商品固定减免 rewardValue
77
+ * - fixed_price: 目标商品改为固定价 rewardValue
78
+ */
79
+ export type ItemRewardMethod = 'free' | 'percent_off' | 'amount_off' | 'fixed_price';
80
+ /**
81
+ * 商品奖励数量规则
82
+ *
83
+ * - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
84
+ * - all_targets: 满足条件后奖励全部目标商品
85
+ * - max_per_order: 满足条件后每单最多奖励固定数量目标商品
86
+ */
87
+ export type ItemRewardQuantityRule = 'per_condition_quantity' | 'all_targets' | 'max_per_order';
88
+ /** 商品奖励目标选择规则 */
89
+ export type ItemRewardTargetSelection = 'consumer_best';
90
+ /**
91
+ * 商品奖励 - Action Value
92
+ *
93
+ * @example
94
+ * value: {
95
+ * rewardMethod: 'free',
96
+ * quantityRule: 'per_condition_quantity',
97
+ * triggerQuantity: 1,
98
+ * rewardQuantity: 1,
99
+ * }
100
+ */
101
+ export interface ItemRewardValue {
102
+ /** 奖励方式 */
103
+ rewardMethod: ItemRewardMethod;
104
+ /** 奖励值:percent_off/amount_off/fixed_price 使用,free 可省略 */
105
+ rewardValue?: number;
106
+ /** 奖励数量规则 */
107
+ quantityRule: ItemRewardQuantityRule;
108
+ /** 每满足 N 个条件商品;默认 1 */
109
+ triggerQuantity?: number;
110
+ /** 奖励 Y 个目标商品;默认 1 */
111
+ rewardQuantity?: number;
112
+ /** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
113
+ maxRewardQuantity?: number;
114
+ }
115
+ /**
116
+ * 商品奖励 - Action Config
117
+ */
118
+ export interface ItemRewardConfig {
119
+ /** 奖励对象,本期支持指定商品/变体;product_variant_id=0 表示任意变体 */
120
+ rewardTargets?: ProductIdentifier[];
121
+ /** 目标商品超额时的选择规则;本期支持 consumer_best */
122
+ targetSelection?: ItemRewardTargetSelection;
123
+ }
69
124
  /**
70
125
  * 商品标识
71
126
  *
@@ -102,10 +157,19 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
102
157
  valueType: 'object';
103
158
  config?: BuyXGetYFreeConfig;
104
159
  }
160
+ /**
161
+ * 商品奖励 Action
162
+ */
163
+ export interface ItemRewardAction extends Omit<ActionEffect, 'type' | 'value' | 'config'> {
164
+ type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
165
+ value: ItemRewardValue;
166
+ valueType: 'object';
167
+ config?: ItemRewardConfig;
168
+ }
105
169
  /**
106
170
  * 促销活动 Action 联合类型
107
171
  */
108
- export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
172
+ export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction | ItemRewardAction;
109
173
  /**
110
174
  * 促销相关运算符
111
175
  */
@@ -170,6 +234,8 @@ export interface PromotionProduct {
170
234
  quantity: number;
171
235
  /** 原价 */
172
236
  original_price?: number;
237
+ /** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
238
+ _promotionOnlyForItemReward?: boolean;
173
239
  }
174
240
  /**
175
241
  * 促销活动适配器转换结果
@@ -195,7 +261,7 @@ export interface PromotionTransformResult {
195
261
  /**
196
262
  * Action 详情联合类型
197
263
  */
198
- export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
264
+ export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail | ItemRewardActionDetail;
199
265
  /**
200
266
  * X件Y元 Action 详情
201
267
  */
@@ -226,6 +292,28 @@ export interface BuyXGetYFreeActionDetail {
226
292
  /** 可选的赠品列表 */
227
293
  giftProducts: ProductIdentifier[];
228
294
  }
295
+ /**
296
+ * 商品奖励 Action 详情
297
+ */
298
+ export interface ItemRewardActionDetail {
299
+ type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
300
+ /** 奖励方式 */
301
+ rewardMethod: ItemRewardMethod;
302
+ /** 奖励值:percent_off/amount_off/fixed_price 使用,free 为 0 */
303
+ rewardValue: number;
304
+ /** 奖励数量规则 */
305
+ quantityRule: ItemRewardQuantityRule;
306
+ /** 每满足 N 个条件商品;默认 1 */
307
+ triggerQuantity: number;
308
+ /** 奖励 Y 个目标商品;默认 1 */
309
+ rewardQuantity: number;
310
+ /** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
311
+ maxRewardQuantity?: number;
312
+ /** 奖励对象,本期支持指定商品/变体 */
313
+ rewardTargets: ProductIdentifier[];
314
+ /** 目标商品超额时的选择规则 */
315
+ targetSelection: ItemRewardTargetSelection;
316
+ }
229
317
  /**
230
318
  * X件Y元 - 业务层计算结果
231
319
  *
@@ -16,6 +16,8 @@ export var PROMOTION_ACTION_TYPES = {
16
16
  X_ITEMS_FOR_Y_PRICE: 'X_ITEMS_FOR_Y_PRICE',
17
17
  /** 买X送Y(买X件送Y件,可累计) */
18
18
  BUY_X_GET_Y_FREE: 'BUY_X_GET_Y_FREE',
19
+ /** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
20
+ ITEM_REWARD: 'ITEM_REWARD',
19
21
  /** 固定折扣 */
20
22
  DISCOUNT_RATE: 'DISCOUNT_RATE',
21
23
  /** 固定减价 */
@@ -54,6 +56,41 @@ export var PROMOTION_ACTION_TYPES = {
54
56
  * 买X送Y - Action Config
55
57
  */
56
58
 
59
+ /**
60
+ * 商品奖励优惠方式
61
+ *
62
+ * - free: 目标商品最终价为 0
63
+ * - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
64
+ * - amount_off: 每个目标商品固定减免 rewardValue
65
+ * - fixed_price: 目标商品改为固定价 rewardValue
66
+ */
67
+
68
+ /**
69
+ * 商品奖励数量规则
70
+ *
71
+ * - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
72
+ * - all_targets: 满足条件后奖励全部目标商品
73
+ * - max_per_order: 满足条件后每单最多奖励固定数量目标商品
74
+ */
75
+
76
+ /** 商品奖励目标选择规则 */
77
+
78
+ /**
79
+ * 商品奖励 - Action Value
80
+ *
81
+ * @example
82
+ * value: {
83
+ * rewardMethod: 'free',
84
+ * quantityRule: 'per_condition_quantity',
85
+ * triggerQuantity: 1,
86
+ * rewardQuantity: 1,
87
+ * }
88
+ */
89
+
90
+ /**
91
+ * 商品奖励 - Action Config
92
+ */
93
+
57
94
  // ============================================
58
95
  // 商品标识
59
96
  // ============================================
@@ -78,6 +115,10 @@ export var PROMOTION_ACTION_TYPES = {
78
115
  * 买X送Y Action
79
116
  */
80
117
 
118
+ /**
119
+ * 商品奖励 Action
120
+ */
121
+
81
122
  /**
82
123
  * 促销活动 Action 联合类型
83
124
  */
@@ -146,6 +187,10 @@ var obj = {
146
187
  * 买X送Y Action 详情
147
188
  */
148
189
 
190
+ /**
191
+ * 商品奖励 Action 详情
192
+ */
193
+
149
194
  // ============================================
150
195
  // 业务层输出类型(供参考)
151
196
  // ============================================
@@ -121,10 +121,6 @@ function resolveProductTitle(product, booking, sourceProduct) {
121
121
  var metadata = product.metadata || {};
122
122
  return (_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.name) !== null && _ref5 !== void 0 ? _ref5 : metadata.product_title) !== null && _ref4 !== void 0 ? _ref4 : metadata.product_name) !== null && _ref3 !== void 0 ? _ref3 : booking === null || booking === void 0 || (_booking$product = booking.product) === null || _booking$product === void 0 ? void 0 : _booking$product.title) !== null && _ref2 !== void 0 ? _ref2 : booking === null || booking === void 0 || (_booking$detail = booking.detail) === null || _booking$detail === void 0 ? void 0 : _booking$detail.product_title) !== null && _ref !== void 0 ? _ref : '';
123
123
  }
124
- function resolveProductCover(product, booking, sourceProduct) {
125
- var _ref6, _cover;
126
- return (_ref6 = (_cover = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover) !== null && _cover !== void 0 ? _cover : product.product_cover) !== null && _ref6 !== void 0 ? _ref6 : '';
127
- }
128
124
  function resolveMainProductPrice(product, fallback) {
129
125
  var _metadata$main_produc;
130
126
  var metadata = product.metadata || {};
@@ -134,9 +130,9 @@ function resolveMainProductPrice(product, fallback) {
134
130
  }
135
131
  function mapOrderBundleToOtherBundle(bundle) {
136
132
  return bundle.map(function (item) {
137
- var _ref7, _item$original_price;
133
+ var _ref6, _item$original_price;
138
134
  return _objectSpread(_objectSpread({}, item), {}, {
139
- original_price: (_ref7 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.bundle_selling_price) !== null && _ref7 !== void 0 ? _ref7 : item.price
135
+ original_price: (_ref6 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.bundle_selling_price) !== null && _ref6 !== void 0 ? _ref6 : item.price
140
136
  });
141
137
  });
142
138
  }
@@ -167,10 +163,10 @@ function synthesizeProductResourceFromBooking(booking) {
167
163
  });
168
164
  if (relationIdsByForm.size === 0) return undefined;
169
165
  return {
170
- resources: Array.from(relationIdsByForm.entries()).map(function (_ref8) {
171
- var _ref9 = _slicedToArray(_ref8, 2),
172
- formId = _ref9[0],
173
- relationIds = _ref9[1];
166
+ resources: Array.from(relationIdsByForm.entries()).map(function (_ref7) {
167
+ var _ref8 = _slicedToArray(_ref7, 2),
168
+ formId = _ref8[0],
169
+ relationIds = _ref8[1];
174
170
  return {
175
171
  id: formId,
176
172
  status: 1,
@@ -190,7 +186,7 @@ function synthesizeProductResourceFromBooking(booking) {
190
186
  * 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
191
187
  */
192
188
  export function buildCacheItemFromOrderLine(input) {
193
- var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref12, _booking$id;
189
+ var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref9, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref10, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref11, _booking$id;
194
190
  var product = input.product,
195
191
  booking = input.booking,
196
192
  sourceProduct = input.sourceProduct;
@@ -206,7 +202,6 @@ export function buildCacheItemFromOrderLine(input) {
206
202
  var capacity = resolveCapacityFromBooking(booking);
207
203
  var holderId = (_booking$metadata$hol = (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : booking.holder_id;
208
204
  var productTitle = resolveProductTitle(product, booking, sourceProduct);
209
- var productCover = resolveProductCover(product, booking, sourceProduct);
210
205
  var productOptionString = buildProductOptionStringFromOrderLine(product);
211
206
  var other = {
212
207
  product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
@@ -224,8 +219,7 @@ export function buildCacheItemFromOrderLine(input) {
224
219
  sub_type: booking.sub_type,
225
220
  quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
226
221
  product_name: productTitle,
227
- product_cover: productCover,
228
- note: (_ref10 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref10 !== void 0 ? _ref10 : '',
222
+ note: (_ref9 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref9 !== void 0 ? _ref9 : '',
229
223
  price: mainProductPrice,
230
224
  total: selling,
231
225
  origin_total: original,
@@ -260,7 +254,7 @@ export function buildCacheItemFromOrderLine(input) {
260
254
  var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
261
255
  id: resolvedId,
262
256
  product_id: resolvedId,
263
- extension_type: (_ref11 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref11 !== void 0 ? _ref11 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
257
+ extension_type: (_ref10 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref10 !== void 0 ? _ref10 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
264
258
  title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
265
259
  price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
266
260
  selling_price: product.selling_price,
@@ -272,7 +266,7 @@ export function buildCacheItemFromOrderLine(input) {
272
266
  new: 0,
273
267
  autoClose: false,
274
268
  order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
275
- booking_id: (_ref12 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref12 !== void 0 ? _ref12 : 0
269
+ booking_id: (_ref11 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref11 !== void 0 ? _ref11 : 0
276
270
  });
277
271
  if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
278
272
  base.capacity = sourceProduct.capacity;
@@ -75,7 +75,7 @@ function mapOrderBundleToOtherBundle(bundle) {
75
75
  });
76
76
  }
77
77
  export function buildNormalProductCacheItemFromOrderLine(input) {
78
- var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail;
78
+ var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _price3, _product$order_detail;
79
79
  var product = input.product,
80
80
  sourceProduct = input.sourceProduct;
81
81
  var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
@@ -132,7 +132,6 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
132
132
  product_id: resolvedId,
133
133
  _id: uid,
134
134
  title: (_ref6 = (_title2 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title2 !== void 0 ? _title2 : product.product_title) !== null && _ref6 !== void 0 ? _ref6 : '',
135
- cover: (_ref7 = (_cover = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover) !== null && _cover !== void 0 ? _cover : product.product_cover) !== null && _ref7 !== void 0 ? _ref7 : '',
136
135
  price: (_price3 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price3 !== void 0 ? _price3 : sourcePrice,
137
136
  selling_price: product.selling_price,
138
137
  original_price: product.original_price
@@ -48,7 +48,7 @@ export interface BookingResourceInput {
48
48
  capacity?: number;
49
49
  like_status?: string;
50
50
  metadata?: Record<string, any>;
51
- children?: BookingResourceInput[];
51
+ children?: any[];
52
52
  }
53
53
  /** custom / package 人数维度快照,与 info2 `_extend.capacity` / `metadata.capacity` 对齐。 */
54
54
  export interface BookingCapacityMetadataItem {
@@ -76,33 +76,6 @@ function resolveDurationMinutes(value) {
76
76
  return Number.isNaN(n) ? undefined : n;
77
77
  }
78
78
 
79
- /**
80
- * 将组合资源子项收敛为 checkout resources 协议。
81
- *
82
- * resourcesOriginMap 中的子资源是 UI 运行态结构,通常只有 id / main_field / form_id,
83
- * 不保证携带后端必填的 relation_type。这里不能原样透传,否则会触发
84
- * `bookings.*.resources.*.children.*.relation_type` 校验错误。
85
- */
86
- function normalizeChildResource(child, parentFormId) {
87
- var _child$form_id, _child$relation_id;
88
- var item = {
89
- form_id: (_child$form_id = child === null || child === void 0 ? void 0 : child.form_id) !== null && _child$form_id !== void 0 ? _child$form_id : parentFormId,
90
- relation_type: (child === null || child === void 0 ? void 0 : child.relation_type) || 'form',
91
- relation_id: (_child$relation_id = child === null || child === void 0 ? void 0 : child.relation_id) !== null && _child$relation_id !== void 0 ? _child$relation_id : child === null || child === void 0 ? void 0 : child.id,
92
- capacity: child === null || child === void 0 ? void 0 : child.capacity,
93
- like_status: (child === null || child === void 0 ? void 0 : child.like_status) || 'common'
94
- };
95
- if ((child === null || child === void 0 ? void 0 : child.metadata) !== undefined) {
96
- item.metadata = _objectSpread({}, child.metadata);
97
- }
98
- if (Array.isArray(child === null || child === void 0 ? void 0 : child.children)) {
99
- item.children = child.children.map(function (nestedChild) {
100
- return normalizeChildResource(nestedChild, item.form_id);
101
- });
102
- }
103
- return item;
104
- }
105
-
106
79
  /**
107
80
  * cacheItem._extend.resource 形如 `{ [form_id]: [{ relation_id, form_id, like_status, metadata, children }] }`。
108
81
  * 这里扁平化为符合协议的 resources[] 数组;id=0 的「无资源」占位行**保留**(与 info2 业务等价;协议 `relation_id=0` 合法)。
@@ -128,11 +101,7 @@ function flattenResources(cacheItem) {
128
101
  // 协议允许 metadata 自由透传;为了与 info2 行为等价,把 form_name / resource_name / combined_resource 一并保留。
129
102
  item.metadata = _objectSpread({}, r.metadata);
130
103
  }
131
- if (Array.isArray(r === null || r === void 0 ? void 0 : r.children)) {
132
- item.children = r.children.map(function (child) {
133
- return normalizeChildResource(child, item.form_id);
134
- });
135
- }
104
+ if ((r === null || r === void 0 ? void 0 : r.children) !== undefined) item.children = r.children;
136
105
  result.push(item);
137
106
  });
138
107
  });
@@ -1,6 +1,6 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { Discount, DiscountModuleAPI, DiscountWithReason, DiscountPrepareConfigResult } from './types';
3
+ import { Discount, DiscountModuleAPI, DiscountWithReason } from './types';
4
4
  export declare class DiscountModule extends BaseModule implements Module, DiscountModuleAPI {
5
5
  protected defaultName: string;
6
6
  protected defaultVersion: string;
@@ -16,18 +16,15 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
16
16
  getDiscountList(): Discount[];
17
17
  setOriginalDiscountList(originalDiscountList: Discount[]): Promise<void>;
18
18
  getOriginalDiscountList(): Discount[];
19
- private normalizePositiveNumberIds;
20
19
  loadPrepareConfig(params: {
21
20
  action?: 'create' | 'edit';
22
21
  with_good_pass: 0 | 1;
23
22
  with_discount_card: 0 | 1;
24
23
  customer_id: number;
25
24
  with_wallet_pass_holder: 0 | 1;
26
- with_available_wallet_flag?: 0 | 1;
27
- with_available_wallet_pass_flag?: 0 | 1;
28
25
  request_timezone: string;
29
26
  order_id?: number | string;
30
- }): Promise<DiscountPrepareConfigResult>;
27
+ }): Promise<Discount[]>;
31
28
  batchSearch(code: string, options?: {
32
29
  customerId?: number;
33
30
  orderId?: number;
@@ -1,12 +1,12 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
7
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
8
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
9
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
10
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
11
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
12
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -151,22 +151,12 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
151
151
  value: function getOriginalDiscountList() {
152
152
  return this.store.originalDiscountList || [];
153
153
  }
154
- }, {
155
- key: "normalizePositiveNumberIds",
156
- value: function normalizePositiveNumberIds(values) {
157
- var ids = values.map(function (value) {
158
- return Number(value);
159
- }).filter(function (value) {
160
- return Number.isFinite(value) && value > 0;
161
- });
162
- return Array.from(new Set(ids));
163
- }
164
154
  }, {
165
155
  key: "loadPrepareConfig",
166
156
  value: function () {
167
157
  var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
168
- var _params$with_availabl, _params$with_availabl2, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5;
169
- var prepareConfig, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, goodPassList;
158
+ var _prepareConfig$data, _prepareConfig$data2;
159
+ var prepareConfig, rawDiscountList, goodPassList;
170
160
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
171
161
  while (1) switch (_context4.prev = _context4.next) {
172
162
  case 0:
@@ -174,26 +164,13 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
174
164
  params.order_id = undefined;
175
165
  }
176
166
  _context4.next = 3;
177
- return this.request.post("/order/prepare/config", _objectSpread(_objectSpread({}, params), {}, {
178
- with_available_wallet_flag: (_params$with_availabl = params.with_available_wallet_flag) !== null && _params$with_availabl !== void 0 ? _params$with_availabl : 1,
179
- with_available_wallet_pass_flag: (_params$with_availabl2 = params.with_available_wallet_pass_flag) !== null && _params$with_availabl2 !== void 0 ? _params$with_availabl2 : 1
180
- }));
167
+ return this.request.post("/order/prepare/config", params);
181
168
  case 3:
182
169
  prepareConfig = _context4.sent;
183
170
  rawDiscountList = [].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []));
184
- availableWalletList = [].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data3 = prepareConfig.data) === null || _prepareConfig$data3 === void 0 ? void 0 : _prepareConfig$data3.avaiable_wallet_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data4 = prepareConfig.data) === null || _prepareConfig$data4 === void 0 ? void 0 : _prepareConfig$data4.available_wallet_list) || []));
185
- availableWalletPassList = (prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data5 = prepareConfig.data) === null || _prepareConfig$data5 === void 0 ? void 0 : _prepareConfig$data5.available_wallet_pass_list) || [];
186
- availableWalletIds = this.normalizePositiveNumberIds([].concat(_toConsumableArray(availableWalletList.map(function (item) {
187
- return item === null || item === void 0 ? void 0 : item.wallet_id;
188
- })), _toConsumableArray(availableWalletPassList.map(function (item) {
189
- return item === null || item === void 0 ? void 0 : item.product_id;
190
- }))));
191
171
  goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
192
- return _context4.abrupt("return", {
193
- discountList: goodPassList,
194
- availableWalletIds: availableWalletIds
195
- });
196
- case 10:
172
+ return _context4.abrupt("return", goodPassList);
173
+ case 7:
197
174
  case "end":
198
175
  return _context4.stop();
199
176
  }
@@ -68,10 +68,6 @@ export interface DiscountWithReason {
68
68
  discountList: Discount[];
69
69
  unavailableReasonKey: DiscountFilterRejectKey | null;
70
70
  }
71
- export interface DiscountPrepareConfigResult {
72
- discountList: Discount[];
73
- availableWalletIds: number[];
74
- }
75
71
  interface ExtensionData {
76
72
  id: number;
77
73
  shop_id: number;
@@ -75,8 +75,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
75
75
  apply?: boolean;
76
76
  }): Promise<Discount[]>;
77
77
  getDiscountList(): Discount[];
78
- getAvailableWalletIds(): number[];
79
- private syncScannedDiscountsToOriginalDiscountList;
80
78
  private ensureEditDiscountConfigForProductChange;
81
79
  scanCode(code: string, customerId?: number): Promise<{
82
80
  isAvailable: boolean;
@@ -86,9 +84,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
86
84
  unavailableReasonKey?: string | null;
87
85
  scannedDiscountList?: Discount[];
88
86
  }>;
89
- applyDiscount(options?: {
90
- reapplyBookingDiscountProductUids?: string[];
91
- }): void;
87
+ applyDiscount(): void;
92
88
  /**
93
89
  * 注入促销评估器。
94
90
  *
@@ -156,7 +152,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
156
152
  private extractOrderIdFromSubmitResult;
157
153
  private calculatePaymentEffectiveAmount;
158
154
  private calculatePaymentTotal;
159
- private calculateOrderPaidPaymentTotal;
160
155
  private getDepositAmount;
161
156
  private normalizeDepositAmount;
162
157
  private getLastOrderDepositSnapshot;
@@ -185,7 +180,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
185
180
  private calculatePaidPaymentSummary;
186
181
  private calculatePaymentServiceFee;
187
182
  private calculatePaymentGapAmount;
188
- private calculatePaymentOrderAmount;
189
183
  private calculatePaymentRoundingAmount;
190
184
  private formatSummaryMetadataMoney;
191
185
  private syncSummaryProductMetadata;
@@ -280,7 +274,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
280
274
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
281
275
  private buildTempOrderCustomer;
282
276
  private isCustomerBoundDiscount;
283
- private shouldKeepCustomerBoundDiscountAfterCustomerChange;
284
277
  private productHasCustomerBoundDiscount;
285
278
  private shouldSkipDiscountCalculation;
286
279
  private clearCustomerBoundDiscounts;
@@ -468,7 +461,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
468
461
  generateIdempotencyToken(): string;
469
462
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
470
463
  createOrder(params: CommitOrderParams['query']): {
471
- type: "virtual" | "appointment_booking";
464
+ type: "appointment_booking" | "virtual";
472
465
  platform: string;
473
466
  sales_channel: string;
474
467
  order_sales_channel: string;
@@ -525,11 +518,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
525
518
  * this.normalizeHydratedBookingHolder({ metadata: { holder: { form_record: [1] } } });
526
519
  */
527
520
  private normalizeHydratedBookingHolder;
528
- /**
529
- * 匿名 booking 没有服务端行 ID 时,商品侧已有的 booking_uid 就是唯一可用的强引用。
530
- * 在统一规范化生成 UUID 前先复用它;已落库 booking 仍按 schedule_event_id 派生稳定 UID。
531
- */
532
- private seedAnonymousBookingUidsFromProducts;
533
521
  private normalizeTempOrderForRuntime;
534
522
  private hydrateLinkedBookingIdentity;
535
523
  private pickHydratedDisplayText;