@pisell/pisellos 3.0.91 → 3.0.92

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.
@@ -0,0 +1,9 @@
1
+ // 导出评估器
2
+ export { PromotionEvaluator } from "./evaluator";
3
+
4
+ // 导出适配器
5
+ export { PromotionAdapter } from "./adapter";
6
+ export { default } from "./adapter";
7
+
8
+ // 导出策略配置示例常量
9
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -86,7 +86,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
86
86
  key: "loadProducts",
87
87
  value: function () {
88
88
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
89
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, schedule_datetime, cacheId, _ref$menu_list_ids, menu_list_ids, userPlugin, customer_id, _userPlugin$get, productsData, sortedList;
89
+ var _this$otherParams, _this$otherParams2;
90
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, schedule_datetime, cacheId, _ref$menu_list_ids, menu_list_ids, userPlugin, customer_id, _userPlugin$get, channelMap, saleChannel, productsData, sortedList;
90
91
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
91
92
  while (1) switch (_context3.prev = _context3.next) {
92
93
  case 0:
@@ -110,8 +111,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
110
111
  } catch (error) {
111
112
  console.error(error);
112
113
  }
113
- _context3.prev = 4;
114
- _context3.next = 7;
114
+ channelMap = {
115
+ 'online_store': 'online-store',
116
+ 'scan_to_order': 'online-store',
117
+ 'scan_to_order_2': 'online-store',
118
+ 'scan_to_order_3': 'online-store'
119
+ };
120
+ saleChannel = channelMap[(_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel] || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel);
121
+ _context3.prev = 6;
122
+ _context3.next = 9;
115
123
  return this.request.post("/product/query", {
116
124
  open_quotation: 1,
117
125
  open_bundle: 0,
@@ -128,8 +136,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
128
136
  // client_schedule_ids: schedule_ids,
129
137
  schedule_date: schedule_date,
130
138
  schedule_datetime: schedule_datetime,
131
- // application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
132
- application_code: 'online-store',
139
+ application_code: saleChannel,
133
140
  is_eject: 1,
134
141
  menu_list_ids: menu_list_ids,
135
142
  open_deposit: 1
@@ -137,7 +144,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
137
144
  useCache: true,
138
145
  customToast: function customToast() {}
139
146
  });
140
- case 7:
147
+ case 9:
141
148
  productsData = _context3.sent;
142
149
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
143
150
  return Number(b.sort) - Number(a.sort);
@@ -150,15 +157,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
150
157
  // }
151
158
  this.addProduct(sortedList);
152
159
  return _context3.abrupt("return", sortedList);
153
- case 13:
154
- _context3.prev = 13;
155
- _context3.t0 = _context3["catch"](4);
160
+ case 15:
161
+ _context3.prev = 15;
162
+ _context3.t0 = _context3["catch"](6);
156
163
  return _context3.abrupt("return", _context3.t0);
157
- case 16:
164
+ case 18:
158
165
  case "end":
159
166
  return _context3.stop();
160
167
  }
161
- }, _callee3, this, [[4, 13]]);
168
+ }, _callee3, this, [[6, 15]]);
162
169
  }));
163
170
  function loadProducts(_x5) {
164
171
  return _loadProducts.apply(this, arguments);
@@ -59,7 +59,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
59
59
  cacheId,
60
60
  menu_list_ids = []
61
61
  }) {
62
- var _a;
62
+ var _a, _b, _c;
63
63
  let userPlugin = this.core.getPlugin("user");
64
64
  let customer_id = void 0;
65
65
  try {
@@ -67,6 +67,13 @@ var ProductList = class extends import_BaseModule.BaseModule {
67
67
  } catch (error) {
68
68
  console.error(error);
69
69
  }
70
+ const channelMap = {
71
+ "online_store": "online-store",
72
+ "scan_to_order": "online-store",
73
+ "scan_to_order_2": "online-store",
74
+ "scan_to_order_3": "online-store"
75
+ };
76
+ const saleChannel = channelMap[(_b = this.otherParams) == null ? void 0 : _b.channel] || ((_c = this.otherParams) == null ? void 0 : _c.channel);
70
77
  try {
71
78
  const productsData = await this.request.post(
72
79
  `/product/query`,
@@ -93,8 +100,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
93
100
  // client_schedule_ids: schedule_ids,
94
101
  schedule_date,
95
102
  schedule_datetime,
96
- // application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
97
- application_code: "online-store",
103
+ application_code: saleChannel,
98
104
  is_eject: 1,
99
105
  menu_list_ids,
100
106
  open_deposit: 1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "3.0.91",
4
+ "version": "3.0.92",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",