@pisell/pisellos 2.2.62 → 2.2.64

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 (53) hide show
  1. package/dist/model/strategy/adapter/index.d.ts +0 -2
  2. package/dist/model/strategy/adapter/index.js +1 -2
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +1 -4
  4. package/dist/model/strategy/index.d.ts +93 -2
  5. package/dist/model/strategy/index.js +549 -6
  6. package/dist/modules/BaseModule.d.ts +0 -4
  7. package/dist/modules/BaseModule.js +0 -5
  8. package/dist/modules/Product/index.d.ts +1 -1
  9. package/dist/modules/Rules/index.d.ts +0 -1
  10. package/dist/modules/Rules/index.js +16 -28
  11. package/dist/solution/BookingByStep/index.d.ts +1 -1
  12. package/dist/solution/BookingTicket/index.d.ts +1 -1
  13. package/dist/solution/Checkout/index.js +22 -12
  14. package/dist/solution/ShopDiscount/index.js +1 -0
  15. package/lib/model/strategy/adapter/index.d.ts +0 -2
  16. package/lib/model/strategy/adapter/index.js +0 -6
  17. package/lib/model/strategy/adapter/walletPass/evaluator.js +1 -2
  18. package/lib/model/strategy/index.d.ts +93 -2
  19. package/lib/model/strategy/index.js +381 -6
  20. package/lib/modules/BaseModule.d.ts +0 -4
  21. package/lib/modules/BaseModule.js +0 -3
  22. package/lib/modules/Product/index.d.ts +1 -1
  23. package/lib/modules/Rules/index.d.ts +0 -1
  24. package/lib/modules/Rules/index.js +17 -23
  25. package/lib/solution/BookingByStep/index.d.ts +1 -1
  26. package/lib/solution/BookingTicket/index.d.ts +1 -1
  27. package/lib/solution/Checkout/index.js +55 -48
  28. package/lib/solution/ShopDiscount/index.js +2 -0
  29. package/package.json +1 -1
  30. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -66
  31. package/dist/model/strategy/adapter/promotion/adapter.js +0 -271
  32. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -213
  33. package/dist/model/strategy/adapter/promotion/evaluator.js +0 -1206
  34. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -138
  35. package/dist/model/strategy/adapter/promotion/examples.js +0 -166
  36. package/dist/model/strategy/adapter/promotion/index.d.ts +0 -4
  37. package/dist/model/strategy/adapter/promotion/index.js +0 -0
  38. package/dist/model/strategy/adapter/promotion/type.d.ts +0 -447
  39. package/dist/model/strategy/adapter/promotion/type.js +0 -209
  40. package/dist/model/strategy/engine.d.ts +0 -106
  41. package/dist/model/strategy/engine.js +0 -611
  42. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -66
  43. package/lib/model/strategy/adapter/promotion/adapter.js +0 -217
  44. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -213
  45. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -844
  46. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -138
  47. package/lib/model/strategy/adapter/promotion/examples.js +0 -192
  48. package/lib/model/strategy/adapter/promotion/index.d.ts +0 -4
  49. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  50. package/lib/model/strategy/adapter/promotion/type.d.ts +0 -447
  51. package/lib/model/strategy/adapter/promotion/type.js +0 -51
  52. package/lib/model/strategy/engine.d.ts +0 -106
  53. package/lib/model/strategy/engine.js +0 -450
@@ -20,19 +20,394 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/model/strategy/index.ts
21
21
  var strategy_exports = {};
22
22
  __export(strategy_exports, {
23
- StrategyEngine: () => import_engine.StrategyEngine,
24
- createStrategyEngine: () => import_engine.createStrategyEngine,
25
- evaluate: () => import_engine.evaluate
23
+ StrategyEngine: () => StrategyEngine,
24
+ createStrategyEngine: () => createStrategyEngine,
25
+ evaluate: () => evaluate
26
26
  });
27
27
  module.exports = __toCommonJS(strategy_exports);
28
- var import_engine = require("./engine");
29
- __reExport(strategy_exports, require("./type"), module.exports);
28
+ var import_type = require("./type");
30
29
  __reExport(strategy_exports, require("./adapter"), module.exports);
