@pisell/pisellos 2.3.39 → 2.3.41

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 (226) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  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 +9 -0
  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 +5 -3
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/Discount/index.d.ts +0 -1
  16. package/dist/modules/Discount/index.js +11 -40
  17. package/dist/modules/Discount/types.d.ts +0 -1
  18. package/dist/modules/OpenData/index.d.ts +2 -0
  19. package/dist/modules/OpenData/index.js +10 -2
  20. package/dist/modules/Order/index.d.ts +29 -12
  21. package/dist/modules/Order/index.js +750 -509
  22. package/dist/modules/Order/payment-utils.d.ts +26 -0
  23. package/dist/modules/Order/payment-utils.js +225 -0
  24. package/dist/modules/Order/types.d.ts +33 -10
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  26. package/dist/modules/Order/utils.d.ts +0 -10
  27. package/dist/modules/Order/utils.js +13 -41
  28. package/dist/modules/Payment/index.d.ts +2 -0
  29. package/dist/modules/Payment/index.js +79 -50
  30. package/dist/modules/Payment/types.d.ts +99 -28
  31. package/dist/modules/Payment/types.js +20 -3
  32. package/dist/modules/Payment/walletpass.d.ts +25 -1
  33. package/dist/modules/Payment/walletpass.js +707 -157
  34. package/dist/modules/Product/types.d.ts +0 -1
  35. package/dist/modules/ProductList/index.js +14 -33
  36. package/dist/modules/Quotation/index.d.ts +1 -1
  37. package/dist/modules/Quotation/index.js +2 -2
  38. package/dist/modules/Rules/index.d.ts +1 -0
  39. package/dist/modules/Rules/index.js +89 -96
  40. package/dist/modules/SalesSummary/index.js +13 -12
  41. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  42. package/dist/modules/ScanOrderLogger/index.js +2 -15
  43. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  44. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  45. package/dist/modules/Schedule/index.d.ts +1 -3
  46. package/dist/modules/Schedule/index.js +16 -21
  47. package/dist/modules/Summary/utils.js +13 -38
  48. package/dist/modules/index.d.ts +0 -2
  49. package/dist/modules/index.js +1 -3
  50. package/dist/plugins/window.d.ts +0 -1
  51. package/dist/server/index.d.ts +16 -14
  52. package/dist/server/index.js +1925 -1143
  53. package/dist/server/modules/order/index.d.ts +54 -4
  54. package/dist/server/modules/order/index.js +1600 -700
  55. package/dist/server/modules/order/types.d.ts +11 -3
  56. package/dist/server/modules/order/types.js +1 -1
  57. package/dist/solution/BaseSales/index.d.ts +109 -20
  58. package/dist/solution/BaseSales/index.js +1800 -480
  59. package/dist/solution/BaseSales/types.d.ts +52 -0
  60. package/dist/solution/BaseSales/types.js +2 -1
  61. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  63. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  64. package/dist/solution/BookingByStep/index.d.ts +2 -17
  65. package/dist/solution/BookingByStep/index.js +215 -294
  66. package/dist/solution/BookingByStep/types.d.ts +1 -2
  67. package/dist/solution/BookingByStep/types.js +1 -3
  68. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  69. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  70. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  71. package/dist/solution/BookingTicket/index.d.ts +7 -3
  72. package/dist/solution/BookingTicket/index.js +132 -49
  73. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  75. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  76. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  77. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  78. package/dist/solution/Sales/index.d.ts +1 -0
  79. package/dist/solution/Sales/index.js +10 -2
  80. package/dist/solution/ScanOrder/index.d.ts +14 -26
  81. package/dist/solution/ScanOrder/index.js +756 -1148
  82. package/dist/solution/ScanOrder/types.d.ts +1 -21
  83. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  84. package/dist/solution/ScanOrder/utils.js +25 -66
  85. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  86. package/dist/solution/ShopDiscount/index.js +87 -125
  87. package/dist/solution/VenueBooking/index.d.ts +11 -39
  88. package/dist/solution/VenueBooking/index.js +860 -1176
  89. package/dist/solution/VenueBooking/types.d.ts +0 -3
  90. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  93. package/dist/solution/index.d.ts +0 -1
  94. package/dist/solution/index.js +1 -2
  95. package/dist/types/index.d.ts +1 -1
  96. package/dist/utils/payment-number.d.ts +9 -0
  97. package/dist/utils/payment-number.js +69 -0
  98. package/lib/core/index.d.ts +2 -0
  99. package/lib/core/index.js +4 -0
  100. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  101. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  102. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  103. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  104. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  105. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  106. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  107. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  108. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  109. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  110. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  111. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  112. package/lib/modules/Discount/index.d.ts +0 -1
  113. package/lib/modules/Discount/index.js +0 -9
  114. package/lib/modules/Discount/types.d.ts +0 -1
  115. package/lib/modules/OpenData/index.d.ts +2 -0
  116. package/lib/modules/OpenData/index.js +6 -1
  117. package/lib/modules/Order/index.d.ts +29 -12
  118. package/lib/modules/Order/index.js +196 -86
  119. package/lib/modules/Order/payment-utils.d.ts +26 -0
  120. package/lib/modules/Order/payment-utils.js +224 -0
  121. package/lib/modules/Order/types.d.ts +33 -10
  122. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  123. package/lib/modules/Order/utils.d.ts +0 -10
  124. package/lib/modules/Order/utils.js +16 -40
  125. package/lib/modules/Payment/index.d.ts +2 -0
  126. package/lib/modules/Payment/index.js +34 -13
  127. package/lib/modules/Payment/types.d.ts +99 -28
  128. package/lib/modules/Payment/types.js +4 -3
  129. package/lib/modules/Payment/walletpass.d.ts +25 -1
  130. package/lib/modules/Payment/walletpass.js +470 -21
  131. package/lib/modules/Product/types.d.ts +0 -1
  132. package/lib/modules/ProductList/index.js +31 -40
  133. package/lib/modules/Quotation/index.d.ts +1 -1
  134. package/lib/modules/Quotation/index.js +2 -2
  135. package/lib/modules/Rules/index.d.ts +1 -0
  136. package/lib/modules/Rules/index.js +47 -40
  137. package/lib/modules/SalesSummary/index.js +7 -6
  138. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  139. package/lib/modules/ScanOrderLogger/index.js +1 -13
  140. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  141. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  142. package/lib/modules/Schedule/index.d.ts +1 -3
  143. package/lib/modules/Schedule/index.js +8 -10
  144. package/lib/modules/Summary/utils.js +1 -21
  145. package/lib/modules/index.d.ts +0 -2
  146. package/lib/modules/index.js +1 -5
  147. package/lib/plugins/window.d.ts +0 -1
  148. package/lib/server/index.d.ts +16 -14
  149. package/lib/server/index.js +675 -83
  150. package/lib/server/modules/order/index.d.ts +54 -4
  151. package/lib/server/modules/order/index.js +679 -66
  152. package/lib/server/modules/order/types.d.ts +11 -3
  153. package/lib/solution/BaseSales/index.d.ts +109 -20
  154. package/lib/solution/BaseSales/index.js +883 -70
  155. package/lib/solution/BaseSales/types.d.ts +52 -0
  156. package/lib/solution/BaseSales/types.js +2 -1
  157. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  158. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  159. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  160. package/lib/solution/BookingByStep/index.d.ts +2 -17
  161. package/lib/solution/BookingByStep/index.js +18 -60
  162. package/lib/solution/BookingByStep/types.d.ts +1 -2
  163. package/lib/solution/BookingByStep/types.js +0 -5
  164. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  165. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  166. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  167. package/lib/solution/BookingTicket/index.d.ts +7 -3
  168. package/lib/solution/BookingTicket/index.js +62 -9
  169. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  170. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  171. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  172. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  173. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  174. package/lib/solution/Sales/index.d.ts +1 -0
  175. package/lib/solution/Sales/index.js +5 -3
  176. package/lib/solution/ScanOrder/index.d.ts +14 -26
  177. package/lib/solution/ScanOrder/index.js +190 -449
  178. package/lib/solution/ScanOrder/types.d.ts +1 -21
  179. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  180. package/lib/solution/ScanOrder/utils.js +0 -31
  181. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  182. package/lib/solution/ShopDiscount/index.js +0 -14
  183. package/lib/solution/VenueBooking/index.d.ts +11 -39
  184. package/lib/solution/VenueBooking/index.js +123 -328
  185. package/lib/solution/VenueBooking/types.d.ts +0 -3
  186. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  187. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  188. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  189. package/lib/solution/index.d.ts +0 -1
  190. package/lib/solution/index.js +1 -3
  191. package/lib/types/index.d.ts +1 -1
  192. package/lib/utils/payment-number.d.ts +9 -0
  193. package/lib/utils/payment-number.js +64 -0
  194. package/package.json +1 -1
  195. package/dist/modules/Holder/index.d.ts +0 -48
  196. package/dist/modules/Holder/index.js +0 -640
  197. package/dist/modules/Holder/types.d.ts +0 -123
  198. package/dist/modules/Holder/types.js +0 -1
  199. package/dist/modules/Holder/utils.d.ts +0 -13
  200. package/dist/modules/Holder/utils.js +0 -34
  201. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  202. package/dist/modules/ResourcePlanner/index.js +0 -181
  203. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  204. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  205. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  206. package/dist/modules/ResourcePlanner/types.js +0 -1
  207. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  208. package/dist/solution/UnifiedBookingSales/index.js +0 -1871
  209. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  210. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  211. package/lib/modules/Holder/index.d.ts +0 -48
  212. package/lib/modules/Holder/index.js +0 -402
  213. package/lib/modules/Holder/types.d.ts +0 -123
  214. package/lib/modules/Holder/types.js +0 -17
  215. package/lib/modules/Holder/utils.d.ts +0 -13
  216. package/lib/modules/Holder/utils.js +0 -71
  217. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  218. package/lib/modules/ResourcePlanner/index.js +0 -148
  219. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  220. package/lib/modules/ResourcePlanner/planner.js +0 -933
  221. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  222. package/lib/modules/ResourcePlanner/types.js +0 -17
  223. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  224. package/lib/solution/UnifiedBookingSales/index.js +0 -1076
  225. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  226. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -35,7 +35,6 @@ export interface ScanOrderOrderProductIdentity {
35
35
  /** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
36
36
  product_sku?: ScanOrderProductSku;
37
37
  product_bundle?: any[];
38
- shop_id?: number | string;
39
38
  }
40
39
  export interface ScanOrderProductSku {
41
40
  option: any[];
@@ -208,7 +207,7 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
208
207
  }>;
209
208
  products: ScanOrderSubmitProduct[];
210
209
  }
211
- export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'multiple_orders' | 'additional_order_with_code' | 'additional_order';
210
+ export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
212
211
  export interface ScanOrderTableFormRecord {
213
212
  policy?: string | null;
214
213
  partyroom_booking?: string | null;
@@ -251,10 +250,6 @@ export interface ScanOrderResourceOccupyDetail {
251
250
  form_id?: number | string | null;
252
251
  order_id?: number | string | null;
253
252
  last_order_id?: number | string | null;
254
- order_list?: Array<{
255
- id?: number | string | null;
256
- [key: string]: any;
257
- }> | null;
258
253
  resource_capacity?: ScanOrderResourceCapacity[] | null;
259
254
  form_record?: ScanOrderTableFormRecord | null;
260
255
  [key: string]: any;
@@ -268,21 +263,6 @@ export interface ScanOrderResourceOccupyDetailApiResponse {
268
263
  } | null;
269
264
  }
270
265
  export type ScanOrderResourceSelectType = 'single' | 'multiple' | 'capacity';
271
- export interface ScanOrderReservationResourceSelectInfo {
272
- resourceSelectType?: ScanOrderResourceSelectType;
273
- isSingleReservation: boolean;
274
- isMultipleReservation: boolean;
275
- isCapacityReservation: boolean;
276
- }
277
- export interface ScanOrderAllowAddItemsInfo {
278
- enabled: boolean;
279
- }
280
- export type ScanOrderSyncAdditionalOrderReason = 'missing_resource_id' | 'no_order' | 'multiple_orders' | 'add_items_disabled' | 'invalid_order_id';
281
- export interface ScanOrderSyncAdditionalOrderResult {
282
- matched: boolean;
283
- order_id?: string;
284
- reason?: ScanOrderSyncAdditionalOrderReason;
285
- }
286
266
  export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
287
267
  relationId?: string;
288
268
  tableFormId?: string;
@@ -2,7 +2,6 @@ import { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderResource
2
2
  import type { CartItemSummary, ItemRuleBusinessData, PaxInfo, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
3
3
  import type { StrategyConfig } from '../../model/strategy/type';
4
4
  import type { ProductData } from '../../modules/Product/types';
5
- import type { OrderSubmitProduct } from '../../modules/Order/types';
6
5
  /**
7
6
  * 构建金额全为 0 的空 summary。
8
7
  * 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
@@ -43,8 +42,6 @@ export declare function toNonNegativeNumber(value: unknown): number;
43
42
  export declare function toNonNegativeInt(value: unknown): number;
44
43
  export declare function toPriceString(value: unknown, fallback?: string): string;
45
44
  export declare function buildProductKey(productId: number, productVariantId: number): string;
46
- /** 加餐接口只提交本次新增商品,过滤掉首单预约占位规则行。 */
47
- export declare function filterProductsForScanOrderMore<T extends OrderSubmitProduct>(products?: T[]): T[];
48
45
  export declare function getTopLevelProductId(product: Record<string, any>): number | null;
49
46
  export declare function getTopLevelVariantId(product: Record<string, any>): number | null;
50
47
  export declare function buildQuantityLimitIndex(limits: QuantityLimitResult[]): {
@@ -137,11 +134,6 @@ export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderPro
137
134
  * 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
138
135
  */
139
136
  export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
140
- /**
141
- * 找到第一个归属指定桌台的预约规则商品。
142
- * 归属判断基于商品资源中的 default_resource / optional_resource。
143
- */
144
- export declare function findReservationRuleProductByResourceId(products: ProductData[], resourceId: string | number | null | undefined): ProductData | undefined;
145
137
  /**
146
138
  * 返回列表中第一个带有效 duration.value(分钟)的商品时长。
147
139
  */
@@ -154,15 +154,6 @@ export function toPriceString(value) {
154
154
  export function buildProductKey(productId, productVariantId) {
155
155
  return "".concat(productId, "_").concat(productVariantId);
156
156
  }
157
-
158
- /** 加餐接口只提交本次新增商品,过滤掉首单预约占位规则行。 */
159
- export function filterProductsForScanOrderMore() {
160
- var products = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
161
- return products.filter(function (product) {
162
- var _product$metadata;
163
- return ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.is_rule) !== true;
164
- });
165
- }
166
157
  export function getTopLevelProductId(product) {
167
158
  var _product$product_id;
168
159
  var rawProductId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id;
@@ -491,11 +482,11 @@ export function getProductIdentityIndex(products, identity) {
491
482
  * - 因此多次 normalize 不会重复叠加 option/bundle。
492
483
  */
493
484
  export function normalizeOrderProduct(product) {
494
- var _product$metadata2, _metadata$origin, _product$product_sku, _metadata$origin2, _variantList$find, _product$is_charge_ta;
485
+ var _product$metadata, _metadata$origin, _product$product_sku, _metadata$origin2, _variantList$find, _product$is_charge_ta;
495
486
  var metadata = _objectSpread({}, product.metadata || {});
496
487
  // 不透明 identity 契约:每条订单行必须带 identity_key。
497
488
  // 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
498
- var resolvedIdentityKey = (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
489
+ var resolvedIdentityKey = (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
499
490
  metadata.unique_identification_number = resolvedIdentityKey;
500
491
  var priceOverride = metadata.price_override;
501
492
  var originOtherBundle = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin._extend) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin.other) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.bundle;
@@ -704,55 +695,23 @@ export function collectLinkProductIdsFromReservationRules(rules) {
704
695
  }
705
696
 
706
697
  /**
707
- * 找到第一个归属指定桌台的预约规则商品。
708
- * 归属判断基于商品资源中的 default_resource / optional_resource。
698
+ * 返回列表中第一个带有效 duration.value(分钟)的商品时长。
709
699
  */
710
- export function findReservationRuleProductByResourceId(products, resourceId) {
711
- var numericResourceId = Number(resourceId);
712
- if (!Number.isFinite(numericResourceId) || numericResourceId <= 0) return undefined;
700
+ export function pickFirstDurationMinutesFromProducts(products) {
713
701
  var _iterator7 = _createForOfIteratorHelper(products),
714
702
  _step7;
715
703
  try {
716
704
  for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
717
- var _product$product_reso;
718
- var product = _step7.value;
719
- var resources = product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
720
- if (!Array.isArray(resources)) continue;
721
- var hasMatchedResource = resources.some(function (resource) {
722
- var defaultResources = Array.isArray(resource === null || resource === void 0 ? void 0 : resource.default_resource) ? resource.default_resource : [];
723
- var optionalResources = Array.isArray(resource === null || resource === void 0 ? void 0 : resource.optional_resource) ? resource.optional_resource : [];
724
- return [].concat(_toConsumableArray(defaultResources), _toConsumableArray(optionalResources)).some(function (id) {
725
- return Number(id) === numericResourceId;
726
- });
727
- });
728
- if (hasMatchedResource) return product;
729
- }
730
- } catch (err) {
731
- _iterator7.e(err);
732
- } finally {
733
- _iterator7.f();
734
- }
735
- return undefined;
736
- }
737
-
738
- /**
739
- * 返回列表中第一个带有效 duration.value(分钟)的商品时长。
740
- */
741
- export function pickFirstDurationMinutesFromProducts(products) {
742
- var _iterator8 = _createForOfIteratorHelper(products),
743
- _step8;
744
- try {
745
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
746
705
  var _product$duration;
747
- var product = _step8.value;
706
+ var product = _step7.value;
748
707
  var value = product === null || product === void 0 || (_product$duration = product.duration) === null || _product$duration === void 0 ? void 0 : _product$duration.value;
749
708
  var n = Number(value);
750
709
  if (Number.isFinite(n) && n > 0) return Math.floor(n);
751
710
  }
752
711
  } catch (err) {
753
- _iterator8.e(err);
712
+ _iterator7.e(err);
754
713
  } finally {
755
- _iterator8.f();
714
+ _iterator7.f();
756
715
  }
757
716
  return undefined;
758
717
  }
@@ -782,11 +741,11 @@ export function computeResourceIsFull(params) {
782
741
  if (!Number.isFinite(totalCapacity) || totalCapacity <= 0) return false;
783
742
  var now = dayjs();
784
743
  var occupied = 0;
785
- var _iterator9 = _createForOfIteratorHelper(capacityList || []),
786
- _step9;
744
+ var _iterator8 = _createForOfIteratorHelper(capacityList || []),
745
+ _step8;
787
746
  try {
788
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
789
- var slot = _step9.value;
747
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
748
+ var slot = _step8.value;
790
749
  var start = dayjs(slot === null || slot === void 0 ? void 0 : slot.start_at);
791
750
  var end = dayjs(slot === null || slot === void 0 ? void 0 : slot.end_at);
792
751
  if (!start.isValid() || !end.isValid()) continue;
@@ -796,9 +755,9 @@ export function computeResourceIsFull(params) {
796
755
  }
797
756
  }
798
757
  } catch (err) {
799
- _iterator9.e(err);
758
+ _iterator8.e(err);
800
759
  } finally {
801
- _iterator9.f();
760
+ _iterator8.f();
802
761
  }
803
762
  return occupied >= totalCapacity;
804
763
  }
@@ -808,11 +767,11 @@ export function computeResourceIsFull(params) {
808
767
  * 仅返回有限数字字段;若均无法解析则返回 `undefined`。
809
768
  */
810
769
  export function pickFirstCustomCapacityPaxBounds(products) {
811
- var _iterator10 = _createForOfIteratorHelper(products),
812
- _step10;
770
+ var _iterator9 = _createForOfIteratorHelper(products),
771
+ _step9;
813
772
  try {
814
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
815
- var p = _step10.value;
773
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
774
+ var p = _step9.value;
816
775
  var cap = p === null || p === void 0 ? void 0 : p.capacity;
817
776
  if (!cap || cap.type !== 'custom') continue;
818
777
  if (!Array.isArray(cap.custom) || cap.custom.length === 0) continue;
@@ -831,9 +790,9 @@ export function pickFirstCustomCapacityPaxBounds(products) {
831
790
  if (out.min !== undefined || out.max !== undefined) return out;
832
791
  }
833
792
  } catch (err) {
834
- _iterator10.e(err);
793
+ _iterator9.e(err);
835
794
  } finally {
836
- _iterator10.f();
795
+ _iterator9.f();
837
796
  }
838
797
  return undefined;
839
798
  }
@@ -843,11 +802,11 @@ export function pickFirstCustomCapacityPaxBounds(products) {
843
802
  * 无匹配时返回 `undefined`,调用方应回退为 `0`。
844
803
  */
845
804
  export function pickFirstCustomCapacityDimensionId(products) {
846
- var _iterator11 = _createForOfIteratorHelper(products),
847
- _step11;
805
+ var _iterator10 = _createForOfIteratorHelper(products),
806
+ _step10;
848
807
  try {
849
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
850
- var p = _step11.value;
808
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
809
+ var p = _step10.value;
851
810
  var cap = p === null || p === void 0 ? void 0 : p.capacity;
852
811
  if (!cap || cap.type !== 'custom') continue;
853
812
  if (!Array.isArray(cap.custom) || cap.custom.length === 0) continue;
@@ -863,9 +822,9 @@ export function pickFirstCustomCapacityDimensionId(products) {
863
822
  }
864
823
  }
865
824
  } catch (err) {
866
- _iterator11.e(err);
825
+ _iterator10.e(err);
867
826
  } finally {
868
- _iterator11.f();
827
+ _iterator10.f();
869
828
  }
870
829
  return undefined;
871
830
  }
@@ -40,7 +40,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
40
40
  discountList: Discount[];
41
41
  };
42
42
  setProductList(productList: Record<string, any>[]): void;
43
- batchSearchByProductIds(productIds: number[]): Promise<Discount[]>;
44
43
  scanCode(code: string, customerId?: number): Promise<{
45
44
  isAvailable: boolean;
46
45
  productList: Record<string, any>[];