@seayoo-web/gamer-api 4.0.2 → 4.0.4

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 CHANGED
@@ -1,2825 +1,1793 @@
1
- import { isComboWebView as me } from "@seayoo-web/combo-webview";
2
- import { isPlainObject as y, usePromise as de, useConsole as ge, weixinStorageHelper as _e, localStorageHelper as pe, supportWx as h, pruneURL as be, supportWindow as ye, queryString as x, pruneObject as l, omitFields as L, parseJSON as fe, removePara as O } from "@seayoo-web/utils";
3
- import { v as e, objectGuard as s } from "@seayoo-web/validator";
4
- function he(o) {
5
- return y(o, "gamer_token") && typeof o.gamer_token == "string";
1
+ import { isComboWebView as e } from "@seayoo-web/combo-webview";
2
+ import { isPlainObject as t, localStorageHelper as n, omitFields as r, parseJSON as i, pruneObject as a, pruneURL as o, queryString as s, removePara as ee, supportWindow as te, supportWx as c, useConsole as ne, usePromise as re, weixinStorageHelper as ie } from "@seayoo-web/utils";
3
+ import { objectGuard as l, v as u } from "@seayoo-web/validator";
4
+ //#region src/token.guards.ts
5
+ function ae(e) {
6
+ return t(e, "gamer_token") && typeof e.gamer_token == "string";
6
7
  }
7
- function we(o) {
8
- return y(o, "gamer_token", "game_id") && typeof o.gamer_token == "string" && typeof o.game_id == "string";
8
+ function oe(e) {
9
+ return t(e, "gamer_token", "game_id") && typeof e.gamer_token == "string" && typeof e.game_id == "string";
9
10
  }
10
- function G(o) {
11
- return y(o);
11
+ function se(e) {
12
+ return t(e);
12
13
  }
13
- ge("GamerApiSDK");
14
- function ke(o) {
15
- return /^\/[a-z\d-]+$/.test(o);
14
+ ne("GamerApiSDK");
15
+ function ce(e) {
16
+ return /^\/[a-z\d-]+$/.test(e);
16
17
  }
17
- async function ve() {
18
- const { promise: o, resolve: t } = de();
19
- return wx.login({
20
- success(n) {
21
- t(n.code);
22
- },
23
- fail() {
24
- t("");
25
- }
26
- }), await o;
18
+ async function le() {
19
+ let { promise: e, resolve: t } = re();
20
+ return wx.login({
21
+ success(e) {
22
+ t(e.code);
23
+ },
24
+ fail() {
25
+ t("");
26
+ }
27
+ }), await e;
27
28
  }
28
- const f = "gamer_token";
29
- class yo {
30
- _NetRequest;
31
- _idToken = "";
32
- _weixinToken = "";
33
- _gamerToken = "";
34
- req;
35
- storage;
36
- constructor(t, n) {
37
- this.storage = h() ? _e : pe;
38
- const r = ke(t) ? t : `https://${be(t)}`;
39
- if (this._NetRequest = n, this.req = n({
40
- baseURL: `${r}/v1`,
41
- timeout: 1e4,
42
- maxRetry: 2,
43
- retryInterval: "2EB",
44
- responseRule: {
45
- ok: { resolve: "body" },
46
- failed: {
47
- resolve: "json",
48
- statusField: "error",
49
- messageField: ["user_message", "message"]
50
- }
51
- },
52
- // 使用箭头函数绑定执行上下文
53
- requestTransformer: (a) => {
54
- this._gamerToken && (a.headers.Authorization = `Bearer ${this._gamerToken}`);
55
- }
56
- }), ye()) {
57
- const a = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), i = x("gamer_token");
58
- (me() || a && i) && (this._gamerToken = i);
59
- }
60
- this._gamerToken || this.loadGamerTokenCache();
61
- }
62
- get NetRequest() {
63
- return this._NetRequest;
64
- }
65
- loadGamerTokenCache() {
66
- const n = this.storage.get(f).match(/^(\d{12,})#(.{8,})$/);
67
- if (n) {
68
- const r = parseInt(n[1]), a = n[2];
69
- if (r > Date.now() - (24 * 3600 - 10) * 1e3) {
70
- this._gamerToken = a;
71
- return;
72
- }
73
- }
74
- this.storage.remove(f);
75
- }
76
- /** 当前是否为登录状态,即是否拥有 gamerToken */
77
- get isLoggedIn() {
78
- return this._gamerToken !== "";
79
- }
80
- /** 读取已经设置的 idToken */
81
- get idToken() {
82
- return this._idToken;
83
- }
84
- /** 设置从登录组件获取的 Id Token,用于后续请求自动置换 Gamer Token */
85
- set idToken(t) {
86
- this._idToken !== t && (this._idToken = t, this.gamerToken = "");
87
- }
88
- /** 读取设置 weixinToken */
89
- get weixinToken() {
90
- return this._weixinToken;
91
- }
92
- /**
93
- * 设置 Weixin Token,用于后续请求自动置换 Gamer Token
94
- *
95
- * 仅仅在微信小程序模式下有效
96
- */
97
- set weixinToken(t) {
98
- this._weixinToken !== t && (this._weixinToken = t, this.gamerToken = "");
99
- }
100
- /** 读取自动置换的 gamerToken */
101
- get gamerToken() {
102
- return this._gamerToken;
103
- }
104
- /**
105
- * 直接写入 Gamer Token,并更新缓存
106
- */
107
- set gamerToken(t) {
108
- this._gamerToken = t, t ? this.storage.set(f, `${Date.now()}#${t}`) : this.storage.remove(f);
109
- }
110
- /**
111
- * 退出登录,销毁相关 Token
112
- */
113
- logout() {
114
- this._idToken = "", this._weixinToken = "", this.gamerToken = "";
115
- }
116
- /**
117
- * 用世游通行证统一登录能力签发的 ID Token / Weixin Token,自动置换 Gamer Token,成功后会自动设置后续 Request Headers
118
- *
119
- * [世游通行证统一登录](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=FJXYgqvLHs)
120
- *
121
- * [世游通行证统一登录 - Web 站点](https://365.kdocs.cn/l/cf57sp1qLlZh)
122
- *
123
- * [世游通行证统一登录 - 微信小程序](https://365.kdocs.cn/l/ccHVuUs0UsZs)
124
- *
125
- * - 此方法通常不需要手动调用,在需要登录的接口调用时会自动执行
126
- * - 为了提高页面执行速度,可以在设置 Token 后立即调用 autoLogin
127
- *
128
- * 🔕请求静默进行,无消息提示
129
- *
130
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=ReeJpWraRO
131
- */
132
- async autoLogin() {
133
- if (this.gamerToken)
134
- return !0;
135
- const t = h();
136
- if (!this.idToken || t && !this.weixinToken)
137
- return !1;
138
- const { code: n, data: r } = await this.req.post(
139
- "login-with-token",
140
- l({ id_token: this.idToken, weixin_token: t ? this.weixinToken : null }),
141
- he,
142
- {
143
- message: !1,
144
- cacheTTL: 300,
145
- cacheResolve: () => `${this.idToken}_${t ? this.weixinToken : "null"}`
146
- }
147
- );
148
- switch (n) {
149
- case "invalid_id_token":
150
- this.idToken = "";
151
- break;
152
- case "invalid_weixin_token":
153
- this.weixinToken = "";
154
- break;
155
- }
156
- return this.gamerToken = r?.gamer_token || "", !!this.gamerToken;
157
- }
158
- /**
159
- * 用于在多租户小程序环境中切换当前 Session game_id。
160
- *
161
- * https://www.kdocs.cn/l/cf2mO2uRLqh9?linkname=ifQTBNrckh
162
- */
163
- async switchGame(t) {
164
- const n = h();
165
- if (!this.idToken || n && !this.weixinToken)
166
- return !1;
167
- const { code: r, data: a } = await this.req.post(
168
- "session/switch-game",
169
- l({ game_id: t }),
170
- we,
171
- {
172
- message: !1,
173
- maxRetry: 2
174
- }
175
- );
176
- return r === "game_not_allowed" ? !1 : (this.gamerToken = a?.gamer_token || "", !!this.gamerToken);
177
- }
178
- /**
179
- * 获取当前登录用户的 Session 的信息
180
- *
181
- * 🔕请求静默进行,无消息提示
182
- *
183
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OdGVCdQxEu
184
- */
185
- async getSession() {
186
- if (!await this.autoLogin()) return null;
187
- const { data: t } = await this.req.get("session", null, G, {
188
- message: !1
189
- });
190
- return t;
191
- }
192
- /**
193
- * 实名认证
194
- *
195
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=kZYnwX6RcF
196
- */
197
- async authRealName(t) {
198
- if (!await this.autoLogin()) return null;
199
- const { data: n } = await this.req.post("auth-real-name", l(t), G);
200
- return n;
201
- }
29
+ //#endregion
30
+ //#region src/token.ts
31
+ var d = "gamer_token", ue = class {
32
+ _NetRequest;
33
+ _idToken = "";
34
+ _weixinToken = "";
35
+ _gamerToken = "";
36
+ req;
37
+ storage;
38
+ constructor(t, r) {
39
+ this.storage = c() ? ie : n;
40
+ let i = ce(t) ? t : `https://${o(t)}`;
41
+ if (this._NetRequest = r, this.req = r({
42
+ baseURL: `${i}/v1`,
43
+ timeout: 1e4,
44
+ maxRetry: 2,
45
+ retryInterval: "2EB",
46
+ responseRule: {
47
+ ok: { resolve: "body" },
48
+ failed: {
49
+ resolve: "json",
50
+ statusField: "error",
51
+ messageField: ["user_message", "message"]
52
+ }
53
+ },
54
+ requestTransformer: (e) => {
55
+ this._gamerToken && (e.headers.Authorization = `Bearer ${this._gamerToken}`);
56
+ }
57
+ }), te()) {
58
+ let t = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), n = s("gamer_token");
59
+ (e() || t && n) && (this._gamerToken = n);
60
+ }
61
+ this._gamerToken || this.loadGamerTokenCache();
62
+ }
63
+ get NetRequest() {
64
+ return this._NetRequest;
65
+ }
66
+ loadGamerTokenCache() {
67
+ let e = this.storage.get(d).match(/^(\d{12,})#(.{8,})$/);
68
+ if (e) {
69
+ let t = parseInt(e[1]), n = e[2];
70
+ if (t > Date.now() - (24 * 3600 - 10) * 1e3) {
71
+ this._gamerToken = n;
72
+ return;
73
+ }
74
+ }
75
+ this.storage.remove(d);
76
+ }
77
+ get isLoggedIn() {
78
+ return this._gamerToken !== "";
79
+ }
80
+ get idToken() {
81
+ return this._idToken;
82
+ }
83
+ set idToken(e) {
84
+ this._idToken !== e && (this._idToken = e, this.gamerToken = "");
85
+ }
86
+ get weixinToken() {
87
+ return this._weixinToken;
88
+ }
89
+ set weixinToken(e) {
90
+ this._weixinToken !== e && (this._weixinToken = e, this.gamerToken = "");
91
+ }
92
+ get gamerToken() {
93
+ return this._gamerToken;
94
+ }
95
+ set gamerToken(e) {
96
+ this._gamerToken = e, e ? this.storage.set(d, `${Date.now()}#${e}`) : this.storage.remove(d);
97
+ }
98
+ logout() {
99
+ this._idToken = "", this._weixinToken = "", this.gamerToken = "";
100
+ }
101
+ async autoLogin() {
102
+ if (this.gamerToken) return !0;
103
+ let e = c();
104
+ if (!this.idToken || e && !this.weixinToken) return !1;
105
+ let { code: t, data: n } = await this.req.post("login-with-token", a({
106
+ id_token: this.idToken,
107
+ weixin_token: e ? this.weixinToken : null
108
+ }), ae, {
109
+ message: !1,
110
+ cacheTTL: 300,
111
+ cacheResolve: () => `${this.idToken}_${e ? this.weixinToken : "null"}`
112
+ });
113
+ switch (t) {
114
+ case "invalid_id_token":
115
+ this.idToken = "";
116
+ break;
117
+ case "invalid_weixin_token":
118
+ this.weixinToken = "";
119
+ break;
120
+ }
121
+ return this.gamerToken = n?.gamer_token || "", !!this.gamerToken;
122
+ }
123
+ async switchGame(e) {
124
+ let t = c();
125
+ if (!this.idToken || t && !this.weixinToken) return !1;
126
+ let { code: n, data: r } = await this.req.post("session/switch-game", a({ game_id: e }), oe, {
127
+ message: !1,
128
+ maxRetry: 2
129
+ });
130
+ switch (n) {
131
+ case "game_not_allowed": return !1;
132
+ }
133
+ return this.gamerToken = r?.gamer_token || "", !!this.gamerToken;
134
+ }
135
+ async getSession() {
136
+ if (!await this.autoLogin()) return null;
137
+ let { data: e } = await this.req.get("session", null, se, { message: !1 });
138
+ return e;
139
+ }
140
+ async authRealName(e) {
141
+ if (!await this.autoLogin()) return null;
142
+ let { data: t } = await this.req.post("auth-real-name", a(e), se);
143
+ return t;
144
+ }
145
+ }, de = {
146
+ Unknown: "unknown",
147
+ Male: "male",
148
+ Female: "female"
149
+ }, fe = u.string().enum(de).lock(), pe = {
150
+ Increase: "increase",
151
+ Decrease: "decrease",
152
+ Expired: "expired"
153
+ }, me = u.string().enum(pe).lock(), he = {
154
+ Order: "order",
155
+ Consumption: "consumption",
156
+ Redeem: "redeem",
157
+ Expire: "expire",
158
+ Admin: "admin",
159
+ Event: "event"
160
+ }, ge = u.string().enum(he).lock(), _e = {
161
+ GameReward: "game_reward",
162
+ Physical: "physical",
163
+ Virtual: "virtual"
164
+ }, f = u.string().enum(_e).lock(), ve = {
165
+ Pending: "pending",
166
+ Issued: "issued",
167
+ Failed: "failed"
168
+ }, ye = u.string().enum(ve).lock(), be = u.object({
169
+ default_avatar_url: u.string(),
170
+ official_avatar_urls: u.array(u.string()),
171
+ default_nickname: u.string(),
172
+ default_bio: u.string(),
173
+ default_role_avatar_url: u.string(),
174
+ level_configs: u.array(u.object({
175
+ level: u.number(),
176
+ exp: u.number(),
177
+ title: u.string()
178
+ })),
179
+ level_valid_days: u.number(),
180
+ benefit_description: u.string(),
181
+ exp_description: u.string(),
182
+ credit_description: u.string(),
183
+ send_role_mail_rate_limit: u.number()
184
+ }).lock(), xe = u.object({
185
+ member_id: u.string(),
186
+ player_id: u.string(),
187
+ exp: u.number(),
188
+ level: u.number(),
189
+ credit: u.number(),
190
+ credit_expiring: u.number(),
191
+ level_change_time: u.number(),
192
+ level_expire_time: u.number()
193
+ }).lock(), Se = u.object({
194
+ server_id: u.string(),
195
+ server_name: u.string()
196
+ }).lock(), Ce = u.object({
197
+ role_id: u.string(),
198
+ role_name: u.string()
199
+ }).lock(), p = u.object({
200
+ ...Ce.shape,
201
+ ...Se.shape,
202
+ role_level: u.number(),
203
+ last_login_time: u.number()
204
+ }).lock(), we = u.object({
205
+ ...p.shape,
206
+ role_fighting: u.number(),
207
+ kin_id: u.string().optional(),
208
+ kin_name: u.string().optional(),
209
+ kin_position: u.string().optional()
210
+ }).lock(), Te = u.object({
211
+ name: u.string(),
212
+ avatar_url: u.string(),
213
+ bio: u.string(),
214
+ gender: fe,
215
+ birthday: u.object({
216
+ year: u.number(),
217
+ month: u.number(),
218
+ day: u.number()
219
+ }),
220
+ social_medias: u.record(u.object({
221
+ homepage_url: u.string(),
222
+ homepage_image_url: u.string()
223
+ }).optional()).optional()
224
+ }).lock(), m = u.object({
225
+ address_id: u.number(),
226
+ recipient: u.string(),
227
+ mobile: u.string(),
228
+ province: u.string(),
229
+ city: u.string(),
230
+ district: u.string(),
231
+ address: u.string(),
232
+ is_default: u.bool()
233
+ }).lock(), Ee = u.object({
234
+ increased_credit: u.number(),
235
+ decreased_credit: u.number(),
236
+ expired_credit: u.number(),
237
+ balance_credit: u.number()
238
+ }).lock(), De = u.object({
239
+ id: u.number(),
240
+ change_type: me,
241
+ change_scene: ge,
242
+ change_credit: u.number(),
243
+ balance: u.number(),
244
+ change_time: u.number(),
245
+ metadata: u.record(u.unknown()).optional()
246
+ }).lock(), h = u.object({
247
+ benefit_id: u.number(),
248
+ name: u.string(),
249
+ img_url: u.string(),
250
+ description: u.string(),
251
+ min_level: u.number(),
252
+ max_level: u.number(),
253
+ product_id: u.number(),
254
+ tag: u.string()
255
+ }).lock(), g = u.object({
256
+ product_id: u.number(),
257
+ catalog_id: u.number(),
258
+ catalog_name: u.string(),
259
+ item_type: f,
260
+ name: u.string(),
261
+ img_url: u.string(),
262
+ description: u.string(),
263
+ tag: u.string(),
264
+ price: u.number(),
265
+ stock: u.number(),
266
+ redeem_quantity: u.number(),
267
+ not_visible_before: u.number(),
268
+ not_visible_after: u.number(),
269
+ not_before: u.number(),
270
+ not_after: u.number(),
271
+ min_level: u.number(),
272
+ max_level: u.number(),
273
+ limit_daily: u.number(),
274
+ limit_monthly: u.number(),
275
+ limit_yearly: u.number(),
276
+ limit_total: u.number(),
277
+ weight: u.number(),
278
+ created_at: u.number(),
279
+ updated_at: u.number(),
280
+ redeemable_quantity: u.number().optional()
281
+ }).lock(), Oe = u.object({
282
+ ...r(h.shape, "tag"),
283
+ product: g.clone().optional()
284
+ }).lock(), ke = u.union(u.object({
285
+ server_id: u.string(),
286
+ role_id: u.string()
287
+ }), u.object({ address_id: u.number() })).satisfies().lock(), Ae = u.object({
288
+ recipient: u.string(),
289
+ mobile: u.string(),
290
+ province: u.string(),
291
+ city: u.string(),
292
+ district: u.string(),
293
+ address: u.string(),
294
+ express_company: u.string(),
295
+ express_number: u.string()
296
+ }).lock(), je = u.object({
297
+ server_id: u.string(),
298
+ role_id: u.string(),
299
+ role_name: u.string()
300
+ }).lock(), Me = u.object({
301
+ redemption_id: u.number(),
302
+ player_id: u.string(),
303
+ product_id: u.number(),
304
+ name: u.string(),
305
+ img_url: u.string(),
306
+ item_type: f,
307
+ catalog_id: u.number(),
308
+ catalog_name: u.string(),
309
+ quantity: u.number(),
310
+ amount: u.number(),
311
+ status: ye,
312
+ created_at: u.number(),
313
+ extra_data: u.union(Ae.clone(), je.clone()).satisfies().optional()
314
+ }), Ne = u.guard(be), _ = l({ player: xe }), Pe = l({ roles: u.array(p) }), v = l({ role_card: we }), y = u.guard(Te), b = u.guard(m), Fe = l({ addresses: u.array(m) }), Ie = u.guard(Ee), Le = l({
315
+ credit_logs: u.array(De),
316
+ next_token: u.string().optional()
317
+ }), Re = l({ products: u.array(g) }), ze = l({ benefits: u.array(h) }), Be = l({ benefit: Oe }), Ve = l({
318
+ redemptions: u.array(Me),
319
+ next_token: u.string().optional()
320
+ }), He = l({
321
+ existed: u.bool(),
322
+ image_upload_url: u.string().optional(),
323
+ image_id: u.string()
324
+ }), Ue = class {
325
+ token;
326
+ req;
327
+ constructor(e) {
328
+ this.token = e, this.req = e.req;
329
+ }
330
+ async getConfig(e) {
331
+ await this.token.autoLogin();
332
+ let { data: t } = await this.req.get("club/config", null, Ne, e);
333
+ return t;
334
+ }
335
+ async getCurrentPlayer(e) {
336
+ await this.token.autoLogin();
337
+ let { data: t, code: n, message: r } = await this.req.get("club/current-player", null, _, e);
338
+ return t?.player ?? {
339
+ message: r,
340
+ error: n
341
+ };
342
+ }
343
+ async linkPlayer(e) {
344
+ await this.token.autoLogin();
345
+ let { data: t, code: n, message: r } = await this.req.post("club/link-player", { id_token: this.token.idToken }, _, e);
346
+ return t?.player ?? {
347
+ message: r,
348
+ error: n
349
+ };
350
+ }
351
+ async getRoles(e, t, n) {
352
+ if (!await this.token.autoLogin()) return [];
353
+ let { data: r } = await this.req.get("club/roles", {
354
+ player_id: e,
355
+ refresh: t
356
+ }, Pe, n);
357
+ return r?.roles || [];
358
+ }
359
+ async getRoleCard(e, t) {
360
+ await this.token.autoLogin();
361
+ let { data: n } = await this.req.get("club/role-card", { member_id: e }, v, t);
362
+ return n?.role_card ?? null;
363
+ }
364
+ async setRoleCard(e, t) {
365
+ if (!await this.token.autoLogin()) return null;
366
+ let { data: n } = await this.req.post("club/role-card", e, v, t);
367
+ return n?.role_card ?? null;
368
+ }
369
+ async refreshRoleCard(e) {
370
+ if (!await this.token.autoLogin()) return null;
371
+ let { data: t } = await this.req.post("club/refresh-role-card", {}, v, e);
372
+ return t?.role_card ?? null;
373
+ }
374
+ async getUserProfile(e, t) {
375
+ await this.token.autoLogin();
376
+ let { data: n } = await this.req.get("club/user-profile", { member_id: e }, y, t);
377
+ return n;
378
+ }
379
+ async updateUserProfile(e, t) {
380
+ if (Object.keys(e).length === 0) return {
381
+ error: "OptionIsEmpty",
382
+ message: "请提供需要修改的信息"
383
+ };
384
+ await this.token.autoLogin();
385
+ let { data: n, code: r, message: i } = await this.req.post("club/user-profile", e, y, t);
386
+ return n ?? {
387
+ message: i,
388
+ error: r
389
+ };
390
+ }
391
+ async getAddresses(e) {
392
+ if (!await this.token.autoLogin()) return [];
393
+ let { data: t } = await this.req.get("club/addresses", null, Fe, e);
394
+ return t?.addresses ?? [];
395
+ }
396
+ async addAddress(e, t) {
397
+ if (!await this.token.autoLogin()) return null;
398
+ let { data: n, code: r, message: i } = await this.req.post("/club/add-address", a(e), b, t);
399
+ return n ?? {
400
+ message: i,
401
+ error: r
402
+ };
403
+ }
404
+ async updateAddress(e, t) {
405
+ await this.token.autoLogin();
406
+ let { data: n, code: r, message: i } = await this.req.post("club/update-address", a(e), b, t);
407
+ return n ?? {
408
+ message: i,
409
+ error: r
410
+ };
411
+ }
412
+ async deleteAddress(e, t) {
413
+ if (!await this.token.autoLogin()) return null;
414
+ let { ok: n } = await this.req.post("club/delete-address", { address_id: e }, null, t);
415
+ return n;
416
+ }
417
+ async getUserCredit(e, t) {
418
+ await this.token.autoLogin();
419
+ let { data: n, code: r, message: i } = await this.req.get("club/user-credit", { ...e }, Ie, t);
420
+ return n ?? {
421
+ message: i,
422
+ error: r
423
+ };
424
+ }
425
+ async getCreditLogs(e, t) {
426
+ await this.token.autoLogin();
427
+ let { data: n } = await this.req.get("club/credit-logs", {
428
+ max_results: 20,
429
+ ...e
430
+ }, Le, t);
431
+ return {
432
+ credit_logs: n?.credit_logs || [],
433
+ next_token: n?.next_token
434
+ };
435
+ }
436
+ async getBenefits(e) {
437
+ if (!await this.token.autoLogin()) return [];
438
+ let { data: t } = await this.req.get("club/benefits", null, ze, e);
439
+ return t?.benefits || [];
440
+ }
441
+ async getBenefit(e, t) {
442
+ if (!await this.token.autoLogin()) return null;
443
+ let { data: n } = await this.req.get("club/benefit", { benefit_id: e }, Be, t);
444
+ return n?.benefit || null;
445
+ }
446
+ async getProducts(e, t) {
447
+ await this.token.autoLogin();
448
+ let { data: n } = await this.req.get("club/products", e || null, Re, t);
449
+ return n?.products || [];
450
+ }
451
+ async redeemProduct(e, t) {
452
+ await this.token.autoLogin();
453
+ let { ok: n, code: r, message: i } = await this.req.post("club/redeem-product", a(e), null, t);
454
+ return n || {
455
+ message: i,
456
+ error: r
457
+ };
458
+ }
459
+ async getRedemptions(e, t) {
460
+ await this.token.autoLogin();
461
+ let { data: n } = await this.req.get("club/redemptions", {
462
+ max_results: 20,
463
+ ...e
464
+ }, Ve, t);
465
+ return {
466
+ redemptions: n?.redemptions || [],
467
+ next_token: n?.next_token
468
+ };
469
+ }
470
+ async clubUploadImage(e, t) {
471
+ await this.token.autoLogin();
472
+ let { data: n, code: r, message: i } = await this.req.post("club/image-upload-url", a(e), He, t);
473
+ return n ?? {
474
+ message: i,
475
+ error: r
476
+ };
477
+ }
478
+ }, We = class {
479
+ token;
480
+ req;
481
+ _event = 0;
482
+ get event() {
483
+ return this._event;
484
+ }
485
+ constructor(e, t) {
486
+ this._event = +t, this.token = e, this.req = e.req;
487
+ }
488
+ bind(e) {
489
+ let t = this;
490
+ for (let [n, r] of Object.entries(e)) r && (t[n] = r.bind(this));
491
+ return t;
492
+ }
493
+ }, x = {
494
+ EventItem: "event_item",
495
+ GameItem: "game_item",
496
+ PhysicalItem: "physical_item",
497
+ WeixinHongbao: "weixin_hongbao",
498
+ GiftCode: "gift_code",
499
+ ActivationKey: "activation_key",
500
+ LotteryTicket: "lottery_ticket",
501
+ ClubCredit: "club_credit",
502
+ ClubExp: "club_exp",
503
+ ExternalCode: "external_gift_code",
504
+ VoidItem: "void_item"
505
+ }, S = u.string().enum(x).lock(), Ge = x, C = S, w = {
506
+ UserId: "user_id",
507
+ RoleId: "role_id"
508
+ }, Ke = u.string().enum(w).lock(), qe = {
509
+ None: "none",
510
+ Daily: "daily",
511
+ Weekly: "weekly",
512
+ Monthly: "monthly"
513
+ }, Je = u.string().enum(qe).lock(), T = {
514
+ Preregister: "preregister",
515
+ Lottery: "lottery",
516
+ Survey: "survey",
517
+ Invite: "invite",
518
+ Share: "share",
519
+ Follow: "follow",
520
+ Subscribe: "weixin_subscribe",
521
+ Comment: "comment",
522
+ Vote: "vote",
523
+ Vote2: "vote2",
524
+ GiftCode: "gift_code",
525
+ Register: "register",
526
+ InvitedRegister: "invited_register",
527
+ ClaimRewards: "claim_rewards",
528
+ Cashback: "cashback",
529
+ Quest: "quest",
530
+ Team: "team",
531
+ LotteryDraw: "lottery_draw",
532
+ CheckIn: "check_in",
533
+ ClaimActivationKey: "claim_activation_key",
534
+ ZeroChatgpt: "zero_chatgpt",
535
+ Ugc: "ugc",
536
+ UgcLike: "ugc_like",
537
+ Redeem: "redeem"
538
+ }, Ye = u.string().enum(T).lock(), Xe = {
539
+ Active: "player_active_points",
540
+ Login: "player_login_days",
541
+ OrderAmount: "order_total_amount",
542
+ OrderCount: "order_total_count",
543
+ Posts: "community_posts",
544
+ Comments: "community_comments",
545
+ MatchCounts: "player_match_counts",
546
+ MatchDays: "player_match_days",
547
+ PlayerLevel: "player_level",
548
+ EventItems: "event_items",
549
+ GameTask: "game_task",
550
+ OrderAmountInApp: "order_in_app_total_amount",
551
+ OrderAmountInPayCenter: "order_seayoo_web_total_amount",
552
+ TeamSize: "team_size",
553
+ UserGroup: "user_group"
554
+ }, E = u.string().enum(Xe).lock(), Ze = {
555
+ System: "system",
556
+ UserSubmission: "user_submission",
557
+ Shortlisted: "shortlisted"
558
+ }, Qe = u.string().enum(Ze).lock(), D = {
559
+ Ineligible: "ineligible",
560
+ Unclaimed: "unclaimed",
561
+ Received: "received",
562
+ Failed: "failed",
563
+ Delivered: "delivered"
564
+ }, O = u.string().enum(D).lock(), $e = {
565
+ Ineligible: D.Ineligible,
566
+ Unclaimed: D.Unclaimed,
567
+ Received: D.Received,
568
+ Failed: D.Failed,
569
+ Delivered: D.Delivered
570
+ }, k = u.string().enum($e).lock(), et = {
571
+ Output: "output",
572
+ Engage: "engage"
573
+ }, A = u.string().enum(et).lock(), tt = {
574
+ Private: "private",
575
+ Public: "public"
576
+ }, nt = u.string().enum(tt).lock(), j = {
577
+ Unknown: "unknown",
578
+ Pending: "pending",
579
+ Drawn: "drawn",
580
+ Claimed: "claimed",
581
+ Fail: "fail"
582
+ }, rt = u.string().enum(j).lock(), it = {
583
+ Assemble: "assemble",
584
+ Join: "join",
585
+ Disband: "disband",
586
+ ChangeVisibility: "change_visibility",
587
+ Query: "query"
588
+ }, at = u.string().enum(it).lock(), ot = {
589
+ Query: "query",
590
+ Draw: "draw",
591
+ Claim: "claim"
592
+ }, st = u.string().enum(ot).lock(), ct = {
593
+ Sum: "sum",
594
+ TopN: "top_n"
595
+ }, lt = u.string().enum(ct).lock(), ut = {
596
+ None: "none",
597
+ Winner: "winner",
598
+ Consolation: "consolation"
599
+ }, dt = u.string().enum(ut).lock(), ft = {
600
+ Douyin: "douyin",
601
+ Xiaohongshu: "xiaohongshu",
602
+ Taptap: "taptap",
603
+ Bilibili: "bilibili",
604
+ Weibo: "weibo",
605
+ Huya: "huya",
606
+ Douyu: "douyu"
607
+ }, M = u.string().enum(ft).lock(), pt = {
608
+ Submitted: "submitted",
609
+ Accepted: "accepted",
610
+ Rejected: "rejected"
611
+ }, mt = u.string().enum(pt).lock(), ht = u.string().enum(x), N = u.object({
612
+ reward_item_id: u.number(),
613
+ reward_amount: u.number(),
614
+ reward_item_name: u.string(),
615
+ reward_item_icon_url: u.string(),
616
+ reward_item_desc: u.string().optional(),
617
+ reward_item_type: ht,
618
+ reward_item_rating: u.number()
619
+ }).lock(), gt = u.object({
620
+ engage_count: u.number(),
621
+ rewards: u.array(N)
622
+ }).lock(), _t = u.union(u.object({
623
+ feature_reward_type: u.string().enum("every"),
624
+ reward_details: u.array(N)
625
+ }), u.object({
626
+ feature_reward_type: u.string().enum("regular"),
627
+ reward_details: u.array(gt)
628
+ })).satisfies().lock(), P = u.object({
629
+ feature_name: u.string(),
630
+ feature_id: u.number(),
631
+ description: u.string(),
632
+ cycle: Je,
633
+ cycle_limit: u.number(),
634
+ limit: u.number(),
635
+ since: u.number(),
636
+ until: u.number(),
637
+ engage_account: Ke,
638
+ feature_rewards: _t.clone().optional(),
639
+ sort: u.number().optional()
640
+ }), vt = T.Cashback, yt = u.object({
641
+ ...P.shape,
642
+ feature_type: u.string().enum(vt),
643
+ config: u.object({
644
+ order_start_time: u.number(),
645
+ order_end_time: u.number(),
646
+ claim_rewards_start_time: u.number(),
647
+ claim_rewards_end_time: u.number()
648
+ })
649
+ }), bt = T.CheckIn, xt = u.object({
650
+ ...P.shape,
651
+ feature_type: u.string().enum(bt)
652
+ }), St = T.ClaimActivationKey, Ct = u.object({
653
+ ...P.shape,
654
+ feature_type: u.string().enum(St)
655
+ }), wt = T.ClaimRewards, Tt = u.object({
656
+ ...P.shape,
657
+ feature_type: u.string().enum(wt)
658
+ }), Et = T.Comment, Dt = u.object({
659
+ ...P.shape,
660
+ feature_type: u.string().enum(Et),
661
+ config: u.object({
662
+ comments: u.array(u.string()),
663
+ send_rate: u.number()
664
+ })
665
+ }), Ot = T.Follow, kt = u.object({
666
+ ...P.shape,
667
+ feature_type: u.string().enum(Ot),
668
+ config: u.object({
669
+ platform: u.string(),
670
+ platform_icon: u.string().optional(),
671
+ link: u.string().optional(),
672
+ qr_code_url: u.string().optional(),
673
+ platform_desc: u.string().optional()
674
+ })
675
+ }), At = T.GiftCode, jt = u.object({
676
+ name: u.string(),
677
+ icon_url: u.string(),
678
+ count: u.number()
679
+ }), Mt = u.object({
680
+ ...P.shape,
681
+ feature_type: u.string().enum(At),
682
+ config: u.object({
683
+ gift_items: u.array(jt),
684
+ mp_url: u.string().optional(),
685
+ mp_qrcode_url: u.string().optional()
686
+ })
687
+ }), Nt = T.Invite, Pt = u.object({
688
+ ...P.shape,
689
+ feature_type: u.string().enum(Nt),
690
+ config: u.object({ share_url: u.string() })
691
+ }), Ft = T.InvitedRegister, It = u.object({
692
+ ...P.shape,
693
+ feature_type: u.string().enum(Ft)
694
+ }), Lt = u.string().enum(r(x, "GiftCode", "LotteryTicket")), Rt = T.Lottery, zt = u.object({
695
+ reward_item_id: u.number(),
696
+ reward_item_name: u.string(),
697
+ reward_item_type: Lt,
698
+ reward_item_icon_url: u.string(),
699
+ reward_item_desc: u.string().optional(),
700
+ reward_amount: u.number(),
701
+ reward_remaining_stock: u.number(),
702
+ reward_item_rating: u.number()
703
+ }), Bt = u.object({
704
+ ...P.shape,
705
+ feature_type: u.string().enum(Rt),
706
+ config: u.object({
707
+ consume_item_id: u.number(),
708
+ consume_item_name: u.string(),
709
+ consume_item_icon_url: u.string(),
710
+ consume_item_count: u.array(u.number()),
711
+ consume_item_desc: u.string().optional(),
712
+ rewards: u.array(zt)
713
+ })
714
+ }), Vt = T.LotteryDraw, Ht = u.object({
715
+ ...P.shape,
716
+ feature_type: u.string().enum(Vt),
717
+ config: u.object({
718
+ draw_not_before: u.number(),
719
+ draw_not_after: u.number()
720
+ })
721
+ }), Ut = T.Preregister, Wt = u.object({
722
+ ...P.shape,
723
+ feature_type: u.string().enum(Ut)
724
+ }), Gt = T.Quest, Kt = u.object({
725
+ ...P.shape,
726
+ feature_type: u.string().enum(Gt),
727
+ config: u.object({
728
+ objective: E,
729
+ completion_value: u.number(),
730
+ team: u.object({
731
+ feature_id: u.number().optional(),
732
+ completion_value: u.number(),
733
+ progress_algorithm: lt.clone().optional(),
734
+ top_n: u.number().optional()
735
+ }).optional(),
736
+ config: u.object({
737
+ topic_id: u.number().optional(),
738
+ required_players: u.number().min(1).optional(),
739
+ required_matches: u.number().min(1).optional(),
740
+ event_item_id: u.number().optional()
741
+ }).optional()
742
+ })
743
+ }), qt = T.Redeem, Jt = u.object({
744
+ price: u.number(),
745
+ per_user_limit: u.number(),
746
+ item: N
747
+ }), Yt = u.object({
748
+ ...P.shape,
749
+ feature_type: u.string().enum(qt),
750
+ config: u.object({
751
+ event_item_id: u.number(),
752
+ redeem_catalog: u.array(Jt)
753
+ })
754
+ }), Xt = T.Register, Zt = u.object({
755
+ ...P.shape,
756
+ feature_type: u.string().enum(Xt)
757
+ }), Qt = T.Share, $t = u.object({
758
+ ...P.shape,
759
+ feature_type: u.string().enum(Qt),
760
+ config: u.object({
761
+ share_platform: u.string(),
762
+ jump_url: u.string().optional(),
763
+ icon_url: u.string().optional()
764
+ })
765
+ }), en = T.Subscribe, tn = u.object({
766
+ ...P.shape,
767
+ feature_type: u.string().enum(en),
768
+ config: u.object({ weixin_template_ids: u.array(u.string()) })
769
+ }), nn = T.Survey, rn = u.object({
770
+ ...P.shape,
771
+ feature_type: u.string().enum(nn),
772
+ config: u.object({
773
+ survey_id: u.string(),
774
+ survey_url: u.string()
775
+ })
776
+ }), an = T.Team, on = u.object({
777
+ ...P.shape,
778
+ feature_type: u.string().enum(an),
779
+ config: u.object({
780
+ max_members: u.number().min(1),
781
+ min_members: u.number().min(1)
782
+ })
783
+ }), sn = T.Ugc, cn = u.object({
784
+ ...P.shape,
785
+ feature_type: u.string().enum(sn),
786
+ config: u.object({
787
+ allowed_social_medias: u.array(u.string()).optional(),
788
+ acceptance_rewards: u.array(N).optional()
789
+ })
790
+ }), ln = T.UgcLike, un = u.object({
791
+ ...P.shape,
792
+ feature_type: u.string().enum(ln),
793
+ config: u.object({ ugc_feature_id: u.number() })
794
+ }), dn = T.Vote, fn = u.object({
795
+ sn: u.string(),
796
+ name: u.string(),
797
+ img_urls: u.array(u.string()).optional(),
798
+ video_urls: u.array(u.string()).optional(),
799
+ descriptions: u.array(u.string()).optional(),
800
+ jump_url: u.string(),
801
+ amount: u.number(),
802
+ finalists: u.bool(),
803
+ last_vote_time: u.number()
804
+ }), pn = u.object({
805
+ ...P.shape,
806
+ feature_type: u.string().enum(dn),
807
+ config: u.object({
808
+ vote_feature_ids: u.array(u.number()),
809
+ submission_feature_ids: u.array(u.number()),
810
+ finalists_amount: u.number(),
811
+ source: Qe,
812
+ options: u.array(fn),
813
+ rewards: u.array(N)
814
+ })
815
+ }), F = u.union(u.string().pattern("NumberString", /^\d+$/), u.number()), I = u.object({
816
+ order_total_amount: F,
817
+ cashback_total_amount: F,
818
+ game_item_count: F
819
+ }), mn = u.object({ activation_key: u.string().disallow("") }), hn = u.object({ gift_code: u.string() }), gn = u.object({
820
+ user_id: u.string(),
821
+ name: u.string().optional(),
822
+ avatar_url: u.string().optional()
823
+ }), _n = u.object({ lottery_count: u.number() }), L = u.object({
824
+ reward_id: u.number(),
825
+ reward_item_id: u.number(),
826
+ reward_source: A,
827
+ reward_item_name: u.string(),
828
+ reward_item_type: S,
829
+ reward_item_icon_url: u.string(),
830
+ reward_item_desc: u.string().optional(),
831
+ reward_item_rating: u.number(),
832
+ reward_amount: u.number(),
833
+ reward_status: k,
834
+ event_id: u.number(),
835
+ event_name: u.string(),
836
+ feature_id: u.number(),
837
+ engagement_id: u.number(),
838
+ feature_type: Ye,
839
+ receive_time: u.number(),
840
+ extra_data: u.record(u.unknown()).optional()
841
+ }), vn = u.string().enum(j.Unknown, j.Pending), yn = u.union(u.object({
842
+ ticket: u.string(),
843
+ status: vn,
844
+ created_at: u.number()
845
+ }), u.object({
846
+ ticket: u.string(),
847
+ status: u.string().enum(r(j, "Unknown", "Pending")),
848
+ created_at: u.number(),
849
+ reward: L
850
+ })).satisfies(), bn = u.object({ tickets: u.array(yn) }), xn = u.object({ platforms: u.array(u.string()) }), Sn = u.object({
851
+ role_name: u.string(),
852
+ is_leader: u.bool(),
853
+ is_myself: u.bool().optional(),
854
+ progress: u.number().optional(),
855
+ avatar_url: u.string().optional()
856
+ }).lock(), Cn = u.object({
857
+ objective: E,
858
+ progress: u.number(),
859
+ completion_value: u.number().optional(),
860
+ team: u.object({
861
+ progress: u.number(),
862
+ completion_value: u.number().optional(),
863
+ players: u.array(Sn)
864
+ }).optional()
865
+ }), wn = u.object({
866
+ progress: u.number(),
867
+ team: u.object({
868
+ progress: u.number(),
869
+ team_members: u.array(Sn).optional()
870
+ }).optional()
871
+ }), Tn = u.object({
872
+ item_id: u.number(),
873
+ item_count: u.number(),
874
+ redeem_count: u.number()
875
+ }), En = u.object({ item_stocks: u.array(u.object({
876
+ item_id: u.number(),
877
+ item_stock: u.number(),
878
+ user_limit: u.number()
879
+ })) }), Dn = u.object({ platform: u.string().optional() }), On = u.object({ weixin_openid: u.string() }), kn = u.object({ serial_number: u.number() }), An = u.object({
880
+ team_code: u.string(),
881
+ leader_name: u.string(),
882
+ total_members: u.number()
883
+ }), jn = u.object({
884
+ is_leader: u.bool(),
885
+ is_myself: u.bool().optional(),
886
+ role_name: u.string(),
887
+ server_name: u.string(),
888
+ avatar_url: u.string().optional()
889
+ }), Mn = u.object({
890
+ team_code: u.string(),
891
+ visibility: nt,
892
+ members: u.array(u.object({
893
+ is_leader: u.bool(),
894
+ role_name: u.string(),
895
+ server_name: u.string()
896
+ }))
897
+ }), Nn = u.object({
898
+ ugc_id: u.number(),
899
+ title: u.string(),
900
+ content: u.string().optional(),
901
+ image_urls: u.array(u.string()).optional(),
902
+ social_media: M.clone().optional(),
903
+ social_media_url: u.string().optional()
904
+ }), Pn = u.object({
905
+ ugcs: u.array(u.object({
906
+ ugc_id: u.number(),
907
+ event_id: u.number().optional(),
908
+ feature_id: u.number().optional(),
909
+ title: u.string(),
910
+ content: u.string().optional(),
911
+ image_urls: u.array(u.string()).optional(),
912
+ social_media: M.clone().optional(),
913
+ social_media_url: u.string().optional(),
914
+ server_id: u.number().optional(),
915
+ server_name: u.string().optional(),
916
+ role_id: u.string().optional(),
917
+ role_name: u.string().optional(),
918
+ total_likes: u.number().optional(),
919
+ created_at: u.number()
920
+ })).optional(),
921
+ next_token: u.string().optional()
922
+ }), Fn = u.object({
923
+ ugcs: u.array(u.object({
924
+ ugc_id: u.number(),
925
+ event_id: u.number().optional(),
926
+ feature_id: u.number().optional(),
927
+ feature_name: u.string().optional(),
928
+ review_status: mt,
929
+ reviewer_comment: u.string().optional(),
930
+ title: u.string(),
931
+ content: u.string().optional(),
932
+ image_urls: u.array(u.string()).optional(),
933
+ social_media: M.clone().optional(),
934
+ social_media_url: u.string().optional(),
935
+ server_id: u.number().optional(),
936
+ server_name: u.string().optional(),
937
+ role_id: u.string().optional(),
938
+ role_name: u.string().optional(),
939
+ total_likes: u.number().optional(),
940
+ created_at: u.number()
941
+ })).optional(),
942
+ next_token: u.string().optional()
943
+ }), In = u.object({ total_count: u.number() }), Ln = u.object({
944
+ existed: u.bool(),
945
+ upload_url: u.string().optional(),
946
+ image_url: u.string()
947
+ }), Rn = u.object({ ugcs: u.array(u.object({
948
+ ugc_id: u.number(),
949
+ rank: u.number(),
950
+ total_likes: u.number(),
951
+ image_urls: u.array(u.string()).optional(),
952
+ server_id: u.number().optional(),
953
+ server_name: u.string().optional(),
954
+ role_id: u.string().optional(),
955
+ role_name: u.string().optional()
956
+ })).optional() }), R = u.object({ option_sn: u.string() }), zn = u.object({
957
+ candidate_id: u.string(),
958
+ total_votes: u.number().optional(),
959
+ my_votes: u.number().optional(),
960
+ votes: u.number().optional()
961
+ }), Bn = u.object({
962
+ rewards_type: dt,
963
+ rewards: u.array(L).optional()
964
+ }), Vn = u.object({
965
+ candidate_id: u.string(),
966
+ is_winner: u.bool(),
967
+ total_votes: u.number(),
968
+ my_votes: u.number()
969
+ }), Hn = u.object({
970
+ role: u.string(),
971
+ content: u.string()
972
+ }), Un = u.object({ conversations: u.array(Hn) }), Wn = u.object({
973
+ user_id: u.string(),
974
+ name: u.string(),
975
+ avatar_url: u.string(),
976
+ comment: u.string(),
977
+ video_note: u.number(),
978
+ created_at: u.number()
979
+ }), z = u.union(xn, _n, kn, gn, Dn, R, zn, On, I, hn, Mn, Cn, bn, mn, Un, Nn, Tn, u.custom("EmptyObject", (e) => t(e) && Object.keys(e).length === 0)).satisfies().lock(), Gn = u.object({
980
+ reward_id: u.number(),
981
+ reward_item_id: u.number(),
982
+ reward_item_type: C,
983
+ reward_count: u.number(),
984
+ reward_status: O,
985
+ reward_source: A,
986
+ reward_item_name: u.string(),
987
+ reward_item_icon_url: u.string(),
988
+ reward_item_desc: u.string().optional(),
989
+ reward_item_rating: u.number(),
990
+ receive_time: u.number(),
991
+ extra_data: u.union(...z.validators, u.record(u.unknown())).satisfies().optional()
992
+ }), Kn = u.object({
993
+ reward_id: u.number(),
994
+ reward_item_id: u.number(),
995
+ reward_item_name: u.string(),
996
+ reward_item_type: C,
997
+ reward_item_icon_url: u.string(),
998
+ reward_item_desc: u.string().optional(),
999
+ reward_item_rating: u.number(),
1000
+ reward_amount: u.number(),
1001
+ reward_status: O,
1002
+ reward_source: A,
1003
+ extra_data: u.record(u.unknown()).optional()
1004
+ }), qn = u.object({
1005
+ engagement_id: u.number(),
1006
+ user_id: u.string(),
1007
+ event_id: u.number(),
1008
+ feature_id: u.number(),
1009
+ sequence: u.number(),
1010
+ data: z.clone().optional(),
1011
+ server_id: u.string().optional(),
1012
+ role_id: u.string().optional(),
1013
+ created_at: u.number(),
1014
+ rewards: u.array(Gn).optional()
1015
+ }).lock(), Jn = u.object({
1016
+ allowed: u.bool(),
1017
+ registered: u.bool()
1018
+ }), Yn = u.object({
1019
+ feature_id: u.number(),
1020
+ can_engage: u.bool(),
1021
+ has_unclaimed_rewards: u.bool(),
1022
+ final_available_count: u.number(),
1023
+ total_remaining_engagements: u.number(),
1024
+ cycle_remaining_engagements: u.number()
1025
+ }), Xn = u.object({
1026
+ engagement_id: u.number(),
1027
+ engagement: u.object({
1028
+ engagement_id: u.number(),
1029
+ sequence: u.number(),
1030
+ feature_id: u.number(),
1031
+ data: z.clone().optional()
1032
+ }).optional(),
1033
+ rewards: u.array(Kn).optional(),
1034
+ scan: u.bool().optional()
1035
+ }), Zn = u.object({
1036
+ reward_id: u.number(),
1037
+ reward_status: k
1038
+ }), Qn = T.Vote2, $n = u.object({
1039
+ candidate_id: u.string(),
1040
+ display_name: u.string(),
1041
+ images: u.array(u.string()).optional(),
1042
+ videos: u.array(u.string()).optional(),
1043
+ description: u.string().optional(),
1044
+ jump_url: u.string()
1045
+ }), er = u.object({
1046
+ ...P.shape,
1047
+ feature_type: u.string().enum(Qn),
1048
+ config: u.object({
1049
+ vote_item_id: u.number().optional(),
1050
+ candidates: u.array($n),
1051
+ vote_since: u.number(),
1052
+ vote_until: u.number(),
1053
+ rewards_since: u.number(),
1054
+ rewards_until: u.number(),
1055
+ winner_rewards: u.array(N).optional(),
1056
+ consolation_rewards: u.array(N).optional()
1057
+ })
1058
+ }), tr = T.ZeroChatgpt, nr = u.object({
1059
+ ...P.shape,
1060
+ feature_type: u.string().enum(tr)
1061
+ }), rr = u.union(yt, xt, Tt, Dt, kt, Mt, Pt, It, Bt, Ht, Wt, Kt, Zt, $t, tn, rn, on, pn, er, Ct, nr, cn, un, Yt).key("feature_type").satisfies(), ir = u.object({
1062
+ event_name: u.string(),
1063
+ rules: u.string(),
1064
+ since: u.number(),
1065
+ until: u.number(),
1066
+ visit_count: u.number().optional(),
1067
+ features: u.array(rr)
1068
+ }).lock(), ar = u.guard(ir), or = u.guard(Jn), B = l({ count: u.number() }), sr = l({ first_visit: u.bool() }), cr = l({ engagements: u.union(u.array(Wn), u.array(An)) }), lr = l({ status: u.array(Yn) }), ur = l({ engagements_counts: u.record(u.number()) }), dr = l({
1069
+ engagements: u.array(qn),
1070
+ next_token: u.string().optional()
1071
+ }), fr = u.guard(Xn), pr = l({ claimed_items: u.array(Zn) }), mr = l({ rewards: u.array(L) }), hr = l({ reward_status: k }), gr = l({
1072
+ user_rewards: u.array(L),
1073
+ next_token: u.string().optional()
1074
+ }), _r = l({ unclaimed: u.number() }), vr = l({ scene: u.string() }), yr = l({ params: u.string() }), br = l({ img: u.string() }), xr = u.guard(wn), Sr = u.guard(Bn), Cr = u.guard(u.object({ candidate_votes: u.array(Vn) })), wr = u.guard(I), Tr = u.guard(Fn), Er = u.guard(Pn), Dr = u.guard(In), Or = u.guard(Ln), kr = u.guard(Rn), Ar = u.guard(En);
1075
+ //#endregion
1076
+ //#region src/event.methods.ts
1077
+ async function jr(e, t, n) {
1078
+ let { data: r } = await this.req.get("verify-mobile-allowed", {
1079
+ game_id: e,
1080
+ mobile: t
1081
+ }, or, n);
1082
+ return r;
202
1083
  }
203
- const Re = {
204
- /** 未知 */
205
- Unknown: "unknown",
206
- /** 男 */
207
- Male: "male",
208
- /** 女 */
209
- Female: "female"
210
- }, Ce = e.string().enum(Re).lock(), Ve = {
211
- /** 积分增加 */
212
- Increase: "increase",
213
- /** 积分减少 */
214
- Decrease: "decrease",
215
- /** 积分过期 */
216
- Expired: "expired"
217
- }, je = e.string().enum(Ve).lock(), Te = {
218
- /** 游戏内购买 */
219
- Order: "order",
220
- /** 游戏内消耗 */
221
- Consumption: "consumption",
222
- /** 商城兑换 */
223
- Redeem: "redeem",
224
- /** 积分过期 */
225
- Expire: "expire",
226
- /** 管理后台调整 */
227
- Admin: "admin",
228
- /** 运营活动 */
229
- Event: "event"
230
- }, qe = e.string().enum(Te).lock(), xe = {
231
- /** 游戏内奖励 */
232
- GameReward: "game_reward",
233
- /** 实物商品 */
234
- Physical: "physical",
235
- /** 虚拟商品 */
236
- Virtual: "virtual"
237
- }, H = e.string().enum(xe).lock(), Le = {
238
- /** 待发放 */
239
- Pending: "pending",
240
- /** 已发放 */
241
- Issued: "issued",
242
- /** 发放失败 */
243
- Failed: "failed"
244
- }, Ue = e.string().enum(Le).lock(), Se = e.object({
245
- default_avatar_url: e.string(),
246
- official_avatar_urls: e.array(e.string()),
247
- default_nickname: e.string(),
248
- default_bio: e.string(),
249
- default_role_avatar_url: e.string(),
250
- level_configs: e.array(
251
- e.object({
252
- level: e.number(),
253
- exp: e.number(),
254
- title: e.string()
255
- })
256
- ),
257
- level_valid_days: e.number(),
258
- benefit_description: e.string(),
259
- exp_description: e.string(),
260
- credit_description: e.string(),
261
- send_role_mail_rate_limit: e.number()
262
- }).lock(), Pe = e.object({
263
- member_id: e.string(),
264
- player_id: e.string(),
265
- exp: e.number(),
266
- level: e.number(),
267
- credit: e.number(),
268
- credit_expiring: e.number(),
269
- level_change_time: e.number(),
270
- level_expire_time: e.number()
271
- }).lock(), Ee = e.object({
272
- server_id: e.string(),
273
- server_name: e.string()
274
- }).lock(), Fe = e.object({
275
- role_id: e.string(),
276
- role_name: e.string()
277
- }).lock(), z = e.object({
278
- ...Fe.shape,
279
- ...Ee.shape,
280
- role_level: e.number(),
281
- last_login_time: e.number()
282
- }).lock(), Ie = e.object({
283
- ...z.shape,
284
- /** 角色战力 */
285
- role_fighting: e.number(),
286
- /** 宗门 ID */
287
- kin_id: e.string().optional(),
288
- /** 宗门名称 */
289
- kin_name: e.string().optional(),
290
- /** 宗门职位 */
291
- kin_position: e.string().optional()
292
- }).lock(), De = e.object({
293
- name: e.string(),
294
- avatar_url: e.string(),
295
- bio: e.string(),
296
- gender: Ce,
297
- birthday: e.object({ year: e.number(), month: e.number(), day: e.number() }),
298
- social_medias: e.record(
299
- e.object({
300
- homepage_url: e.string(),
301
- homepage_image_url: e.string()
302
- }).optional()
303
- ).optional()
304
- }).lock(), J = e.object({
305
- address_id: e.number(),
306
- recipient: e.string(),
307
- mobile: e.string(),
308
- province: e.string(),
309
- city: e.string(),
310
- district: e.string(),
311
- address: e.string(),
312
- is_default: e.bool()
313
- }).lock(), $e = e.object({
314
- increased_credit: e.number(),
315
- decreased_credit: e.number(),
316
- expired_credit: e.number(),
317
- balance_credit: e.number()
318
- }).lock(), Ae = e.object({
319
- id: e.number(),
320
- change_type: je,
321
- change_scene: qe,
322
- change_credit: e.number(),
323
- balance: e.number(),
324
- change_time: e.number(),
325
- metadata: e.record(e.unknown()).optional()
326
- }).lock(), Z = e.object({
327
- benefit_id: e.number(),
328
- name: e.string(),
329
- img_url: e.string(),
330
- description: e.string(),
331
- min_level: e.number(),
332
- max_level: e.number(),
333
- product_id: e.number(),
334
- tag: e.string()
335
- }).lock(), X = e.object({
336
- product_id: e.number(),
337
- catalog_id: e.number(),
338
- catalog_name: e.string(),
339
- item_type: H,
340
- name: e.string(),
341
- img_url: e.string(),
342
- description: e.string(),
343
- tag: e.string(),
344
- price: e.number(),
345
- stock: e.number(),
346
- redeem_quantity: e.number(),
347
- not_visible_before: e.number(),
348
- not_visible_after: e.number(),
349
- not_before: e.number(),
350
- not_after: e.number(),
351
- min_level: e.number(),
352
- max_level: e.number(),
353
- limit_daily: e.number(),
354
- limit_monthly: e.number(),
355
- limit_yearly: e.number(),
356
- limit_total: e.number(),
357
- weight: e.number(),
358
- created_at: e.number(),
359
- updated_at: e.number(),
360
- redeemable_quantity: e.number().optional()
361
- }).lock(), Oe = e.object({
362
- ...L(Z.shape, "tag"),
363
- product: X.clone().optional()
364
- }).lock(), fo = e.union(
365
- e.object({
366
- server_id: e.string(),
367
- role_id: e.string()
368
- }),
369
- e.object({
370
- address_id: e.number()
371
- })
372
- ).satisfies().lock(), Ge = e.object({
373
- recipient: e.string(),
374
- mobile: e.string(),
375
- province: e.string(),
376
- city: e.string(),
377
- district: e.string(),
378
- address: e.string(),
379
- express_company: e.string(),
380
- express_number: e.string()
381
- }).lock(), Ne = e.object({
382
- server_id: e.string(),
383
- role_id: e.string(),
384
- role_name: e.string()
385
- }).lock(), Qe = e.object({
386
- redemption_id: e.number(),
387
- player_id: e.string(),
388
- product_id: e.number(),
389
- name: e.string(),
390
- img_url: e.string(),
391
- item_type: H,
392
- catalog_id: e.number(),
393
- catalog_name: e.string(),
394
- quantity: e.number(),
395
- amount: e.number(),
396
- status: Ue,
397
- created_at: e.number(),
398
- extra_data: e.union(Ge.clone(), Ne.clone()).satisfies().optional()
399
- }), Be = e.guard(Se), N = s({ player: Pe }), Me = s({ roles: e.array(z) }), j = s({ role_card: Ie }), Q = e.guard(De), B = e.guard(J), Ke = s({ addresses: e.array(J) }), He = e.guard($e), ze = s({
400
- credit_logs: e.array(Ae),
401
- next_token: e.string().optional()
402
- }), Je = s({ products: e.array(X) }), Ze = s({ benefits: e.array(Z) }), Xe = s({ benefit: Oe }), Ye = s({
403
- redemptions: e.array(Qe),
404
- next_token: e.string().optional()
405
- }), We = s({
406
- existed: e.bool(),
407
- image_upload_url: e.string().optional(),
408
- image_id: e.string()
409
- });
410
- class ho {
411
- token;
412
- req;
413
- constructor(t) {
414
- this.token = t, this.req = t.req;
415
- }
416
- /**
417
- * 获取俱乐部配置
418
- *
419
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
420
- */
421
- async getConfig(t) {
422
- await this.token.autoLogin();
423
- const { data: n } = await this.req.get("club/config", null, Be, t);
424
- return n;
425
- }
426
- /**
427
- * 用于游戏内嵌 Web 页面和微信小程序获取当前登录的游戏账号在俱乐部中的信息。
428
- *
429
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=hIDfaMlT7m
430
- */
431
- async getCurrentPlayer(t) {
432
- await this.token.autoLogin();
433
- const { data: n, code: r, message: a } = await this.req.get(
434
- "club/current-player",
435
- null,
436
- N,
437
- t
438
- );
439
- return n?.player ?? {
440
- message: a,
441
- error: r
442
- };
443
- }
444
- /**
445
- * 俱乐部用户关联游戏账号
446
- *
447
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=Dpb9JAKqzG
448
- */
449
- async linkPlayer(t) {
450
- await this.token.autoLogin();
451
- const { data: n, code: r, message: a } = await this.req.post(
452
- "club/link-player",
453
- { id_token: this.token.idToken },
454
- N,
455
- t
456
- );
457
- return n?.player ?? {
458
- message: a,
459
- error: r
460
- };
461
- }
462
- /**
463
- * 获取俱乐部关联的游戏账号下的角色列表
464
- *
465
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=nwu4FiGM9V
466
- */
467
- async getRoles(t, n, r) {
468
- if (!await this.token.autoLogin()) return [];
469
- const { data: a } = await this.req.get(
470
- "club/roles",
471
- { player_id: t, refresh: n },
472
- Me,
473
- r
474
- );
475
- return a?.roles || [];
476
- }
477
- /**
478
- * 获取俱乐部会员的角色卡片数据
479
- *
480
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=A1Wr7kUXnS
481
- */
482
- async getRoleCard(t, n) {
483
- await this.token.autoLogin();
484
- const { data: r } = await this.req.get("club/role-card", { member_id: t }, j, n);
485
- return r?.role_card ?? null;
486
- }
487
- /**
488
- * 设置自己的角色卡片
489
- *
490
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=XgMf6OFE5i
491
- */
492
- async setRoleCard(t, n) {
493
- if (!await this.token.autoLogin()) return null;
494
- const { data: r } = await this.req.post("club/role-card", t, j, n);
495
- return r?.role_card ?? null;
496
- }
497
- /**
498
- * 强制刷新自己的角色卡片,从游戏内获取最新数据
499
- *
500
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=RPdJquwmgv
501
- */
502
- async refreshRoleCard(t) {
503
- if (!await this.token.autoLogin()) return null;
504
- const { data: n } = await this.req.post("club/refresh-role-card", {}, j, t);
505
- return n?.role_card ?? null;
506
- }
507
- /**
508
- * 获取俱乐部用户的信息
509
- *
510
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TMWBCFcOr2
511
- */
512
- async getUserProfile(t, n) {
513
- await this.token.autoLogin();
514
- const { data: r } = await this.req.get("club/user-profile", { member_id: t }, Q, n);
515
- return r;
516
- }
517
- /**
518
- * 修改自己的俱乐部用户信息
519
- *
520
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=Qt822A57jd
521
- */
522
- async updateUserProfile(t, n) {
523
- if (Object.keys(t).length === 0)
524
- return { error: "OptionIsEmpty", message: "请提供需要修改的信息" };
525
- await this.token.autoLogin();
526
- const { data: r, code: a, message: i } = await this.req.post("club/user-profile", t, Q, n);
527
- return r ?? {
528
- message: i,
529
- error: a
530
- };
531
- }
532
- /**
533
- * 获取自己的俱乐部收货地址列表
534
- *
535
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=NowUIynMVn
536
- */
537
- async getAddresses(t) {
538
- if (!await this.token.autoLogin()) return [];
539
- const { data: n } = await this.req.get("club/addresses", null, Ke, t);
540
- return n?.addresses ?? [];
541
- }
542
- /**
543
- * 增加俱乐部收货地址
544
- *
545
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TaGIIYDRYA
546
- */
547
- async addAddress(t, n) {
548
- if (!await this.token.autoLogin()) return null;
549
- const { data: r, code: a, message: i } = await this.req.post(
550
- "/club/add-address",
551
- l(t),
552
- B,
553
- n
554
- );
555
- return r ?? {
556
- message: i,
557
- error: a
558
- };
559
- }
560
- /**
561
- * 修改自己的俱乐部收货地址
562
- *
563
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=p9FlJhHnWN
564
- */
565
- async updateAddress(t, n) {
566
- await this.token.autoLogin();
567
- const { data: r, code: a, message: i } = await this.req.post(
568
- "club/update-address",
569
- l(t),
570
- B,
571
- n
572
- );
573
- return r ?? {
574
- message: i,
575
- error: a
576
- };
577
- }
578
- /**
579
- * 删除自己的俱乐部收货地址
580
- *
581
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=MEEOBdf8rm
582
- */
583
- async deleteAddress(t, n) {
584
- if (!await this.token.autoLogin()) return null;
585
- const { ok: r } = await this.req.post("club/delete-address", { address_id: t }, null, n);
586
- return r;
587
- }
588
- /**
589
- * 获取俱乐部积分统计信息
590
- *
591
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=x4uxtGstRL
592
- */
593
- async getUserCredit(t, n) {
594
- await this.token.autoLogin();
595
- const { data: r, code: a, message: i } = await this.req.get("club/user-credit", { ...t }, He, n);
596
- return r ?? {
597
- message: i,
598
- error: a
599
- };
600
- }
601
- /**
602
- * 获取自己的俱乐部积分变动记录
603
- *
604
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=lQFgF689P8
605
- */
606
- async getCreditLogs(t, n) {
607
- await this.token.autoLogin();
608
- const { data: r } = await this.req.get(
609
- "club/credit-logs",
610
- { max_results: 20, ...t },
611
- ze,
612
- n
613
- );
614
- return {
615
- credit_logs: r?.credit_logs || [],
616
- next_token: r?.next_token
617
- };
618
- }
619
- /**
620
- * 获取自己的俱乐部权益列表
621
- *
622
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=UFSDGvqkdV
623
- */
624
- async getBenefits(t) {
625
- if (!await this.token.autoLogin()) return [];
626
- const { data: n } = await this.req.get("club/benefits", null, Ze, t);
627
- return n?.benefits || [];
628
- }
629
- /**
630
- * 获取某个权益详细信息
631
- *
632
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=XKto0MeaHF
633
- */
634
- async getBenefit(t, n) {
635
- if (!await this.token.autoLogin()) return null;
636
- const { data: r } = await this.req.get(
637
- "club/benefit",
638
- { benefit_id: t },
639
- Xe,
640
- n
641
- );
642
- return r?.benefit || null;
643
- }
644
- /**
645
- * 获取商城商品列表
646
- *
647
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=r3vC3PzfMQ
648
- */
649
- async getProducts(t, n) {
650
- await this.token.autoLogin();
651
- const { data: r } = await this.req.get("club/products", t || null, Je, n);
652
- return r?.products || [];
653
- }
654
- /**
655
- * 兑换商城商品
656
- *
657
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=LWcMVwX3OY
658
- */
659
- async redeemProduct(t, n) {
660
- await this.token.autoLogin();
661
- const { ok: r, code: a, message: i } = await this.req.post("club/redeem-product", l(t), null, n);
662
- return r || {
663
- message: i,
664
- error: a
665
- };
666
- }
667
- /**
668
- * 获取兑换记录
669
- *
670
- * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=Ml6mLgT4cM
671
- */
672
- async getRedemptions(t, n) {
673
- await this.token.autoLogin();
674
- const { data: r } = await this.req.get(
675
- "club/redemptions",
676
- { max_results: 20, ...t },
677
- Ye,
678
- n
679
- );
680
- return {
681
- redemptions: r?.redemptions || [],
682
- next_token: r?.next_token
683
- };
684
- }
685
- /**
686
- * 图片预上传地址获取,为 club 服务提供预签名上传 URL,供用户客户端上传图片资源
687
- *
688
- * https://www.kdocs.cn/l/cgp4gSBMbOf1?linkname=d4IHcCQu34
689
- */
690
- async clubUploadImage(t, n) {
691
- await this.token.autoLogin();
692
- const { data: r, code: a, message: i } = await this.req.post(
693
- "club/image-upload-url",
694
- l(t),
695
- We,
696
- n
697
- );
698
- return r ?? {
699
- message: i,
700
- error: a
701
- };
702
- }
1084
+ async function Mr(e) {
1085
+ let { data: t } = await this.req.get(`event/${this.event}/event-config`, null, ar, e);
1086
+ return t;
703
1087
  }
704
- class wo {
705
- token;
706
- req;
707
- _event = 0;
708
- get event() {
709
- return this._event;
710
- }
711
- constructor(t, n) {
712
- this._event = +n, this.token = t, this.req = t.req;
713
- }
714
- /**
715
- * 绑定指定的方法到当前实例上
716
- */
717
- bind(t) {
718
- const n = this;
719
- for (const [r, a] of Object.entries(t))
720
- a && (n[r] = a.bind(this));
721
- return n;
722
- }
1088
+ async function Nr(e, t) {
1089
+ let { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, {
1090
+ feature_id: e,
1091
+ type: "user"
1092
+ }, B, t);
1093
+ return n?.count ?? null;
723
1094
  }
724
- const v = {
725
- /** 活动道具 */
726
- EventItem: "event_item",
727
- /** 游戏内道具 */
728
- GameItem: "game_item",
729
- /** 实物 */
730
- PhysicalItem: "physical_item",
731
- /** 微信红包 */
732
- WeixinHongbao: "weixin_hongbao",
733
- /** 礼包码 */
734
- GiftCode: "gift_code",
735
- /** 激活码 */
736
- ActivationKey: "activation_key",
737
- /** 抽奖券 */
738
- LotteryTicket: "lottery_ticket",
739
- /** 俱乐部积分 */
740
- ClubCredit: "club_credit",
741
- /** 俱乐部成长值 */
742
- ClubExp: "club_exp",
743
- /** 外部兑换码 */
744
- ExternalCode: "external_gift_code",
745
- /** 空奖励 */
746
- VoidItem: "void_item"
747
- }, Y = e.string().enum(v).lock(), ko = v, W = Y, et = {
748
- /** 世游通行证 ID / Combo ID */
749
- UserId: "user_id",
750
- /** 游戏角色 ID */
751
- RoleId: "role_id"
752
- }, tt = e.string().enum(et).lock(), nt = {
753
- None: "none",
754
- Daily: "daily",
755
- Weekly: "weekly",
756
- Monthly: "monthly"
757
- }, rt = e.string().enum(nt).lock(), c = {
758
- /** 预约 */
759
- Preregister: "preregister",
760
- /** 抽奖 */
761
- Lottery: "lottery",
762
- /** 问卷 */
763
- Survey: "survey",
764
- /** 邀请 */
765
- Invite: "invite",
766
- /** 分享 */
767
- Share: "share",
768
- /** 关注社交媒体 */
769
- Follow: "follow",
770
- /** 微信小程序订阅消息 */
771
- Subscribe: "weixin_subscribe",
772
- /** 弹幕/评论 */
773
- Comment: "comment",
774
- /** 投票 */
775
- Vote: "vote",
776
- /** 投票 V2 */
777
- Vote2: "vote2",
778
- /** 礼包码 */
779
- GiftCode: "gift_code",
780
- /** 注册 */
781
- Register: "register",
782
- /** 受邀注册 */
783
- InvitedRegister: "invited_register",
784
- /** 领奖 */
785
- ClaimRewards: "claim_rewards",
786
- /** 充值返还 */
787
- Cashback: "cashback",
788
- /** 任务 */
789
- Quest: "quest",
790
- /** 组队 */
791
- Team: "team",
792
- /** 开奖 */
793
- LotteryDraw: "lottery_draw",
794
- /** 签到 */
795
- CheckIn: "check_in",
796
- /** 领取激活码 */
797
- ClaimActivationKey: "claim_activation_key",
798
- /** 不朽箴言特有的 AI 聊天 */
799
- ZeroChatgpt: "zero_chatgpt",
800
- /** 投稿 */
801
- Ugc: "ugc",
802
- /** 投稿点赞 */
803
- UgcLike: "ugc_like",
804
- /** 兑换 */
805
- Redeem: "redeem"
806
- }, ot = e.string().enum(c).lock(), at = {
807
- /** 累计游戏内活跃值 */
808
- Active: "player_active_points",
809
- /** 累计登录,单位 人天 */
810
- Login: "player_login_days",
811
- /** 累计充值金额 */
812
- OrderAmount: "order_total_amount",
813
- /** 累计充值次数 */
814
- OrderCount: "order_total_count",
815
- /** 社区发帖数量 */
816
- Posts: "community_posts",
817
- /** 社区评论数量 */
818
- Comments: "community_comments",
819
- /** 游戏对局次数 */
820
- MatchCounts: "player_match_counts",
821
- /** 游戏对局天数 */
822
- MatchDays: "player_match_days",
823
- /** 账号等级目标 */
824
- PlayerLevel: "player_level",
825
- /** 活动道具累计获取 */
826
- EventItems: "event_items",
827
- /** 游戏内任务 */
828
- GameTask: "game_task",
829
- /** 游戏内充值金额 */
830
- OrderAmountInApp: "order_in_app_total_amount",
831
- /** 支付中心充值金额 */
832
- OrderAmountInPayCenter: "order_seayoo_web_total_amount",
833
- /** 组队进度 */
834
- TeamSize: "team_size"
835
- }, ee = e.string().enum(at).lock(), it = {
836
- /** 官方上传 */
837
- System: "system",
838
- /** 用户投稿 */
839
- UserSubmission: "user_submission",
840
- /** 投票入围 */
841
- Shortlisted: "shortlisted"
842
- }, st = e.string().enum(it).lock(), p = {
843
- /** 未获得奖励 */
844
- Ineligible: "ineligible",
845
- /** 奖励未领取 */
846
- Unclaimed: "unclaimed",
847
- /** 奖励已领取 */
848
- Received: "received",
849
- /** 奖励发放失败 */
850
- Failed: "failed",
851
- /** 奖励已发货 */
852
- Delivered: "delivered"
853
- }, te = e.string().enum(p).lock(), ct = {
854
- /** 未获得奖励 */
855
- Ineligible: p.Ineligible,
856
- /** 奖励未领取 */
857
- Unclaimed: p.Unclaimed,
858
- /** 奖励已领取 */
859
- Received: p.Received,
860
- /** 奖励发放失败 */
861
- Failed: p.Failed,
862
- /** 奖励已发货 */
863
- Delivered: p.Delivered
864
- }, U = e.string().enum(ct).lock(), ut = {
865
- /** 玩法产出奖励 */
866
- Output: "output",
867
- /** 玩法参与奖励 */
868
- Engage: "engage"
869
- }, S = e.string().enum(ut).lock(), lt = {
870
- /** 私有队伍 */
871
- Private: "private",
872
- /** 公开队伍 */
873
- Public: "public"
874
- }, mt = e.string().enum(lt).lock(), w = {
875
- /** 未知状态 */
876
- Unknown: "unknown",
877
- /** 等待开奖 */
878
- Pending: "pending",
879
- /** 已开奖,待领奖 */
880
- Drawn: "drawn",
881
- /** 已领奖 */
882
- Claimed: "claimed",
883
- /** 领奖失败 */
884
- Fail: "fail"
885
- }, vo = e.string().enum(w).lock(), dt = {
886
- /** 发起组队 */
887
- Assemble: "assemble",
888
- /** 加入队伍 */
889
- Join: "join",
890
- /** 解散队伍 */
891
- Disband: "disband",
892
- /** 修改队伍可见性 */
893
- ChangeVisibility: "change_visibility",
894
- /** 查询组队信息 */
895
- Query: "query"
896
- }, Ro = e.string().enum(dt).lock(), gt = {
897
- /** 查询抽奖券 */
898
- Query: "query",
899
- /** 开奖 */
900
- Draw: "draw",
901
- /** 领奖 */
902
- Claim: "claim"
903
- }, Co = e.string().enum(gt).lock(), _t = {
904
- /** 将所有队员的进度值求和,作为队伍进度值 */
905
- Sum: "sum",
906
- /** 以进度值倒序排名第 N 的队员的进度值,作为队伍进度值。如果队伍人数不足 N,则队伍进度值为 0。N 的值来自于配置字段 top_n */
907
- TopN: "top_n"
908
- }, pt = e.string().enum(_t).lock(), bt = {
909
- /** 尚未结算 */
910
- None: "none",
911
- /** 获胜奖励 */
912
- Winner: "winner",
913
- /** 安慰奖励 */
914
- Consolation: "consolation"
915
- }, yt = e.string().enum(bt).lock(), ft = {
916
- /** 抖音 */
917
- Douyin: "douyin",
918
- /** 小红书 */
919
- Xiaohongshu: "xiaohongshu",
920
- /** Tap Tap */
921
- Taptap: "taptap",
922
- /** B站 */
923
- Bilibili: "bilibili",
924
- /** 微博 */
925
- Weibo: "weibo",
926
- /** 虎牙 */
927
- Huya: "huya",
928
- /** 斗鱼 */
929
- Douyu: "douyu"
930
- }, P = e.string().enum(ft).lock(), ht = {
931
- /** 已提交 */
932
- Submitted: "submitted",
933
- /** 已接收 */
934
- Accepted: "accepted",
935
- /** 已拒绝 */
936
- Rejected: "rejected"
937
- }, wt = e.string().enum(ht).lock(), kt = e.string().enum(v), g = e.object({
938
- reward_item_id: e.number(),
939
- reward_amount: e.number(),
940
- reward_item_name: e.string(),
941
- reward_item_icon_url: e.string(),
942
- reward_item_desc: e.string().optional(),
943
- reward_item_type: kt,
944
- reward_item_rating: e.number()
945
- }).lock(), vt = e.object({
946
- engage_count: e.number(),
947
- rewards: e.array(g)
948
- }).lock(), Rt = e.union(
949
- e.object({
950
- feature_reward_type: e.string().enum("every"),
951
- reward_details: e.array(g)
952
- }),
953
- e.object({
954
- feature_reward_type: e.string().enum("regular"),
955
- reward_details: e.array(vt)
956
- })
957
- ).satisfies().lock(), u = e.object({
958
- feature_name: e.string(),
959
- feature_id: e.number(),
960
- description: e.string(),
961
- cycle: rt,
962
- cycle_limit: e.number(),
963
- limit: e.number(),
964
- since: e.number(),
965
- until: e.number(),
966
- engage_account: tt,
967
- feature_rewards: Rt.clone().optional(),
968
- sort: e.number().optional()
969
- }), Ct = c.Cashback, Vt = e.object({
970
- ...u.shape,
971
- feature_type: e.string().enum(Ct),
972
- config: e.object({
973
- order_start_time: e.number(),
974
- order_end_time: e.number(),
975
- claim_rewards_start_time: e.number(),
976
- claim_rewards_end_time: e.number()
977
- })
978
- }), jt = c.CheckIn, Tt = e.object({
979
- ...u.shape,
980
- feature_type: e.string().enum(jt)
981
- }), qt = c.ClaimActivationKey, xt = e.object({
982
- ...u.shape,
983
- feature_type: e.string().enum(qt)
984
- }), Lt = c.ClaimRewards, Ut = e.object({
985
- ...u.shape,
986
- feature_type: e.string().enum(Lt)
987
- }), St = c.Comment, Pt = e.object({
988
- ...u.shape,
989
- feature_type: e.string().enum(St),
990
- config: e.object({
991
- comments: e.array(e.string()),
992
- send_rate: e.number()
993
- })
994
- }), Et = c.Follow, Ft = e.object({
995
- ...u.shape,
996
- feature_type: e.string().enum(Et),
997
- config: e.object({
998
- platform: e.string(),
999
- platform_icon: e.string().optional(),
1000
- link: e.string().optional(),
1001
- qr_code_url: e.string().optional(),
1002
- platform_desc: e.string().optional()
1003
- })
1004
- }), It = c.GiftCode, Dt = e.object({
1005
- name: e.string(),
1006
- icon_url: e.string(),
1007
- count: e.number()
1008
- }), $t = e.object({
1009
- ...u.shape,
1010
- feature_type: e.string().enum(It),
1011
- config: e.object({
1012
- gift_items: e.array(Dt),
1013
- mp_url: e.string().optional(),
1014
- mp_qrcode_url: e.string().optional()
1015
- })
1016
- }), At = c.Invite, Ot = e.object({
1017
- ...u.shape,
1018
- feature_type: e.string().enum(At),
1019
- config: e.object({
1020
- share_url: e.string()
1021
- })
1022
- }), Gt = c.InvitedRegister, Nt = e.object({
1023
- ...u.shape,
1024
- feature_type: e.string().enum(Gt)
1025
- }), Qt = e.string().enum(L(v, "GiftCode", "LotteryTicket")), Bt = c.Lottery, Mt = e.object({
1026
- reward_item_id: e.number(),
1027
- reward_item_name: e.string(),
1028
- reward_item_type: Qt,
1029
- reward_item_icon_url: e.string(),
1030
- reward_item_desc: e.string().optional(),
1031
- reward_amount: e.number(),
1032
- reward_remaining_stock: e.number(),
1033
- reward_item_rating: e.number()
1034
- }), Kt = e.object({
1035
- ...u.shape,
1036
- feature_type: e.string().enum(Bt),
1037
- config: e.object({
1038
- consume_item_id: e.number(),
1039
- consume_item_name: e.string(),
1040
- consume_item_icon_url: e.string(),
1041
- consume_item_count: e.array(e.number()),
1042
- consume_item_desc: e.string().optional(),
1043
- rewards: e.array(Mt)
1044
- })
1045
- }), Ht = c.LotteryDraw, zt = e.object({
1046
- ...u.shape,
1047
- feature_type: e.string().enum(Ht),
1048
- config: e.object({
1049
- draw_not_before: e.number(),
1050
- draw_not_after: e.number()
1051
- })
1052
- }), Jt = c.Preregister, Zt = e.object({
1053
- ...u.shape,
1054
- feature_type: e.string().enum(Jt)
1055
- }), Xt = c.Quest, Yt = e.object({
1056
- ...u.shape,
1057
- feature_type: e.string().enum(Xt),
1058
- config: e.object({
1059
- objective: ee,
1060
- completion_value: e.number(),
1061
- team: e.object({
1062
- feature_id: e.number().optional(),
1063
- completion_value: e.number(),
1064
- progress_algorithm: pt.clone().optional(),
1065
- top_n: e.number().optional()
1066
- }).optional(),
1067
- config: e.object({
1068
- topic_id: e.number().optional(),
1069
- required_players: e.number().min(1).optional(),
1070
- required_matches: e.number().min(1).optional(),
1071
- event_item_id: e.number().optional()
1072
- }).optional()
1073
- })
1074
- }), Wt = c.Redeem, en = e.object({
1075
- price: e.number(),
1076
- per_user_limit: e.number(),
1077
- item: g
1078
- }), tn = e.object({
1079
- ...u.shape,
1080
- feature_type: e.string().enum(Wt),
1081
- config: e.object({
1082
- event_item_id: e.number(),
1083
- redeem_catalog: e.array(en)
1084
- })
1085
- }), nn = c.Register, rn = e.object({
1086
- ...u.shape,
1087
- feature_type: e.string().enum(nn)
1088
- }), on = c.Share, an = e.object({
1089
- ...u.shape,
1090
- feature_type: e.string().enum(on),
1091
- config: e.object({
1092
- share_platform: e.string(),
1093
- jump_url: e.string().optional(),
1094
- icon_url: e.string().optional()
1095
- })
1096
- }), sn = c.Subscribe, cn = e.object({
1097
- ...u.shape,
1098
- feature_type: e.string().enum(sn),
1099
- config: e.object({
1100
- weixin_template_ids: e.array(e.string())
1101
- })
1102
- }), un = c.Survey, ln = e.object({
1103
- ...u.shape,
1104
- feature_type: e.string().enum(un),
1105
- config: e.object({
1106
- survey_id: e.string(),
1107
- survey_url: e.string()
1108
- })
1109
- }), mn = c.Team, dn = e.object({
1110
- ...u.shape,
1111
- feature_type: e.string().enum(mn),
1112
- config: e.object({
1113
- max_members: e.number().min(1),
1114
- min_members: e.number().min(1)
1115
- })
1116
- }), gn = c.Ugc, _n = e.object({
1117
- ...u.shape,
1118
- feature_type: e.string().enum(gn),
1119
- config: e.object({
1120
- allowed_social_medias: e.array(e.string()).optional(),
1121
- acceptance_rewards: e.array(g).optional()
1122
- })
1123
- }), pn = c.UgcLike, bn = e.object({
1124
- ...u.shape,
1125
- feature_type: e.string().enum(pn),
1126
- config: e.object({
1127
- ugc_feature_id: e.number()
1128
- })
1129
- }), yn = c.Vote, fn = e.object({
1130
- sn: e.string(),
1131
- name: e.string(),
1132
- img_urls: e.array(e.string()).optional(),
1133
- video_urls: e.array(e.string()).optional(),
1134
- descriptions: e.array(e.string()).optional(),
1135
- jump_url: e.string(),
1136
- amount: e.number(),
1137
- finalists: e.bool(),
1138
- last_vote_time: e.number()
1139
- }), hn = e.object({
1140
- ...u.shape,
1141
- feature_type: e.string().enum(yn),
1142
- config: e.object({
1143
- vote_feature_ids: e.array(e.number()),
1144
- submission_feature_ids: e.array(e.number()),
1145
- finalists_amount: e.number(),
1146
- source: st,
1147
- options: e.array(fn),
1148
- rewards: e.array(g)
1149
- })
1150
- }), T = e.union(e.string().pattern("NumberString", /^\d+$/), e.number()), ne = e.object({
1151
- order_total_amount: T,
1152
- cashback_total_amount: T,
1153
- game_item_count: T
1154
- }), wn = e.object({
1155
- activation_key: e.string().disallow("")
1156
- }), kn = e.object({
1157
- gift_code: e.string()
1158
- }), vn = e.object({
1159
- user_id: e.string(),
1160
- name: e.string().optional(),
1161
- avatar_url: e.string().optional()
1162
- }), Rn = e.object({
1163
- lottery_count: e.number()
1164
- }), R = e.object({
1165
- reward_id: e.number(),
1166
- reward_item_id: e.number(),
1167
- reward_source: S,
1168
- reward_item_name: e.string(),
1169
- reward_item_type: Y,
1170
- reward_item_icon_url: e.string(),
1171
- reward_item_desc: e.string().optional(),
1172
- reward_item_rating: e.number(),
1173
- reward_amount: e.number(),
1174
- reward_status: U,
1175
- event_id: e.number(),
1176
- event_name: e.string(),
1177
- feature_id: e.number(),
1178
- engagement_id: e.number(),
1179
- feature_type: ot,
1180
- receive_time: e.number(),
1181
- extra_data: e.record(e.unknown()).optional()
1182
- }), Cn = e.string().enum(w.Unknown, w.Pending), Vn = e.union(
1183
- e.object({
1184
- ticket: e.string(),
1185
- status: Cn,
1186
- created_at: e.number()
1187
- }),
1188
- e.object({
1189
- ticket: e.string(),
1190
- status: e.string().enum(L(w, "Unknown", "Pending")),
1191
- created_at: e.number(),
1192
- reward: R
1193
- })
1194
- ).satisfies(), jn = e.object({
1195
- tickets: e.array(Vn)
1196
- }), Tn = e.object({
1197
- platforms: e.array(e.string())
1198
- }), re = e.object({
1199
- role_name: e.string(),
1200
- is_leader: e.bool(),
1201
- is_myself: e.bool().optional(),
1202
- progress: e.number().optional()
1203
- }).lock(), qn = e.object({
1204
- objective: ee,
1205
- progress: e.number(),
1206
- completion_value: e.number().optional(),
1207
- team: e.object({
1208
- progress: e.number(),
1209
- completion_value: e.number().optional(),
1210
- players: e.array(re)
1211
- }).optional()
1212
- }), xn = e.object({
1213
- progress: e.number(),
1214
- team: e.object({
1215
- progress: e.number(),
1216
- team_members: e.array(re).optional()
1217
- }).optional()
1218
- }), Ln = e.object({
1219
- item_id: e.number(),
1220
- item_count: e.number(),
1221
- redeem_count: e.number()
1222
- }), Un = e.object({
1223
- item_stocks: e.array(
1224
- e.object({
1225
- item_id: e.number(),
1226
- item_stock: e.number(),
1227
- user_limit: e.number()
1228
- })
1229
- )
1230
- }), Sn = e.object({
1231
- platform: e.string().optional()
1232
- }), Pn = e.object({
1233
- weixin_openid: e.string()
1234
- }), En = e.object({
1235
- serial_number: e.number()
1236
- }), Fn = e.object({
1237
- team_code: e.string(),
1238
- leader_name: e.string(),
1239
- total_members: e.number()
1240
- }), Vo = e.object({
1241
- is_leader: e.bool(),
1242
- is_myself: e.bool().optional(),
1243
- role_name: e.string(),
1244
- server_name: e.string(),
1245
- avatar_url: e.string().optional()
1246
- }), In = e.object({
1247
- team_code: e.string(),
1248
- visibility: mt,
1249
- members: e.array(
1250
- e.object({
1251
- is_leader: e.bool(),
1252
- role_name: e.string(),
1253
- server_name: e.string()
1254
- })
1255
- )
1256
- }), Dn = e.object({
1257
- ugc_id: e.number(),
1258
- title: e.string(),
1259
- content: e.string().optional(),
1260
- image_urls: e.array(e.string()).optional(),
1261
- social_media: P.clone().optional(),
1262
- social_media_url: e.string().optional()
1263
- }), $n = e.object({
1264
- ugcs: e.array(
1265
- e.object({
1266
- ugc_id: e.number(),
1267
- event_id: e.number().optional(),
1268
- feature_id: e.number().optional(),
1269
- title: e.string(),
1270
- content: e.string().optional(),
1271
- image_urls: e.array(e.string()).optional(),
1272
- social_media: P.clone().optional(),
1273
- social_media_url: e.string().optional(),
1274
- server_id: e.number().optional(),
1275
- server_name: e.string().optional(),
1276
- role_id: e.string().optional(),
1277
- role_name: e.string().optional(),
1278
- total_likes: e.number().optional(),
1279
- created_at: e.number()
1280
- })
1281
- ).optional(),
1282
- next_token: e.string().optional()
1283
- }), An = e.object({
1284
- ugcs: e.array(
1285
- e.object({
1286
- ugc_id: e.number(),
1287
- event_id: e.number().optional(),
1288
- feature_id: e.number().optional(),
1289
- feature_name: e.string().optional(),
1290
- review_status: wt,
1291
- reviewer_comment: e.string().optional(),
1292
- title: e.string(),
1293
- content: e.string().optional(),
1294
- image_urls: e.array(e.string()).optional(),
1295
- social_media: P.clone().optional(),
1296
- social_media_url: e.string().optional(),
1297
- server_id: e.number().optional(),
1298
- server_name: e.string().optional(),
1299
- role_id: e.string().optional(),
1300
- role_name: e.string().optional(),
1301
- total_likes: e.number().optional(),
1302
- created_at: e.number()
1303
- })
1304
- ).optional(),
1305
- next_token: e.string().optional()
1306
- }), On = e.object({
1307
- total_count: e.number()
1308
- }), Gn = e.object({
1309
- existed: e.bool(),
1310
- upload_url: e.string().optional(),
1311
- image_url: e.string()
1312
- }), Nn = e.object({
1313
- ugcs: e.array(
1314
- e.object({
1315
- ugc_id: e.number(),
1316
- rank: e.number(),
1317
- total_likes: e.number(),
1318
- image_urls: e.array(e.string()).optional(),
1319
- server_id: e.number().optional(),
1320
- server_name: e.string().optional(),
1321
- role_id: e.string().optional(),
1322
- role_name: e.string().optional()
1323
- })
1324
- ).optional()
1325
- }), Qn = e.object({
1326
- option_sn: e.string()
1327
- }), Bn = e.object({
1328
- candidate_id: e.string(),
1329
- total_votes: e.number().optional(),
1330
- my_votes: e.number().optional(),
1331
- votes: e.number().optional()
1332
- }), Mn = e.object({
1333
- rewards_type: yt,
1334
- rewards: e.array(R).optional()
1335
- }), Kn = e.object({
1336
- candidate_id: e.string(),
1337
- is_winner: e.bool(),
1338
- total_votes: e.number(),
1339
- my_votes: e.number()
1340
- }), Hn = e.object({
1341
- role: e.string(),
1342
- content: e.string()
1343
- }), zn = e.object({
1344
- conversations: e.array(Hn)
1345
- }), Jn = e.object({
1346
- user_id: e.string(),
1347
- name: e.string(),
1348
- avatar_url: e.string(),
1349
- comment: e.string(),
1350
- video_note: e.number(),
1351
- created_at: e.number()
1352
- }), E = e.union(
1353
- Tn,
1354
- Rn,
1355
- En,
1356
- vn,
1357
- Sn,
1358
- Qn,
1359
- Bn,
1360
- Pn,
1361
- ne,
1362
- kn,
1363
- In,
1364
- qn,
1365
- jn,
1366
- wn,
1367
- zn,
1368
- Dn,
1369
- Ln,
1370
- e.custom(
1371
- "EmptyObject",
1372
- (o) => y(o) && Object.keys(o).length === 0
1373
- )
1374
- ).satisfies().lock(), Zn = e.object({
1375
- reward_id: e.number(),
1376
- reward_item_id: e.number(),
1377
- reward_item_type: W,
1378
- reward_count: e.number(),
1379
- reward_status: te,
1380
- reward_source: S,
1381
- reward_item_name: e.string(),
1382
- reward_item_icon_url: e.string(),
1383
- reward_item_desc: e.string().optional(),
1384
- reward_item_rating: e.number(),
1385
- receive_time: e.number(),
1386
- extra_data: e.union(...E.validators, e.record(e.unknown())).satisfies().optional()
1387
- }), Xn = e.object({
1388
- reward_id: e.number(),
1389
- reward_item_id: e.number(),
1390
- reward_item_name: e.string(),
1391
- reward_item_type: W,
1392
- reward_item_icon_url: e.string(),
1393
- reward_item_desc: e.string().optional(),
1394
- reward_item_rating: e.number(),
1395
- reward_amount: e.number(),
1396
- reward_status: te,
1397
- reward_source: S,
1398
- extra_data: e.record(e.unknown()).optional()
1399
- }), Yn = e.object({
1400
- engagement_id: e.number(),
1401
- user_id: e.string(),
1402
- event_id: e.number(),
1403
- feature_id: e.number(),
1404
- sequence: e.number(),
1405
- data: E.clone().optional(),
1406
- server_id: e.string().optional(),
1407
- role_id: e.string().optional(),
1408
- created_at: e.number(),
1409
- rewards: e.array(Zn).optional()
1410
- }).lock(), Wn = e.object({
1411
- allowed: e.bool(),
1412
- registered: e.bool()
1413
- }), er = e.object({
1414
- feature_id: e.number(),
1415
- can_engage: e.bool(),
1416
- has_unclaimed_rewards: e.bool(),
1417
- final_available_count: e.number(),
1418
- total_remaining_engagements: e.number(),
1419
- cycle_remaining_engagements: e.number()
1420
- }), tr = e.object({
1421
- engagement_id: e.number(),
1422
- engagement: e.object({
1423
- engagement_id: e.number(),
1424
- sequence: e.number(),
1425
- feature_id: e.number(),
1426
- data: E.clone().optional()
1427
- }).optional(),
1428
- rewards: e.array(Xn).optional(),
1429
- scan: e.bool().optional()
1430
- }), nr = e.object({
1431
- reward_id: e.number(),
1432
- reward_status: U
1433
- }), rr = c.Vote2, or = e.object({
1434
- candidate_id: e.string(),
1435
- display_name: e.string(),
1436
- images: e.array(e.string()).optional(),
1437
- videos: e.array(e.string()).optional(),
1438
- description: e.string().optional(),
1439
- jump_url: e.string()
1440
- }), ar = e.object({
1441
- ...u.shape,
1442
- feature_type: e.string().enum(rr),
1443
- config: e.object({
1444
- vote_item_id: e.number().optional(),
1445
- candidates: e.array(or),
1446
- vote_since: e.number(),
1447
- vote_until: e.number(),
1448
- rewards_since: e.number(),
1449
- rewards_until: e.number(),
1450
- winner_rewards: e.array(g).optional(),
1451
- consolation_rewards: e.array(g).optional()
1452
- })
1453
- }), ir = c.ZeroChatgpt, sr = e.object({
1454
- ...u.shape,
1455
- feature_type: e.string().enum(ir)
1456
- }), cr = e.union(
1457
- Vt,
1458
- Tt,
1459
- Ut,
1460
- Pt,
1461
- Ft,
1462
- $t,
1463
- Ot,
1464
- Nt,
1465
- Kt,
1466
- zt,
1467
- Zt,
1468
- Yt,
1469
- rn,
1470
- an,
1471
- cn,
1472
- ln,
1473
- dn,
1474
- hn,
1475
- ar,
1476
- xt,
1477
- sr,
1478
- _n,
1479
- bn,
1480
- tn
1481
- ).key("feature_type").satisfies(), ur = e.object({
1482
- event_name: e.string(),
1483
- rules: e.string(),
1484
- since: e.number(),
1485
- until: e.number(),
1486
- visit_count: e.number().optional(),
1487
- features: e.array(cr)
1488
- }).lock(), lr = e.guard(ur), mr = e.guard(Wn), F = s({ count: e.number() }), dr = s({ first_visit: e.bool() }), gr = s({
1489
- engagements: e.union(e.array(Jn), e.array(Fn))
1490
- }), _r = s({
1491
- status: e.array(er)
1492
- }), pr = s({
1493
- engagements_counts: e.record(e.number())
1494
- }), br = s({
1495
- engagements: e.array(Yn),
1496
- next_token: e.string().optional()
1497
- }), yr = e.guard(tr), fr = s({
1498
- claimed_items: e.array(nr)
1499
- }), hr = s({
1500
- rewards: e.array(R)
1501
- }), wr = s({
1502
- reward_status: U
1503
- }), kr = s({
1504
- user_rewards: e.array(R),
1505
- next_token: e.string().optional()
1506
- }), vr = s({
1507
- unclaimed: e.number()
1508
- }), Rr = s({
1509
- scene: e.string()
1510
- }), Cr = s({
1511
- params: e.string()
1512
- }), Vr = s({
1513
- img: e.string()
1514
- }), jr = e.guard(xn), Tr = e.guard(Mn), qr = e.guard(
1515
- e.object({
1516
- candidate_votes: e.array(Kn)
1517
- })
1518
- ), xr = e.guard(ne), oe = e.guard(An), Lr = e.guard($n), Ur = e.guard(On), Sr = e.guard(Gn), Pr = e.guard(Nn), Er = e.guard(Un);
1519
- async function jo(o, t, n) {
1520
- const { data: r } = await this.req.get(
1521
- "verify-mobile-allowed",
1522
- { game_id: o, mobile: t },
1523
- mr,
1524
- n
1525
- );
1526
- return r;
1095
+ async function Pr(e, t) {
1096
+ let { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, {
1097
+ feature_id: e,
1098
+ type: "engagement"
1099
+ }, B, t);
1100
+ return n?.count ?? null;
1527
1101
  }
1528
- async function To(o) {
1529
- const { data: t } = await this.req.get(`event/${this.event}/event-config`, null, lr, o);
1530
- return t;
1102
+ async function Fr(e, t) {
1103
+ let { data: n } = await this.req.get(`event/${this.event}/feature-engagements`, { feature_id: e }, cr, t);
1104
+ return n?.engagements || [];
1531
1105
  }
1532
- async function qo(o, t) {
1533
- const { data: n } = await this.req.get(
1534
- `event/${this.event}/feature-engagement-count`,
1535
- { feature_id: o, type: "user" },
1536
- F,
1537
- t
1538
- );
1539
- return n?.count ?? null;
1106
+ async function Ir(e, t) {
1107
+ await this.token.autoLogin();
1108
+ let { data: n, code: r, message: i } = await this.req.post(`event/${this.event}/visit`, a(e || {}), sr, t);
1109
+ return n ?? {
1110
+ message: i,
1111
+ error: r
1112
+ };
1540
1113
  }
1541
- async function xo(o, t) {
1542
- const { data: n } = await this.req.get(
1543
- `event/${this.event}/feature-engagement-count`,
1544
- { feature_id: o, type: "engagement" },
1545
- F,
1546
- t
1547
- );
1548
- return n?.count ?? null;
1114
+ async function Lr(e, t) {
1115
+ if (!await this.token.autoLogin()) return [];
1116
+ let { data: n } = await this.req.get("event/user-feature-status", {
1117
+ ...e,
1118
+ event_id: this.event
1119
+ }, lr, {
1120
+ ...t,
1121
+ message: !1
1122
+ });
1123
+ return n?.status || [];
1549
1124
  }
1550
- async function Lo(o, t) {
1551
- const { data: n } = await this.req.get(
1552
- `event/${this.event}/feature-engagements`,
1553
- { feature_id: o },
1554
- gr,
1555
- t
1556
- );
1557
- return n?.engagements || [];
1125
+ async function Rr(e, t) {
1126
+ if (!await this.token.autoLogin()) return {};
1127
+ let { data: n } = await this.req.get("event/user-engagements-count", {
1128
+ ...t,
1129
+ event_id: this.event,
1130
+ feature_id: e
1131
+ }, ur, { message: !1 });
1132
+ return n?.engagements_counts || {};
1558
1133
  }
1559
- async function Uo(o, t) {
1560
- await this.token.autoLogin();
1561
- const { data: n, code: r, message: a } = await this.req.post(
1562
- `event/${this.event}/visit`,
1563
- l(o || {}),
1564
- dr,
1565
- t
1566
- );
1567
- return n ?? {
1568
- message: a,
1569
- error: r
1570
- };
1134
+ async function zr(e, t, n) {
1135
+ if (!await this.token.autoLogin()) return {
1136
+ engagements: [],
1137
+ next_token: ""
1138
+ };
1139
+ let { data: r } = await this.req.get("event/user-engagements", {
1140
+ max_results: 20,
1141
+ ...t,
1142
+ event_id: this.event,
1143
+ feature_id: e
1144
+ }, dr, n);
1145
+ return {
1146
+ engagements: r?.engagements || [],
1147
+ next_token: r?.next_token || ""
1148
+ };
1571
1149
  }
1572
- async function So(o, t) {
1573
- if (!await this.token.autoLogin()) return [];
1574
- const { data: n } = await this.req.get(
1575
- "event/user-feature-status",
1576
- { ...o, event_id: this.event },
1577
- _r,
1578
- {
1579
- ...t,
1580
- message: !1
1581
- }
1582
- );
1583
- return n?.status || [];
1150
+ async function Br(e, t, n, r) {
1151
+ await this.token.autoLogin();
1152
+ let { data: i, code: o, message: s } = await this.req.post(`event/${this.event}/engage`, a({
1153
+ feature_id: e,
1154
+ engagement: t,
1155
+ ...n
1156
+ }), fr, r);
1157
+ return i ?? {
1158
+ message: s,
1159
+ error: o
1160
+ };
1584
1161
  }
1585
- async function Po(o, t) {
1586
- if (!await this.token.autoLogin()) return {};
1587
- const { data: n } = await this.req.get(
1588
- "event/user-engagements-count",
1589
- { ...t, event_id: this.event, feature_id: o },
1590
- pr,
1591
- { message: !1 }
1592
- );
1593
- return n?.engagements_counts || {};
1162
+ async function Vr(e, t) {
1163
+ await this.token.autoLogin();
1164
+ let { data: n, code: r, message: i } = await this.req.post("event/claim-rewards", a({
1165
+ ...e,
1166
+ server_id: e.server_id ? +e.server_id : void 0
1167
+ }), pr, t);
1168
+ return n?.claimed_items || {
1169
+ message: i,
1170
+ error: r
1171
+ };
1594
1172
  }
1595
- async function Eo(o, t, n) {
1596
- if (!await this.token.autoLogin())
1597
- return {
1598
- engagements: [],
1599
- next_token: ""
1600
- };
1601
- const { data: r } = await this.req.get(
1602
- "event/user-engagements",
1603
- {
1604
- max_results: 20,
1605
- ...t,
1606
- event_id: this.event,
1607
- feature_id: o
1608
- },
1609
- br,
1610
- n
1611
- );
1612
- return {
1613
- engagements: r?.engagements || [],
1614
- next_token: r?.next_token || ""
1615
- };
1173
+ async function Hr(e, t) {
1174
+ if (!await this.token.autoLogin()) return null;
1175
+ let { ok: n, code: r, message: i } = await this.req.post(`event/${this.event}/user-reward-address`, e, null, t);
1176
+ return n || {
1177
+ message: i,
1178
+ error: r
1179
+ };
1616
1180
  }
1617
- async function Fo(o, t, n, r) {
1618
- await this.token.autoLogin();
1619
- const { data: a, code: i, message: d } = await this.req.post(
1620
- `event/${this.event}/engage`,
1621
- l({
1622
- feature_id: o,
1623
- engagement: t,
1624
- ...n
1625
- }),
1626
- yr,
1627
- r
1628
- );
1629
- return a ?? {
1630
- message: d,
1631
- error: i
1632
- };
1181
+ async function Ur(e, t) {
1182
+ if (!await this.token.autoLogin()) return null;
1183
+ let { data: n } = await this.req.get("event/unlimit-qrcode-scene", { params: e }, vr, t);
1184
+ return n?.scene ?? null;
1633
1185
  }
1634
- async function Io(o, t) {
1635
- await this.token.autoLogin();
1636
- const { data: n, code: r, message: a } = await this.req.post(
1637
- "event/claim-rewards",
1638
- l({
1639
- ...o,
1640
- server_id: o.server_id ? +o.server_id : void 0
1641
- }),
1642
- fr,
1643
- t
1644
- );
1645
- return n?.claimed_items || {
1646
- message: a,
1647
- error: r
1648
- };
1186
+ async function Wr(e, t) {
1187
+ let { data: n } = await this.req.get("event/params-by-qrcode-scene", { scene: e }, yr, t);
1188
+ return n?.params ?? null;
1649
1189
  }
1650
- async function Do(o, t) {
1651
- if (!await this.token.autoLogin()) return null;
1652
- const { ok: n, code: r, message: a } = await this.req.post(
1653
- `event/${this.event}/user-reward-address`,
1654
- o,
1655
- null,
1656
- t
1657
- );
1658
- return n || {
1659
- message: a,
1660
- error: r
1661
- };
1190
+ async function Gr(e, t) {
1191
+ if (!await this.token.autoLogin()) return null;
1192
+ let { data: n } = await this.req.post("event/unlimit-qrcode", a(e), br, t);
1193
+ return n?.img ?? null;
1662
1194
  }
1663
- async function $o(o, t) {
1664
- if (!await this.token.autoLogin()) return null;
1665
- const { data: n } = await this.req.get(
1666
- "event/unlimit-qrcode-scene",
1667
- { params: o },
1668
- Rr,
1669
- t
1670
- );
1671
- return n?.scene ?? null;
1195
+ async function Kr(e, t) {
1196
+ if (!await this.token.autoLogin()) return null;
1197
+ let { data: n, code: r, message: i } = await this.req.get(`event/${this.event}/quest-progress`, { feature_id: e }, xr, {
1198
+ message: !1,
1199
+ ...t
1200
+ });
1201
+ return n || {
1202
+ message: i,
1203
+ error: r
1204
+ };
1672
1205
  }
1673
- async function Ao(o, t) {
1674
- const { data: n } = await this.req.get(
1675
- "event/params-by-qrcode-scene",
1676
- { scene: o },
1677
- Cr,
1678
- t
1679
- );
1680
- return n?.params ?? null;
1206
+ async function qr(e, t) {
1207
+ if (!await this.token.autoLogin()) return null;
1208
+ let { data: n, code: r, message: i } = await this.req.post("event/vote2/rewards", {
1209
+ feature_id: e,
1210
+ event_id: this.event
1211
+ }, Sr, t);
1212
+ return n || {
1213
+ message: i,
1214
+ code: r
1215
+ };
1681
1216
  }
1682
- async function Oo(o, t) {
1683
- if (!await this.token.autoLogin()) return null;
1684
- const { data: n } = await this.req.post(
1685
- "event/unlimit-qrcode",
1686
- l(o),
1687
- Vr,
1688
- t
1689
- );
1690
- return n?.img ?? null;
1217
+ async function Jr(e, t) {
1218
+ if (!await this.token.autoLogin()) return [];
1219
+ let { data: n } = await this.req.get("event/vote2/leaderboard", {
1220
+ feature_id: e,
1221
+ event_id: this.event
1222
+ }, Cr, t);
1223
+ return n?.candidate_votes || [];
1691
1224
  }
1692
- async function Go(o, t) {
1693
- if (!await this.token.autoLogin()) return null;
1694
- const { data: n, code: r, message: a } = await this.req.get(
1695
- `event/${this.event}/quest-progress`,
1696
- { feature_id: o },
1697
- jr,
1698
- { message: !1, ...t }
1699
- );
1700
- return n || {
1701
- message: a,
1702
- error: r
1703
- };
1225
+ async function Yr(e, t) {
1226
+ if (!await this.token.autoLogin()) return null;
1227
+ let { data: n, code: r, message: i } = await this.req.get("event/cashback/query", {
1228
+ feature_id: e,
1229
+ event_id: this.event
1230
+ }, wr, t);
1231
+ return n || {
1232
+ message: i,
1233
+ error: r
1234
+ };
1704
1235
  }
1705
- async function No(o, t) {
1706
- if (!await this.token.autoLogin()) return null;
1707
- const { data: n, code: r, message: a } = await this.req.post(
1708
- "event/vote2/rewards",
1709
- { feature_id: o, event_id: this.event },
1710
- Tr,
1711
- t
1712
- );
1713
- return n || {
1714
- message: a,
1715
- code: r
1716
- };
1236
+ async function Xr(e, t) {
1237
+ if (!await this.token.autoLogin()) return null;
1238
+ let { data: n, code: r, message: i } = await this.req.get("event/ugc/my", {
1239
+ max_results: 20,
1240
+ ...e
1241
+ }, Tr, t);
1242
+ return n || {
1243
+ message: i,
1244
+ error: r
1245
+ };
1717
1246
  }
1718
- async function Qo(o, t) {
1719
- if (!await this.token.autoLogin()) return [];
1720
- const { data: n } = await this.req.get(
1721
- "event/vote2/leaderboard",
1722
- { feature_id: o, event_id: this.event },
1723
- qr,
1724
- t
1725
- );
1726
- return n?.candidate_votes || [];
1247
+ async function Zr(e, t) {
1248
+ if (!await this.token.autoLogin()) return null;
1249
+ let { data: n, code: r, message: i } = await this.req.get("event/ugc/my-count", { ...e }, Dr, t);
1250
+ return n || {
1251
+ message: i,
1252
+ error: r
1253
+ };
1727
1254
  }
1728
- async function Bo(o, t) {
1729
- if (!await this.token.autoLogin()) return null;
1730
- const { data: n, code: r, message: a } = await this.req.get(
1731
- "event/cashback/query",
1732
- { feature_id: o, event_id: this.event },
1733
- xr,
1734
- t
1735
- );
1736
- return n || {
1737
- message: a,
1738
- error: r
1739
- };
1255
+ async function Qr(e, t) {
1256
+ await this.token.autoLogin();
1257
+ let { data: n, code: r, message: i } = await this.req.post("event/claim-rewards-v2", a({
1258
+ ...e,
1259
+ server_id: e.server_id ? +e.server_id : void 0
1260
+ }), mr, t);
1261
+ return n?.rewards || {
1262
+ message: i,
1263
+ error: r
1264
+ };
1740
1265
  }
1741
- async function Mo(o, t) {
1742
- if (!await this.token.autoLogin()) return null;
1743
- const { data: n, code: r, message: a } = await this.req.get(
1744
- "event/ugc/my",
1745
- { max_results: 20, ...o },
1746
- oe,
1747
- t
1748
- );
1749
- return n || {
1750
- message: a,
1751
- error: r
1752
- };
1266
+ async function $r(e, t) {
1267
+ await this.token.autoLogin();
1268
+ let { data: n, code: r, message: i } = await this.req.post("event/claim-weixin-hongbao", { reward_id: e }, hr, t);
1269
+ return n || {
1270
+ message: i,
1271
+ error: r
1272
+ };
1753
1273
  }
1754
- async function Ko(o, t) {
1755
- if (!await this.token.autoLogin()) return null;
1756
- const { data: n, code: r, message: a } = await this.req.get(
1757
- "event/ugc/my-count",
1758
- { ...o },
1759
- Ur,
1760
- t
1761
- );
1762
- return n || {
1763
- message: a,
1764
- error: r
1765
- };
1274
+ async function ei(e, t) {
1275
+ if (!this.token.isLoggedIn) return { error: "not_logged_in" };
1276
+ let { ok: n, code: r, message: i } = await this.req.post("verify-activation-key", { activation_key: e }, null, {
1277
+ message: !1,
1278
+ ...t
1279
+ });
1280
+ return n || {
1281
+ message: i,
1282
+ error: r
1283
+ };
1766
1284
  }
1767
- async function Ho(o, t) {
1768
- await this.token.autoLogin();
1769
- const { data: n, code: r, message: a } = await this.req.post(
1770
- "event/claim-rewards-v2",
1771
- l({
1772
- ...o,
1773
- server_id: o.server_id ? +o.server_id : void 0
1774
- }),
1775
- hr,
1776
- t
1777
- );
1778
- return n?.rewards || {
1779
- message: a,
1780
- error: r
1781
- };
1285
+ async function ti(e, t) {
1286
+ if (!await this.token.autoLogin()) return {
1287
+ user_rewards: [],
1288
+ next_token: ""
1289
+ };
1290
+ let { data: n } = await this.req.post("event/user-rewards", a({
1291
+ max_results: 20,
1292
+ ...e,
1293
+ event_id: this.event
1294
+ }), gr, t);
1295
+ return {
1296
+ user_rewards: n?.user_rewards || [],
1297
+ next_token: n?.next_token || ""
1298
+ };
1782
1299
  }
1783
- async function zo(o, t) {
1784
- await this.token.autoLogin();
1785
- const { data: n, code: r, message: a } = await this.req.post(
1786
- "event/claim-weixin-hongbao",
1787
- { reward_id: o },
1788
- wr,
1789
- t
1790
- );
1791
- return n || {
1792
- message: a,
1793
- error: r
1794
- };
1300
+ async function ni(e, t) {
1301
+ if (!await this.token.autoLogin()) return { unclaimed: 0 };
1302
+ let { data: n } = await this.req.get("event/user-rewards-count", { ...e }, _r, t);
1303
+ return { unclaimed: n?.unclaimed || 0 };
1795
1304
  }
1796
- async function Jo(o, t) {
1797
- if (!this.token.isLoggedIn)
1798
- return { error: "not_logged_in" };
1799
- const { ok: n, code: r, message: a } = await this.req.post("verify-activation-key", { activation_key: o }, null, {
1800
- message: !1,
1801
- ...t
1802
- });
1803
- return n || {
1804
- message: a,
1805
- error: r
1806
- };
1305
+ async function ri(e, t) {
1306
+ if (!await this.token.autoLogin()) return null;
1307
+ let { data: n } = await this.req.get(`event/${this.event}/user-item-count`, { item_id: e }, B, t);
1308
+ return n?.count ?? null;
1807
1309
  }
1808
- async function Zo(o, t) {
1809
- if (!await this.token.autoLogin())
1810
- return {
1811
- user_rewards: [],
1812
- next_token: ""
1813
- };
1814
- const { data: n } = await this.req.post(
1815
- "event/user-rewards",
1816
- l({ max_results: 20, ...o, event_id: this.event }),
1817
- kr,
1818
- t
1819
- );
1820
- return {
1821
- user_rewards: n?.user_rewards || [],
1822
- next_token: n?.next_token || ""
1823
- };
1310
+ async function ii(e, t, n) {
1311
+ if (!await this.token.autoLogin()) return null;
1312
+ let { data: r, code: i, message: a } = await this.req.post("event/ugc/upload-image", {
1313
+ feature_id: e,
1314
+ ...t,
1315
+ event_id: this.event
1316
+ }, Or, n);
1317
+ return r || {
1318
+ message: a,
1319
+ error: i
1320
+ };
1824
1321
  }
1825
- async function Xo(o, t) {
1826
- if (!await this.token.autoLogin())
1827
- return {
1828
- unclaimed: 0
1829
- };
1830
- const { data: n } = await this.req.get(
1831
- "event/user-rewards-count",
1832
- { ...o },
1833
- vr,
1834
- t
1835
- );
1836
- return {
1837
- unclaimed: n?.unclaimed || 0
1838
- };
1322
+ async function ai(e, t) {
1323
+ let { data: n, code: r, message: i } = await this.req.get("event/ugc/recommendation", {
1324
+ feature_id: e,
1325
+ event_id: this.event
1326
+ }, Tr, t);
1327
+ return n || {
1328
+ message: i,
1329
+ error: r
1330
+ };
1839
1331
  }
1840
- async function Yo(o, t) {
1841
- if (!await this.token.autoLogin()) return null;
1842
- const { data: n } = await this.req.get(
1843
- `event/${this.event}/user-item-count`,
1844
- { item_id: o },
1845
- F,
1846
- t
1847
- );
1848
- return n?.count ?? null;
1332
+ async function oi(e, t, n) {
1333
+ let { data: r, code: i, message: a } = await this.req.get("event/ugc/ugcs", {
1334
+ event_id: this.event,
1335
+ feature_id: e,
1336
+ max_results: 20,
1337
+ ...t
1338
+ }, Er, n);
1339
+ return r || {
1340
+ message: a,
1341
+ error: i
1342
+ };
1849
1343
  }
1850
- async function Wo(o, t, n) {
1851
- if (!await this.token.autoLogin()) return null;
1852
- const { data: r, code: a, message: i } = await this.req.post(
1853
- "event/ugc/upload-image",
1854
- { feature_id: o, ...t, event_id: this.event },
1855
- Sr,
1856
- n
1857
- );
1858
- return r || {
1859
- message: i,
1860
- error: a
1861
- };
1344
+ async function si(e, t) {
1345
+ if (!await this.token.autoLogin()) return null;
1346
+ let { data: n, code: r, message: i } = await this.req.get("event/ugc/leaderboard", {
1347
+ feature_id: e,
1348
+ event_id: this.event
1349
+ }, kr, t);
1350
+ return n || {
1351
+ message: i,
1352
+ error: r
1353
+ };
1862
1354
  }
1863
- async function ea(o, t) {
1864
- const { data: n, code: r, message: a } = await this.req.get(
1865
- "event/ugc/recommendation",
1866
- {
1867
- feature_id: o,
1868
- event_id: this.event
1869
- },
1870
- oe,
1871
- t
1872
- );
1873
- return n || {
1874
- message: a,
1875
- error: r
1876
- };
1355
+ async function ci(e, t) {
1356
+ if (!await this.token.autoLogin()) return null;
1357
+ let { data: n, code: r, message: i } = await this.req.get("event/redeem/item-stocks", {
1358
+ event_id: this.event,
1359
+ feature_id: e
1360
+ }, Ar, t);
1361
+ return n || {
1362
+ message: i,
1363
+ error: r
1364
+ };
1877
1365
  }
1878
- async function ta(o, t, n) {
1879
- const { data: r, code: a, message: i } = await this.req.get(
1880
- "event/ugc/ugcs",
1881
- {
1882
- event_id: this.event,
1883
- feature_id: o,
1884
- max_results: 20,
1885
- ...t
1886
- },
1887
- Lr,
1888
- n
1889
- );
1890
- return r || {
1891
- message: i,
1892
- error: a
1893
- };
1366
+ //#endregion
1367
+ //#region src/community.enums.ts
1368
+ var li = {
1369
+ All: "all",
1370
+ Limit: "limit"
1371
+ }, ui = u.string().enum(li).lock(), di = {
1372
+ Pending: "pending",
1373
+ Approved: "approved",
1374
+ Failed: "failed",
1375
+ Suspect: "suspect"
1376
+ }, V = u.string().enum(di).lock(), fi = {
1377
+ System: "system",
1378
+ Comment: "comment",
1379
+ Like: "like"
1380
+ }, pi = u.string().enum(fi).lock(), H = {
1381
+ System: "system",
1382
+ PostPinned: "post_pinned",
1383
+ PostHighlighted: "post_highlighted",
1384
+ PostDeleted: "post_deleted",
1385
+ PostCommented: "post_commented",
1386
+ PostLiked: "post_liked",
1387
+ CommentReplied: "comment_replied",
1388
+ CommentLiked: "comment_liked",
1389
+ CommentDeleted: "comment_deleted",
1390
+ ReplyReplied: "reply_replied",
1391
+ ReplyLiked: "reply_liked",
1392
+ ReplyDeleted: "reply_deleted"
1393
+ }, mi = u.string().enum(H).lock(), U = u.object({
1394
+ forum_id: u.number(),
1395
+ icon_url: u.string(),
1396
+ name: u.string(),
1397
+ tags: u.array(u.string()),
1398
+ sort: u.number(),
1399
+ mode: ui,
1400
+ member_ids: u.array(u.number())
1401
+ }).lock(), W = u.object({
1402
+ topic_id: u.number(),
1403
+ cover_url: u.string(),
1404
+ name: u.string(),
1405
+ description: u.string(),
1406
+ tags: u.array(u.string()),
1407
+ post_num: u.number()
1408
+ }).lock(), G = u.object({
1409
+ post_id: u.number(),
1410
+ forum: U,
1411
+ posted_by: u.string(),
1412
+ nickname: u.string(),
1413
+ avatar_url: u.string(),
1414
+ title: u.string().optional(),
1415
+ content: u.string(),
1416
+ content_text_count: u.number(),
1417
+ summary: u.string(),
1418
+ like_num: u.number(),
1419
+ comments_num: u.number(),
1420
+ liked: u.bool(),
1421
+ image_urls: u.array(u.string()),
1422
+ topics: u.array(W),
1423
+ event_ids: u.array(u.number()),
1424
+ is_pinned: u.bool(),
1425
+ is_highlighted: u.bool(),
1426
+ status: V,
1427
+ create_time: u.number()
1428
+ }).lock(), K = u.object({ err_msg: u.string().optional() }).optional().lock(), hi = u.object({
1429
+ reply_id: u.number(),
1430
+ reply_content: u.string().optional(),
1431
+ replied_by: u.string(),
1432
+ nickname: u.string(),
1433
+ avatar_url: u.string()
1434
+ }).lock(), q = u.object({
1435
+ reply_id: u.number(),
1436
+ comment_id: u.number(),
1437
+ comment_content: u.string().optional(),
1438
+ commented_by: u.string().optional(),
1439
+ commented_by_nickname: u.string().optional(),
1440
+ commented_by_avatar_url: u.string().optional(),
1441
+ replied_by: u.string(),
1442
+ nickname: u.string(),
1443
+ avatar_url: u.string(),
1444
+ content: u.string(),
1445
+ like_num: u.number(),
1446
+ liked: u.bool(),
1447
+ reply_to: hi,
1448
+ create_time: u.number()
1449
+ }).lock(), J = u.object({
1450
+ comment_id: u.number(),
1451
+ post_id: u.number(),
1452
+ post_subject: u.string().optional(),
1453
+ post_summary: u.string().optional(),
1454
+ post_image_url: u.string().optional(),
1455
+ posted_by: u.string().optional(),
1456
+ posted_by_nickname: u.string().optional(),
1457
+ posted_by_avatar_url: u.string().optional(),
1458
+ commented_by: u.string(),
1459
+ nickname: u.string(),
1460
+ avatar_url: u.string(),
1461
+ content: u.string(),
1462
+ like_num: u.number(),
1463
+ reply_num: u.number(),
1464
+ liked: u.bool(),
1465
+ image_url: u.string(),
1466
+ create_time: u.number(),
1467
+ status: V,
1468
+ replies: u.array(q).optional()
1469
+ }).lock(), gi = u.object({
1470
+ image_url: u.string(),
1471
+ upload_url: u.string(),
1472
+ existed: u.bool()
1473
+ }).lock(), Y = u.object({
1474
+ notification_id: u.string(),
1475
+ notification_type: mi,
1476
+ is_read: u.bool(),
1477
+ create_time: u.number(),
1478
+ origin_user_id: u.string(),
1479
+ origin_user_name: u.string(),
1480
+ origin_user_avatar_url: u.string()
1481
+ }).lock(), _i = u.object({
1482
+ system_message_subject: u.string(),
1483
+ system_message_content: u.string()
1484
+ }).lock(), X = u.object({
1485
+ post_id: u.number(),
1486
+ post_subject: u.string(),
1487
+ post_summary: u.string(),
1488
+ post_image_url: u.string()
1489
+ }).lock(), Z = u.object({
1490
+ comment_id: u.number(),
1491
+ comment_content: u.string()
1492
+ }).lock(), Q = u.object({
1493
+ reply_id: u.number(),
1494
+ reply_content: u.string()
1495
+ }).lock(), vi = u.object({
1496
+ ...Y.shape,
1497
+ ..._i.shape,
1498
+ notification_type: u.string().enum(H.System)
1499
+ }), yi = u.object({
1500
+ ...Y.shape,
1501
+ ...X.shape,
1502
+ notification_type: u.string().enum(H.PostPinned, H.PostHighlighted, H.PostDeleted, H.PostLiked)
1503
+ }), bi = u.object({
1504
+ ...Y.shape,
1505
+ ...X.shape,
1506
+ ...Z.shape,
1507
+ notification_type: u.string().enum(H.PostCommented)
1508
+ }), xi = u.object({
1509
+ ...Y.shape,
1510
+ ...Z.shape,
1511
+ ...Q.shape,
1512
+ notification_type: u.string().enum(H.CommentReplied)
1513
+ }), Si = u.object({
1514
+ ...Y.shape,
1515
+ ...Z.shape,
1516
+ ...X.shape,
1517
+ notification_type: u.string().enum(H.CommentLiked, H.CommentDeleted)
1518
+ }), Ci = u.object({
1519
+ ...Y.shape,
1520
+ ...Q.shape,
1521
+ notification_type: u.string().enum(H.ReplyReplied),
1522
+ comment_id: u.number(),
1523
+ reply_to_reply_id: u.number(),
1524
+ reply_to_reply_content: u.string()
1525
+ }), wi = u.object({
1526
+ ...Y.shape,
1527
+ ...Q.shape,
1528
+ ...Z.shape,
1529
+ notification_type: u.string().enum(H.ReplyLiked, H.ReplyDeleted)
1530
+ }), Ti = u.union(vi, yi, bi, xi, Si, Ci, wi).satisfies().lock(), Ei = l({ forums: u.array(U) }), Di = l({ topics: u.array(W) }), Oi = l({ topic: W }), ki = l({ post: G }), Ai = l({
1531
+ posts: u.array(G),
1532
+ next_token: u.string().optional()
1533
+ }), ji = l({
1534
+ post: G.clone().optional(),
1535
+ antispam: K.clone().optional()
1536
+ }), Mi = l({
1537
+ replies: u.array(q),
1538
+ next_token: u.string().optional()
1539
+ }), Ni = l({ reply: q }), Pi = l({
1540
+ reply: q.clone().optional(),
1541
+ antispam: K.clone().optional()
1542
+ }), Fi = l({ comment: J }), Ii = l({
1543
+ comments: u.array(J),
1544
+ next_token: u.string().optional()
1545
+ }), Li = l({
1546
+ comment: J.clone().optional(),
1547
+ antispam: J.clone().optional()
1548
+ }), Ri = u.guard(gi), zi = l({
1549
+ notifications: u.array(Ti),
1550
+ next_token: u.string().optional()
1551
+ }), Bi = l({
1552
+ system: u.number(),
1553
+ comment: u.number(),
1554
+ like: u.number()
1555
+ }), Vi = class {
1556
+ token;
1557
+ req;
1558
+ constructor(e) {
1559
+ this.token = e, this.req = e.req;
1560
+ }
1561
+ async getForums(e) {
1562
+ let { data: t } = await this.req.get("community/forums", null, Ei, e);
1563
+ return t?.forums || [];
1564
+ }
1565
+ async getTopics(e) {
1566
+ let { data: t } = await this.req.get("community/topics", null, Di, e);
1567
+ return t?.topics || [];
1568
+ }
1569
+ async getTopic(e, t) {
1570
+ let { data: n, code: r } = await this.req.get("community/topic", { topic_id: e }, Oi, t);
1571
+ return n?.topic ?? { error: r };
1572
+ }
1573
+ async getPosts(e, t) {
1574
+ let { data: n, code: r, message: i } = await this.req.get("community/posts", e || null, Ai, t);
1575
+ return n ?? {
1576
+ message: i,
1577
+ error: r
1578
+ };
1579
+ }
1580
+ async getPinnedPosts(e, t, n, r) {
1581
+ let { data: i, code: a, message: o } = await this.req.get("community/pinned-posts", {
1582
+ forum_id: e,
1583
+ max_results: t,
1584
+ next_token: n
1585
+ }, Ai, r);
1586
+ return i ?? {
1587
+ message: o,
1588
+ error: a
1589
+ };
1590
+ }
1591
+ async getPost(e, t) {
1592
+ let { data: n, code: r, message: i } = await this.req.get("community/post", { post_id: e }, ki, t);
1593
+ return n?.post ?? {
1594
+ message: i,
1595
+ error: r
1596
+ };
1597
+ }
1598
+ async post(e, t) {
1599
+ let { data: n, code: r, message: i } = await this.req.post("community/post", a(e), ji, t);
1600
+ return n ?? {
1601
+ message: i,
1602
+ error: r
1603
+ };
1604
+ }
1605
+ async getComments(e, t) {
1606
+ let { data: n, code: r, message: i } = await this.req.get("community/comments", e, Ii, t);
1607
+ return n ?? {
1608
+ message: i,
1609
+ error: r
1610
+ };
1611
+ }
1612
+ async getComment(e, t) {
1613
+ let { data: n, code: r, message: i } = await this.req.get("community/comment", { comment_id: e }, Fi, t);
1614
+ return n?.comment ?? {
1615
+ message: i,
1616
+ error: r
1617
+ };
1618
+ }
1619
+ async comment(e, t) {
1620
+ await this.token.autoLogin();
1621
+ let { data: n, code: r, message: i } = await this.req.post("community/comment", a(e), Li, t);
1622
+ return n ?? {
1623
+ message: i,
1624
+ error: r
1625
+ };
1626
+ }
1627
+ async getReplies(e, t) {
1628
+ let { data: n } = await this.req.get("community/replies", {
1629
+ max_results: 20,
1630
+ ...e
1631
+ }, Mi, t);
1632
+ return {
1633
+ replies: n?.replies || [],
1634
+ next_token: n?.next_token || ""
1635
+ };
1636
+ }
1637
+ async getReply(e, t) {
1638
+ let { data: n, code: r, message: i } = await this.req.get("community/reply", { reply_id: e }, Ni, t);
1639
+ return n?.reply ?? {
1640
+ message: i,
1641
+ error: r
1642
+ };
1643
+ }
1644
+ async reply(e, t) {
1645
+ await this.token.autoLogin();
1646
+ let { data: n, code: r, message: i } = await this.req.post("community/reply", a(e), Pi, t);
1647
+ return n ?? {
1648
+ message: i,
1649
+ error: r
1650
+ };
1651
+ }
1652
+ async like(e, t) {
1653
+ await this.token.autoLogin();
1654
+ let { ok: n, code: r, message: i } = await this.req.post("community/like", {
1655
+ ...e,
1656
+ action: "like"
1657
+ }, null, t);
1658
+ return n || {
1659
+ message: i,
1660
+ error: r
1661
+ };
1662
+ }
1663
+ async unlike(e, t) {
1664
+ await this.token.autoLogin();
1665
+ let { ok: n, code: r, message: i } = await this.req.post("community/like", {
1666
+ ...e,
1667
+ action: "unlike"
1668
+ }, null, t);
1669
+ return n || {
1670
+ message: i,
1671
+ error: r
1672
+ };
1673
+ }
1674
+ async getMediaPresignedUrl(e, t) {
1675
+ await this.token.autoLogin();
1676
+ let { data: n } = await this.req.get("community/media-presign-url", e, Ri, t);
1677
+ return n;
1678
+ }
1679
+ async getNotifications(e, t) {
1680
+ await this.token.autoLogin();
1681
+ let { data: n } = await this.req.get("community/notifications", {
1682
+ max_results: 20,
1683
+ ...e
1684
+ }, zi, t);
1685
+ return {
1686
+ notifications: n?.notifications || [],
1687
+ next_token: n?.next_token || ""
1688
+ };
1689
+ }
1690
+ async getUnreadNotificationsCount(e) {
1691
+ if (!await this.token.autoLogin()) return null;
1692
+ let { data: t } = await this.req.get("community/unread-notifications-count", null, Bi, e);
1693
+ return t;
1694
+ }
1695
+ async clearUnreadNotifications(e, t) {
1696
+ if (!await this.token.autoLogin()) return !1;
1697
+ let { ok: n } = await this.req.post("community/clear-unread-notifications", { category: e }, null, t);
1698
+ return n;
1699
+ }
1700
+ }, Hi = l({
1701
+ nonce_str: u.string(),
1702
+ timestamp: u.number(),
1703
+ signature: u.string()
1704
+ }), Ui = /* @__PURE__ */ function(e) {
1705
+ return e.RedirectUriDisMatch = "10003", e.AppidError = "10016", e.AuthorizationError = "10015", e.NoRightForScope = "10005", e.Frequently = "10009", e.AppBanded = "10004", e.ShouldFollow = "10006", e.ScopeNull = "10010", e.RedirectUriNull = "10011", e.AppidNull = "10012", e.StateNull = "10013", e;
1706
+ }({});
1707
+ //#endregion
1708
+ //#region src/weixin.guards.ts
1709
+ function $(e) {
1710
+ return t(e, "open_id", "union_id", "weixin_token");
1894
1711
  }
1895
- async function na(o, t) {
1896
- if (!await this.token.autoLogin()) return null;
1897
- const { data: n, code: r, message: a } = await this.req.get(
1898
- "event/ugc/leaderboard",
1899
- {
1900
- feature_id: o,
1901
- event_id: this.event
1902
- },
1903
- Pr,
1904
- t
1905
- );
1906
- return n || {
1907
- message: a,
1908
- error: r
1909
- };
1910
- }
1911
- async function ra(o, t) {
1912
- if (!await this.token.autoLogin()) return null;
1913
- const { data: n, code: r, message: a } = await this.req.get(
1914
- "event/redeem/item-stocks",
1915
- {
1916
- event_id: this.event,
1917
- feature_id: o
1918
- },
1919
- Er,
1920
- t
1921
- );
1922
- return n || {
1923
- message: a,
1924
- error: r
1925
- };
1926
- }
1927
- const Fr = {
1928
- /** 所有人均可以发帖 */
1929
- All: "all",
1930
- /** 指定用户可发帖 */
1931
- Limit: "limit"
1932
- }, Ir = e.string().enum(Fr).lock(), Dr = {
1933
- /** 待审核(仅自己可见) */
1934
- Pending: "pending",
1935
- /** 审核通过 */
1936
- Approved: "approved",
1937
- /** 审核不通过 */
1938
- Failed: "failed",
1939
- /** 嫌疑(仅自己可见) */
1940
- Suspect: "suspect"
1941
- }, ae = e.string().enum(Dr).lock(), $r = {
1942
- /** 系统通知 */
1943
- System: "system",
1944
- /** 评论我的 */
1945
- Comment: "comment",
1946
- /** 点赞通知 */
1947
- Like: "like"
1948
- }, oa = e.string().enum($r).lock(), m = {
1949
- /** 系统通知 */
1950
- System: "system",
1951
- /** 帖子被置顶 */
1952
- PostPinned: "post_pinned",
1953
- /** 帖子被加精 */
1954
- PostHighlighted: "post_highlighted",
1955
- /** 帖子被删除 */
1956
- PostDeleted: "post_deleted",
1957
- /** 帖子被评论 */
1958
- PostCommented: "post_commented",
1959
- /** 帖子被点赞 */
1960
- PostLiked: "post_liked",
1961
- /** 评论被回复 */
1962
- CommentReplied: "comment_replied",
1963
- /** 评论被点赞 */
1964
- CommentLiked: "comment_liked",
1965
- /** 评论被删除 */
1966
- CommentDeleted: "comment_deleted",
1967
- /** 回复被回复 */
1968
- ReplyReplied: "reply_replied",
1969
- /** 回复被点赞 */
1970
- ReplyLiked: "reply_liked",
1971
- /** 回复被删除 */
1972
- ReplyDeleted: "reply_deleted"
1973
- }, Ar = e.string().enum(m).lock(), ie = e.object({
1974
- forum_id: e.number(),
1975
- icon_url: e.string(),
1976
- name: e.string(),
1977
- tags: e.array(e.string()),
1978
- sort: e.number(),
1979
- mode: Ir,
1980
- member_ids: e.array(e.number())
1981
- }).lock(), I = e.object({
1982
- topic_id: e.number(),
1983
- cover_url: e.string(),
1984
- name: e.string(),
1985
- description: e.string(),
1986
- tags: e.array(e.string()),
1987
- post_num: e.number()
1988
- }).lock(), D = e.object({
1989
- post_id: e.number(),
1990
- forum: ie,
1991
- posted_by: e.string(),
1992
- nickname: e.string(),
1993
- avatar_url: e.string(),
1994
- title: e.string().optional(),
1995
- content: e.string(),
1996
- content_text_count: e.number(),
1997
- summary: e.string(),
1998
- like_num: e.number(),
1999
- comments_num: e.number(),
2000
- liked: e.bool(),
2001
- image_urls: e.array(e.string()),
2002
- topics: e.array(I),
2003
- event_ids: e.array(e.number()),
2004
- is_pinned: e.bool(),
2005
- is_highlighted: e.bool(),
2006
- status: ae,
2007
- create_time: e.number()
2008
- }).lock(), se = e.object({
2009
- err_msg: e.string().optional()
2010
- }).optional().lock(), Or = e.object({
2011
- reply_id: e.number(),
2012
- reply_content: e.string().optional(),
2013
- replied_by: e.string(),
2014
- nickname: e.string(),
2015
- avatar_url: e.string()
2016
- }).lock(), C = e.object({
2017
- reply_id: e.number(),
2018
- comment_id: e.number(),
2019
- comment_content: e.string().optional(),
2020
- commented_by: e.string().optional(),
2021
- commented_by_nickname: e.string().optional(),
2022
- commented_by_avatar_url: e.string().optional(),
2023
- replied_by: e.string(),
2024
- nickname: e.string(),
2025
- avatar_url: e.string(),
2026
- content: e.string(),
2027
- like_num: e.number(),
2028
- liked: e.bool(),
2029
- reply_to: Or,
2030
- create_time: e.number()
2031
- }).lock(), k = e.object({
2032
- comment_id: e.number(),
2033
- post_id: e.number(),
2034
- post_subject: e.string().optional(),
2035
- post_summary: e.string().optional(),
2036
- post_image_url: e.string().optional(),
2037
- posted_by: e.string().optional(),
2038
- posted_by_nickname: e.string().optional(),
2039
- posted_by_avatar_url: e.string().optional(),
2040
- commented_by: e.string(),
2041
- nickname: e.string(),
2042
- avatar_url: e.string(),
2043
- content: e.string(),
2044
- like_num: e.number(),
2045
- reply_num: e.number(),
2046
- liked: e.bool(),
2047
- image_url: e.string(),
2048
- create_time: e.number(),
2049
- status: ae,
2050
- replies: e.array(C).optional()
2051
- }).lock(), Gr = e.object({
2052
- image_url: e.string(),
2053
- upload_url: e.string(),
2054
- existed: e.bool()
2055
- }).lock(), _ = e.object({
2056
- notification_id: e.string(),
2057
- notification_type: Ar,
2058
- is_read: e.bool(),
2059
- create_time: e.number(),
2060
- origin_user_id: e.string(),
2061
- origin_user_name: e.string(),
2062
- origin_user_avatar_url: e.string()
2063
- }).lock(), Nr = e.object({
2064
- system_message_subject: e.string(),
2065
- system_message_content: e.string()
2066
- }).lock(), $ = e.object({
2067
- post_id: e.number(),
2068
- post_subject: e.string(),
2069
- post_summary: e.string(),
2070
- post_image_url: e.string()
2071
- }).lock(), V = e.object({
2072
- comment_id: e.number(),
2073
- comment_content: e.string()
2074
- }).lock(), A = e.object({
2075
- reply_id: e.number(),
2076
- reply_content: e.string()
2077
- }).lock(), Qr = e.object({
2078
- ..._.shape,
2079
- ...Nr.shape,
2080
- notification_type: e.string().enum(m.System)
2081
- }), Br = e.object({
2082
- ..._.shape,
2083
- ...$.shape,
2084
- notification_type: e.string().enum(
2085
- m.PostPinned,
2086
- m.PostHighlighted,
2087
- m.PostDeleted,
2088
- m.PostLiked
2089
- )
2090
- }), Mr = e.object({
2091
- ..._.shape,
2092
- ...$.shape,
2093
- ...V.shape,
2094
- notification_type: e.string().enum(m.PostCommented)
2095
- }), Kr = e.object({
2096
- ..._.shape,
2097
- ...V.shape,
2098
- ...A.shape,
2099
- notification_type: e.string().enum(m.CommentReplied)
2100
- }), Hr = e.object({
2101
- ..._.shape,
2102
- ...V.shape,
2103
- ...$.shape,
2104
- notification_type: e.string().enum(m.CommentLiked, m.CommentDeleted)
2105
- }), zr = e.object({
2106
- ..._.shape,
2107
- ...A.shape,
2108
- notification_type: e.string().enum(m.ReplyReplied),
2109
- comment_id: e.number(),
2110
- reply_to_reply_id: e.number(),
2111
- reply_to_reply_content: e.string()
2112
- }), Jr = e.object({
2113
- ..._.shape,
2114
- ...A.shape,
2115
- ...V.shape,
2116
- notification_type: e.string().enum(m.ReplyLiked, m.ReplyDeleted)
2117
- }), Zr = e.union(
2118
- Qr,
2119
- Br,
2120
- Mr,
2121
- Kr,
2122
- Hr,
2123
- zr,
2124
- Jr
2125
- ).satisfies().lock(), Xr = s({ forums: e.array(ie) }), Yr = s({ topics: e.array(I) }), Wr = s({ topic: I }), eo = s({ post: D }), M = s({
2126
- posts: e.array(D),
2127
- next_token: e.string().optional()
2128
- }), to = s({
2129
- post: D.clone().optional(),
2130
- antispam: se.clone().optional()
2131
- }), no = s({
2132
- replies: e.array(C),
2133
- next_token: e.string().optional()
2134
- }), ro = s({ reply: C }), oo = s({
2135
- reply: C.clone().optional(),
2136
- antispam: se.clone().optional()
2137
- }), ao = s({ comment: k }), io = s({
2138
- comments: e.array(k),
2139
- next_token: e.string().optional()
2140
- }), so = s({
2141
- comment: k.clone().optional(),
2142
- antispam: k.clone().optional()
2143
- }), co = e.guard(Gr), uo = s({
2144
- notifications: e.array(Zr),
2145
- next_token: e.string().optional()
2146
- }), lo = s({
2147
- system: e.number(),
2148
- comment: e.number(),
2149
- like: e.number()
2150
- });
2151
- class aa {
2152
- token;
2153
- req;
2154
- constructor(t) {
2155
- this.token = t, this.req = t.req;
2156
- }
2157
- /**
2158
- * 获取社区版块列表,仅返回启用状态的版块
2159
- *
2160
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=QaqUa2K0z0
2161
- */
2162
- async getForums(t) {
2163
- const { data: n } = await this.req.get("community/forums", null, Xr, t);
2164
- return n?.forums || [];
2165
- }
2166
- /**
2167
- * 获取社区话题列表,仅返回启用状态的话题
2168
- *
2169
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=mIwpymAQom
2170
- */
2171
- async getTopics(t) {
2172
- const { data: n } = await this.req.get("community/topics", null, Yr, t);
2173
- return n?.topics || [];
2174
- }
2175
- /**
2176
- * 根据话题 ID 获取社区话题信息
2177
- *
2178
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=Jvw7xMK31K
2179
- */
2180
- async getTopic(t, n) {
2181
- const { data: r, code: a } = await this.req.get(
2182
- "community/topic",
2183
- { topic_id: t },
2184
- Wr,
2185
- n
2186
- );
2187
- return r?.topic ?? { error: a };
2188
- }
2189
- /**
2190
- * 获取社区帖子列表
2191
- *
2192
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
2193
- */
2194
- async getPosts(t, n) {
2195
- const { data: r, code: a, message: i } = await this.req.get(
2196
- "community/posts",
2197
- t || null,
2198
- M,
2199
- n
2200
- );
2201
- return r ?? {
2202
- message: i,
2203
- error: a
2204
- };
2205
- }
2206
- /**
2207
- * 获取社区置顶帖子列表
2208
- *
2209
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
2210
- */
2211
- async getPinnedPosts(t, n, r, a) {
2212
- const { data: i, code: d, message: b } = await this.req.get(
2213
- "community/pinned-posts",
2214
- { forum_id: t, max_results: n, next_token: r },
2215
- M,
2216
- a
2217
- );
2218
- return i ?? {
2219
- message: b,
2220
- error: d
2221
- };
2222
- }
2223
- /**
2224
- * 根据帖子 id 获取帖子详情
2225
- *
2226
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=hj1AZy5rcP
2227
- */
2228
- async getPost(t, n) {
2229
- const { data: r, code: a, message: i } = await this.req.get(
2230
- "community/post",
2231
- { post_id: t },
2232
- eo,
2233
- n
2234
- );
2235
- return r?.post ?? {
2236
- message: i,
2237
- error: a
2238
- };
2239
- }
2240
- /**
2241
- * 发布帖子
2242
- *
2243
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=M5okHBuaVk
2244
- */
2245
- async post(t, n) {
2246
- const { data: r, code: a, message: i } = await this.req.post(
2247
- "community/post",
2248
- l(t),
2249
- to,
2250
- n
2251
- );
2252
- return r ?? {
2253
- message: i,
2254
- error: a
2255
- };
2256
- }
2257
- /**
2258
- * 获取社区帖子评论列表
2259
- *
2260
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=djKbX7lFdp
2261
- */
2262
- async getComments(t, n) {
2263
- const { data: r, code: a, message: i } = await this.req.get(
2264
- "community/comments",
2265
- t,
2266
- io,
2267
- n
2268
- );
2269
- return r ?? {
2270
- message: i,
2271
- error: a
2272
- };
2273
- }
2274
- /**
2275
- * 根据评论 id 获取评论详情
2276
- *
2277
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=RIc7oxVGae
2278
- */
2279
- async getComment(t, n) {
2280
- const { data: r, code: a, message: i } = await this.req.get(
2281
- "community/comment",
2282
- { comment_id: t },
2283
- ao,
2284
- n
2285
- );
2286
- return r?.comment ?? {
2287
- message: i,
2288
- error: a
2289
- };
2290
- }
2291
- /**
2292
- * 帖子下发表评论
2293
- *
2294
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=Nv7lk0nTmr
2295
- */
2296
- async comment(t, n) {
2297
- await this.token.autoLogin();
2298
- const { data: r, code: a, message: i } = await this.req.post(
2299
- "community/comment",
2300
- l(t),
2301
- so,
2302
- n
2303
- );
2304
- return r ?? {
2305
- message: i,
2306
- error: a
2307
- };
2308
- }
2309
- /**
2310
- * 获取社区帖子评论回复列表
2311
- *
2312
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=sVKBbY83MY
2313
- */
2314
- async getReplies(t, n) {
2315
- const { data: r } = await this.req.get(
2316
- "community/replies",
2317
- { max_results: 20, ...t },
2318
- no,
2319
- n
2320
- );
2321
- return {
2322
- replies: r?.replies || [],
2323
- next_token: r?.next_token || ""
2324
- };
2325
- }
2326
- /**
2327
- * 根据回复 id 获取回复详情
2328
- *
2329
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=kxhcSXD3MG
2330
- */
2331
- async getReply(t, n) {
2332
- const { data: r, code: a, message: i } = await this.req.get(
2333
- "community/reply",
2334
- { reply_id: t },
2335
- ro,
2336
- n
2337
- );
2338
- return r?.reply ?? {
2339
- message: i,
2340
- error: a
2341
- };
2342
- }
2343
- /**
2344
- * 回复帖子评论或回复
2345
- *
2346
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=KA8WpTX2pg
2347
- */
2348
- async reply(t, n) {
2349
- await this.token.autoLogin();
2350
- const { data: r, code: a, message: i } = await this.req.post(
2351
- "community/reply",
2352
- l(t),
2353
- oo,
2354
- n
2355
- );
2356
- return r ?? {
2357
- message: i,
2358
- error: a
2359
- };
2360
- }
2361
- /**
2362
- * 对 帖子/评论/回复 点赞
2363
- *
2364
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
2365
- */
2366
- async like(t, n) {
2367
- await this.token.autoLogin();
2368
- const { ok: r, code: a, message: i } = await this.req.post(
2369
- "community/like",
2370
- { ...t, action: "like" },
2371
- null,
2372
- n
2373
- );
2374
- return r || {
2375
- message: i,
2376
- error: a
2377
- };
2378
- }
2379
- /**
2380
- * 对 帖子/评论/回复 取消点赞
2381
- *
2382
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
2383
- */
2384
- async unlike(t, n) {
2385
- await this.token.autoLogin();
2386
- const { ok: r, code: a, message: i } = await this.req.post(
2387
- "community/like",
2388
- { ...t, action: "unlike" },
2389
- null,
2390
- n
2391
- );
2392
- return r || {
2393
- message: i,
2394
- error: a
2395
- };
2396
- }
2397
- /**
2398
- * 获取资源预上传地址
2399
- *
2400
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=dWWhpoShxZ
2401
- */
2402
- async getMediaPresignedUrl(t, n) {
2403
- await this.token.autoLogin();
2404
- const { data: r } = await this.req.get(
2405
- "community/media-presign-url",
2406
- t,
2407
- co,
2408
- n
2409
- );
2410
- return r;
2411
- }
2412
- /**
2413
- * 获取用户社区通知
2414
- *
2415
- * 了解更多[通知的分类](https://kdocs.cn/l/cbggfJodHLIz?linkname=AiCR5khgOr)。
2416
- *
2417
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=W5lceDgbBG
2418
- */
2419
- async getNotifications(t, n) {
2420
- await this.token.autoLogin();
2421
- const { data: r } = await this.req.get(
2422
- "community/notifications",
2423
- { max_results: 20, ...t },
2424
- uo,
2425
- n
2426
- );
2427
- return {
2428
- notifications: r?.notifications || [],
2429
- next_token: r?.next_token || ""
2430
- };
2431
- }
2432
- /**
2433
- * 获取用户未读通知数量
2434
- *
2435
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=CwIOMjAfMU
2436
- */
2437
- async getUnreadNotificationsCount(t) {
2438
- if (!await this.token.autoLogin()) return null;
2439
- const { data: n } = await this.req.get(
2440
- "community/unread-notifications-count",
2441
- null,
2442
- lo,
2443
- t
2444
- );
2445
- return n;
2446
- }
2447
- /**
2448
- * 社区用户将通知标为已读
2449
- *
2450
- * https://kdocs.cn/l/cbggfJodHLIz?linkname=TCJQxnOjJe
2451
- */
2452
- async clearUnreadNotifications(t, n) {
2453
- if (!await this.token.autoLogin()) return !1;
2454
- const { ok: r } = await this.req.post("community/clear-unread-notifications", { category: t }, null, n);
2455
- return r;
2456
- }
2457
- }
2458
- const mo = s({
2459
- nonce_str: e.string(),
2460
- timestamp: e.number(),
2461
- signature: e.string()
2462
- });
2463
- var go = /* @__PURE__ */ ((o) => (o.RedirectUriDisMatch = "10003", o.AppidError = "10016", o.AuthorizationError = "10015", o.NoRightForScope = "10005", o.Frequently = "10009", o.AppBanded = "10004", o.ShouldFollow = "10006", o.ScopeNull = "10010", o.RedirectUriNull = "10011", o.AppidNull = "10012", o.StateNull = "10013", o))(go || {});
2464
- function q(o) {
2465
- return y(o, "open_id", "union_id", "weixin_token");
2466
- }
2467
- const K = "wx_login_cache";
2468
- class ia {
2469
- token;
2470
- _appid;
2471
- req;
2472
- /**
2473
- * 创建微信相关功能接口
2474
- *
2475
- * - authToken 需要导入 AuthToken 进行初始化后传入
2476
- * - appid 可以静态设置,也可以在小程序中动态获取,见下示例代码
2477
- *
2478
- * ```js
2479
- * const info = wx.getAccountInfoSync();
2480
- * console.log(info.miniProgram.appId)
2481
- * ```
2482
- *
2483
- * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html
2484
- */
2485
- constructor(t, n) {
2486
- this.token = t, this.req = t.req, this._appid = n, this.getLoginCache();
2487
- }
2488
- get appid() {
2489
- return this._appid;
2490
- }
2491
- /**
2492
- * 检查缓存中的登录数据
2493
- *
2494
- * 如果没有缓存或缓存数据错误,则需要调用 [wx.login](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) 后调用 login 方法
2495
- *
2496
- * 也可以直接调用 login 方法,并传入 weixin code 的读取函数
2497
- */
2498
- async getLoginCache() {
2499
- const t = this.token.storage.get(K);
2500
- if (!t)
2501
- return null;
2502
- const n = fe(t);
2503
- return q(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
2504
- }
2505
- /**
2506
- * 小程序页面微信静默登录,获取 weixinToken / open_id / union_id。
2507
- *
2508
- * 使用场景:
2509
- *
2510
- * - 小程序的任意页面打开后应该优先调用此方法以获取登录状态
2511
- *
2512
- * 注意:
2513
- *
2514
- * - 登录成功后会将登录信息缓存到本地,重复或并发调用不会引起任何副作用。
2515
- * - 由于小程序的存储是以用户维度隔离的,每个微信用户在每个小程序下只要成功调用一次此 API 就会缓存请求结果。
2516
- * - 微信公众号网页授权请使用 webLogin 方法
2517
- *
2518
- * 🔕请求静默进行,无消息提示
2519
- *
2520
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=GwIZ0givCb
2521
- */
2522
- async login(t) {
2523
- if (!h())
2524
- throw new Error("当前环境非微信小程序");
2525
- const n = await this.getLoginCache();
2526
- if (n)
2527
- return n;
2528
- const r = await ve(), { data: a, code: i, message: d } = await this.req.post(
2529
- "weixin/login",
2530
- { code: r, appid: this.appid },
2531
- q,
2532
- { ...t, message: !1 }
2533
- );
2534
- return a && (this.token.weixinToken = a.weixin_token, this.token.storage.set(K, JSON.stringify(a))), a ?? {
2535
- message: d,
2536
- error: i
2537
- };
2538
- }
2539
- /**
2540
- * 在微信内嵌网页中调用微信公众号授权登录【暂未启用】
2541
- *
2542
- * 注意:
2543
- *
2544
- * - 登录回调地址强制是当前页面,包括 location search 和 location hash 部分
2545
- * - 登录跳转返回 code 后,会将 code 从 url 中删除以防止 code 泄露,如需设置分享则需要在此方法执行完毕之后
2546
- *
2547
- * 官方参考资料:
2548
- *
2549
- * - [微信网页开发 / 网页授权](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html)
2550
- *
2551
- * @param scope - 网页授权作用域
2552
- * - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 union_id 则需要 snsapi_userinfo
2553
- * - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
2554
- */
2555
- async webLogin(t = "snsapi_userinfo", n) {
2556
- const r = x("code"), a = Date.now(), i = +x("state");
2557
- if (!r || !i || i < a - 1e3 * 60 * 5 || i > a) {
2558
- const le = O(["code", "state"]);
2559
- location.replace(
2560
- `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(le)}&response_type=code&scope=${t}&state=${a}#wechat_redirect`
2561
- );
2562
- return;
2563
- }
2564
- if (/^100\d{2}$/.test(r))
2565
- return {
2566
- message: "Error: " + r,
2567
- error: r
2568
- };
2569
- const d = O(["code", "state"]);
2570
- "replaceState" in history && history.replaceState({}, "", d);
2571
- const {
2572
- data: b,
2573
- code: ce,
2574
- message: ue
2575
- } = await this.req.post("weixin/login", { code: r, appid: this.appid }, q, n);
2576
- return b && (this.token.weixinToken = b.weixin_token, await this.token.autoLogin()), b ?? {
2577
- message: ue,
2578
- error: ce
2579
- };
2580
- }
2581
- /**
2582
- * 关联游戏账号,无返回值,全程静默
2583
- *
2584
- * 用于从游戏内跳转至小程序时,将微信用户身份和游戏内身份关联起来,使得后续的企业微信客服流程能够知道该微信用户在游戏内的身份。
2585
- *
2586
- * 🔕请求静默进行,无消息提示
2587
- *
2588
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=ci73N833Mk
2589
- *
2590
- * @param weixinToken 调用 login 后,得到的 weixinToken,如果 weixinToken 为空则跳过不处理
2591
- * @param gameCode 从游戏内跳转至小程序时,通过请求参数 query 携带的 game_code,如果值为空则跳过不处理
2592
- */
2593
- async linkPlayer(t, n, r) {
2594
- if (!t || !n)
2595
- return !1;
2596
- const { ok: a } = await this.req.post("weixin/link-player", { weixin_token: t, game_code: n }, null, {
2597
- ...r,
2598
- message: !1
2599
- });
2600
- return a;
2601
- }
2602
- /**
2603
- * 获取集成 JSSDK 所需的签名信息
2604
- *
2605
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=CuWOqxr9Ue
2606
- */
2607
- async getJSSDKConfig(t) {
2608
- const { data: n } = await this.req.get(
2609
- "weixin/offiaccount/jssdk-sign",
2610
- {
2611
- appid: this.appid,
2612
- url: location.href.split("#")[0]
2613
- },
2614
- mo,
2615
- t
2616
- );
2617
- return n ? {
2618
- appid: this.appid,
2619
- nonceStr: n.nonce_str,
2620
- timestamp: n.timestamp,
2621
- signature: n.signature
2622
- } : null;
2623
- }
2624
- }
2625
- export {
2626
- se as AntispamValidator,
2627
- yo as AuthToken,
2628
- Kn as CandidateVoteValidator,
2629
- ne as CashbackEngagementDataValidator,
2630
- wn as ClaimActivationKeyEngagementDataValidator,
2631
- ct as ClaimRewardStatus,
2632
- U as ClaimRewardStatusValidator,
2633
- nr as ClaimedItemValidator,
2634
- J as ClubAddressValidator,
2635
- ho as ClubApi,
2636
- Z as ClubBenefitSummaryValidator,
2637
- Oe as ClubBenefitValidator,
2638
- Te as ClubCreditChangeScene,
2639
- qe as ClubCreditChangeSceneValidator,
2640
- Ve as ClubCreditChangeType,
2641
- je as ClubCreditChangeTypeValidator,
2642
- Ae as ClubCreditLogValidator,
2643
- Se as ClubGlobalConfigValidator,
2644
- xe as ClubItemType,
2645
- H as ClubItemTypeValidator,
2646
- Pe as ClubPlayerValidator,
2647
- X as ClubProductValidator,
2648
- Le as ClubRedemptionStatus,
2649
- Ue as ClubRedemptionStatusValidator,
2650
- $e as ClubUserCreditValidator,
2651
- De as ClubUserProfileValidator,
2652
- Jn as CommentEngagementValidator,
2653
- k as CommentValidator,
2654
- aa as CommunityApi,
2655
- Hn as ConversationValidator,
2656
- et as EngageAccountType,
2657
- tt as EngageAccountTypeValidator,
2658
- tr as EngageResponseValidator,
2659
- Xn as EngageRewardValidator,
2660
- wo as EventApi,
2661
- ur as EventConfigValidator,
2662
- Vt as EventFeatureConfigOfCashbackValidator,
2663
- Tt as EventFeatureConfigOfCheckInValidator,
2664
- xt as EventFeatureConfigOfClaimActivationKeyValidator,
2665
- Ut as EventFeatureConfigOfClaimRewardsValidator,
2666
- Pt as EventFeatureConfigOfCommentValidator,
2667
- Ft as EventFeatureConfigOfFollowValidator,
2668
- $t as EventFeatureConfigOfGiftCodeValidator,
2669
- Ot as EventFeatureConfigOfInviteValidator,
2670
- Nt as EventFeatureConfigOfInvitedRegisterValidator,
2671
- zt as EventFeatureConfigOfLotteryDrawValidator,
2672
- Kt as EventFeatureConfigOfLotteryValidator,
2673
- Zt as EventFeatureConfigOfPreregisterValidator,
2674
- Yt as EventFeatureConfigOfQuestValidator,
2675
- tn as EventFeatureConfigOfRedeemValidator,
2676
- rn as EventFeatureConfigOfRegisterValidator,
2677
- an as EventFeatureConfigOfShareValidator,
2678
- cn as EventFeatureConfigOfSubscribeValidator,
2679
- ln as EventFeatureConfigOfSurveyValidator,
2680
- dn as EventFeatureConfigOfTeamValidator,
2681
- bn as EventFeatureConfigOfUgcLikeValidator,
2682
- _n as EventFeatureConfigOfUgcValidator,
2683
- ar as EventFeatureConfigOfVote2Validator,
2684
- hn as EventFeatureConfigOfVoteValidator,
2685
- cr as EventFeatureConfigValidator,
2686
- nt as EventPeriodType,
2687
- rt as EventPeriodTypeValidator,
2688
- g as EventRewardItemConfigValidator,
2689
- Ne as ExtraGameRewardValidator,
2690
- Ge as ExtraPhysicalShipmentValidator,
2691
- en as FeatureRedeemItemConfigValidator,
2692
- Rt as FeatureRewardValidator,
2693
- c as FeatureType,
2694
- ot as FeatureTypeValidator,
2695
- Fr as ForumMode,
2696
- Ir as ForumModeValidator,
2697
- ie as ForumValidator,
2698
- v as GamerItemType,
2699
- Y as GamerItemTypeValidator,
2700
- Re as Gender,
2701
- Ce as GenderValidator,
2702
- kn as GiftCodeEngagementDataValidator,
2703
- vn as InviteEngagementDataValidator,
2704
- gt as LotteryDrawAction,
2705
- Co as LotteryDrawActionValidator,
2706
- jn as LotteryDrawEngagementDataValidator,
2707
- Rn as LotteryEngagementDataValidator,
2708
- w as LotteryTicketStatus,
2709
- vo as LotteryTicketStatusValidator,
2710
- _ as NotificationBaseValidator,
2711
- $r as NotificationCategory,
2712
- oa as NotificationCategoryValidator,
2713
- Kr as NotificationCommentReplyValidator,
2714
- Hr as NotificationCommentValidator,
2715
- V as NotificationPayloadCommentValidator,
2716
- $ as NotificationPayloadPostValidator,
2717
- A as NotificationPayloadReplyValidator,
2718
- Nr as NotificationPayloadSystemValidator,
2719
- Mr as NotificationPostCommentValidator,
2720
- Br as NotificationPostValidator,
2721
- zr as NotificationReplyRepliedValidator,
2722
- Jr as NotificationReplyValidator,
2723
- Qr as NotificationSystemValidator,
2724
- m as NotificationType,
2725
- Ar as NotificationTypeValidator,
2726
- Zr as NotificationValidator,
2727
- Ie as PlayerRoleCardValidator,
2728
- z as PlayerRoleValidator,
2729
- Dr as PostStatus,
2730
- ae as PostStatusValidator,
2731
- D as PostValidator,
2732
- Tn as PreregisterEngagementDataValidator,
2733
- Gr as PresignedUrlResponseValidator,
2734
- qn as QuestEngagementDataValidator,
2735
- at as QuestObjective,
2736
- ee as QuestObjectiveValidator,
2737
- _t as QuestProgressAlgorithm,
2738
- pt as QuestProgressAlgorithmValidator,
2739
- xn as QuestProgressValidator,
2740
- Ln as RedeemEngagementDataValidator,
2741
- fo as RedeemParamsValidator,
2742
- Un as RedeemStocksResponseValidator,
2743
- Qe as RedemptionValidator,
2744
- vt as RegularRewardValidator,
2745
- Or as ReplyToValidator,
2746
- C as ReplyValidator,
2747
- ko as RewardItemType,
2748
- W as RewardItemTypeValidator,
2749
- ut as RewardSource,
2750
- S as RewardSourceValidator,
2751
- p as RewardStatus,
2752
- te as RewardStatusValidator,
2753
- Zn as RewardValidator,
2754
- Fe as RoleBaseInfoValidator,
2755
- Ee as ServerBaseInfoValidator,
2756
- Sn as ShareEngagementDataValidator,
2757
- En as SurveyEngagementDataValidator,
2758
- dt as TeamAction,
2759
- Ro as TeamActionValidator,
2760
- In as TeamEngagementDataValidator,
2761
- Fn as TeamEngagementValidator,
2762
- Vo as TeamMemberValidator,
2763
- lt as TeamVisibility,
2764
- mt as TeamVisibilityValidator,
2765
- I as TopicValidator,
2766
- On as UgcCountResponseValidator,
2767
- Dn as UgcEngagementDataValidator,
2768
- Nn as UgcLeaderboardResponseValidator,
2769
- $n as UgcRecordBaseResponseValidator,
2770
- An as UgcRecordResponseValidator,
2771
- ht as UgcReviewStatus,
2772
- wt as UgcReviewStatusValidator,
2773
- ft as UgcSocialMedia,
2774
- P as UgcSocialMediaValidator,
2775
- Gn as UgcUploadImageValidator,
2776
- E as UserEngagementDataValidator,
2777
- Yn as UserEngagementValidator,
2778
- er as UserFeatureStatusValidator,
2779
- R as UserRewardValidator,
2780
- Wn as VerifyMobileResultValidator,
2781
- Mn as Vote2ClaimRewardsResponseValidator,
2782
- Bn as Vote2EngagementDataValidator,
2783
- bt as Vote2RewardType,
2784
- yt as Vote2RewardTypeValidator,
2785
- Qn as VoteEngagementDataValidator,
2786
- it as VoteOptionSource,
2787
- st as VoteOptionSourceValidator,
2788
- ia as WeixinApi,
2789
- Pn as WeixinSubscribeEngagementDataValidator,
2790
- go as WeixinWebLoginErrorCode,
2791
- zn as ZeroChatGPTDataValidator,
2792
- Io as claimRewards,
2793
- Ho as claimRewardsV2,
2794
- zo as claimWeixinHongbao,
2795
- Fo as engage,
2796
- Oo as generateUnlimitQrcode,
2797
- Bo as getCashbackQuery,
2798
- To as getConfig,
2799
- Lo as getEngagements,
2800
- xo as getEngagementsCount,
2801
- qo as getEngagementsUserCount,
2802
- Ao as getParamsByQrcodeScene,
2803
- Go as getQuestProgress,
2804
- ra as getRedeemItemStocks,
2805
- na as getUgcLeaderboard,
2806
- Ko as getUgcMyCount,
2807
- ea as getUgcRecommendation,
2808
- Mo as getUgcRecord,
2809
- ta as getUgcs,
2810
- $o as getUnlimitQrcodeScene,
2811
- Po as getUserEngagementCount,
2812
- Eo as getUserEngagements,
2813
- So as getUserFeatureStatus,
2814
- Yo as getUserItemCount,
2815
- Zo as getUserRewards,
2816
- Xo as getUserRewardsCount,
2817
- Qo as getVote2Leaderboard,
2818
- mo as isWeixinSignResponse,
2819
- Do as submitUserRewardAddress,
2820
- Wo as ugcUploadImage,
2821
- Jo as verifyActivationKey,
2822
- jo as verifyMobileAllowed,
2823
- Uo as visit,
2824
- No as vote2Rewards
1712
+ //#endregion
1713
+ //#region src/weixin.ts
1714
+ var Wi = "wx_login_cache", Gi = class {
1715
+ token;
1716
+ _appid;
1717
+ req;
1718
+ constructor(e, t) {
1719
+ this.token = e, this.req = e.req, this._appid = t, this.getLoginCache();
1720
+ }
1721
+ get appid() {
1722
+ return this._appid;
1723
+ }
1724
+ async getLoginCache() {
1725
+ let e = this.token.storage.get(Wi);
1726
+ if (!e) return null;
1727
+ let t = i(e);
1728
+ return $(t) ? (this.token.weixinToken = t.weixin_token, await this.token.autoLogin(), t) : null;
1729
+ }
1730
+ async login(e) {
1731
+ if (!c()) throw Error("当前环境非微信小程序");
1732
+ let t = await this.getLoginCache();
1733
+ if (t) return t;
1734
+ let n = await le(), { data: r, code: i, message: a } = await this.req.post("weixin/login", {
1735
+ code: n,
1736
+ appid: this.appid
1737
+ }, $, {
1738
+ ...e,
1739
+ message: !1
1740
+ });
1741
+ return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(Wi, JSON.stringify(r))), r ?? {
1742
+ message: a,
1743
+ error: i
1744
+ };
1745
+ }
1746
+ async webLogin(e = "snsapi_userinfo", t) {
1747
+ let n = s("code"), r = Date.now(), i = +s("state");
1748
+ if (!n || !i || i < r - 1e3 * 60 * 5 || i > r) {
1749
+ let t = ee(["code", "state"]);
1750
+ location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(t)}&response_type=code&scope=${e}&state=${r}#wechat_redirect`);
1751
+ return;
1752
+ }
1753
+ if (/^100\d{2}$/.test(n)) return {
1754
+ message: "Error: " + n,
1755
+ error: n
1756
+ };
1757
+ let a = ee(["code", "state"]);
1758
+ "replaceState" in history && history.replaceState({}, "", a);
1759
+ let { data: o, code: te, message: c } = await this.req.post("weixin/login", {
1760
+ code: n,
1761
+ appid: this.appid
1762
+ }, $, t);
1763
+ return o && (this.token.weixinToken = o.weixin_token, await this.token.autoLogin()), o ?? {
1764
+ message: c,
1765
+ error: te
1766
+ };
1767
+ }
1768
+ async linkPlayer(e, t, n) {
1769
+ if (!e || !t) return !1;
1770
+ let { ok: r } = await this.req.post("weixin/link-player", {
1771
+ weixin_token: e,
1772
+ game_code: t
1773
+ }, null, {
1774
+ ...n,
1775
+ message: !1
1776
+ });
1777
+ return r;
1778
+ }
1779
+ async getJSSDKConfig(e) {
1780
+ let { data: t } = await this.req.get("weixin/offiaccount/jssdk-sign", {
1781
+ appid: this.appid,
1782
+ url: location.href.split("#")[0]
1783
+ }, Hi, e);
1784
+ return t ? {
1785
+ appid: this.appid,
1786
+ nonceStr: t.nonce_str,
1787
+ timestamp: t.timestamp,
1788
+ signature: t.signature
1789
+ } : null;
1790
+ }
2825
1791
  };
1792
+ //#endregion
1793
+ export { K as AntispamValidator, ue as AuthToken, Vn as CandidateVoteValidator, I as CashbackEngagementDataValidator, mn as ClaimActivationKeyEngagementDataValidator, $e as ClaimRewardStatus, k as ClaimRewardStatusValidator, Zn as ClaimedItemValidator, m as ClubAddressValidator, Ue as ClubApi, h as ClubBenefitSummaryValidator, Oe as ClubBenefitValidator, he as ClubCreditChangeScene, ge as ClubCreditChangeSceneValidator, pe as ClubCreditChangeType, me as ClubCreditChangeTypeValidator, De as ClubCreditLogValidator, be as ClubGlobalConfigValidator, _e as ClubItemType, f as ClubItemTypeValidator, xe as ClubPlayerValidator, g as ClubProductValidator, ve as ClubRedemptionStatus, ye as ClubRedemptionStatusValidator, Ee as ClubUserCreditValidator, Te as ClubUserProfileValidator, Wn as CommentEngagementValidator, J as CommentValidator, Vi as CommunityApi, Hn as ConversationValidator, w as EngageAccountType, Ke as EngageAccountTypeValidator, Xn as EngageResponseValidator, Kn as EngageRewardValidator, We as EventApi, ir as EventConfigValidator, yt as EventFeatureConfigOfCashbackValidator, xt as EventFeatureConfigOfCheckInValidator, Ct as EventFeatureConfigOfClaimActivationKeyValidator, Tt as EventFeatureConfigOfClaimRewardsValidator, Dt as EventFeatureConfigOfCommentValidator, kt as EventFeatureConfigOfFollowValidator, Mt as EventFeatureConfigOfGiftCodeValidator, Pt as EventFeatureConfigOfInviteValidator, It as EventFeatureConfigOfInvitedRegisterValidator, Ht as EventFeatureConfigOfLotteryDrawValidator, Bt as EventFeatureConfigOfLotteryValidator, Wt as EventFeatureConfigOfPreregisterValidator, Kt as EventFeatureConfigOfQuestValidator, Yt as EventFeatureConfigOfRedeemValidator, Zt as EventFeatureConfigOfRegisterValidator, $t as EventFeatureConfigOfShareValidator, tn as EventFeatureConfigOfSubscribeValidator, rn as EventFeatureConfigOfSurveyValidator, on as EventFeatureConfigOfTeamValidator, un as EventFeatureConfigOfUgcLikeValidator, cn as EventFeatureConfigOfUgcValidator, er as EventFeatureConfigOfVote2Validator, pn as EventFeatureConfigOfVoteValidator, rr as EventFeatureConfigValidator, qe as EventPeriodType, Je as EventPeriodTypeValidator, N as EventRewardItemConfigValidator, je as ExtraGameRewardValidator, Ae as ExtraPhysicalShipmentValidator, Jt as FeatureRedeemItemConfigValidator, _t as FeatureRewardValidator, T as FeatureType, Ye as FeatureTypeValidator, li as ForumMode, ui as ForumModeValidator, U as ForumValidator, x as GamerItemType, S as GamerItemTypeValidator, de as Gender, fe as GenderValidator, hn as GiftCodeEngagementDataValidator, gn as InviteEngagementDataValidator, ot as LotteryDrawAction, st as LotteryDrawActionValidator, bn as LotteryDrawEngagementDataValidator, _n as LotteryEngagementDataValidator, j as LotteryTicketStatus, rt as LotteryTicketStatusValidator, Y as NotificationBaseValidator, fi as NotificationCategory, pi as NotificationCategoryValidator, xi as NotificationCommentReplyValidator, Si as NotificationCommentValidator, Z as NotificationPayloadCommentValidator, X as NotificationPayloadPostValidator, Q as NotificationPayloadReplyValidator, _i as NotificationPayloadSystemValidator, bi as NotificationPostCommentValidator, yi as NotificationPostValidator, Ci as NotificationReplyRepliedValidator, wi as NotificationReplyValidator, vi as NotificationSystemValidator, H as NotificationType, mi as NotificationTypeValidator, Ti as NotificationValidator, we as PlayerRoleCardValidator, p as PlayerRoleValidator, di as PostStatus, V as PostStatusValidator, G as PostValidator, xn as PreregisterEngagementDataValidator, gi as PresignedUrlResponseValidator, Cn as QuestEngagementDataValidator, Xe as QuestObjective, E as QuestObjectiveValidator, ct as QuestProgressAlgorithm, lt as QuestProgressAlgorithmValidator, wn as QuestProgressValidator, Tn as RedeemEngagementDataValidator, ke as RedeemParamsValidator, En as RedeemStocksResponseValidator, Me as RedemptionValidator, gt as RegularRewardValidator, hi as ReplyToValidator, q as ReplyValidator, Ge as RewardItemType, C as RewardItemTypeValidator, et as RewardSource, A as RewardSourceValidator, D as RewardStatus, O as RewardStatusValidator, Gn as RewardValidator, Ce as RoleBaseInfoValidator, Se as ServerBaseInfoValidator, Dn as ShareEngagementDataValidator, kn as SurveyEngagementDataValidator, it as TeamAction, at as TeamActionValidator, Mn as TeamEngagementDataValidator, An as TeamEngagementValidator, jn as TeamMemberValidator, tt as TeamVisibility, nt as TeamVisibilityValidator, W as TopicValidator, In as UgcCountResponseValidator, Nn as UgcEngagementDataValidator, Rn as UgcLeaderboardResponseValidator, Pn as UgcRecordBaseResponseValidator, Fn as UgcRecordResponseValidator, pt as UgcReviewStatus, mt as UgcReviewStatusValidator, ft as UgcSocialMedia, M as UgcSocialMediaValidator, Ln as UgcUploadImageValidator, z as UserEngagementDataValidator, qn as UserEngagementValidator, Yn as UserFeatureStatusValidator, L as UserRewardValidator, Jn as VerifyMobileResultValidator, Bn as Vote2ClaimRewardsResponseValidator, zn as Vote2EngagementDataValidator, ut as Vote2RewardType, dt as Vote2RewardTypeValidator, R as VoteEngagementDataValidator, Ze as VoteOptionSource, Qe as VoteOptionSourceValidator, Gi as WeixinApi, On as WeixinSubscribeEngagementDataValidator, Ui as WeixinWebLoginErrorCode, Un as ZeroChatGPTDataValidator, Vr as claimRewards, Qr as claimRewardsV2, $r as claimWeixinHongbao, Br as engage, Gr as generateUnlimitQrcode, Yr as getCashbackQuery, Mr as getConfig, Fr as getEngagements, Pr as getEngagementsCount, Nr as getEngagementsUserCount, Wr as getParamsByQrcodeScene, Kr as getQuestProgress, ci as getRedeemItemStocks, si as getUgcLeaderboard, Zr as getUgcMyCount, ai as getUgcRecommendation, Xr as getUgcRecord, oi as getUgcs, Ur as getUnlimitQrcodeScene, Rr as getUserEngagementCount, zr as getUserEngagements, Lr as getUserFeatureStatus, ri as getUserItemCount, ti as getUserRewards, ni as getUserRewardsCount, Jr as getVote2Leaderboard, Hi as isWeixinSignResponse, Hr as submitUserRewardAddress, ii as ugcUploadImage, ei as verifyActivationKey, jr as verifyMobileAllowed, Ir as visit, qr as vote2Rewards };