@pisell/pisellos 1.0.78 → 1.0.80

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 (32) hide show
  1. package/dist/modules/Cart/utils/cartProduct.js +11 -11
  2. package/dist/modules/Discount/index.js +1 -1
  3. package/dist/modules/Product/index.d.ts +1 -1
  4. package/dist/modules/Rules/index.js +8 -5
  5. package/dist/plugins/request.d.ts +1 -0
  6. package/dist/solution/RegisterAndLogin/config.d.ts +87 -0
  7. package/dist/solution/RegisterAndLogin/config.js +794 -0
  8. package/dist/solution/RegisterAndLogin/index.d.ts +189 -0
  9. package/dist/solution/RegisterAndLogin/index.js +2667 -0
  10. package/dist/solution/RegisterAndLogin/types.d.ts +445 -0
  11. package/dist/solution/RegisterAndLogin/types.js +231 -0
  12. package/dist/solution/RegisterAndLogin/utils.d.ts +95 -0
  13. package/dist/solution/RegisterAndLogin/utils.js +322 -0
  14. package/dist/solution/index.d.ts +1 -0
  15. package/dist/solution/index.js +2 -1
  16. package/lib/modules/Cart/utils/cartProduct.js +8 -10
  17. package/lib/modules/Discount/index.js +1 -1
  18. package/lib/modules/Product/index.d.ts +1 -1
  19. package/lib/modules/Rules/index.js +6 -5
  20. package/lib/plugins/request.d.ts +1 -0
  21. package/lib/solution/BookingTicket/index.js +6 -0
  22. package/lib/solution/RegisterAndLogin/config.d.ts +87 -0
  23. package/lib/solution/RegisterAndLogin/config.js +596 -0
  24. package/lib/solution/RegisterAndLogin/index.d.ts +189 -0
  25. package/lib/solution/RegisterAndLogin/index.js +1593 -0
  26. package/lib/solution/RegisterAndLogin/types.d.ts +445 -0
  27. package/lib/solution/RegisterAndLogin/types.js +78 -0
  28. package/lib/solution/RegisterAndLogin/utils.d.ts +95 -0
  29. package/lib/solution/RegisterAndLogin/utils.js +279 -0
  30. package/lib/solution/index.d.ts +1 -0
  31. package/lib/solution/index.js +3 -1
  32. package/package.json +1 -1
