@seayoo-web/gamer-api 1.1.2 → 1.1.3

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
@@ -2,7 +2,7 @@ var V = Object.defineProperty;
2
2
  var Q = (e, t, r) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var u = (e, t, r) => Q(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { isComboWebView as T } from "@seayoo-web/combo-webview";
5
- import { isPlainObject as n, useConsole as M, Support as m, usePromise as H, pruneURL as j, queryString as h, pruneObject as s, isArray as a, isString as z, isValuedString as J, parseJSON as K, removePara as A } from "@seayoo-web/utils";
5
+ import { isPlainObject as n, useConsole as M, Support as m, usePromise as H, pruneURL as j, queryString as h, pruneObject as s, isArray as o, isString as z, isValuedString as J, parseJSON as K, removePara as A } from "@seayoo-web/utils";
6
6
  import "@seayoo-web/request";
7
7
  function N(e) {
8
8
  return n(e, "gamer_token") && typeof e.gamer_token == "string";
@@ -11,7 +11,10 @@ function L(e) {
11
11
  return n(e);
12
12
  }
13
13
  const l = M("GamerApiSDK");
14
- async function O() {
14
+ function O(e) {
15
+ return /^\/[a-z\d-]+$/.test(e);
16
+ }
17
+ async function X() {
15
18
  const { promise: e, resolve: t } = H();
16
19
  return wx.login({
17
20
  success(r) {
@@ -22,7 +25,7 @@ async function O() {
22
25
  }
23
26
  }), await e;
24
27
  }
25
- const X = {
28
+ const Y = {
26
29
  get(e) {
27
30
  return localStorage.getItem(e) || "";
28
31
  },
@@ -32,7 +35,7 @@ const X = {
32
35
  remove(e) {
33
36
  localStorage.removeItem(e);
34
37
  }
35
- }, Y = {
38
+ }, Z = {
36
39
  get(e) {
37
40
  try {
38
41
  if (m.wx) return wx.getStorageSync(e) || "";
@@ -56,15 +59,15 @@ const X = {
56
59
  }
57
60
  }
58
61
  }, _ = "gamer_token";
59
- class Xt {
62
+ class Yt {
60
63
  constructor(t, r) {
61
64
  u(this, "$idToken", "");
62
65
  u(this, "$weixinToken", "");
63
66
  u(this, "$gamerToken", "");
64
67
  u(this, "req");
65
68
  u(this, "storage");
66
- this.storage = m.wx ? Y : X, this.req = r({
67
- baseURL: `https://${j(t)}/v1`,
69
+ this.storage = m.wx ? Z : Y, this.req = r({
70
+ baseURL: O(t) ? t : `https://${j(t)}/v1`,
68
71
  timeout: 1e4,
69
72
  responseRule: {
70
73
  ok: { resolve: "body" },
@@ -191,7 +194,7 @@ class Xt {
191
194
  return r;
192
195
  }
193
196
  }
194
- function Z(e) {
197
+ function W(e) {
195
198
  return n(
196
199
  e,
197
200
  "default_avatar_url",
@@ -209,7 +212,7 @@ function Z(e) {
209
212
  (t) => n(t, "exp", "level", "title")
210
213
  );
211
214
  }
212
- function W(e) {
215
+ function ee(e) {
213
216
  return n(
214
217
  e,
215
218
  "member_id",
@@ -224,7 +227,7 @@ function W(e) {
224
227
  ) && typeof e.player_id == "string";
225
228
  }
226
229
  function C(e) {
227
- return n(e, "player") && W(e.player);
230
+ return n(e, "player") && ee(e.player);
228
231
  }
229
232
  function S(e) {
230
233
  return n(
@@ -237,14 +240,14 @@ function S(e) {
237
240
  "last_login_time"
238
241
  ) && z(e.server_id) && J(e.role_id);
239
242
  }
240
- function ee(e) {
241
- return n(e, "roles") && a(e.roles, S);
242
- }
243
243
  function te(e) {
244
+ return n(e, "roles") && o(e.roles, S);
245
+ }
246
+ function re(e) {
244
247
  return S(e) && n(e, "role_fighting");
245
248
  }
246
249
  function f(e) {
247
- return n(e, "role_card") && te(e.role_card);
250
+ return n(e, "role_card") && re(e.role_card);
248
251
  }
249
252
  function U(e) {
250
253
  return n(e, "name", "avatar_url", "bio", "gender", "birthday") && n(e.birthday, "year", "month", "day");
@@ -262,10 +265,10 @@ function v(e) {
262
265
  "is_default"
263
266
  );
264
267
  }
265
- function re(e) {
266
- return n(e, "addresses") && a(e.addresses, v);
267
- }
268
268
  function ne(e) {
269
+ return n(e, "addresses") && o(e.addresses, v);
270
+ }
271
+ function ie(e) {
269
272
  return n(
270
273
  e,
271
274
  "increased_credit",
@@ -274,7 +277,7 @@ function ne(e) {
274
277
  "balance_credit"
275
278
  );
276
279
  }
277
- function ie(e) {
280
+ function se(e) {
278
281
  return n(
279
282
  e,
280
283
  "id",
@@ -285,10 +288,10 @@ function ie(e) {
285
288
  "change_scene"
286
289
  );
287
290
  }
288
- function se(e) {
289
- return n(e, "credit_logs") && a(e.credit_logs, ie);
290
- }
291
291
  function oe(e) {
292
+ return n(e, "credit_logs") && o(e.credit_logs, se);
293
+ }
294
+ function ae(e) {
292
295
  return n(
293
296
  e,
294
297
  "benefit_id",
@@ -301,10 +304,10 @@ function oe(e) {
301
304
  "tag"
302
305
  );
303
306
  }
304
- function ae(e) {
305
- return n(e, "benefits") && a(e.benefits, oe);
306
- }
307
307
  function ue(e) {
308
+ return n(e, "benefits") && o(e.benefits, ae);
309
+ }
310
+ function ce(e) {
308
311
  return n(
309
312
  e,
310
313
  "benefit_id",
@@ -316,8 +319,8 @@ function ue(e) {
316
319
  "product_id"
317
320
  ) && ("product" in e ? D(e.product) : !0);
318
321
  }
319
- function ce(e) {
320
- return n(e, "benefit") && ue(e.benefit);
322
+ function me(e) {
323
+ return n(e, "benefit") && ce(e.benefit);
321
324
  }
322
325
  function D(e) {
323
326
  return n(
@@ -348,10 +351,10 @@ function D(e) {
348
351
  "updated_at"
349
352
  );
350
353
  }
351
- function me(e) {
352
- return n(e, "products") && a(e.products, D);
353
- }
354
354
  function le(e) {
355
+ return n(e, "products") && o(e.products, D);
356
+ }
357
+ function _e(e) {
355
358
  return n(
356
359
  e,
357
360
  "redemption_id",
@@ -366,9 +369,9 @@ function le(e) {
366
369
  "amount",
367
370
  "status",
368
371
  "created_at"
369
- ) && ("extra_data" in e ? _e(e.extra_data) || ge(e.extra_data) : !0);
372
+ ) && ("extra_data" in e ? ge(e.extra_data) || de(e.extra_data) : !0);
370
373
  }
371
- function _e(e) {
374
+ function ge(e) {
372
375
  return n(
373
376
  e,
374
377
  "address",
@@ -381,14 +384,14 @@ function _e(e) {
381
384
  "express_number"
382
385
  );
383
386
  }
384
- function ge(e) {
387
+ function de(e) {
385
388
  return n(e, "server_id", "role_id", "role_name");
386
389
  }
387
- function de(e) {
388
- return n(e, "redemptions") && a(e.redemptions, le);
390
+ function pe(e) {
391
+ return n(e, "redemptions") && o(e.redemptions, _e);
389
392
  }
390
- var pe = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Male = "male", e.Female = "female", e))(pe || {}), fe = /* @__PURE__ */ ((e) => (e.Increase = "increase", e.Decrease = "decrease", e.Expired = "expired", e))(fe || {}), ye = /* @__PURE__ */ ((e) => (e.Order = "order", e.Consumption = "consumption", e.Redeem = "redeem", e.Expire = "expire", e.Admin = "admin", e.Event = "event", e))(ye || {}), we = /* @__PURE__ */ ((e) => (e.GameReward = "game_reward", e.Physical = "physical", e.Virtual = "virtual", e))(we || {}), he = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.issued = "issued", e.failed = "failed", e))(he || {});
391
- class Yt {
393
+ var fe = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Male = "male", e.Female = "female", e))(fe || {}), we = /* @__PURE__ */ ((e) => (e.Increase = "increase", e.Decrease = "decrease", e.Expired = "expired", e))(we || {}), ye = /* @__PURE__ */ ((e) => (e.Order = "order", e.Consumption = "consumption", e.Redeem = "redeem", e.Expire = "expire", e.Admin = "admin", e.Event = "event", e))(ye || {}), he = /* @__PURE__ */ ((e) => (e.GameReward = "game_reward", e.Physical = "physical", e.Virtual = "virtual", e))(he || {}), ve = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.issued = "issued", e.failed = "failed", e))(ve || {});
394
+ class Zt {
392
395
  constructor(t) {
393
396
  u(this, "token");
394
397
  u(this, "req");
@@ -400,7 +403,7 @@ class Yt {
400
403
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
401
404
  */
402
405
  async getConfig() {
403
- const { data: t } = await this.req.get("club/config", Z);
406
+ const { data: t } = await this.req.get("club/config", W);
404
407
  return t;
405
408
  }
406
409
  /**
@@ -438,7 +441,7 @@ class Yt {
438
441
  */
439
442
  async getRoles(t, r) {
440
443
  if (!await this.token.autoLogin()) return [];
441
- const { data: i } = await this.req.get("club/roles", ee, {
444
+ const { data: i } = await this.req.get("club/roles", te, {
442
445
  params: s({ player_id: t, refresh: r })
443
446
  });
444
447
  return (i == null ? void 0 : i.roles) || [];
@@ -504,7 +507,7 @@ class Yt {
504
507
  */
505
508
  async getAddresses() {
506
509
  if (!await this.token.autoLogin()) return [];
507
- const { data: t } = await this.req.get("club/addresses", re);
510
+ const { data: t } = await this.req.get("club/addresses", ne);
508
511
  return (t == null ? void 0 : t.addresses) ?? [];
509
512
  }
510
513
  /**
@@ -544,7 +547,7 @@ class Yt {
544
547
  */
545
548
  async getUserCredit(t) {
546
549
  await this.token.autoLogin();
547
- const { data: r, code: i } = await this.req.get("club/user-credit", ne, { params: s(t) });
550
+ const { data: r, code: i } = await this.req.get("club/user-credit", ie, { params: s(t) });
548
551
  return r ?? { error: i };
549
552
  }
550
553
  /**
@@ -554,7 +557,7 @@ class Yt {
554
557
  */
555
558
  async getCreditLogs(t) {
556
559
  await this.token.autoLogin();
557
- const { data: r } = await this.req.get("club/credit-logs", se, {
560
+ const { data: r } = await this.req.get("club/credit-logs", oe, {
558
561
  params: s({ max_results: 20, ...t })
559
562
  });
560
563
  return r || { credit_logs: [] };
@@ -566,7 +569,7 @@ class Yt {
566
569
  */
567
570
  async getBenefits() {
568
571
  if (!await this.token.autoLogin()) return [];
569
- const { data: t } = await this.req.get("club/benefits", ae);
572
+ const { data: t } = await this.req.get("club/benefits", ue);
570
573
  return (t == null ? void 0 : t.benefits) || [];
571
574
  }
572
575
  /**
@@ -576,7 +579,7 @@ class Yt {
576
579
  */
577
580
  async getBenefit(t) {
578
581
  if (!await this.token.autoLogin()) return null;
579
- const { data: r } = await this.req.get("club/benefit", ce, {
582
+ const { data: r } = await this.req.get("club/benefit", me, {
580
583
  params: { benefit_id: t }
581
584
  });
582
585
  return (r == null ? void 0 : r.benefit) || null;
@@ -587,7 +590,7 @@ class Yt {
587
590
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=r3vC3PzfMQ
588
591
  */
589
592
  async getProducts() {
590
- const { data: t } = await this.req.get("club/products", me);
593
+ const { data: t } = await this.req.get("club/products", le);
591
594
  return (t == null ? void 0 : t.products) || [];
592
595
  }
593
596
  /**
@@ -609,51 +612,51 @@ class Yt {
609
612
  */
610
613
  async getRedemptions(t) {
611
614
  await this.token.autoLogin();
612
- const { data: r } = await this.req.get("club/redemptions", de, {
615
+ const { data: r } = await this.req.get("club/redemptions", pe, {
613
616
  params: s({ max_results: 20, ...t })
614
617
  });
615
618
  return r || { redemptions: [] };
616
619
  }
617
620
  }
618
- var ve = /* @__PURE__ */ ((e) => (e.EventItem = "event_item", e.GameItem = "game_item", e.PhysicalItem = "physical_item", e.WeixinHongbao = "weixin_hongbao", e.GiftCode = "gift_code", e.LotteryTicket = "lottery_ticket", e.VoidItem = "void_item", e))(ve || {}), ke = /* @__PURE__ */ ((e) => (e.UserId = "user_id", e.RoleId = "role_id", e))(ke || {}), be = /* @__PURE__ */ ((e) => (e.None = "none", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e))(be || {}), o = /* @__PURE__ */ ((e) => (e.Preregister = "preregister", e.Lottery = "lottery", e.Survey = "survey", e.Invite = "invite", e.Share = "share", e.Follow = "follow", e.Subscribe = "weixin_subscribe", e.Comment = "comment", e.Vote = "vote", e.GiftCode = "gift_code", e.Register = "register", e.InvitedRegister = "invited_register", e.ClaimRewards = "claim_rewards", e.Cashback = "cashback", e.Quest = "quest", e.Team = "team", e.LotteryDraw = "lottery_draw", e))(o || {}), qe = /* @__PURE__ */ ((e) => (e.Active = "player_active_points", e.Login = "player_login_days", e.OrderAmount = "order_total_amount", e.Posts = "community_posts", e.Comments = "community_comments", e))(qe || {}), Re = /* @__PURE__ */ ((e) => (e.System = "system", e.UserSubmission = "user_submission", e.Shortlisted = "shortlisted", e))(Re || {}), xe = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e))(xe || {}), Ae = /* @__PURE__ */ ((e) => (e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Ae || {}), Le = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e))(Le || {}), Ce = /* @__PURE__ */ ((e) => (e.Output = "output", e.Engage = "engage", e))(Ce || {}), Ue = /* @__PURE__ */ ((e) => (e.Private = "private", e.Public = "public", e))(Ue || {}), Pe = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Pending = "pending", e.Drawn = "drawn", e.Claimed = "claimed", e.Fail = "fail", e))(Pe || {}), $e = /* @__PURE__ */ ((e) => (e.Assemble = "assemble", e.Join = "join", e.Disband = "disband", e.ChangeVisibility = "change_visibility", e.Query = "query", e))($e || {}), Se = /* @__PURE__ */ ((e) => (e.Query = "query", e.Draw = "draw", e.Claim = "claim", e))(Se || {});
619
- function De(e) {
620
- return n(e, "event_name", "rules", "since", "until", "features") && Array.isArray(e.features) && e.features.every(Ee);
621
- }
621
+ var ke = /* @__PURE__ */ ((e) => (e.EventItem = "event_item", e.GameItem = "game_item", e.PhysicalItem = "physical_item", e.WeixinHongbao = "weixin_hongbao", e.GiftCode = "gift_code", e.LotteryTicket = "lottery_ticket", e.VoidItem = "void_item", e))(ke || {}), be = /* @__PURE__ */ ((e) => (e.UserId = "user_id", e.RoleId = "role_id", e))(be || {}), qe = /* @__PURE__ */ ((e) => (e.None = "none", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e))(qe || {}), a = /* @__PURE__ */ ((e) => (e.Preregister = "preregister", e.Lottery = "lottery", e.Survey = "survey", e.Invite = "invite", e.Share = "share", e.Follow = "follow", e.Subscribe = "weixin_subscribe", e.Comment = "comment", e.Vote = "vote", e.GiftCode = "gift_code", e.Register = "register", e.InvitedRegister = "invited_register", e.ClaimRewards = "claim_rewards", e.Cashback = "cashback", e.Quest = "quest", e.Team = "team", e.LotteryDraw = "lottery_draw", e))(a || {}), Re = /* @__PURE__ */ ((e) => (e.Active = "player_active_points", e.Login = "player_login_days", e.OrderAmount = "order_total_amount", e.Posts = "community_posts", e.Comments = "community_comments", e))(Re || {}), xe = /* @__PURE__ */ ((e) => (e.System = "system", e.UserSubmission = "user_submission", e.Shortlisted = "shortlisted", e))(xe || {}), Ae = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e))(Ae || {}), Le = /* @__PURE__ */ ((e) => (e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Le || {}), Ce = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e))(Ce || {}), Ue = /* @__PURE__ */ ((e) => (e.Output = "output", e.Engage = "engage", e))(Ue || {}), $e = /* @__PURE__ */ ((e) => (e.Private = "private", e.Public = "public", e))($e || {}), Pe = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Pending = "pending", e.Drawn = "drawn", e.Claimed = "claimed", e.Fail = "fail", e))(Pe || {}), Se = /* @__PURE__ */ ((e) => (e.Assemble = "assemble", e.Join = "join", e.Disband = "disband", e.ChangeVisibility = "change_visibility", e.Query = "query", e))(Se || {}), De = /* @__PURE__ */ ((e) => (e.Query = "query", e.Draw = "draw", e.Claim = "claim", e))(De || {});
622
622
  function Ee(e) {
623
- if (!Fe(e))
623
+ return n(e, "event_name", "rules", "since", "until", "features") && Array.isArray(e.features) && e.features.every(Ge);
624
+ }
625
+ function Ge(e) {
626
+ if (!Ie(e))
624
627
  return !1;
625
628
  switch (e.feature_type) {
626
- case o.Preregister:
627
- case o.ClaimRewards:
628
- case o.Register:
629
- case o.InvitedRegister:
629
+ case a.Preregister:
630
+ case a.ClaimRewards:
631
+ case a.Register:
632
+ case a.InvitedRegister:
630
633
  return !0;
631
- case o.Lottery:
632
- return Be(e.config);
633
- case o.Survey:
634
+ case a.Lottery:
634
635
  return Ve(e.config);
635
- case o.Invite:
636
+ case a.Survey:
636
637
  return Qe(e.config);
637
- case o.Share:
638
+ case a.Invite:
638
639
  return Te(e.config);
639
- case o.Follow:
640
+ case a.Share:
640
641
  return Me(e.config);
641
- case o.Subscribe:
642
+ case a.Follow:
642
643
  return He(e.config);
643
- case o.Comment:
644
+ case a.Subscribe:
644
645
  return je(e.config);
645
- case o.Vote:
646
+ case a.Comment:
646
647
  return ze(e.config);
647
- case o.Cashback:
648
- return Ke(e.config);
649
- case o.GiftCode:
648
+ case a.Vote:
649
+ return Je(e.config);
650
+ case a.Cashback:
650
651
  return Ne(e.config);
651
- case o.Quest:
652
- return Xe(e.config);
653
- case o.Team:
652
+ case a.GiftCode:
653
+ return Oe(e.config);
654
+ case a.Quest:
654
655
  return Ye(e.config);
655
- case o.LotteryDraw:
656
+ case a.Team:
656
657
  return Ze(e.config);
658
+ case a.LotteryDraw:
659
+ return We(e.config);
657
660
  default:
658
661
  return !1;
659
662
  }
@@ -665,13 +668,14 @@ function k(e) {
665
668
  "reward_amount",
666
669
  "reward_item_name",
667
670
  "reward_item_icon_url",
668
- "reward_item_type"
671
+ "reward_item_type",
672
+ "reward_item_rating"
669
673
  );
670
674
  }
671
- function Ge(e) {
675
+ function Fe(e) {
672
676
  return n(e, "feature_reward_type", "reward_details") && (e.feature_reward_type === "every" ? Array.isArray(e.reward_details) && e.reward_details.every(k) : e.feature_reward_type === "regular" ? n(e.reward_details, "engage_count", "rewards") && Array.isArray(e.reward_details.rewards) && e.reward_details.rewards.every(k) : !1);
673
677
  }
674
- function Fe(e) {
678
+ function Ie(e) {
675
679
  return n(
676
680
  e,
677
681
  "feature_id",
@@ -682,11 +686,10 @@ function Fe(e) {
682
686
  "limit",
683
687
  "since",
684
688
  "until",
685
- "engage_account_type",
686
- "feature_rewards"
687
- ) && Array.isArray(e.feature_rewards) && e.feature_rewards.every(Ge);
689
+ "engage_account"
690
+ ) && ("feature_rewards" in e ? o(e.feature_rewards, Fe) : !0);
688
691
  }
689
- function Ie(e) {
692
+ function Be(e) {
690
693
  return n(
691
694
  e,
692
695
  "reward_item_id",
@@ -697,7 +700,7 @@ function Ie(e) {
697
700
  "reward_remaining_stock"
698
701
  );
699
702
  }
700
- function Be(e) {
703
+ function Ve(e) {
701
704
  return n(
702
705
  e,
703
706
  "consume_item_id",
@@ -705,27 +708,27 @@ function Be(e) {
705
708
  "consume_item_icon_url",
706
709
  "consume_item_count",
707
710
  "rewards"
708
- ) && Array.isArray(e.rewards) && e.rewards.every(Ie);
711
+ ) && Array.isArray(e.rewards) && e.rewards.every(Be);
709
712
  }
710
- function Ve(e) {
713
+ function Qe(e) {
711
714
  return n(e, "survey_id", "survey_url");
712
715
  }
713
- function Qe(e) {
716
+ function Te(e) {
714
717
  return n(e, "share_url");
715
718
  }
716
- function Te(e) {
719
+ function Me(e) {
717
720
  return n(e, "share_platform");
718
721
  }
719
- function Me(e) {
722
+ function He(e) {
720
723
  return n(e, "platform");
721
724
  }
722
- function He(e) {
725
+ function je(e) {
723
726
  return n(e, "weixin_template_ids") && Array.isArray(e.weixin_template_ids) && e.weixin_template_ids.every((t) => typeof t == "string");
724
727
  }
725
- function je(e) {
728
+ function ze(e) {
726
729
  return n(e, "comments", "send_rate") && Array.isArray(e.comments) && e.comments.every((t) => typeof t == "string");
727
730
  }
728
- function ze(e) {
731
+ function Je(e) {
729
732
  return n(
730
733
  e,
731
734
  "vote_feature_ids",
@@ -734,12 +737,12 @@ function ze(e) {
734
737
  "source",
735
738
  "options",
736
739
  "rewards"
737
- ) && Array.isArray(e.vote_feature_ids) && Array.isArray(e.submission_feature_ids) && Array.isArray(e.options) && e.options.every(Je) && Array.isArray(e.rewards) && e.rewards.every(k);
740
+ ) && Array.isArray(e.vote_feature_ids) && Array.isArray(e.submission_feature_ids) && Array.isArray(e.options) && e.options.every(Ke) && Array.isArray(e.rewards) && e.rewards.every(k);
738
741
  }
739
- function Je(e) {
742
+ function Ke(e) {
740
743
  return n(e, "sn", "name", "amount", "jump_url", "last_vote_time", "finalists") && ("img_urls" in e ? Array.isArray(e.img_urls) : !0) && ("video_urls" in e ? Array.isArray(e.video_urls) : !0) && ("descriptions" in e ? Array.isArray(e.descriptions) : !0);
741
744
  }
742
- function Ke(e) {
745
+ function Ne(e) {
743
746
  return n(
744
747
  e,
745
748
  "order_start_time",
@@ -748,40 +751,40 @@ function Ke(e) {
748
751
  "claim_rewards_end_time"
749
752
  );
750
753
  }
751
- function Ne(e) {
752
- return n(e, "gift_items") && Array.isArray(e.gift_items) && e.gift_items.every(Oe);
753
- }
754
754
  function Oe(e) {
755
- return n(e, "name", "count", "icon_url");
755
+ return n(e, "gift_items") && Array.isArray(e.gift_items) && e.gift_items.every(Xe);
756
756
  }
757
757
  function Xe(e) {
758
- return n(e, "objective", "completion_value") && ("team" in e ? n(e.team, "completion_value") : !0);
758
+ return n(e, "name", "count", "icon_url");
759
759
  }
760
760
  function Ye(e) {
761
- return n(e, "min_members", "max_members");
761
+ return n(e, "objective", "completion_value") && ("team" in e ? n(e.team, "completion_value") : !0);
762
762
  }
763
763
  function Ze(e) {
764
- return n(e, "draw_not_after", "draw_not_before");
764
+ return n(e, "min_members", "max_members");
765
765
  }
766
766
  function We(e) {
767
+ return n(e, "draw_not_after", "draw_not_before");
768
+ }
769
+ function et(e) {
767
770
  return n(e, "allowed", "registered");
768
771
  }
769
- function y(e) {
772
+ function w(e) {
770
773
  return n(e, "count");
771
774
  }
772
- function et(e) {
775
+ function tt(e) {
773
776
  return n(e, "engagements") && Array.isArray(e.engagements) && (e.engagements.every(
774
777
  (t) => n(t, "user_id", "name", "avatar_url", "comment", "video_note", "created_at")
775
778
  ) || e.engagements.every((t) => n(t, "team_code", "leader_name", "total_members")));
776
779
  }
777
- function tt(e) {
780
+ function rt(e) {
778
781
  return n(e, "first_visit") && typeof e.first_visit == "boolean";
779
782
  }
780
- function rt(e) {
783
+ function nt(e) {
781
784
  return n(e, "status") && Array.isArray(e.status) && e.status.every((t) => n(t, "feature_id", "can_engage", "has_unclaimed_rewards"));
782
785
  }
783
- function nt(e) {
784
- return n(e, "engagements") && a(e.engagements, E);
786
+ function it(e) {
787
+ return n(e, "engagements") && o(e.engagements, E);
785
788
  }
786
789
  function E(e) {
787
790
  if (!n(
@@ -791,6 +794,11 @@ function E(e) {
791
794
  "feature_id",
792
795
  "reward_id",
793
796
  "reward_status",
797
+ "reward_item_amount",
798
+ "reward_item_name",
799
+ "reward_item_desc",
800
+ "reward_item_icon_url",
801
+ "reward_item_rating",
794
802
  "reward_source",
795
803
  "created_at"
796
804
  ))
@@ -798,41 +806,41 @@ function E(e) {
798
806
  if (!("data" in e))
799
807
  return !0;
800
808
  const t = e.data;
801
- return it(t) || st(t) || ot(t) || at(t) || ut(t) || ct(t) || mt(t) || lt(t) || _t(t) || gt(t) || dt(t) || pt(t);
809
+ return st(t) || ot(t) || at(t) || ut(t) || ct(t) || mt(t) || lt(t) || _t(t) || gt(t) || dt(t) || pt(t) || ft(t);
802
810
  }
803
- function it(e) {
811
+ function st(e) {
804
812
  return n(e, "platforms") && Array.isArray(e.platforms);
805
813
  }
806
- function st(e) {
814
+ function ot(e) {
807
815
  return n(e, "lottery_count");
808
816
  }
809
- function ot(e) {
817
+ function at(e) {
810
818
  return n(e, "serial_number");
811
819
  }
812
- function at(e) {
820
+ function ut(e) {
813
821
  return n(e, "user_id");
814
822
  }
815
- function ut(e) {
823
+ function ct(e) {
816
824
  return n(e, "platform");
817
825
  }
818
- function ct(e) {
826
+ function mt(e) {
819
827
  return n(e, "option_sn");
820
828
  }
821
- function mt(e) {
829
+ function lt(e) {
822
830
  return n(e, "weixin_openid");
823
831
  }
824
- function lt(e) {
832
+ function _t(e) {
825
833
  return n(e, "cashback_total_amount", "game_item_count", "order_total_amount");
826
834
  }
827
- function _t(e) {
835
+ function gt(e) {
828
836
  return n(e, "gift_code");
829
837
  }
830
- function gt(e) {
838
+ function dt(e) {
831
839
  return n(e, "team_code", "visibility", "members") && Array.isArray(e.members) && e.members.every(
832
840
  (t) => n(t, "is_leader", "role_name", "server_name")
833
841
  );
834
842
  }
835
- function dt(e) {
843
+ function pt(e) {
836
844
  return n(e, "objective", "progress") ? "team" in e ? n(e.team, "progress", "players") && Array.isArray(e.team.players) && e.team.players.every(
837
845
  (t) => n(
838
846
  t,
@@ -861,10 +869,10 @@ function G(e) {
861
869
  "receive_time"
862
870
  ) && ("extra_data" in e ? n(e.extra_data) : !0);
863
871
  }
864
- function pt(e) {
872
+ function ft(e) {
865
873
  return !n(e, "tickets") || !("status" in e) ? !1 : e.status === "unknown" || e.status === "pending" ? !0 : "reward" in e ? G(e.reward) : !1;
866
874
  }
867
- function ft(e) {
875
+ function wt(e) {
868
876
  return n(
869
877
  e,
870
878
  "reward_id",
@@ -878,30 +886,30 @@ function ft(e) {
878
886
  );
879
887
  }
880
888
  function yt(e) {
881
- return n(e, "engagement_id") && ("engagement" in e ? E(e.engagement) : !0) && ("rewards" in e ? a(e.rewards, ft) : !0);
882
- }
883
- function wt(e) {
884
- return n(e, "reward_id", "reward_status");
889
+ return n(e, "engagement_id") && ("engagement" in e ? E(e.engagement) : !0) && ("rewards" in e ? o(e.rewards, wt) : !0);
885
890
  }
886
891
  function ht(e) {
887
- return n(e, "claimed_items") && a(e.claimed_items, wt);
892
+ return n(e, "reward_id", "reward_status");
888
893
  }
889
894
  function vt(e) {
890
- return n(e, "reward_status");
895
+ return n(e, "claimed_items") && o(e.claimed_items, ht);
891
896
  }
892
897
  function kt(e) {
893
- return n(e, "user_rewards") && a(e.user_rewards, G);
898
+ return n(e, "reward_status");
894
899
  }
895
900
  function bt(e) {
896
- return n(e, "scene");
901
+ return n(e, "user_rewards") && o(e.user_rewards, G);
897
902
  }
898
903
  function qt(e) {
899
- return n(e, "params");
904
+ return n(e, "scene");
900
905
  }
901
906
  function Rt(e) {
907
+ return n(e, "params");
908
+ }
909
+ function xt(e) {
902
910
  return n(e, "img") && typeof e.img == "string";
903
911
  }
904
- class Zt {
912
+ class Wt {
905
913
  constructor(t, r) {
906
914
  u(this, "token");
907
915
  u(this, "event", 0);
@@ -914,7 +922,7 @@ class Zt {
914
922
  * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OWGSPF3Ysl
915
923
  */
916
924
  async verifyMobileAllowed(t) {
917
- const { data: r } = await this.req.get("verify-mobile-allowed", We, {
925
+ const { data: r } = await this.req.get("verify-mobile-allowed", et, {
918
926
  params: { mobile: t }
919
927
  });
920
928
  return r;
@@ -925,7 +933,7 @@ class Zt {
925
933
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=wFXxtdNKPm
926
934
  */
927
935
  async getConfig() {
928
- const { data: t } = await this.req.get(`event/${this.event}/event-config`, De);
936
+ const { data: t } = await this.req.get(`event/${this.event}/event-config`, Ee);
929
937
  return t;
930
938
  }
931
939
  /**
@@ -934,7 +942,7 @@ class Zt {
934
942
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
935
943
  */
936
944
  async getEngagementsUserCount(t) {
937
- const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, y, {
945
+ const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, w, {
938
946
  params: { feature_id: t, type: "user" }
939
947
  });
940
948
  return (r == null ? void 0 : r.count) ?? null;
@@ -945,7 +953,7 @@ class Zt {
945
953
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
946
954
  */
947
955
  async getEngagementsCount(t) {
948
- const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, y, {
956
+ const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, w, {
949
957
  params: { feature_id: t, type: "engagement" }
950
958
  });
951
959
  return (r == null ? void 0 : r.count) ?? null;
@@ -956,7 +964,7 @@ class Zt {
956
964
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=THtZ4ewIQW
957
965
  */
958
966
  async getEngagements(t) {
959
- const { data: r } = await this.req.get(`event/${this.event}/feature-engagements`, et, {
967
+ const { data: r } = await this.req.get(`event/${this.event}/feature-engagements`, tt, {
960
968
  params: { feature_id: t }
961
969
  });
962
970
  return (r == null ? void 0 : r.engagements) || [];
@@ -971,7 +979,7 @@ class Zt {
971
979
  const { data: r, code: i } = await this.req.post(
972
980
  `event/${this.event}/visit`,
973
981
  s(t || {}),
974
- tt
982
+ rt
975
983
  );
976
984
  return r ?? {
977
985
  error: i
@@ -986,7 +994,7 @@ class Zt {
986
994
  */
987
995
  async getUserFeatureStatus(t) {
988
996
  if (!await this.token.autoLogin()) return [];
989
- const { data: r } = await this.req.get("event/user-feature-status", rt, {
997
+ const { data: r } = await this.req.get("event/user-feature-status", nt, {
990
998
  params: s({ ...t, event_id: this.event }),
991
999
  message: !1
992
1000
  });
@@ -999,7 +1007,7 @@ class Zt {
999
1007
  */
1000
1008
  async getUserEngagements(t) {
1001
1009
  if (!await this.token.autoLogin()) return [];
1002
- const { data: r } = await this.req.get(`event/${this.event}/user-engagements`, nt, {
1010
+ const { data: r } = await this.req.get(`event/${this.event}/user-engagements`, it, {
1003
1011
  params: { feature_id: t }
1004
1012
  });
1005
1013
  return (r == null ? void 0 : r.engagements) || [];
@@ -1026,7 +1034,7 @@ class Zt {
1026
1034
  const { data: r, code: i } = await this.req.post(
1027
1035
  `event/${this.event}/claim-rewards`,
1028
1036
  s(t),
1029
- ht
1037
+ vt
1030
1038
  );
1031
1039
  return (r == null ? void 0 : r.claimed_items) ?? {
1032
1040
  error: i
@@ -1042,7 +1050,7 @@ class Zt {
1042
1050
  const { data: r, code: i } = await this.req.post(
1043
1051
  `event/${this.event}/claim-weixin-hongbao`,
1044
1052
  { reward_id: t },
1045
- vt
1053
+ kt
1046
1054
  );
1047
1055
  return r ?? {
1048
1056
  error: i
@@ -1058,7 +1066,7 @@ class Zt {
1058
1066
  const { data: r } = await this.req.post(
1059
1067
  "event/user-rewards",
1060
1068
  s({ ...t, event_id: this.event }),
1061
- kt
1069
+ bt
1062
1070
  );
1063
1071
  return (r == null ? void 0 : r.user_rewards) || [];
1064
1072
  }
@@ -1069,7 +1077,7 @@ class Zt {
1069
1077
  */
1070
1078
  async getUserItemCount(t) {
1071
1079
  if (!await this.token.autoLogin()) return null;
1072
- const { data: r } = await this.req.get(`event/${this.event}/user-item-count`, y, {
1080
+ const { data: r } = await this.req.get(`event/${this.event}/user-item-count`, w, {
1073
1081
  params: { item_id: t }
1074
1082
  });
1075
1083
  return (r == null ? void 0 : r.count) ?? null;
@@ -1093,7 +1101,7 @@ class Zt {
1093
1101
  */
1094
1102
  async getUnlimitQrcodeScene(t) {
1095
1103
  if (!await this.token.autoLogin()) return null;
1096
- const { data: r } = await this.req.get("event/unlimit-qrcode-scene", bt, {
1104
+ const { data: r } = await this.req.get("event/unlimit-qrcode-scene", qt, {
1097
1105
  params: { params: t }
1098
1106
  });
1099
1107
  return (r == null ? void 0 : r.scene) ?? null;
@@ -1106,7 +1114,7 @@ class Zt {
1106
1114
  * @param scene - 小程序码 scene 值
1107
1115
  */
1108
1116
  async getParamsByQrcodeScene(t) {
1109
- const { data: r } = await this.req.get("event/params-by-qrcode-scene", qt, {
1117
+ const { data: r } = await this.req.get("event/params-by-qrcode-scene", Rt, {
1110
1118
  params: { scene: t }
1111
1119
  });
1112
1120
  return (r == null ? void 0 : r.params) ?? null;
@@ -1118,23 +1126,23 @@ class Zt {
1118
1126
  */
1119
1127
  async generateUnlimitQrcode(t) {
1120
1128
  if (!await this.token.autoLogin()) return null;
1121
- const { data: r } = await this.req.post("event/unlimit-qrcode", s(t), Rt);
1129
+ const { data: r } = await this.req.post("event/unlimit-qrcode", s(t), xt);
1122
1130
  return (r == null ? void 0 : r.img) ?? null;
1123
1131
  }
1124
1132
  }
1125
1133
  function F(e) {
1126
1134
  return n(e, "forum_id", "icon_url", "name", "tags", "sort", "mode", "member_ids") && Array.isArray(e.tags) && Array.isArray(e.member_ids);
1127
1135
  }
1128
- function xt(e) {
1129
- return n(e, "forums") && a(e.forums, F);
1136
+ function At(e) {
1137
+ return n(e, "forums") && o(e.forums, F);
1130
1138
  }
1131
1139
  function b(e) {
1132
1140
  return n(e, "topic_id", "cover_url", "name", "description", "tags", "post_num") && Array.isArray(e.tags);
1133
1141
  }
1134
- function At(e) {
1135
- return n(e, "topics") && a(e.topics, b);
1136
- }
1137
1142
  function Lt(e) {
1143
+ return n(e, "topics") && o(e.topics, b);
1144
+ }
1145
+ function Ct(e) {
1138
1146
  return n(e, "topic") && b(e.topic);
1139
1147
  }
1140
1148
  function q(e) {
@@ -1157,18 +1165,18 @@ function q(e) {
1157
1165
  "is_highlighted",
1158
1166
  "status",
1159
1167
  "create_time"
1160
- ) && a(e.topics, b) && F(e.forum);
1168
+ ) && o(e.topics, b) && F(e.forum);
1161
1169
  }
1162
- function P(e) {
1163
- return n(e, "next_token", "posts") && a(e.posts, q);
1170
+ function $(e) {
1171
+ return n(e, "next_token", "posts") && o(e.posts, q);
1164
1172
  }
1165
- function Ct(e) {
1173
+ function Ut(e) {
1166
1174
  return n(e, "post") && q(e.post);
1167
1175
  }
1168
1176
  function R(e) {
1169
1177
  return n(e);
1170
1178
  }
1171
- function Ut(e) {
1179
+ function $t(e) {
1172
1180
  return n(e) && ("post" in e ? q(e.post) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1173
1181
  }
1174
1182
  function g(e) {
@@ -1186,13 +1194,13 @@ function g(e) {
1186
1194
  "image_url",
1187
1195
  "create_time",
1188
1196
  "status"
1189
- ) && ("replies" in e ? a(e.replies, x) : !0);
1197
+ ) && ("replies" in e ? o(e.replies, x) : !0);
1190
1198
  }
1191
1199
  function Pt(e) {
1192
1200
  return n(e, "comment") && g(e.comment);
1193
1201
  }
1194
- function $t(e) {
1195
- return n(e, "comments") && a(e.comments, g);
1202
+ function St(e) {
1203
+ return n(e, "comments") && o(e.comments, g);
1196
1204
  }
1197
1205
  function x(e) {
1198
1206
  return n(
@@ -1207,27 +1215,27 @@ function x(e) {
1207
1215
  "liked",
1208
1216
  "reply_to",
1209
1217
  "create_time"
1210
- ) && St(e.reply_to);
1211
- }
1212
- function St(e) {
1213
- return n(e, "reply_id", "replied_by", "avatar_url", "nickname");
1218
+ ) && Dt(e.reply_to);
1214
1219
  }
1215
1220
  function Dt(e) {
1216
- return n(e) && ("comment" in e ? g(e.comment) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1221
+ return n(e, "reply_id", "replied_by", "avatar_url", "nickname");
1217
1222
  }
1218
1223
  function Et(e) {
1219
- return n(e, "replies") && a(e.replies, x);
1224
+ return n(e) && ("comment" in e ? g(e.comment) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1220
1225
  }
1221
1226
  function Gt(e) {
1222
- return n(e, "reply") && x(e.reply);
1227
+ return n(e, "replies") && o(e.replies, x);
1223
1228
  }
1224
1229
  function Ft(e) {
1225
- return n(e) && ("reply" in e ? g(e.comment) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1230
+ return n(e, "reply") && x(e.reply);
1226
1231
  }
1227
1232
  function It(e) {
1228
- return n(e, "image_url", "upload_url", "existed") && typeof e.existed == "boolean";
1233
+ return n(e) && ("reply" in e ? g(e.comment) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1229
1234
  }
1230
1235
  function Bt(e) {
1236
+ return n(e, "image_url", "upload_url", "existed") && typeof e.existed == "boolean";
1237
+ }
1238
+ function Vt(e) {
1231
1239
  return n(
1232
1240
  e,
1233
1241
  "notification_id",
@@ -1239,14 +1247,14 @@ function Bt(e) {
1239
1247
  "origin_user_avatar_url"
1240
1248
  );
1241
1249
  }
1242
- function Vt(e) {
1243
- return n(e, "notifications") && a(e.notifications, Bt);
1244
- }
1245
1250
  function Qt(e) {
1251
+ return n(e, "notifications") && o(e.notifications, Vt);
1252
+ }
1253
+ function Tt(e) {
1246
1254
  return n(e, "system", "comment", "like");
1247
1255
  }
1248
- var Tt = /* @__PURE__ */ ((e) => (e.All = "all", e.Limit = "limit", e))(Tt || {}), Mt = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Approved = "approved", e.Failed = "failed", e.Suspect = "suspect", e))(Mt || {}), Ht = /* @__PURE__ */ ((e) => (e.System = "system", e.Comment = "comment", e.Like = "like", e))(Ht || {}), jt = /* @__PURE__ */ ((e) => (e.System = "system", e.PostPinned = "post_pinned", e.PostHighlighted = "post_highlighted", e.PostDeleted = "post_deleted", e.PostCommented = "post_commented", e.PostLiked = "post_liked", e.CommentReplied = "comment_replied", e.CommentLiked = "comment_liked", e.CommentDeleted = "comment_deleted", e.ReplyReplied = "reply_replied", e.ReplyLiked = "reply_liked", e.ReplyDeleted = "reply_deleted", e))(jt || {});
1249
- class Wt {
1256
+ var Mt = /* @__PURE__ */ ((e) => (e.All = "all", e.Limit = "limit", e))(Mt || {}), Ht = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Approved = "approved", e.Failed = "failed", e.Suspect = "suspect", e))(Ht || {}), jt = /* @__PURE__ */ ((e) => (e.System = "system", e.Comment = "comment", e.Like = "like", e))(jt || {}), zt = /* @__PURE__ */ ((e) => (e.System = "system", e.PostPinned = "post_pinned", e.PostHighlighted = "post_highlighted", e.PostDeleted = "post_deleted", e.PostCommented = "post_commented", e.PostLiked = "post_liked", e.CommentReplied = "comment_replied", e.CommentLiked = "comment_liked", e.CommentDeleted = "comment_deleted", e.ReplyReplied = "reply_replied", e.ReplyLiked = "reply_liked", e.ReplyDeleted = "reply_deleted", e))(zt || {});
1257
+ class er {
1250
1258
  constructor(t) {
1251
1259
  u(this, "token");
1252
1260
  u(this, "req");
@@ -1258,7 +1266,7 @@ class Wt {
1258
1266
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=QaqUa2K0z0
1259
1267
  */
1260
1268
  async getForums() {
1261
- const { data: t } = await this.req.get("community/forums", xt);
1269
+ const { data: t } = await this.req.get("community/forums", At);
1262
1270
  return (t == null ? void 0 : t.forums) || [];
1263
1271
  }
1264
1272
  /**
@@ -1267,7 +1275,7 @@ class Wt {
1267
1275
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=mIwpymAQom
1268
1276
  */
1269
1277
  async getTopics() {
1270
- const { data: t } = await this.req.get("community/topics", At);
1278
+ const { data: t } = await this.req.get("community/topics", Lt);
1271
1279
  return (t == null ? void 0 : t.topics) || [];
1272
1280
  }
1273
1281
  /**
@@ -1276,7 +1284,7 @@ class Wt {
1276
1284
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=Jvw7xMK31K
1277
1285
  */
1278
1286
  async getTopic(t) {
1279
- const { data: r, code: i } = await this.req.get("community/topic", Lt, {
1287
+ const { data: r, code: i } = await this.req.get("community/topic", Ct, {
1280
1288
  params: { topic_id: t }
1281
1289
  });
1282
1290
  return (r == null ? void 0 : r.topic) ?? { error: i };
@@ -1287,7 +1295,7 @@ class Wt {
1287
1295
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
1288
1296
  */
1289
1297
  async getPosts(t) {
1290
- const { data: r, code: i } = await this.req.get("community/posts", P, {
1298
+ const { data: r, code: i } = await this.req.get("community/posts", $, {
1291
1299
  params: s(t)
1292
1300
  });
1293
1301
  return r ?? { error: i };
@@ -1298,7 +1306,7 @@ class Wt {
1298
1306
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
1299
1307
  */
1300
1308
  async getPinnedPosts(t, r, i) {
1301
- const { data: c, code: d } = await this.req.get("community/pinned-posts", P, {
1309
+ const { data: c, code: d } = await this.req.get("community/pinned-posts", $, {
1302
1310
  params: s({ forum_id: t, max_results: r, next_token: i })
1303
1311
  });
1304
1312
  return c ?? { error: d };
@@ -1309,7 +1317,7 @@ class Wt {
1309
1317
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=hj1AZy5rcP
1310
1318
  */
1311
1319
  async getPost(t) {
1312
- const { data: r, code: i } = await this.req.get("community/post", Ct, {
1320
+ const { data: r, code: i } = await this.req.get("community/post", Ut, {
1313
1321
  params: { post_id: t }
1314
1322
  });
1315
1323
  return (r == null ? void 0 : r.post) ?? { error: i };
@@ -1320,7 +1328,7 @@ class Wt {
1320
1328
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=M5okHBuaVk
1321
1329
  */
1322
1330
  async post(t) {
1323
- const { data: r, code: i } = await this.req.post("community/post", s(t), Ut);
1331
+ const { data: r, code: i } = await this.req.post("community/post", s(t), $t);
1324
1332
  return r ?? {
1325
1333
  error: i
1326
1334
  };
@@ -1331,7 +1339,7 @@ class Wt {
1331
1339
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=djKbX7lFdp
1332
1340
  */
1333
1341
  async getComments(t) {
1334
- const { data: r, code: i } = await this.req.get("community/comments", $t, {
1342
+ const { data: r, code: i } = await this.req.get("community/comments", St, {
1335
1343
  params: s(t)
1336
1344
  });
1337
1345
  return r ?? { error: i };
@@ -1354,7 +1362,7 @@ class Wt {
1354
1362
  */
1355
1363
  async comment(t) {
1356
1364
  await this.token.autoLogin();
1357
- const { data: r, code: i } = await this.req.post("community/comment", s(t), Dt);
1365
+ const { data: r, code: i } = await this.req.post("community/comment", s(t), Et);
1358
1366
  return r ?? {
1359
1367
  error: i
1360
1368
  };
@@ -1365,7 +1373,7 @@ class Wt {
1365
1373
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=sVKBbY83MY
1366
1374
  */
1367
1375
  async getReplies(t) {
1368
- const { data: r } = await this.req.get("community/replies", Et, {
1376
+ const { data: r } = await this.req.get("community/replies", Gt, {
1369
1377
  params: s({ max_results: 20, ...t })
1370
1378
  });
1371
1379
  return r ?? { replies: [] };
@@ -1376,7 +1384,7 @@ class Wt {
1376
1384
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=kxhcSXD3MG
1377
1385
  */
1378
1386
  async getReply(t) {
1379
- const { data: r, code: i } = await this.req.get("community/reply", Gt, {
1387
+ const { data: r, code: i } = await this.req.get("community/reply", Ft, {
1380
1388
  params: { reply_id: t }
1381
1389
  });
1382
1390
  return (r == null ? void 0 : r.reply) ?? { error: i };
@@ -1388,7 +1396,7 @@ class Wt {
1388
1396
  */
1389
1397
  async reply(t) {
1390
1398
  await this.token.autoLogin();
1391
- const { data: r, code: i } = await this.req.post("community/reply", s(t), Ft);
1399
+ const { data: r, code: i } = await this.req.post("community/reply", s(t), It);
1392
1400
  return r ?? {
1393
1401
  error: i
1394
1402
  };
@@ -1424,7 +1432,7 @@ class Wt {
1424
1432
  */
1425
1433
  async getMediaPresignUrl(t) {
1426
1434
  await this.token.autoLogin();
1427
- const { data: r } = await this.req.get("community/media-presign-url", It, {
1435
+ const { data: r } = await this.req.get("community/media-presign-url", Bt, {
1428
1436
  params: t
1429
1437
  });
1430
1438
  return r;
@@ -1438,7 +1446,7 @@ class Wt {
1438
1446
  */
1439
1447
  async getNotifications(t) {
1440
1448
  await this.token.autoLogin();
1441
- const { data: r } = await this.req.get("community/notifications", Vt, {
1449
+ const { data: r } = await this.req.get("community/notifications", Qt, {
1442
1450
  params: s({ max_results: 20, ...t })
1443
1451
  });
1444
1452
  return r || { notifications: [] };
@@ -1450,7 +1458,7 @@ class Wt {
1450
1458
  */
1451
1459
  async getUnreadNotificationsCount() {
1452
1460
  if (!await this.token.autoLogin()) return null;
1453
- const { data: t } = await this.req.get("community/unread-notifications-count", Qt);
1461
+ const { data: t } = await this.req.get("community/unread-notifications-count", Tt);
1454
1462
  return t;
1455
1463
  }
1456
1464
  /**
@@ -1464,12 +1472,12 @@ class Wt {
1464
1472
  return r;
1465
1473
  }
1466
1474
  }
1467
- function w(e) {
1475
+ function y(e) {
1468
1476
  return n(e, "openid", "unionid", "weixin_token");
1469
1477
  }
1470
- var zt = /* @__PURE__ */ ((e) => (e.RedirectUriDisMatch = "10003", e.AppidError = "10016", e.AuthorizationError = "10015", e.NoRightForScope = "10005", e.Frequently = "10009", e.AppBanded = "10004", e.ShouldFllow = "10006", e.ScopeNull = "10010", e.RedirectUriNull = "10011", e.AppidNull = "10012", e.StateNull = "10013", e))(zt || {});
1471
- const $ = "wx_login_cache";
1472
- class er {
1478
+ var Jt = /* @__PURE__ */ ((e) => (e.RedirectUriDisMatch = "10003", e.AppidError = "10016", e.AuthorizationError = "10015", e.NoRightForScope = "10005", e.Frequently = "10009", e.AppBanded = "10004", e.ShouldFllow = "10006", e.ScopeNull = "10010", e.RedirectUriNull = "10011", e.AppidNull = "10012", e.StateNull = "10013", e))(Jt || {});
1479
+ const P = "wx_login_cache";
1480
+ class tr {
1473
1481
  /**
1474
1482
  * 创建微信相关功能接口
1475
1483
  *
@@ -1497,11 +1505,11 @@ class er {
1497
1505
  * 也可以直接调用 login 方法,并传入 wxcode 的读取函数
1498
1506
  */
1499
1507
  async getLoginCache() {
1500
- const t = this.token.storage.get($);
1508
+ const t = this.token.storage.get(P);
1501
1509
  if (!t)
1502
1510
  return null;
1503
1511
  const r = K(t);
1504
- return w(r) ? (this.token.weixinToken = r.weixin_token, await this.token.autoLogin(), r) : null;
1512
+ return y(r) ? (this.token.weixinToken = r.weixin_token, await this.token.autoLogin(), r) : null;
1505
1513
  }
1506
1514
  /**
1507
1515
  * 小程序页面微信静默登录,获取 weixinToken / openid / unionid。
@@ -1524,13 +1532,13 @@ class er {
1524
1532
  const t = await this.getLoginCache();
1525
1533
  if (t)
1526
1534
  return t;
1527
- const r = await O(), { data: i, code: c } = await this.req.post(
1535
+ const r = await X(), { data: i, code: c } = await this.req.post(
1528
1536
  "weixin/login",
1529
1537
  { code: r, appid: this.appid },
1530
- w,
1538
+ y,
1531
1539
  { message: !1 }
1532
1540
  );
1533
- return i && (this.token.weixinToken = i.weixin_token, this.token.storage.set($, JSON.stringify(i)), await this.token.autoLogin()), i ?? { error: c };
1541
+ return i && (this.token.weixinToken = i.weixin_token, this.token.storage.set(P, JSON.stringify(i)), await this.token.autoLogin()), i ?? { error: c };
1534
1542
  }
1535
1543
  /**
1536
1544
  * 在微信内嵌网页中调用微信公众号授权登录【暂未启用】
@@ -1567,7 +1575,7 @@ class er {
1567
1575
  code: r,
1568
1576
  appid: this.appid
1569
1577
  },
1570
- w
1578
+ y
1571
1579
  );
1572
1580
  return p && (this.token.weixinToken = p.weixin_token, await this.token.autoLogin()), p ?? { error: I };
1573
1581
  }
@@ -1596,33 +1604,33 @@ class er {
1596
1604
  }
1597
1605
  }
1598
1606
  export {
1599
- Xt as AuthToken,
1600
- Le as CliamRewardStatus,
1601
- Yt as ClubApi,
1607
+ Yt as AuthToken,
1608
+ Ce as CliamRewardStatus,
1609
+ Zt as ClubApi,
1602
1610
  ye as ClubCreditChangeSence,
1603
- fe as ClubCreditChangeType,
1604
- we as ClubItemType,
1605
- he as ClubRedemptionStatus,
1606
- Wt as CommunityApi,
1607
- ke as EngageAccountType,
1608
- Zt as EventApi,
1609
- be as EventPeriodType,
1610
- o as FeatureType,
1611
- Tt as ForumMode,
1612
- ve as GamerItemType,
1613
- pe as Gender,
1614
- Se as LotteryDrawAction,
1611
+ we as ClubCreditChangeType,
1612
+ he as ClubItemType,
1613
+ ve as ClubRedemptionStatus,
1614
+ er as CommunityApi,
1615
+ be as EngageAccountType,
1616
+ Wt as EventApi,
1617
+ qe as EventPeriodType,
1618
+ a as FeatureType,
1619
+ Mt as ForumMode,
1620
+ ke as GamerItemType,
1621
+ fe as Gender,
1622
+ De as LotteryDrawAction,
1615
1623
  Pe as LotteryTicketStatus,
1616
- Ht as NotificationCategory,
1617
- jt as NotificationType,
1618
- Mt as PostStatus,
1619
- qe as QuestObjective,
1620
- Ce as RewardSoure,
1621
- xe as RewardStatusPrefix,
1622
- Ae as RewardStatusSuffix,
1623
- $e as TeamAction,
1624
- Ue as TeamVisibility,
1625
- Re as VoteOptionSource,
1626
- er as WeixinApi,
1627
- zt as WeixinWebLoginErrorCode
1624
+ jt as NotificationCategory,
1625
+ zt as NotificationType,
1626
+ Ht as PostStatus,
1627
+ Re as QuestObjective,
1628
+ Ue as RewardSoure,
1629
+ Ae as RewardStatusPrefix,
1630
+ Le as RewardStatusSuffix,
1631
+ Se as TeamAction,
1632
+ $e as TeamVisibility,
1633
+ xe as VoteOptionSource,
1634
+ tr as WeixinApi,
1635
+ Jt as WeixinWebLoginErrorCode
1628
1636
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seayoo-web/gamer-api",
3
3
  "description": "agent for gamer api",
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "type": "module",
6
6
  "source": "index.ts",
7
7
  "main": "./dist/index.js",
@@ -23,10 +23,10 @@
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.13.1",
25
25
  "@seayoo-web/combo-webview": "^2.5.0",
26
- "@seayoo-web/tsconfig": "^1.0.3",
27
- "@seayoo-web/scripts": "^1.3.9",
28
26
  "@seayoo-web/utils": "^3.0.10",
29
- "@seayoo-web/request": "^2.1.2"
27
+ "@seayoo-web/tsconfig": "^1.0.3",
28
+ "@seayoo-web/request": "^2.1.2",
29
+ "@seayoo-web/scripts": "^1.3.9"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@seayoo-web/combo-webview": "^2.5.0",
@@ -28,6 +28,8 @@ interface EventRewardItemConfig {
28
28
  reward_item_desc?: string;
29
29
  /** 玩法奖励道具类型 */
30
30
  reward_item_type: Exclude<GamerItemType, GamerItemType.GiftCode | GamerItemType.LotteryTicket>;
31
+ /** 奖励道具评级,用于前端展示 */
32
+ reward_item_rating: number;
31
33
  }
32
34
  type FeatureReward = {
33
35
  feature_reward_type: "every";
@@ -50,7 +52,7 @@ interface EventFeatureBaseConfig<T extends FeatureType = FeatureType, C extends
50
52
  /** 玩法类型 */
51
53
  feature_type: T;
52
54
  /** 玩法配置 */
53
- config: C;
55
+ config?: C;
54
56
  /** 玩法周期,即每多长时间可参与一次 */
55
57
  cycle: EventPeriodType;
56
58
  /** 允许的最大参与次数 */
@@ -60,9 +62,9 @@ interface EventFeatureBaseConfig<T extends FeatureType = FeatureType, C extends
60
62
  /** 玩法结束时间 */
61
63
  until: number;
62
64
  /** 参与玩法维度账号类型 */
63
- engage_account_type: EngageAccountType;
65
+ engage_account: EngageAccountType;
64
66
  /** 玩法参与奖励 */
65
- feature_rewards: FeatureReward;
67
+ feature_rewards?: FeatureReward;
66
68
  }
67
69
  interface FeatureLotteryItemConfig {
68
70
  /** 抽奖奖励道具 id */
@@ -50,6 +50,16 @@ export interface UserEngagement {
50
50
  reward_id: number;
51
51
  /** 奖励状态 */
52
52
  reward_status: RewardStatusPrefix;
53
+ /** 道具数量 */
54
+ reward_item_amount: number;
55
+ /** 道具名称 */
56
+ reward_item_name: string;
57
+ /** 道具描述 */
58
+ reward_item_desc: string;
59
+ /** 道具图标 */
60
+ reward_item_icon_url: string;
61
+ /** 道具评级 */
62
+ reward_item_rating: number;
53
63
  /** 奖励来源 */
54
64
  reward_source: RewardSoure;
55
65
  /** 附带的数据,由 feature_id 的类型决定 */
@@ -1,6 +1,7 @@
1
1
  export declare const console: Pick<Console, "log" | "error" | "warn">;
2
2
  /** 检测是否在 combo webview */
3
3
  export declare function inComboWebview(): boolean;
4
+ export declare function isRootEndpoint(path: string): boolean;
4
5
  export declare function getWeixinLoginCode(): Promise<string>;
5
6
  export type StorageHelper = {
6
7
  set(key: string, value: string): void;