@pisell/pisellos 2.1.174 → 2.1.176

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 (60) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -4
  4. package/dist/modules/Discount/index.d.ts +3 -6
  5. package/dist/modules/Discount/index.js +23 -125
  6. package/dist/modules/Discount/types.d.ts +5 -34
  7. package/dist/modules/OpenData/types.d.ts +1 -0
  8. package/dist/modules/ProductList/index.js +13 -6
  9. package/dist/modules/Rules/index.d.ts +2 -12
  10. package/dist/modules/Rules/index.js +113 -377
  11. package/dist/modules/Rules/types.d.ts +2 -2
  12. package/dist/plugins/window.d.ts +0 -2
  13. package/dist/solution/BookingByStep/index.d.ts +1 -1
  14. package/dist/solution/ScanOrder/index.d.ts +7 -5
  15. package/dist/solution/ScanOrder/index.js +123 -31
  16. package/dist/solution/ScanOrder/resourceSchedule.d.ts +12 -0
  17. package/dist/solution/ScanOrder/resourceSchedule.js +300 -0
  18. package/dist/solution/ScanOrder/types.d.ts +9 -1
  19. package/dist/solution/ShopDiscount/index.d.ts +0 -3
  20. package/dist/solution/ShopDiscount/index.js +78 -161
  21. package/dist/solution/ShopDiscount/utils.d.ts +0 -1
  22. package/dist/solution/ShopDiscount/utils.js +1 -40
  23. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
  24. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -4
  25. package/lib/modules/Discount/index.d.ts +3 -6
  26. package/lib/modules/Discount/index.js +16 -66
  27. package/lib/modules/Discount/types.d.ts +5 -34
  28. package/lib/modules/OpenData/types.d.ts +1 -0
  29. package/lib/modules/ProductList/index.js +8 -1
  30. package/lib/modules/Rules/index.d.ts +2 -12
  31. package/lib/modules/Rules/index.js +69 -303
  32. package/lib/modules/Rules/types.d.ts +2 -2
  33. package/lib/plugins/window.d.ts +0 -2
  34. package/lib/solution/BookingByStep/index.d.ts +1 -1
  35. package/lib/solution/ScanOrder/index.d.ts +7 -5
  36. package/lib/solution/ScanOrder/index.js +90 -12
  37. package/lib/solution/ScanOrder/resourceSchedule.d.ts +12 -0
  38. package/lib/solution/ScanOrder/resourceSchedule.js +272 -0
  39. package/lib/solution/ScanOrder/types.d.ts +9 -1
  40. package/lib/solution/ShopDiscount/index.d.ts +0 -3
  41. package/lib/solution/ShopDiscount/index.js +28 -78
  42. package/lib/solution/ShopDiscount/utils.d.ts +0 -1
  43. package/lib/solution/ShopDiscount/utils.js +1 -42
  44. package/package.json +1 -1
  45. package/dist/modules/Discount/availability.d.ts +0 -7
  46. package/dist/modules/Discount/availability.js +0 -52
  47. package/dist/modules/Discount/entitlementPass.d.ts +0 -34
  48. package/dist/modules/Discount/entitlementPass.js +0 -147
  49. package/dist/modules/Discount/entitlementState.d.ts +0 -8
  50. package/dist/modules/Discount/entitlementState.js +0 -205
  51. package/dist/modules/Rules/entitlementLines.d.ts +0 -8
  52. package/dist/modules/Rules/entitlementLines.js +0 -157
  53. package/lib/modules/Discount/availability.d.ts +0 -7
  54. package/lib/modules/Discount/availability.js +0 -91
  55. package/lib/modules/Discount/entitlementPass.d.ts +0 -34
  56. package/lib/modules/Discount/entitlementPass.js +0 -184
  57. package/lib/modules/Discount/entitlementState.d.ts +0 -8
  58. package/lib/modules/Discount/entitlementState.js +0 -206
  59. package/lib/modules/Rules/entitlementLines.d.ts +0 -8
  60. package/lib/modules/Rules/entitlementLines.js +0 -158
