@seayoo-web/gamer-api 2.2.1 → 2.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +171 -169
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -2,12 +2,12 @@ var ue = Object.defineProperty;
2
2
  var le = (i, t, n) => t in i ? ue(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
3
3
  var l = (i, t, n) => le(i, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { isComboWebView as me } from "@seayoo-web/combo-webview";
5
- import { isPlainObject as C, useConsole as de, Support as b, usePromise as ge, pruneURL as pe, queryString as w, pruneObject as a, v as e, omitFields as R, typedObjectGuard as o, parseJSON as _e, removePara as N } from "@seayoo-web/utils";
5
+ import { isPlainObject as v, useConsole as de, Support as b, usePromise as ge, pruneURL as pe, queryString as P, pruneObject as a, v as e, omitFields as C, typedObjectGuard as o, parseJSON as _e, removePara as O } from "@seayoo-web/utils";
6
6
  function be(i) {
7
- return C(i, "gamer_token") && typeof i.gamer_token == "string";
7
+ return v(i, "gamer_token") && typeof i.gamer_token == "string";
8
8
  }
9
- function O(i) {
10
- return C(i);
9
+ function B(i) {
10
+ return v(i);
11
11
  }
12
12
  const f = de("GamerApiSDK");
13
13
  function ye(i) {
@@ -73,8 +73,8 @@ class vr {
73
73
  timeout: 1e4,
74
74
  maxRetry: 2,
75
75
  retryInterval: "2EB",
76
- retryResolve({ method: s, status: d }) {
77
- return s === "GET" && d < 0;
76
+ retryResolve({ method: g, status: T }) {
77
+ return g === "GET" && T < 0;
78
78
  },
79
79
  responseRule: {
80
80
  ok: { resolve: "body" },
@@ -85,10 +85,12 @@ class vr {
85
85
  }
86
86
  },
87
87
  // 使用箭头函数绑定执行上下文
88
- requestTransformer: (s) => {
89
- this.$gamerToken && (s.headers.Authorization = `Bearer ${this.$gamerToken}`);
88
+ requestTransformer: (g) => {
89
+ this.$gamerToken && (g.headers.Authorization = `Bearer ${this.$gamerToken}`);
90
90
  }
91
- }), me() || w("debug") === "yes" ? this.$gamerToken = w("gamer_token") : this.loadGamerTokenCache();
91
+ });
92
+ const s = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), m = P("gamer_token");
93
+ (me() || s && m) && (this.$gamerToken = m), this.$gamerToken || this.loadGamerTokenCache();
92
94
  }
93
95
  get NetRequest() {
94
96
  return this.$NetRequest;
@@ -192,7 +194,7 @@ class vr {
192
194
  */
193
195
  async getSession() {
194
196
  if (!await this.autoLogin()) return null;
195
- const { data: t } = await this.req.get("session", O, {
197
+ const { data: t } = await this.req.get("session", B, {
196
198
  message: !1
197
199
  });
198
200
  return t;
@@ -204,7 +206,7 @@ class vr {
204
206
  */
205
207
  async authRealName(t) {
206
208
  if (!await this.autoLogin()) return null;
207
- const { data: n } = await this.req.post("auth-real-name", a(t), O);
209
+ const { data: n } = await this.req.post("auth-real-name", a(t), B);
208
210
  return n;
209
211
  }
210
212
  }
@@ -242,7 +244,7 @@ const ke = {
242
244
  Physical: "physical",
243
245
  /** 虚拟商品 */
244
246
  Virtual: "virtual"
245
- }, z = e.string().enum(Te).lock(), qe = {
247
+ }, J = e.string().enum(Te).lock(), qe = {
246
248
  /** 待发放 */
247
249
  Pending: "pending",
248
250
  /** 已发放 */
@@ -282,13 +284,13 @@ const ke = {
282
284
  }).lock(), Ee = e.object({
283
285
  role_id: e.string(),
284
286
  role_name: e.string()
285
- }).lock(), J = e.object({
287
+ }).lock(), X = e.object({
286
288
  ...Ee.shape,
287
289
  ...Pe.shape,
288
290
  role_level: e.number(),
289
291
  last_login_time: e.number()
290
292
  }).lock(), $e = e.object({
291
- ...J.shape,
293
+ ...X.shape,
292
294
  /** 角色战力 */
293
295
  role_fighting: e.number(),
294
296
  /** 宗门 ID */
@@ -303,7 +305,7 @@ const ke = {
303
305
  bio: e.string(),
304
306
  gender: ve,
305
307
  birthday: e.object({ year: e.number(), month: e.number(), day: e.number() })
306
- }).lock(), X = e.object({
308
+ }).lock(), Y = e.object({
307
309
  address_id: e.number(),
308
310
  recipient: e.string(),
309
311
  mobile: e.string(),
@@ -324,7 +326,7 @@ const ke = {
324
326
  change_credit: e.number(),
325
327
  balance: e.number(),
326
328
  change_time: e.number()
327
- }).lock(), Y = e.object({
329
+ }).lock(), Z = e.object({
328
330
  benefit_id: e.number(),
329
331
  name: e.string(),
330
332
  img_url: e.string(),
@@ -333,11 +335,11 @@ const ke = {
333
335
  max_level: e.number(),
334
336
  product_id: e.number(),
335
337
  tag: e.string()
336
- }).lock(), Z = e.object({
338
+ }).lock(), W = e.object({
337
339
  product_id: e.number(),
338
340
  catalog_id: e.number(),
339
341
  catalog_name: e.string(),
340
- item_type: z,
342
+ item_type: J,
341
343
  name: e.string(),
342
344
  img_url: e.string(),
343
345
  description: e.string(),
@@ -360,8 +362,8 @@ const ke = {
360
362
  updated_at: e.number(),
361
363
  redeemable_quantity: e.number().optional()
362
364
  }).lock(), Ie = e.object({
363
- ...R(Y.shape, "tag"),
364
- product: Z.clone().optional()
365
+ ...C(Z.shape, "tag"),
366
+ product: W.clone().optional()
365
367
  }).lock(), Cr = e.union(
366
368
  e.object({
367
369
  server_id: e.string(),
@@ -389,7 +391,7 @@ const ke = {
389
391
  product_id: e.number(),
390
392
  name: e.string(),
391
393
  img_url: e.string(),
392
- item_type: z,
394
+ item_type: J,
393
395
  catalog_id: e.number(),
394
396
  catalog_name: e.string(),
395
397
  quantity: e.number(),
@@ -397,10 +399,10 @@ const ke = {
397
399
  status: xe,
398
400
  created_at: e.number(),
399
401
  extra_data: e.union(Ge.clone(), Ae.clone()).satisfies().optional()
400
- }), Oe = e.guard(Se), B = o({ player: Le }), Be = o({ roles: e.array(J) }), q = o({ role_card: $e }), M = e.guard(Ue), Q = e.guard(X), Me = o({ addresses: e.array(X) }), Qe = e.guard(Fe), Ke = o({
402
+ }), Oe = e.guard(Se), M = o({ player: Le }), Be = o({ roles: e.array(X) }), q = o({ role_card: $e }), Q = e.guard(Ue), K = e.guard(Y), Me = o({ addresses: e.array(Y) }), Qe = e.guard(Fe), Ke = o({
401
403
  credit_logs: e.array(De),
402
404
  next_token: e.string().optional()
403
- }), He = o({ products: e.array(Z) }), ze = o({ benefits: e.array(Y) }), Je = o({ benefit: Ie }), Xe = o({
405
+ }), He = o({ products: e.array(W) }), ze = o({ benefits: e.array(Z) }), Je = o({ benefit: Ie }), Xe = o({
404
406
  redemptions: e.array(Ne),
405
407
  next_token: e.string().optional()
406
408
  });
@@ -426,7 +428,7 @@ class Rr {
426
428
  */
427
429
  async getCurrentPlayer() {
428
430
  await this.token.autoLogin();
429
- const { data: t, code: n } = await this.req.get("club/current-player", B);
431
+ const { data: t, code: n } = await this.req.get("club/current-player", M);
430
432
  return (t == null ? void 0 : t.player) ?? { error: n };
431
433
  }
432
434
  /**
@@ -441,7 +443,7 @@ class Rr {
441
443
  {
442
444
  id_token: this.token.idToken
443
445
  },
444
- B
446
+ M
445
447
  );
446
448
  return (t == null ? void 0 : t.player) ?? {
447
449
  error: n
@@ -496,7 +498,7 @@ class Rr {
496
498
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TMWBCFcOr2
497
499
  */
498
500
  async getUserProfile(t) {
499
- const { data: n } = await this.req.get("club/user-profile", M, {
501
+ const { data: n } = await this.req.get("club/user-profile", Q, {
500
502
  params: { member_id: t }
501
503
  });
502
504
  return n;
@@ -508,7 +510,7 @@ class Rr {
508
510
  */
509
511
  async updateUserProfile(t) {
510
512
  await this.token.autoLogin();
511
- const { data: n, code: r } = await this.req.post("club/user-profile", t, M);
513
+ const { data: n, code: r } = await this.req.post("club/user-profile", t, Q);
512
514
  return n ?? {
513
515
  error: r
514
516
  };
@@ -530,7 +532,7 @@ class Rr {
530
532
  */
531
533
  async addAddress(t) {
532
534
  if (!await this.token.autoLogin()) return null;
533
- const { data: n } = await this.req.post("/club/add-address", a(t), Q);
535
+ const { data: n } = await this.req.post("/club/add-address", a(t), K);
534
536
  return n;
535
537
  }
536
538
  /**
@@ -540,7 +542,7 @@ class Rr {
540
542
  */
541
543
  async updateAddress(t) {
542
544
  await this.token.autoLogin();
543
- const { data: n, code: r } = await this.req.post("club/update-address", a(t), Q);
545
+ const { data: n, code: r } = await this.req.post("club/update-address", a(t), K);
544
546
  return n ?? { error: r };
545
547
  }
546
548
  /**
@@ -633,7 +635,7 @@ class Rr {
633
635
  return { redemptions: (n == null ? void 0 : n.redemptions) || [], next_token: n == null ? void 0 : n.next_token };
634
636
  }
635
637
  }
636
- const V = {
638
+ const R = {
637
639
  /** 活动道具 */
638
640
  EventItem: "event_item",
639
641
  /** 游戏内道具 */
@@ -652,7 +654,7 @@ const V = {
652
654
  ExternalCode: "external_gift_code",
653
655
  /** 空奖励 */
654
656
  VoidItem: "void_item"
655
- }, W = e.string().enum(V).lock(), Vr = V, ee = W, Ye = {
657
+ }, ee = e.string().enum(R).lock(), Vr = R, te = ee, Ye = {
656
658
  /** 世游通行证 ID / Combo ID */
657
659
  UserId: "user_id",
658
660
  /** 游戏角色 ID */
@@ -716,14 +718,14 @@ const V = {
716
718
  MatchCounts: "player_match_counts",
717
719
  /** 游戏对局天数 */
718
720
  MatchDays: "player_match_days"
719
- }, te = e.string().enum(nt).lock(), rt = {
721
+ }, ne = e.string().enum(nt).lock(), rt = {
720
722
  /** 官方上传 */
721
723
  System: "system",
722
724
  /** 用户投稿 */
723
725
  UserSubmission: "user_submission",
724
726
  /** 投票入围 */
725
727
  Shortlisted: "shortlisted"
726
- }, it = e.string().enum(rt).lock(), g = {
728
+ }, it = e.string().enum(rt).lock(), p = {
727
729
  /** 未获得奖励 */
728
730
  Ineligible: "ineligible",
729
731
  /** 奖励未领取 */
@@ -734,7 +736,7 @@ const V = {
734
736
  Failed: "failed",
735
737
  /** 奖励已发货 */
736
738
  Delivered: "delivered"
737
- }, jr = e.string().enum(g).lock(), P = {
739
+ }, jr = e.string().enum(p).lock(), E = {
738
740
  /**
739
741
  * 奖励未领取,拼写错误以兼容后端历史版本,检查请使用 Unclaimed
740
742
  *
@@ -742,16 +744,16 @@ const V = {
742
744
  */
743
745
  UnclaimedErr: "unaccalimed",
744
746
  /** 奖励未领取 */
745
- Unclaimed: g.Unclaimed,
747
+ Unclaimed: p.Unclaimed,
746
748
  /** 奖励已领取 */
747
- Received: g.Received,
749
+ Received: p.Received,
748
750
  /** 奖励发放失败 */
749
- Failed: g.Failed,
751
+ Failed: p.Failed,
750
752
  /** 奖励已发货 */
751
- Delivered: g.Delivered
752
- }, ne = e.string().enum(P).lock(), _ = {
753
+ Delivered: p.Delivered
754
+ }, re = e.string().enum(E).lock(), _ = {
753
755
  /** 未获得奖励 */
754
- Ineligible: g.Ineligible,
756
+ Ineligible: p.Ineligible,
755
757
  /**
756
758
  * 奖励未领取,拼写错误以兼容后端历史版本,检查请使用 Unclaimed
757
759
  *
@@ -759,24 +761,24 @@ const V = {
759
761
  */
760
762
  UnclaimedErr: "unaccalimed",
761
763
  /** 奖励未领取 */
762
- Unclaimed: g.Unclaimed,
764
+ Unclaimed: p.Unclaimed,
763
765
  /** 奖励已领取 */
764
- Received: g.Received,
766
+ Received: p.Received,
765
767
  /** 奖励发放失败 */
766
- Failed: g.Failed,
768
+ Failed: p.Failed,
767
769
  /** 奖励已发货 */
768
- Delivered: g.Delivered
769
- }, E = e.string().enum(_).lock(), ot = {
770
+ Delivered: p.Delivered
771
+ }, $ = e.string().enum(_).lock(), ot = {
770
772
  /** 玩法产出奖励 */
771
773
  Output: "output",
772
774
  /** 玩法参与奖励 */
773
775
  Engage: "engage"
774
- }, $ = e.string().enum(ot).lock(), at = {
776
+ }, U = e.string().enum(ot).lock(), at = {
775
777
  /** 私有队伍 */
776
778
  Private: "private",
777
779
  /** 公开队伍 */
778
780
  Public: "public"
779
- }, st = e.string().enum(at).lock(), k = {
781
+ }, st = e.string().enum(at).lock(), w = {
780
782
  /** 未知状态 */
781
783
  Unknown: "unknown",
782
784
  /** 等待开奖 */
@@ -787,7 +789,7 @@ const V = {
787
789
  Claimed: "claimed",
788
790
  /** 领奖失败 */
789
791
  Fail: "fail"
790
- }, Tr = e.string().enum(k).lock(), ct = {
792
+ }, Tr = e.string().enum(w).lock(), ct = {
791
793
  /** 发起组队 */
792
794
  Assemble: "assemble",
793
795
  /** 加入队伍 */
@@ -805,7 +807,7 @@ const V = {
805
807
  Draw: "draw",
806
808
  /** 领奖 */
807
809
  Claim: "claim"
808
- }, xr = e.string().enum(ut).lock(), lt = e.string().enum(R(V, "GiftCode", "LotteryTicket")), U = e.object({
810
+ }, xr = e.string().enum(ut).lock(), lt = e.string().enum(C(R, "GiftCode", "LotteryTicket")), F = e.object({
809
811
  reward_item_id: e.number(),
810
812
  reward_amount: e.number(),
811
813
  reward_item_name: e.string(),
@@ -815,11 +817,11 @@ const V = {
815
817
  reward_item_rating: e.number()
816
818
  }).lock(), mt = e.object({
817
819
  engage_count: e.number(),
818
- rewards: e.array(U)
820
+ rewards: e.array(F)
819
821
  }).lock(), dt = e.union(
820
822
  e.object({
821
823
  feature_reward_type: e.string().enum("every"),
822
- reward_details: e.array(U)
824
+ reward_details: e.array(F)
823
825
  }),
824
826
  e.object({
825
827
  feature_reward_type: e.string().enum("regular"),
@@ -891,7 +893,7 @@ const V = {
891
893
  }), St = c.InvitedRegister, Lt = e.object({
892
894
  ...u.shape,
893
895
  feature_type: e.string().enum(St)
894
- }), Pt = e.string().enum(R(V, "GiftCode", "LotteryTicket")), Et = c.Lottery, $t = e.object({
896
+ }), Pt = e.string().enum(C(R, "GiftCode", "LotteryTicket")), Et = c.Lottery, $t = e.object({
895
897
  reward_item_id: e.number(),
896
898
  reward_item_name: e.string(),
897
899
  reward_item_type: Pt,
@@ -924,7 +926,7 @@ const V = {
924
926
  ...u.shape,
925
927
  feature_type: e.string().enum(At),
926
928
  config: e.object({
927
- objective: te,
929
+ objective: ne,
928
930
  completion_value: e.number(),
929
931
  team: e.object({
930
932
  feature_id: e.number().optional(),
@@ -986,7 +988,7 @@ const V = {
986
988
  finalists_amount: e.number(),
987
989
  source: it,
988
990
  options: e.array(Wt),
989
- rewards: e.array(U)
991
+ rewards: e.array(F)
990
992
  })
991
993
  }), tn = e.union(
992
994
  pt,
@@ -1029,17 +1031,17 @@ const V = {
1029
1031
  avatar_url: e.string().optional()
1030
1032
  }), cn = e.object({
1031
1033
  lottery_count: e.number()
1032
- }), re = e.object({
1034
+ }), ie = e.object({
1033
1035
  reward_id: e.number(),
1034
1036
  reward_item_id: e.number(),
1035
- reward_source: $,
1037
+ reward_source: U,
1036
1038
  reward_item_name: e.string(),
1037
- reward_item_type: W,
1039
+ reward_item_type: ee,
1038
1040
  reward_item_icon_url: e.string(),
1039
1041
  reward_item_desc: e.string().optional(),
1040
1042
  reward_item_rating: e.number(),
1041
1043
  reward_amount: e.number(),
1042
- reward_status: E,
1044
+ reward_status: $,
1043
1045
  event_id: e.number(),
1044
1046
  event_name: e.string(),
1045
1047
  feature_id: e.number(),
@@ -1049,22 +1051,22 @@ const V = {
1049
1051
  // https://kdocs.cn/l/ckWFDcOsYEUA?linkname=merUzJsVYH
1050
1052
  // 后续会格式化为具体的类型,此处的校验需要对应增加
1051
1053
  extra_data: e.record(e.unknown()).optional()
1052
- }), un = e.string().enum(k.Unknown, k.Pending), ln = e.union(
1054
+ }), un = e.string().enum(w.Unknown, w.Pending), ln = e.union(
1053
1055
  e.object({
1054
1056
  ticket: e.string(),
1055
1057
  status: un
1056
1058
  }),
1057
1059
  e.object({
1058
1060
  ticket: e.string(),
1059
- status: e.string().enum(R(k, "Unknown", "Pending")),
1060
- reward: re
1061
+ status: e.string().enum(C(w, "Unknown", "Pending")),
1062
+ reward: ie
1061
1063
  })
1062
1064
  ).satisfies(), mn = e.object({
1063
1065
  tickets: e.array(ln)
1064
1066
  }), dn = e.object({
1065
1067
  platforms: e.array(e.string())
1066
1068
  }), gn = e.object({
1067
- objective: te,
1069
+ objective: ne,
1068
1070
  progress: e.number(),
1069
1071
  completion_value: e.number().optional(),
1070
1072
  team: e.object({
@@ -1113,7 +1115,7 @@ const V = {
1113
1115
  comment: e.string(),
1114
1116
  video_note: e.number(),
1115
1117
  created_at: e.number()
1116
- }), F = e.union(
1118
+ }), D = e.union(
1117
1119
  dn,
1118
1120
  cn,
1119
1121
  bn,
@@ -1129,31 +1131,31 @@ const V = {
1129
1131
  on,
1130
1132
  e.custom(
1131
1133
  "EmptyObject",
1132
- (i) => C(i) && Object.keys(i).length === 0
1134
+ (i) => v(i) && Object.keys(i).length === 0
1133
1135
  )
1134
1136
  ).satisfies().lock(), kn = e.object({
1135
1137
  reward_id: e.number(),
1136
1138
  reward_item_id: e.number(),
1137
- reward_item_type: ee,
1139
+ reward_item_type: te,
1138
1140
  reward_count: e.number(),
1139
- reward_status: ne,
1140
- reward_source: $,
1141
+ reward_status: re,
1142
+ reward_source: U,
1141
1143
  reward_item_name: e.string(),
1142
1144
  reward_item_icon_url: e.string(),
1143
1145
  reward_item_desc: e.string().optional(),
1144
1146
  reward_item_rating: e.number(),
1145
1147
  receive_time: e.number(),
1146
- extra_data: e.union(...F.validators, e.record(e.unknown())).satisfies().optional()
1148
+ extra_data: e.union(...D.validators, e.record(e.unknown())).satisfies().optional()
1147
1149
  }), vn = e.object({
1148
1150
  reward_id: e.number(),
1149
1151
  reward_item_id: e.number(),
1150
1152
  reward_item_name: e.string(),
1151
- reward_item_type: ee,
1153
+ reward_item_type: te,
1152
1154
  reward_item_icon_url: e.string(),
1153
1155
  reward_item_desc: e.string().optional(),
1154
1156
  reward_amount: e.number(),
1155
- reward_status: ne,
1156
- reward_source: $,
1157
+ reward_status: re,
1158
+ reward_source: U,
1157
1159
  extra_data: e.record(e.unknown()).optional()
1158
1160
  }), Cn = e.object({
1159
1161
  engagement_id: e.number(),
@@ -1161,7 +1163,7 @@ const V = {
1161
1163
  event_id: e.number(),
1162
1164
  feature_id: e.number(),
1163
1165
  sequence: e.number(),
1164
- data: F.clone().optional(),
1166
+ data: D.clone().optional(),
1165
1167
  server_id: e.string().optional(),
1166
1168
  role_id: e.string().optional(),
1167
1169
  created_at: e.number(),
@@ -1179,13 +1181,13 @@ const V = {
1179
1181
  engagement_id: e.number(),
1180
1182
  sequence: e.number(),
1181
1183
  feature_id: e.number(),
1182
- data: F.clone().optional()
1184
+ data: D.clone().optional()
1183
1185
  }).optional(),
1184
1186
  rewards: e.array(vn).optional(),
1185
1187
  scan: e.bool().optional()
1186
1188
  }), Tn = e.object({
1187
1189
  reward_id: e.number(),
1188
- reward_status: E
1190
+ reward_status: $
1189
1191
  }), qn = e.guard(nn), xn = e.guard(Rn), S = o({ count: e.number() }), Sn = o({ first_visit: e.bool() }), Ln = o({
1190
1192
  engagements: e.union(e.array(wn), e.array(yn))
1191
1193
  }), Pn = o({
@@ -1196,9 +1198,9 @@ const V = {
1196
1198
  }), $n = e.guard(jn), Un = o({
1197
1199
  claimed_items: e.array(Tn)
1198
1200
  }), Fn = o({
1199
- reward_status: E
1201
+ reward_status: $
1200
1202
  }), Dn = o({
1201
- user_rewards: e.array(re),
1203
+ user_rewards: e.array(ie),
1202
1204
  next_token: e.string().optional()
1203
1205
  }), In = o({
1204
1206
  scene: e.string()
@@ -1335,7 +1337,7 @@ class Lr {
1335
1337
  */
1336
1338
  async engage(t, n, r) {
1337
1339
  await this.token.autoLogin();
1338
- const { data: s, code: d } = await this.req.post(
1340
+ const { data: s, code: m } = await this.req.post(
1339
1341
  `event/${this.event}/engage`,
1340
1342
  a({
1341
1343
  feature_id: t,
@@ -1344,8 +1346,8 @@ class Lr {
1344
1346
  }),
1345
1347
  $n
1346
1348
  );
1347
- return s && s.rewards && (s.rewards = s.rewards.map((p) => (p.reward_status = p.reward_status === P.UnclaimedErr ? P.Unclaimed : p.reward_status, p))), s ?? {
1348
- error: d
1349
+ return s && s.rewards && (s.rewards = s.rewards.map((g) => (g.reward_status = g.reward_status === E.UnclaimedErr ? E.Unclaimed : g.reward_status, g))), s ?? {
1350
+ error: m
1349
1351
  };
1350
1352
  }
1351
1353
  /**
@@ -1356,7 +1358,7 @@ class Lr {
1356
1358
  async claimRewards(t) {
1357
1359
  await this.token.autoLogin();
1358
1360
  const { data: n, code: r } = await this.req.post("event/claim-rewards", a(t), Un), s = n == null ? void 0 : n.claimed_items;
1359
- return s ? s.map((d) => (d.reward_status = d.reward_status === _.UnclaimedErr ? _.Unclaimed : d.reward_status, d)) : {
1361
+ return s ? s.map((m) => (m.reward_status = m.reward_status === _.UnclaimedErr ? _.Unclaimed : m.reward_status, m)) : {
1360
1362
  error: r
1361
1363
  };
1362
1364
  }
@@ -1467,14 +1469,14 @@ const Nn = {
1467
1469
  Failed: "failed",
1468
1470
  /** 嫌疑(仅自己可见) */
1469
1471
  Suspect: "suspect"
1470
- }, ie = e.string().enum(Bn).lock(), Mn = {
1472
+ }, oe = e.string().enum(Bn).lock(), Mn = {
1471
1473
  /** 系统通知 */
1472
1474
  System: "system",
1473
1475
  /** 评论我的 */
1474
1476
  Comment: "comment",
1475
1477
  /** 点赞通知 */
1476
1478
  Like: "like"
1477
- }, Pr = e.string().enum(Mn).lock(), m = {
1479
+ }, Pr = e.string().enum(Mn).lock(), d = {
1478
1480
  /** 系统通知 */
1479
1481
  System: "system",
1480
1482
  /** 帖子被置顶 */
@@ -1499,7 +1501,7 @@ const Nn = {
1499
1501
  ReplyLiked: "reply_liked",
1500
1502
  /** 回复被删除 */
1501
1503
  ReplyDeleted: "reply_deleted"
1502
- }, Qn = e.string().enum(m).lock(), oe = e.object({
1504
+ }, Qn = e.string().enum(d).lock(), ae = e.object({
1503
1505
  forum_id: e.number(),
1504
1506
  icon_url: e.string(),
1505
1507
  name: e.string(),
@@ -1507,16 +1509,16 @@ const Nn = {
1507
1509
  sort: e.number(),
1508
1510
  mode: On,
1509
1511
  member_ids: e.array(e.number())
1510
- }).lock(), D = e.object({
1512
+ }).lock(), I = e.object({
1511
1513
  topic_id: e.number(),
1512
1514
  cover_url: e.string(),
1513
1515
  name: e.string(),
1514
1516
  description: e.string(),
1515
1517
  tags: e.array(e.string()),
1516
1518
  post_num: e.number()
1517
- }).lock(), I = e.object({
1519
+ }).lock(), G = e.object({
1518
1520
  post_id: e.number(),
1519
- forum: oe,
1521
+ forum: ae,
1520
1522
  posted_by: e.string(),
1521
1523
  nickname: e.string(),
1522
1524
  avatar_url: e.string(),
@@ -1528,13 +1530,13 @@ const Nn = {
1528
1530
  comments_num: e.number(),
1529
1531
  liked: e.bool(),
1530
1532
  image_urls: e.array(e.string()),
1531
- topics: e.array(D),
1533
+ topics: e.array(I),
1532
1534
  event_ids: e.array(e.number()),
1533
1535
  is_pinned: e.bool(),
1534
1536
  is_highlighted: e.bool(),
1535
- status: ie,
1537
+ status: oe,
1536
1538
  create_time: e.number()
1537
- }).lock(), ae = e.object({
1539
+ }).lock(), se = e.object({
1538
1540
  err_msg: e.string().optional()
1539
1541
  }).lock(), Kn = e.object({
1540
1542
  reply_id: e.number(),
@@ -1542,7 +1544,7 @@ const Nn = {
1542
1544
  replied_by: e.string(),
1543
1545
  nickname: e.string(),
1544
1546
  avatar_url: e.string()
1545
- }).lock(), j = e.object({
1547
+ }).lock(), V = e.object({
1546
1548
  reply_id: e.number(),
1547
1549
  comment_id: e.number(),
1548
1550
  comment_content: e.string().optional(),
@@ -1557,7 +1559,7 @@ const Nn = {
1557
1559
  liked: e.bool(),
1558
1560
  reply_to: Kn,
1559
1561
  create_time: e.number()
1560
- }).lock(), v = e.object({
1562
+ }).lock(), k = e.object({
1561
1563
  comment_id: e.number(),
1562
1564
  post_id: e.number(),
1563
1565
  post_subject: e.string().optional(),
@@ -1575,8 +1577,8 @@ const Nn = {
1575
1577
  liked: e.bool(),
1576
1578
  image_url: e.string(),
1577
1579
  create_time: e.number(),
1578
- status: ie,
1579
- replies: e.array(j).optional()
1580
+ status: oe,
1581
+ replies: e.array(V).optional()
1580
1582
  }).lock(), Hn = e.object({
1581
1583
  image_url: e.string(),
1582
1584
  upload_url: e.string(),
@@ -1592,57 +1594,57 @@ const Nn = {
1592
1594
  }).lock(), zn = e.object({
1593
1595
  system_message_subject: e.string(),
1594
1596
  system_message_content: e.string()
1595
- }).lock(), G = e.object({
1597
+ }).lock(), A = e.object({
1596
1598
  post_id: e.number(),
1597
1599
  post_subject: e.string(),
1598
1600
  post_summary: e.string(),
1599
1601
  post_image_url: e.string()
1600
- }).lock(), T = e.object({
1602
+ }).lock(), j = e.object({
1601
1603
  comment_id: e.number(),
1602
1604
  comment_content: e.string()
1603
- }).lock(), A = e.object({
1605
+ }).lock(), N = e.object({
1604
1606
  reply_id: e.number(),
1605
1607
  reply_content: e.string()
1606
1608
  }).lock(), Jn = e.object({
1607
1609
  ...y.shape,
1608
1610
  ...zn.shape,
1609
- notification_type: e.string().enum(m.System)
1611
+ notification_type: e.string().enum(d.System)
1610
1612
  }), Xn = e.object({
1611
1613
  ...y.shape,
1612
- ...G.shape,
1614
+ ...A.shape,
1613
1615
  notification_type: e.string().enum(
1614
- m.PostPinned,
1615
- m.PostHighlighted,
1616
- m.PostDeleted,
1617
- m.PostLiked
1616
+ d.PostPinned,
1617
+ d.PostHighlighted,
1618
+ d.PostDeleted,
1619
+ d.PostLiked
1618
1620
  )
1619
1621
  }), Yn = e.object({
1620
1622
  ...y.shape,
1621
- ...G.shape,
1622
- ...T.shape,
1623
- notification_type: e.string().enum(m.PostCommented)
1623
+ ...A.shape,
1624
+ ...j.shape,
1625
+ notification_type: e.string().enum(d.PostCommented)
1624
1626
  }), Zn = e.object({
1625
1627
  ...y.shape,
1626
- ...T.shape,
1627
- ...A.shape,
1628
- notification_type: e.string().enum(m.CommentReplied)
1628
+ ...j.shape,
1629
+ ...N.shape,
1630
+ notification_type: e.string().enum(d.CommentReplied)
1629
1631
  }), Wn = e.object({
1630
1632
  ...y.shape,
1631
- ...T.shape,
1632
- ...G.shape,
1633
- notification_type: e.string().enum(m.CommentLiked, m.CommentDeleted)
1633
+ ...j.shape,
1634
+ ...A.shape,
1635
+ notification_type: e.string().enum(d.CommentLiked, d.CommentDeleted)
1634
1636
  }), er = e.object({
1635
1637
  ...y.shape,
1636
- ...A.shape,
1637
- notification_type: e.string().enum(m.ReplyReplied),
1638
+ ...N.shape,
1639
+ notification_type: e.string().enum(d.ReplyReplied),
1638
1640
  comment_id: e.number(),
1639
1641
  reply_to_reply_id: e.number(),
1640
1642
  reply_to_reply_content: e.string()
1641
1643
  }), tr = e.object({
1642
1644
  ...y.shape,
1643
- ...A.shape,
1644
- ...T.shape,
1645
- notification_type: e.string().enum(m.ReplyLiked, m.ReplyDeleted)
1645
+ ...N.shape,
1646
+ ...j.shape,
1647
+ notification_type: e.string().enum(d.ReplyLiked, d.ReplyDeleted)
1646
1648
  }), nr = e.union(
1647
1649
  Jn,
1648
1650
  Xn,
@@ -1651,21 +1653,21 @@ const Nn = {
1651
1653
  Wn,
1652
1654
  er,
1653
1655
  tr
1654
- ).satisfies().lock(), rr = o({ forums: e.array(oe) }), ir = o({ topics: e.array(D) }), or = o({ topic: D }), ar = o({ post: I }), K = o({
1655
- posts: e.array(I),
1656
+ ).satisfies().lock(), rr = o({ forums: e.array(ae) }), ir = o({ topics: e.array(I) }), or = o({ topic: I }), ar = o({ post: G }), H = o({
1657
+ posts: e.array(G),
1656
1658
  next_token: e.string().optional()
1657
- }), sr = o({ post: I, antispam: ae }), cr = o({
1658
- replies: e.array(j),
1659
+ }), sr = o({ post: G, antispam: se }), cr = o({
1660
+ replies: e.array(V),
1659
1661
  next_token: e.string().optional()
1660
- }), ur = o({ reply: j }), lr = o({
1661
- reply: j.clone().optional(),
1662
- antispam: ae.clone().optional()
1663
- }), mr = o({ comment: v }), dr = o({
1664
- comments: e.array(v),
1662
+ }), ur = o({ reply: V }), lr = o({
1663
+ reply: V.clone().optional(),
1664
+ antispam: se.clone().optional()
1665
+ }), mr = o({ comment: k }), dr = o({
1666
+ comments: e.array(k),
1665
1667
  next_token: e.string().optional()
1666
1668
  }), gr = o({
1667
- comment: v.clone().optional(),
1668
- antispam: v.clone().optional()
1669
+ comment: k.clone().optional(),
1670
+ antispam: k.clone().optional()
1669
1671
  }), pr = e.guard(Hn), _r = o({
1670
1672
  notifications: e.array(nr),
1671
1673
  next_token: e.string().optional()
@@ -1715,7 +1717,7 @@ class Er {
1715
1717
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
1716
1718
  */
1717
1719
  async getPosts(t) {
1718
- const { data: n, code: r } = await this.req.get("community/posts", K, {
1720
+ const { data: n, code: r } = await this.req.get("community/posts", H, {
1719
1721
  params: a(t)
1720
1722
  });
1721
1723
  return n ?? { error: r };
@@ -1726,10 +1728,10 @@ class Er {
1726
1728
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
1727
1729
  */
1728
1730
  async getPinnedPosts(t, n, r) {
1729
- const { data: s, code: d } = await this.req.get("community/pinned-posts", K, {
1731
+ const { data: s, code: m } = await this.req.get("community/pinned-posts", H, {
1730
1732
  params: a({ forum_id: t, max_results: n, next_token: r })
1731
1733
  });
1732
- return s ?? { error: d };
1734
+ return s ?? { error: m };
1733
1735
  }
1734
1736
  /**
1735
1737
  * 根据帖子 id 获取帖子详情
@@ -1899,9 +1901,9 @@ const yr = o({
1899
1901
  });
1900
1902
  var fr = /* @__PURE__ */ ((i) => (i.RedirectUriDisMatch = "10003", i.AppidError = "10016", i.AuthorizationError = "10015", i.NoRightForScope = "10005", i.Frequently = "10009", i.AppBanded = "10004", i.ShouldFollow = "10006", i.ScopeNull = "10010", i.RedirectUriNull = "10011", i.AppidNull = "10012", i.StateNull = "10013", i))(fr || {});
1901
1903
  function L(i) {
1902
- return C(i, "open_id", "union_id", "weixin_token");
1904
+ return v(i, "open_id", "union_id", "weixin_token");
1903
1905
  }
1904
- const H = "wx_login_cache";
1906
+ const z = "wx_login_cache";
1905
1907
  class $r {
1906
1908
  /**
1907
1909
  * 创建微信相关功能接口
@@ -1933,7 +1935,7 @@ class $r {
1933
1935
  * 也可以直接调用 login 方法,并传入 weixin code 的读取函数
1934
1936
  */
1935
1937
  async getLoginCache() {
1936
- const t = this.token.storage.get(H);
1938
+ const t = this.token.storage.get(z);
1937
1939
  if (!t)
1938
1940
  return null;
1939
1941
  const n = _e(t);
@@ -1968,7 +1970,7 @@ class $r {
1968
1970
  L,
1969
1971
  { message: !1 }
1970
1972
  );
1971
- return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(H, JSON.stringify(r)), await this.token.autoLogin()), r ?? { error: s };
1973
+ return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(z, JSON.stringify(r)), await this.token.autoLogin()), r ?? { error: s };
1972
1974
  }
1973
1975
  /**
1974
1976
  * 在微信内嵌网页中调用微信公众号授权登录【暂未启用】
@@ -1987,9 +1989,9 @@ class $r {
1987
1989
  * - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
1988
1990
  */
1989
1991
  async webLogin(t = "snsapi_userinfo") {
1990
- const n = w("code"), r = Date.now(), s = +w("state");
1992
+ const n = P("code"), r = Date.now(), s = +P("state");
1991
1993
  if (!n || !s || s < r - 1e3 * 60 * 5 || s > r) {
1992
- const ce = N(["code", "state"]);
1994
+ const ce = O(["code", "state"]);
1993
1995
  location.replace(
1994
1996
  `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(ce)}&response_type=code&scope=${t}&state=${r}#wechat_redirect`
1995
1997
  );
@@ -1997,9 +1999,9 @@ class $r {
1997
1999
  }
1998
2000
  if (/^100\d{2}$/.test(n))
1999
2001
  return { error: n };
2000
- const d = N(["code", "state"]);
2001
- "replaceState" in history && history.replaceState({}, "", d);
2002
- const { data: p, code: se } = await this.req.post(
2002
+ const m = O(["code", "state"]);
2003
+ "replaceState" in history && history.replaceState({}, "", m);
2004
+ const { data: g, code: T } = await this.req.post(
2003
2005
  "weixin/login",
2004
2006
  {
2005
2007
  code: n,
@@ -2007,7 +2009,7 @@ class $r {
2007
2009
  },
2008
2010
  L
2009
2011
  );
2010
- return p && (this.token.weixinToken = p.weixin_token, await this.token.autoLogin()), p ?? { error: se };
2012
+ return g && (this.token.weixinToken = g.weixin_token, await this.token.autoLogin()), g ?? { error: T };
2011
2013
  }
2012
2014
  /**
2013
2015
  * 关联游戏账号,无返回值,全程静默
@@ -2047,16 +2049,16 @@ class $r {
2047
2049
  }
2048
2050
  }
2049
2051
  export {
2050
- ae as AntispamValidator,
2052
+ se as AntispamValidator,
2051
2053
  vr as AuthToken,
2052
2054
  rn as CashbackEngagementDataValidator,
2053
2055
  on as ClaimActivationKeyEngagementDataValidator,
2054
2056
  _ as ClaimRewardStatus,
2055
- E as ClaimRewardStatusValidator,
2057
+ $ as ClaimRewardStatusValidator,
2056
2058
  Tn as ClaimedItemValidator,
2057
- X as ClubAddressValidator,
2059
+ Y as ClubAddressValidator,
2058
2060
  Rr as ClubApi,
2059
- Y as ClubBenefitSummaryValidator,
2061
+ Z as ClubBenefitSummaryValidator,
2060
2062
  Ie as ClubBenefitValidator,
2061
2063
  Ve as ClubCreditChangeScene,
2062
2064
  je as ClubCreditChangeSceneValidator,
@@ -2065,15 +2067,15 @@ export {
2065
2067
  De as ClubCreditLogValidator,
2066
2068
  Se as ClubGlobalConfigValidator,
2067
2069
  Te as ClubItemType,
2068
- z as ClubItemTypeValidator,
2070
+ J as ClubItemTypeValidator,
2069
2071
  Le as ClubPlayerValidator,
2070
- Z as ClubProductValidator,
2072
+ W as ClubProductValidator,
2071
2073
  qe as ClubRedemptionStatus,
2072
2074
  xe as ClubRedemptionStatusValidator,
2073
2075
  Fe as ClubUserCreditValidator,
2074
2076
  Ue as ClubUserProfileValidator,
2075
2077
  wn as CommentEngagementValidator,
2076
- v as CommentValidator,
2078
+ k as CommentValidator,
2077
2079
  Er as CommunityApi,
2078
2080
  Ye as EngageAccountType,
2079
2081
  Ze as EngageAccountTypeValidator,
@@ -2103,7 +2105,7 @@ export {
2103
2105
  tn as EventFeatureConfigValidator,
2104
2106
  We as EventPeriodType,
2105
2107
  et as EventPeriodTypeValidator,
2106
- U as EventRewardItemConfigValidator,
2108
+ F as EventRewardItemConfigValidator,
2107
2109
  Ae as ExtraGameRewardValidator,
2108
2110
  Ge as ExtraPhysicalShipmentValidator,
2109
2111
  dt as FeatureRewardValidator,
@@ -2111,9 +2113,9 @@ export {
2111
2113
  tt as FeatureTypeValidator,
2112
2114
  Nn as ForumMode,
2113
2115
  On as ForumModeValidator,
2114
- oe as ForumValidator,
2115
- V as GamerItemType,
2116
- W as GamerItemTypeValidator,
2116
+ ae as ForumValidator,
2117
+ R as GamerItemType,
2118
+ ee as GamerItemTypeValidator,
2117
2119
  ke as Gender,
2118
2120
  ve as GenderValidator,
2119
2121
  an as GiftCodeEngagementDataValidator,
@@ -2122,47 +2124,47 @@ export {
2122
2124
  xr as LotteryDrawActionValidator,
2123
2125
  mn as LotteryDrawEngagementDataValidator,
2124
2126
  cn as LotteryEngagementDataValidator,
2125
- k as LotteryTicketStatus,
2127
+ w as LotteryTicketStatus,
2126
2128
  Tr as LotteryTicketStatusValidator,
2127
2129
  y as NotificationBaseValidator,
2128
2130
  Mn as NotificationCategory,
2129
2131
  Pr as NotificationCategoryValidator,
2130
2132
  Zn as NotificationCommentReplyValidator,
2131
2133
  Wn as NotificationCommentValidator,
2132
- T as NotificationPayloadCommentValidator,
2133
- G as NotificationPayloadPostValidator,
2134
- A as NotificationPayloadReplyValidator,
2134
+ j as NotificationPayloadCommentValidator,
2135
+ A as NotificationPayloadPostValidator,
2136
+ N as NotificationPayloadReplyValidator,
2135
2137
  zn as NotificationPayloadSystemValidator,
2136
2138
  Yn as NotificationPostCommentValidator,
2137
2139
  Xn as NotificationPostValidator,
2138
2140
  er as NotificationReplyRepliedValidator,
2139
2141
  tr as NotificationReplyValidator,
2140
2142
  Jn as NotificationSystemValidator,
2141
- m as NotificationType,
2143
+ d as NotificationType,
2142
2144
  Qn as NotificationTypeValidator,
2143
2145
  nr as NotificationValidator,
2144
2146
  $e as PlayerRoleCardValidator,
2145
- J as PlayerRoleValidator,
2147
+ X as PlayerRoleValidator,
2146
2148
  Bn as PostStatus,
2147
- ie as PostStatusValidator,
2148
- I as PostValidator,
2149
+ oe as PostStatusValidator,
2150
+ G as PostValidator,
2149
2151
  dn as PreregisterEngagementDataValidator,
2150
2152
  Hn as PresignedUrlResponseValidator,
2151
2153
  gn as QuestEngagementDataValidator,
2152
2154
  nt as QuestObjective,
2153
- te as QuestObjectiveValidator,
2155
+ ne as QuestObjectiveValidator,
2154
2156
  Cr as RedeemParamsValidator,
2155
2157
  Ne as RedemptionValidator,
2156
2158
  mt as RegularRewardValidator,
2157
2159
  Kn as ReplyToValidator,
2158
- j as ReplyValidator,
2160
+ V as ReplyValidator,
2159
2161
  Vr as RewardItemType,
2160
- ee as RewardItemTypeValidator,
2162
+ te as RewardItemTypeValidator,
2161
2163
  ot as RewardSource,
2162
- $ as RewardSourceValidator,
2163
- g as RewardStatus,
2164
- P as RewardStatusSuffix,
2165
- ne as RewardStatusSuffixValidator,
2164
+ U as RewardSourceValidator,
2165
+ p as RewardStatus,
2166
+ E as RewardStatusSuffix,
2167
+ re as RewardStatusSuffixValidator,
2166
2168
  jr as RewardStatusValidator,
2167
2169
  kn as RewardValidator,
2168
2170
  Ee as RoleBaseInfoValidator,
@@ -2176,11 +2178,11 @@ export {
2176
2178
  Sr as TeamMemberValidator,
2177
2179
  at as TeamVisibility,
2178
2180
  st as TeamVisibilityValidator,
2179
- D as TopicValidator,
2180
- F as UserEngagementDataValidator,
2181
+ I as TopicValidator,
2182
+ D as UserEngagementDataValidator,
2181
2183
  Cn as UserEngagementValidator,
2182
2184
  Vn as UserFeatureStatusValidator,
2183
- re as UserRewardValidator,
2185
+ ie as UserRewardValidator,
2184
2186
  Rn as VerifyMobileResultValidator,
2185
2187
  hn as VoteEngagementDataValidator,
2186
2188
  rt as VoteOptionSource,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seayoo-web/gamer-api",
3
3
  "description": "agent for gamer api",
4
- "version": "2.2.1",
4
+ "version": "2.2.2",
5
5
  "type": "module",
6
6
  "source": "index.ts",
7
7
  "main": "./dist/index.js",
@@ -24,10 +24,10 @@
24
24
  "devDependencies": {
25
25
  "@types/node": "^22.13.1",
26
26
  "@seayoo-web/combo-webview": "^2.5.4",
27
- "@seayoo-web/request": "^3.1.5",
27
+ "@seayoo-web/utils": "^3.5.1",
28
28
  "@seayoo-web/tsconfig": "^1.0.3",
29
- "@seayoo-web/scripts": "^2.5.2",
30
- "@seayoo-web/utils": "^3.5.1"
29
+ "@seayoo-web/request": "^3.1.5",
30
+ "@seayoo-web/scripts": "^2.5.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@seayoo-web/combo-webview": "^2.5.4",