@pisell/pisellos 2.1.100 → 2.1.101
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.
- package/dist/effects/index.d.ts +2 -2
- package/dist/modules/Customer/types.d.ts +1 -1
- package/dist/modules/Payment/types.d.ts +7 -7
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/core/index.js +28 -27
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +7 -3
- package/lib/modules/Account/index.js +10 -9
- package/lib/modules/AccountList/index.js +11 -14
- package/lib/modules/BaseModule.js +3 -6
- package/lib/modules/Cart/index.js +9 -14
- package/lib/modules/Cart/utils/cartProduct.js +6 -3
- package/lib/modules/Customer/constants.js +1 -1
- package/lib/modules/Customer/index.js +15 -18
- package/lib/modules/Customer/types.d.ts +1 -1
- package/lib/modules/Date/index.js +6 -10
- package/lib/modules/Date/types.js +0 -1
- package/lib/modules/Discount/index.js +6 -11
- package/lib/modules/Guests/index.js +15 -10
- package/lib/modules/Order/index.js +7 -10
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +73 -84
- package/lib/modules/Payment/types.d.ts +7 -7
- package/lib/modules/Payment/utils.js +6 -3
- package/lib/modules/Payment/walletpass.js +31 -31
- package/lib/modules/Product/index.js +5 -6
- package/lib/modules/ProductList/index.js +3 -5
- package/lib/modules/Resource/index.js +12 -8
- package/lib/modules/Rules/index.js +35 -21
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/lib/modules/Schedule/index.js +5 -8
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +4 -2
- package/lib/modules/Step/index.js +4 -7
- package/lib/modules/Summary/index.js +4 -9
- package/lib/modules/Summary/utils.js +16 -8
- package/lib/plugins/request.js +33 -34
- package/lib/plugins/window.js +113 -101
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +177 -110
- package/lib/solution/BookingByStep/utils/capacity.js +16 -11
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +8 -4
- package/lib/solution/BookingByStep/utils/stock.js +6 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +27 -24
- package/lib/solution/BookingTicket/index.js +14 -19
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.js +1 -3
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +9 -10
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/Checkout/index.js +211 -216
- package/lib/solution/Checkout/utils/index.js +22 -18
- package/lib/solution/RegisterAndLogin/config.js +2 -2
- package/lib/solution/RegisterAndLogin/index.js +110 -114
- package/lib/solution/RegisterAndLogin/utils.js +9 -9
- package/lib/solution/ShopDiscount/index.js +13 -16
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- package/lib/solution/ShopDiscount/utils.js +2 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/task.js +3 -3
- package/lib/utils/watch.d.ts +2 -2
- package/lib/utils/watch.js +7 -5
- package/package.json +17 -16
|
@@ -29,20 +29,16 @@ var import_config = require("./config");
|
|
|
29
29
|
__reExport(RegisterAndLogin_exports, require("./types"), module.exports);
|
|
30
30
|
__reExport(RegisterAndLogin_exports, require("./config"), module.exports);
|
|
31
31
|
var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
32
|
-
// 提供给 baseModule 用的默认名称和默认版本
|
|
33
|
-
defaultName = "registerAndLogin";
|
|
34
|
-
defaultVersion = "1.0.0";
|
|
35
|
-
isSolution = true;
|
|
36
|
-
request;
|
|
37
|
-
window;
|
|
38
|
-
store;
|
|
39
|
-
apiCaller;
|
|
40
|
-
otherParams = {};
|
|
41
|
-
channel = "default";
|
|
42
|
-
// 内存缓存
|
|
43
|
-
countriesCache = null;
|
|
44
32
|
constructor(name, version) {
|
|
45
33
|
super(name, version);
|
|
34
|
+
// 提供给 baseModule 用的默认名称和默认版本
|
|
35
|
+
this.defaultName = "registerAndLogin";
|
|
36
|
+
this.defaultVersion = "1.0.0";
|
|
37
|
+
this.isSolution = true;
|
|
38
|
+
this.otherParams = {};
|
|
39
|
+
this.channel = "default";
|
|
40
|
+
// 内存缓存
|
|
41
|
+
this.countriesCache = null;
|
|
46
42
|
}
|
|
47
43
|
/**
|
|
48
44
|
* 重新发送邮箱注册链接
|
|
@@ -50,7 +46,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
50
46
|
async resendEmailRegisterLink() {
|
|
51
47
|
try {
|
|
52
48
|
if (!this.store.emailRegisterLinkCode) {
|
|
53
|
-
const error = "
|
|
49
|
+
const error = "没有找到邮箱注册链接的 code,请先调用 sendEmailRegisterLink";
|
|
54
50
|
this.store.error = error;
|
|
55
51
|
return {
|
|
56
52
|
status: false,
|
|
@@ -72,7 +68,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
72
68
|
}
|
|
73
69
|
);
|
|
74
70
|
} else {
|
|
75
|
-
this.store.error = response.message || "
|
|
71
|
+
this.store.error = response.message || "重新发送注册邀请链接失败";
|
|
76
72
|
await this.core.effects.emit(
|
|
77
73
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
78
74
|
{
|
|
@@ -83,7 +79,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
83
79
|
}
|
|
84
80
|
return response;
|
|
85
81
|
} catch (error) {
|
|
86
|
-
this.store.error = "
|
|
82
|
+
this.store.error = "重新发送注册邀请链接失败";
|
|
87
83
|
await this.core.effects.emit(
|
|
88
84
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
89
85
|
{
|
|
@@ -124,7 +120,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
124
120
|
response.data
|
|
125
121
|
);
|
|
126
122
|
} else {
|
|
127
|
-
this.store.error = response.message || "
|
|
123
|
+
this.store.error = response.message || "邮箱验证码注册失败";
|
|
128
124
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onRegisterFailed, {
|
|
129
125
|
error: this.store.error,
|
|
130
126
|
params
|
|
@@ -132,7 +128,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
132
128
|
}
|
|
133
129
|
return response;
|
|
134
130
|
} catch (error) {
|
|
135
|
-
this.store.error = "
|
|
131
|
+
this.store.error = "邮箱验证码注册失败";
|
|
136
132
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onRegisterFailed, {
|
|
137
133
|
error: this.store.error,
|
|
138
134
|
params
|
|
@@ -168,7 +164,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
168
164
|
response.data
|
|
169
165
|
);
|
|
170
166
|
} else {
|
|
171
|
-
this.store.error = response.message || "
|
|
167
|
+
this.store.error = response.message || "注册失败";
|
|
172
168
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onRegisterFailed, {
|
|
173
169
|
error: this.store.error,
|
|
174
170
|
params
|
|
@@ -176,7 +172,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
176
172
|
}
|
|
177
173
|
return response;
|
|
178
174
|
} catch (error) {
|
|
179
|
-
this.store.error = error.message || "
|
|
175
|
+
this.store.error = error.message || "注册失败";
|
|
180
176
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onRegisterFailed, {
|
|
181
177
|
error: this.store.error,
|
|
182
178
|
params
|
|
@@ -202,15 +198,15 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
202
198
|
this.request = core.getPlugin("request");
|
|
203
199
|
this.window = core.getPlugin("window");
|
|
204
200
|
if (!this.request) {
|
|
205
|
-
throw new Error("RegisterAndLogin
|
|
201
|
+
throw new Error("RegisterAndLogin 模块需要 request 插件支持");
|
|
206
202
|
}
|
|
207
203
|
if (!this.window) {
|
|
208
|
-
throw new Error("RegisterAndLogin
|
|
204
|
+
throw new Error("RegisterAndLogin 模块需要 window 插件支持");
|
|
209
205
|
}
|
|
210
206
|
this.apiCaller = (0, import_config.createApiCaller)(this.request, this.channel);
|
|
211
207
|
await this.restoreLoginState();
|
|
212
208
|
this.getCountries();
|
|
213
|
-
console.log("[RegisterAndLogin]
|
|
209
|
+
console.log("[RegisterAndLogin] 初始化完成");
|
|
214
210
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onInited, {});
|
|
215
211
|
}
|
|
216
212
|
/**
|
|
@@ -227,7 +223,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
227
223
|
await this.validateToken(token);
|
|
228
224
|
}
|
|
229
225
|
} catch (error) {
|
|
230
|
-
console.warn("[RegisterAndLogin]
|
|
226
|
+
console.warn("[RegisterAndLogin] 恢复登录状态失败:", error);
|
|
231
227
|
this.clearLoginState();
|
|
232
228
|
}
|
|
233
229
|
}
|
|
@@ -248,7 +244,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
248
244
|
return false;
|
|
249
245
|
}
|
|
250
246
|
} catch (error) {
|
|
251
|
-
console.warn("[RegisterAndLogin] Token
|
|
247
|
+
console.warn("[RegisterAndLogin] Token 验证失败:", error);
|
|
252
248
|
this.clearLoginState();
|
|
253
249
|
return false;
|
|
254
250
|
}
|
|
@@ -290,7 +286,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
290
286
|
}
|
|
291
287
|
);
|
|
292
288
|
} else {
|
|
293
|
-
this.store.error = response.message || "
|
|
289
|
+
this.store.error = response.message || "发送验证码失败";
|
|
294
290
|
await this.core.effects.emit(
|
|
295
291
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
296
292
|
{
|
|
@@ -301,7 +297,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
301
297
|
}
|
|
302
298
|
return response;
|
|
303
299
|
} catch (error) {
|
|
304
|
-
this.store.error = "
|
|
300
|
+
this.store.error = "发送验证码失败";
|
|
305
301
|
await this.core.effects.emit(
|
|
306
302
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
307
303
|
{
|
|
@@ -341,7 +337,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
341
337
|
}
|
|
342
338
|
);
|
|
343
339
|
} else {
|
|
344
|
-
this.store.error = response.message || "
|
|
340
|
+
this.store.error = response.message || "发送验证码失败";
|
|
345
341
|
await this.core.effects.emit(
|
|
346
342
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
347
343
|
{
|
|
@@ -352,7 +348,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
352
348
|
}
|
|
353
349
|
return response;
|
|
354
350
|
} catch (error) {
|
|
355
|
-
this.store.error = "
|
|
351
|
+
this.store.error = "发送验证码失败";
|
|
356
352
|
await this.core.effects.emit(
|
|
357
353
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
358
354
|
{
|
|
@@ -392,7 +388,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
392
388
|
}
|
|
393
389
|
);
|
|
394
390
|
} else {
|
|
395
|
-
this.store.error = response.message || "
|
|
391
|
+
this.store.error = response.message || "发送注册验证码失败";
|
|
396
392
|
await this.core.effects.emit(
|
|
397
393
|
import_types.RegisterAndLoginHooks.onSmsVerificationFailed,
|
|
398
394
|
{
|
|
@@ -403,7 +399,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
403
399
|
}
|
|
404
400
|
return response;
|
|
405
401
|
} catch (error) {
|
|
406
|
-
this.store.error = "
|
|
402
|
+
this.store.error = "发送注册验证码失败";
|
|
407
403
|
await this.core.effects.emit(
|
|
408
404
|
import_types.RegisterAndLoginHooks.onSmsVerificationFailed,
|
|
409
405
|
{
|
|
@@ -447,7 +443,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
447
443
|
}
|
|
448
444
|
);
|
|
449
445
|
} else {
|
|
450
|
-
this.store.error = response.message || "
|
|
446
|
+
this.store.error = response.message || "发送注册邀请链接失败";
|
|
451
447
|
await this.core.effects.emit(
|
|
452
448
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
453
449
|
{
|
|
@@ -458,7 +454,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
458
454
|
}
|
|
459
455
|
return response;
|
|
460
456
|
} catch (error) {
|
|
461
|
-
this.store.error = "
|
|
457
|
+
this.store.error = "发送注册邀请链接失败";
|
|
462
458
|
await this.core.effects.emit(
|
|
463
459
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
464
460
|
{
|
|
@@ -491,7 +487,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
491
487
|
}
|
|
492
488
|
);
|
|
493
489
|
} else {
|
|
494
|
-
this.store.error = response.message || "
|
|
490
|
+
this.store.error = response.message || "邮箱注册链接验证失败";
|
|
495
491
|
await this.core.effects.emit(
|
|
496
492
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
497
493
|
{
|
|
@@ -502,7 +498,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
502
498
|
}
|
|
503
499
|
return response;
|
|
504
500
|
} catch (error) {
|
|
505
|
-
this.store.error = "
|
|
501
|
+
this.store.error = "邮箱注册链接验证失败";
|
|
506
502
|
await this.core.effects.emit(
|
|
507
503
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
508
504
|
{
|
|
@@ -543,7 +539,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
543
539
|
loginType: "email-password"
|
|
544
540
|
});
|
|
545
541
|
} else {
|
|
546
|
-
this.store.error = response.message || "
|
|
542
|
+
this.store.error = response.message || "邮箱密码登录失败";
|
|
547
543
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
548
544
|
error: this.store.error,
|
|
549
545
|
loginType: "email-password"
|
|
@@ -551,7 +547,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
551
547
|
}
|
|
552
548
|
return response;
|
|
553
549
|
} catch (error) {
|
|
554
|
-
this.store.error = "
|
|
550
|
+
this.store.error = "邮箱密码登录失败";
|
|
555
551
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
556
552
|
error: this.store.error,
|
|
557
553
|
loginType: "email-password"
|
|
@@ -579,7 +575,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
579
575
|
purpose: params.purpose
|
|
580
576
|
});
|
|
581
577
|
} else {
|
|
582
|
-
this.store.error = response.message || "
|
|
578
|
+
this.store.error = response.message || "验证码验证失败";
|
|
583
579
|
const hookName = params.type === import_types.VerificationCodeType.EMAIL ? import_types.RegisterAndLoginHooks.onEmailVerificationFailed : import_types.RegisterAndLoginHooks.onSmsVerificationFailed;
|
|
584
580
|
await this.core.effects.emit(hookName, {
|
|
585
581
|
target: params.target,
|
|
@@ -588,7 +584,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
588
584
|
}
|
|
589
585
|
return response;
|
|
590
586
|
} catch (error) {
|
|
591
|
-
this.store.error = "
|
|
587
|
+
this.store.error = "验证码验证失败";
|
|
592
588
|
return error;
|
|
593
589
|
} finally {
|
|
594
590
|
this.store.isLoading = false;
|
|
@@ -620,7 +616,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
620
616
|
response.data
|
|
621
617
|
);
|
|
622
618
|
} else {
|
|
623
|
-
this.store.error = response.message || "
|
|
619
|
+
this.store.error = response.message || "注册失败";
|
|
624
620
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onRegisterFailed, {
|
|
625
621
|
error: this.store.error,
|
|
626
622
|
params
|
|
@@ -628,7 +624,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
628
624
|
}
|
|
629
625
|
return response;
|
|
630
626
|
} catch (error) {
|
|
631
|
-
this.store.error = "
|
|
627
|
+
this.store.error = "注册失败";
|
|
632
628
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onRegisterFailed, {
|
|
633
629
|
error: this.store.error,
|
|
634
630
|
params
|
|
@@ -662,7 +658,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
662
658
|
response.data
|
|
663
659
|
);
|
|
664
660
|
} else {
|
|
665
|
-
this.store.error = response.message || "
|
|
661
|
+
this.store.error = response.message || "登录失败";
|
|
666
662
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
667
663
|
error: this.store.error,
|
|
668
664
|
params
|
|
@@ -670,7 +666,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
670
666
|
}
|
|
671
667
|
return response;
|
|
672
668
|
} catch (error) {
|
|
673
|
-
this.store.error = "
|
|
669
|
+
this.store.error = "登录失败";
|
|
674
670
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
675
671
|
error: this.store.error,
|
|
676
672
|
params
|
|
@@ -701,7 +697,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
701
697
|
response.data
|
|
702
698
|
);
|
|
703
699
|
} else {
|
|
704
|
-
this.store.error = response.message || "OAuth
|
|
700
|
+
this.store.error = response.message || "OAuth 登录失败";
|
|
705
701
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onOAuthLoginFailed, {
|
|
706
702
|
error: this.store.error,
|
|
707
703
|
params
|
|
@@ -709,7 +705,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
709
705
|
}
|
|
710
706
|
return response;
|
|
711
707
|
} catch (error) {
|
|
712
|
-
this.store.error = "OAuth
|
|
708
|
+
this.store.error = "OAuth 登录失败";
|
|
713
709
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onOAuthLoginFailed, {
|
|
714
710
|
error: this.store.error,
|
|
715
711
|
params
|
|
@@ -726,7 +722,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
726
722
|
try {
|
|
727
723
|
await this.apiCaller.call("logout");
|
|
728
724
|
} catch (error) {
|
|
729
|
-
console.warn("[RegisterAndLogin]
|
|
725
|
+
console.warn("[RegisterAndLogin] 登出接口调用失败:", error);
|
|
730
726
|
} finally {
|
|
731
727
|
this.clearLoginState();
|
|
732
728
|
}
|
|
@@ -752,11 +748,11 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
752
748
|
purpose: "reset-password-link"
|
|
753
749
|
});
|
|
754
750
|
} else {
|
|
755
|
-
this.store.error = response.message || "
|
|
751
|
+
this.store.error = response.message || "发送重置密码链接失败";
|
|
756
752
|
}
|
|
757
753
|
return response;
|
|
758
754
|
} catch (error) {
|
|
759
|
-
this.store.error = "
|
|
755
|
+
this.store.error = "发送重置密码链接失败";
|
|
760
756
|
return error;
|
|
761
757
|
} finally {
|
|
762
758
|
this.store.isLoading = false;
|
|
@@ -772,11 +768,11 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
772
768
|
params
|
|
773
769
|
);
|
|
774
770
|
if (!response.status) {
|
|
775
|
-
this.store.error = response.message || "
|
|
771
|
+
this.store.error = response.message || "验证码无效";
|
|
776
772
|
}
|
|
777
773
|
return response;
|
|
778
774
|
} catch (error) {
|
|
779
|
-
this.store.error = "
|
|
775
|
+
this.store.error = "验证码验证失败";
|
|
780
776
|
return error;
|
|
781
777
|
} finally {
|
|
782
778
|
this.store.isLoading = false;
|
|
@@ -792,11 +788,11 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
792
788
|
params
|
|
793
789
|
);
|
|
794
790
|
if (!response.status) {
|
|
795
|
-
this.store.error = response.message || "
|
|
791
|
+
this.store.error = response.message || "邮件链接验证码无效";
|
|
796
792
|
}
|
|
797
793
|
return response;
|
|
798
794
|
} catch (error) {
|
|
799
|
-
this.store.error = "
|
|
795
|
+
this.store.error = "邮件链接验证码验证失败";
|
|
800
796
|
return error;
|
|
801
797
|
} finally {
|
|
802
798
|
this.store.isLoading = false;
|
|
@@ -819,7 +815,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
819
815
|
code: params.code
|
|
820
816
|
});
|
|
821
817
|
} else {
|
|
822
|
-
this.store.error = response.message || "
|
|
818
|
+
this.store.error = response.message || "密码重置失败";
|
|
823
819
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onPasswordResetFailed, {
|
|
824
820
|
code: params.code,
|
|
825
821
|
error: this.store.error
|
|
@@ -827,7 +823,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
827
823
|
}
|
|
828
824
|
return response;
|
|
829
825
|
} catch (error) {
|
|
830
|
-
this.store.error = "
|
|
826
|
+
this.store.error = "密码重置失败";
|
|
831
827
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onPasswordResetFailed, {
|
|
832
828
|
code: params.code,
|
|
833
829
|
error: this.store.error
|
|
@@ -856,7 +852,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
856
852
|
let response;
|
|
857
853
|
if (params.type === "email") {
|
|
858
854
|
if (!params.target.email) {
|
|
859
|
-
throw new Error("
|
|
855
|
+
throw new Error("邮箱地址不能为空");
|
|
860
856
|
}
|
|
861
857
|
response = await this.apiCaller.call(
|
|
862
858
|
"resetPasswordByEmail",
|
|
@@ -868,7 +864,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
868
864
|
);
|
|
869
865
|
} else {
|
|
870
866
|
if (!params.target.phone || !params.target.country_calling_code) {
|
|
871
|
-
throw new Error("
|
|
867
|
+
throw new Error("手机号和国家区号不能为空");
|
|
872
868
|
}
|
|
873
869
|
response = await this.apiCaller.call(
|
|
874
870
|
"resetPasswordByPhone",
|
|
@@ -895,7 +891,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
895
891
|
});
|
|
896
892
|
}
|
|
897
893
|
} else {
|
|
898
|
-
this.store.error = response.message || "
|
|
894
|
+
this.store.error = response.message || "密码重置失败";
|
|
899
895
|
if (params.type === "email") {
|
|
900
896
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onPasswordResetFailed, {
|
|
901
897
|
email: params.target.email,
|
|
@@ -910,7 +906,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
910
906
|
}
|
|
911
907
|
return response;
|
|
912
908
|
} catch (error) {
|
|
913
|
-
this.store.error = "
|
|
909
|
+
this.store.error = "密码重置失败";
|
|
914
910
|
if (params.type === "email") {
|
|
915
911
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onPasswordResetFailed, {
|
|
916
912
|
email: params.target.email,
|
|
@@ -952,7 +948,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
952
948
|
}
|
|
953
949
|
);
|
|
954
950
|
} else {
|
|
955
|
-
this.store.error = response.message || "
|
|
951
|
+
this.store.error = response.message || "发送登录验证码失败";
|
|
956
952
|
await this.core.effects.emit(
|
|
957
953
|
import_types.RegisterAndLoginHooks.onSmsVerificationFailed,
|
|
958
954
|
{
|
|
@@ -963,7 +959,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
963
959
|
}
|
|
964
960
|
return response;
|
|
965
961
|
} catch (error) {
|
|
966
|
-
this.store.error = "
|
|
962
|
+
this.store.error = "发送登录验证码失败";
|
|
967
963
|
await this.core.effects.emit(
|
|
968
964
|
import_types.RegisterAndLoginHooks.onSmsVerificationFailed,
|
|
969
965
|
{
|
|
@@ -1002,7 +998,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1002
998
|
loginType: "phone-code"
|
|
1003
999
|
});
|
|
1004
1000
|
} else {
|
|
1005
|
-
this.store.error = response.message || "
|
|
1001
|
+
this.store.error = response.message || "手机号验证码登录失败";
|
|
1006
1002
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
1007
1003
|
error: this.store.error,
|
|
1008
1004
|
loginType: "phone-code"
|
|
@@ -1010,7 +1006,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1010
1006
|
}
|
|
1011
1007
|
return response;
|
|
1012
1008
|
} catch (error) {
|
|
1013
|
-
this.store.error = "
|
|
1009
|
+
this.store.error = "手机号验证码登录失败";
|
|
1014
1010
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
1015
1011
|
error: this.store.error,
|
|
1016
1012
|
loginType: "phone-code"
|
|
@@ -1063,7 +1059,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1063
1059
|
loginType: "guest"
|
|
1064
1060
|
});
|
|
1065
1061
|
} else {
|
|
1066
|
-
this.store.error = response.message || "Guest
|
|
1062
|
+
this.store.error = response.message || "Guest 登录失败";
|
|
1067
1063
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
1068
1064
|
error: this.store.error,
|
|
1069
1065
|
loginType: "guest"
|
|
@@ -1071,7 +1067,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1071
1067
|
}
|
|
1072
1068
|
return response;
|
|
1073
1069
|
} catch (error) {
|
|
1074
|
-
this.store.error = "Guest
|
|
1070
|
+
this.store.error = "Guest 登录失败";
|
|
1075
1071
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
1076
1072
|
error: this.store.error,
|
|
1077
1073
|
loginType: "guest"
|
|
@@ -1088,11 +1084,11 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1088
1084
|
this.store.error = null;
|
|
1089
1085
|
const response = await this.apiCaller.call("checkEmailExists", params);
|
|
1090
1086
|
if (!response.status) {
|
|
1091
|
-
this.store.error = response.message || "
|
|
1087
|
+
this.store.error = response.message || "检查邮箱失败";
|
|
1092
1088
|
}
|
|
1093
1089
|
return response;
|
|
1094
1090
|
} catch (error) {
|
|
1095
|
-
this.store.error = "
|
|
1091
|
+
this.store.error = "检查邮箱失败";
|
|
1096
1092
|
return error;
|
|
1097
1093
|
} finally {
|
|
1098
1094
|
this.store.isLoading = false;
|
|
@@ -1105,11 +1101,11 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1105
1101
|
this.store.error = null;
|
|
1106
1102
|
const response = await this.apiCaller.call("checkEmailCode", params);
|
|
1107
1103
|
if (!response.status) {
|
|
1108
|
-
this.store.error = response.message || "
|
|
1104
|
+
this.store.error = response.message || "检查邮箱验证码失败";
|
|
1109
1105
|
}
|
|
1110
1106
|
return response;
|
|
1111
1107
|
} catch (error) {
|
|
1112
|
-
this.store.error = "
|
|
1108
|
+
this.store.error = "检查邮箱验证码失败";
|
|
1113
1109
|
return error;
|
|
1114
1110
|
} finally {
|
|
1115
1111
|
this.store.isLoading = false;
|
|
@@ -1122,11 +1118,11 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1122
1118
|
this.store.error = null;
|
|
1123
1119
|
const response = await this.apiCaller.call("checkMobileCode", params);
|
|
1124
1120
|
if (!response.status) {
|
|
1125
|
-
this.store.error = response.message || "
|
|
1121
|
+
this.store.error = response.message || "检查手机验证码失败";
|
|
1126
1122
|
}
|
|
1127
1123
|
return response;
|
|
1128
1124
|
} catch (error) {
|
|
1129
|
-
this.store.error = "
|
|
1125
|
+
this.store.error = "检查手机验证码失败";
|
|
1130
1126
|
return error;
|
|
1131
1127
|
} finally {
|
|
1132
1128
|
this.store.isLoading = false;
|
|
@@ -1158,7 +1154,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1158
1154
|
loginType: "phone-password"
|
|
1159
1155
|
});
|
|
1160
1156
|
} else {
|
|
1161
|
-
this.store.error = response.message || "
|
|
1157
|
+
this.store.error = response.message || "手机号密码登录失败";
|
|
1162
1158
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
1163
1159
|
error: this.store.error,
|
|
1164
1160
|
loginType: "phone-password"
|
|
@@ -1166,7 +1162,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1166
1162
|
}
|
|
1167
1163
|
return response;
|
|
1168
1164
|
} catch (error) {
|
|
1169
|
-
this.store.error = "
|
|
1165
|
+
this.store.error = "手机号密码登录失败";
|
|
1170
1166
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginFailed, {
|
|
1171
1167
|
error: this.store.error,
|
|
1172
1168
|
loginType: "phone-password"
|
|
@@ -1198,7 +1194,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1198
1194
|
purpose: import_types.VerificationPurpose.PASSWORD_RESET
|
|
1199
1195
|
});
|
|
1200
1196
|
} else {
|
|
1201
|
-
this.store.error = response.message || "
|
|
1197
|
+
this.store.error = response.message || "发送密码重置验证码失败";
|
|
1202
1198
|
this.core.effects.emit(
|
|
1203
1199
|
import_types.RegisterAndLoginHooks.onEmailVerificationFailed,
|
|
1204
1200
|
{
|
|
@@ -1209,7 +1205,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1209
1205
|
}
|
|
1210
1206
|
return response;
|
|
1211
1207
|
} catch (error) {
|
|
1212
|
-
this.store.error = "
|
|
1208
|
+
this.store.error = "发送密码重置验证码失败";
|
|
1213
1209
|
this.core.effects.emit(import_types.RegisterAndLoginHooks.onEmailVerificationFailed, {
|
|
1214
1210
|
target: params.email,
|
|
1215
1211
|
error: this.store.error
|
|
@@ -1231,11 +1227,11 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1231
1227
|
if (response.status) {
|
|
1232
1228
|
return response;
|
|
1233
1229
|
} else {
|
|
1234
|
-
this.store.error = response.message || "
|
|
1230
|
+
this.store.error = response.message || "发送手机号验证码重置密码失败";
|
|
1235
1231
|
}
|
|
1236
1232
|
return response;
|
|
1237
1233
|
} catch (error) {
|
|
1238
|
-
this.store.error = "
|
|
1234
|
+
this.store.error = "发送手机号验证码重置密码失败";
|
|
1239
1235
|
return error;
|
|
1240
1236
|
} finally {
|
|
1241
1237
|
this.store.isLoading = false;
|
|
@@ -1298,7 +1294,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1298
1294
|
async initFacebookSDK(token) {
|
|
1299
1295
|
return new Promise((resolve, reject) => {
|
|
1300
1296
|
if (typeof window === "undefined") {
|
|
1301
|
-
reject(new Error("Facebook SDK
|
|
1297
|
+
reject(new Error("Facebook SDK 只能在浏览器环境中使用"));
|
|
1302
1298
|
return;
|
|
1303
1299
|
}
|
|
1304
1300
|
if (window.FB) {
|
|
@@ -1320,7 +1316,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1320
1316
|
resolve();
|
|
1321
1317
|
};
|
|
1322
1318
|
script.onerror = () => {
|
|
1323
|
-
reject(new Error("Facebook SDK
|
|
1319
|
+
reject(new Error("Facebook SDK 加载失败"));
|
|
1324
1320
|
};
|
|
1325
1321
|
document.head.appendChild(script);
|
|
1326
1322
|
});
|
|
@@ -1331,7 +1327,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1331
1327
|
async initAppleSDK() {
|
|
1332
1328
|
return new Promise((resolve, reject) => {
|
|
1333
1329
|
if (typeof window === "undefined") {
|
|
1334
|
-
reject(new Error("Apple SDK
|
|
1330
|
+
reject(new Error("Apple SDK 只能在浏览器环境中使用"));
|
|
1335
1331
|
return;
|
|
1336
1332
|
}
|
|
1337
1333
|
if (window.AppleID) {
|
|
@@ -1348,12 +1344,12 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1348
1344
|
if (window.AppleID) {
|
|
1349
1345
|
resolve();
|
|
1350
1346
|
} else {
|
|
1351
|
-
reject(new Error("Apple SDK
|
|
1347
|
+
reject(new Error("Apple SDK 加载失败:AppleID 对象不可用"));
|
|
1352
1348
|
}
|
|
1353
1349
|
}, 100);
|
|
1354
1350
|
};
|
|
1355
1351
|
script.onerror = () => {
|
|
1356
|
-
reject(new Error("Apple SDK
|
|
1352
|
+
reject(new Error("Apple SDK 加载失败"));
|
|
1357
1353
|
};
|
|
1358
1354
|
document.head.appendChild(script);
|
|
1359
1355
|
});
|
|
@@ -1362,38 +1358,38 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1362
1358
|
* Facebook 登录
|
|
1363
1359
|
*/
|
|
1364
1360
|
async loginWithFacebook(token) {
|
|
1365
|
-
console.log("[RegisterAndLogin] Facebook
|
|
1361
|
+
console.log("[RegisterAndLogin] Facebook 登录开始", {
|
|
1366
1362
|
tokenLength: (token == null ? void 0 : token.length) || 0,
|
|
1367
1363
|
timestamp: Date.now()
|
|
1368
1364
|
});
|
|
1369
1365
|
await this.initFacebookSDK(token);
|
|
1370
|
-
console.log("[RegisterAndLogin] Facebook SDK
|
|
1366
|
+
console.log("[RegisterAndLogin] Facebook SDK 初始化完成,准备调用 FB.login");
|
|
1371
1367
|
return new Promise((resolve, reject) => {
|
|
1372
|
-
console.log("[RegisterAndLogin]
|
|
1368
|
+
console.log("[RegisterAndLogin] 调用 FB.login", {
|
|
1373
1369
|
scope: "email,public_profile"
|
|
1374
1370
|
});
|
|
1375
1371
|
window.FB.login(
|
|
1376
1372
|
async (response) => {
|
|
1377
|
-
console.log("[RegisterAndLogin] FB.login
|
|
1373
|
+
console.log("[RegisterAndLogin] FB.login 回调触发", {
|
|
1378
1374
|
hasAuthResponse: Boolean(response == null ? void 0 : response.authResponse),
|
|
1379
1375
|
status: response == null ? void 0 : response.status
|
|
1380
1376
|
});
|
|
1381
1377
|
if (response.authResponse) {
|
|
1382
1378
|
try {
|
|
1383
|
-
console.log("[RegisterAndLogin]
|
|
1379
|
+
console.log("[RegisterAndLogin] 调用后端 facebookLogin 接口");
|
|
1384
1380
|
const result = await this.apiCaller.call("facebookLogin", {
|
|
1385
1381
|
token: response.authResponse.accessToken
|
|
1386
1382
|
});
|
|
1387
|
-
console.log("[RegisterAndLogin] facebookLogin
|
|
1383
|
+
console.log("[RegisterAndLogin] facebookLogin 接口返回成功", {
|
|
1388
1384
|
hasResult: Boolean(result)
|
|
1389
1385
|
});
|
|
1390
1386
|
resolve(result);
|
|
1391
1387
|
} catch (error) {
|
|
1392
|
-
console.error("[RegisterAndLogin] facebookLogin
|
|
1388
|
+
console.error("[RegisterAndLogin] facebookLogin 接口调用失败", error);
|
|
1393
1389
|
reject(error);
|
|
1394
1390
|
}
|
|
1395
1391
|
} else {
|
|
1396
|
-
console.warn("[RegisterAndLogin] FB.login
|
|
1392
|
+
console.warn("[RegisterAndLogin] FB.login 用户取消授权或无 authResponse", response);
|
|
1397
1393
|
reject(new Error("facebook_login_cancel"));
|
|
1398
1394
|
}
|
|
1399
1395
|
},
|
|
@@ -1405,16 +1401,16 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1405
1401
|
* Apple 登录(需要在支持的环境中使用)
|
|
1406
1402
|
*/
|
|
1407
1403
|
async loginWithApple(token) {
|
|
1408
|
-
console.log("[RegisterAndLogin] Apple
|
|
1404
|
+
console.log("[RegisterAndLogin] Apple 登录开始", {
|
|
1409
1405
|
tokenLength: (token == null ? void 0 : token.length) || 0,
|
|
1410
1406
|
timestamp: Date.now()
|
|
1411
1407
|
});
|
|
1412
1408
|
await this.initAppleSDK();
|
|
1413
|
-
console.log("[RegisterAndLogin] Apple SDK
|
|
1409
|
+
console.log("[RegisterAndLogin] Apple SDK 初始化完成");
|
|
1414
1410
|
return new Promise((resolve, reject) => {
|
|
1415
1411
|
var _a, _b, _c, _d;
|
|
1416
1412
|
try {
|
|
1417
|
-
console.log("[RegisterAndLogin]
|
|
1413
|
+
console.log("[RegisterAndLogin] 创建临时 Apple SignIn 按钮节点");
|
|
1418
1414
|
const appleSignInDiv = document.createElement("div");
|
|
1419
1415
|
appleSignInDiv.id = "appleid-signin-temp";
|
|
1420
1416
|
appleSignInDiv.setAttribute("data-color", "black");
|
|
@@ -1429,9 +1425,9 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1429
1425
|
appleSignInDiv.style.width = "1px";
|
|
1430
1426
|
appleSignInDiv.style.height = "1px";
|
|
1431
1427
|
document.body.appendChild(appleSignInDiv);
|
|
1432
|
-
console.log("[RegisterAndLogin] Apple SignIn
|
|
1428
|
+
console.log("[RegisterAndLogin] Apple SignIn 按钮已添加到文档");
|
|
1433
1429
|
if ((_b = (_a = window.AppleID) == null ? void 0 : _a.auth) == null ? void 0 : _b.init) {
|
|
1434
|
-
console.log("[RegisterAndLogin]
|
|
1430
|
+
console.log("[RegisterAndLogin] 调用 AppleID.auth.init");
|
|
1435
1431
|
window.AppleID.auth.init({
|
|
1436
1432
|
clientId: token,
|
|
1437
1433
|
// 使用传入的 token 作为 clientId
|
|
@@ -1441,52 +1437,52 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1441
1437
|
usePopup: true
|
|
1442
1438
|
});
|
|
1443
1439
|
} else {
|
|
1444
|
-
console.warn("[RegisterAndLogin] AppleID.auth.init
|
|
1440
|
+
console.warn("[RegisterAndLogin] AppleID.auth.init 方法不可用");
|
|
1445
1441
|
}
|
|
1446
1442
|
if ((_d = (_c = window.AppleID) == null ? void 0 : _c.auth) == null ? void 0 : _d.signIn) {
|
|
1447
|
-
console.log("[RegisterAndLogin]
|
|
1443
|
+
console.log("[RegisterAndLogin] 调用 AppleID.auth.signIn");
|
|
1448
1444
|
window.AppleID.auth.signIn().then(async (authResult) => {
|
|
1449
1445
|
var _a2, _b2;
|
|
1450
1446
|
try {
|
|
1451
1447
|
if (document.body.contains(appleSignInDiv)) {
|
|
1452
1448
|
document.body.removeChild(appleSignInDiv);
|
|
1453
1449
|
}
|
|
1454
|
-
console.log("[RegisterAndLogin] Apple SignIn
|
|
1450
|
+
console.log("[RegisterAndLogin] Apple SignIn 成功,临时节点已移除", {
|
|
1455
1451
|
hasAuthorization: Boolean(authResult == null ? void 0 : authResult.authorization),
|
|
1456
1452
|
hasUser: Boolean(authResult == null ? void 0 : authResult.user)
|
|
1457
1453
|
});
|
|
1458
1454
|
const authorizationCode = (_a2 = authResult.authorization) == null ? void 0 : _a2.code;
|
|
1459
1455
|
const identityToken = (_b2 = authResult.authorization) == null ? void 0 : _b2.id_token;
|
|
1460
|
-
console.log("[RegisterAndLogin] Apple
|
|
1456
|
+
console.log("[RegisterAndLogin] Apple 授权结果解析", {
|
|
1461
1457
|
hasAuthorizationCode: Boolean(authorizationCode),
|
|
1462
1458
|
hasIdentityToken: Boolean(identityToken)
|
|
1463
1459
|
});
|
|
1464
|
-
console.log("[RegisterAndLogin]
|
|
1460
|
+
console.log("[RegisterAndLogin] 调用后端 appleLogin 接口");
|
|
1465
1461
|
const result = await this.apiCaller.call("appleLogin", {
|
|
1466
1462
|
code: identityToken || authorizationCode,
|
|
1467
1463
|
login_channel: this.channel
|
|
1468
1464
|
});
|
|
1469
|
-
console.log("[RegisterAndLogin] appleLogin
|
|
1465
|
+
console.log("[RegisterAndLogin] appleLogin 接口返回成功", {
|
|
1470
1466
|
hasResult: Boolean(result)
|
|
1471
1467
|
});
|
|
1472
1468
|
resolve(result);
|
|
1473
1469
|
} catch (error) {
|
|
1474
|
-
console.error("[RegisterAndLogin]
|
|
1470
|
+
console.error("[RegisterAndLogin] 处理 Apple 登录结果失败", error);
|
|
1475
1471
|
reject(error);
|
|
1476
1472
|
}
|
|
1477
1473
|
}).catch((error) => {
|
|
1478
1474
|
if (document.body.contains(appleSignInDiv)) {
|
|
1479
1475
|
document.body.removeChild(appleSignInDiv);
|
|
1480
1476
|
}
|
|
1481
|
-
console.error("[RegisterAndLogin] Apple SignIn Promise
|
|
1482
|
-
reject(new Error("Apple
|
|
1477
|
+
console.error("[RegisterAndLogin] Apple SignIn Promise 拒绝", error);
|
|
1478
|
+
reject(new Error("Apple 登录失败: " + ((error == null ? void 0 : error.error) || (error == null ? void 0 : error.message) || "未知错误")));
|
|
1483
1479
|
});
|
|
1484
1480
|
} else {
|
|
1485
|
-
console.error("[RegisterAndLogin] AppleID.auth.signIn
|
|
1486
|
-
reject(new Error("Apple SDK
|
|
1481
|
+
console.error("[RegisterAndLogin] AppleID.auth.signIn 方法不可用");
|
|
1482
|
+
reject(new Error("Apple SDK 未正确加载"));
|
|
1487
1483
|
}
|
|
1488
1484
|
} catch (error) {
|
|
1489
|
-
console.error("[RegisterAndLogin] Apple
|
|
1485
|
+
console.error("[RegisterAndLogin] Apple 登录流程异常", error);
|
|
1490
1486
|
reject(error);
|
|
1491
1487
|
}
|
|
1492
1488
|
});
|
|
@@ -1531,7 +1527,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1531
1527
|
cachedData = JSON.parse(cached);
|
|
1532
1528
|
}
|
|
1533
1529
|
} catch (error) {
|
|
1534
|
-
console.warn("[RegisterAndLogin] localStorage
|
|
1530
|
+
console.warn("[RegisterAndLogin] localStorage 缓存解析失败:", error);
|
|
1535
1531
|
}
|
|
1536
1532
|
if (cachedData && Array.isArray(cachedData) && cachedData.length > 0) {
|
|
1537
1533
|
this.countriesCache = cachedData;
|
|
@@ -1546,16 +1542,16 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1546
1542
|
try {
|
|
1547
1543
|
localStorage.setItem(CACHE_KEY, JSON.stringify(countries));
|
|
1548
1544
|
} catch (error) {
|
|
1549
|
-
console.warn("[RegisterAndLogin] localStorage
|
|
1545
|
+
console.warn("[RegisterAndLogin] localStorage 存储失败:", error);
|
|
1550
1546
|
}
|
|
1551
1547
|
return countries;
|
|
1552
1548
|
} else {
|
|
1553
|
-
this.store.error = response.message || "
|
|
1549
|
+
this.store.error = response.message || "获取国家区号失败";
|
|
1554
1550
|
throw new Error(this.store.error);
|
|
1555
1551
|
}
|
|
1556
1552
|
} catch (error) {
|
|
1557
|
-
this.store.error = "
|
|
1558
|
-
console.error("[RegisterAndLogin]
|
|
1553
|
+
this.store.error = "获取国家区号失败";
|
|
1554
|
+
console.error("[RegisterAndLogin] 获取国家区号失败:", error);
|
|
1559
1555
|
throw error;
|
|
1560
1556
|
} finally {
|
|
1561
1557
|
this.store.isLoading = false;
|
|
@@ -1575,18 +1571,18 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
|
|
|
1575
1571
|
try {
|
|
1576
1572
|
localStorage.setItem(cacheKey, JSON.stringify(newData));
|
|
1577
1573
|
} catch (error) {
|
|
1578
|
-
console.warn("[RegisterAndLogin] localStorage
|
|
1574
|
+
console.warn("[RegisterAndLogin] localStorage 更新失败:", error);
|
|
1579
1575
|
}
|
|
1580
|
-
console.log("[RegisterAndLogin]
|
|
1576
|
+
console.log("[RegisterAndLogin] 国家数据已更新");
|
|
1581
1577
|
}
|
|
1582
1578
|
}
|
|
1583
1579
|
} catch (error) {
|
|
1584
|
-
console.warn("[RegisterAndLogin]
|
|
1580
|
+
console.warn("[RegisterAndLogin] 后台更新国家数据失败:", error);
|
|
1585
1581
|
}
|
|
1586
1582
|
}
|
|
1587
1583
|
async destroy() {
|
|
1588
1584
|
await this.core.effects.emit(import_types.RegisterAndLoginHooks.onDestroy, {});
|
|
1589
|
-
console.log("[RegisterAndLogin]
|
|
1585
|
+
console.log("[RegisterAndLogin] 已销毁");
|
|
1590
1586
|
}
|
|
1591
1587
|
};
|
|
1592
1588
|
// Annotate the CommonJS export names for ESM import in node:
|