@@ -1,9 +0,0 @@
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";
@@ -26,8 +26,6 @@ export declare class WalletPassEvaluator {
26
26
  /** 检查代金券/折扣卡是否可用 并返回config */
27
27
  checkVoucherAvailability(input: EvaluatorInput): {
28
28
  isAvailable: boolean;
29
- reason: string | undefined;
30
- reasonCode: string | undefined;
31
29
  config: {
32
30
  [x: string]: any;
33
31
  };
@@ -232,7 +232,7 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
232
232
  }, {
233
233
  key: "checkVoucherAvailability",
234
234
  value: function checkVoucherAvailability(input) {
235
- var _results$, _results$2, _results$3, _results$4;
235
+ var _results$, _results$2;
236
236
  var orderTotalAmount = input.orderTotalAmount,
237
237
  products = input.products,
238
238
  vouchers = input.vouchers;
@@ -240,9 +240,7 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
240
240
  var isAvailable = ((_results$ = results[0]) === null || _results$ === void 0 ? void 0 : _results$.isApplicable) || false;
241
241
  return {
242
242
  isAvailable: isAvailable,
243
- reason: (_results$2 = results[0]) === null || _results$2 === void 0 ? void 0 : _results$2.reason,
244
- reasonCode: (_results$3 = results[0]) === null || _results$3 === void 0 ? void 0 : _results$3.reasonCode,
245
- config: _objectSpread({}, (_results$4 = results[0]) === null || _results$4 === void 0 || (_results$4 = _results$4.strategyResult) === null || _results$4 === void 0 || (_results$4 = _results$4.config) === null || _results$4 === void 0 || (_results$4 = _results$4.metadata) === null || _results$4 === void 0 ? void 0 : _results$4.custom)
243
+ config: _objectSpread({}, (_results$2 = results[0]) === null || _results$2 === void 0 || (_results$2 = _results$2.strategyResult) === null || _results$2 === void 0 || (_results$2 = _results$2.config) === null || _results$2 === void 0 || (_results$2 = _results$2.metadata) === null || _results$2 === void 0 ? void 0 : _results$2.custom)
246
244
  };
247
245
  }
248
246
 
@@ -23,14 +23,11 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
23
23
  customer_id: number;
24
24
  with_wallet_pass_holder: 0 | 1;
25
25
  request_timezone: string;
26
- order_id?: number | string;
27
- with_entitlement_pass?: 0 | 1;
28
- filter_order_wallet_pass_usage?: 0 | 1;
26
+ order_id?: number;
29
27
  }): Promise<Discount[]>;
30
- batchSearch(code: string, customerIdOrOptions?: number | {
28
+ batchSearch(code: string, options?: {
31
29
  customerId?: number;
32
- orderId?: number | string;
33
- withEntitlementPass?: boolean;
30
+ orderId?: number;
34
31
  }): Promise<DiscountWithReason>;
35
32
  batchSearchByProductIds(productIds: number[]): Promise<any>;
36
33
  filterEnabledDiscountList(discountList: Discount[]): Discount[];
@@ -1,8 +1,4 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
5
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
6
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; }
7
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; }
8
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -31,8 +27,6 @@ import { uniqueById } from "../../solution/ShopDiscount/utils";
31
27
  import { BaseModule } from "../BaseModule";
32
28
  import { DiscountHooks } from "./types";
33
29
  import Decimal from 'decimal.js';
34
- import { isEntitlementPass } from "./entitlementPass";
35
- import { getDiscountLifecycleReason, getDiscountUsageLimitFailKey } from "./availability";
36
30
  export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
37
31
  _inherits(DiscountModule, _BaseModule);
38
32
  var _super = _createSuper(DiscountModule);
@@ -159,8 +153,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
159
153
  key: "loadPrepareConfig",
