@pisell/pisellos 2.2.58 → 2.2.60

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 (49) hide show
  1. package/dist/model/strategy/adapter/index.d.ts +2 -0
  2. package/dist/model/strategy/adapter/index.js +2 -1
  3. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  4. package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
  5. package/dist/model/strategy/adapter/promotion/index.d.ts +206 -0
  6. package/dist/model/strategy/adapter/promotion/index.js +0 -0
  7. package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
  8. package/dist/model/strategy/adapter/promotion/type.js +209 -0
  9. package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -1
  10. package/dist/model/strategy/engine.d.ts +106 -0
  11. package/dist/model/strategy/engine.js +611 -0
  12. package/dist/model/strategy/index.d.ts +2 -93
  13. package/dist/model/strategy/index.js +6 -549
  14. package/dist/modules/BaseModule.d.ts +4 -0
  15. package/dist/modules/BaseModule.js +5 -0
  16. package/dist/modules/Payment/index.js +5 -5
  17. package/dist/modules/Rules/index.d.ts +1 -0
  18. package/dist/modules/Rules/index.js +30 -22
  19. package/dist/modules/Schedule/index.d.ts +2 -2
  20. package/dist/modules/Schedule/index.js +0 -2
  21. package/dist/solution/BookingByStep/index.js +1 -0
  22. package/dist/solution/Checkout/index.js +38 -40
  23. package/lib/model/strategy/adapter/index.d.ts +2 -0
  24. package/lib/model/strategy/adapter/index.js +5 -0
  25. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  26. package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
  27. package/lib/model/strategy/adapter/promotion/index.d.ts +206 -0
  28. package/lib/model/strategy/adapter/promotion/index.js +0 -0
  29. package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
  30. package/lib/model/strategy/adapter/promotion/type.js +51 -0
  31. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -1
  32. package/lib/model/strategy/engine.d.ts +106 -0
  33. package/lib/model/strategy/engine.js +450 -0
  34. package/lib/model/strategy/index.d.ts +2 -93
  35. package/lib/model/strategy/index.js +6 -381
  36. package/lib/modules/BaseModule.d.ts +4 -0
  37. package/lib/modules/BaseModule.js +3 -0
  38. package/lib/modules/Payment/index.js +5 -4
  39. package/lib/modules/Rules/index.d.ts +1 -0
  40. package/lib/modules/Rules/index.js +25 -23
  41. package/lib/modules/Schedule/index.d.ts +2 -2
  42. package/lib/modules/Schedule/index.js +0 -2
  43. package/lib/solution/BookingByStep/index.js +1 -0
  44. package/lib/solution/Checkout/index.js +4 -5
  45. package/package.json +1 -1
  46. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  47. package/dist/modules/Schedule/getDateIsInSchedule.js +0 -747
  48. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  49. package/lib/modules/Schedule/getDateIsInSchedule.js +0 -451
@@ -507,7 +507,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
507
507
  */
508
508
  async updateLocalOrderAsync(params) {
509
509
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
510
- this.payment.wallet.clearAllCache();
511
510
  this.logInfo("updateLocalOrderAsync called", {
512
511
  orderId: params.orderId,
513
512
  orderDataType: (_a = params.orderData) == null ? void 0 : _a.type,
@@ -606,7 +605,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
606
605
  });
607
606
  const syncedPayments = updated2.payment.filter((p) => p.isSynced && p.status !== "voided");
608
607
  const syncedAmount2 = syncedPayments.reduce((sum, p) => {
609
- let amt = new import_decimal.default(p.amount || "0");
608
+ const amt = new import_decimal.default(p.amount || "0");
610
609
  const rounding = new import_decimal.default(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || "0").abs();
611
610
  return sum.plus(amt).plus(rounding);
612
611
  }, new import_decimal.default(0));
@@ -2029,9 +2028,9 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2029
2028
  */
2030
2029
  calculatePaidAmountFromItems(payments) {
2031
2030
  const paidAmount = payments.filter((payment) => payment.status !== "voided").reduce((sum, payment) => {
2032
- const paymentAmount = new import_decimal.default(payment.amount || 0);
2033
- const roundingAmount = new import_decimal.default(payment.rounding_amount || 0);
2034
- const effectiveAmount = paymentAmount.minus(roundingAmount);
2031
+ const amount = new import_decimal.default(payment.amount || "0");
2032
+ const roundingAmount = new import_decimal.default(payment.rounding_amount || "0");
2033
+ const effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
2035
2034
  return sum.add(effectiveAmount);
2036
2035
  }, new import_decimal.default(0));
2037
2036
  return paidAmount.toFixed(2);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.58",
4
+ "version": "2.2.60",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1,32 +0,0 @@
1
- import dayjs from "dayjs";
2
- import { ScheduleItem } from "./types";
3
- export declare const getDateIsInSchedule: (dateTime: string, scheduleList: ScheduleItem[]) => boolean;
4
- export type ScheduleTimeSlot = {
5
- /** 开始时间 HH:mm */
6
- start_time: string;
7
- /** 结束时间 HH:mm */
8
- end_time: string;
9
- /** 开始日期时间 YYYY-MM-DD HH:mm:ss */
10
- start_at: dayjs.Dayjs;
11
- /** 结束日期时间 YYYY-MM-DD HH:mm:ss */
12
- end_at: dayjs.Dayjs;
13
- };
14
- /**
15
- * 获取当前日期日程时间点
16
- * @param date 日期 YYYY-MM-DD
17
- * @param scheduleList 日程列表
18
- * @returns 当前日期日程时间点 结构,数组 [{
19
- *
20
- * // HH:mm
21
- * end_time: string,
22
- * // HH:mm
23
- * start_time: string,
24
- * // 日期时间
25
- * // YYYY-MM-DD HH:mm:ss
26
- * end_at: Dayjs,
27
- * // YYYY-MM-DD HH:mm:ss
28
- * start_at: Dayjs,
29
- *
30
- * }]
31
- */
32
- export declare const getScheduleStartEndTimePoints: (date: string, scheduleList: ScheduleItem[]) => ScheduleTimeSlot[];