30
+ var StrategyEngine = class {
31
+ constructor(options = {}) {
32
+ this.options = {
33
+ debug: options.debug ?? false,
34
+ enableTrace: options.enableTrace ?? false,
35
+ operatorHandlers: options.operatorHandlers ?? {},
36
+ errorHandler: options.errorHandler ?? ((error) => console.error(error))
37
+ };
38
+ this.operatorHandlers = new Map(
39
+ Object.entries(this.options.operatorHandlers)
40
+ );
41
+ this.initializeBuiltInOperators();
42
+ }
43
+ /**
44
+ * 评估策略
45
+ */
46
+ evaluate(config, context) {
47
+ var _a;
48
+ const startTime = Date.now();
49
+ const trace = {
50
+ steps: [],
51
+ duration: 0,
52
+ errors: []
53
+ };
54
+ try {
55
+ this.validateConfig(config);
56
+ if (this.options.enableTrace) {
57
+ trace.steps.push({
58
+ step: "validate_config",
59
+ status: "success",
60
+ duration: Date.now() - startTime
61
+ });
62
+ }
63
+ const evaluateStart = Date.now();
64
+ const evaluationResult = this.evaluateConditionGroup(
65
+ config.conditions,
66
+ context
67
+ );
68
+ if (this.options.enableTrace) {
69
+ trace.steps.push({
70
+ step: "evaluate_conditions",
71
+ status: "success",
72
+ duration: Date.now() - evaluateStart,
73
+ details: {
74
+ satisfied: evaluationResult.satisfied,
75
+ collectedActionIds: evaluationResult.actionIds
76
+ }
77
+ });
78
+ }
79
+ const actionStart = Date.now();
80
+ const matchedActions = this.getActionsByIds(
81
+ evaluationResult.actionIds,
82
+ config.actions
83
+ );
84
+ if (this.options.enableTrace) {
85
+ trace.steps.push({
86
+ step: "get_actions",
87
+ status: "success",
88
+ duration: Date.now() - actionStart,
89
+ details: { matchedCount: matchedActions.length }
90
+ });
91
+ }
92
+ const sortStart = Date.now();
93
+ const sortedActions = this.sortActionsByPriority(matchedActions);
94
+ if (this.options.enableTrace) {
95
+ trace.steps.push({
96
+ step: "sort_actions",
97
+ status: "success",
98
+ duration: Date.now() - sortStart
99
+ });
100
+ }
101
+ const applicable = evaluationResult.satisfied;
102
+ const result = {
103
+ success: true,
104
+ applicable,
105
+ code: applicable ? import_type.SUCCESS_CODES.SUCCESS : import_type.NOT_APPLICABLE_CODES.CONDITION_NOT_MET,
106
+ message: applicable ? "Strategy is applicable" : "Conditions not met",
107
+ matched: {
108
+ conditions: applicable,
109
+ actionIds: evaluationResult.actionIds,
110
+ details: {}
111
+ },
112
+ matchedActions: sortedActions,
113
+ outputs: {},
114
+ config
115
+ };
116
+ trace.duration = Date.now() - startTime;
117
+ if (this.options.enableTrace) {
118
+ result.trace = trace;
119
+ }
120
+ return result;
121
+ } catch (error) {
122
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
123
+ if (this.options.enableTrace) {
124
+ (_a = trace.errors) == null ? void 0 : _a.push({
125
+ step: "evaluation",
126
+ error: errorMessage,
127
+ timestamp: Date.now()
128
+ });
129
+ trace.duration = Date.now() - startTime;
130
+ }
131
+ this.options.errorHandler(error, context);
132
+ return {
133
+ success: false,
134
+ applicable: false,
135
+ code: import_type.ERROR_CODES.EVALUATION_ERROR,
136
+ message: errorMessage,
137
+ matched: {
138
+ conditions: false,
139
+ actionIds: [],
140
+ details: {}
141
+ },
142
+ matchedActions: [],
143
+ outputs: {},
144
+ trace: this.options.enableTrace ? trace : void 0,
145
+ config
146
+ };
147
+ }
148
+ }
149
+ /**
150
+ * 递归评估条件组
151
+ *
152
+ * @param group 条件组
153
+ * @param context 运行时上下文
154
+ * @returns 评估结果对象,包含条件是否满足和收集到的 actionIds
155
+ */
156
+ evaluateConditionGroup(group, context) {
157
+ const collectedActionIds = [];
158
+ const isCurrentLayerSatisfied = this.evaluateGroupLogic(group, context);
159
+ if (isCurrentLayerSatisfied) {
160
+ collectedActionIds.push(...group.actionIds);
161
+ for (const rule of group.rules) {
162
+ if (this.isConditionGroup(rule)) {
163
+ const nestedResult = this.evaluateConditionGroup(rule, context);
164
+ collectedActionIds.push(...nestedResult.actionIds);
165
+ }
166
+ }
167
+ }
168
+ return {
169
+ satisfied: isCurrentLayerSatisfied,
170
+ actionIds: collectedActionIds
171
+ };
172
+ }
173
+ /**
174
+ * 评估条件组的逻辑运算
175
+ */
176
+ evaluateGroupLogic(group, context) {
177
+ const { operator, rules } = group;
178
+ switch (operator) {
179
+ case "and":
180
+ return rules.every((rule) => this.evaluateRule(rule, context));
181
+ case "or":
182
+ return rules.some((rule) => this.evaluateRule(rule, context));
183
+ case "not":
184
+ if (rules.length === 0)
185
+ return false;
186
+ return !this.evaluateRule(rules[0], context);
187
+ default:
188
+ throw new Error(`Unknown operator: ${operator}`);
189
+ }
190
+ }
191
+ /**
192
+ * 评估单个规则
193
+ */
194
+ evaluateRule(rule, context) {
195
+ if (this.isConditionGroup(rule)) {
196
+ return this.evaluateGroupLogic(rule, context);
197
+ }
198
+ const conditionRule = rule;
199
+ if (conditionRule.type === "code" && conditionRule.code) {
200
+ return this.evaluateCodeCondition(conditionRule.code, context);
201
+ }
202
+ return this.evaluateOperatorCondition(conditionRule, context);
203
+ }
204
+ /**
205
+ * 评估代码模式条件
206
+ */
207
+ evaluateCodeCondition(code, context) {
208
+ try {
209
+ const { entities, attributes, metadata } = context;
210
+ const evalFunc = new Function(
211
+ "entities",
212
+ "attributes",
213
+ "metadata",
214
+ `return (${code})`
215
+ );
216
+ const result = evalFunc(entities, attributes, metadata);
217
+ return Boolean(result);
218
+ } catch (error) {
219
+ if (this.options.debug) {
220
+ console.error("Code evaluation error:", error);
221
+ }
222
+ return false;
223
+ }
224
+ }
225
+ /**
226
+ * 评估运算符模式条件
227
+ */
228
+ evaluateOperatorCondition(rule, context) {
229
+ const { field, operator, value } = rule;
230
+ if (!field || !operator) {
231
+ return false;
232
+ }
233
+ const fieldValue = this.getFieldValue(field, context);
234
+ const handler = this.operatorHandlers.get(operator);
235
+ if (handler) {
236
+ return handler(fieldValue, value, rule);
237
+ }
238
+ return this.evaluateBuiltInOperator(fieldValue, operator, value);
239
+ }
240
+ /**
241
+ * 获取字段值
242
+ */
243
+ getFieldValue(field, context) {
244
+ const path = field.split(".");
245
+ let value = context.attributes;
246
+ for (const key of path) {
247
+ if (value && typeof value === "object" && key in value) {
248
+ value = value[key];
249
+ } else {
250
+ return void 0;
251
+ }
252
+ }
253
+ return value;
254
+ }
255
+ /**
256
+ * 评估内置运算符
257
+ */
258
+ evaluateBuiltInOperator(fieldValue, operator, compareValue) {
259
+ switch (operator) {
260
+ case "=":
261
+ case "==":
262
+ return fieldValue == compareValue;
263
+ case "!=":
264
+ return fieldValue != compareValue;
265
+ case ">":
266
+ return fieldValue > compareValue;
267
+ case ">=":
268
+ return fieldValue >= compareValue;
269
+ case "<":
270
+ return fieldValue < compareValue;
271
+ case "<=":
272
+ return fieldValue <= compareValue;
273
+ case "in":
274
+ return Array.isArray(compareValue) && compareValue.includes(fieldValue);
275
+ case "not_in":
276
+ return Array.isArray(compareValue) && !compareValue.includes(fieldValue);
277
+ case "contains":
278
+ if (Array.isArray(fieldValue)) {
279
+ return fieldValue.includes(compareValue);
280
+ }
281
+ if (typeof fieldValue === "string") {
282
+ return fieldValue.includes(compareValue);
283
+ }
284
+ return false;
285
+ case "not_contains":
286
+ if (Array.isArray(fieldValue)) {
287
+ return !fieldValue.includes(compareValue);
288
+ }
289
+ if (typeof fieldValue === "string") {
290
+ return !fieldValue.includes(compareValue);
291
+ }
292
+ return true;
293
+ case "starts_with":
294
+ return typeof fieldValue === "string" && fieldValue.startsWith(compareValue);
295
+ case "ends_with":
296
+ return typeof fieldValue === "string" && fieldValue.endsWith(compareValue);
297
+ case "regex":
298
+ return typeof fieldValue === "string" && new RegExp(compareValue).test(fieldValue);
299
+ case "between":
300
+ if (!Array.isArray(compareValue) || compareValue.length !== 2)
301
+ return false;
302
+ return fieldValue >= compareValue[0] && fieldValue <= compareValue[1];
303
+ case "is_null":
304
+ return fieldValue === null || fieldValue === void 0;
305
+ case "is_not_null":
306
+ return fieldValue !== null && fieldValue !== void 0;
307
+ case "is_empty":
308
+ if (Array.isArray(fieldValue))
309
+ return fieldValue.length === 0;
310
+ if (typeof fieldValue === "string")
311
+ return fieldValue.length === 0;
312
+ if (typeof fieldValue === "object")
313
+ return Object.keys(fieldValue).length === 0;
314
+ return !fieldValue;
315
+ case "is_not_empty":
316
+ if (Array.isArray(fieldValue))
317
+ return fieldValue.length > 0;
318
+ if (typeof fieldValue === "string")
319
+ return fieldValue.length > 0;
320
+ if (typeof fieldValue === "object")
321
+ return Object.keys(fieldValue).length > 0;
322
+ return Boolean(fieldValue);
323
+ default:
324
+ throw new Error(`Unsupported operator: ${operator}`);
325
+ }
326
+ }
327
+ /**
328
+ * 根据 actionIds 获取 ActionEffect 对象
329
+ */
330
+ getActionsByIds(actionIds, actions) {
331
+ const matchedActions = [];
332
+ const actionMap = new Map(actions.map((action) => [action.id, action]));
333
+ for (const id of actionIds) {
334
+ const action = actionMap.get(id);
335
+ if (action) {
336
+ matchedActions.push(action);
337
+ } else {
338
+ if (this.options.debug) {
339
+ console.warn(`Action with id "${id}" not found in actions array`);
340
+ }
341
+ }
342
+ }
343
+ return matchedActions;
344
+ }
345
+ /**
346
+ * 按 priority 排序(降序)
347
+ */
348
+ sortActionsByPriority(actions) {
349
+ return [...actions].sort((a, b) => {
350
+ const priorityA = a.priority ?? 0;
351
+ const priorityB = b.priority ?? 0;
352
+ return priorityB - priorityA;
353
+ });
354
+ }
355
+ /**
356
+ * 判断是否为条件组
357
+ */
358
+ isConditionGroup(rule) {
359
+ return "operator" in rule && "rules" in rule && Array.isArray(rule.rules);
360
+ }
361
+ /**
362
+ * 验证配置
363
+ */
364
+ validateConfig(config) {
365
+ if (!config) {
366
+ throw new Error("Strategy config is required");
367
+ }
368
+ if (!config.metadata || !config.metadata.id) {
369
+ throw new Error("Strategy metadata.id is required");
370
+ }
371
+ if (!config.conditions) {
372
+ throw new Error("Strategy conditions is required");
373
+ }
374
+ if (!Array.isArray(config.actions)) {
375
+ throw new Error("Strategy actions must be an array");
376
+ }
377
+ }
378
+ /**
379
+ * 初始化内置运算符处理器
380
+ */
381
+ initializeBuiltInOperators() {
382
+ }
383
+ /**
384
+ * 注册自定义运算符
385
+ */
386
+ registerOperator(operator, handler) {
387
+ this.operatorHandlers.set(operator, handler);
388
+ }
389
+ /**
390
+ * 获取调试信息
391
+ */
392
+ getDebugInfo() {
393
+ return {
394
+ debug: this.options.debug,
395
+ enableTrace: this.options.enableTrace,
396
+ registeredOperators: Array.from(this.operatorHandlers.keys())
397
+ };
398
+ }
399
+ };
400
+ function createStrategyEngine(options) {
401
+ return new StrategyEngine(options);
402
+ }
403
+ function evaluate(config, context) {
404
+ const engine = new StrategyEngine();
405
+ return engine.evaluate(config, context);
406
+ }
31
407
  // Annotate the CommonJS export names for ESM import in node:
32
408
  0 && (module.exports = {
33
409
  StrategyEngine,
34
410
  createStrategyEngine,
35
411
  evaluate,
36
- ...require("./type"),
37
412
  ...require("./adapter")
38
413
  });
@@ -17,8 +17,4 @@ export declare class BaseModule {
17
17
  effectsOn(eventType: string, callback: (payload: any) => void): () => void;
18
18
  effectsOff(eventType: string, callback: (payload: any) => void): void;
19
19
  effectsOnce(eventType: string, callback: (payload: any) => void): () => void;
20
- effectsEmit(eventType: string, payload: any): Promise<{
21
- status: boolean;
22
- data: any;
23
- }>;
24
20
  }
@@ -91,9 +91,6 @@ var BaseModule = class {
91
91
  effectsOnce(eventType, callback) {
92
92
  return this.core.effects.once(`${this.name}:${eventType}`, callback);
93
93
  }
94
- effectsEmit(eventType, payload) {
95
- return this.core.effects.emit(`${this.name}:${eventType}`, payload);
96
- }
97
94
  };
98
95
  // Annotate the CommonJS export names for ESM import in node:
99
96
  0 && (module.exports = {
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -30,7 +30,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
30
30
  discountList: Discount[];
31
31
  productList: any[];
32
32
  };
33
- filterDiscountListByType(discountList: Discount[], type: string): Discount[];
34
33
  calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
35
34
  discountList: Discount[];
36
35
  productList: any[];
@@ -149,9 +149,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
149
149
  productList: hasApplicableDiscount ? result.productList : productList
150
150
  };