160
154
  value: function () {
161
155
  var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
162
- var _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5;
163
- var prepareConfig, _prepareConfig$data, _prepareConfig$data2, entitlementPassList, ids, rawDiscountList, goodPassList;
156
+ var _prepareConfig$data, _prepareConfig$data2;
157
+ var prepareConfig, goodPassList;
164
158
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
165
159
  while (1) switch (_context4.prev = _context4.next) {
166
160
  case 0:
@@ -168,29 +162,9 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
168
162
  return this.request.post("/order/prepare/config", params);
169
163
  case 2:
170
164
  prepareConfig = _context4.sent;
171
- if (params.with_entitlement_pass) {
172
- _context4.next = 5;
173
- break;
174
- }
175
- return _context4.abrupt("return", this.filterEnabledDiscountList([].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) || [])).filter(function (item) {
176
- return !isEntitlementPass(item);
177
- })));
178
- case 5:
179
- entitlementPassList = (prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data3 = prepareConfig.data) === null || _prepareConfig$data3 === void 0 ? void 0 : _prepareConfig$data3.entitlement_pass_list) || [];
180
- ids = new Set(entitlementPassList.map(function (item) {
181
- return String(item.id);
182
- }));
183
- rawDiscountList = [].concat(_toConsumableArray(entitlementPassList), _toConsumableArray(((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data4 = prepareConfig.data) === null || _prepareConfig$data4 === void 0 ? void 0 : _prepareConfig$data4.good_pass_list) || []).filter(function (item) {
184
- return !ids.has(String(item.id));
185
- })), _toConsumableArray(((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data5 = prepareConfig.data) === null || _prepareConfig$data5 === void 0 ? void 0 : _prepareConfig$data5.discount_card_list) || []).filter(function (item) {
186
- return !ids.has(String(item.id));
187
- })));
188
- _context4.next = 10;
189
- return this.setOriginalDiscountList(rawDiscountList);
190
- case 10:
191
- goodPassList = this.filterEnabledDiscountList(rawDiscountList); // this.setDiscountList(goodPassList);
165
+ goodPassList = this.filterEnabledDiscountList([].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) || []))) || []; // this.setDiscountList(goodPassList);
192
166
  return _context4.abrupt("return", goodPassList);
193
- case 12:
167
+ case 5:
194
168
  case "end":
195
169
  return _context4.stop();
196
170
  }
