@pisell/pisellos 2.2.42 → 2.2.43

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 (99) 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/types.d.ts +15 -0
  30. package/dist/modules/Payment/index.d.ts +2 -1
  31. package/dist/modules/Payment/index.js +10 -7
  32. package/dist/modules/Payment/utils.js +3 -0
  33. package/dist/modules/Payment/walletpass.d.ts +23 -0
  34. package/dist/modules/Payment/walletpass.js +196 -95
  35. package/dist/modules/Rules/index.d.ts +8 -3
  36. package/dist/modules/Rules/index.js +143 -23
  37. package/dist/modules/Rules/types.d.ts +1 -0
  38. package/dist/modules/Schedule/index.d.ts +0 -9
  39. package/dist/modules/Schedule/index.js +2 -18
  40. package/dist/modules/Summary/types.d.ts +2 -0
  41. package/dist/modules/Summary/utils.d.ts +6 -0
  42. package/dist/modules/Summary/utils.js +21 -0
  43. package/dist/plugins/window.d.ts +2 -0
  44. package/dist/solution/BookingByStep/index.d.ts +1 -0
  45. package/dist/solution/Checkout/index.js +24 -23
  46. package/dist/solution/RegisterAndLogin/config.js +1 -339
  47. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  48. package/dist/solution/ShopDiscount/index.js +13 -3
  49. package/dist/solution/ShopDiscount/types.d.ts +1 -0
  50. package/lib/index.d.ts +1 -0
  51. package/lib/index.js +3 -1
  52. package/lib/model/index.d.ts +1 -0
  53. package/lib/model/index.js +23 -0
  54. package/lib/model/strategy/adapter/index.d.ts +3 -0
  55. package/lib/model/strategy/adapter/index.js +45 -0
  56. package/lib/model/strategy/adapter/type.d.ts +28 -0
  57. package/lib/model/strategy/adapter/type.js +17 -0
  58. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  59. package/lib/model/strategy/adapter/walletPass/evaluator.js +421 -0
  60. package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
  61. package/lib/model/strategy/adapter/walletPass/example.js +207 -0
  62. package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
  63. package/lib/model/strategy/adapter/walletPass/index.js +142 -0
  64. package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  65. package/lib/model/strategy/adapter/walletPass/locales.js +51 -0
  66. package/lib/model/strategy/adapter/walletPass/type.d.ts +165 -0
  67. package/lib/model/strategy/adapter/walletPass/type.js +17 -0
  68. package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  69. package/lib/model/strategy/adapter/walletPass/utils.js +660 -0
  70. package/lib/model/strategy/index.d.ts +94 -0
  71. package/lib/model/strategy/index.js +413 -0
  72. package/lib/model/strategy/strategy-example.d.ts +5 -0
  73. package/lib/model/strategy/strategy-example.js +318 -0
  74. package/lib/model/strategy/type.d.ts +228 -0
  75. package/lib/model/strategy/type.js +44 -0
  76. package/lib/modules/Cart/types.d.ts +2 -0
  77. package/lib/modules/Cart/utils/cartProduct.js +9 -0
  78. package/lib/modules/Discount/types.d.ts +15 -0
  79. package/lib/modules/Payment/index.d.ts +2 -1
  80. package/lib/modules/Payment/index.js +1 -0
  81. package/lib/modules/Payment/utils.js +3 -0
  82. package/lib/modules/Payment/walletpass.d.ts +23 -0
  83. package/lib/modules/Payment/walletpass.js +99 -17
  84. package/lib/modules/Rules/index.d.ts +8 -3
  85. package/lib/modules/Rules/index.js +352 -187
  86. package/lib/modules/Rules/types.d.ts +1 -0
  87. package/lib/modules/Schedule/index.d.ts +0 -9
  88. package/lib/modules/Schedule/index.js +0 -11
  89. package/lib/modules/Summary/types.d.ts +2 -0
  90. package/lib/modules/Summary/utils.d.ts +6 -0
  91. package/lib/modules/Summary/utils.js +15 -0
  92. package/lib/plugins/window.d.ts +2 -0
  93. package/lib/solution/BookingByStep/index.d.ts +1 -0
  94. package/lib/solution/Checkout/index.js +3 -3
  95. package/lib/solution/RegisterAndLogin/config.js +1 -265
  96. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  97. package/lib/solution/ShopDiscount/index.js +8 -2
  98. package/lib/solution/ShopDiscount/types.d.ts +1 -0
  99. package/package.json +1 -1
@@ -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;
@@ -105,6 +107,19 @@ export interface Discount {
105
107
  isSelected?: boolean;
106
108
  isAvailable?: boolean;
107
109
  isUsed?: boolean;
110
+ config?: {
111
+ isAvailable?: boolean;
112
+ /** 最大抵扣金额 */
113
+ maxDeductionAmount?: number;
114
+ /** 每单最多使用张数 */
115
+ maxUsagePerOrder?: number;
116
+ /** 是否抵扣税费与附加费 */
117
+ deductTaxAndFee?: boolean;
118
+ /** 适用粒度(多商品共用) */
119
+ allowCrossProduct?: boolean;
120
+ /** 可用商品数量上限 */
121
+ applicableProductLimit?: number;
122
+ };
108
123
  applicableProductIds?: number[];
109
124
  applicableProductDetails: ApplicableProductDetails[];
110
125
  appliedProductDetails: ApplicableProductDetails[];
@@ -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
  private voucherUpdateLockByOrderUuid;
@@ -96,6 +96,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
96
96
  _defineProperty(_assertThisInitialized(_this), "app", void 0);
97
97
  // App instance
98
98
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
99
+ _defineProperty(_assertThisInitialized(_this), "window", void 0);
100
+ // WindowPlugin 实例
99
101
  _defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
100
102
  // IndexDBManager 实例
101
103
  _defineProperty(_assertThisInitialized(_this), "logger", void 0);
@@ -170,26 +172,27 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
170
172
  // 获取依赖的插件
171
173
  this.request = core.getPlugin('request');
172
174
  appPlugin = core.getPlugin('app');
175
+ this.window = core.getPlugin('window');
173
176
  if (this.request) {
174
- _context.next = 7;
177
+ _context.next = 8;
175
178
  break;
176
179
  }
177
180
  throw new Error('支付模块需要 request 插件支持');
178
- case 7:
181
+ case 8:
179
182
  if (appPlugin) {
180
- _context.next = 9;
183
+ _context.next = 10;
181
184
  break;
182
185
  }
183
186
  throw new Error('支付模块需要 app 插件支持');
184
- case 9:
187
+ case 10:
185
188
  this.app = appPlugin.getApp();
186
189
  this.dbManager = this.app.dbManager;
187
190
  this.logger = this.app.logger;
188
191
 
189
192
  // 确保支付模块所需的对象存储已创建
190
- _context.next = 14;
193
+ _context.next = 15;
191
194
  return this.ensurePaymentTables();
192
- case 14:
195
+ case 15:
193
196
  this.registerNetworkHandlers();
194
197
 
195
198
  // // 预连接数据库
@@ -197,7 +200,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
197
200
 
198
201
  console.log('[PaymentModule] 初始化完成');
199
202
  this.logInfo('PaymentModule initialized successfully');
200
- case 17:
203
+ case 18:
201
204
  case "end":
202
205
  return _context.stop();
203
206
  }
@@ -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
  */