151
151
  }
152
- filterDiscountListByType(discountList, type) {
153
- return (discountList || []).filter((item) => item.type === type || item.tag === type);
154
- }
155
152
  calcDiscount({
156
153
  discountList,
157
154
  productList,
@@ -585,7 +582,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
585
582
  });
586
583
  const processedFlatItemsMap = /* @__PURE__ */ new Map();
587
584
  sortedFlattenedList.forEach((flatItem, index) => {
588
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
585
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
589
586
  let product, originProduct;
590
587
  if (flatItem.type === "main") {
591
588
  product = flatItem.product;
@@ -700,9 +697,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
700
697
  _h,
701
698
  (item) => item.type === "product"
702
699
  )));
703
- if (product.inPromotion) {
704
- isManualDiscount = false;
705
- }
706
700
  } else {
707
701
  const parentProduct = flatItem.parentProduct;
708
702
  if (parentProduct) {
@@ -806,7 +800,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
806
800
  }),
807
801
  price: product.price
808
802
  },
809
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
803
+ discount_list: []
810
804
  })
811
805
  ]);
812
806
  } else {
@@ -817,18 +811,18 @@ var RulesModule = class extends import_BaseModule.BaseModule {
817
811
  main_product_selling_price: product.price
818
812
  } : {
819
813
  _id: product._id.split("___")[0] + "___" + index,
820
- total: product.inPromotion ? ((_u = product == null ? void 0 : product._promotion) == null ? void 0 : _u.finalPrice) ?? product.origin_total ?? product.total : product.origin_total || product.total,
814
+ total: product.origin_total || product.total,
821
815
  price: product.price,
822
816
  main_product_selling_price: product.price
823
817
  },
824
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
818
+ discount_list: []
825
819
  })
