@pisell/pisellos 2.1.82 → 2.1.83

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 (97) 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/index.d.ts +1 -0
  6. package/dist/modules/Discount/index.js +2 -1
  7. package/dist/modules/Discount/types.d.ts +0 -15
  8. package/dist/modules/Payment/index.d.ts +1 -2
  9. package/dist/modules/Payment/index.js +7 -10
  10. package/dist/modules/Payment/utils.js +0 -3
  11. package/dist/modules/Payment/walletpass.d.ts +0 -23
  12. package/dist/modules/Payment/walletpass.js +95 -191
  13. package/dist/modules/Rules/index.d.ts +2 -7
  14. package/dist/modules/Rules/index.js +19 -141
  15. package/dist/modules/Rules/types.d.ts +0 -1
  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/ShopDiscount/index.d.ts +0 -1
  23. package/dist/solution/ShopDiscount/index.js +3 -12
  24. package/dist/solution/ShopDiscount/types.d.ts +0 -1
  25. package/lib/index.d.ts +0 -1
  26. package/lib/index.js +1 -3
  27. package/lib/modules/Cart/types.d.ts +0 -2
  28. package/lib/modules/Cart/utils/cartProduct.js +0 -9
  29. package/lib/modules/Discount/index.d.ts +1 -0
  30. package/lib/modules/Discount/index.js +2 -1
  31. package/lib/modules/Discount/types.d.ts +0 -15
  32. package/lib/modules/Payment/index.d.ts +1 -2
  33. package/lib/modules/Payment/index.js +0 -1
  34. package/lib/modules/Payment/utils.js +0 -3
  35. package/lib/modules/Payment/walletpass.d.ts +0 -23
  36. package/lib/modules/Payment/walletpass.js +17 -94
  37. package/lib/modules/Rules/index.d.ts +2 -7
  38. package/lib/modules/Rules/index.js +149 -285
  39. package/lib/modules/Rules/types.d.ts +0 -1
  40. package/lib/modules/Summary/types.d.ts +0 -2
  41. package/lib/modules/Summary/utils.d.ts +0 -6
  42. package/lib/modules/Summary/utils.js +0 -15
  43. package/lib/plugins/window.d.ts +0 -2
  44. package/lib/solution/BookingByStep/index.d.ts +0 -1
  45. package/lib/solution/Checkout/index.js +0 -2
  46. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  47. package/lib/solution/ShopDiscount/index.js +2 -7
  48. package/lib/solution/ShopDiscount/types.d.ts +0 -1
  49. package/package.json +1 -1
  50. package/dist/model/index.d.ts +0 -1
  51. package/dist/model/index.js +0 -1
  52. package/dist/model/strategy/adapter/index.d.ts +0 -3
  53. package/dist/model/strategy/adapter/index.js +0 -4
  54. package/dist/model/strategy/adapter/type.d.ts +0 -28
  55. package/dist/model/strategy/adapter/type.js +0 -1
  56. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  57. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -497
  58. package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
  59. package/dist/model/strategy/adapter/walletPass/example.js +0 -258
  60. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  61. package/dist/model/strategy/adapter/walletPass/index.js +0 -182
  62. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  63. package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
  64. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -165
  65. package/dist/model/strategy/adapter/walletPass/type.js +0 -1
  66. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  67. package/dist/model/strategy/adapter/walletPass/utils.js +0 -965
  68. package/dist/model/strategy/index.d.ts +0 -94
  69. package/dist/model/strategy/index.js +0 -551
  70. package/dist/model/strategy/strategy-example.d.ts +0 -5
  71. package/dist/model/strategy/strategy-example.js +0 -331
  72. package/dist/model/strategy/type.d.ts +0 -228
  73. package/dist/model/strategy/type.js +0 -94
  74. package/lib/model/index.d.ts +0 -1
  75. package/lib/model/index.js +0 -23
  76. package/lib/model/strategy/adapter/index.d.ts +0 -3
  77. package/lib/model/strategy/adapter/index.js +0 -45
  78. package/lib/model/strategy/adapter/type.d.ts +0 -28
  79. package/lib/model/strategy/adapter/type.js +0 -17
  80. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  81. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -421
  82. package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
  83. package/lib/model/strategy/adapter/walletPass/example.js +0 -207
  84. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  85. package/lib/model/strategy/adapter/walletPass/index.js +0 -142
  86. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  87. package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
  88. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -165
  89. package/lib/model/strategy/adapter/walletPass/type.js +0 -17
  90. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  91. package/lib/model/strategy/adapter/walletPass/utils.js +0 -660
  92. package/lib/model/strategy/index.d.ts +0 -94
  93. package/lib/model/strategy/index.js +0 -413
  94. package/lib/model/strategy/strategy-example.d.ts +0 -5
  95. package/lib/model/strategy/strategy-example.js +0 -318
  96. package/lib/model/strategy/type.d.ts +0 -228
  97. package/lib/model/strategy/type.js +0 -44
