@pisell/pisellos 2.1.99 → 2.1.100

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 (82) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/modules/Customer/types.d.ts +1 -1
  3. package/dist/modules/Payment/types.d.ts +7 -7
  4. package/dist/modules/Product/index.d.ts +1 -1
  5. package/dist/modules/Rules/types.d.ts +1 -1
  6. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  7. package/dist/modules/Schedule/type.d.ts +7 -7
  8. package/dist/modules/Schedule/types.d.ts +9 -9
  9. package/dist/solution/BookingByStep/index.d.ts +1 -1
  10. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  11. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  12. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  13. package/dist/types/index.d.ts +1 -1
  14. package/dist/utils/task.d.ts +2 -2
  15. package/dist/utils/watch.d.ts +2 -2
  16. package/lib/core/index.js +27 -28
  17. package/lib/effects/index.d.ts +2 -2
  18. package/lib/effects/index.js +3 -7
  19. package/lib/modules/Account/index.js +9 -10
  20. package/lib/modules/AccountList/index.js +14 -11
  21. package/lib/modules/BaseModule.js +6 -3
  22. package/lib/modules/Cart/index.js +14 -9
  23. package/lib/modules/Cart/utils/cartProduct.js +3 -6
  24. package/lib/modules/Customer/constants.js +1 -1
  25. package/lib/modules/Customer/index.js +18 -15
  26. package/lib/modules/Customer/types.d.ts +1 -1
  27. package/lib/modules/Date/index.js +10 -6
  28. package/lib/modules/Date/types.js +1 -0
  29. package/lib/modules/Discount/index.js +11 -6
  30. package/lib/modules/Guests/index.js +10 -15
  31. package/lib/modules/Order/index.js +10 -7
  32. package/lib/modules/Payment/cash.js +1 -1
  33. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  34. package/lib/modules/Payment/eftpos.js +1 -1
  35. package/lib/modules/Payment/index.js +84 -73
  36. package/lib/modules/Payment/types.d.ts +7 -7
  37. package/lib/modules/Payment/utils.js +3 -6
  38. package/lib/modules/Payment/walletpass.js +31 -31
  39. package/lib/modules/Product/index.d.ts +1 -1
  40. package/lib/modules/Product/index.js +6 -5
  41. package/lib/modules/ProductList/index.js +5 -3
  42. package/lib/modules/Resource/index.js +8 -12
  43. package/lib/modules/Rules/index.js +21 -35
  44. package/lib/modules/Rules/types.d.ts +1 -1
  45. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  46. package/lib/modules/Schedule/index.js +8 -5
  47. package/lib/modules/Schedule/type.d.ts +7 -7
  48. package/lib/modules/Schedule/types.d.ts +9 -9
  49. package/lib/modules/Schedule/utils.js +2 -4
  50. package/lib/modules/Step/index.js +7 -4
  51. package/lib/modules/Summary/index.js +9 -4
  52. package/lib/modules/Summary/utils.js +8 -16
  53. package/lib/plugins/request.js +34 -33
  54. package/lib/plugins/window.js +101 -113
  55. package/lib/solution/BookingByStep/index.d.ts +1 -1
  56. package/lib/solution/BookingByStep/index.js +110 -177
  57. package/lib/solution/BookingByStep/utils/capacity.js +11 -16
  58. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  59. package/lib/solution/BookingByStep/utils/resources.js +4 -8
  60. package/lib/solution/BookingByStep/utils/stock.js +3 -6
  61. package/lib/solution/BookingByStep/utils/timeslots.js +24 -27
  62. package/lib/solution/BookingTicket/index.js +19 -14
  63. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  64. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  65. package/lib/solution/BookingTicket/utils/scan/index.js +3 -1
  66. package/lib/solution/BookingTicket/utils/scan/scanCache.js +10 -9
  67. package/lib/solution/BuyTickets/index.js +15 -15
  68. package/lib/solution/Checkout/index.js +216 -211
  69. package/lib/solution/Checkout/utils/index.js +18 -22
  70. package/lib/solution/RegisterAndLogin/config.js +2 -2
  71. package/lib/solution/RegisterAndLogin/index.js +114 -110
  72. package/lib/solution/RegisterAndLogin/utils.js +9 -9
  73. package/lib/solution/ShopDiscount/index.js +16 -13
  74. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  75. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  76. package/lib/solution/ShopDiscount/utils.js +1 -2
  77. package/lib/types/index.d.ts +1 -1
  78. package/lib/utils/task.d.ts +2 -2
  79. package/lib/utils/task.js +3 -3
  80. package/lib/utils/watch.d.ts +2 -2
  81. package/lib/utils/watch.js +5 -7
  82. package/package.json +16 -17
