@pisell/pisellos 2.2.261 → 2.2.263

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 (134) hide show
  1. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
  2. package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
  4. package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
  5. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  6. package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
  7. package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  8. package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
  9. package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
  10. package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
  11. package/dist/model/strategy/adapter/index.d.ts +4 -0
  12. package/dist/model/strategy/adapter/index.js +5 -1
  13. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  14. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  15. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  16. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  17. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  18. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  19. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  20. package/dist/model/strategy/adapter/promotion/index.js +1 -1
  21. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  22. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  23. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -10
  24. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  25. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  26. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
  27. package/dist/modules/Discount/index.d.ts +5 -2
  28. package/dist/modules/Discount/index.js +30 -7
  29. package/dist/modules/Discount/types.d.ts +4 -0
  30. package/dist/modules/Order/index.d.ts +14 -2
  31. package/dist/modules/Order/index.js +1035 -736
  32. package/dist/modules/Order/types.d.ts +16 -0
  33. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  34. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  35. package/dist/modules/Order/utils.d.ts +4 -3
  36. package/dist/modules/Order/utils.js +54 -61
  37. package/dist/modules/Product/types.d.ts +22 -0
  38. package/dist/modules/ProductList/index.d.ts +1 -1
  39. package/dist/modules/ProductList/index.js +4 -2
  40. package/dist/modules/ProductList/types.d.ts +2 -0
  41. package/dist/modules/Rules/index.d.ts +2 -9
  42. package/dist/modules/Rules/index.js +69 -43
  43. package/dist/modules/Rules/types.d.ts +10 -1
  44. package/dist/server/index.d.ts +55 -0
  45. package/dist/server/index.js +1173 -753
  46. package/dist/server/modules/order/index.d.ts +10 -4
  47. package/dist/server/modules/order/index.js +404 -399
  48. package/dist/server/modules/order/types.d.ts +4 -0
  49. package/dist/server/modules/products/index.d.ts +31 -8
  50. package/dist/server/modules/products/index.js +549 -390
  51. package/dist/server/modules/products/types.d.ts +18 -0
  52. package/dist/solution/BaseSales/index.d.ts +21 -1
  53. package/dist/solution/BaseSales/index.js +1136 -789
  54. package/dist/solution/BaseSales/types.d.ts +6 -1
  55. package/dist/solution/BaseSales/types.js +1 -1
  56. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  57. package/dist/solution/BaseSales/utils/cartPromotion.js +48 -81
  58. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  59. package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
  60. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -1
  61. package/dist/solution/BookingByStep/index.d.ts +1 -1
  62. package/dist/solution/BookingTicket/index.d.ts +1 -1
  63. package/dist/solution/BookingTicket/index.js +59 -25
  64. package/dist/solution/BookingTicket/types.d.ts +2 -0
  65. package/dist/solution/ScanOrder/index.js +20 -31
  66. package/dist/solution/ShopDiscount/index.js +15 -14
  67. package/dist/solution/VenueBooking/index.js +19 -30
  68. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
  69. package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
  70. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
  71. package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
  72. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  73. package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
  74. package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  75. package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
  76. package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
  77. package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
  78. package/lib/model/strategy/adapter/index.d.ts +4 -0
  79. package/lib/model/strategy/adapter/index.js +13 -2
  80. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  81. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  82. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  83. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  84. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  85. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  86. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  87. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  88. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  89. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  90. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -0
  91. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
  92. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  93. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
  94. package/lib/modules/Discount/index.d.ts +5 -2
  95. package/lib/modules/Discount/index.js +23 -3
  96. package/lib/modules/Discount/types.d.ts +4 -0
  97. package/lib/modules/Order/index.d.ts +14 -2
  98. package/lib/modules/Order/index.js +326 -60
  99. package/lib/modules/Order/types.d.ts +16 -0
  100. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  101. package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
  102. package/lib/modules/Order/utils.d.ts +4 -3
  103. package/lib/modules/Order/utils.js +22 -23
  104. package/lib/modules/Product/types.d.ts +22 -0
  105. package/lib/modules/ProductList/index.d.ts +1 -1
  106. package/lib/modules/ProductList/index.js +4 -2
  107. package/lib/modules/ProductList/types.d.ts +2 -0
  108. package/lib/modules/Rules/index.d.ts +2 -9
  109. package/lib/modules/Rules/index.js +61 -29
  110. package/lib/modules/Rules/types.d.ts +10 -1
  111. package/lib/server/index.d.ts +55 -0
  112. package/lib/server/index.js +332 -34
  113. package/lib/server/modules/order/index.d.ts +10 -4
  114. package/lib/server/modules/order/index.js +198 -139
  115. package/lib/server/modules/order/types.d.ts +4 -0
  116. package/lib/server/modules/products/index.d.ts +31 -8
  117. package/lib/server/modules/products/index.js +134 -35
  118. package/lib/server/modules/products/types.d.ts +18 -0
  119. package/lib/solution/BaseSales/index.d.ts +21 -1
  120. package/lib/solution/BaseSales/index.js +313 -72
  121. package/lib/solution/BaseSales/types.d.ts +6 -1
  122. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  123. package/lib/solution/BaseSales/utils/cartPromotion.js +29 -60
  124. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  125. package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
  126. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -0
  127. package/lib/solution/BookingByStep/index.d.ts +1 -1
  128. package/lib/solution/BookingTicket/index.d.ts +1 -1
  129. package/lib/solution/BookingTicket/index.js +33 -8
  130. package/lib/solution/BookingTicket/types.d.ts +2 -0
  131. package/lib/solution/ScanOrder/index.js +0 -8
  132. package/lib/solution/ShopDiscount/index.js +2 -1
  133. package/lib/solution/VenueBooking/index.js +0 -8
  134. package/package.json +1 -1
