@pisell/pisellos 2.2.39 → 2.2.41

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 +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/modules/Cart/types.d.ts +0 -2
  4. package/dist/modules/Cart/utils/cartProduct.js +0 -11
  5. package/dist/modules/Discount/types.d.ts +0 -15
  6. package/dist/modules/Payment/index.d.ts +1 -2
  7. package/dist/modules/Payment/index.js +7 -10
  8. package/dist/modules/Payment/utils.js +0 -3
  9. package/dist/modules/Payment/walletpass.d.ts +0 -23
  10. package/dist/modules/Payment/walletpass.js +95 -191
  11. package/dist/modules/Rules/index.d.ts +3 -8
  12. package/dist/modules/Rules/index.js +23 -143
  13. package/dist/modules/Rules/types.d.ts +0 -1
  14. package/dist/modules/Schedule/index.d.ts +9 -0
  15. package/dist/modules/Schedule/index.js +18 -2
  16. package/dist/modules/Summary/types.d.ts +0 -2
  17. package/dist/modules/Summary/utils.d.ts +0 -6
  18. package/dist/modules/Summary/utils.js +0 -21
  19. package/dist/plugins/window.d.ts +0 -2
  20. package/dist/solution/BookingByStep/index.d.ts +0 -1
  21. package/dist/solution/Checkout/index.js +0 -2
  22. package/dist/solution/RegisterAndLogin/config.js +339 -1
  23. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  24. package/dist/solution/ShopDiscount/index.js +3 -13
  25. package/dist/solution/ShopDiscount/types.d.ts +0 -1
  26. package/lib/index.d.ts +0 -1
  27. package/lib/index.js +1 -3
  28. package/lib/modules/Cart/types.d.ts +0 -2
  29. package/lib/modules/Cart/utils/cartProduct.js +0 -9
  30. package/lib/modules/Discount/types.d.ts +0 -15
  31. package/lib/modules/Payment/index.d.ts +1 -2
  32. package/lib/modules/Payment/index.js +0 -1
  33. package/lib/modules/Payment/utils.js +0 -3
  34. package/lib/modules/Payment/walletpass.d.ts +0 -23
  35. package/lib/modules/Payment/walletpass.js +17 -94
  36. package/lib/modules/Rules/index.d.ts +3 -8
  37. package/lib/modules/Rules/index.js +187 -352
  38. package/lib/modules/Rules/types.d.ts +0 -1
  39. package/lib/modules/Schedule/index.d.ts +9 -0
  40. package/lib/modules/Schedule/index.js +11 -0
  41. package/lib/modules/Summary/types.d.ts +0 -2
  42. package/lib/modules/Summary/utils.d.ts +0 -6
  43. package/lib/modules/Summary/utils.js +0 -15
  44. package/lib/plugins/window.d.ts +0 -2
  45. package/lib/solution/BookingByStep/index.d.ts +0 -1
  46. package/lib/solution/Checkout/index.js +0 -2
  47. package/lib/solution/RegisterAndLogin/config.js +265 -1
  48. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  49. package/lib/solution/ShopDiscount/index.js +2 -8
  50. package/lib/solution/ShopDiscount/types.d.ts +0 -1
  51. package/package.json +1 -1
  52. package/dist/model/index.d.ts +0 -1
  53. package/dist/model/index.js +0 -1
  54. package/dist/model/strategy/adapter/index.d.ts +0 -3
  55. package/dist/model/strategy/adapter/index.js +0 -4
  56. package/dist/model/strategy/adapter/type.d.ts +0 -28
  57. package/dist/model/strategy/adapter/type.js +0 -1
  58. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  59. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -497
  60. package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
  61. package/dist/model/strategy/adapter/walletPass/example.js +0 -258
  62. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  63. package/dist/model/strategy/adapter/walletPass/index.js +0 -182
  64. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  65. package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
  66. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -165
  67. package/dist/model/strategy/adapter/walletPass/type.js +0 -1
  68. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  69. package/dist/model/strategy/adapter/walletPass/utils.js +0 -965
  70. package/dist/model/strategy/index.d.ts +0 -94
  71. package/dist/model/strategy/index.js +0 -551
  72. package/dist/model/strategy/strategy-example.d.ts +0 -5
  73. package/dist/model/strategy/strategy-example.js +0 -331
  74. package/dist/model/strategy/type.d.ts +0 -228
  75. package/dist/model/strategy/type.js +0 -94
  76. package/lib/model/index.d.ts +0 -1
  77. package/lib/model/index.js +0 -23
  78. package/lib/model/strategy/adapter/index.d.ts +0 -3
  79. package/lib/model/strategy/adapter/index.js +0 -45
  80. package/lib/model/strategy/adapter/type.d.ts +0 -28
  81. package/lib/model/strategy/adapter/type.js +0 -17
  82. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  83. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -421
  84. package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
  85. package/lib/model/strategy/adapter/walletPass/example.js +0 -207
  86. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  87. package/lib/model/strategy/adapter/walletPass/index.js +0 -142
  88. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  89. package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
  90. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -165
  91. package/lib/model/strategy/adapter/walletPass/type.js +0 -17
  92. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  93. package/lib/model/strategy/adapter/walletPass/utils.js +0 -660
  94. package/lib/model/strategy/index.d.ts +0 -94
  95. package/lib/model/strategy/index.js +0 -413
  96. package/lib/model/strategy/strategy-example.d.ts +0 -5
  97. package/lib/model/strategy/strategy-example.js +0 -318
  98. package/lib/model/strategy/type.d.ts +0 -228
  99. package/lib/model/strategy/type.js +0 -44