@@ -29,7 +29,7 @@ var DEFAULT_PAGE_SIZE = 20;
29
29
  var DEFAULT_CUSTOMER = {
30
30
  "id": 1,
31
31
  "nickname": "Select a customer",
32
- "name": "选择一个客户"
32
+ "name": "\u9009\u62E9\u4E00\u4E2A\u5BA2\u6237"
33
33
  };
34
34
  // Annotate the CommonJS export names for ESM import in node:
35
35
  0 && (module.exports = {
@@ -28,23 +28,26 @@ var import_BaseModule = require("../BaseModule");
28
28
  var import_constants = require("./constants");
29
29
  __reExport(Customer_exports, require("./types"), module.exports);
30
30
  var CustomerModule = class extends import_BaseModule.BaseModule {
31
+ defaultName = "customer";
32
+ defaultVersion = "1.0.0";
33
+ store = {
34
+ customerList: [],
35
+ selectedCustomer: null,
36
+ total: 0,
37
+ currentPage: 1,
38
+ pageSize: import_constants.DEFAULT_PAGE_SIZE,
39
+ loading: false,
40
+ error: null,
41
+ hasMore: true,
42
+ loadingMore: false,
43
+ searchParams: {}
44
+ };
45
+ request;
46
+ cacheId;
47
+ openCache = false;
48
+ fatherModule;
31
49
  constructor(name, version) {
32
50
  super(name, version);
33
- this.defaultName = "customer";
34
- this.defaultVersion = "1.0.0";
35
- this.store = {
36
- customerList: [],
37
- selectedCustomer: null,
38
- total: 0,
39
- currentPage: 1,
40
- pageSize: import_constants.DEFAULT_PAGE_SIZE,
41
- loading: false,
42
- error: null,
43
- hasMore: true,
44
- loadingMore: false,
45
- searchParams: {}
46
- };
47
- this.openCache = false;
48
51
  }
49
52
  async initialize(core, options) {
50
53
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
@@ -33,7 +33,7 @@ export interface ShopCustomer extends ICustomer {
33
33
  * walletDetails.wallet: 用户所有wallet
34
34
  * latestWalletDetail.wallet: 用户最新wallet
35
35
  */
36
- type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
36
+ declare type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
37
37
  /**
38
38
  * 获取客户列表参数
39
39
  */
@@ -37,11 +37,15 @@ var import_BaseModule = require("../BaseModule");
37
37
  var import_utils = require("./utils");
38
38
  var import_cloneDeep = __toESM(require("lodash-es/cloneDeep"));
39
39
  var DateModule = class extends import_BaseModule.BaseModule {
40
+ defaultName = "date";
41
+ defaultVersion = "1.0.0";
42
+ store;
43
+ request;
44
+ cacheId;
45
+ openCache = false;
46
+ fatherModule;
40
47
  constructor(name, version) {
41
48
  super(name, version);
42
- this.defaultName = "date";
43
- this.defaultVersion = "1.0.0";
44
- this.openCache = false;
45
49
  }
46
50
  async initialize(core, options) {
47
51
  var _a, _b;
@@ -53,7 +57,7 @@ var DateModule = class extends import_BaseModule.BaseModule {
53
57
  this.store.dateList = options.initialState.dateList;
54
58
  }
55
59
  if (!this.request) {
56
- throw new Error("DateModule 需要 request 插件支持");
60
+ throw new Error("DateModule \u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
57
61
  }
58
62
  if ((_a = options.otherParams) == null ? void 0 : _a.cacheId) {
59
63
  this.openCache = options.otherParams.openCache;
@@ -197,13 +201,13 @@ var DateModule = class extends import_BaseModule.BaseModule {
197
201
  if (startAt.isBefore(resourceStartTime)) {
198
202
  const roundedStartTime = this.roundUpToNext10Minutes(resourceStartTime);
199
203
  const roundedStartTimeDayjs = (0, import_dayjs.default)(roundedStartTime);
200
- console.log(`[DateModule] 修正时间段开始时间: ${timeSlot.start_at} -> ${roundedStartTime} (资源ID: ${resource.id}, 原始start_time: ${resource.start_time})`);
204
+ console.log(`[DateModule] \u4FEE\u6B63\u65F6\u95F4\u6BB5\u5F00\u59CB\u65F6\u95F4: ${timeSlot.start_at} -> ${roundedStartTime} (\u8D44\u6E90ID: ${resource.id}, \u539F\u59CBstart_time: ${resource.start_time})`);
201
205
  const correctedTimeSlot = {
202
206
  ...timeSlot,
203
207
  start_at: roundedStartTime
204
208
  };
205
209
  if (endAt.isBefore(roundedStartTimeDayjs)) {
206
- console.log(`[DateModule] 时间段无效,将被删除: ${timeSlot.start_at} - ${timeSlot.end_at} (资源ID: ${resource.id}, 修正后start_time: ${roundedStartTime})`);
210
+ console.log(`[DateModule] \u65F6\u95F4\u6BB5\u65E0\u6548\uFF0C\u5C06\u88AB\u5220\u9664: ${timeSlot.start_at} - ${timeSlot.end_at} (\u8D44\u6E90ID: ${resource.id}, \u4FEE\u6B63\u540Estart_time: ${roundedStartTime})`);
207
211
  return null;
208
212
  }
209
213
  return correctedTimeSlot;
@@ -23,6 +23,7 @@ __export(types_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(types_exports);
25
25
  var DateHooks = /* @__PURE__ */ ((DateHooks2) => {
26
+ return DateHooks2;
26
27
  })(DateHooks || {});
27
28
  // Annotate the CommonJS export names for ESM import in node:
28
29
  0 && (module.exports = {
@@ -37,11 +37,16 @@ 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;
40
48
  constructor(name, version) {
41
49
  super(name, version);
42
- this.defaultName = "discount";
43
- this.defaultVersion = "1.0.0";
44
- this.openCache = false;
45
50
  }
46
51
  async initialize(core, options) {
47
52
  var _a, _b, _c, _d;
@@ -67,10 +72,10 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
67
72
  this.request = core.getPlugin("request");
68
73
  this.window = core.getPlugin("window");
69
74
  if (!this.request) {
70
- throw new Error("discount模块需要 request 插件支持");
75
+ throw new Error("discount\u6A21\u5757\u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
71
76
  }
72
77
  if (!this.window) {
73
- throw new Error("discount模块需要 window 插件支持");
78
+ throw new Error("discount\u6A21\u5757\u9700\u8981 window \u63D2\u4EF6\u652F\u6301");
74
79
  }
75
80
  }
76
81
  async setDiscountList(discountList) {
@@ -196,7 +201,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
196
201
  this.store.discountList = [];
197
202
  this.core.effects.offByModuleDestroy(this.name);
198
203
  await this.core.effects.emit(`${this.name}:onDestroy`, {});
199
- console.log("[Discount] 已销毁");
204
+ console.log("[Discount] \u5DF2\u9500\u6BC1");
200
205
  }
201
206
  async clear() {
202
207
  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
+ };
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;
@@ -211,7 +214,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
211
214
  orderIdIncluded: params.order_id,
212
215
  paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
213
216
  });
214
- console.log("[Order] createOrderByCheckout 开始创建订单:", {
217
+ console.log("[Order] createOrderByCheckout \u5F00\u59CB\u521B\u5EFA\u8BA2\u5355:", {
215
218
  type: params.type,
216
219
  platform: params.platform,
217
220
  is_deposit: params.is_deposit,
@@ -241,7 +244,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
241
244
  if (!params.order_id && !orderData.schedule_date) {
242
245
  orderData.schedule_date = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
243
246
  }
244
- console.log("[Order] 调用后端接口创建订单:", {
247
+ console.log("[Order] \u8C03\u7528\u540E\u7AEF\u63A5\u53E3\u521B\u5EFA\u8BA2\u5355:", {
245
248
  url: "/order/checkout",
246
249
  orderType: orderData.type,
247
250
  platform: orderData.platform,
@@ -279,13 +282,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
279
282
  this.logInfo("Order API called successfully", {
280
283
  response
281
284
  });
282
- console.log("[Order] 订单创建成功,后端响应:", {
285
+ console.log("[Order] \u8BA2\u5355\u521B\u5EFA\u6210\u529F\uFF0C\u540E\u7AEF\u54CD\u5E94:", {
283
286
  success: !!response,
284
287
  hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
285
288
  });
286
289
  return response;
287
290
  } catch (error) {
288
- console.error("[Order] createOrderByCheckout 创建订单失败:", error);
291
+ console.error("[Order] createOrderByCheckout \u521B\u5EFA\u8BA2\u5355\u5931\u8D25:", error);
289
292
  this.logInfo("Order API called failed", {
290
293
  error: error instanceof Error ? error.message : String(error)
291
294
  });
@@ -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(),