@pisell/pisellos 2.1.98 → 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
@@ -48,26 +48,26 @@ var import_types = require("../../../modules/Payment/types");
48
48
  function validateCheckoutData(params) {
49
49
  const errors = [];
50
50
  if (!params.cartItems || params.cartItems.length === 0) {
51
- errors.push("购物车不能为空");
51
+ errors.push("\u8D2D\u7269\u8F66\u4E0D\u80FD\u4E3A\u7A7A");
52
52
  }
53
53
  if (params.cartItems) {
54
54
  params.cartItems.forEach((item, index) => {
55
55
  if (!item.id) {
56
- errors.push(`购物车商品 ${index + 1} 缺少商品ID`);
56
+ errors.push(`\u8D2D\u7269\u8F66\u5546\u54C1 ${index + 1} \u7F3A\u5C11\u5546\u54C1ID`);
57
57
  }
58
58
  if (!item.price || parseFloat(String(item.price)) < 0) {
59
- errors.push(`购物车商品 ${index + 1} 价格无效`);
59
+ errors.push(`\u8D2D\u7269\u8F66\u5546\u54C1 ${index + 1} \u4EF7\u683C\u65E0\u6548`);
60
60
  }
61
61
  if (!item.num || item.num <= 0) {
62
- errors.push(`购物车商品 ${index + 1} 数量无效`);
62
+ errors.push(`\u8D2D\u7269\u8F66\u5546\u54C1 ${index + 1} \u6570\u91CF\u65E0\u6548`);
63
63
  }
64
64
  });
65
65
  }
66
66
  if (params.orderType && !["virtual", "appointment_booking"].includes(params.orderType)) {
67
- errors.push("订单类型无效,必须是 virtual appointment_booking");
67
+ errors.push("\u8BA2\u5355\u7C7B\u578B\u65E0\u6548\uFF0C\u5FC5\u987B\u662F virtual \u6216 appointment_booking");
68
68
  }
69
69
  if (params.platform && !["pc", "h5"].includes(params.platform)) {
70
- errors.push("平台类型无效,必须是 pc h5");
70
+ errors.push("\u5E73\u53F0\u7C7B\u578B\u65E0\u6548\uFF0C\u5FC5\u987B\u662F pc \u6216 h5");
71
71
  }
72
72
  return {
73
73
  valid: errors.length === 0,
@@ -84,8 +84,7 @@ function createCheckoutError(type, message, details) {
84
84
  }
85
85
  function formatAmount(amount) {
86
86
  const numAmount = typeof amount === "string" ? parseFloat(amount) : amount;
87
- if (isNaN(numAmount))
88
- return "0.00";
87
+ if (isNaN(numAmount)) return "0.00";
89
88
  return numAmount.toFixed(2);
90
89
  }
91
90
  function validateAmount(amount) {
@@ -165,12 +164,9 @@ async function retry(fn, maxAttempts = 3, delay = 1e3) {
165
164
  throw lastError;
166
165
  }
167
166
  function isEmpty(obj) {
168
- if (obj == null)
169
- return true;
170
- if (Array.isArray(obj) || typeof obj === "string")
171
- return obj.length === 0;
172
- if (typeof obj === "object")
173
- return Object.keys(obj).length === 0;
167
+ if (obj == null) return true;
168
+ if (Array.isArray(obj) || typeof obj === "string") return obj.length === 0;
169
+ if (typeof obj === "object") return Object.keys(obj).length === 0;
174
170
  return false;
175
171
  }
176
172
  function getErrorMessage(error) {
@@ -183,7 +179,7 @@ function getErrorMessage(error) {
183
179
  if (error && typeof error === "object" && "message" in error) {
184
180
  return String(error.message);
185
181
  }
186
- return "未知错误";
182
+ return "\u672A\u77E5\u9519\u8BEF";
187
183
  }
188
184
  function isProduction() {
189
185
  return process.env.NODE_ENV === "production";
@@ -208,24 +204,24 @@ function validateLocalOrderData(orderData) {
208
204
  var _a;
209
205
  const errors = [];
210
206
  if (!orderData.type) {
211
- errors.push("订单类型不能为空");
207
+ errors.push("\u8BA2\u5355\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
212
208
  }
213
209
  if (!orderData.platform) {
214
- errors.push("平台信息不能为空");
210
+ errors.push("\u5E73\u53F0\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A");
215
211
  }
216
212
  if ((!orderData.bookings || orderData.bookings.length === 0) && !((_a = orderData == null ? void 0 : orderData.relation_products) == null ? void 0 : _a.length)) {
217
- errors.push("预订信息不能为空");
213
+ errors.push("\u9884\u8BA2\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A");
218
214
  }
219
215
  if (orderData.bookings) {
220
216
  orderData.bookings.forEach((booking, index) => {
221
217
  if (!booking.product || !booking.product.product_id) {
222
- errors.push(`预订项 ${index + 1} 缺少商品信息`);
218
+ errors.push(`\u9884\u8BA2\u9879 ${index + 1} \u7F3A\u5C11\u5546\u54C1\u4FE1\u606F`);
223
219
  }
224
220
  if (!booking.start_date) {
225
- errors.push(`预订项 ${index + 1} 缺少开始日期`);
221
+ errors.push(`\u9884\u8BA2\u9879 ${index + 1} \u7F3A\u5C11\u5F00\u59CB\u65E5\u671F`);
226
222
  }
227
223
  if (!booking.start_time) {
228
- errors.push(`预订项 ${index + 1} 缺少开始时间`);
224
+ errors.push(`\u9884\u8BA2\u9879 ${index + 1} \u7F3A\u5C11\u5F00\u59CB\u65F6\u95F4`);
229
225
  }
230
226
  });
231
227
  }
@@ -288,7 +284,7 @@ function extractAmountFromCartSummary(cartSummary) {
288
284
  break;
289
285
  }
290
286
  });
291
- console.log("[Checkout] 从购物车小计提取金额信息:", {
287
+ console.log("[Checkout] \u4ECE\u8D2D\u7269\u8F66\u5C0F\u8BA1\u63D0\u53D6\u91D1\u989D\u4FE1\u606F:", {
292
288
  totalAmount: result.totalAmount,
293
289
  subTotal: result.subTotal,
294
290
  taxAmount: result.taxAmount,
@@ -550,7 +550,7 @@ var ApiCaller = class {
550
550
  async call(apiName, params, additionalOptions) {
551
551
  const apiConfig = this.config[apiName];
552
552
  if (!apiConfig) {
553
- throw new Error(`API 配置未找到: ${String(apiName)}`);
553
+ throw new Error(`API \u914D\u7F6E\u672A\u627E\u5230: ${String(apiName)}`);
554
554
  }
555
555
  const transformedParams = apiConfig.transformParams ? apiConfig.transformParams(params) : params;
556
556
  let requestOptions = { ...apiConfig.options, ...additionalOptions };
@@ -578,7 +578,7 @@ var ApiCaller = class {
578
578
  response = await this.request.delete(apiConfig.url, requestOptions);
579
579
  break;
580
580
  default:
581
- throw new Error(`不支持的 HTTP 方法: ${apiConfig.method}`);
581
+ throw new Error(`\u4E0D\u652F\u6301\u7684 HTTP \u65B9\u6CD5: ${apiConfig.method}`);
582
582
  }
583
583
  return apiConfig.transformResponse ? apiConfig.transformResponse(response) : response;
584
584
  }