@pisell/pisellos 2.1.91 → 2.1.93

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 (102) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/model/index.d.ts +1 -0
  4. package/dist/model/index.js +1 -0
  5. package/dist/model/strategy/adapter/index.d.ts +3 -0
  6. package/dist/model/strategy/adapter/index.js +4 -0
  7. package/dist/model/strategy/adapter/type.d.ts +28 -0
  8. package/dist/model/strategy/adapter/type.js +1 -0
  9. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  10. package/dist/model/strategy/adapter/walletPass/evaluator.js +497 -0
  11. package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
  12. package/dist/model/strategy/adapter/walletPass/example.js +258 -0
  13. package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
  14. package/dist/model/strategy/adapter/walletPass/index.js +182 -0
  15. package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  16. package/dist/model/strategy/adapter/walletPass/locales.js +23 -0
  17. package/dist/model/strategy/adapter/walletPass/type.d.ts +165 -0
  18. package/dist/model/strategy/adapter/walletPass/type.js +1 -0
  19. package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  20. package/dist/model/strategy/adapter/walletPass/utils.js +965 -0
  21. package/dist/model/strategy/index.d.ts +94 -0
  22. package/dist/model/strategy/index.js +551 -0
  23. package/dist/model/strategy/strategy-example.d.ts +5 -0
  24. package/dist/model/strategy/strategy-example.js +331 -0
  25. package/dist/model/strategy/type.d.ts +228 -0
  26. package/dist/model/strategy/type.js +94 -0
  27. package/dist/modules/Cart/types.d.ts +2 -0
  28. package/dist/modules/Cart/utils/cartProduct.js +11 -0
  29. package/dist/modules/Discount/index.d.ts +1 -0
  30. package/dist/modules/Discount/index.js +40 -11
  31. package/dist/modules/Discount/types.d.ts +17 -0
  32. package/dist/modules/Payment/index.d.ts +2 -1
  33. package/dist/modules/Payment/index.js +10 -7
  34. package/dist/modules/Payment/utils.js +3 -0
  35. package/dist/modules/Payment/walletpass.d.ts +23 -0
  36. package/dist/modules/Payment/walletpass.js +191 -95
  37. package/dist/modules/Product/index.d.ts +1 -1
  38. package/dist/modules/Rules/index.d.ts +9 -5
  39. package/dist/modules/Rules/index.js +538 -118
  40. package/dist/modules/Rules/types.d.ts +1 -0
  41. package/dist/modules/Summary/types.d.ts +2 -0
  42. package/dist/modules/Summary/utils.d.ts +6 -0
  43. package/dist/modules/Summary/utils.js +21 -0
  44. package/dist/plugins/window.d.ts +2 -0
  45. package/dist/solution/BookingByStep/index.d.ts +2 -1
  46. package/dist/solution/Checkout/index.js +2 -0
  47. package/dist/solution/ShopDiscount/index.d.ts +2 -0
  48. package/dist/solution/ShopDiscount/index.js +146 -92
  49. package/dist/solution/ShopDiscount/types.d.ts +1 -0
  50. package/dist/solution/ShopDiscount/types.js +2 -1
  51. package/dist/solution/ShopDiscount/utils.js +26 -12
  52. package/lib/index.d.ts +1 -0
  53. package/lib/index.js +3 -1
  54. package/lib/model/index.d.ts +1 -0
  55. package/lib/model/index.js +23 -0
  56. package/lib/model/strategy/adapter/index.d.ts +3 -0
  57. package/lib/model/strategy/adapter/index.js +45 -0
  58. package/lib/model/strategy/adapter/type.d.ts +28 -0
  59. package/lib/model/strategy/adapter/type.js +17 -0
  60. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  61. package/lib/model/strategy/adapter/walletPass/evaluator.js +421 -0
  62. package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
  63. package/lib/model/strategy/adapter/walletPass/example.js +207 -0
  64. package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
  65. package/lib/model/strategy/adapter/walletPass/index.js +142 -0
  66. package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  67. package/lib/model/strategy/adapter/walletPass/locales.js +51 -0
  68. package/lib/model/strategy/adapter/walletPass/type.d.ts +165 -0
  69. package/lib/model/strategy/adapter/walletPass/type.js +17 -0
  70. package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  71. package/lib/model/strategy/adapter/walletPass/utils.js +660 -0
  72. package/lib/model/strategy/index.d.ts +94 -0
  73. package/lib/model/strategy/index.js +413 -0
  74. package/lib/model/strategy/strategy-example.d.ts +5 -0
  75. package/lib/model/strategy/strategy-example.js +318 -0
  76. package/lib/model/strategy/type.d.ts +228 -0
  77. package/lib/model/strategy/type.js +44 -0
  78. package/lib/modules/Cart/types.d.ts +2 -0
  79. package/lib/modules/Cart/utils/cartProduct.js +9 -0
  80. package/lib/modules/Discount/index.d.ts +1 -0
  81. package/lib/modules/Discount/index.js +9 -0
  82. package/lib/modules/Discount/types.d.ts +17 -0
  83. package/lib/modules/Payment/index.d.ts +2 -1
  84. package/lib/modules/Payment/index.js +1 -0
  85. package/lib/modules/Payment/utils.js +3 -0
  86. package/lib/modules/Payment/walletpass.d.ts +23 -0
  87. package/lib/modules/Payment/walletpass.js +94 -17
  88. package/lib/modules/Product/index.d.ts +1 -1
  89. package/lib/modules/Rules/index.d.ts +9 -5
  90. package/lib/modules/Rules/index.js +669 -258
  91. package/lib/modules/Rules/types.d.ts +1 -0
  92. package/lib/modules/Summary/types.d.ts +2 -0
  93. package/lib/modules/Summary/utils.d.ts +6 -0
  94. package/lib/modules/Summary/utils.js +15 -0
  95. package/lib/plugins/window.d.ts +2 -0
  96. package/lib/solution/BookingByStep/index.d.ts +2 -1
  97. package/lib/solution/Checkout/index.js +2 -0
  98. package/lib/solution/ShopDiscount/index.d.ts +2 -0
  99. package/lib/solution/ShopDiscount/index.js +36 -8
  100. package/lib/solution/ShopDiscount/types.d.ts +1 -0
  101. package/lib/solution/ShopDiscount/utils.js +10 -6
  102. package/package.json +1 -1