@@ -31,7 +31,6 @@ export interface RulesModuleAPI {
31
31
  holders: {
32
32
  form_record_id: number;
33
33
  }[];
34
- orderTotalAmount: number;
35
34
  isFormSubject: boolean;
36
35
  }) => DiscountResult;
37
36
  }
@@ -6,8 +6,6 @@ export interface ISummaryState {
6
6
  subtotal: string | number;
7
7
  /** 最终总价 */
8
8
  total: string | number;
9
- /** 最终原始价格 不包含折扣卡商品券折扣 */
10
- originTotal: string | number;
11
9
  /** 税率标题 */
12
10
  taxTitle?: string;
13
11
  /** 商品总费率 */
@@ -58,12 +58,6 @@ export declare const getTax: ({ service, addons, bookingDetail, bookingId }: {
58
58
  * @returns 商品总价字符串,保留2位小数
59
59
  */
60
60
  export declare const calculateSubtotal: (items: CartItem[]) => string;
61
- /**
62
- * 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
63
- * @param items - 购物车商品数组
64
- * @returns 商品总价字符串,保留2位小数
65
- */
66
- export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
67
61
  /**
68
62
  * @title: 单个商品的税费
69
63
  * @description:
@@ -31,7 +31,6 @@ var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  calcDiscountListDifference: () => calcDiscountListDifference,
33
33
  calculateDeposit: () => calculateDeposit,
34
- calculateOriginSubtotal: () => calculateOriginSubtotal,
35
34
  calculatePriceDetails: () => calculatePriceDetails,
36
35
  calculateSubtotal: () => calculateSubtotal,
37
36
  calculateTaxFee: () => calculateTaxFee,
@@ -45,7 +44,6 @@ module.exports = __toCommonJS(utils_exports);
45
44
  var import_decimal = __toESM(require("decimal.js"));
46
45
  var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList) => {
47
46
  const subtotal = new import_decimal.default(calculateSubtotal(items));
48
- const subOriginTotal = new import_decimal.default(calculateOriginSubtotal(items));
49
47
  const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
50
48
  const surcharge = getSurcharge({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate, surcharge_list: surchargeList, scheduleById: {} });
51
49
  const surchargeAmount = new import_decimal.default(getSurchargeAmount({ bookingDetail: null, bookingId: void 0 }, surcharge, { isEdit: false }));
@@ -59,12 +57,10 @@ var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList)
59
57
  is_price_include_tax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax
60
58
  });
61
59
  const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
62
- const originTotal = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
63
60
  const deposit = calculateDeposit(items);
64
61
  return {
65
62
  subtotal: subtotal.toFixed(2),
66
63
  total: total.toFixed(2),
67
- originTotal: originTotal.toFixed(2),
68
64
  taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
69
65
  taxRate: shopInfo == null ? void 0 : shopInfo.tax_rate,
70
66
  totalTaxFee: tax,
@@ -362,16 +358,6 @@ var calculateSubtotal = (items) => {
362
358
  }, new import_decimal.default(0));
363
359
  return subtotal.toFixed(2);
364
360
  };
365
- var calculateOriginSubtotal = (items) => {
366
- if (!(items == null ? void 0 : items.length)) {
367
- return "0.00";
368
- }
369
- const subtotal = items.reduce((sum, item) => {
370
- const cartItemTotalPrice = new import_decimal.default(item.summaryOriginTotal || 0);
371
- return sum.plus(cartItemTotalPrice);
372
- }, new import_decimal.default(0));
373
- return subtotal.toFixed(2);
374
- };
375
361
  var calculateTaxFee = (shopInfo, items) => {
376
362
  if (!(items == null ? void 0 : items.length)) {
377
363
  return "0.00";
@@ -790,7 +776,6 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
790
776
  0 && (module.exports = {
791
777
  calcDiscountListDifference,
792
778
  calculateDeposit,
793
- calculateOriginSubtotal,
794
779
  calculatePriceDetails,
795
780
  calculateSubtotal,
796
781
  calculateTaxFee,
@@ -1,4 +1,3 @@
1
- import { WalletPassEvaluator } from '../model';
2
1
  import { Plugin } from '../types';
3
2
  /**
4
3
  * WindowPlugin 接口定义
@@ -15,7 +14,6 @@ export interface WindowPlugin extends Plugin {
15
14
  document: Partial<Document>;
16
15
  history: History;
17
16
  interaction?: any;
18
- getWalletPassEvaluator?: () => WalletPassEvaluator;
19
17
  }
20
18
  /**
21
19
  * 简单的 Storage 接口实现
@@ -144,7 +144,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
144
144
  getSummary(): Promise<{
145
145
  subtotal: string | number;
146
146
  total: string | number;
147
- originTotal: string | number;
148
147
  taxTitle?: string | undefined;
149
148
  totalTaxFee?: string | number | undefined;
150
149
  isPriceIncludeTax?: 0 | 1 | undefined;
@@ -222,7 +222,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
222
222
  product_id: item.product_id,
223
223
  product_variant_id: item.product_variant_id,
224
224
  quantity: item.num,
225
- is_price_include_tax: item.is_price_include_tax,
226
225
  // 商品是否含税:1;0
227
226
  is_charge_tax: item.is_charge_tax ?? 0,
228
227
  // 若商品不含税,计算得到的税费,单位(元)
@@ -247,7 +246,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
247
246
  },
248
247
  product_bundle: item.product_bundle.map((bundle) => {
249
248
  return {
250
- is_price_include_tax: item.is_price_include_tax,
251
249
  bundle_id: bundle.bundle_id,
252
250
  bundle_product_id: bundle.bundle_product_id,
253
251
  bundle_variant_id: bundle.bundle_variant_id,
@@ -22,7 +22,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
22
22
  getCurrentBookingTime(): string | null;
23
23
  private filterDiscountListByBookingTime;
24
24
  setCustomer(customer: Customer): Promise<void>;
25
- setOriginTotalAmount(amount: number): void;
26
25
  setHolders(holders: {
27
26
  form_record_id: number;
28
27
  }[]): void;
@@ -56,7 +56,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
56
56
  originalDiscountList: [],
57
57
  currentBookingTime: "",
58
58
  filteredDiscountList: [],
59
- orderTotalAmount: 0,
60
59
  bookingSubject: void 0
61
60
  };
62
61
  }
@@ -195,9 +194,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
195
194
  );
196
195
  }
197
196
  }
198
- setOriginTotalAmount(amount) {
199
- this.store.orderTotalAmount = amount;
200
- }
201
197
  // 设置holders
202
198
  setHolders(holders) {
203
199
  this.store.holders = holders;
@@ -218,7 +214,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
218
214
  productList,
219
215
  discountList: this.getDiscountList(),
220
216
  holders: this.store.holders || [],
221
- orderTotalAmount: this.store.orderTotalAmount || 0,
222
217
  isFormSubject: ((_a = this.store.bookingSubject) == null ? void 0 : _a.type) === "form"
223
218
  },
224
219
  options
@@ -312,7 +307,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
312
307
  oldDiscountList: this.getDiscountList(),
313
308
  newDiscountList: withScanList,
314
309
  holders: this.store.holders || [],
315
- orderTotalAmount: this.store.orderTotalAmount || 0,
316
310
  isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
317
311
  }) || {
318
312
  isAvailable: false,
@@ -501,7 +495,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
501
495
  action: "create",
502
496
  with_good_pass: 1,
503
497
  with_discount_card: 1,
504
- with_wallet_pass_holder: 1
498
+ with_wallet_pass_holder: 1,
499
+ request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
505
500
  }));
506
501
  const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
507
502
  (item) => item.isScan
@@ -31,7 +31,6 @@ export interface ShopDiscountState {
31
31
  originalDiscountList: Discount[];
32
32
  currentBookingTime: string | null;
33
33
  filteredDiscountList: Discount[];
34
- orderTotalAmount?: number;
35
34
  bookingSubject?: {
36
35
  type?: 'form' | 'customer';
37
36
  [key: string]: any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.82",
4
+ "version": "2.1.83",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- export * from './strategy';
@@ -1 +0,0 @@
1
- export * from "./strategy";
@@ -1,3 +0,0 @@
1
- export * from './type';
2
- export { default as WalletPassAdapter } from './walletPass';
3
- export { WalletPassEvaluator } from './walletPass/evaluator';
@@ -1,4 +0,0 @@
1
- export * from "./type";
2
- export { default as WalletPassAdapter } from "./walletPass";
3
- export { WalletPassEvaluator } from "./walletPass/evaluator";
4
- // export * from './walletPass/type';
@@ -1,28 +0,0 @@
1
- import { EvaluationResult, RuntimeContext } from '../type';
2
- export interface BusinessAdapter {
3
- /**
4
- * 适配器名称
5
- */
6
- name: string;
7
- /**
8
- * 适配器版本
9
- */
10
- version: string;
11
- /**
12
- * 准备运行时上下文
13
- * 将业务数据转换为策略引擎可识别的上下文
14
- */
15
- prepareContext(businessData: any): RuntimeContext;
16
- /**
17
- * 转换执行结果
18
- * 将策略引擎的通用结果转换为业务层需要的格式
19
- */
20
- transformResult(result: EvaluationResult, businessData?: any): any;
21
- /**
22
- * 根据业务数据重新格式化配置
23
- */
24
- formatConfig(result: EvaluationResult, businessData?: any): {
25
- result: EvaluationResult;
26
- businessData?: any;
27
- };
28
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,84 +0,0 @@
1
- import { StrategyConfig } from '../../type';
2
- import { Voucher, Product, VoucherEvaluationResult, EvaluatorInput } from './type';
3
- /**
4
- * Wallet Pass 评估器
5
- * 用于评估哪些 voucher 可以在当前订单中使用
6
- */
7
- export declare class WalletPassEvaluator {
8
- private engine;
9
- private strategyConfigs;
10
- private locale;
11
- constructor();
12
- setStrategyConfigs(strategyConfigs: StrategyConfig[]): void;
13
- getStrategyConfigs(): StrategyConfig[];
14
- setLocale(locale: string): void;
15
- getText(key: string): string;
16
- /**
17
- * 搜索券的格式
18
- * @param input 输入
19
- * @returns 返回搜索券的格式
20
- */
21
- searchVoucherFormat(input: EvaluatorInput): Voucher[];
22
- /**
23
- * 评估可用的 vouchers
24
- */
25
- evaluate(input: EvaluatorInput): VoucherEvaluationResult[];
26
- /** 检查代金券/折扣卡是否可用 并返回config */
27
- checkVoucherAvailability(input: EvaluatorInput): {
28
- isAvailable: boolean;
29
- config: {
30
- [x: string]: any;
31
- };
32
- };
33
- /**
34
- * 获取推荐券
35
- * @param input 输入
36
- * @returns 返回推荐券列表
37
- */
38
- getRecommendedVouchers(input: EvaluatorInput): {
39
- recommendedAmount: any;
40
- recommended: any[];
41
- transformList: any[];
42
- noApplicableVoucher: Voucher[];
43
- };
44
- enhanceWithReason(voucher: any): any;
45
- /**
46
- * 优惠券处理函数
47
- * @param applicableVouchers 可用的券列表
48
- * @param orderTotalAmount 订单总金额
49
- * @param products 订单商品列表
50
- * @returns 返回推荐券列表和全部列表,每个券包含 _available_max_amount 和 _unified_available_status
51
- */
52
- processVouchers(vouchers: Voucher[], orderTotalAmount: number, products: Product[]): {
53
- recommended: any[];
54
- transformList: any[];
55
- };
56
- /**
57
- * 重新计算优惠券状态(基于已选券的增量计算)
58
- * @param allVouchers 所有原始券列表
59
- * @param selectedVouchers 已选中的券列表(按选中顺序)
60
- * @param orderTotalAmount 订单总金额
61
- * @param products 订单商品列表
62
- * @returns 返回更新后的所有券列表和已选券的详细抵扣信息
63
- */
64
- recalculateVouchers(allVouchers: any[], selectedVouchers: any[], orderTotalAmount: number, products: any[]): {
65
- allWithUpdatedStatus: any[];
66
- selectedWithDetails: any[];
67
- };
68
- /**
69
- * 查找适用于指定 voucher 的策略配置
70
- */
71
- private findApplicableStrategies;
72
- /**
73
- * 检查策略中是否包含指定的 voucher ID
74
- */
75
- private checkVoucherInStrategy;
76
- /**
77
- * 递归检查条件组中是否包含 voucher ID
78
- */
79
- private checkVoucherInConditionGroup;
80
- /**
81
- * 计算适用商品的总金额和数量
82
- */
83
- private calculateApplicableProducts;
84
- }