826
820
  ]);
827
821
  }
828
822
  } else {
829
823
  processedFlatItemsMap.set(flatItem._id, [{
830
824
  ...flatItem,
831
- discount_list: this.filterDiscountListByType(((_v = flatItem.bundleItem) == null ? void 0 : _v.discount_list) || [], "promotion"),
825
+ discount_list: [],
832
826
  price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
833
827
  processed: true
834
828
  }]);
@@ -856,7 +850,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
856
850
  if (splitCount < totalQuantity && isNeedSplit) {
857
851
  arr.push(
858
852
  this.hooks.setProduct(originProduct, {
859
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion"),
853
+ discount_list: [],
860
854
  quantity: totalQuantity - splitCount,
861
855
  _id: product._id.split("___")[0],
862
856
  total: product.origin_total || product.total
@@ -872,10 +866,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
872
866
  }
873
867
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
874
868
  let productOriginTotal = product.origin_total || product.total || 0;
875
- if (this.filterDiscountListByType(product.discount_list, "promotion").length && product.origin_total) {
869
+ if (((_u = product.discount_list) == null ? void 0 : _u.length) && product.origin_total) {
876
870
  productOriginTotal = product.origin_total;
877
871
  }
878
- if (Number(((_w = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _w.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
872
+ if (Number(((_v = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _v.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
879
873
  productOriginTotal = product.total;
880
874
  }
881
875
  const isOrderLevel = (0, import_utils3.isOrderLevelFixedAmountDiscount)(selectedDiscount2);
@@ -898,9 +892,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
898
892
  amount,
899
893
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
900
894
  discount: {
901
- discount_card_type: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_card_type,
895
+ discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
902
896
  fixed_amount: amount,
903
- discount_calculation_mode: (_y = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _y.discount_calculation_mode,
897
+ discount_calculation_mode: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_calculation_mode,
904
898
  resource_id: selectedDiscount2.id,
905
899
  title: selectedDiscount2.format_title,
906
900
  original_amount: product.price,
@@ -948,7 +942,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
948
942
  } else {
949
943
  arr.push(
950
944
  this.hooks.setProduct(originProduct, {
951
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion").concat([discountDetail]),
945
+ discount_list: [discountDetail],
952
946
  _id: product._id.split("___")[0] + "___" + selectedDiscount2.id + index,
953
947
  price: selectedDiscount2.tag === "good_pass" ? 0 : product.price,
954
948
  quantity: isNeedSplit ? 1 : product.quantity,
@@ -984,7 +978,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
984
978
  type: "good_pass",
985
979
  discount: {
986
980
  fixed_amount: product.origin_total,
987
- discount_calculation_mode: (_z = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _z.discount_calculation_mode,
981
+ discount_calculation_mode: (_y = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _y.discount_calculation_mode,
988
982
  resource_id: selectedDiscount2.id,
989
983
  title: selectedDiscount2.format_title,
990
984
  original_amount: product.origin_total,
@@ -1058,9 +1052,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1058
1052
  amount: fixedAmountPerItem * (product.num || 1),
1059
1053
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
1060
1054
  discount: {
1061
- discount_card_type: (_A = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _A.discount_card_type,
1055
+ discount_card_type: (_z = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _z.discount_card_type,
1062
1056
  fixed_amount: fixedAmountPerItem,
1063
- discount_calculation_mode: (_B = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _B.discount_calculation_mode,
1057
+ discount_calculation_mode: (_A = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _A.discount_calculation_mode,
1064
1058
  resource_id: selectedDiscount2.id,
1065
1059
  title: selectedDiscount2.format_title,
1066
1060
  original_amount: product.original_price,
@@ -1076,7 +1070,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1076
1070
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
1077
1071
  },
1078
1072
  config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
1079
- _num: (product.num || 1) * (((_C = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _C.num) || 1)
1073
+ _num: (product.num || 1) * (((_B = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _B.num) || 1)
1080
1074
  };
1081
1075
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
1082
1076
  appliedProducts.push(discountDetail);
@@ -1101,7 +1095,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1101
1095
  const getDefaultProduct = () => {
1102
1096
  if (product.isClient) {
1103
1097
  return this.hooks.setProduct(originProduct, {
1104
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion"),
1098
+ discount_list: [],
1105
1099
  price: product.price,
1106
1100
  origin_total: (0, import_utils2.getProductOriginTotalPrice)({
1107
1101
  product: {
@@ -1122,7 +1116,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1122
1116
  });
1123
1117
  } else {
1124
1118
  return this.hooks.setProduct(originProduct, {
1125
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion"),
1119
+ discount_list: [],
1126
1120
  total: product.total,
1127
1121
  origin_total: product.origin_total,
1128
1122
  price: product.price
@@ -344,7 +344,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
344
344
  };
345
345
  setOtherData(key: string, value: any): void;
346
346
  getOtherData(key: string): any;
347
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
347
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
348
348
  /**
349
349
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
350
350
  *
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态