@@ -0,0 +1,95 @@
1
+ /**
2
+ * 注册登录工具函数
3
+ */
4
+ import { VerificationCodeType, OAuthProvider } from './types';
5
+ /**
6
+ * 验证邮箱格式
7
+ */
8
+ export declare function validateEmail(email: string): boolean;
9
+ /**
10
+ * 验证手机号格式(支持多种国际格式)
11
+ */
12
+ export declare function validatePhone(phone: string): boolean;
13
+ /**
14
+ * 验证密码强度
15
+ */
16
+ export declare function validatePassword(password: string): {
17
+ isValid: boolean;
18
+ errors: string[];
19
+ };
20
+ /**
21
+ * 验证验证码格式
22
+ */
23
+ export declare function validateVerificationCode(code: string, type: VerificationCodeType): boolean;
24
+ /**
25
+ * 格式化手机号显示
26
+ */
27
+ export declare function formatPhoneDisplay(phone: string): string;
28
+ /**
29
+ * 格式化邮箱显示(隐藏部分字符)
30
+ */
31
+ export declare function formatEmailDisplay(email: string, maskLength?: number): string;
32
+ /**
33
+ * 生成随机字符串(用于状态参数等)
34
+ */
35
+ export declare function generateRandomString(length?: number): string;
36
+ /**
37
+ * 获取 OAuth 提供商的显示名称
38
+ */
39
+ export declare function getOAuthProviderDisplayName(provider: OAuthProvider): string;
40
+ /**
41
+ * 获取 OAuth 提供商的图标 URL
42
+ */
43
+ export declare function getOAuthProviderIconUrl(provider: OAuthProvider): string;
44
+ /**
45
+ * 检查是否在移动设备上
46
+ */
47
+ export declare function isMobileDevice(): boolean;
48
+ /**
49
+ * 检查是否支持 WebAuthn
50
+ */
51
+ export declare function isWebAuthnSupported(): boolean;
52
+ /**
53
+ * 检查是否在 iOS 设备上
54
+ */
55
+ export declare function isIOSDevice(): boolean;
56
+ /**
57
+ * 检查是否在 Android 设备上
58
+ */
59
+ export declare function isAndroidDevice(): boolean;
60
+ /**
61
+ * 获取设备类型
62
+ */
63
+ export declare function getDeviceType(): 'desktop' | 'mobile' | 'tablet';
64
+ /**
65
+ * 防抖函数
66
+ */
67
+ export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
68
+ /**
69
+ * 节流函数
70
+ */
71
+ export declare function throttle<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
72
+ /**
73
+ * 深拷贝对象
74
+ */
75
+ export declare function deepClone<T>(obj: T): T;
76
+ /**
77
+ * 安全的 JSON 解析
78
+ */
79
+ export declare function safeJsonParse<T = any>(jsonString: string, defaultValue: T): T;
80
+ /**
81
+ * 安全的 JSON 字符串化
82
+ */
83
+ export declare function safeJsonStringify(obj: any, defaultValue?: string): string;
84
+ /**
85
+ * 格式化时间戳为可读时间
86
+ */
87
+ export declare function formatTimestamp(timestamp: number, format?: string): string;
88
+ /**
89
+ * 计算两个时间戳之间的差值(秒)
90
+ */
91
+ export declare function getTimeDifference(timestamp1: number, timestamp2: number): number;
92
+ /**
93
+ * 检查时间戳是否过期
94
+ */
95
+ export declare function isTimestampExpired(timestamp: number, expirationTime?: number): boolean;
@@ -0,0 +1,322 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ /**
12
+ * 注册登录工具函数
13
+ */
14
+
15
+ import { VerificationCodeType, OAuthProvider } from "./types";
16
+
17
+ /**
18
+ * 验证邮箱格式
19
+ */
20
+ export function validateEmail(email) {
21
+ var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
22
+ return emailRegex.test(email);
23
+ }
24
+
25
+ /**
26
+ * 验证手机号格式(支持多种国际格式)
27
+ */
28
+ export function validatePhone(phone) {
29
+ // 移除所有非数字字符(除了 + 号)
30
+ var cleanPhone = phone.replace(/[^\d+]/g, '');
31
+
32
+ // 基本的手机号验证规则
33
+ var phoneRegex = /^(\+\d{1,3}[- ]?)?\d{10,14}$/;
34
+ return phoneRegex.test(cleanPhone);
35
+ }
36
+
37
+ /**
38
+ * 验证密码强度
39
+ */
40
+ export function validatePassword(password) {
41
+ var errors = [];
42
+ if (password.length < 8) {
43
+ errors.push('密码长度至少为8位');
44
+ }
45
+ if (password.length > 128) {
46
+ errors.push('密码长度不能超过128位');
47
+ }
48
+ if (!/[a-z]/.test(password)) {
49
+ errors.push('密码必须包含至少一个小写字母');
50
+ }
51
+ if (!/[A-Z]/.test(password)) {
52
+ errors.push('密码必须包含至少一个大写字母');
53
+ }
54
+ if (!/\d/.test(password)) {
55
+ errors.push('密码必须包含至少一个数字');
56
+ }
57
+ if (!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password)) {
58
+ errors.push('密码必须包含至少一个特殊字符');
59
+ }
60
+ return {
61
+ isValid: errors.length === 0,
62
+ errors: errors
63
+ };
64
+ }
65
+
66
+ /**
67
+ * 验证验证码格式
68
+ */
69
+ export function validateVerificationCode(code, type) {
70
+ // 移除所有空格
71
+ var cleanCode = code.replace(/\s/g, '');
72
+ switch (type) {
73
+ case VerificationCodeType.EMAIL:
74
+ case VerificationCodeType.SMS:
75
+ // 通常是4-8位数字
76
+ return /^\d{4,8}$/.test(cleanCode);
77
+ default:
78
+ return false;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * 格式化手机号显示
84
+ */
85
+ export function formatPhoneDisplay(phone) {
86
+ // 移除所有非数字字符(除了 + 号)
87
+ var cleanPhone = phone.replace(/[^\d+]/g, '');
88
+
89
+ // 如果是中国手机号(11位数字)
90
+ if (/^\d{11}$/.test(cleanPhone)) {
91
+ return cleanPhone.replace(/(\d{3})(\d{4})(\d{4})/, '$1 $2 $3');
92
+ }
93
+
94
+ // 如果是国际号码(以 + 开头)
95
+ if (cleanPhone.startsWith('+')) {
96
+ return cleanPhone;
97
+ }
98
+
99
+ // 其他格式保持原样
100
+ return phone;
101
+ }
102
+
103
+ /**
104
+ * 格式化邮箱显示(隐藏部分字符)
105
+ */
106
+ export function formatEmailDisplay(email) {
107
+ var maskLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
108
+ var _email$split = email.split('@'),
109
+ _email$split2 = _slicedToArray(_email$split, 2),
110
+ localPart = _email$split2[0],
111
+ domain = _email$split2[1];
112
+ if (!localPart || !domain) {
113
+ return email;
114
+ }
115
+ if (localPart.length <= maskLength * 2) {
116
+ return email;
117
+ }
118
+ var visibleStart = localPart.substring(0, maskLength);
119
+ var visibleEnd = localPart.substring(localPart.length - maskLength);
120
+ var maskedPart = '*'.repeat(localPart.length - maskLength * 2);
121
+ return "".concat(visibleStart).concat(maskedPart).concat(visibleEnd, "@").concat(domain);
122
+ }
123
+
124
+ /**
125
+ * 生成随机字符串(用于状态参数等)
126
+ */
127
+ export function generateRandomString() {
128
+ var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;
129
+ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
130
+ var result = '';
131
+ for (var i = 0; i < length; i++) {
132
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
133
+ }
134
+ return result;
135
+ }
136
+
137
+ /**
138
+ * 获取 OAuth 提供商的显示名称
139
+ */
140
+ export function getOAuthProviderDisplayName(provider) {
141
+ var displayNames = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, OAuthProvider.FACEBOOK, 'Facebook'), OAuthProvider.APPLE, 'Apple'), OAuthProvider.GOOGLE, 'Google'), OAuthProvider.WECHAT, '微信'), OAuthProvider.GITHUB, 'GitHub');
142
+ return displayNames[provider] || provider;
143
+ }
144
+
145
+ /**
146
+ * 获取 OAuth 提供商的图标 URL
147
+ */
148
+ export function getOAuthProviderIconUrl(provider) {
149
+ var iconUrls = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, OAuthProvider.FACEBOOK, 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/facebook.svg'), OAuthProvider.APPLE, 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/apple.svg'), OAuthProvider.GOOGLE, 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/google.svg'), OAuthProvider.WECHAT, 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/wechat.svg'), OAuthProvider.GITHUB, 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/github.svg');
150
+ return iconUrls[provider] || '';
151
+ }
152
+
153
+ /**
154
+ * 检查是否在移动设备上
155
+ */
156
+ export function isMobileDevice() {
157
+ if (typeof window === 'undefined') {
158
+ return false;
159
+ }
160
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
161
+ }
162
+
163
+ /**
164
+ * 检查是否支持 WebAuthn
165
+ */
166
+ export function isWebAuthnSupported() {
167
+ if (typeof window === 'undefined') {
168
+ return false;
169
+ }
170
+ return !!(navigator.credentials && navigator.credentials.create);
171
+ }
172
+
173
+ /**
174
+ * 检查是否在 iOS 设备上
175
+ */
176
+ export function isIOSDevice() {
177
+ if (typeof window === 'undefined') {
178
+ return false;
179
+ }
180
+ return /iPad|iPhone|iPod/.test(navigator.userAgent);
181
+ }
182
+
183
+ /**
184
+ * 检查是否在 Android 设备上
185
+ */
186
+ export function isAndroidDevice() {
187
+ if (typeof window === 'undefined') {
188
+ return false;
189
+ }
190
+ return /Android/.test(navigator.userAgent);
191
+ }
192
+
193
+ /**
194
+ * 获取设备类型
195
+ */
196
+ export function getDeviceType() {
197
+ if (typeof window === 'undefined') {
198
+ return 'desktop';
199
+ }
200
+ var userAgent = navigator.userAgent;
201
+ if (/iPad/.test(userAgent)) {
202
+ return 'tablet';
203
+ }
204
+ if (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)) {
205
+ return 'mobile';
206
+ }
207
+ return 'desktop';
208
+ }
209
+
210
+ /**
211
+ * 防抖函数
212
+ */
213
+ export function debounce(func, wait) {
214
+ var timeout = null;
215
+ return function () {
216
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
217
+ args[_key] = arguments[_key];
218
+ }
219
+ if (timeout) {
220
+ clearTimeout(timeout);
221
+ }
222
+ timeout = setTimeout(function () {
223
+ func.apply(void 0, args);
224
+ }, wait);
225
+ };
226
+ }
227
+
228
+ /**
229
+ * 节流函数
230
+ */
231
+ export function throttle(func, wait) {
232
+ var lastTime = 0;
233
+ return function () {
234
+ var now = Date.now();
235
+ if (now - lastTime >= wait) {
236
+ lastTime = now;
237
+ func.apply(void 0, arguments);
238
+ }
239
+ };
240
+ }
241
+
242
+ /**
243
+ * 深拷贝对象
244
+ */
245
+ export function deepClone(obj) {
246
+ if (obj === null || _typeof(obj) !== 'object') {
247
+ return obj;
248
+ }
249
+ if (obj instanceof Date) {
250
+ return new Date(obj.getTime());
251
+ }
252
+ if (obj instanceof Array) {
253
+ return obj.map(function (item) {
254
+ return deepClone(item);
255
+ });
256
+ }
257
+ if (_typeof(obj) === 'object') {
258
+ var cloned = {};
259
+ for (var key in obj) {
260
+ if (obj.hasOwnProperty(key)) {
261
+ cloned[key] = deepClone(obj[key]);
262
+ }
263
+ }
264
+ return cloned;
265
+ }
266
+ return obj;
267
+ }
268
+
269
+ /**
270
+ * 安全的 JSON 解析
271
+ */
272
+ export function safeJsonParse(jsonString, defaultValue) {
273
+ try {
274
+ return JSON.parse(jsonString);
275
+ } catch (error) {
276
+ console.warn('JSON 解析失败:', error);
277
+ return defaultValue;
278
+ }
279
+ }
280
+
281
+ /**
282
+ * 安全的 JSON 字符串化
283
+ */
284
+ export function safeJsonStringify(obj) {
285
+ var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '{}';
286
+ try {
287
+ return JSON.stringify(obj);
288
+ } catch (error) {
289
+ console.warn('JSON 字符串化失败:', error);
290
+ return defaultValue;
291
+ }
292
+ }
293
+
294
+ /**
295
+ * 格式化时间戳为可读时间
296
+ */
297
+ export function formatTimestamp(timestamp) {
298
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
299
+ var date = new Date(timestamp);
300
+ var year = date.getFullYear();
301
+ var month = String(date.getMonth() + 1).padStart(2, '0');
302
+ var day = String(date.getDate()).padStart(2, '0');
303
+ var hours = String(date.getHours()).padStart(2, '0');
304
+ var minutes = String(date.getMinutes()).padStart(2, '0');
305
+ var seconds = String(date.getSeconds()).padStart(2, '0');
306
+ return format.replace('YYYY', year.toString()).replace('MM', month).replace('DD', day).replace('HH', hours).replace('mm', minutes).replace('ss', seconds);
307
+ }
308
+
309
+ /**
310
+ * 计算两个时间戳之间的差值(秒)
311
+ */
312
+ export function getTimeDifference(timestamp1, timestamp2) {
313
+ return Math.abs(timestamp1 - timestamp2) / 1000;
314
+ }
315
+
316
+ /**
317
+ * 检查时间戳是否过期
318
+ */
319
+ export function isTimestampExpired(timestamp) {
320
+ var expirationTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5 * 60 * 1000;
321
+ return Date.now() - timestamp > expirationTime;
322
+ }
@@ -3,3 +3,4 @@ export * from './BookingByStep';
3
3
  export * from './BookingTicket';
