@pisell/pisellos 1.0.147 → 1.0.148

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 (107) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/model/strategy/adapter/itemRule/type.d.ts +6 -6
  3. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  4. package/dist/model/strategy/adapter/promotion/type.d.ts +5 -5
  5. package/dist/model/strategy/type.d.ts +1 -1
  6. package/dist/modules/Customer/types.d.ts +1 -1
  7. package/dist/modules/Discount/types.d.ts +1 -1
  8. package/dist/modules/Payment/types.d.ts +7 -7
  9. package/dist/modules/Product/index.d.ts +1 -1
  10. package/dist/modules/Rules/index.js +2 -1
  11. package/dist/modules/Rules/types.d.ts +1 -1
  12. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  13. package/dist/modules/Schedule/type.d.ts +7 -7
  14. package/dist/modules/Schedule/types.d.ts +9 -9
  15. package/dist/solution/BookingByStep/index.d.ts +1 -1
  16. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  17. package/dist/solution/BookingTicket/index.d.ts +1 -1
  18. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  19. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  20. package/dist/types/index.d.ts +1 -1
  21. package/dist/utils/task.d.ts +2 -2
  22. package/dist/utils/watch.d.ts +2 -2
  23. package/lib/core/index.js +27 -28
  24. package/lib/effects/index.d.ts +2 -2
  25. package/lib/effects/index.js +3 -7
  26. package/lib/model/strategy/adapter/itemRule/adapter.js +7 -14
  27. package/lib/model/strategy/adapter/itemRule/evaluator.js +5 -5
  28. package/lib/model/strategy/adapter/itemRule/examples.js +12 -12
  29. package/lib/model/strategy/adapter/itemRule/type.d.ts +6 -6
  30. package/lib/model/strategy/adapter/promotion/adapter.js +2 -4
  31. package/lib/model/strategy/adapter/promotion/evaluator.js +16 -19
  32. package/lib/model/strategy/adapter/promotion/examples.js +8 -8
  33. package/lib/model/strategy/adapter/promotion/type.d.ts +5 -5
  34. package/lib/model/strategy/adapter/walletPass/evaluator.js +5 -5
  35. package/lib/model/strategy/adapter/walletPass/example.js +21 -21
  36. package/lib/model/strategy/adapter/walletPass/index.js +2 -4
  37. package/lib/model/strategy/adapter/walletPass/locales.js +18 -18
  38. package/lib/model/strategy/adapter/walletPass/utils.js +21 -42
  39. package/lib/model/strategy/engine.js +6 -8
  40. package/lib/model/strategy/strategy-example.js +19 -19
  41. package/lib/model/strategy/type.d.ts +1 -1
  42. package/lib/modules/Account/index.js +9 -10
  43. package/lib/modules/AccountList/index.js +14 -11
  44. package/lib/modules/BaseModule.js +6 -3
  45. package/lib/modules/Cart/index.js +14 -9
  46. package/lib/modules/Cart/utils/cartProduct.js +3 -6
  47. package/lib/modules/Customer/constants.js +1 -1
  48. package/lib/modules/Customer/index.js +18 -15
  49. package/lib/modules/Customer/types.d.ts +1 -1
  50. package/lib/modules/Date/index.js +10 -6
  51. package/lib/modules/Date/types.js +1 -0
  52. package/lib/modules/Discount/index.js +11 -6
  53. package/lib/modules/Discount/types.d.ts +1 -1
  54. package/lib/modules/Guests/index.js +10 -15
  55. package/lib/modules/Order/index.js +10 -7
  56. package/lib/modules/Payment/cash.js +1 -1
  57. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  58. package/lib/modules/Payment/eftpos.js +1 -1
  59. package/lib/modules/Payment/index.js +86 -73
  60. package/lib/modules/Payment/types.d.ts +7 -7
  61. package/lib/modules/Payment/utils.js +3 -6
  62. package/lib/modules/Payment/walletpass.js +33 -33
  63. package/lib/modules/Product/index.d.ts +1 -1
  64. package/lib/modules/Product/index.js +6 -5
  65. package/lib/modules/ProductList/index.js +5 -3
  66. package/lib/modules/Resource/index.js +8 -12
  67. package/lib/modules/Rules/index.js +24 -36
  68. package/lib/modules/Rules/types.d.ts +1 -1
  69. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  70. package/lib/modules/Schedule/index.js +8 -5
  71. package/lib/modules/Schedule/type.d.ts +7 -7
  72. package/lib/modules/Schedule/types.d.ts +9 -9
  73. package/lib/modules/Schedule/utils.js +2 -4
  74. package/lib/modules/Step/index.js +7 -4
  75. package/lib/modules/Summary/index.js +9 -4
  76. package/lib/modules/Summary/utils.js +8 -16
  77. package/lib/plugins/request.js +34 -33
  78. package/lib/plugins/window.js +101 -113
  79. package/lib/solution/BookingByStep/index.d.ts +1 -1
  80. package/lib/solution/BookingByStep/index.js +110 -177
  81. package/lib/solution/BookingByStep/utils/capacity.js +10 -15
  82. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  83. package/lib/solution/BookingByStep/utils/resources.js +4 -8
  84. package/lib/solution/BookingByStep/utils/stock.js +3 -6
  85. package/lib/solution/BookingByStep/utils/timeslots.js +26 -31
  86. package/lib/solution/BookingTicket/index.d.ts +1 -1
  87. package/lib/solution/BookingTicket/index.js +19 -14
  88. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  89. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  90. package/lib/solution/BookingTicket/utils/scan/index.js +3 -1
  91. package/lib/solution/BookingTicket/utils/scan/scanCache.js +10 -9
  92. package/lib/solution/BuyTickets/index.js +15 -15
  93. package/lib/solution/Checkout/index.js +216 -211
  94. package/lib/solution/Checkout/utils/index.js +18 -22
  95. package/lib/solution/RegisterAndLogin/config.js +2 -2
  96. package/lib/solution/RegisterAndLogin/index.js +114 -110
  97. package/lib/solution/RegisterAndLogin/utils.js +9 -9
  98. package/lib/solution/ShopDiscount/index.js +16 -13
  99. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  100. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  101. package/lib/solution/ShopDiscount/utils.js +1 -2
  102. package/lib/types/index.d.ts +1 -1
  103. package/lib/utils/task.d.ts +2 -2
  104. package/lib/utils/task.js +3 -3
  105. package/lib/utils/watch.d.ts +2 -2
  106. package/lib/utils/watch.js +5 -7
  107. package/package.json +16 -17