@@ -31,7 +31,6 @@ var WalletPassPaymentImpl = class {
31
31
  this.userIdentificationCodes = [];
32
32
  this.searchResults = [];
33
33
  this.walletParams = null;
34
- this.walletInitData = null;
35
34
  }
36
35
  /**
37
36
  * 发送事件的辅助方法
@@ -43,9 +42,7 @@ var WalletPassPaymentImpl = class {
43
42
  const fullEventName = `${this.paymentModule.name}:${eventName}`;
44
43
  this.paymentModule.core.effects.emit(fullEventName, data);
45
44
  } catch (error) {
46
- this.paymentModule.logError("[WalletPass] 发送事件失败", error, {
47
- hook
48
- });
45
+ this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
49
46
  }
50
47
  }
51
48
  /**
@@ -118,10 +115,7 @@ var WalletPassPaymentImpl = class {
118
115
  if (Number(((_a = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _a.totalAmount) || 0) < 0 || Number(((_b = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _b.subTotal) || 0) < 0) {
119
116
  return {
120
117
  walletRecommendList: [],
121
- userIdentificationCodes: [],
122
- transformList: [],
123
- noApplicableVoucher: [],
124
- products: []
118
+ userIdentificationCodes: []
125
119
  };
126
120
  }
127
121
  if ([1, 0].includes((walletParams == null ? void 0 : walletParams.customer_id) || 0)) {
@@ -168,28 +162,11 @@ var WalletPassPaymentImpl = class {
168
162
  endTime,
169
163
  duration
170
164
  });
171
- this.paymentModule.logError(
172
- `[WalletPass] 从业务数据初始化钱包数据失败`,
173
- error,
174
- {
175
- duration: `${duration}ms`,
176
- customer_id: businessData.customer_id,
177
- totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
178
- }
179
- );
180
- throw error;
181
- }
182
- }
183
- /**
184
- * 获取订单基础详情
185
- */
186
- async getOrderBasicDetailAsync(orderId) {
187
- try {
188
- const response = await this.paymentModule.request.get(
189
- `/order/order/${orderId}/basic-detail`
190
- );
191
- return (response == null ? void 0 : response.data) || {};
192
- } catch (error) {
165
+ this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
166
+ duration: `${duration}ms`,
167
+ customer_id: businessData.customer_id,
168
+ totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
169
+ });
193
170
  throw error;
194
171
  }
195
172
  }
