@seayoo-web/gamer-api 2.0.3 → 2.0.6
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/index.js +66 -62
- package/package.json +9 -10
- package/types/src/event.engage/engage.d.ts +3 -2
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@ var ue = Object.defineProperty;
|
|
|
2
2
|
var le = (i, t, n) => t in i ? ue(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
|
|
3
3
|
var l = (i, t, n) => le(i, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { isComboWebView as me } from "@seayoo-web/combo-webview";
|
|
5
|
-
import { isPlainObject as
|
|
5
|
+
import { isPlainObject as k, useConsole as de, Support as _, usePromise as ge, pruneURL as pe, queryString as L, pruneObject as a, v as e, omitFields as v, typedObjectGuard as o, parseJSON as _e, removePara as G } from "@seayoo-web/utils";
|
|
6
6
|
import "@seayoo-web/request";
|
|
7
7
|
function be(i) {
|
|
8
|
-
return
|
|
8
|
+
return k(i, "gamer_token") && typeof i.gamer_token == "string";
|
|
9
9
|
}
|
|
10
10
|
function A(i) {
|
|
11
|
-
return
|
|
11
|
+
return k(i);
|
|
12
12
|
}
|
|
13
13
|
const y = de("GamerApiSDK");
|
|
14
14
|
function ye(i) {
|
|
@@ -83,7 +83,7 @@ class hr {
|
|
|
83
83
|
requestTransformer: (u) => {
|
|
84
84
|
this.$gamerToken && (u.headers.Authorization = `Bearer ${this.$gamerToken}`);
|
|
85
85
|
}
|
|
86
|
-
}), me() ? this.$gamerToken =
|
|
86
|
+
}), me() ? this.$gamerToken = L("gamer_token") : this.loadGamerTokenCache();
|
|
87
87
|
}
|
|
88
88
|
loadGamerTokenCache() {
|
|
89
89
|
const n = this.storage.get(f).match(/^(\d{12,})#(.{8,})$/);
|
|
@@ -352,7 +352,7 @@ const ke = {
|
|
|
352
352
|
updated_at: e.number(),
|
|
353
353
|
redeemable_quantity: e.number().optional()
|
|
354
354
|
}).lock(), De = e.object({
|
|
355
|
-
...
|
|
355
|
+
...v(K.shape, "tag"),
|
|
356
356
|
product: X.clone().optional()
|
|
357
357
|
}).lock(), wr = e.union(
|
|
358
358
|
e.object({
|
|
@@ -375,7 +375,7 @@ const ke = {
|
|
|
375
375
|
server_id: e.string(),
|
|
376
376
|
role_id: e.string(),
|
|
377
377
|
role_name: e.string()
|
|
378
|
-
}).lock(),
|
|
378
|
+
}).lock(), Oe = e.object({
|
|
379
379
|
redemption_id: e.number(),
|
|
380
380
|
player_id: e.string(),
|
|
381
381
|
product_id: e.number(),
|
|
@@ -389,11 +389,11 @@ const ke = {
|
|
|
389
389
|
status: xe,
|
|
390
390
|
created_at: e.number(),
|
|
391
391
|
extra_data: e.union(Ge.clone(), Ae.clone()).satisfies().optional()
|
|
392
|
-
}),
|
|
392
|
+
}), Ne = e.guard(Se), O = o({ player: Le }), Be = o({ roles: e.array(z) }), T = o({ role_card: $e }), N = e.guard(Ue), B = e.guard(J), Qe = o({ addresses: e.array(J) }), Me = e.guard(Fe), He = o({
|
|
393
393
|
credit_logs: e.array(Ie),
|
|
394
394
|
next_token: e.string().optional()
|
|
395
395
|
}), ze = o({ products: e.array(X) }), Je = o({ benefits: e.array(K) }), Ke = o({ benefit: De }), Xe = o({
|
|
396
|
-
redemptions: e.array(
|
|
396
|
+
redemptions: e.array(Oe),
|
|
397
397
|
next_token: e.string().optional()
|
|
398
398
|
});
|
|
399
399
|
class kr {
|
|
@@ -408,7 +408,7 @@ class kr {
|
|
|
408
408
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
|
|
409
409
|
*/
|
|
410
410
|
async getConfig() {
|
|
411
|
-
const { data: t } = await this.req.get("club/config",
|
|
411
|
+
const { data: t } = await this.req.get("club/config", Ne);
|
|
412
412
|
return t;
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
@@ -418,7 +418,7 @@ class kr {
|
|
|
418
418
|
*/
|
|
419
419
|
async getCurrentPlayer() {
|
|
420
420
|
await this.token.autoLogin();
|
|
421
|
-
const { data: t, code: n } = await this.req.get("club/current-player",
|
|
421
|
+
const { data: t, code: n } = await this.req.get("club/current-player", O);
|
|
422
422
|
return (t == null ? void 0 : t.player) ?? { error: n };
|
|
423
423
|
}
|
|
424
424
|
/**
|
|
@@ -433,7 +433,7 @@ class kr {
|
|
|
433
433
|
{
|
|
434
434
|
id_token: this.token.idToken
|
|
435
435
|
},
|
|
436
|
-
|
|
436
|
+
O
|
|
437
437
|
);
|
|
438
438
|
return (t == null ? void 0 : t.player) ?? {
|
|
439
439
|
error: n
|
|
@@ -457,7 +457,7 @@ class kr {
|
|
|
457
457
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=A1Wr7kUXnS
|
|
458
458
|
*/
|
|
459
459
|
async getRoleCard(t) {
|
|
460
|
-
const { data: n } = await this.req.get("club/role-card",
|
|
460
|
+
const { data: n } = await this.req.get("club/role-card", T, {
|
|
461
461
|
params: { member_id: t }
|
|
462
462
|
});
|
|
463
463
|
return (n == null ? void 0 : n.role_card) ?? null;
|
|
@@ -469,7 +469,7 @@ class kr {
|
|
|
469
469
|
*/
|
|
470
470
|
async setRoleCard(t) {
|
|
471
471
|
if (!await this.token.autoLogin()) return null;
|
|
472
|
-
const { data: n } = await this.req.post("club/role-card", t,
|
|
472
|
+
const { data: n } = await this.req.post("club/role-card", t, T);
|
|
473
473
|
return (n == null ? void 0 : n.role_card) ?? null;
|
|
474
474
|
}
|
|
475
475
|
/**
|
|
@@ -479,7 +479,7 @@ class kr {
|
|
|
479
479
|
*/
|
|
480
480
|
async refreshRoleCard() {
|
|
481
481
|
if (!await this.token.autoLogin()) return null;
|
|
482
|
-
const { data: t } = await this.req.post("club/refresh-role-card", {},
|
|
482
|
+
const { data: t } = await this.req.post("club/refresh-role-card", {}, T);
|
|
483
483
|
return (t == null ? void 0 : t.role_card) ?? null;
|
|
484
484
|
}
|
|
485
485
|
/**
|
|
@@ -488,7 +488,7 @@ class kr {
|
|
|
488
488
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TMWBCFcOr2
|
|
489
489
|
*/
|
|
490
490
|
async getUserProfile(t) {
|
|
491
|
-
const { data: n } = await this.req.get("club/user-profile",
|
|
491
|
+
const { data: n } = await this.req.get("club/user-profile", N, {
|
|
492
492
|
params: { member_id: t }
|
|
493
493
|
});
|
|
494
494
|
return n;
|
|
@@ -500,7 +500,7 @@ class kr {
|
|
|
500
500
|
*/
|
|
501
501
|
async updateUserProfile(t) {
|
|
502
502
|
await this.token.autoLogin();
|
|
503
|
-
const { data: n, code: r } = await this.req.post("club/user-profile", t,
|
|
503
|
+
const { data: n, code: r } = await this.req.post("club/user-profile", t, N);
|
|
504
504
|
return n ?? {
|
|
505
505
|
error: r
|
|
506
506
|
};
|
|
@@ -625,7 +625,7 @@ class kr {
|
|
|
625
625
|
return { redemptions: (n == null ? void 0 : n.redemptions) || [], next_token: n == null ? void 0 : n.next_token };
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
const
|
|
628
|
+
const C = {
|
|
629
629
|
/** 活动道具 */
|
|
630
630
|
EventItem: "event_item",
|
|
631
631
|
/** 游戏内道具 */
|
|
@@ -642,7 +642,7 @@ const v = {
|
|
|
642
642
|
Credit: "credit",
|
|
643
643
|
/** 空奖励 */
|
|
644
644
|
VoidItem: "void_item"
|
|
645
|
-
}, Y = e.string().enum(
|
|
645
|
+
}, Y = e.string().enum(C).lock(), vr = C, Z = Y, Ye = {
|
|
646
646
|
/** 世游通行证 ID / Combo ID */
|
|
647
647
|
UserId: "user_id",
|
|
648
648
|
/** 游戏角色 ID */
|
|
@@ -783,7 +783,7 @@ const v = {
|
|
|
783
783
|
Draw: "draw",
|
|
784
784
|
/** 领奖 */
|
|
785
785
|
Claim: "claim"
|
|
786
|
-
}, jr = e.string().enum(lt).lock(), mt = e.string().enum(
|
|
786
|
+
}, jr = e.string().enum(lt).lock(), mt = e.string().enum(v(C, "GiftCode", "LotteryTicket")), $ = e.object({
|
|
787
787
|
reward_item_id: e.number(),
|
|
788
788
|
reward_amount: e.number(),
|
|
789
789
|
reward_item_name: e.string(),
|
|
@@ -866,7 +866,7 @@ const v = {
|
|
|
866
866
|
}), xt = s.InvitedRegister, St = e.object({
|
|
867
867
|
...c.shape,
|
|
868
868
|
feature_type: e.string().enum(xt)
|
|
869
|
-
}), Lt = e.string().enum(
|
|
869
|
+
}), Lt = e.string().enum(v(C, "GiftCode", "LotteryTicket")), Pt = s.Lottery, Et = e.object({
|
|
870
870
|
reward_item_id: e.number(),
|
|
871
871
|
reward_item_name: e.string(),
|
|
872
872
|
reward_item_type: Lt,
|
|
@@ -906,9 +906,9 @@ const v = {
|
|
|
906
906
|
completion_value: e.number()
|
|
907
907
|
}).optional()
|
|
908
908
|
})
|
|
909
|
-
}),
|
|
909
|
+
}), Ot = s.Register, Nt = e.object({
|
|
910
910
|
...c.shape,
|
|
911
|
-
feature_type: e.string().enum(
|
|
911
|
+
feature_type: e.string().enum(Ot)
|
|
912
912
|
}), Bt = s.Share, Qt = e.object({
|
|
913
913
|
...c.shape,
|
|
914
914
|
feature_type: e.string().enum(Bt),
|
|
@@ -971,7 +971,7 @@ const v = {
|
|
|
971
971
|
Ft,
|
|
972
972
|
Dt,
|
|
973
973
|
At,
|
|
974
|
-
|
|
974
|
+
Nt,
|
|
975
975
|
Qt,
|
|
976
976
|
Ht,
|
|
977
977
|
Jt,
|
|
@@ -984,10 +984,10 @@ const v = {
|
|
|
984
984
|
until: e.number(),
|
|
985
985
|
visit_count: e.number().optional(),
|
|
986
986
|
features: e.array(en)
|
|
987
|
-
}).lock(),
|
|
988
|
-
order_total_amount:
|
|
989
|
-
cashback_total_amount:
|
|
990
|
-
game_item_count:
|
|
987
|
+
}).lock(), q = e.union(e.string().pattern("NumberString", /^\d+$/), e.number()), nn = e.object({
|
|
988
|
+
order_total_amount: q,
|
|
989
|
+
cashback_total_amount: q,
|
|
990
|
+
game_item_count: q
|
|
991
991
|
}), rn = e.object({
|
|
992
992
|
gift_code: e.string()
|
|
993
993
|
}), on = e.object({
|
|
@@ -1021,7 +1021,7 @@ const v = {
|
|
|
1021
1021
|
}),
|
|
1022
1022
|
e.object({
|
|
1023
1023
|
ticket: e.string(),
|
|
1024
|
-
status: e.string().enum(
|
|
1024
|
+
status: e.string().enum(v(h, "Unknown", "Pending")),
|
|
1025
1025
|
reward: te
|
|
1026
1026
|
})
|
|
1027
1027
|
).satisfies(), un = e.object({
|
|
@@ -1090,7 +1090,11 @@ const v = {
|
|
|
1090
1090
|
rn,
|
|
1091
1091
|
bn,
|
|
1092
1092
|
mn,
|
|
1093
|
-
un
|
|
1093
|
+
un,
|
|
1094
|
+
e.custom(
|
|
1095
|
+
"EmptyObject",
|
|
1096
|
+
(i) => k(i) && Object.keys(i).length === 0
|
|
1097
|
+
)
|
|
1094
1098
|
).satisfies().lock(), hn = e.object({
|
|
1095
1099
|
reward_id: e.number(),
|
|
1096
1100
|
reward_item_id: e.number(),
|
|
@@ -1148,7 +1152,7 @@ const v = {
|
|
|
1148
1152
|
}), Vn = e.object({
|
|
1149
1153
|
reward_id: e.number(),
|
|
1150
1154
|
reward_status: P
|
|
1151
|
-
}), Rn = e.guard(tn), jn = e.guard(kn),
|
|
1155
|
+
}), Rn = e.guard(tn), jn = e.guard(kn), x = o({ count: e.number() }), Tn = o({ first_visit: e.bool() }), qn = o({
|
|
1152
1156
|
engagements: e.union(e.array(fn), e.array(_n))
|
|
1153
1157
|
}), xn = o({
|
|
1154
1158
|
status: e.array(vn)
|
|
@@ -1202,7 +1206,7 @@ class qr {
|
|
|
1202
1206
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1203
1207
|
*/
|
|
1204
1208
|
async getEngagementsUserCount(t) {
|
|
1205
|
-
const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`,
|
|
1209
|
+
const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, x, {
|
|
1206
1210
|
params: { feature_id: t, type: "user" }
|
|
1207
1211
|
});
|
|
1208
1212
|
return (n == null ? void 0 : n.count) ?? null;
|
|
@@ -1213,7 +1217,7 @@ class qr {
|
|
|
1213
1217
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1214
1218
|
*/
|
|
1215
1219
|
async getEngagementsCount(t) {
|
|
1216
|
-
const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`,
|
|
1220
|
+
const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, x, {
|
|
1217
1221
|
params: { feature_id: t, type: "engagement" }
|
|
1218
1222
|
});
|
|
1219
1223
|
return (n == null ? void 0 : n.count) ?? null;
|
|
@@ -1362,7 +1366,7 @@ class qr {
|
|
|
1362
1366
|
*/
|
|
1363
1367
|
async getUserItemCount(t) {
|
|
1364
1368
|
if (!await this.token.autoLogin()) return null;
|
|
1365
|
-
const { data: n } = await this.req.get(`event/${this.event}/user-item-count`,
|
|
1369
|
+
const { data: n } = await this.req.get(`event/${this.event}/user-item-count`, x, {
|
|
1366
1370
|
params: { item_id: t }
|
|
1367
1371
|
});
|
|
1368
1372
|
return (n == null ? void 0 : n.count) ?? null;
|
|
@@ -1429,14 +1433,14 @@ const Dn = {
|
|
|
1429
1433
|
Failed: "failed",
|
|
1430
1434
|
/** 嫌疑(仅自己可见) */
|
|
1431
1435
|
Suspect: "suspect"
|
|
1432
|
-
}, ie = e.string().enum(An).lock(),
|
|
1436
|
+
}, ie = e.string().enum(An).lock(), On = {
|
|
1433
1437
|
/** 系统通知 */
|
|
1434
1438
|
System: "system",
|
|
1435
1439
|
/** 评论我的 */
|
|
1436
1440
|
Comment: "comment",
|
|
1437
1441
|
/** 点赞通知 */
|
|
1438
1442
|
Like: "like"
|
|
1439
|
-
}, xr = e.string().enum(
|
|
1443
|
+
}, xr = e.string().enum(On).lock(), m = {
|
|
1440
1444
|
/** 系统通知 */
|
|
1441
1445
|
System: "system",
|
|
1442
1446
|
/** 帖子被置顶 */
|
|
@@ -1461,7 +1465,7 @@ const Dn = {
|
|
|
1461
1465
|
ReplyLiked: "reply_liked",
|
|
1462
1466
|
/** 回复被删除 */
|
|
1463
1467
|
ReplyDeleted: "reply_deleted"
|
|
1464
|
-
},
|
|
1468
|
+
}, Nn = e.string().enum(m).lock(), oe = e.object({
|
|
1465
1469
|
forum_id: e.number(),
|
|
1466
1470
|
icon_url: e.string(),
|
|
1467
1471
|
name: e.string(),
|
|
@@ -1503,7 +1507,7 @@ const Dn = {
|
|
|
1503
1507
|
replied_by: e.string(),
|
|
1504
1508
|
nickname: e.string(),
|
|
1505
1509
|
avatar_url: e.string()
|
|
1506
|
-
}).lock(),
|
|
1510
|
+
}).lock(), V = e.object({
|
|
1507
1511
|
reply_id: e.number(),
|
|
1508
1512
|
comment_id: e.number(),
|
|
1509
1513
|
comment_content: e.string().optional(),
|
|
@@ -1537,14 +1541,14 @@ const Dn = {
|
|
|
1537
1541
|
image_url: e.string(),
|
|
1538
1542
|
create_time: e.number(),
|
|
1539
1543
|
status: ie,
|
|
1540
|
-
replies: e.array(
|
|
1544
|
+
replies: e.array(V).optional()
|
|
1541
1545
|
}).lock(), Qn = e.object({
|
|
1542
1546
|
image_url: e.string(),
|
|
1543
1547
|
upload_url: e.string(),
|
|
1544
1548
|
existed: e.bool()
|
|
1545
1549
|
}).lock(), b = e.object({
|
|
1546
1550
|
notification_id: e.string(),
|
|
1547
|
-
notification_type:
|
|
1551
|
+
notification_type: Nn,
|
|
1548
1552
|
is_read: e.bool(),
|
|
1549
1553
|
create_time: e.number(),
|
|
1550
1554
|
origin_user_id: e.string(),
|
|
@@ -1558,7 +1562,7 @@ const Dn = {
|
|
|
1558
1562
|
post_subject: e.string(),
|
|
1559
1563
|
post_summary: e.string(),
|
|
1560
1564
|
post_image_url: e.string()
|
|
1561
|
-
}).lock(),
|
|
1565
|
+
}).lock(), R = e.object({
|
|
1562
1566
|
comment_id: e.number(),
|
|
1563
1567
|
comment_content: e.string()
|
|
1564
1568
|
}).lock(), D = e.object({
|
|
@@ -1580,16 +1584,16 @@ const Dn = {
|
|
|
1580
1584
|
}), Jn = e.object({
|
|
1581
1585
|
...b.shape,
|
|
1582
1586
|
...I.shape,
|
|
1583
|
-
...
|
|
1587
|
+
...R.shape,
|
|
1584
1588
|
notification_type: e.string().enum(m.PostCommented)
|
|
1585
1589
|
}), Kn = e.object({
|
|
1586
1590
|
...b.shape,
|
|
1587
|
-
...
|
|
1591
|
+
...R.shape,
|
|
1588
1592
|
...D.shape,
|
|
1589
1593
|
notification_type: e.string().enum(m.CommentReplied)
|
|
1590
1594
|
}), Xn = e.object({
|
|
1591
1595
|
...b.shape,
|
|
1592
|
-
...
|
|
1596
|
+
...R.shape,
|
|
1593
1597
|
...I.shape,
|
|
1594
1598
|
notification_type: e.string().enum(m.CommentLiked, m.CommentDeleted)
|
|
1595
1599
|
}), Yn = e.object({
|
|
@@ -1602,7 +1606,7 @@ const Dn = {
|
|
|
1602
1606
|
}), Zn = e.object({
|
|
1603
1607
|
...b.shape,
|
|
1604
1608
|
...D.shape,
|
|
1605
|
-
...
|
|
1609
|
+
...R.shape,
|
|
1606
1610
|
notification_type: e.string().enum(m.ReplyLiked, m.ReplyDeleted)
|
|
1607
1611
|
}), Wn = e.union(
|
|
1608
1612
|
Hn,
|
|
@@ -1616,10 +1620,10 @@ const Dn = {
|
|
|
1616
1620
|
posts: e.array(F),
|
|
1617
1621
|
next_token: e.string().optional()
|
|
1618
1622
|
}), ir = o({ post: F, antispam: ae }), or = o({
|
|
1619
|
-
replies: e.array(
|
|
1623
|
+
replies: e.array(V),
|
|
1620
1624
|
next_token: e.string().optional()
|
|
1621
|
-
}), ar = o({ reply:
|
|
1622
|
-
reply:
|
|
1625
|
+
}), ar = o({ reply: V }), sr = o({
|
|
1626
|
+
reply: V.clone().optional(),
|
|
1623
1627
|
antispam: ae.clone().optional()
|
|
1624
1628
|
}), cr = o({ comment: w }), ur = o({
|
|
1625
1629
|
comments: e.array(w),
|
|
@@ -1853,8 +1857,8 @@ class Sr {
|
|
|
1853
1857
|
return n;
|
|
1854
1858
|
}
|
|
1855
1859
|
}
|
|
1856
|
-
function
|
|
1857
|
-
return
|
|
1860
|
+
function S(i) {
|
|
1861
|
+
return k(i, "openid", "unionid", "weixin_token");
|
|
1858
1862
|
}
|
|
1859
1863
|
var pr = /* @__PURE__ */ ((i) => (i.RedirectUriDisMatch = "10003", i.AppidError = "10016", i.AuthorizationError = "10015", i.NoRightForScope = "10005", i.Frequently = "10009", i.AppBanded = "10004", i.ShouldFollow = "10006", i.ScopeNull = "10010", i.RedirectUriNull = "10011", i.AppidNull = "10012", i.StateNull = "10013", i))(pr || {});
|
|
1860
1864
|
const M = "wx_login_cache";
|
|
@@ -1890,7 +1894,7 @@ class Lr {
|
|
|
1890
1894
|
if (!t)
|
|
1891
1895
|
return null;
|
|
1892
1896
|
const n = _e(t);
|
|
1893
|
-
return
|
|
1897
|
+
return S(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
|
|
1894
1898
|
}
|
|
1895
1899
|
/**
|
|
1896
1900
|
* 小程序页面微信静默登录,获取 weixinToken / openid / unionid。
|
|
@@ -1918,7 +1922,7 @@ class Lr {
|
|
|
1918
1922
|
const n = await fe(), { data: r, code: u } = await this.req.post(
|
|
1919
1923
|
"weixin/login",
|
|
1920
1924
|
{ code: n, appid: this.appid },
|
|
1921
|
-
|
|
1925
|
+
S,
|
|
1922
1926
|
{ message: !1 }
|
|
1923
1927
|
);
|
|
1924
1928
|
return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(M, JSON.stringify(r)), await this.token.autoLogin()), r ?? { error: u };
|
|
@@ -1940,7 +1944,7 @@ class Lr {
|
|
|
1940
1944
|
* - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、unionid、昵称、头像等信息,但用户也可能会拒绝授权
|
|
1941
1945
|
*/
|
|
1942
1946
|
async webLogin(t = "snsapi_userinfo") {
|
|
1943
|
-
const n =
|
|
1947
|
+
const n = L("code"), r = Date.now(), u = +L("state");
|
|
1944
1948
|
if (!n || !u || u < r - 1e3 * 60 * 5 || u > r) {
|
|
1945
1949
|
const ce = G(["code", "state"]);
|
|
1946
1950
|
location.replace(
|
|
@@ -1952,15 +1956,15 @@ class Lr {
|
|
|
1952
1956
|
return { error: n };
|
|
1953
1957
|
const d = G(["code", "state"]);
|
|
1954
1958
|
"replaceState" in history && history.replaceState({}, "", d);
|
|
1955
|
-
const { data:
|
|
1959
|
+
const { data: j, code: se } = await this.req.post(
|
|
1956
1960
|
"weixin/login",
|
|
1957
1961
|
{
|
|
1958
1962
|
code: n,
|
|
1959
1963
|
appid: this.appid
|
|
1960
1964
|
},
|
|
1961
|
-
|
|
1965
|
+
S
|
|
1962
1966
|
);
|
|
1963
|
-
return
|
|
1967
|
+
return j && (this.token.weixinToken = j.weixin_token, await this.token.autoLogin()), j ?? { error: se };
|
|
1964
1968
|
}
|
|
1965
1969
|
/**
|
|
1966
1970
|
* 关联游戏账号,无返回值,全程静默
|
|
@@ -2026,7 +2030,7 @@ export {
|
|
|
2026
2030
|
$t as EventFeatureConfigOfLotteryValidator,
|
|
2027
2031
|
Dt as EventFeatureConfigOfPreregisterValidator,
|
|
2028
2032
|
At as EventFeatureConfigOfQuestValidator,
|
|
2029
|
-
|
|
2033
|
+
Nt as EventFeatureConfigOfRegisterValidator,
|
|
2030
2034
|
Qt as EventFeatureConfigOfShareValidator,
|
|
2031
2035
|
Ht as EventFeatureConfigOfSubscribeValidator,
|
|
2032
2036
|
Jt as EventFeatureConfigOfSurveyValidator,
|
|
@@ -2044,7 +2048,7 @@ export {
|
|
|
2044
2048
|
Dn as ForumMode,
|
|
2045
2049
|
Gn as ForumModeValidator,
|
|
2046
2050
|
oe as ForumValidator,
|
|
2047
|
-
|
|
2051
|
+
C as GamerItemType,
|
|
2048
2052
|
Y as GamerItemTypeValidator,
|
|
2049
2053
|
ke as Gender,
|
|
2050
2054
|
ve as GenderValidator,
|
|
@@ -2057,11 +2061,11 @@ export {
|
|
|
2057
2061
|
h as LotteryTicketStatus,
|
|
2058
2062
|
Vr as LotteryTicketStatusValidator,
|
|
2059
2063
|
b as NotificationBaseValidator,
|
|
2060
|
-
|
|
2064
|
+
On as NotificationCategory,
|
|
2061
2065
|
xr as NotificationCategoryValidator,
|
|
2062
2066
|
Kn as NotificationCommentReplyValidator,
|
|
2063
2067
|
Xn as NotificationCommentValidator,
|
|
2064
|
-
|
|
2068
|
+
R as NotificationPayloadCommentValidator,
|
|
2065
2069
|
I as NotificationPayloadPostValidator,
|
|
2066
2070
|
D as NotificationPayloadReplyValidator,
|
|
2067
2071
|
Mn as NotificationPayloadSystemValidator,
|
|
@@ -2071,7 +2075,7 @@ export {
|
|
|
2071
2075
|
Zn as NotificationReplyValidator,
|
|
2072
2076
|
Hn as NotificationSystemValidator,
|
|
2073
2077
|
m as NotificationType,
|
|
2074
|
-
|
|
2078
|
+
Nn as NotificationTypeValidator,
|
|
2075
2079
|
Wn as NotificationValidator,
|
|
2076
2080
|
$e as PlayerRoleCardValidator,
|
|
2077
2081
|
z as PlayerRoleValidator,
|
|
@@ -2084,10 +2088,10 @@ export {
|
|
|
2084
2088
|
nt as QuestObjective,
|
|
2085
2089
|
W as QuestObjectiveValidator,
|
|
2086
2090
|
wr as RedeemParamsValidator,
|
|
2087
|
-
|
|
2091
|
+
Oe as RedemptionValidator,
|
|
2088
2092
|
dt as RegularRewardValidator,
|
|
2089
2093
|
Bn as ReplyToValidator,
|
|
2090
|
-
|
|
2094
|
+
V as ReplyValidator,
|
|
2091
2095
|
vr as RewardItemType,
|
|
2092
2096
|
Z as RewardItemTypeValidator,
|
|
2093
2097
|
at as RewardSource,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/gamer-api",
|
|
3
3
|
"description": "agent for gamer api",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -22,20 +22,19 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^22.13.1",
|
|
25
|
-
"
|
|
26
|
-
"@seayoo-web/
|
|
27
|
-
"@seayoo-web/
|
|
25
|
+
"vitest": "^3.0.5",
|
|
26
|
+
"@seayoo-web/combo-webview": "^2.5.1",
|
|
27
|
+
"@seayoo-web/request": "^3.0.1",
|
|
28
28
|
"@seayoo-web/tsconfig": "^1.0.3",
|
|
29
|
-
"@seayoo-web/utils": "^3.4.3"
|
|
30
|
-
},
|
|
31
|
-
"peerDependencies": {
|
|
32
29
|
"@seayoo-web/utils": "^3.4.3",
|
|
33
|
-
"@seayoo-web/
|
|
30
|
+
"@seayoo-web/scripts": "^2.0.1"
|
|
34
31
|
},
|
|
35
|
-
"
|
|
36
|
-
"
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@seayoo-web/combo-webview": "^2.5.1",
|
|
34
|
+
"@seayoo-web/utils": "^3.4.3"
|
|
37
35
|
},
|
|
38
36
|
"scripts": {
|
|
37
|
+
"prebuild": "pnpm -F request build && pnpm -F combo-webview build",
|
|
39
38
|
"build": "vite build && tsc --emitDeclarationOnly",
|
|
40
39
|
"type-check": "tsc --noEmit",
|
|
41
40
|
"lint": "eslint ./src/**/*.ts",
|
|
@@ -23,7 +23,8 @@ export * from "./engage.subscribe";
|
|
|
23
23
|
export * from "./engage.survey";
|
|
24
24
|
export * from "./engage.team";
|
|
25
25
|
export * from "./engage.vote";
|
|
26
|
-
export type
|
|
26
|
+
export type EmptyObject = Record<string | number | symbol, never>;
|
|
27
|
+
export type UserEngagementData = PreregisterEngagementData | LotteryEngagementData | SurveyEngagementData | InviteEngagementData | ShareEngagementData | VoteEngagementData | WeixinSubscribeEngagementData | CashbackEngagementData | GiftCodeEngagementData | TeamEngagementData | QuestEngagementData | LotteryDrawEngagementData | EmptyObject;
|
|
27
28
|
export declare const UserEngagementDataValidator: import("@seayoo-web/utils").UnionValidator<[import("@seayoo-web/utils").ObjectValidator<{
|
|
28
29
|
platforms: string[];
|
|
29
30
|
}, false, false>, import("@seayoo-web/utils").ObjectValidator<LotteryEngagementData, false, false>, import("@seayoo-web/utils").ObjectValidator<{
|
|
@@ -37,7 +38,7 @@ export declare const UserEngagementDataValidator: import("@seayoo-web/utils").Un
|
|
|
37
38
|
status: /*elided*/ any;
|
|
38
39
|
reward: /*elided*/ any;
|
|
39
40
|
})[];
|
|
40
|
-
}, false, false>], false, false> & {
|
|
41
|
+
}, false, false>, import("@seayoo-web/utils").CustomValidator<EmptyObject, false, false>], false, false> & {
|
|
41
42
|
optional: never;
|
|
42
43
|
maybeNull: never;
|
|
43
44
|
key: never;
|