@pisell/pisellos 2.2.6 → 2.2.8

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 (50) hide show
  1. package/dist/modules/Order/index.js +4 -4
  2. package/dist/modules/Order/types.d.ts +1 -0
  3. package/dist/modules/Product/index.d.ts +1 -1
  4. package/dist/modules/ProductList/index.js +11 -3
  5. package/dist/plugins/request.d.ts +1 -0
  6. package/dist/plugins/request.js +1 -1
  7. package/dist/server/modules/menu/index.js +1 -1
  8. package/dist/server/modules/products/index.js +1 -1
  9. package/dist/server/modules/schedule/index.js +1 -1
  10. package/dist/solution/BookingByStep/index.d.ts +22 -2
  11. package/dist/solution/BookingByStep/index.js +502 -29
  12. package/dist/solution/BookingByStep/utils/capacity.d.ts +7 -2
  13. package/dist/solution/BookingByStep/utils/capacity.js +24 -8
  14. package/dist/solution/BookingTicket/index.d.ts +1 -1
  15. package/dist/solution/RegisterAndLogin/config.d.ts +87 -0
  16. package/dist/solution/RegisterAndLogin/config.js +1140 -0
  17. package/dist/solution/RegisterAndLogin/index.d.ts +189 -0
  18. package/dist/solution/RegisterAndLogin/index.js +2667 -0
  19. package/dist/solution/RegisterAndLogin/types.d.ts +445 -0
  20. package/dist/solution/RegisterAndLogin/types.js +231 -0
  21. package/dist/solution/RegisterAndLogin/utils.d.ts +95 -0
  22. package/dist/solution/RegisterAndLogin/utils.js +322 -0
  23. package/dist/solution/ShopDiscount/index.js +27 -9
  24. package/dist/solution/index.d.ts +1 -0
  25. package/dist/solution/index.js +1 -0
  26. package/lib/modules/Order/index.js +5 -2
  27. package/lib/modules/Order/types.d.ts +1 -0
  28. package/lib/modules/Product/index.d.ts +1 -1
  29. package/lib/modules/ProductList/index.js +10 -2
  30. package/lib/plugins/request.d.ts +1 -0
  31. package/lib/server/modules/menu/index.js +1 -1
  32. package/lib/server/modules/products/index.js +1 -1
  33. package/lib/server/modules/schedule/index.js +1 -1
  34. package/lib/solution/BookingByStep/index.d.ts +22 -2
  35. package/lib/solution/BookingByStep/index.js +321 -42
  36. package/lib/solution/BookingByStep/utils/capacity.d.ts +7 -2
  37. package/lib/solution/BookingByStep/utils/capacity.js +21 -8
  38. package/lib/solution/BookingTicket/index.d.ts +1 -1
  39. package/lib/solution/RegisterAndLogin/config.d.ts +87 -0
  40. package/lib/solution/RegisterAndLogin/config.js +866 -0
  41. package/lib/solution/RegisterAndLogin/index.d.ts +189 -0
  42. package/lib/solution/RegisterAndLogin/index.js +1593 -0
  43. package/lib/solution/RegisterAndLogin/types.d.ts +445 -0
  44. package/lib/solution/RegisterAndLogin/types.js +78 -0
  45. package/lib/solution/RegisterAndLogin/utils.d.ts +95 -0
  46. package/lib/solution/RegisterAndLogin/utils.js +279 -0
  47. package/lib/solution/ShopDiscount/index.js +9 -0
  48. package/lib/solution/index.d.ts +1 -0
  49. package/lib/solution/index.js +2 -0
  50. package/package.json +1 -1
