@pisell/pisellos 0.0.472 → 0.0.474

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.
@@ -1178,15 +1178,20 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1178
1178
  discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1179
1179
  }))]);
1180
1180
  } else {
1181
- var _product$main_product, _ref8, _product$_promotion$f, _product13, _product$main_product2;
1181
+ var _product$price2, _ref8, _product$_promotion$f, _product13;
1182
+ var main_product_selling_price = (_product$price2 = product.price) !== null && _product$price2 !== void 0 ? _product$price2 : product.main_product_selling_price;
1183
+ if (product.booking_id) {
1184
+ var _product$main_product;
1185
+ main_product_selling_price = (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : product.price;
1186
+ }
1182
1187
  processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
1183
1188
  price: product.price,
1184
- main_product_selling_price: (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : product.price
1189
+ main_product_selling_price: main_product_selling_price
1185
1190
  } : {
1186
1191
  _id: product._id.split('___')[0] + '___' + index,
1187
1192
  total: product.inPromotion ? (_ref8 = (_product$_promotion$f = (_product13 = product) === null || _product13 === void 0 || (_product13 = _product13._promotion) === null || _product13 === void 0 ? void 0 : _product13.finalPrice) !== null && _product$_promotion$f !== void 0 ? _product$_promotion$f : product.origin_total) !== null && _ref8 !== void 0 ? _ref8 : product.total : product.origin_total || product.total,
1188
1193
  price: product.price,
1189
- main_product_selling_price: (_product$main_product2 = product.main_product_selling_price) !== null && _product$main_product2 !== void 0 ? _product$main_product2 : product.price
1194
+ main_product_selling_price: main_product_selling_price
1190
1195
  }), {}, {
1191
1196
  discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1192
1197
  }))]);
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -426,7 +426,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
426
426
  // 可选,附加费均摊舍入金额
427
427
  "surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
428
428
  },
429
- product_bundle: item.product_bundle.map(function (bundle) {
429
+ product_bundle: (item.product_bundle || []).map(function (bundle) {
430
430
  return {
431
431
  is_price_include_tax: item.is_price_include_tax,
432
432
  bundle_id: bundle.bundle_id,
@@ -0,0 +1,49 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
34
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
+ default: () => import_adapter2.default
37
+ });
38
+ module.exports = __toCommonJS(promotion_exports);
39
+ var import_evaluator = require("./evaluator");
40
+ var import_adapter = require("./adapter");
41
+ var import_adapter2 = __toESM(require("./adapter"));
42
+ var import_examples = require("./examples");
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ BUY_X_GET_Y_FREE_STRATEGY,
46
+ PromotionAdapter,
47
+ PromotionEvaluator,
48
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
49
+ });
@@ -869,16 +869,20 @@ var RulesModule = class extends import_BaseModule.BaseModule {
869
869
  })
870
870
  ]);
871
871
  } else {
872
+ let main_product_selling_price = product.price ?? product.main_product_selling_price;
873
+ if (product.booking_id) {
874
+ main_product_selling_price = product.main_product_selling_price ?? product.price;
875
+ }
872
876
  processedProductsMap.set(product._id, [
873
877
  this.hooks.setProduct(originProduct, {
874
878
  ...isManualDiscount ? {
875
879
  price: product.price,
876
- main_product_selling_price: product.main_product_selling_price ?? product.price
880
+ main_product_selling_price
877
881
  } : {
878
882
  _id: product._id.split("___")[0] + "___" + index,
879
883
  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,
880
884
  price: product.price,
881
- main_product_selling_price: product.main_product_selling_price ?? product.price
885
+ main_product_selling_price
882
886
  },
883
887
  discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
884
888
  })
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -245,7 +245,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
245
245
  // 可选,附加费均摊舍入金额
246
246
  "surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
247
247
  },
248
- product_bundle: item.product_bundle.map((bundle) => {
248
+ product_bundle: (item.product_bundle || []).map((bundle) => {
249
249
  return {
250
250
  is_price_include_tax: item.is_price_include_tax,
251
251
  bundle_id: bundle.bundle_id,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.472",
4
+ "version": "0.0.474",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",