@@ -204,22 +178,18 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
204
178
  }, {
205
179
  key: "batchSearch",
206
180
  value: function () {
207
- var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerIdOrOptions) {
208
- var _this2 = this,
209
- _entitlement$value,
210
- _legacy$value;
211
- var _ref, customerId, orderId, withEntitlementPass, params, _result, search, _yield$Promise$all, _yield$Promise$all2, legacy, entitlement, entitlementList, legacyList, ids, result;
181
+ var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, options) {
182
+ var _ref, customerId, orderId, result, resultDiscountWithReason;
212
183
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
213
184
  while (1) switch (_context5.prev = _context5.next) {
214
185
  case 0:
215
- _ref = typeof customerIdOrOptions === 'number' ? {
216
- customerId: customerIdOrOptions,
217
- orderId: undefined,
218
- withEntitlementPass: false
219
- } : customerIdOrOptions || {}, customerId = _ref.customerId, orderId = _ref.orderId, withEntitlementPass = _ref.withEntitlementPass;
220
- params = _objectSpread(_objectSpread({
186
+ _ref = options || {}, customerId = _ref.customerId, orderId = _ref.orderId;
187
+ _context5.next = 3;
188
+ return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
221
189
  code: code,
222
190
  translate_flag: 1,
191
+ tags: ['good_pass', 'product_discount_card'],
192
+ // available: 1,
223
193
  relation_product: 1,
224
194
  with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
225
195
  order_behavior_count: 1,
@@ -229,75 +199,12 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
229
199
  } : {}), {}, {
230
200
  unified_status_info_flag: 1,
231
201
  request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
232
- });
233
- if (withEntitlementPass) {
234
- _context5.next = 7;
235
- break;
236
- }
237
- _context5.next = 5;
238
- return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({}, params), {}, {
239
- tags: ['good_pass', 'product_discount_card']
240
- }));
241
- case 5:
242
- _result = _context5.sent;
243
- return _context5.abrupt("return", this.filterEnabledDiscountListWithReason(((_result === null || _result === void 0 ? void 0 : _result.data) || []).filter(function (item) {
244
- return !isEntitlementPass(item);
245
- })));
246
- case 7:
247
- // 旧券沿用统一状态校验;多次卡单独查询,保留暂不可用的卡供展示。
248
- search = function search(query) {
249
- return _this2.request.get("/machinecode/batch-search", query).then(function (value) {
250
- return {
251
- status: 'fulfilled',
252
- value: value
253
- };
254
- }, function (reason) {
255
- return {
256
- status: 'rejected',
257
- reason: reason
258
- };
259
- });
260
- };
261
- _context5.next = 10;
262
- return Promise.all([search(_objectSpread(_objectSpread({}, params), {}, {
263
- tags: ['good_pass', 'product_discount_card']
264
- })), search(_objectSpread(_objectSpread({}, params), {}, {
265
- tags: ['entitlement_pass'],
266
- with_franchisor_data: 1,
267
- unified_status_info_flag: 1,
268
- with: [].concat(_toConsumableArray(params.with), ['franchiseeWalletPass:shop_id,source_shop_id,product_id,use'])
269
- }))]);
270
- case 10:
271
- _yield$Promise$all = _context5.sent;
272
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
273
- legacy = _yield$Promise$all2[0];
274
- entitlement = _yield$Promise$all2[1];
275
- entitlementList = (entitlement.status === 'fulfilled' ? ((_entitlement$value = entitlement.value) === null || _entitlement$value === void 0 ? void 0 : _entitlement$value.data) || [] : []).filter(isEntitlementPass);
276
- legacyList = legacy.status === 'fulfilled' ? ((_legacy$value = legacy.value) === null || _legacy$value === void 0 ? void 0 : _legacy$value.data) || [] : [];
277
- ids = new Set(entitlementList.map(function (item) {
278
- return String(item.id);
279
202
  }));
280
- result = this.filterEnabledDiscountListWithReason([].concat(_toConsumableArray(entitlementList), _toConsumableArray(legacyList.filter(function (item) {
281
- return !isEntitlementPass(item) && !ids.has(String(item.id));
282
- })))); // 任一类型查到可用卡即可继续,另一类型的查询失败不阻断该卡。
283
- if (result.discountList.length) {
284
- _context5.next = 23;
285
- break;
286
- }
287
- if (!(legacy.status === 'rejected')) {
288
- _context5.next = 21;
289
- break;
290
- }
291
- throw legacy.reason;
292
- case 21:
293
- if (!(entitlement.status === 'rejected')) {
294
- _context5.next = 23;
295
- break;
296
- }
297
- throw entitlement.reason;
298
- case 23:
299
- return _context5.abrupt("return", result);
300
- case 24:
203
+ case 3:
204
+ result = _context5.sent;
205
+ resultDiscountWithReason = this.filterEnabledDiscountListWithReason((result === null || result === void 0 ? void 0 : result.data) || []) || [];
206
+ return _context5.abrupt("return", resultDiscountWithReason);
207
+ case 6:
301
208
  case "end":
302
209
  return _context5.stop();
303
210
  }
@@ -340,9 +247,9 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
340
247
  }, {
341
248
  key: "filterEnabledDiscountList",
342
249
  value: function filterEnabledDiscountList(discountList) {
343
- var _this3 = this;
250
+ var _this2 = this;
344
251
  return discountList.filter(function (discount) {
345
- return isEntitlementPass(discount) ? !getDiscountLifecycleReason(discount) : discount.limit_status === 'enable' && new Decimal((discount === null || discount === void 0 ? void 0 : discount.par_value) || 0).minus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.used_par_value) || 0)).greaterThan(0) && _this3.checkUsageCreditsLimit(discount);
252
+ return discount.limit_status === 'enable' && new Decimal((discount === null || discount === void 0 ? void 0 : discount.par_value) || 0).minus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.used_par_value) || 0)).greaterThan(0) && _this2.checkUsageCreditsLimit(discount);
346
253
  });
347
254
  }
348
255
 
