@seayoo-web/gamer-api 2.10.8 → 2.10.10
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 +146 -146
- package/package.json +5 -5
- package/types/src/event.config/feature.lottery.d.ts +1 -1
- package/types/src/event.config/reward.d.ts +1 -1
- package/types/src/event.d.ts +3 -3
- package/types/src/event.engage/engage.claimActivationKey.d.ts +1 -0
- package/types/src/event.engage/engage.comment.d.ts +1 -0
- package/types/src/event.engage/engage.giftcode.d.ts +1 -0
- package/types/src/event.engage/engage.lottery.d.ts +1 -0
- package/types/src/event.engage/engage.lotteryDraw.d.ts +1 -0
- package/types/src/event.engage/engage.quest.d.ts +1 -0
- package/types/src/event.engage/engage.team.d.ts +1 -0
- package/types/src/event.engage/engage.vote2.d.ts +1 -0
- package/types/src/event.engage/index.d.ts +8 -2
- package/types/src/event.enums.d.ts +2 -10
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { isComboWebView as
|
|
2
|
-
import { isPlainObject as k, supportWx as b, useConsole as
|
|
1
|
+
import { isComboWebView as le } from "@seayoo-web/combo-webview";
|
|
2
|
+
import { isPlainObject as k, supportWx as b, useConsole as ue, usePromise as me, pruneURL as de, supportWindow as ge, queryString as L, pruneObject as c, omitFields as P, parseJSON as pe, removePara as G } from "@seayoo-web/utils";
|
|
3
3
|
import { v as e, objectGuard as s } from "@seayoo-web/validator";
|
|
4
|
-
function
|
|
4
|
+
function _e(i) {
|
|
5
5
|
return k(i, "gamer_token") && typeof i.gamer_token == "string";
|
|
6
6
|
}
|
|
7
7
|
function O(i) {
|
|
8
8
|
return k(i);
|
|
9
9
|
}
|
|
10
|
-
const j =
|
|
11
|
-
function
|
|
10
|
+
const j = ue("GamerApiSDK");
|
|
11
|
+
function be(i) {
|
|
12
12
|
return /^\/[a-z\d-]+$/.test(i);
|
|
13
13
|
}
|
|
14
|
-
async function
|
|
15
|
-
const { promise: i, resolve: t } =
|
|
14
|
+
async function ye() {
|
|
15
|
+
const { promise: i, resolve: t } = me();
|
|
16
16
|
return wx.login({
|
|
17
17
|
success(n) {
|
|
18
18
|
t(n.code);
|
|
@@ -22,7 +22,7 @@ async function fe() {
|
|
|
22
22
|
}
|
|
23
23
|
}), await i;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const fe = {
|
|
26
26
|
get(i) {
|
|
27
27
|
return localStorage.getItem(i) || "";
|
|
28
28
|
},
|
|
@@ -32,7 +32,7 @@ const he = {
|
|
|
32
32
|
remove(i) {
|
|
33
33
|
localStorage.removeItem(i);
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, he = {
|
|
36
36
|
get(i) {
|
|
37
37
|
try {
|
|
38
38
|
if (b()) return wx.getStorageSync(i) || "";
|
|
@@ -64,8 +64,8 @@ class Qr {
|
|
|
64
64
|
req;
|
|
65
65
|
storage;
|
|
66
66
|
constructor(t, n) {
|
|
67
|
-
this.storage = b() ?
|
|
68
|
-
const r =
|
|
67
|
+
this.storage = b() ? he : fe;
|
|
68
|
+
const r = be(t) ? t : `https://${de(t)}`;
|
|
69
69
|
if (this.$NetRequest = n, this.req = n({
|
|
70
70
|
baseURL: `${r}/v1`,
|
|
71
71
|
timeout: 1e4,
|
|
@@ -86,9 +86,9 @@ class Qr {
|
|
|
86
86
|
requestTransformer: (a) => {
|
|
87
87
|
this.$gamerToken && (a.headers.Authorization = `Bearer ${this.$gamerToken}`);
|
|
88
88
|
}
|
|
89
|
-
}),
|
|
89
|
+
}), ge()) {
|
|
90
90
|
const a = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), o = L("gamer_token");
|
|
91
|
-
(
|
|
91
|
+
(le() || a && o) && (this.$gamerToken = o);
|
|
92
92
|
}
|
|
93
93
|
this.$gamerToken || this.loadGamerTokenCache();
|
|
94
94
|
}
|
|
@@ -171,7 +171,7 @@ class Qr {
|
|
|
171
171
|
const { code: n, data: r } = await this.req.post(
|
|
172
172
|
"login-with-token",
|
|
173
173
|
c({ id_token: this.idToken, weixin_token: t ? this.weixinToken : null }),
|
|
174
|
-
|
|
174
|
+
_e,
|
|
175
175
|
{
|
|
176
176
|
message: !1,
|
|
177
177
|
cacheTTL: 300,
|
|
@@ -213,21 +213,21 @@ class Qr {
|
|
|
213
213
|
return n;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const we = {
|
|
217
217
|
/** 未知 */
|
|
218
218
|
Unknown: "unknown",
|
|
219
219
|
/** 男 */
|
|
220
220
|
Male: "male",
|
|
221
221
|
/** 女 */
|
|
222
222
|
Female: "female"
|
|
223
|
-
},
|
|
223
|
+
}, ke = e.string().enum(we).lock(), ve = {
|
|
224
224
|
/** 积分增加 */
|
|
225
225
|
Increase: "increase",
|
|
226
226
|
/** 积分减少 */
|
|
227
227
|
Decrease: "decrease",
|
|
228
228
|
/** 积分过期 */
|
|
229
229
|
Expired: "expired"
|
|
230
|
-
},
|
|
230
|
+
}, Ve = e.string().enum(ve).lock(), Ce = {
|
|
231
231
|
/** 游戏内购买 */
|
|
232
232
|
Order: "order",
|
|
233
233
|
/** 游戏内消耗 */
|
|
@@ -240,21 +240,21 @@ const ke = {
|
|
|
240
240
|
Admin: "admin",
|
|
241
241
|
/** 运营活动 */
|
|
242
242
|
Event: "event"
|
|
243
|
-
},
|
|
243
|
+
}, Re = e.string().enum(Ce).lock(), je = {
|
|
244
244
|
/** 游戏内奖励 */
|
|
245
245
|
GameReward: "game_reward",
|
|
246
246
|
/** 实物商品 */
|
|
247
247
|
Physical: "physical",
|
|
248
248
|
/** 虚拟商品 */
|
|
249
249
|
Virtual: "virtual"
|
|
250
|
-
}, H = e.string().enum(
|
|
250
|
+
}, H = e.string().enum(je).lock(), Te = {
|
|
251
251
|
/** 待发放 */
|
|
252
252
|
Pending: "pending",
|
|
253
253
|
/** 已发放 */
|
|
254
254
|
Issued: "issued",
|
|
255
255
|
/** 发放失败 */
|
|
256
256
|
Failed: "failed"
|
|
257
|
-
},
|
|
257
|
+
}, qe = e.string().enum(Te).lock(), xe = e.object({
|
|
258
258
|
default_avatar_url: e.string(),
|
|
259
259
|
official_avatar_urls: e.array(e.string()),
|
|
260
260
|
default_nickname: e.string(),
|
|
@@ -272,7 +272,7 @@ const ke = {
|
|
|
272
272
|
exp_description: e.string(),
|
|
273
273
|
credit_description: e.string(),
|
|
274
274
|
send_role_mail_rate_limit: e.number()
|
|
275
|
-
}).lock(),
|
|
275
|
+
}).lock(), Se = e.object({
|
|
276
276
|
member_id: e.string(),
|
|
277
277
|
player_id: e.string(),
|
|
278
278
|
exp: e.number(),
|
|
@@ -281,18 +281,18 @@ const ke = {
|
|
|
281
281
|
credit_expiring: e.number(),
|
|
282
282
|
level_change_time: e.number(),
|
|
283
283
|
level_expire_time: e.number()
|
|
284
|
-
}).lock(),
|
|
284
|
+
}).lock(), Le = e.object({
|
|
285
285
|
server_id: e.string(),
|
|
286
286
|
server_name: e.string()
|
|
287
|
-
}).lock(),
|
|
287
|
+
}).lock(), Pe = e.object({
|
|
288
288
|
role_id: e.string(),
|
|
289
289
|
role_name: e.string()
|
|
290
290
|
}).lock(), z = e.object({
|
|
291
|
-
...Ee.shape,
|
|
292
291
|
...Pe.shape,
|
|
292
|
+
...Le.shape,
|
|
293
293
|
role_level: e.number(),
|
|
294
294
|
last_login_time: e.number()
|
|
295
|
-
}).lock(),
|
|
295
|
+
}).lock(), Ee = e.object({
|
|
296
296
|
...z.shape,
|
|
297
297
|
/** 角色战力 */
|
|
298
298
|
role_fighting: e.number(),
|
|
@@ -302,11 +302,11 @@ const ke = {
|
|
|
302
302
|
kin_name: e.string().optional(),
|
|
303
303
|
/** 宗门职位 */
|
|
304
304
|
kin_position: e.string().optional()
|
|
305
|
-
}).lock(),
|
|
305
|
+
}).lock(), $e = e.object({
|
|
306
306
|
name: e.string(),
|
|
307
307
|
avatar_url: e.string(),
|
|
308
308
|
bio: e.string(),
|
|
309
|
-
gender:
|
|
309
|
+
gender: ke,
|
|
310
310
|
birthday: e.object({ year: e.number(), month: e.number(), day: e.number() })
|
|
311
311
|
}).lock(), J = e.object({
|
|
312
312
|
address_id: e.number(),
|
|
@@ -317,15 +317,15 @@ const ke = {
|
|
|
317
317
|
district: e.string(),
|
|
318
318
|
address: e.string(),
|
|
319
319
|
is_default: e.bool()
|
|
320
|
-
}).lock(),
|
|
320
|
+
}).lock(), Fe = e.object({
|
|
321
321
|
increased_credit: e.number(),
|
|
322
322
|
decreased_credit: e.number(),
|
|
323
323
|
expired_credit: e.number(),
|
|
324
324
|
balance_credit: e.number()
|
|
325
|
-
}).lock(),
|
|
325
|
+
}).lock(), Ue = e.object({
|
|
326
326
|
id: e.number(),
|
|
327
|
-
change_type:
|
|
328
|
-
change_scene:
|
|
327
|
+
change_type: Ve,
|
|
328
|
+
change_scene: Re,
|
|
329
329
|
change_credit: e.number(),
|
|
330
330
|
balance: e.number(),
|
|
331
331
|
change_time: e.number()
|
|
@@ -364,7 +364,7 @@ const ke = {
|
|
|
364
364
|
created_at: e.number(),
|
|
365
365
|
updated_at: e.number(),
|
|
366
366
|
redeemable_quantity: e.number().optional()
|
|
367
|
-
}).lock(),
|
|
367
|
+
}).lock(), De = e.object({
|
|
368
368
|
...P(Z.shape, "tag"),
|
|
369
369
|
product: X.clone().optional()
|
|
370
370
|
}).lock(), Br = e.union(
|
|
@@ -375,7 +375,7 @@ const ke = {
|
|
|
375
375
|
e.object({
|
|
376
376
|
address_id: e.number()
|
|
377
377
|
})
|
|
378
|
-
).satisfies().lock(),
|
|
378
|
+
).satisfies().lock(), Ie = e.object({
|
|
379
379
|
recipient: e.string(),
|
|
380
380
|
mobile: e.string(),
|
|
381
381
|
province: e.string(),
|
|
@@ -384,11 +384,11 @@ const ke = {
|
|
|
384
384
|
address: e.string(),
|
|
385
385
|
express_company: e.string(),
|
|
386
386
|
express_number: e.string()
|
|
387
|
-
}).lock(),
|
|
387
|
+
}).lock(), Ae = e.object({
|
|
388
388
|
server_id: e.string(),
|
|
389
389
|
role_id: e.string(),
|
|
390
390
|
role_name: e.string()
|
|
391
|
-
}).lock(),
|
|
391
|
+
}).lock(), Ge = e.object({
|
|
392
392
|
redemption_id: e.number(),
|
|
393
393
|
player_id: e.string(),
|
|
394
394
|
product_id: e.number(),
|
|
@@ -399,14 +399,14 @@ const ke = {
|
|
|
399
399
|
catalog_name: e.string(),
|
|
400
400
|
quantity: e.number(),
|
|
401
401
|
amount: e.number(),
|
|
402
|
-
status:
|
|
402
|
+
status: qe,
|
|
403
403
|
created_at: e.number(),
|
|
404
|
-
extra_data: e.union(
|
|
405
|
-
}),
|
|
406
|
-
credit_logs: e.array(
|
|
404
|
+
extra_data: e.union(Ie.clone(), Ae.clone()).satisfies().optional()
|
|
405
|
+
}), Oe = e.guard(xe), N = s({ player: Se }), Ne = s({ roles: e.array(z) }), T = s({ role_card: Ee }), Q = e.guard($e), B = e.guard(J), Qe = s({ addresses: e.array(J) }), Be = e.guard(Fe), Me = s({
|
|
406
|
+
credit_logs: e.array(Ue),
|
|
407
407
|
next_token: e.string().optional()
|
|
408
|
-
}),
|
|
409
|
-
redemptions: e.array(
|
|
408
|
+
}), Ke = s({ products: e.array(X) }), He = s({ benefits: e.array(Z) }), ze = s({ benefit: De }), Je = s({
|
|
409
|
+
redemptions: e.array(Ge),
|
|
410
410
|
next_token: e.string().optional()
|
|
411
411
|
});
|
|
412
412
|
class Mr {
|
|
@@ -421,7 +421,7 @@ class Mr {
|
|
|
421
421
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
|
|
422
422
|
*/
|
|
423
423
|
async getConfig(t) {
|
|
424
|
-
const { data: n } = await this.req.get("club/config",
|
|
424
|
+
const { data: n } = await this.req.get("club/config", Oe, t);
|
|
425
425
|
return n;
|
|
426
426
|
}
|
|
427
427
|
/**
|
|
@@ -462,7 +462,7 @@ class Mr {
|
|
|
462
462
|
*/
|
|
463
463
|
async getRoles(t, n, r) {
|
|
464
464
|
if (!await this.token.autoLogin()) return [];
|
|
465
|
-
const { data: a } = await this.req.get("club/roles",
|
|
465
|
+
const { data: a } = await this.req.get("club/roles", Ne, {
|
|
466
466
|
...r,
|
|
467
467
|
params: c({ player_id: t, refresh: n })
|
|
468
468
|
});
|
|
@@ -534,7 +534,7 @@ class Mr {
|
|
|
534
534
|
*/
|
|
535
535
|
async getAddresses(t) {
|
|
536
536
|
if (!await this.token.autoLogin()) return [];
|
|
537
|
-
const { data: n } = await this.req.get("club/addresses",
|
|
537
|
+
const { data: n } = await this.req.get("club/addresses", Qe, t);
|
|
538
538
|
return n?.addresses ?? [];
|
|
539
539
|
}
|
|
540
540
|
/**
|
|
@@ -582,7 +582,7 @@ class Mr {
|
|
|
582
582
|
*/
|
|
583
583
|
async getUserCredit(t, n) {
|
|
584
584
|
await this.token.autoLogin();
|
|
585
|
-
const { data: r, code: a, message: o } = await this.req.get("club/user-credit",
|
|
585
|
+
const { data: r, code: a, message: o } = await this.req.get("club/user-credit", Be, {
|
|
586
586
|
...n,
|
|
587
587
|
params: c(t)
|
|
588
588
|
});
|
|
@@ -598,7 +598,7 @@ class Mr {
|
|
|
598
598
|
*/
|
|
599
599
|
async getCreditLogs(t, n) {
|
|
600
600
|
await this.token.autoLogin();
|
|
601
|
-
const { data: r } = await this.req.get("club/credit-logs",
|
|
601
|
+
const { data: r } = await this.req.get("club/credit-logs", Me, {
|
|
602
602
|
...n,
|
|
603
603
|
params: c({ max_results: 20, ...t })
|
|
604
604
|
});
|
|
@@ -614,7 +614,7 @@ class Mr {
|
|
|
614
614
|
*/
|
|
615
615
|
async getBenefits(t) {
|
|
616
616
|
if (!await this.token.autoLogin()) return [];
|
|
617
|
-
const { data: n } = await this.req.get("club/benefits",
|
|
617
|
+
const { data: n } = await this.req.get("club/benefits", He, t);
|
|
618
618
|
return n?.benefits || [];
|
|
619
619
|
}
|
|
620
620
|
/**
|
|
@@ -624,7 +624,7 @@ class Mr {
|
|
|
624
624
|
*/
|
|
625
625
|
async getBenefit(t, n) {
|
|
626
626
|
if (!await this.token.autoLogin()) return null;
|
|
627
|
-
const { data: r } = await this.req.get("club/benefit",
|
|
627
|
+
const { data: r } = await this.req.get("club/benefit", ze, {
|
|
628
628
|
...n,
|
|
629
629
|
params: { benefit_id: t }
|
|
630
630
|
});
|
|
@@ -636,7 +636,7 @@ class Mr {
|
|
|
636
636
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=r3vC3PzfMQ
|
|
637
637
|
*/
|
|
638
638
|
async getProducts(t, n) {
|
|
639
|
-
const { data: r } = await this.req.get("club/products",
|
|
639
|
+
const { data: r } = await this.req.get("club/products", Ke, {
|
|
640
640
|
...n,
|
|
641
641
|
params: t
|
|
642
642
|
});
|
|
@@ -662,7 +662,7 @@ class Mr {
|
|
|
662
662
|
*/
|
|
663
663
|
async getRedemptions(t, n) {
|
|
664
664
|
await this.token.autoLogin();
|
|
665
|
-
const { data: r } = await this.req.get("club/redemptions",
|
|
665
|
+
const { data: r } = await this.req.get("club/redemptions", Je, {
|
|
666
666
|
...n,
|
|
667
667
|
params: c({ max_results: 20, ...t })
|
|
668
668
|
});
|
|
@@ -693,17 +693,17 @@ const v = {
|
|
|
693
693
|
ExternalCode: "external_gift_code",
|
|
694
694
|
/** 空奖励 */
|
|
695
695
|
VoidItem: "void_item"
|
|
696
|
-
}, Y = e.string().enum(v).lock(), Kr = v, W = Y,
|
|
696
|
+
}, Y = e.string().enum(v).lock(), Kr = v, W = Y, Ze = {
|
|
697
697
|
/** 世游通行证 ID / Combo ID */
|
|
698
698
|
UserId: "user_id",
|
|
699
699
|
/** 游戏角色 ID */
|
|
700
700
|
RoleId: "role_id"
|
|
701
|
-
},
|
|
701
|
+
}, Xe = e.string().enum(Ze).lock(), Ye = {
|
|
702
702
|
None: "none",
|
|
703
703
|
Daily: "daily",
|
|
704
704
|
Weekly: "weekly",
|
|
705
705
|
Monthly: "monthly"
|
|
706
|
-
},
|
|
706
|
+
}, We = e.string().enum(Ye).lock(), l = {
|
|
707
707
|
/** 预约 */
|
|
708
708
|
Preregister: "preregister",
|
|
709
709
|
/** 抽奖 */
|
|
@@ -746,7 +746,7 @@ const v = {
|
|
|
746
746
|
ClaimActivationKey: "claim_activation_key",
|
|
747
747
|
/** 不朽箴言特有的 AI 聊天 */
|
|
748
748
|
ZeroChatgpt: "zero_chatgpt"
|
|
749
|
-
},
|
|
749
|
+
}, et = e.string().enum(l).lock(), tt = {
|
|
750
750
|
/** 累计游戏内活跃值 */
|
|
751
751
|
Active: "player_active_points",
|
|
752
752
|
/** 累计登录,单位 人天 */
|
|
@@ -766,15 +766,17 @@ const v = {
|
|
|
766
766
|
/** 账号等级目标 */
|
|
767
767
|
PlayerLevel: "player_level",
|
|
768
768
|
/** 活动道具累计获取 */
|
|
769
|
-
EventItems: "event_items"
|
|
770
|
-
|
|
769
|
+
EventItems: "event_items",
|
|
770
|
+
/**游戏内任务 */
|
|
771
|
+
GameTask: "game_task"
|
|
772
|
+
}, ee = e.string().enum(tt).lock(), nt = {
|
|
771
773
|
/** 官方上传 */
|
|
772
774
|
System: "system",
|
|
773
775
|
/** 用户投稿 */
|
|
774
776
|
UserSubmission: "user_submission",
|
|
775
777
|
/** 投票入围 */
|
|
776
778
|
Shortlisted: "shortlisted"
|
|
777
|
-
},
|
|
779
|
+
}, rt = e.string().enum(nt).lock(), d = {
|
|
778
780
|
/** 未获得奖励 */
|
|
779
781
|
Ineligible: "ineligible",
|
|
780
782
|
/** 奖励未领取 */
|
|
@@ -785,7 +787,7 @@ const v = {
|
|
|
785
787
|
Failed: "failed",
|
|
786
788
|
/** 奖励已发货 */
|
|
787
789
|
Delivered: "delivered"
|
|
788
|
-
}, Hr = e.string().enum(d).lock(),
|
|
790
|
+
}, Hr = e.string().enum(d).lock(), at = {
|
|
789
791
|
/** 奖励未领取 */
|
|
790
792
|
Unclaimed: d.Unclaimed,
|
|
791
793
|
/** 奖励已领取 */
|
|
@@ -794,7 +796,7 @@ const v = {
|
|
|
794
796
|
Failed: d.Failed,
|
|
795
797
|
/** 奖励已发货 */
|
|
796
798
|
Delivered: d.Delivered
|
|
797
|
-
}, te = e.string().enum(
|
|
799
|
+
}, te = e.string().enum(at).lock(), ot = {
|
|
798
800
|
/** 未获得奖励 */
|
|
799
801
|
Ineligible: d.Ineligible,
|
|
800
802
|
/** 奖励未领取 */
|
|
@@ -805,17 +807,17 @@ const v = {
|
|
|
805
807
|
Failed: d.Failed,
|
|
806
808
|
/** 奖励已发货 */
|
|
807
809
|
Delivered: d.Delivered
|
|
808
|
-
}, E = e.string().enum(
|
|
810
|
+
}, E = e.string().enum(ot).lock(), it = {
|
|
809
811
|
/** 玩法产出奖励 */
|
|
810
812
|
Output: "output",
|
|
811
813
|
/** 玩法参与奖励 */
|
|
812
814
|
Engage: "engage"
|
|
813
|
-
}, $ = e.string().enum(
|
|
815
|
+
}, $ = e.string().enum(it).lock(), st = {
|
|
814
816
|
/** 私有队伍 */
|
|
815
817
|
Private: "private",
|
|
816
818
|
/** 公开队伍 */
|
|
817
819
|
Public: "public"
|
|
818
|
-
},
|
|
820
|
+
}, ct = e.string().enum(st).lock(), h = {
|
|
819
821
|
/** 未知状态 */
|
|
820
822
|
Unknown: "unknown",
|
|
821
823
|
/** 等待开奖 */
|
|
@@ -826,7 +828,7 @@ const v = {
|
|
|
826
828
|
Claimed: "claimed",
|
|
827
829
|
/** 领奖失败 */
|
|
828
830
|
Fail: "fail"
|
|
829
|
-
}, zr = e.string().enum(h).lock(),
|
|
831
|
+
}, zr = e.string().enum(h).lock(), lt = {
|
|
830
832
|
/** 发起组队 */
|
|
831
833
|
Assemble: "assemble",
|
|
832
834
|
/** 加入队伍 */
|
|
@@ -837,19 +839,19 @@ const v = {
|
|
|
837
839
|
ChangeVisibility: "change_visibility",
|
|
838
840
|
/** 查询组队信息 */
|
|
839
841
|
Query: "query"
|
|
840
|
-
}, Jr = e.string().enum(
|
|
842
|
+
}, Jr = e.string().enum(lt).lock(), ut = {
|
|
841
843
|
/** 查询抽奖券 */
|
|
842
844
|
Query: "query",
|
|
843
845
|
/** 开奖 */
|
|
844
846
|
Draw: "draw",
|
|
845
847
|
/** 领奖 */
|
|
846
848
|
Claim: "claim"
|
|
847
|
-
}, Zr = e.string().enum(
|
|
849
|
+
}, Zr = e.string().enum(ut).lock(), mt = {
|
|
848
850
|
/** 将所有队员的进度值求和,作为队伍进度值 */
|
|
849
851
|
Sum: "sum",
|
|
850
852
|
/** 以进度值倒序排名第 N 的队员的进度值,作为队伍进度值。如果队伍人数不足 N,则队伍进度值为 0。N 的值来自于配置字段 top_n */
|
|
851
853
|
TopN: "top_n"
|
|
852
|
-
},
|
|
854
|
+
}, dt = e.string().enum(mt).lock(), gt = {
|
|
853
855
|
/** 尚未结算 */
|
|
854
856
|
None: "none",
|
|
855
857
|
/** 获胜奖励 */
|
|
@@ -880,12 +882,12 @@ const v = {
|
|
|
880
882
|
feature_name: e.string(),
|
|
881
883
|
feature_id: e.number(),
|
|
882
884
|
description: e.string(),
|
|
883
|
-
cycle:
|
|
885
|
+
cycle: We,
|
|
884
886
|
cycle_limit: e.number(),
|
|
885
887
|
limit: e.number(),
|
|
886
888
|
since: e.number(),
|
|
887
889
|
until: e.number(),
|
|
888
|
-
engage_account:
|
|
890
|
+
engage_account: Xe,
|
|
889
891
|
feature_rewards: yt.clone().optional(),
|
|
890
892
|
sort: e.number().optional()
|
|
891
893
|
}), ft = l.Cashback, ht = e.object({
|
|
@@ -983,7 +985,7 @@ const v = {
|
|
|
983
985
|
team: e.object({
|
|
984
986
|
feature_id: e.number().optional(),
|
|
985
987
|
completion_value: e.number(),
|
|
986
|
-
progress_algorithm: dt,
|
|
988
|
+
progress_algorithm: dt.clone().optional(),
|
|
987
989
|
top_n: e.number().optional()
|
|
988
990
|
}).optional(),
|
|
989
991
|
config: e.object({
|
|
@@ -1041,7 +1043,7 @@ const v = {
|
|
|
1041
1043
|
vote_feature_ids: e.array(e.number()),
|
|
1042
1044
|
submission_feature_ids: e.array(e.number()),
|
|
1043
1045
|
finalists_amount: e.number(),
|
|
1044
|
-
source:
|
|
1046
|
+
source: rt,
|
|
1045
1047
|
options: e.array(an),
|
|
1046
1048
|
rewards: e.array(y)
|
|
1047
1049
|
})
|
|
@@ -1126,7 +1128,7 @@ const v = {
|
|
|
1126
1128
|
event_name: e.string(),
|
|
1127
1129
|
feature_id: e.number(),
|
|
1128
1130
|
engagement_id: e.number(),
|
|
1129
|
-
feature_type:
|
|
1131
|
+
feature_type: et,
|
|
1130
1132
|
receive_time: e.number(),
|
|
1131
1133
|
extra_data: e.record(e.unknown()).optional()
|
|
1132
1134
|
}), hn = e.string().enum(h.Unknown, h.Pending), wn = e.union(
|
|
@@ -1143,7 +1145,7 @@ const v = {
|
|
|
1143
1145
|
tickets: e.array(wn)
|
|
1144
1146
|
}), vn = e.object({
|
|
1145
1147
|
platforms: e.array(e.string())
|
|
1146
|
-
}),
|
|
1148
|
+
}), ne = e.object({
|
|
1147
1149
|
role_name: e.string(),
|
|
1148
1150
|
is_leader: e.bool(),
|
|
1149
1151
|
is_myself: e.bool().optional(),
|
|
@@ -1155,13 +1157,13 @@ const v = {
|
|
|
1155
1157
|
team: e.object({
|
|
1156
1158
|
progress: e.number(),
|
|
1157
1159
|
completion_value: e.number().optional(),
|
|
1158
|
-
players: e.array(
|
|
1160
|
+
players: e.array(ne)
|
|
1159
1161
|
}).optional()
|
|
1160
1162
|
}), Cn = e.object({
|
|
1161
1163
|
progress: e.number(),
|
|
1162
1164
|
team: e.object({
|
|
1163
1165
|
progress: e.number(),
|
|
1164
|
-
team_members: e.array(
|
|
1166
|
+
team_members: e.array(ne).optional()
|
|
1165
1167
|
}).optional()
|
|
1166
1168
|
}), Rn = e.object({
|
|
1167
1169
|
platform: e.string()
|
|
@@ -1173,14 +1175,14 @@ const v = {
|
|
|
1173
1175
|
team_code: e.string(),
|
|
1174
1176
|
leader_name: e.string(),
|
|
1175
1177
|
total_members: e.number()
|
|
1176
|
-
}),
|
|
1178
|
+
}), Xr = e.object({
|
|
1177
1179
|
is_leader: e.bool(),
|
|
1178
1180
|
is_myself: e.bool().optional(),
|
|
1179
1181
|
role_name: e.string(),
|
|
1180
1182
|
server_name: e.string()
|
|
1181
1183
|
}), xn = e.object({
|
|
1182
1184
|
team_code: e.string(),
|
|
1183
|
-
visibility:
|
|
1185
|
+
visibility: ct,
|
|
1184
1186
|
members: e.array(
|
|
1185
1187
|
e.object({
|
|
1186
1188
|
is_leader: e.bool(),
|
|
@@ -1320,7 +1322,7 @@ const v = {
|
|
|
1320
1322
|
candidate_votes: e.array(En)
|
|
1321
1323
|
})
|
|
1322
1324
|
);
|
|
1323
|
-
class
|
|
1325
|
+
class Yr {
|
|
1324
1326
|
token;
|
|
1325
1327
|
event = 0;
|
|
1326
1328
|
req;
|
|
@@ -1463,7 +1465,7 @@ class Wr {
|
|
|
1463
1465
|
/**
|
|
1464
1466
|
* 用户参与某个玩法
|
|
1465
1467
|
*
|
|
1466
|
-
* 💡可以设置泛型参数来快速确定 engagementParam
|
|
1468
|
+
* 💡可以设置泛型参数来快速确定 engagementParam 数据类型和返回值
|
|
1467
1469
|
*
|
|
1468
1470
|
* 💡需要先调用 `visit` 接口提交访问信息
|
|
1469
1471
|
*
|
|
@@ -1484,7 +1486,6 @@ class Wr {
|
|
|
1484
1486
|
return o ?? {
|
|
1485
1487
|
message: p,
|
|
1486
1488
|
error: g
|
|
1487
|
-
// 您的道具数量不足,请先获取足够的道具
|
|
1488
1489
|
};
|
|
1489
1490
|
}
|
|
1490
1491
|
/**
|
|
@@ -1728,14 +1729,14 @@ const cr = {
|
|
|
1728
1729
|
Failed: "failed",
|
|
1729
1730
|
/** 嫌疑(仅自己可见) */
|
|
1730
1731
|
Suspect: "suspect"
|
|
1731
|
-
},
|
|
1732
|
+
}, re = e.string().enum(ur).lock(), mr = {
|
|
1732
1733
|
/** 系统通知 */
|
|
1733
1734
|
System: "system",
|
|
1734
1735
|
/** 评论我的 */
|
|
1735
1736
|
Comment: "comment",
|
|
1736
1737
|
/** 点赞通知 */
|
|
1737
1738
|
Like: "like"
|
|
1738
|
-
},
|
|
1739
|
+
}, Wr = e.string().enum(mr).lock(), m = {
|
|
1739
1740
|
/** 系统通知 */
|
|
1740
1741
|
System: "system",
|
|
1741
1742
|
/** 帖子被置顶 */
|
|
@@ -1760,7 +1761,7 @@ const cr = {
|
|
|
1760
1761
|
ReplyLiked: "reply_liked",
|
|
1761
1762
|
/** 回复被删除 */
|
|
1762
1763
|
ReplyDeleted: "reply_deleted"
|
|
1763
|
-
}, dr = e.string().enum(m).lock(),
|
|
1764
|
+
}, dr = e.string().enum(m).lock(), ae = e.object({
|
|
1764
1765
|
forum_id: e.number(),
|
|
1765
1766
|
icon_url: e.string(),
|
|
1766
1767
|
name: e.string(),
|
|
@@ -1777,7 +1778,7 @@ const cr = {
|
|
|
1777
1778
|
post_num: e.number()
|
|
1778
1779
|
}).lock(), D = e.object({
|
|
1779
1780
|
post_id: e.number(),
|
|
1780
|
-
forum:
|
|
1781
|
+
forum: ae,
|
|
1781
1782
|
posted_by: e.string(),
|
|
1782
1783
|
nickname: e.string(),
|
|
1783
1784
|
avatar_url: e.string(),
|
|
@@ -1793,9 +1794,9 @@ const cr = {
|
|
|
1793
1794
|
event_ids: e.array(e.number()),
|
|
1794
1795
|
is_pinned: e.bool(),
|
|
1795
1796
|
is_highlighted: e.bool(),
|
|
1796
|
-
status:
|
|
1797
|
+
status: re,
|
|
1797
1798
|
create_time: e.number()
|
|
1798
|
-
}).lock(),
|
|
1799
|
+
}).lock(), oe = e.object({
|
|
1799
1800
|
err_msg: e.string().optional()
|
|
1800
1801
|
}).optional().lock(), gr = e.object({
|
|
1801
1802
|
reply_id: e.number(),
|
|
@@ -1836,7 +1837,7 @@ const cr = {
|
|
|
1836
1837
|
liked: e.bool(),
|
|
1837
1838
|
image_url: e.string(),
|
|
1838
1839
|
create_time: e.number(),
|
|
1839
|
-
status:
|
|
1840
|
+
status: re,
|
|
1840
1841
|
replies: e.array(C).optional()
|
|
1841
1842
|
}).lock(), pr = e.object({
|
|
1842
1843
|
image_url: e.string(),
|
|
@@ -1912,18 +1913,18 @@ const cr = {
|
|
|
1912
1913
|
wr,
|
|
1913
1914
|
kr,
|
|
1914
1915
|
vr
|
|
1915
|
-
).satisfies().lock(), Cr = s({ forums: e.array(
|
|
1916
|
+
).satisfies().lock(), Cr = s({ forums: e.array(ae) }), Rr = s({ topics: e.array(U) }), jr = s({ topic: U }), Tr = s({ post: D }), M = s({
|
|
1916
1917
|
posts: e.array(D),
|
|
1917
1918
|
next_token: e.string().optional()
|
|
1918
1919
|
}), qr = s({
|
|
1919
1920
|
post: D.clone().optional(),
|
|
1920
|
-
antispam:
|
|
1921
|
+
antispam: oe.clone().optional()
|
|
1921
1922
|
}), xr = s({
|
|
1922
1923
|
replies: e.array(C),
|
|
1923
1924
|
next_token: e.string().optional()
|
|
1924
1925
|
}), Sr = s({ reply: C }), Lr = s({
|
|
1925
1926
|
reply: C.clone().optional(),
|
|
1926
|
-
antispam:
|
|
1927
|
+
antispam: oe.clone().optional()
|
|
1927
1928
|
}), Pr = s({ comment: w }), Er = s({
|
|
1928
1929
|
comments: e.array(w),
|
|
1929
1930
|
next_token: e.string().optional()
|
|
@@ -1938,7 +1939,7 @@ const cr = {
|
|
|
1938
1939
|
comment: e.number(),
|
|
1939
1940
|
like: e.number()
|
|
1940
1941
|
});
|
|
1941
|
-
class
|
|
1942
|
+
class ea {
|
|
1942
1943
|
token;
|
|
1943
1944
|
req;
|
|
1944
1945
|
constructor(t) {
|
|
@@ -2234,7 +2235,7 @@ function S(i) {
|
|
|
2234
2235
|
return k(i, "open_id", "union_id", "weixin_token");
|
|
2235
2236
|
}
|
|
2236
2237
|
const K = "wx_login_cache";
|
|
2237
|
-
class
|
|
2238
|
+
class ta {
|
|
2238
2239
|
token;
|
|
2239
2240
|
$appid;
|
|
2240
2241
|
req;
|
|
@@ -2268,7 +2269,7 @@ class na {
|
|
|
2268
2269
|
const t = this.token.storage.get(K);
|
|
2269
2270
|
if (!t)
|
|
2270
2271
|
return null;
|
|
2271
|
-
const n =
|
|
2272
|
+
const n = pe(t);
|
|
2272
2273
|
return S(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
|
|
2273
2274
|
}
|
|
2274
2275
|
/**
|
|
@@ -2294,7 +2295,7 @@ class na {
|
|
|
2294
2295
|
const n = await this.getLoginCache();
|
|
2295
2296
|
if (n)
|
|
2296
2297
|
return n;
|
|
2297
|
-
const r = await
|
|
2298
|
+
const r = await ye(), { data: a, code: o, message: g } = await this.req.post(
|
|
2298
2299
|
"weixin/login",
|
|
2299
2300
|
{ code: r, appid: this.appid },
|
|
2300
2301
|
S,
|
|
@@ -2324,9 +2325,9 @@ class na {
|
|
|
2324
2325
|
async webLogin(t = "snsapi_userinfo", n) {
|
|
2325
2326
|
const r = L("code"), a = Date.now(), o = +L("state");
|
|
2326
2327
|
if (!r || !o || o < a - 1e3 * 60 * 5 || o > a) {
|
|
2327
|
-
const
|
|
2328
|
+
const ce = G(["code", "state"]);
|
|
2328
2329
|
location.replace(
|
|
2329
|
-
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(
|
|
2330
|
+
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(ce)}&response_type=code&scope=${t}&state=${a}#wechat_redirect`
|
|
2330
2331
|
);
|
|
2331
2332
|
return;
|
|
2332
2333
|
}
|
|
@@ -2339,12 +2340,12 @@ class na {
|
|
|
2339
2340
|
"replaceState" in history && history.replaceState({}, "", g);
|
|
2340
2341
|
const {
|
|
2341
2342
|
data: p,
|
|
2342
|
-
code:
|
|
2343
|
-
message:
|
|
2343
|
+
code: ie,
|
|
2344
|
+
message: se
|
|
2344
2345
|
} = await this.req.post("weixin/login", { code: r, appid: this.appid }, S, n);
|
|
2345
2346
|
return p && (this.token.weixinToken = p.weixin_token, await this.token.autoLogin()), p ?? {
|
|
2346
|
-
message:
|
|
2347
|
-
error:
|
|
2347
|
+
message: se,
|
|
2348
|
+
error: ie
|
|
2348
2349
|
};
|
|
2349
2350
|
}
|
|
2350
2351
|
/**
|
|
@@ -2390,40 +2391,40 @@ class na {
|
|
|
2390
2391
|
}
|
|
2391
2392
|
}
|
|
2392
2393
|
export {
|
|
2393
|
-
|
|
2394
|
+
oe as AntispamValidator,
|
|
2394
2395
|
Qr as AuthToken,
|
|
2395
2396
|
En as CandidateVoteValidator,
|
|
2396
2397
|
pn as CashbackEngagementDataValidator,
|
|
2397
2398
|
_n as ClaimActivationKeyEngagementDataValidator,
|
|
2398
|
-
|
|
2399
|
+
ot as ClaimRewardStatus,
|
|
2399
2400
|
E as ClaimRewardStatusValidator,
|
|
2400
2401
|
Qn as ClaimedItemValidator,
|
|
2401
2402
|
J as ClubAddressValidator,
|
|
2402
2403
|
Mr as ClubApi,
|
|
2403
2404
|
Z as ClubBenefitSummaryValidator,
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2405
|
+
De as ClubBenefitValidator,
|
|
2406
|
+
Ce as ClubCreditChangeScene,
|
|
2407
|
+
Re as ClubCreditChangeSceneValidator,
|
|
2408
|
+
ve as ClubCreditChangeType,
|
|
2409
|
+
Ve as ClubCreditChangeTypeValidator,
|
|
2410
|
+
Ue as ClubCreditLogValidator,
|
|
2411
|
+
xe as ClubGlobalConfigValidator,
|
|
2412
|
+
je as ClubItemType,
|
|
2412
2413
|
H as ClubItemTypeValidator,
|
|
2413
|
-
|
|
2414
|
+
Se as ClubPlayerValidator,
|
|
2414
2415
|
X as ClubProductValidator,
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2416
|
+
Te as ClubRedemptionStatus,
|
|
2417
|
+
qe as ClubRedemptionStatusValidator,
|
|
2418
|
+
Fe as ClubUserCreditValidator,
|
|
2419
|
+
$e as ClubUserProfileValidator,
|
|
2419
2420
|
Un as CommentEngagementValidator,
|
|
2420
2421
|
w as CommentValidator,
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2422
|
+
ea as CommunityApi,
|
|
2423
|
+
Ze as EngageAccountType,
|
|
2424
|
+
Xe as EngageAccountTypeValidator,
|
|
2424
2425
|
Nn as EngageResponseValidator,
|
|
2425
2426
|
In as EngageRewardValidator,
|
|
2426
|
-
|
|
2427
|
+
Yr as EventApi,
|
|
2427
2428
|
gn as EventConfigValidator,
|
|
2428
2429
|
ht as EventFeatureConfigOfCashbackValidator,
|
|
2429
2430
|
kt as EventFeatureConfigOfCheckInValidator,
|
|
@@ -2446,24 +2447,24 @@ export {
|
|
|
2446
2447
|
ln as EventFeatureConfigOfVote2Validator,
|
|
2447
2448
|
on as EventFeatureConfigOfVoteValidator,
|
|
2448
2449
|
dn as EventFeatureConfigValidator,
|
|
2449
|
-
|
|
2450
|
-
|
|
2450
|
+
Ye as EventPeriodType,
|
|
2451
|
+
We as EventPeriodTypeValidator,
|
|
2451
2452
|
y as EventRewardItemConfigValidator,
|
|
2452
|
-
|
|
2453
|
-
|
|
2453
|
+
Ae as ExtraGameRewardValidator,
|
|
2454
|
+
Ie as ExtraPhysicalShipmentValidator,
|
|
2454
2455
|
yt as FeatureRewardValidator,
|
|
2455
2456
|
l as FeatureType,
|
|
2456
|
-
|
|
2457
|
+
et as FeatureTypeValidator,
|
|
2457
2458
|
cr as ForumMode,
|
|
2458
2459
|
lr as ForumModeValidator,
|
|
2459
|
-
|
|
2460
|
+
ae as ForumValidator,
|
|
2460
2461
|
v as GamerItemType,
|
|
2461
2462
|
Y as GamerItemTypeValidator,
|
|
2462
|
-
|
|
2463
|
-
|
|
2463
|
+
we as Gender,
|
|
2464
|
+
ke as GenderValidator,
|
|
2464
2465
|
bn as GiftCodeEngagementDataValidator,
|
|
2465
2466
|
yn as InviteEngagementDataValidator,
|
|
2466
|
-
|
|
2467
|
+
ut as LotteryDrawAction,
|
|
2467
2468
|
Zr as LotteryDrawActionValidator,
|
|
2468
2469
|
kn as LotteryDrawEngagementDataValidator,
|
|
2469
2470
|
fn as LotteryEngagementDataValidator,
|
|
@@ -2471,7 +2472,7 @@ export {
|
|
|
2471
2472
|
zr as LotteryTicketStatusValidator,
|
|
2472
2473
|
_ as NotificationBaseValidator,
|
|
2473
2474
|
mr as NotificationCategory,
|
|
2474
|
-
|
|
2475
|
+
Wr as NotificationCategoryValidator,
|
|
2475
2476
|
hr as NotificationCommentReplyValidator,
|
|
2476
2477
|
wr as NotificationCommentValidator,
|
|
2477
2478
|
R as NotificationPayloadCommentValidator,
|
|
@@ -2486,45 +2487,44 @@ export {
|
|
|
2486
2487
|
m as NotificationType,
|
|
2487
2488
|
dr as NotificationTypeValidator,
|
|
2488
2489
|
Vr as NotificationValidator,
|
|
2489
|
-
|
|
2490
|
+
Ee as PlayerRoleCardValidator,
|
|
2490
2491
|
z as PlayerRoleValidator,
|
|
2491
2492
|
ur as PostStatus,
|
|
2492
|
-
|
|
2493
|
+
re as PostStatusValidator,
|
|
2493
2494
|
D as PostValidator,
|
|
2494
2495
|
vn as PreregisterEngagementDataValidator,
|
|
2495
2496
|
pr as PresignedUrlResponseValidator,
|
|
2496
2497
|
Vn as QuestEngagementDataValidator,
|
|
2497
|
-
|
|
2498
|
+
tt as QuestObjective,
|
|
2498
2499
|
ee as QuestObjectiveValidator,
|
|
2499
|
-
|
|
2500
|
-
dt as
|
|
2501
|
-
Xr as QuestProgressAlgorithmValidator,
|
|
2500
|
+
mt as QuestProgressAlgorithm,
|
|
2501
|
+
dt as QuestProgressAlgorithmValidator,
|
|
2502
2502
|
Cn as QuestProgressValidator,
|
|
2503
2503
|
Br as RedeemParamsValidator,
|
|
2504
|
-
|
|
2504
|
+
Ge as RedemptionValidator,
|
|
2505
2505
|
bt as RegularRewardValidator,
|
|
2506
2506
|
gr as ReplyToValidator,
|
|
2507
2507
|
C as ReplyValidator,
|
|
2508
2508
|
Kr as RewardItemType,
|
|
2509
2509
|
W as RewardItemTypeValidator,
|
|
2510
|
-
|
|
2510
|
+
it as RewardSource,
|
|
2511
2511
|
$ as RewardSourceValidator,
|
|
2512
2512
|
d as RewardStatus,
|
|
2513
|
-
|
|
2513
|
+
at as RewardStatusSuffix,
|
|
2514
2514
|
te as RewardStatusSuffixValidator,
|
|
2515
2515
|
Hr as RewardStatusValidator,
|
|
2516
2516
|
Dn as RewardValidator,
|
|
2517
|
-
|
|
2518
|
-
|
|
2517
|
+
Pe as RoleBaseInfoValidator,
|
|
2518
|
+
Le as ServerBaseInfoValidator,
|
|
2519
2519
|
Rn as ShareEngagementDataValidator,
|
|
2520
2520
|
Tn as SurveyEngagementDataValidator,
|
|
2521
|
-
|
|
2521
|
+
lt as TeamAction,
|
|
2522
2522
|
Jr as TeamActionValidator,
|
|
2523
2523
|
xn as TeamEngagementDataValidator,
|
|
2524
2524
|
qn as TeamEngagementValidator,
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2525
|
+
Xr as TeamMemberValidator,
|
|
2526
|
+
st as TeamVisibility,
|
|
2527
|
+
ct as TeamVisibilityValidator,
|
|
2528
2528
|
U as TopicValidator,
|
|
2529
2529
|
F as UserEngagementDataValidator,
|
|
2530
2530
|
An as UserEngagementValidator,
|
|
@@ -2536,9 +2536,9 @@ export {
|
|
|
2536
2536
|
gt as Vote2RewardType,
|
|
2537
2537
|
pt as Vote2RewardTypeValidator,
|
|
2538
2538
|
Sn as VoteEngagementDataValidator,
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2539
|
+
nt as VoteOptionSource,
|
|
2540
|
+
rt as VoteOptionSourceValidator,
|
|
2541
|
+
ta as WeixinApi,
|
|
2542
2542
|
jn as WeixinSubscribeEngagementDataValidator,
|
|
2543
2543
|
Ar as WeixinWebLoginErrorCode,
|
|
2544
2544
|
Ir as isWeixinSignResponse
|
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.10.
|
|
4
|
+
"version": "2.10.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"@types/node": "^22.13.1",
|
|
33
33
|
"@seayoo-web/request": "3.4.0",
|
|
34
34
|
"@seayoo-web/combo-webview": "2.7.0",
|
|
35
|
-
"@seayoo-web/utils": "4.1.3",
|
|
36
|
-
"@seayoo-web/validator": "1.1.0",
|
|
37
35
|
"@seayoo-web/scripts": "3.1.3",
|
|
38
|
-
"@seayoo-web/tsconfig": "1.0.5"
|
|
36
|
+
"@seayoo-web/tsconfig": "1.0.5",
|
|
37
|
+
"@seayoo-web/utils": "4.1.3",
|
|
38
|
+
"@seayoo-web/validator": "1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@seayoo-web/combo-webview": "^2.7.0",
|
|
42
42
|
"@seayoo-web/utils": "^4.1.3",
|
|
43
|
-
"@seayoo-web/validator": "^1.1.
|
|
43
|
+
"@seayoo-web/validator": "^1.1.1"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"prebuild": "pnpm -F validator build && pnpm -F request build && pnpm -F combo-webview build",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InferType } from "@seayoo-web/validator";
|
|
2
2
|
import { type EventFeatureBaseConfig } from "./feature.base";
|
|
3
|
-
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"
|
|
3
|
+
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"activation_key" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "credit" | "external_gift_code" | "void_item", false, false>;
|
|
4
4
|
declare const featureType: "lottery";
|
|
5
5
|
export interface FeatureLotteryItemConfig {
|
|
6
6
|
/** 抽奖奖励道具 id */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type InferType } from "@seayoo-web/validator";
|
|
2
|
-
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"
|
|
2
|
+
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"activation_key" | "gift_code" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "lottery_ticket" | "credit" | "external_gift_code" | "void_item", false, false>;
|
|
3
3
|
export interface EventRewardItemConfig {
|
|
4
4
|
/** 玩法奖励道具 id */
|
|
5
5
|
reward_item_id: number;
|
package/types/src/event.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EngagementFeatureType, InferEngagementParam } from "./event.define";
|
|
1
|
+
import type { EngagementFeatureType, InferEngagementError, InferEngagementParam } from "./event.define";
|
|
2
2
|
import type { GamerItemType, RewardSource } from "./event.enums";
|
|
3
3
|
import type { AuthToken } from "./token";
|
|
4
4
|
import type { RequestInternalError, IRequestOptions } from "@seayoo-web/request";
|
|
@@ -110,7 +110,7 @@ export declare class EventApi {
|
|
|
110
110
|
/**
|
|
111
111
|
* 用户参与某个玩法
|
|
112
112
|
*
|
|
113
|
-
* 💡可以设置泛型参数来快速确定 engagementParam
|
|
113
|
+
* 💡可以设置泛型参数来快速确定 engagementParam 数据类型和返回值
|
|
114
114
|
*
|
|
115
115
|
* 💡需要先调用 `visit` 接口提交访问信息
|
|
116
116
|
*
|
|
@@ -129,7 +129,7 @@ export declare class EventApi {
|
|
|
129
129
|
role_name?: string;
|
|
130
130
|
}, requestOptions?: IRequestOptions): Promise<import("./event.define").EngageResponse | {
|
|
131
131
|
message: string;
|
|
132
|
-
error: RequestInternalError |
|
|
132
|
+
error: RequestInternalError | InferEngagementError<T>;
|
|
133
133
|
}>;
|
|
134
134
|
/**
|
|
135
135
|
* 用户领取除红包和实物奖励以外的所有奖励
|
|
@@ -3,3 +3,4 @@ export interface ClaimActivationKeyEngagementData {
|
|
|
3
3
|
activation_key: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const ClaimActivationKeyEngagementDataValidator: import("@seayoo-web/validator").ObjectValidator<ClaimActivationKeyEngagementData, false, false>;
|
|
6
|
+
export type ClaimActivationKeyEngagementError = "activation_group_not_found" | "activation_group_expired" | "no_claim_activation_key_eligibility" | "no_activation_key_available";
|
|
@@ -3,3 +3,4 @@ export interface GiftCodeEngagementData {
|
|
|
3
3
|
gift_code: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const GiftCodeEngagementDataValidator: import("@seayoo-web/validator").ObjectValidator<GiftCodeEngagementData, false, false>;
|
|
6
|
+
export type GiftCodeEngagementError = "unique_gift_code_is_empty";
|
|
@@ -40,3 +40,4 @@ export type QuestProgress = {
|
|
|
40
40
|
team?: QuestProgressTeam;
|
|
41
41
|
};
|
|
42
42
|
export declare const QuestProgressValidator: import("@seayoo-web/validator").ObjectValidator<QuestProgress, false, false>;
|
|
43
|
+
export type QuestEngagementError = "player_created_at_out_of_range" | "query_user_order_total_amount_err";
|
|
@@ -51,3 +51,4 @@ export type TeamEngagementParam = {
|
|
|
51
51
|
/** 组队码 */
|
|
52
52
|
team_code?: string;
|
|
53
53
|
};
|
|
54
|
+
export type TeamEngagementError = "team_not_found" | "team_is_full" | "user_had_joined_a_team" | "join_team_conflict" | "team_has_been_disbanded" | "exceeded_assembled_team_limit" | "change_team_visibility_not_allowed" | "disband_team_not_allowed";
|
|
@@ -36,3 +36,4 @@ export interface CandidateVote {
|
|
|
36
36
|
my_votes: number;
|
|
37
37
|
}
|
|
38
38
|
export declare const CandidateVoteValidator: import("@seayoo-web/validator").ObjectValidator<CandidateVote, false, false>;
|
|
39
|
+
export type Vote2EngagementError = "vote_not_started" | "vote_already_ended" | "vote_candidate_not_found" | "consume_item_not_enough";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UserEngagementData, type CommentEngagementParam, type PreregisterEngagementParam, type LotteryEngagementParam, type LotteryDrawEngagementParam, type ShareEngagementParam, type SubscribeEngagementParam, type TeamEngagementParam, type VoteEngagementParam, type Vote2EngagementParam } from "./engage";
|
|
1
|
+
import { type UserEngagementData, type CommentEngagementParam, type PreregisterEngagementParam, type LotteryEngagementParam, type LotteryDrawEngagementParam, type ShareEngagementParam, type SubscribeEngagementParam, type TeamEngagementParam, type VoteEngagementParam, type Vote2EngagementParam, type Vote2EngagementError, type LotteryEngagementError, type ClaimActivationKeyEngagementError, type LotteryDrawEngagementError, type TeamEngagementError, type GiftCodeEngagementError } from "./engage";
|
|
2
2
|
import { type Reward } from "./reward";
|
|
3
3
|
import type { FeatureType } from "../event.enums";
|
|
4
4
|
import type { ZeroChatGPTEngagementParam } from "./engage.zeroChatGPT";
|
|
@@ -37,4 +37,10 @@ export type EngagementFeatureType = FeatureType | unknown;
|
|
|
37
37
|
/**
|
|
38
38
|
* 根据玩法类型推导需要提交的参数数据类型
|
|
39
39
|
*/
|
|
40
|
-
export type InferEngagementParam<T extends EngagementFeatureType> = [
|
|
40
|
+
export type InferEngagementParam<T extends EngagementFeatureType> = [T] extends ["preregister"] ? PreregisterEngagementParam : [T] extends ["lottery"] ? LotteryEngagementParam : [T] extends ["comment"] ? CommentEngagementParam : [T] extends ["share"] ? ShareEngagementParam : [T] extends ["vote"] ? VoteEngagementParam : [T] extends ["vote2"] ? Vote2EngagementParam : [T] extends ["weixin_subscribe"] ? SubscribeEngagementParam : [T] extends ["team"] ? TeamEngagementParam : [T] extends ["lottery_draw"] ? LotteryDrawEngagementParam : [T] extends ["zero_chatgpt"] ? ZeroChatGPTEngagementParam : EngagementParam;
|
|
41
|
+
export type EngagementCommonError = "invalid_token" | "event_not_found" | "feature_not_found" | "visit_record_not_found" | "event_not_started" | "event_already_ended" | "engage_feature_reached_limit" | "invalid_merchant_parameter" | "budget_not_enough" | "combo_id_not_found";
|
|
42
|
+
export type EngagementError = EngagementCommonError | TeamEngagementError | Vote2EngagementError | ClaimActivationKeyEngagementError | LotteryDrawEngagementError | LotteryEngagementError | GiftCodeEngagementError;
|
|
43
|
+
/**
|
|
44
|
+
* 根据玩法类型推导额外的错误字段
|
|
45
|
+
*/
|
|
46
|
+
export type InferEngagementError<T extends EngagementFeatureType> = ([T] extends ["vote2"] ? Vote2EngagementError : [T] extends ["claim_activation_key"] ? ClaimActivationKeyEngagementError : [T] extends ["lottery"] ? LotteryEngagementError : [T] extends ["lottery_draw"] ? LotteryDrawEngagementError : [T] extends ["team"] ? TeamEngagementError : [T] extends ["gift_code"] ? GiftCodeEngagementError : EngagementError) | EngagementCommonError;
|
|
@@ -180,6 +180,8 @@ export declare const QuestObjective: {
|
|
|
180
180
|
readonly PlayerLevel: "player_level";
|
|
181
181
|
/** 活动道具累计获取 */
|
|
182
182
|
readonly EventItems: "event_items";
|
|
183
|
+
/**游戏内任务 */
|
|
184
|
+
readonly GameTask: "game_task";
|
|
183
185
|
};
|
|
184
186
|
export type QuestObjective = ValueOf<typeof QuestObjective>;
|
|
185
187
|
export declare const QuestObjectiveValidator: import("@seayoo-web/validator").StringValidator<QuestObjective, false, false> & {
|
|
@@ -410,16 +412,6 @@ export declare const QuestProgressAlgorithmValidator: import("@seayoo-web/valida
|
|
|
410
412
|
maybeNull: never;
|
|
411
413
|
lock: never;
|
|
412
414
|
};
|
|
413
|
-
export declare const QuestProgressAlgorithmOptionalValidator: import("@seayoo-web/validator").StringValidator<QuestProgressAlgorithm, true, false> & {
|
|
414
|
-
pattern: never;
|
|
415
|
-
url: never;
|
|
416
|
-
dataUri: never;
|
|
417
|
-
enum: never;
|
|
418
|
-
disallow: never;
|
|
419
|
-
optional: never;
|
|
420
|
-
maybeNull: never;
|
|
421
|
-
lock: never;
|
|
422
|
-
};
|
|
423
415
|
/**
|
|
424
416
|
* vote2 玩法的奖励结算状态
|
|
425
417
|
*/
|