@@ -208,6 +208,35 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
208
208
  }
209
209
  return batchSearch;
210
210
  }()
211
+ }, {
212
+ key: "batchSearchByProductIds",
213
+ value: function () {
214
+ var _batchSearchByProductIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(productIds) {
215
+ var result;
216
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
217
+ while (1) switch (_context6.prev = _context6.next) {
218
+ case 0:
219
+ _context6.next = 2;
220
+ return this.request.get("/machinecode/batch-search", {
221
+ ids: productIds,
222
+ translate_flag: 1,
223
+ tags: ['good_pass', 'product_discount_card'],
224
+ relation_product: 1
225
+ });
226
+ case 2:
227
+ result = _context6.sent;
228
+ return _context6.abrupt("return", (result === null || result === void 0 ? void 0 : result.data) || []);
229
+ case 4:
230
+ case "end":
231
+ return _context6.stop();
232
+ }
233
+ }, _callee6, this);
234
+ }));
235
+ function batchSearchByProductIds(_x8) {
236
+ return _batchSearchByProductIds.apply(this, arguments);
237
+ }
238
+ return batchSearchByProductIds;
239
+ }()
211
240
  }, {
212
241
  key: "filterEnabledDiscountList",
213
242
  value: function filterEnabledDiscountList(discountList) {
@@ -309,21 +338,21 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
309
338
  }, {
310
339
  key: "destroy",
311
340
  value: function () {
312
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
313
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
314
- while (1) switch (_context6.prev = _context6.next) {
341
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
342
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
343
+ while (1) switch (_context7.prev = _context7.next) {
315
344
  case 0:
316
345
  this.store.discountList = [];
317
346
  this.core.effects.offByModuleDestroy(this.name);
318
- _context6.next = 4;
347
+ _context7.next = 4;
319
348
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
320
349
  case 4:
321
350
  console.log('[Discount] 已销毁');
322
351
  case 5:
323
352
  case "end":
324
- return _context6.stop();
353
+ return _context7.stop();
325
354
  }
326
- }, _callee6, this);
355
+ }, _callee7, this);
327
356
  }));