@@ -16,8 +16,6 @@ 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',
21
19
  /** 固定折扣 */
22
20
  DISCOUNT_RATE: 'DISCOUNT_RATE',
23
21
  /** 固定减价 */
@@ -56,41 +54,6 @@ export var PROMOTION_ACTION_TYPES = {
56
54
  * 买X送Y - Action Config
57
55
  */
58
56
 
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
-
94
57
  // ============================================
95
58
  // 商品标识
96
59
  // ============================================
@@ -115,10 +78,6 @@ export var PROMOTION_ACTION_TYPES = {
115
78
  * 买X送Y Action
116
79
  */
117
80
 
118
- /**
119
- * 商品奖励 Action
120
- */
121
-
122
81
  /**
123
82
  * 促销活动 Action 联合类型
124
83
  */
@@ -187,10 +146,6 @@ var obj = {
187
146
  * 买X送Y Action 详情
188
147
  */
189
148
 
190
- /**
191
- * 商品奖励 Action 详情
192
- */
193
-
194
149
  // ============================================
195
150
  // 业务层输出类型(供参考)
196
151
  // ============================================
@@ -121,6 +121,10 @@ 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
+ }
124
128
  function resolveMainProductPrice(product, fallback) {
125
129
  var _metadata$main_produc;
126
130
  var metadata = product.metadata || {};
@@ -130,9 +134,9 @@ function resolveMainProductPrice(product, fallback) {
130
134
  }
131
135
  function mapOrderBundleToOtherBundle(bundle) {
132
136
  return bundle.map(function (item) {
133
- var _ref6, _item$original_price;
137
+ var _ref7, _item$original_price;
134
138
  return _objectSpread(_objectSpread({}, item), {}, {
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
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
136
140
  });
137
141
  });
138
142
  }
@@ -163,10 +167,10 @@ function synthesizeProductResourceFromBooking(booking) {
163
167
  });
164
168
  if (relationIdsByForm.size === 0) return undefined;
165
169
  return {
166
- resources: Array.from(relationIdsByForm.entries()).map(function (_ref7) {
167
- var _ref8 = _slicedToArray(_ref7, 2),
168
- formId = _ref8[0],
169
- relationIds = _ref8[1];
170
+ resources: Array.from(relationIdsByForm.entries()).map(function (_ref8) {
171
+ var _ref9 = _slicedToArray(_ref8, 2),
172
+ formId = _ref9[0],
173
+ relationIds = _ref9[1];
170
174
  return {
171
175
  id: formId,
172
176
  status: 1,
@@ -186,7 +190,7 @@ function synthesizeProductResourceFromBooking(booking) {
186
190
  * 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
187
191
  */
188
192
  export function buildCacheItemFromOrderLine(input) {
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;
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;
190
194
  var product = input.product,
191
195
  booking = input.booking,
192
196
  sourceProduct = input.sourceProduct;
@@ -202,6 +206,7 @@ export function buildCacheItemFromOrderLine(input) {
202
206
  var capacity = resolveCapacityFromBooking(booking);
203
207
  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;
204
208
  var productTitle = resolveProductTitle(product, booking, sourceProduct);
209
+ var productCover = resolveProductCover(product, booking, sourceProduct);
205
210
  var productOptionString = buildProductOptionStringFromOrderLine(product);
206
211
  var other = {
207
212
  product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
@@ -219,7 +224,8 @@ export function buildCacheItemFromOrderLine(input) {
219
224
  sub_type: booking.sub_type,
220
225
  quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
221
226
  product_name: productTitle,
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 : '',
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 : '',
223
229
  price: mainProductPrice,
224
230
  total: selling,
225
231
  origin_total: original,
@@ -254,7 +260,7 @@ export function buildCacheItemFromOrderLine(input) {
254
260
  var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
255
261
  id: resolvedId,
256
262
  product_id: resolvedId,
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,
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,
258
264
  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),
259
265
  price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
260
266
  selling_price: product.selling_price,
@@ -266,7 +272,7 @@ export function buildCacheItemFromOrderLine(input) {
266
272
  new: 0,
267
273
  autoClose: false,
268
274
  order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
269
- booking_id: (_ref11 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref11 !== void 0 ? _ref11 : 0
275
+ booking_id: (_ref12 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref12 !== void 0 ? _ref12 : 0
270
276
  });
271
277
  if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
272
278
  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, _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, _ref7, _cover, _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,6 +132,7 @@ 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 : '',
135
136
  price: (_price3 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price3 !== void 0 ? _price3 : sourcePrice,
136
137
  selling_price: product.selling_price,
137
138
  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?: any[];
51
+ children?: BookingResourceInput[];
52
52
  }
53
53
  /** custom / package 人数维度快照,与 info2 `_extend.capacity` / `metadata.capacity` 对齐。 */
54
54
  export interface BookingCapacityMetadataItem {
@@ -76,6 +76,33 @@ 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
+
79
106
  /**
80
107
  * cacheItem._extend.resource 形如 `{ [form_id]: [{ relation_id, form_id, like_status, metadata, children }] }`。
81
108
  * 这里扁平化为符合协议的 resources[] 数组;id=0 的「无资源」占位行**保留**(与 info2 业务等价;协议 `relation_id=0` 合法)。
@@ -101,7 +128,11 @@ function flattenResources(cacheItem) {
101
128
  // 协议允许 metadata 自由透传;为了与 info2 行为等价,把 form_name / resource_name / combined_resource 一并保留。
102
129
  item.metadata = _objectSpread({}, r.metadata);
103
130
  }
104
- if ((r === null || r === void 0 ? void 0 : r.children) !== undefined) item.children = r.children;
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
+ }
105
136
  result.push(item);
106
137
  });
107
138
  });
@@ -1,6 +1,6 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { Discount, DiscountModuleAPI, DiscountWithReason } from './types';
3
+ import { Discount, DiscountModuleAPI, DiscountWithReason, DiscountPrepareConfigResult } from './types';
4
4
  export declare class DiscountModule extends BaseModule implements Module, DiscountModuleAPI {
5
5
  protected defaultName: string;
6
6
  protected defaultVersion: string;
@@ -16,15 +16,18 @@ 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;
19
20
  loadPrepareConfig(params: {
20
21
  action?: 'create' | 'edit';
21
22
  with_good_pass: 0 | 1;
22
23
  with_discount_card: 0 | 1;
23
24
  customer_id: number;
24
25
  with_wallet_pass_holder: 0 | 1;
26
+ with_available_wallet_flag?: 0 | 1;
27
+ with_available_wallet_pass_flag?: 0 | 1;
25
28
  request_timezone: string;
26
29
  order_id?: number | string;
27
- }): Promise<Discount[]>;
30
+ }): Promise<DiscountPrepareConfigResult>;
28
31
  batchSearch(code: string, options?: {
29
32
  customerId?: number;
30
33
  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; }
4
2
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
3
  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."); }
6
4
  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); }
7
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
9
7
  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,12 +151,22 @@ 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
+ }
154
164
  }, {
155
165
  key: "loadPrepareConfig",
156
166
  value: function () {
157
167
  var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
158
- var _prepareConfig$data, _prepareConfig$data2;
159
- var prepareConfig, rawDiscountList, goodPassList;
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;
160
170
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
161
171
  while (1) switch (_context4.prev = _context4.next) {
162
172
  case 0:
@@ -164,13 +174,26 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
164
174
  params.order_id = undefined;
165
175
  }
166
176
  _context4.next = 3;
167
- return this.request.post("/order/prepare/config", params);
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
+ }));
168
181
  case 3:
169
182
  prepareConfig = _context4.sent;
170
183
  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
+ }))));
171
191
  goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
172
- return _context4.abrupt("return", goodPassList);
173
- case 7:
192
+ return _context4.abrupt("return", {
193
+ discountList: goodPassList,
194
+ availableWalletIds: availableWalletIds
195
+ });
196
+ case 10:
174
197
  case "end":
175
198
  return _context4.stop();
176
199
  }
@@ -68,6 +68,10 @@ 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
+ }
71
75
  interface ExtensionData {
72
76
  id: number;
73
77
  shop_id: number;
@@ -75,6 +75,8 @@ 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;
78
80
  private ensureEditDiscountConfigForProductChange;
79
81
  scanCode(code: string, customerId?: number): Promise<{
80
82
  isAvailable: boolean;
@@ -84,7 +86,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
84
86
  unavailableReasonKey?: string | null;
85
87
  scannedDiscountList?: Discount[];
86
88
  }>;
87
- applyDiscount(): void;
89
+ applyDiscount(options?: {
90
+ reapplyBookingDiscountProductUids?: string[];
91
+ }): void;
88
92
  /**
89
93
  * 注入促销评估器。
90
94
  *
@@ -152,6 +156,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
152
156
  private extractOrderIdFromSubmitResult;
153
157
  private calculatePaymentEffectiveAmount;
154
158
  private calculatePaymentTotal;
159
+ private calculateOrderPaidPaymentTotal;
155
160
  private getDepositAmount;
156
161
  private normalizeDepositAmount;
157
162
  private getLastOrderDepositSnapshot;
@@ -180,6 +185,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
180
185
  private calculatePaidPaymentSummary;
181
186
  private calculatePaymentServiceFee;
182
187
  private calculatePaymentGapAmount;
188
+ private calculatePaymentOrderAmount;
183
189
  private calculatePaymentRoundingAmount;
184
190
  private formatSummaryMetadataMoney;
185
191
  private syncSummaryProductMetadata;
@@ -274,6 +280,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
274
280
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
275
281
  private buildTempOrderCustomer;
276
282
  private isCustomerBoundDiscount;
283
+ private shouldKeepCustomerBoundDiscountAfterCustomerChange;
277
284
  private productHasCustomerBoundDiscount;
278
285
  private shouldSkipDiscountCalculation;
279
286
  private clearCustomerBoundDiscounts;
@@ -461,7 +468,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
461
468
  generateIdempotencyToken(): string;
462
469
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
463
470
  createOrder(params: CommitOrderParams['query']): {
464
- type: "appointment_booking" | "virtual";
471
+ type: "virtual" | "appointment_booking";
465
472
  platform: string;
466
473
  sales_channel: string;
467
474
  order_sales_channel: string;
@@ -518,6 +525,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
518
525
  * this.normalizeHydratedBookingHolder({ metadata: { holder: { form_record: [1] } } });
519
526
  */
520
527
  private normalizeHydratedBookingHolder;
528
+ /**
529
+ * 匿名 booking 没有服务端行 ID 时,商品侧已有的 booking_uid 就是唯一可用的强引用。
530
+ * 在统一规范化生成 UUID 前先复用它;已落库 booking 仍按 schedule_event_id 派生稳定 UID。
531
+ */
532
+ private seedAnonymousBookingUidsFromProducts;
521
533
  private normalizeTempOrderForRuntime;
522
534
  private hydrateLinkedBookingIdentity;
523
535
  private pickHydratedDisplayText;