@@ -47,8 +47,9 @@ var formatDefaultCapacitys = ({
47
47
  if ((capacity == null ? void 0 : capacity.type) === "package") {
48
48
  return (product_bundle || []).map((d) => {
49
49
  const id = d.bundle_product_id;
50
+ const variantId = d.bundle_variant_id;
50
51
  const item = ((capacity == null ? void 0 : capacity.package) || []).find(
51
- (item2) => item2.product_id === id
52
+ (item2) => item2.product_id === id || item2.product_id === variantId
52
53
  );
53
54
  return {
54
55
  id,
@@ -68,12 +69,12 @@ var formatDefaultCapacitys = ({
68
69
  }
69
70
  return [{ id: 0, value: 1, name: "" }];
70
71
  };
71
- var getSumCapacity = ({ capacity }) => {
72
+ var getSumCapacity = ({ capacity, num = 1 }) => {
72
73
  let sum = 0;
73
74
  for (let item of capacity || []) {
74
75
  sum += item.value;
75
76
  }
76
- return sum;
77
+ return sum * num;
77
78
  };
78
79
  function getCapacityInfoByCartItem(targetCartItem) {
79
80
  var _a;
@@ -81,7 +82,7 @@ function getCapacityInfoByCartItem(targetCartItem) {
81
82
  capacity: (_a = targetCartItem._productOrigin) == null ? void 0 : _a.capacity,
82
83
  product_bundle: targetCartItem._origin.product.product_bundle
83
84
  });
84
- const currentCapacity = getSumCapacity({ capacity: formatCapacity });
85
+ const currentCapacity = getSumCapacity({ capacity: formatCapacity, num: (targetCartItem == null ? void 0 : targetCartItem.num) || 1 });
85
86
  return {
86
87
  formatCapacity,
87
88
  currentCapacity
@@ -194,7 +195,7 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
194
195
  );
195
196
  if (needsThisResourceType) {
196
197
  if (selectType === "single") {
197
- requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + 1;
198
+ requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + ((cartItem == null ? void 0 : cartItem.num) || 1);
198
199
  } else {
199
200
  requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
200
201
  }
@@ -238,7 +239,11 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
238
239
  console.log(`capacity.ts - 资源类型 ${formId} 多个预约检查: 总容量 ${totalAvailableCapacity}, 需求 ${requiredCapacity}`);
239
240
  if (totalAvailableCapacity < requiredCapacity) {
240
241
  console.log(`资源类型 ${formId} 容量不足: 需要 ${requiredCapacity}, 可用 ${totalAvailableCapacity}`);
241
- return false;
242
+ return {
243
+ success: false,
244
+ required: requiredCapacity,
245
+ available: totalAvailableCapacity
246
+ };
242
247
  }
243
248
  } else {
244
249
  let availableResourceCount = 0;
@@ -253,11 +258,19 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
253
258
  console.log(`capacity.ts - 资源类型 ${formId} 单个预约检查: 可用资源数 ${availableResourceCount}, 需求 ${requiredCapacity}`);
254
259
  if (availableResourceCount < requiredCapacity) {
255
260
  console.log(`资源类型 ${formId} 数量不足: 需要 ${requiredCapacity}, 可用 ${availableResourceCount}`);
256
- return false;
261
+ return {
262
+ success: false,
263
+ required: requiredCapacity,
264
+ available: availableResourceCount
265
+ };
257
266
  }
258
267
  }
259
268
  }
260
- return true;
269
+ return {
270
+ success: true,
271
+ required: 0,
272
+ available: 0
273
+ };
261
274
  }
262
275
  // Annotate the CommonJS export names for ESM import in node:
263
276
  0 && (module.exports = {
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -0,0 +1,87 @@
1
+ /**
2
+ * 注册登录解决方案配置
3
+ * 根据不同渠道配置不同的接口地址和参数
4
+ */
5
+ /**
6
+ * API 配置接口
7
+ */
8
+ export interface ApiConfig {
9
+ url: string;
10
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
11
+ transformParams?: (params: any) => any;
12
+ transformResponse?: (response: any) => any;
13
+ options?: Record<string, any>;
14
+ }
15
+ /**
16
+ * 渠道配置接口
17
+ */
18
+ export interface ChannelConfig {
19
+ sendEmailVerificationCode: ApiConfig;
20
+ sendEmailLoginCode: ApiConfig;
21
+ sendSmsRegisterCode: ApiConfig;
22
+ sendEmailRegisterLink: ApiConfig;
23
+ verifyEmailRegistrationLink: ApiConfig;
24
+ emailPasswordLogin: ApiConfig;
25
+ emailCodeRegister: ApiConfig;
26
+ phoneCodeRegister: ApiConfig;
27
+ resendEmailRegisterLink: ApiConfig;
28
+ checkEmailLinkCode: ApiConfig;
29
+ sendSmsLoginCode: ApiConfig;
30
+ phoneCodeLogin: ApiConfig;
31
+ guestLogin: ApiConfig;
32
+ checkEmailExists: ApiConfig;
33
+ checkEmailCode: ApiConfig;
34
+ checkMobileCode: ApiConfig;
35
+ phonePasswordLogin: ApiConfig;
36
+ sendPasswordResetEmail: ApiConfig;
37
+ sendPasswordResetSms: ApiConfig;
38
+ sendResetPasswordLink: ApiConfig;
39
+ checkResetPasswordCode: ApiConfig;
40
+ resetPasswordByCode: ApiConfig;
41
+ resetPasswordByEmail: ApiConfig;
42
+ resetPasswordByPhone: ApiConfig;
43
+ verifyCode: ApiConfig;
44
+ register: ApiConfig;
45
+ login: ApiConfig;
46
+ oauthLogin: ApiConfig;
47
+ validateToken: ApiConfig;
48
+ logout: ApiConfig;
49
+ getCountries: ApiConfig;
50
+ facebookLogin: ApiConfig;
51
+ appleLogin: ApiConfig;
52
+ }
53
+ /**
54
+ * 渠道配置映射
55
+ */
56
+ export declare const channelConfigMap: Record<string, ChannelConfig>;
57
+ /**
58
+ * 获取渠道配置
59
+ */
60
+ export declare function getChannelConfig(channel: string): ChannelConfig;
61
+ /**
62
+ * API 调用器类
63
+ * 负责根据配置执行 API 调用
64
+ */
65
+ export declare class ApiCaller {
66
+ private request;
67
+ private config;
68
+ constructor(request: {
69
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
70
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
71
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
72
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
73
+ }, config: ChannelConfig);
74
+ /**
75
+ * 执行 API 调用
76
+ */
77
+ call<T = any>(apiName: keyof ChannelConfig, params?: any, additionalOptions?: any): Promise<T>;
78
+ }
79
+ /**
80
+ * 创建 API 调用器
81
+ */
82
+ export declare function createApiCaller(request: {
83
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
84
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
85
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
86
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
87
+ }, channel: string): ApiCaller;