328
357
  function destroy() {
329
358
  return _destroy.apply(this, arguments);
@@ -333,18 +362,18 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
333
362
  }, {
334
363
  key: "clear",
335
364
  value: function () {
336
- var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
337
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
338
- while (1) switch (_context7.prev = _context7.next) {
365
+ var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
366
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
367
+ while (1) switch (_context8.prev = _context8.next) {
339
368
  case 0:
340
369
  this.store.discountList = [];
341
370
  this.store.originalDiscountList = [];
342
371
  console.log('[Discount] clear');
343
372
  case 3:
344
373
  case "end":
345
- return _context7.stop();
374
+ return _context8.stop();
346
375
  }
347
- }, _callee7, this);
376
+ }, _callee8, this);
348
377
  }));
349
378
  function clear() {
350
379
  return _clear.apply(this, arguments);
@@ -25,6 +25,8 @@ interface Limitedrelationproductdata {
25
25
  product_ids: number[];
26
26
  product_collection_id: number[];
27
27
  package_sub_item_usage_rules?: PackageSubItemUsageRules;
28
+ filter: 0 | 1;
29
+ exclude_product_ids: number[];
28
30
  }
29
31
  interface ApplicableProductDetails {
30
32
  amount: string;
@@ -81,6 +83,7 @@ export interface Discount {
81
83
  balance: string;
82
84
  format_title: Formattitle;
83
85
  metadata?: {
86
+ num?: number;
84
87
  discount_card_type?: 'fixed_amount' | 'percent';
85
88
  custom_product_bundle_map_id?: string;
86
89
  validity_type?: "custom_schedule_validity" | "fixed_validity";
@@ -105,6 +108,19 @@ export interface Discount {
105
108
  isSelected?: boolean;
106
109
  isAvailable?: boolean;
107
110
  isUsed?: boolean;
111
+ config?: {
112
+ isAvailable?: boolean;
113
+ /** 最大抵扣金额 */
114
+ maxDeductionAmount?: number;
115
+ /** 每单最多使用张数 */
116
+ maxUsagePerOrder?: number;
117
+ /** 是否抵扣税费与附加费 */
118
+ deductTaxAndFee?: boolean;
119
+ /** 适用粒度(多商品共用) */
120
+ allowCrossProduct?: boolean;
121
+ /** 可用商品数量上限 */
122
+ applicableProductLimit?: number;
123
+ };
108
124
  applicableProductIds?: number[];
109
125
  applicableProductDetails: ApplicableProductDetails[];
110
126
  appliedProductDetails: ApplicableProductDetails[];
@@ -122,6 +138,7 @@ export interface Discount {
122
138
  num?: number;
123
139
  start_date?: string;
124
140
  start_time?: string;
141
+ discount_rule_uncheck_flag?: boolean;
125
142
  }
126
143
  export interface DiscountState {
127
144
  discountList: Discount[];
@@ -1,5 +1,5 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
- import { RequestPlugin } from '../../plugins';
2
+ import { RequestPlugin, WindowPlugin } from '../../plugins';
3
3
  import { BaseModule } from '../BaseModule';
4
4
  import { PaymentModuleAPI, PaymentMethod, PaymentOrder, PaymentItem, PaymentItemInput, PaymentUpdateFields, PushOrderParams, CashPayment, EftposPayment, WalletPassPayment, RoundingRule, RoundingInterval, RoundingResult } from './types';
5
5
  export * from './types';
@@ -21,6 +21,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
21
21
  request: RequestPlugin;
22
22
  private app;
23
23
  private store;
24
+ window: WindowPlugin;
24
25
  private dbManager;
25
26
  private logger;
26
27
  protected otherParams: any;
@@ -81,6 +81,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
81
81
  _defineProperty(_assertThisInitialized(_this), "app", void 0);
82
82
  // App instance
83
83
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
84
+ _defineProperty(_assertThisInitialized(_this), "window", void 0);
85
+ // WindowPlugin 实例
84
86
  _defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
85
87
  // IndexDBManager 实例
86
88
  _defineProperty(_assertThisInitialized(_this), "logger", void 0);
@@ -110,26 +112,27 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
110
112
  // 获取依赖的插件
111
113
  this.request = core.getPlugin('request');
112
114
  appPlugin = core.getPlugin('app');
115
+ this.window = core.getPlugin('window');
113
116
  if (this.request) {
114
- _context.next = 7;
117
+ _context.next = 8;
115
118
  break;
116
119
  }
117
120
  throw new Error('支付模块需要 request 插件支持');
118
- case 7:
121
+ case 8:
119
122
  if (appPlugin) {
120
- _context.next = 9;
123
+ _context.next = 10;
121
124
  break;
122
125
  }
123
126
  throw new Error('支付模块需要 app 插件支持');
124
- case 9:
127
+ case 10:
125
128
  this.app = appPlugin.getApp();
126
129
  this.dbManager = this.app.dbManager;
127
130
  this.logger = this.app.logger;
128
131
 
129
132
  // 确保支付模块所需的对象存储已创建
130
- _context.next = 14;
133
+ _context.next = 15;
131
134
  return this.ensurePaymentTables();
132
- case 14:
135
+ case 15:
133
136
  this.registerNetworkHandlers();
134
137
 
135
138
  // // 预连接数据库
@@ -137,7 +140,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
137
140
 
138
141
  console.log('[PaymentModule] 初始化完成');
139
142
  this.logInfo('PaymentModule initialized successfully');
140
- case 17:
143
+ case 18:
141
144
  case "end":
142
145
  return _context.stop();
143
146
  }
@@ -1,5 +1,8 @@
1
1
  // 获取walletPass可用最大金额
2
2
  export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
3
+ if (typeof data._available_max_amount === 'number') {
4
+ return data._available_max_amount;
5
+ }
3
6
  return data.tag !== 'point_card' ? data.available_max_amount : data === null || data === void 0 ? void 0 : data.recommended_usage_amount;
4
7
  };
5
8
 
@@ -9,6 +9,7 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
9
9
  private userIdentificationCodes;
10
10
  private searchResults;
11
11
  private walletParams;
12
+ private walletInitData;
12
13
  constructor(paymentModule: PaymentModule);
13
14
  /**
14
15
  * 发送事件的辅助方法
@@ -37,7 +38,14 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
37
38
  initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
38
39
  walletRecommendList: WalletRecommendItem[];
39
40
  userIdentificationCodes: UserIdentificationCodeItem[];
41
+ transformList: any[];
42
+ noApplicableVoucher: any[];
43
+ products: any[];
40
44
  }>;
45
+ /**
46
+ * 获取订单基础详情
47
+ */
48
+ getOrderBasicDetailAsync(orderId: string): Promise<any>;
41
49
  /**
42
50
  * 初始化钱包数据
43
51
  * 先获取推荐列表,再获取用户识别码列表(顺序执行)
@@ -45,6 +53,9 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
45
53
  initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
46
54
  walletRecommendList: WalletRecommendItem[];
47
55
  userIdentificationCodes: UserIdentificationCodeItem[];
56
+ transformList: any[];
57
+ noApplicableVoucher: any[];
58
+ products: any[];
48
59
  }>;
49
60
  getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
50
61
  formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
@@ -92,6 +103,18 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
92
103
  * 清除搜索结果缓存
93
104
  */
94
105
  clearSearchResults(): void;
106
+ /**
107
+ * 获取存储的钱包初始化数据
108
+ */
109
+ getStoredWalletInitData(): {
110
+ transformList: any[];
111
+ noApplicableVoucher: any[];
112
+ products: any[];
113
+ } | null;
114
+ /**
115
+ * 清除存储的钱包初始化数据
116
+ */
117
+ clearStoredWalletInitData(): void;
95
118
  /**
96
119
  * 清除所有缓存数据
97
120
  */