@@ -409,19 +316,14 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
409
316
  }, {
410
317
  key: "filterEnabledDiscountListWithReason",
411
318
  value: function filterEnabledDiscountListWithReason(discountList) {
412
- var _this4 = this;
413
- var entitlementPasses = discountList.filter(function (item) {
414
- return isEntitlementPass(item) && !getDiscountLifecycleReason(item);
415
- });
416
- var lists = discountList.filter(function (item) {
417
- return !isEntitlementPass(item);
418
- }).filter(function (discount) {
319
+ var _this3 = this;
320
+ var lists = discountList.filter(function (discount) {
419
321
  return discount.limit_status === 'enable';
420
322
  }).filter(function (discount) {
421
323
  var remaining = new Decimal((discount === null || discount === void 0 ? void 0 : discount.par_value) || 0).minus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.used_par_value) || 0)).greaterThan(0);
422
324
  return remaining;
423
325
  }).map(function (discount) {
424
- var limitFailKey = _this4.checkUsageCreditsLimitWithFailKey(discount);
326
+ var limitFailKey = _this3.checkUsageCreditsLimitWithFailKey(discount);
425
327
  return _objectSpread(_objectSpread({}, discount), {}, {
426
328
  usageLimitFailKey: limitFailKey
427
329
  });
@@ -436,12 +338,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
436
338
  return item.usageLimitFailKey;
437
339
  });
438
340
  return {
439
- discountList: [].concat(_toConsumableArray(entitlementPasses.map(function (item) {
440
- return _objectSpread(_objectSpread({}, item), {}, {
441
- usageLimitFailKey: getDiscountUsageLimitFailKey(item)
442
- });
443
- })), _toConsumableArray(availableLists)),
444
- unavailableReasonKey: (currentFailDiscount === null || currentFailDiscount === void 0 ? void 0 : currentFailDiscount.usageLimitFailKey) || discountList.filter(isEntitlementPass).map(getDiscountLifecycleReason).find(Boolean) || null
341
+ discountList: availableLists,
342
+ unavailableReasonKey: currentFailDiscount === null || currentFailDiscount === void 0 ? void 0 : currentFailDiscount.usageLimitFailKey
445
343
  };
446
344
  }
447
345
 
