@seayoo-web/gamer-api 2.2.2 → 2.3.1

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 (64) hide show
  1. package/dist/index.js +736 -664
  2. package/package.json +6 -6
  3. package/types/src/club.d.ts +21 -21
  4. package/types/src/community.d.ts +20 -20
  5. package/types/src/event.config/feature.lottery.d.ts +1 -1
  6. package/types/src/event.config/reward.d.ts +1 -1
  7. package/types/src/event.d.ts +19 -19
  8. package/types/src/event.engage/index.d.ts +2 -2
  9. package/types/src/weixin.d.ts +4 -4
  10. package/types/index.d.ts +0 -5
  11. package/types/src/club.define.d.ts +0 -371
  12. package/types/src/club.enums.d.ts +0 -104
  13. package/types/src/club.guards.d.ts +0 -33
  14. package/types/src/community.define.d.ts +0 -331
  15. package/types/src/community.enums.d.ts +0 -99
  16. package/types/src/community.guards.d.ts +0 -52
  17. package/types/src/event.config/feature.base.d.ts +0 -23
  18. package/types/src/event.config/feature.cashback.d.ts +0 -18
  19. package/types/src/event.config/feature.checkIn.d.ts +0 -7
  20. package/types/src/event.config/feature.claimActivationKey.d.ts +0 -7
  21. package/types/src/event.config/feature.claimRewards.d.ts +0 -7
  22. package/types/src/event.config/feature.comment.d.ts +0 -14
  23. package/types/src/event.config/feature.d.ts +0 -40
  24. package/types/src/event.config/feature.follow.d.ts +0 -24
  25. package/types/src/event.config/feature.giftcode.d.ts +0 -24
  26. package/types/src/event.config/feature.invite.d.ts +0 -12
  27. package/types/src/event.config/feature.invitedRegister.d.ts +0 -7
  28. package/types/src/event.config/feature.lotteryDraw.d.ts +0 -14
  29. package/types/src/event.config/feature.preregister.d.ts +0 -7
  30. package/types/src/event.config/feature.quest.d.ts +0 -31
  31. package/types/src/event.config/feature.register.d.ts +0 -7
  32. package/types/src/event.config/feature.share.d.ts +0 -16
  33. package/types/src/event.config/feature.subscribe.d.ts +0 -12
  34. package/types/src/event.config/feature.survey.d.ts +0 -14
  35. package/types/src/event.config/feature.team.d.ts +0 -14
  36. package/types/src/event.config/feature.vote.d.ts +0 -44
  37. package/types/src/event.config/index.d.ts +0 -23
  38. package/types/src/event.config.d.ts +0 -228
  39. package/types/src/event.define.d.ts +0 -48
  40. package/types/src/event.engage/engage.cashback.d.ts +0 -9
  41. package/types/src/event.engage/engage.claimActivationKey.d.ts +0 -5
  42. package/types/src/event.engage/engage.comment.d.ts +0 -22
  43. package/types/src/event.engage/engage.d.ts +0 -49
  44. package/types/src/event.engage/engage.giftcode.d.ts +0 -5
  45. package/types/src/event.engage/engage.invite.d.ts +0 -9
  46. package/types/src/event.engage/engage.lottery.d.ts +0 -9
  47. package/types/src/event.engage/engage.lotteryDraw.d.ts +0 -40
  48. package/types/src/event.engage/engage.lotteryDraw.reward.d.ts +0 -38
  49. package/types/src/event.engage/engage.preregister.d.ts +0 -11
  50. package/types/src/event.engage/engage.quest.d.ts +0 -28
  51. package/types/src/event.engage/engage.share.d.ts +0 -9
  52. package/types/src/event.engage/engage.subscribe.d.ts +0 -14
  53. package/types/src/event.engage/engage.survey.d.ts +0 -7
  54. package/types/src/event.engage/engage.team.d.ts +0 -53
  55. package/types/src/event.engage/engage.vote.d.ts +0 -9
  56. package/types/src/event.engage/reward.d.ts +0 -52
  57. package/types/src/event.enums.d.ts +0 -392
  58. package/types/src/event.guards.d.ts +0 -38
  59. package/types/src/token.d.ts +0 -93
  60. package/types/src/token.define.d.ts +0 -31
  61. package/types/src/token.guards.d.ts +0 -5
  62. package/types/src/utils.d.ts +0 -12
  63. package/types/src/weixin.define.d.ts +0 -46
  64. package/types/src/weixin.guards.d.ts +0 -2