@@ -198,49 +175,19 @@ var WalletPassPaymentImpl = class {
198
175
  * 先获取推荐列表,再获取用户识别码列表(顺序执行)
199
176
  */
200
177
  async initializeWalletDataAsync(baseParams) {
201
- var _a, _b;
202
178
  try {
179
+ const walletRecommendList = await this.getWalletPassRecommendListAsync(baseParams);
203
180
  const identificationParams = {
204
181
  ...baseParams,
205
182
  available: 2,
206
- prepare_payments: [],
183
+ prepare_payments: this.formatWalletPassList2PreparePayments(walletRecommendList),
207
184
  other_exact_codes: [],
208
185
  filter_prepare_wallet_pass: 1
209
186
  };
210
- const [allList, orderBasicDetail] = await Promise.all([
211
- this.getUserIdentificationCodeListAsync(identificationParams),
212
- baseParams.payment_order_id ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)
213
- ]);
214
- const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
215
- if (!walletPassEvaluator) {
216
- return {
217
- walletRecommendList: [],
218
- userIdentificationCodes: [],
219
- transformList: [],
220
- noApplicableVoucher: [],
221
- products: []
222
- };
223
- }
224
- const products = (orderBasicDetail == null ? void 0 : orderBasicDetail.detail) || baseParams.products;
225
- const res = walletPassEvaluator == null ? void 0 : walletPassEvaluator.getRecommendedVouchers({
226
- orderTotalAmount: baseParams.order_wait_pay_amount,
227
- products,
228
- vouchers: allList
229
- });
230
- const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
231
- console.log(res, "resres12");
232
- this.walletRecommendList = recommended;
233
- this.walletInitData = {
234
- transformList,
235
- noApplicableVoucher,
236
- products: products || []
237
- };
187
+ const userIdentificationCodes = await this.getUserIdentificationCodeListAsync(identificationParams);
238
188
  return {
239
- walletRecommendList: recommended,
240
- userIdentificationCodes: allList,
241
- transformList,
242
- noApplicableVoucher,
243
- products: products || []
189
+ walletRecommendList,
190
+ userIdentificationCodes
244
191
  };
245
192
  } catch (error) {
246
193
  this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
@@ -323,14 +270,10 @@ var WalletPassPaymentImpl = class {
323
270
  });
324
271
  return this.userIdentificationCodes;
325
272
  } catch (error) {
326
- this.paymentModule.logError(
327
- "[WalletPass] 获取用户识别码列表失败",
328
- error,
329
- {
330
- customer_id: params.customer_id,
331
- available: params.available
332
- }
333
- );
273
+ this.paymentModule.logError("[WalletPass] 获取用户识别码列表失败", error, {
274
+ customer_id: params.customer_id,
275
+ available: params.available
276
+ });
334
277
  return [];
335
278
  }
336
279
  }
@@ -528,19 +471,6 @@ var WalletPassPaymentImpl = class {
528
471
  this.searchResults = [];
529
472
  this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
530
473
  }
531
- /**
532
- * 获取存储的钱包初始化数据
533
- */
534
- getStoredWalletInitData() {
535
- return this.walletInitData;
536
- }
537
- /**
538
- * 清除存储的钱包初始化数据
539
- */
540
- clearStoredWalletInitData() {
541
- this.walletInitData = null;
542
- this.paymentModule.logInfo("[WalletPass] 钱包初始化数据已清除");
543
- }
544
474
  /**
545
475
  * 清除所有缓存数据
546
476
  */
@@ -549,18 +479,11 @@ var WalletPassPaymentImpl = class {
549
479
  this.userIdentificationCodes = [];
550
480
  this.searchResults = [];
551
481
  this.walletParams = null;
552
- this.walletInitData = null;
553
482
  this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
554
483
  clearedTypes: ["all"]
555
484
  });
556
485
  this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
557
- cleared_types: [
558
- "walletRecommendList",
559
- "userIdentificationCodes",
560
- "searchResults",
561
- "walletParams",
562
- "walletInitData"
563
- ]
486
+ cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
564
487
  });
565
488
  }
566
489
  };
@@ -1,26 +1,22 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import { Rules, RulesModuleAPI, DiscountResult } from './types';
4
- import { Discount } from '../Discount/types';
4
+ import { Discount } from "../Discount/types";
5
5
  import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
6
- import { WindowPlugin } from '../../plugins';
7
6
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
8
7
  protected defaultName: string;
9
8
  protected defaultVersion: string;
10
9
  private store;
11
- window: WindowPlugin;
12
10
  private hooks;
13
11
  constructor(name?: string, version?: string);
14
12
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
13
  setRulesList(rulesList: Rules[]): Promise<void>;
16
14
  getRulesList(): Rules[];
17
- getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
18
15
  private checkHolderMatch;
19
- isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, isFormSubject, }: {
16
+ isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, isFormSubject, }: {
20
17
  oldDiscountList: Discount[];
21
18
  newDiscountList: Discount[];
22
19
  productList: any[];
23
- orderTotalAmount: number;
24
20
  holders: {
25
21
  form_record_id: number;
26
22
  }[];
@@ -30,14 +26,13 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
30
26
  discountList: Discount[];
31
27
  productList: any[];
32
28
  };
33
- calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
29
+ calcDiscount({ discountList, productList, holders, isFormSubject, }: {
34
30
  discountList: Discount[];
35
31
  productList: any[];
36
32
  holders: {
37
33
  form_record_id: number;
38
34
  }[];
39
35
  isFormSubject: boolean;
40
- orderTotalAmount: number;
41
36
  }, options?: {
42
37
  isSelected?: boolean;
43
38
  discountId?: number;