@pisell/pisellos 2.2.6 → 2.2.7

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 (44) 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/solution/BookingByStep/index.d.ts +22 -2
  8. package/dist/solution/BookingByStep/index.js +502 -29
  9. package/dist/solution/BookingByStep/utils/capacity.d.ts +7 -2
  10. package/dist/solution/BookingByStep/utils/capacity.js +24 -8
  11. package/dist/solution/BookingTicket/index.d.ts +1 -1
  12. package/dist/solution/RegisterAndLogin/config.d.ts +87 -0
  13. package/dist/solution/RegisterAndLogin/config.js +1140 -0
  14. package/dist/solution/RegisterAndLogin/index.d.ts +189 -0
  15. package/dist/solution/RegisterAndLogin/index.js +2667 -0
  16. package/dist/solution/RegisterAndLogin/types.d.ts +445 -0
  17. package/dist/solution/RegisterAndLogin/types.js +231 -0
  18. package/dist/solution/RegisterAndLogin/utils.d.ts +95 -0
  19. package/dist/solution/RegisterAndLogin/utils.js +322 -0
  20. package/dist/solution/ShopDiscount/index.js +27 -9
  21. package/dist/solution/index.d.ts +1 -0
  22. package/dist/solution/index.js +1 -0
  23. package/lib/modules/Order/index.js +5 -2
  24. package/lib/modules/Order/types.d.ts +1 -0
  25. package/lib/modules/Product/index.d.ts +1 -1
  26. package/lib/modules/ProductList/index.js +10 -2
  27. package/lib/plugins/request.d.ts +1 -0
  28. package/lib/solution/BookingByStep/index.d.ts +22 -2
  29. package/lib/solution/BookingByStep/index.js +321 -42
  30. package/lib/solution/BookingByStep/utils/capacity.d.ts +7 -2
  31. package/lib/solution/BookingByStep/utils/capacity.js +21 -8
  32. package/lib/solution/BookingTicket/index.d.ts +1 -1
  33. package/lib/solution/RegisterAndLogin/config.d.ts +87 -0
  34. package/lib/solution/RegisterAndLogin/config.js +866 -0
  35. package/lib/solution/RegisterAndLogin/index.d.ts +189 -0
  36. package/lib/solution/RegisterAndLogin/index.js +1593 -0
  37. package/lib/solution/RegisterAndLogin/types.d.ts +445 -0
  38. package/lib/solution/RegisterAndLogin/types.js +78 -0
  39. package/lib/solution/RegisterAndLogin/utils.d.ts +95 -0
  40. package/lib/solution/RegisterAndLogin/utils.js +279 -0
  41. package/lib/solution/ShopDiscount/index.js +9 -0
  42. package/lib/solution/index.d.ts +1 -0
  43. package/lib/solution/index.js +2 -0
  44. package/package.json +1 -1
@@ -15,8 +15,9 @@ export declare const formatDefaultCapacitys: ({ capacity, product_bundle, }: any
15
15
  * @return {*}
16
16
  * @Author: zhiwei.Wang
17
17
  */
18
- export declare const getSumCapacity: ({ capacity }: {
18
+ export declare const getSumCapacity: ({ capacity, num }: {
19
19
  capacity: CapacityItem[];
20
+ num: number;
20
21
  }) => number;
21
22
  /**
22
23
  * 给定购物车数据,返回对应的 capacity 信息和套餐 capacity
@@ -67,4 +68,8 @@ export declare function getResourcesIdsByProduct(product: any): number[];
67
68
  /**
68
69
  * 检查特定时间段的容量是否足够
69
70
  */
70
- export declare function checkTimeSlotCapacity(timeSlotStart: string, timeSlotEnd: string, cartItems: CartItem[], allResources: ResourceItem[]): boolean;
71
+ export declare function checkTimeSlotCapacity(timeSlotStart: string, timeSlotEnd: string, cartItems: CartItem[], allResources: ResourceItem[]): {
72
+ success: boolean;
73
+ required: number;
74
+ available: number;
75
+ };
@@ -24,8 +24,9 @@ export var formatDefaultCapacitys = function formatDefaultCapacitys(_ref) {
24
24
  if ((capacity === null || capacity === void 0 ? void 0 : capacity.type) === 'package') {
25
25
  return (product_bundle || []).map(function (d) {
26
26
  var id = d.bundle_product_id;
27
+ var variantId = d.bundle_variant_id;
27
28
  var item = ((capacity === null || capacity === void 0 ? void 0 : capacity.package) || []).find(function (item) {
28
- return item.product_id === id;
29
+ return item.product_id === id || item.product_id === variantId;
29
30
  });
30
31
  return {
31
32
  id: id,
@@ -60,7 +61,9 @@ export var formatDefaultCapacitys = function formatDefaultCapacitys(_ref) {
60
61
  * @Author: zhiwei.Wang
61
62
  */
62
63
  export var getSumCapacity = function getSumCapacity(_ref2) {
63
- var capacity = _ref2.capacity;
64
+ var capacity = _ref2.capacity,
65
+ _ref2$num = _ref2.num,
66
+ num = _ref2$num === void 0 ? 1 : _ref2$num;
64
67
  var sum = 0;
65
68
  var _iterator = _createForOfIteratorHelper(capacity || []),
66
69
  _step;
@@ -74,7 +77,7 @@ export var getSumCapacity = function getSumCapacity(_ref2) {
74
77
  } finally {
75
78
  _iterator.f();
76
79
  }
77
- return sum;
80
+ return sum * num;
78
81
  };
79
82
 
80
83
  /**
@@ -91,7 +94,8 @@ export function getCapacityInfoByCartItem(targetCartItem) {
91
94
  product_bundle: targetCartItem._origin.product.product_bundle
92
95
  });
93
96
  var currentCapacity = getSumCapacity({
94
- capacity: formatCapacity
97
+ capacity: formatCapacity,
98
+ num: (targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.num) || 1
95
99
  });
96
100
  return {
97
101
  formatCapacity: formatCapacity,
@@ -262,7 +266,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
262
266
  if (needsThisResourceType) {
263
267
  // 需要判断是单个预约还是多个预约,如果是单个预约,不用加 capacity,只用+1
264
268
  if (selectType === 'single') {
265
- requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + 1;
269
+ requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + ((cartItem === null || cartItem === void 0 ? void 0 : cartItem.num) || 1);
266
270
  } else {
267
271
  requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
268
272
  }
@@ -327,7 +331,11 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
327
331
  if (totalAvailableCapacity < requiredCapacity) {
328
332
  console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5BB9\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(totalAvailableCapacity));
329
333
  return {
330
- v: false
334
+ v: {
335
+ success: false,
336
+ required: requiredCapacity,
337
+ available: totalAvailableCapacity
338
+ }
331
339
  };
332
340
  }
333
341
  } else {
@@ -346,7 +354,11 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
346
354
  if (availableResourceCount < requiredCapacity) {
347
355
  console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u6570\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(availableResourceCount));
348
356
  return {
349
- v: false
357
+ v: {
358
+ success: false,
359
+ required: requiredCapacity,
360
+ available: availableResourceCount
361
+ }
350
362
  };
351
363
  }
352
364
  }
@@ -357,5 +369,9 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
357
369
  if (_ret === 0) continue;
358
370
  if (_ret) return _ret.v;
359
371
  }
360
- return true;
372
+ return {
373
+ success: true,
374
+ required: 0,
375
+ available: 0
376
+ };
361
377
  }
@@ -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;