@@ -1,93 +0,0 @@
1
- import { type StorageHelper } from "./utils";
2
- import type { NetRequestFactory } from "@seayoo-web/request";
3
- export * from "./token.define";
4
- /**
5
- * auth 管理工具 + request 工具
6
- *
7
- * 核心概念如下:
8
- *
9
- * - [ID Token](https://365.kdocs.cn/l/ctrXywvA1Wfd)
10
- * - [Gamer Token](https://365.kdocs.cn/l/crZwOsI54RBH)
11
- * - [Weixin Token](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=YtzQpmRQ0v)
12
- */
13
- export declare class AuthToken {
14
- private $NetRequest;
15
- private $idToken;
16
- private $weixinToken;
17
- private $gamerToken;
18
- req: ReturnType<NetRequestFactory>;
19
- storage: StorageHelper;
20
- constructor(
21
- /**
22
- * 服务端点
23
- *
24
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=k2iGGXbfov
25
- */
26
- endpoint: string,
27
- /** request 工具类 */
28
- NetRequest: NetRequestFactory);
29
- get NetRequest(): typeof import("@seayoo-web/request").NetRequest;
30
- private loadGamerTokenCache;
31
- /** 当前是否为登录状态,即是否拥有 gamerToken */
32
- get isLoggedIn(): boolean;
33
- /** 读取已经设置的 idToken */
34
- get idToken(): string;
35
- /** 设置从登录组件获取的 Id Token,用于后续请求自动置换 Gamer Token */
36
- set idToken(value: string);
37
- /** 读取设置 weixinToken */
38
- get weixinToken(): string;
39
- /**
40
- * 设置 Weixin Token,用于后续请求自动置换 Gamer Token
41
- *
42
- * 仅仅在微信小程序模式下有效
43
- */
44
- set weixinToken(value: string);
45
- /** 读取自动置换的 gamerToken */
46
- get gamerToken(): string;
47
- /**
48
- * 直接写入 Gamer Token,并更新缓存
49
- */
50
- set gamerToken(value: string);
51
- /**
52
- * 退出登录,销毁相关 Token
53
- */
54
- logout(): void;
55
- /**
56
- * 用世游通行证统一登录能力签发的 ID Token / Weixin Token,自动置换 Gamer Token,成功后会自动设置后续 Request Headers
57
- *
58
- * [世游通行证统一登录](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=FJXYgqvLHs)
59
- *
60
- * [世游通行证统一登录 - Web 站点](https://365.kdocs.cn/l/cf57sp1qLlZh)
61
- *
62
- * [世游通行证统一登录 - 微信小程序](https://365.kdocs.cn/l/ccHVuUs0UsZs)
63
- *
64
- * - 此方法通常不需要手动调用,在需要登录的接口调用时会自动执行
65
- * - 为了提高页面执行速度,可以在设置 Token 后立即调用 autoLogin
66
- *
67
- * 🔕请求静默进行,无消息提示
68
- *
69
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=ReeJpWraRO
70
- */
71
- autoLogin(): Promise<boolean>;
72
- /**
73
- * 获取当前登录用户的 Session 的信息
74
- *
75
- * 🔕请求静默进行,无消息提示
76
- *
77
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OdGVCdQxEu
78
- */
79
- getSession(): Promise<import("./token.define").GamerSession | null>;
80
- /**
81
- * 实名认证
82
- *
83
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=kZYnwX6RcF
84
- */
85
- authRealName(option: {
86
- /** 用户输入的真实姓名。明文或者密文 */
87
- real_name: string;
88
- /** 用户输入的身份证号码。明文或者密文 */
89
- identity_card: string;
90
- /** 预留参数,是否加密 real_name 和 identity_card,加密的密钥应当使用 api 服务的 ECDSA Public Key */
91
- encrypted?: boolean;
92
- }): Promise<import("./token.define").GamerSession | null>;
93
- }
@@ -1,31 +0,0 @@
1
- export type PopupFn = (option: {
2
- title?: string;
3
- content: string;
4
- cancelText?: string;
5
- confirmText: string;
6
- onCancel?: () => void;
7
- onConfirm: () => void;
8
- }) => void;
9
- export type ToastFn = (content: string, timeout?: number) => void;
10
- export interface GamerSession {
11
- /** 世游通行证 ID */
12
- seayoo_user_id?: string;
13
- /** 手机号码(掩码形式) */
14
- seayoo_mobile?: string;
15
- /**
16
- * 世游通行证用户实名信息(掩码形式);即将去除此字段,使用 has_real_name 代替
17
- * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OdGVCdQxEu
18
- * @deprecated
19
- */
20
- seayoo_real_name?: string;
21
- /** 是否已经具有世游通行证用户实名信息 */
22
- has_real_name?: boolean;
23
- /** Combo ID */
24
- combo_id?: string;
25
- /**
26
- * combo_id 背后的 IdP
27
- *
28
- * 取值参见 [Combo Client REST API 中的 idp](https://kdocs.cn/l/cg0cfHzazsta?linkname=ZVDdf1pe48),仅当 combo_id 有值时才有值
29
- */
30
- combo_idp?: string;
31
- }
@@ -1,5 +0,0 @@
1
- import type { GamerSession } from "./token.define";
2
- export declare function isGamerTokenResponse(data: unknown): data is {
3
- gamer_token: string;
4
- };
5
- export declare function isGetSessionResponse(data: unknown): data is GamerSession;
@@ -1,12 +0,0 @@
1
- export declare const console: Pick<Console, "log" | "error" | "warn">;
2
- /** 检测是否在 combo webview */
3
- export declare function inComboWebview(): boolean;
4
- export declare function isRootEndpoint(path: string): boolean;
5
- export declare function getWeixinLoginCode(): Promise<string>;
6
- export type StorageHelper = {
7
- set(key: string, value: string): void;
8
- get(key: string): string;
9
- remove(key: string): void;
10
- };
11
- export declare const localStorageHelper: StorageHelper;
12
- export declare const weixinStorageHelper: StorageHelper;
@@ -1,46 +0,0 @@
1
- export interface WeixinLoginResponse {
2
- /** 微信小程序下,用户的 open_id */
3
- open_id: string;
4
- /** 微信小程序所在的微信开放平台账号下,用户的 union_id */
5
- union_id: string;
6
- /**
7
- * Gamer 为这个微信小程序用户签发的 Weixin Token。长期有效
8
- *
9
- * 对 Weixin Token 的详细描述请阅读 [世游用户运营 - JWT 场景与规范](https://365.kdocs.cn/l/cbxbzWc6zSgY)
10
- */
11
- weixin_token: string;
12
- }
13
- export declare const isWeixinSignResponse: (data: unknown) => data is {
14
- nonce_str: string;
15
- timestamp: number;
16
- signature: string;
17
- };
18
- /**
19
- * 微信web登录错误码
20
- *
21
- * https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html
22
- */
23
- export declare const enum WeixinWebLoginErrorCode {
24
- /** redirect_uri域名与后台配置不一致 */
25
- RedirectUriDisMatch = "10003",
26
- /** 不支持微信开放平台的 Appid,请使用公众号Appid */
27
- AppidError = "10016",
28
- /** 公众号未授权第三方平台,请检查授权状态 */
29
- AuthorizationError = "10015",
30
- /** 此公众号并没有这些 scope 的权限 */
31
- NoRightForScope = "10005",
32
- /** 操作太频繁了,请稍后重试 */
33
- Frequently = "10009",
34
- /** 此公众号被封禁 */
35
- AppBanded = "10004",
36
- /** 必须关注此测试号 */
37
- ShouldFollow = "10006",
38
- /** scope不能为空 */
39
- ScopeNull = "10010",
40
- /** redirect_uri不能为空 */
41
- RedirectUriNull = "10011",
42
- /** appid不能为空 */
43
- AppidNull = "10012",
44
- /** state不能为空 */
45
- StateNull = "10013"
46
- }
@@ -1,2 +0,0 @@
1
- import type { WeixinLoginResponse } from "./weixin.define";
2
- export declare function isWeixinLoginResponse(data: unknown): data is WeixinLoginResponse;