@@ -25,13 +25,13 @@ module.exports = __toCommonJS(Guests_exports);
25
25
  var import_BaseModule = require("../BaseModule");
26
26
  var import_types = require("./types");
27
27
  var GuestListModule = class extends import_BaseModule.BaseModule {
28
+ defaultName = "guestList";
29
+ defaultVersion = "1.0.0";
30
+ state = {
31
+ list: []
32
+ };
28
33
  constructor(name, version) {
29
34
  super(name, version);
30
- this.defaultName = "guestList";
31
- this.defaultVersion = "1.0.0";
32
- this.state = {
33
- list: []
34
- };
35
35
  }
36
36
  async initialize(core, options) {
37
37
  this.core = core;
@@ -46,8 +46,7 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
46
46
  }
47
47
  async updateGuest(id, updates) {
48
48
  const index = this.state.list.findIndex((g) => g.id === id);
49
- if (index === -1)
50
- return;
49
+ if (index === -1) return;
51
50
  this.state.list[index] = {
52
51
  ...this.state.list[index],
53
52
  ...updates
@@ -60,8 +59,7 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
60
59
  }
61
60
  async removeGuest(id) {
62
61
  const index = this.state.list.findIndex((g) => g.id === id);
63
- if (index === -1)
64
- return;
62
+ if (index === -1) return;
65
63
  const [removed] = this.state.list.splice(index, 1);
66
64
  await this.core.effects.emit(`${this.name}:onGuestRemove`, removed);
67
65
  await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
@@ -74,19 +72,16 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
74
72
  }
75
73
  async addItemToGuest(guestId, item) {
76
74
  const guest = this.state.list.find((g) => g.id === guestId);
77
- if (!guest)
78
- return;
75
+ if (!guest) return;
79
76
  guest.items.push(item);
80
77
  await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
81
78
  await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
82
79
  }
83
80
  async removeItemFromGuest(guestId, itemId) {
84
81
  const guest = this.state.list.find((g) => g.id === guestId);
85
- if (!guest)
86
- return;
82
+ if (!guest) return;
87
83
  const index = guest.items.findIndex((i) => i.id === itemId);
88
- if (index === -1)
89
- return;
84
+ if (index === -1) return;
90
85
  guest.items.splice(index, 1);
91
86
  await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
92
87
  await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
@@ -37,11 +37,14 @@ var import_utils = require("./utils");
37
37
  var import_utils2 = require("../Product/utils");
38
38
  var import_dayjs = __toESM(require("dayjs"));
39
39
  var OrderModule = class extends import_BaseModule.BaseModule {
40
+ defaultName = "order";
41
+ defaultVersion = "1.0.0";
42
+ store;
43
+ request;
44
+ logger;
40
45
  // LoggerManager 实例
41
46
  constructor(name, version) {
42
47
  super(name || "order", version);
43
- this.defaultName = "order";
44
- this.defaultVersion = "1.0.0";
45
48
  }
46
49
  async initialize(core, options) {
47
50
  this.core = core;
@@ -49,7 +52,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
49
52
  this.request = this.core.getPlugin("request");
50
53
  const appPlugin = this.core.getPlugin("app");
51
54
  if (!appPlugin) {
52
- throw new Error("Order 模块需要 app 插件支持");
55
+ throw new Error("Order \u6A21\u5757\u9700\u8981 app \u63D2\u4EF6\u652F\u6301");
53
56
  }
54
57
  const app = appPlugin.getApp();
55
58
  this.logger = app.logger;
@@ -210,7 +213,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
210
213
  orderIdIncluded: params.order_id,
211
214
  paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
212
215
  });
213
- console.log("[Order] createOrderByCheckout 开始创建订单:", {
216
+ console.log("[Order] createOrderByCheckout \u5F00\u59CB\u521B\u5EFA\u8BA2\u5355:", {
214
217
  type: params.type,
215
218
  platform: params.platform,
216
219
  is_deposit: params.is_deposit,
@@ -240,7 +243,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
240
243
  if (!params.order_id && !orderData.schedule_date) {
241
244
  orderData.schedule_date = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
242
245
  }
243
- console.log("[Order] 调用后端接口创建订单:", {
246
+ console.log("[Order] \u8C03\u7528\u540E\u7AEF\u63A5\u53E3\u521B\u5EFA\u8BA2\u5355:", {
244
247
  url: "/order/checkout",
245
248
  orderType: orderData.type,
246
249
  platform: orderData.platform,
@@ -278,13 +281,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
278
281
  this.logInfo("Order API called successfully", {
279
282
  response
280
283
  });
281
- console.log("[Order] 订单创建成功,后端响应:", {
284
+ console.log("[Order] \u8BA2\u5355\u521B\u5EFA\u6210\u529F\uFF0C\u540E\u7AEF\u54CD\u5E94:", {
282
285
  success: !!response,
283
286
  hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
284
287
  });
285
288
  return response;
286
289
  } catch (error) {
287
- console.error("[Order] createOrderByCheckout 创建订单失败:", error);
290
+ console.error("[Order] createOrderByCheckout \u521B\u5EFA\u8BA2\u5355\u5931\u8D25:", error);
288
291
  this.logInfo("Order API called failed", {
289
292
  error: error instanceof Error ? error.message : String(error)
290
293
  });
@@ -30,7 +30,7 @@ var CashPaymentImpl = class {
30
30
  async processCashPayment(amount, orderUuid) {
31
31
  const cashMethod = await this.paymentModule.getCashPaymentMethod();
32
32
  if (!cashMethod) {
33
- throw new Error("现金支付方式未找到");
33
+ throw new Error("\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
34
34
  }
35
35
  const paymentItem = {
36
36
  amount: amount.toString(),
@@ -213,7 +213,7 @@ function recommendOptimalPayments(targetAmount, denominations) {
213
213
  }
214
214
  return finalResults.sort((a, b) => a - b);
215
215
  } catch (error) {
216
- console.warn("推荐支付金额计算出错:", error);
216
+ console.warn("\u63A8\u8350\u652F\u4ED8\u91D1\u989D\u8BA1\u7B97\u51FA\u9519:", error);
217
217
  const safeAmount = Math.ceil(targetAmount);
218
218
  return [targetAmount, safeAmount];
219
219
  }
@@ -29,7 +29,7 @@ var EftposPaymentImpl = class {
29
29
  async processEftposPayment(amount, orderUuid) {
30
30
  const eftposMethod = await this.paymentModule.getEftposPaymentMethod();
31
31
  if (!eftposMethod) {
32
- throw new Error("Eftpos支付方式未找到");
32
+ throw new Error("Eftpos\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
33
33
  }
34
34
  const paymentItem = {
35
35
  amount: amount.toString(),