4
4
  export * from './ShopDiscount';
5
5
  export * from './Checkout';
6
+ export * from './RegisterAndLogin';
@@ -2,4 +2,5 @@ export * from "./BuyTickets";
2
2
  export * from "./BookingByStep";
3
3
  export * from "./BookingTicket";
4
4
  export * from "./ShopDiscount";
5
- export * from "./Checkout";
5
+ export * from "./Checkout";
6
+ export * from "./RegisterAndLogin";
@@ -175,15 +175,13 @@ var getProductTotalPrice = (params) => {
175
175
  if (discounts == null ? void 0 : discounts.length) {
176
176
  discounts.forEach((currentValue) => {
177
177
  var _a;
178
- if (currentValue.type !== "good_pass") {
179
- price = (0, import_utils2.getDiscountAmount)({
180
- tag: currentValue.type,
181
- par_value: currentValue.discount.percent,
182
- metadata: {
183
- discount_card_type: (_a = currentValue == null ? void 0 : currentValue.discount) == null ? void 0 : _a.discount_card_type
184
- }
185
- }, price, price);
186
- }
178
+ price = (0, import_utils2.getDiscountAmount)({
179
+ tag: currentValue.type,
180
+ par_value: currentValue.discount.percent,
181
+ metadata: {
182
+ discount_card_type: (_a = currentValue == null ? void 0 : currentValue.discount) == null ? void 0 : _a.discount_card_type
183
+ }
184
+ }, price, price);
187
185
  });
188
186
  }
189
187
  if (bundle == null ? void 0 : bundle.length) {
@@ -196,7 +194,7 @@ var getProductTotalPrice = (params) => {
196
194
  return accumulator + Number(currentValue.price) * Number(currentValue.num);
197
195
  }, price);
198
196
  }