@@ -45,8 +45,6 @@ interface ApplicableProductDetails {
45
45
  num: number;
46
46
  metadata?: {
47
47
  product_discount_difference?: number;
48
- num?: number;
49
- custom_product_bundle_map_id?: string;
50
48
  };
51
49
  discount?: {
52
50
  fixed_amount?: number;
@@ -65,17 +63,10 @@ interface UsageCreditsValue {
65
63
  max_per_week: number;
66
64
  max_per_month: number;
67
65
  }
68
- export type IncludedUses = {
69
- type: 'limited';
70
- value: number;
71
- } | {
72
- type: 'unlimited';
73
- value: null;
74
- };
75
66
  export type DiscountFilterRejectKey = 'total_credits' | 'per_user_limit' | 'max_per_day' | 'max_per_week' | 'max_per_month';
76
67
  export interface DiscountWithReason {
77
68
  discountList: Discount[];
78
- unavailableReasonKey: DiscountFilterRejectKey | string | null;
69
+ unavailableReasonKey: DiscountFilterRejectKey | null;
79
70
  }
80
71
  interface ExtensionData {
81
72
  id: number;
@@ -102,39 +93,19 @@ export interface Discount {
102
93
  used_par_value: string;
103
94
  limit_status: string;
104
95
  limited_relation_product_data: Limitedrelationproductdata;
105
- balance?: string | number | null;
96
+ balance: string;
106
97
  format_title: Formattitle;
107
98
  metadata?: {
108
99
  discount_card_type?: 'fixed_amount' | 'percent';
109
100
  custom_product_bundle_map_id?: string;
110
101
  validity_type?: "custom_schedule_validity" | "fixed_validity";
111
- included_uses?: IncludedUses;
112
- discount_calculation_mode?: 'item_level' | 'order_level';
113
- holder?: {
102
+ discount_calculation_mode: 'item_level' | 'order_level';
103
+ holder: {
114
104
  type: "customer" | "custom";
115
105
  };
116
106
  };
117
107
  product: Product;
118
- type?: 'product' | 'good_pass' | 'entitlement_pass' | 'discount_card' | 'product_discount_card';
119
- shop_id?: number;
120
- customer_id?: number | string | null;
121
- holder?: {
122
- holder_type?: string;
123
- holder_id?: number | string | Array<number | string>;
124
- [key: string]: any;
125
- };
126
- config?: {
127
- isAvailable?: boolean;
128
- maxUsagePerOrder?: number;
129
- [key: string]: any;
130
- };
131
- reason?: string;
132
- reasonCode?: string;
133
- is_franchisor_pass?: number;
134
- franchisee_wallet_pass?: {
135
- use?: string;
136
- };
137
- committedAppliedProductDetails?: ApplicableProductDetails[];
108
+ type: "product" | 'good_pass';
138
109
  resource_id?: number;
139
110
  savedAmount?: number;
140
111
  isEditMode?: boolean;
@@ -33,6 +33,7 @@ export interface OpenDataConfig {
33
33
  'sale.sale_number_prefix'?: string | null;
34
34
  'sale.enabled_item_rules'?: number[];
35
35
  'fulfillment.enable_pickup'?: boolean;
36
+ 'fulfillment.handover_mode'?: string[] | null;
36
37
  'fulfillment.overdue_reminder'?: boolean;
37
38
  'fulfillment.manual_input_type'?: string;
38
39
  'fulfillment.enable_auto_complete'?: boolean;
@@ -86,7 +86,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
86
86
  value: function () {
87
87
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
88
88
  var _this$core, _this$otherParams, _this$otherParams2;
89
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, _platform, productsData, sortedList;
89
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, _platform, channelMap, saleChannel, productsData, sortedList;
90
90
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
91
91
  while (1) switch (_context3.prev = _context3.next) {
92
92
  case 0:
@@ -110,8 +110,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
110
110
  } catch (error) {
111
111
  console.error(error);
112
112
  }
113
- _platform = (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 ? void 0 : _this$core.platform; // 如果没传schedule_date,则从
114
- _context3.next = 7;
113
+ _platform = (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 ? void 0 : _this$core.platform;
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); // 如果没传schedule_date,则从
121
+ _context3.next = 9;
115
122
  return this.request.post("/product/query", {
116
123
  open_quotation: 1,
117
124
  open_bundle: 0,
@@ -129,7 +136,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
129
136
  with_count: with_count,
130
137
  // client_schedule_ids: schedule_ids,
131
138
  schedule_date: schedule_date,
132
- application_code: _platform === 'shop' ? ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel) === 'online_store' ? 'online-store' : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel : 'online-store',
139
+ application_code: _platform === 'shop' ? saleChannel : 'online-store',
133
140
  with_schedule: with_schedule,
134
141
  schedule_datetime: schedule_datetime,
135
142
  is_eject: 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,7 +157,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
150
157
  // }
151
158
  this.addProduct(sortedList);
152
159
  return _context3.abrupt("return", sortedList);
153
- case 11:
160
+ case 13:
154
161
  case "end":
155
162
  return _context3.stop();
156
163
  }
@@ -8,26 +8,17 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
8
8
  protected defaultVersion: string;
9
9
  private store;
10
10
  private hooks;
11
- private entitlementPassEnabled;
12
- private defaultWalletPassEvaluator?;
13
- setEntitlementPassEnabled(enabled: boolean): void;
14
- private getWalletPassEvaluator;
15
11
  constructor(name?: string, version?: string);
16
12
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
17
13
  setRulesList(rulesList: Rules[]): Promise<void>;
18
14
  getRulesList(): Rules[];
19
- private normalizeHolderRecordIds;
20
- /**
21
- * 商品未开启 Holder 选择时跳过匹配;已开启时,特定 form Holder 卡
22
- * 只适用于同一 Holder Record,是否必填不影响匹配规则。
23
- */
24
15
  private checkHolderMatch;
25
16
  isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, isFormSubject, }: {
26
17
  oldDiscountList: Discount[];
27
18
  newDiscountList: Discount[];
28
19
  productList: any[];
29
20
  holders: {
30
- form_record_id: number | string;
21
+ form_record_id: number;
31
22
  }[];
32
23
  isFormSubject: boolean;
33
24
  }): {
@@ -35,7 +26,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
35
26
  discountList: Discount[];
36
27
  productList: any[];
37
28
  unavailableReason?: UnavailableReason;
38
- evaluatedDiscountList?: Discount[];
39
29
  };
40
30
  filterDiscountListByType(discountList: Discount[], type: string): Discount[];
41
31
  private getUnavailableReason;
@@ -43,7 +33,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
43
33
  discountList: Discount[];
44
34
  productList: any[];
45
35
  holders: {
46
- form_record_id: number | string;
36
+ form_record_id: number;
47
37
  }[];
48
38
  isFormSubject: boolean;
49
39
  }, options?: {