@seayoo-web/gamer-api 2.11.1 → 2.11.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isComboWebView as ue } from "@seayoo-web/combo-webview";
1
+ import { isComboWebView as le } from "@seayoo-web/combo-webview";
2
2
  import { isPlainObject as k, supportWx as b, useConsole as me, usePromise as de, pruneURL as ge, supportWindow as pe, queryString as L, pruneObject as c, omitFields as P, parseJSON as _e, removePara as G } from "@seayoo-web/utils";
3
3
  import { v as e, objectGuard as s } from "@seayoo-web/validator";
4
4
  function be(i) {
@@ -88,7 +88,7 @@ class Br {
88
88
  }
89
89
  }), pe()) {
90
90
  const a = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), o = L("gamer_token");
91
- (ue() || a && o) && (this.$gamerToken = o);
91
+ (le() || a && o) && (this.$gamerToken = o);
92
92
  }
93
93
  this.$gamerToken || this.loadGamerTokenCache();
94
94
  }
@@ -703,7 +703,7 @@ const v = {
703
703
  Daily: "daily",
704
704
  Weekly: "weekly",
705
705
  Monthly: "monthly"
706
- }, et = e.string().enum(We).lock(), l = {
706
+ }, et = e.string().enum(We).lock(), u = {
707
707
  /** 预约 */
708
708
  Preregister: "preregister",
709
709
  /** 抽奖 */
@@ -746,7 +746,7 @@ const v = {
746
746
  ClaimActivationKey: "claim_activation_key",
747
747
  /** 不朽箴言特有的 AI 聊天 */
748
748
  ZeroChatgpt: "zero_chatgpt"
749
- }, tt = e.string().enum(l).lock(), nt = {
749
+ }, tt = e.string().enum(u).lock(), nt = {
750
750
  /** 累计游戏内活跃值 */
751
751
  Active: "player_active_points",
752
752
  /** 累计登录,单位 人天 */
@@ -817,7 +817,7 @@ const v = {
817
817
  Private: "private",
818
818
  /** 公开队伍 */
819
819
  Public: "public"
820
- }, lt = e.string().enum(ct).lock(), f = {
820
+ }, ut = e.string().enum(ct).lock(), f = {
821
821
  /** 未知状态 */
822
822
  Unknown: "unknown",
823
823
  /** 等待开奖 */
@@ -828,7 +828,7 @@ const v = {
828
828
  Claimed: "claimed",
829
829
  /** 领奖失败 */
830
830
  Fail: "fail"
831
- }, Jr = e.string().enum(f).lock(), ut = {
831
+ }, Jr = e.string().enum(f).lock(), lt = {
832
832
  /** 发起组队 */
833
833
  Assemble: "assemble",
834
834
  /** 加入队伍 */
@@ -839,7 +839,7 @@ const v = {
839
839
  ChangeVisibility: "change_visibility",
840
840
  /** 查询组队信息 */
841
841
  Query: "query"
842
- }, Zr = e.string().enum(ut).lock(), mt = {
842
+ }, Zr = e.string().enum(lt).lock(), mt = {
843
843
  /** 查询抽奖券 */
844
844
  Query: "query",
845
845
  /** 开奖 */
@@ -878,7 +878,7 @@ const v = {
878
878
  feature_reward_type: e.string().enum("regular"),
879
879
  reward_details: e.array(yt)
880
880
  })
881
- ).satisfies().lock(), u = e.object({
881
+ ).satisfies().lock(), l = e.object({
882
882
  feature_name: e.string(),
883
883
  feature_id: e.number(),
884
884
  description: e.string(),
@@ -890,8 +890,8 @@ const v = {
890
890
  engage_account: Ye,
891
891
  feature_rewards: ht.clone().optional(),
892
892
  sort: e.number().optional()
893
- }), ft = l.Cashback, wt = e.object({
894
- ...u.shape,
893
+ }), ft = u.Cashback, wt = e.object({
894
+ ...l.shape,
895
895
  feature_type: e.string().enum(ft),
896
896
  config: e.object({
897
897
  order_start_time: e.number(),
@@ -899,24 +899,24 @@ const v = {
899
899
  claim_rewards_start_time: e.number(),
900
900
  claim_rewards_end_time: e.number()
901
901
  })
902
- }), kt = l.CheckIn, vt = e.object({
903
- ...u.shape,
902
+ }), kt = u.CheckIn, vt = e.object({
903
+ ...l.shape,
904
904
  feature_type: e.string().enum(kt)
905
- }), Ct = l.ClaimActivationKey, Vt = e.object({
906
- ...u.shape,
905
+ }), Ct = u.ClaimActivationKey, Vt = e.object({
906
+ ...l.shape,
907
907
  feature_type: e.string().enum(Ct)
908
- }), Rt = l.ClaimRewards, jt = e.object({
909
- ...u.shape,
908
+ }), Rt = u.ClaimRewards, jt = e.object({
909
+ ...l.shape,
910
910
  feature_type: e.string().enum(Rt)
911
- }), Tt = l.Comment, qt = e.object({
912
- ...u.shape,
911
+ }), Tt = u.Comment, qt = e.object({
912
+ ...l.shape,
913
913
  feature_type: e.string().enum(Tt),
914
914
  config: e.object({
915
915
  comments: e.array(e.string()),
916
916
  send_rate: e.number()
917
917
  })
918
- }), xt = l.Follow, St = e.object({
919
- ...u.shape,
918
+ }), xt = u.Follow, St = e.object({
919
+ ...l.shape,
920
920
  feature_type: e.string().enum(xt),
921
921
  config: e.object({
922
922
  platform: e.string(),
@@ -925,28 +925,28 @@ const v = {
925
925
  qr_code_url: e.string().optional(),
926
926
  platform_desc: e.string().optional()
927
927
  })
928
- }), Lt = l.GiftCode, Pt = e.object({
928
+ }), Lt = u.GiftCode, Pt = e.object({
929
929
  name: e.string(),
930
930
  icon_url: e.string(),
931
931
  count: e.number()
932
932
  }), Et = e.object({
933
- ...u.shape,
933
+ ...l.shape,
934
934
  feature_type: e.string().enum(Lt),
935
935
  config: e.object({
936
936
  gift_items: e.array(Pt),
937
937
  mp_url: e.string().optional(),
938
938
  mp_qrcode_url: e.string().optional()
939
939
  })
940
- }), $t = l.Invite, Ft = e.object({
941
- ...u.shape,
940
+ }), $t = u.Invite, Ft = e.object({
941
+ ...l.shape,
942
942
  feature_type: e.string().enum($t),
943
943
  config: e.object({
944
944
  share_url: e.string()
945
945
  })
946
- }), Ut = l.InvitedRegister, Dt = e.object({
947
- ...u.shape,
946
+ }), Ut = u.InvitedRegister, Dt = e.object({
947
+ ...l.shape,
948
948
  feature_type: e.string().enum(Ut)
949
- }), It = e.string().enum(P(v, "GiftCode", "LotteryTicket")), At = l.Lottery, Gt = e.object({
949
+ }), It = e.string().enum(P(v, "GiftCode", "LotteryTicket")), At = u.Lottery, Gt = e.object({
950
950
  reward_item_id: e.number(),
951
951
  reward_item_name: e.string(),
952
952
  reward_item_type: It,
@@ -956,7 +956,7 @@ const v = {
956
956
  reward_remaining_stock: e.number(),
957
957
  reward_item_rating: e.number()
958
958
  }), Ot = e.object({
959
- ...u.shape,
959
+ ...l.shape,
960
960
  feature_type: e.string().enum(At),
961
961
  config: e.object({
962
962
  consume_item_id: e.number(),
@@ -966,18 +966,18 @@ const v = {
966
966
  consume_item_desc: e.string().optional(),
967
967
  rewards: e.array(Gt)
968
968
  })
969
- }), Nt = l.LotteryDraw, Qt = e.object({
970
- ...u.shape,
969
+ }), Nt = u.LotteryDraw, Qt = e.object({
970
+ ...l.shape,
971
971
  feature_type: e.string().enum(Nt),
972
972
  config: e.object({
973
973
  draw_not_before: e.number(),
974
974
  draw_not_after: e.number()
975
975
  })
976
- }), Bt = l.Preregister, Mt = e.object({
977
- ...u.shape,
976
+ }), Bt = u.Preregister, Mt = e.object({
977
+ ...l.shape,
978
978
  feature_type: e.string().enum(Bt)
979
- }), Kt = l.Quest, Ht = e.object({
980
- ...u.shape,
979
+ }), Kt = u.Quest, Ht = e.object({
980
+ ...l.shape,
981
981
  feature_type: e.string().enum(Kt),
982
982
  config: e.object({
983
983
  objective: ee,
@@ -995,38 +995,38 @@ const v = {
995
995
  event_item_id: e.number().optional()
996
996
  }).optional()
997
997
  })
998
- }), zt = l.Register, Jt = e.object({
999
- ...u.shape,
998
+ }), zt = u.Register, Jt = e.object({
999
+ ...l.shape,
1000
1000
  feature_type: e.string().enum(zt)
1001
- }), Zt = l.Share, Xt = e.object({
1002
- ...u.shape,
1001
+ }), Zt = u.Share, Xt = e.object({
1002
+ ...l.shape,
1003
1003
  feature_type: e.string().enum(Zt),
1004
1004
  config: e.object({
1005
1005
  share_platform: e.string(),
1006
1006
  jump_url: e.string().optional(),
1007
1007
  icon_url: e.string().optional()
1008
1008
  })
1009
- }), Yt = l.Subscribe, Wt = e.object({
1010
- ...u.shape,
1009
+ }), Yt = u.Subscribe, Wt = e.object({
1010
+ ...l.shape,
1011
1011
  feature_type: e.string().enum(Yt),
1012
1012
  config: e.object({
1013
1013
  weixin_template_ids: e.array(e.string())
1014
1014
  })
1015
- }), en = l.Survey, tn = e.object({
1016
- ...u.shape,
1015
+ }), en = u.Survey, tn = e.object({
1016
+ ...l.shape,
1017
1017
  feature_type: e.string().enum(en),
1018
1018
  config: e.object({
1019
1019
  survey_id: e.string(),
1020
1020
  survey_url: e.string()
1021
1021
  })
1022
- }), nn = l.Team, rn = e.object({
1023
- ...u.shape,
1022
+ }), nn = u.Team, rn = e.object({
1023
+ ...l.shape,
1024
1024
  feature_type: e.string().enum(nn),
1025
1025
  config: e.object({
1026
1026
  max_members: e.number().min(1),
1027
1027
  min_members: e.number().min(1)
1028
1028
  })
1029
- }), an = l.Vote, on = e.object({
1029
+ }), an = u.Vote, on = e.object({
1030
1030
  sn: e.string(),
1031
1031
  name: e.string(),
1032
1032
  img_urls: e.array(e.string()).optional(),
@@ -1037,7 +1037,7 @@ const v = {
1037
1037
  finalists: e.bool(),
1038
1038
  last_vote_time: e.number()
1039
1039
  }), sn = e.object({
1040
- ...u.shape,
1040
+ ...l.shape,
1041
1041
  feature_type: e.string().enum(an),
1042
1042
  config: e.object({
1043
1043
  vote_feature_ids: e.array(e.number()),
@@ -1047,19 +1047,19 @@ const v = {
1047
1047
  options: e.array(on),
1048
1048
  rewards: e.array(y)
1049
1049
  })
1050
- }), cn = l.Vote2, ln = e.object({
1050
+ }), cn = u.Vote2, un = e.object({
1051
1051
  candidate_id: e.string(),
1052
1052
  display_name: e.string(),
1053
1053
  images: e.array(e.string()).optional(),
1054
1054
  videos: e.array(e.string()).optional(),
1055
1055
  description: e.string().optional(),
1056
1056
  jump_url: e.string()
1057
- }), un = e.object({
1058
- ...u.shape,
1057
+ }), ln = e.object({
1058
+ ...l.shape,
1059
1059
  feature_type: e.string().enum(cn),
1060
1060
  config: e.object({
1061
1061
  vote_item_id: e.number().optional(),
1062
- candidates: e.array(ln),
1062
+ candidates: e.array(un),
1063
1063
  vote_since: e.number(),
1064
1064
  vote_until: e.number(),
1065
1065
  rewards_since: e.number(),
@@ -1067,8 +1067,8 @@ const v = {
1067
1067
  winner_rewards: e.array(y).optional(),
1068
1068
  consolation_rewards: e.array(y).optional()
1069
1069
  })
1070
- }), mn = l.ZeroChatgpt, dn = e.object({
1071
- ...u.shape,
1070
+ }), mn = u.ZeroChatgpt, dn = e.object({
1071
+ ...l.shape,
1072
1072
  feature_type: e.string().enum(mn)
1073
1073
  }), gn = e.union(
1074
1074
  wt,
@@ -1089,7 +1089,7 @@ const v = {
1089
1089
  tn,
1090
1090
  rn,
1091
1091
  sn,
1092
- un,
1092
+ ln,
1093
1093
  Vt,
1094
1094
  dn
1095
1095
  ).key("feature_type").satisfies(), pn = e.object({
@@ -1182,7 +1182,7 @@ const v = {
1182
1182
  server_name: e.string()
1183
1183
  }), xn = e.object({
1184
1184
  team_code: e.string(),
1185
- visibility: lt,
1185
+ visibility: ut,
1186
1186
  members: e.array(
1187
1187
  e.object({
1188
1188
  is_leader: e.bool(),
@@ -1684,11 +1684,13 @@ class Wr {
1684
1684
  };
1685
1685
  }
1686
1686
  /**
1687
- * 领取投票(vote2)玩法获得的奖励
1687
+ * 产生投票(vote2)玩法获得的奖励,并非发放给用户;领取需要调用 claimRewardsV2
1688
+ *
1689
+ * path: event/vote2/rewards
1688
1690
  *
1689
1691
  * https://www.kdocs.cn/l/chlVWKom7DzU?linkname=fabGKteIEK
1690
1692
  */
1691
- async claimVote2Rewards(t, n) {
1693
+ async vote2Rewards(t, n) {
1692
1694
  if (!await this.token.autoLogin()) return null;
1693
1695
  const { data: r, code: a, message: o } = await this.req.post(
1694
1696
  "event/vote2/rewards",
@@ -1731,12 +1733,12 @@ class Wr {
1731
1733
  };
1732
1734
  }
1733
1735
  }
1734
- const lr = {
1736
+ const ur = {
1735
1737
  /** 所有人均可以发帖 */
1736
1738
  All: "all",
1737
1739
  /** 指定用户可发帖 */
1738
1740
  Limit: "limit"
1739
- }, ur = e.string().enum(lr).lock(), mr = {
1741
+ }, lr = e.string().enum(ur).lock(), mr = {
1740
1742
  /** 待审核(仅自己可见) */
1741
1743
  Pending: "pending",
1742
1744
  /** 审核通过 */
@@ -1783,7 +1785,7 @@ const lr = {
1783
1785
  name: e.string(),
1784
1786
  tags: e.array(e.string()),
1785
1787
  sort: e.number(),
1786
- mode: ur,
1788
+ mode: lr,
1787
1789
  member_ids: e.array(e.number())
1788
1790
  }).lock(), U = e.object({
1789
1791
  topic_id: e.number(),
@@ -2341,9 +2343,9 @@ class na {
2341
2343
  async webLogin(t = "snsapi_userinfo", n) {
2342
2344
  const r = L("code"), a = Date.now(), o = +L("state");
2343
2345
  if (!r || !o || o < a - 1e3 * 60 * 5 || o > a) {
2344
- const le = G(["code", "state"]);
2346
+ const ue = G(["code", "state"]);
2345
2347
  location.replace(
2346
- `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(le)}&response_type=code&scope=${t}&state=${a}#wechat_redirect`
2348
+ `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(ue)}&response_type=code&scope=${t}&state=${a}#wechat_redirect`
2347
2349
  );
2348
2350
  return;
2349
2351
  }
@@ -2436,6 +2438,7 @@ export {
2436
2438
  Un as CommentEngagementValidator,
2437
2439
  w as CommentValidator,
2438
2440
  ta as CommunityApi,
2441
+ $n as ConversationValidator,
2439
2442
  Xe as EngageAccountType,
2440
2443
  Ye as EngageAccountTypeValidator,
2441
2444
  Nn as EngageResponseValidator,
@@ -2460,7 +2463,7 @@ export {
2460
2463
  Wt as EventFeatureConfigOfSubscribeValidator,
2461
2464
  tn as EventFeatureConfigOfSurveyValidator,
2462
2465
  rn as EventFeatureConfigOfTeamValidator,
2463
- un as EventFeatureConfigOfVote2Validator,
2466
+ ln as EventFeatureConfigOfVote2Validator,
2464
2467
  sn as EventFeatureConfigOfVoteValidator,
2465
2468
  gn as EventFeatureConfigValidator,
2466
2469
  We as EventPeriodType,
@@ -2469,10 +2472,10 @@ export {
2469
2472
  Ge as ExtraGameRewardValidator,
2470
2473
  Ae as ExtraPhysicalShipmentValidator,
2471
2474
  ht as FeatureRewardValidator,
2472
- l as FeatureType,
2475
+ u as FeatureType,
2473
2476
  tt as FeatureTypeValidator,
2474
- lr as ForumMode,
2475
- ur as ForumModeValidator,
2477
+ ur as ForumMode,
2478
+ lr as ForumModeValidator,
2476
2479
  oe as ForumValidator,
2477
2480
  v as GamerItemType,
2478
2481
  Y as GamerItemTypeValidator,
@@ -2534,13 +2537,13 @@ export {
2534
2537
  Pe as ServerBaseInfoValidator,
2535
2538
  Rn as ShareEngagementDataValidator,
2536
2539
  Tn as SurveyEngagementDataValidator,
2537
- ut as TeamAction,
2540
+ lt as TeamAction,
2538
2541
  Zr as TeamActionValidator,
2539
2542
  xn as TeamEngagementDataValidator,
2540
2543
  qn as TeamEngagementValidator,
2541
2544
  Yr as TeamMemberValidator,
2542
2545
  ct as TeamVisibility,
2543
- lt as TeamVisibilityValidator,
2546
+ ut as TeamVisibilityValidator,
2544
2547
  U as TopicValidator,
2545
2548
  F as UserEngagementDataValidator,
2546
2549
  An as UserEngagementValidator,
@@ -2557,5 +2560,6 @@ export {
2557
2560
  na as WeixinApi,
2558
2561
  jn as WeixinSubscribeEngagementDataValidator,
2559
2562
  Gr as WeixinWebLoginErrorCode,
2563
+ Fn as ZeroChatGPTDataValidator,
2560
2564
  Ar as isWeixinSignResponse
2561
2565
  };
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.11.1",
4
+ "version": "2.11.2",
5
5
  "type": "module",
6
6
  "source": "index.ts",
7
7
  "main": "./dist/index.js",
@@ -30,17 +30,17 @@
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
32
  "@types/node": "^22.13.1",
33
- "@seayoo-web/scripts": "3.1.5",
33
+ "@seayoo-web/combo-webview": "2.8.0",
34
34
  "@seayoo-web/request": "3.4.0",
35
- "@seayoo-web/combo-webview": "2.7.0",
35
+ "@seayoo-web/scripts": "3.1.5",
36
36
  "@seayoo-web/tsconfig": "1.0.5",
37
- "@seayoo-web/utils": "4.1.3",
38
- "@seayoo-web/validator": "1.1.1"
37
+ "@seayoo-web/validator": "1.1.1",
38
+ "@seayoo-web/utils": "4.1.3"
39
39
  },
40
40
  "peerDependencies": {
41
- "@seayoo-web/validator": "^1.1.1",
42
- "@seayoo-web/combo-webview": "^2.7.0",
43
- "@seayoo-web/utils": "^4.1.3"
41
+ "@seayoo-web/combo-webview": "^2.8.0",
42
+ "@seayoo-web/utils": "^4.1.3",
43
+ "@seayoo-web/validator": "^1.1.1"
44
44
  },
45
45
  "scripts": {
46
46
  "prebuild": "pnpm -F validator build && pnpm -F request build && pnpm -F combo-webview build",
@@ -1,6 +1,6 @@
1
1
  import type { EventFeatureBaseConfig } from "./feature.base";
2
2
  import type { InferType } from "@seayoo-web/validator";
3
- declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"credit" | "activation_key" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "external_gift_code" | "void_item", false, false>;
3
+ declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"credit" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "activation_key" | "external_gift_code" | "void_item", false, false>;
4
4
  declare const featureType: "lottery";
5
5
  export interface FeatureLotteryItemConfig {
6
6
  /** 抽奖奖励道具 id */
@@ -1,5 +1,5 @@
1
1
  import type { InferType } from "@seayoo-web/validator";
2
- declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"credit" | "activation_key" | "gift_code" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "lottery_ticket" | "external_gift_code" | "void_item", false, false>;
2
+ declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"credit" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "gift_code" | "activation_key" | "lottery_ticket" | "external_gift_code" | "void_item", false, false>;
3
3
  export interface EventRewardItemConfig {
4
4
  /** 玩法奖励道具 id */
5
5
  reward_item_id: number;
@@ -313,11 +313,13 @@ export declare class EventApi {
313
313
  error: RequestInternalError | "invalid_token" | "feature_not_found";
314
314
  } | null>;
315
315
  /**
316
- * 领取投票(vote2)玩法获得的奖励
316
+ * 产生投票(vote2)玩法获得的奖励,并非发放给用户;领取需要调用 claimRewardsV2
317
+ *
318
+ * path: event/vote2/rewards
317
319
  *
318
320
  * https://www.kdocs.cn/l/chlVWKom7DzU?linkname=fabGKteIEK
319
321
  */
320
- claimVote2Rewards(featureId: number, requestOptions?: IRequestOptions): Promise<import("./event.engage").Vote2ClaimRewardsResponse | {
322
+ vote2Rewards(featureId: number, requestOptions?: IRequestOptions): Promise<import("./event.engage").Vote2ClaimRewardsResponse | {
321
323
  message: string;
322
324
  code: RequestInternalError | "vote_rewards_not_started" | "vote_rewards_already_ended" | "engagement_not_found";
323
325
  } | null>;
@@ -28,6 +28,7 @@ export * from "./engage.team";
28
28
  export * from "./engage.vote";
29
29
  export * from "./engage.vote2";
30
30
  export * from "./engage.claimActivationKey";
31
+ export * from "./engage.zeroChatGPT";
31
32
  export type EmptyObject = Record<string | number | symbol, never>;
32
33
  export type UserEngagementData = PreregisterEngagementData | LotteryEngagementData | SurveyEngagementData | InviteEngagementData | ShareEngagementData | VoteEngagementData | Vote2EngagementData | WeixinSubscribeEngagementData | CashbackEngagementData | GiftCodeEngagementData | TeamEngagementData | QuestEngagementData | LotteryDrawEngagementData | ClaimActivationKeyEngagementData | ZeroChatGPTData | EmptyObject;
33
34
  export declare const UserEngagementDataValidator: import("@seayoo-web/validator").UnionValidator<[import("@seayoo-web/validator").ObjectValidator<{