199
- return price;
197
+ return Math.max(0, price);
200
198
  };
201
199
  var getProductOriginTotalPrice = (params) => {
202
200
  const { product, bundle, options, discounts } = params;
@@ -163,7 +163,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
163
163
  }
164
164
  if (discount.appliedProductDetails) {
165
165
  return discount.appliedProductDetails.reduce((total, product) => {
166
- const price = new import_decimal.default((product == null ? void 0 : product.amount) || 0).mul((product == null ? void 0 : product.num) || 1);
166
+ const price = new import_decimal.default((product == null ? void 0 : product.amount) || 0);
167
167
  return new import_decimal.default(total).plus(price).toNumber();
168
168
  }, 0);
169
169
  }
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -268,12 +268,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
268
268
  const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
269
269
  const isLimitedProduct = limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id);
270
270
  const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_a = product == null ? void 0 : product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount2) => discount2.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount2.tag || discount2.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && ((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.metadata) == null ? void 0 : _d.custom_product_bundle_map_id));
271
- if (isAvailableProduct && isLimitedProduct) {
271
+ const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
272
+ if (isAvailableProduct && isLimitedProduct && isBundleAvailable) {
272
273
  (_e = discountApplicability.get(discount.id)) == null ? void 0 : _e.push(product.id);
273
274
  const applicableProducts = discountApplicableProducts.get(discount.id) || [];
274
275
  const discountType = discount.tag || discount.type;
275
276
  const productData = {
276
- amount: product.price,
277
+ amount: product.price * (product.num || 1),
277
278
  type: discountType,
278
279
  tag: discountType,
279
280
  discount: {
@@ -454,7 +455,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
454
455
  }
455
456
  const targetProductTotal = (0, import_utils.getDiscountAmount)(selectedDiscount2, product.price, product.price);
456
457
  const discountDetail = {
457
- amount: new import_decimal.default(product.price).minus(new import_decimal.default(targetProductTotal)).toNumber(),
458
+ amount: new import_decimal.default(product.price).minus(new import_decimal.default(targetProductTotal)).toNumber() * (product.num || 1),
458
459
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
459
460
  discount: {
460
461
  discount_card_type: (_m = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _m.discount_card_type,
@@ -564,7 +565,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
564
565
  );
565
566
  const uniqueId = flatItem._id;
566
567
  const discountDetail = {
567
- amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber(),
568
+ amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber() * (product.num || 1),
568
569
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
569
570
  discount: {
570
571
  discount_card_type: (_n = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _n.discount_card_type,
@@ -588,7 +589,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
588
589
  processedItems.push({
589
590
  ...flatItem,
590
591
  total: targetProductTotal,
591
- price: new import_decimal.default(productOriginTotal || 0).minus(discountDetail.amount).toNumber(),
592
+ price: new import_decimal.default(productOriginTotal || 0).minus(discountDetail.discount.fixed_amount).toNumber(),
592
593
  discount_list: [discountDetail],
593
594
  processed: true
594
595
  });
@@ -49,6 +49,7 @@ export interface RequestOptions {
49
49
  responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';
50
50
  withCredentials?: boolean;
51
51
  useCache?: boolean;
52
+ customToast?: () => void;
52
53
  }
53
54
  /**
54
55
  * 响应接口
@@ -122,6 +122,12 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
122
122
  throw error;
123
123
  }
124
124
  }
125
+ /**
126
+ * 初始化外设扫码结果监听
127
+ */
128
+ initPeripheralsListener() {
129
+ this.scan.initPeripheralsListener();
130
+ }
125
131
  /**
126
132
  * 获取商品列表(不加载到模块中)
127
133
  * @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;