@pisell/pisellos 0.0.373 → 0.0.376

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