@heybox/hb-sdk-protocol 0.8.1 → 0.8.2-alpha.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.
package/dist/index.cjs.js CHANGED
@@ -593,8 +593,8 @@ function isOperationList(value) {
593
593
  new Set(value).size === value.length);
594
594
  }
595
595
 
596
- /** 当前用户信息与登录能力支持的完整 scope 目录。 */
597
- const USER_INFO_AUTHORIZATION_SCOPES = ['identity', 'profile'];
596
+ /** 当前用户信息与登录能力支持的完整 scope 目录(canonical 顺序)。 */
597
+ const USER_INFO_AUTHORIZATION_SCOPES = ['identity', 'profile', 'steam_account'];
598
598
  /** Companion alias 的跨构建、Runtime 与 Host 规范。 */
599
599
  const COMPANION_ALIAS_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
600
600
  /** Companion Host 可跨 bridge 保留的稳定领域错误码。 */
package/dist/index.esm.js CHANGED
@@ -591,8 +591,8 @@ function isOperationList(value) {
591
591
  new Set(value).size === value.length);
592
592
  }
593
593
 
594
- /** 当前用户信息与登录能力支持的完整 scope 目录。 */
595
- const USER_INFO_AUTHORIZATION_SCOPES = ['identity', 'profile'];
594
+ /** 当前用户信息与登录能力支持的完整 scope 目录(canonical 顺序)。 */
595
+ const USER_INFO_AUTHORIZATION_SCOPES = ['identity', 'profile', 'steam_account'];
596
596
  /** Companion alias 的跨构建、Runtime 与 Host 规范。 */
597
597
  const COMPANION_ALIAS_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
598
598
  /** Companion Host 可跨 bridge 保留的稳定领域错误码。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk-protocol",
3
- "version": "0.8.1",
3
+ "version": "0.8.2-alpha.1",
4
4
  "description": "Heybox mini-program iframe bridge wire contracts.",
5
5
  "sideEffects": false,
6
6
  "exports": {
package/src/payloads.ts CHANGED
@@ -1,5 +1,5 @@
1
- /** 当前用户信息与登录能力支持的完整 scope 目录。 */
2
- export const USER_INFO_AUTHORIZATION_SCOPES = ['identity', 'profile'] as const;
1
+ /** 当前用户信息与登录能力支持的完整 scope 目录(canonical 顺序)。 */
2
+ export const USER_INFO_AUTHORIZATION_SCOPES = ['identity', 'profile', 'steam_account'] as const;
3
3
 
4
4
  /** 用户信息授权 scope。 */
5
5
  export type UserInfoAuthorizationScope = (typeof USER_INFO_AUTHORIZATION_SCOPES)[number];
@@ -16,10 +16,19 @@ export interface LoginResult {
16
16
  /** 用户资料授权状态。 */
17
17
  export type UserInfoAuthorizationStatus = 'not_required' | 'not_requested' | 'granted' | 'denied';
18
18
 
19
- type CanonicalUserInfoAuthorization = Record<UserInfoAuthorizationScope, UserInfoAuthorizationStatus>;
20
-
21
- /** 当前小程序对 canonical 用户信息 scope 的授权状态。 */
22
- export interface UserInfoAuthorization extends CanonicalUserInfoAuthorization {}
19
+ /**
20
+ * 当前小程序对 canonical 用户信息 scope 的授权状态。
21
+ *
22
+ * @remarks
23
+ * `steam_account` 是可选键:新能力版本的 Runtime 必定返回,legacy Runtime/Version 可以
24
+ * 缺失。已授权不代表当前一定已绑定 Steam,只有 {@link AuthorizedUserInfo.steam_id}
25
+ * 存在才表示当前有主绑定。
26
+ */
27
+ export interface UserInfoAuthorization {
28
+ identity: UserInfoAuthorizationStatus;
29
+ profile: UserInfoAuthorizationStatus;
30
+ steam_account?: UserInfoAuthorizationStatus;
31
+ }
23
32
 
24
33
  /**
25
34
  * 已获准向当前小程序披露的用户资料。
@@ -43,6 +52,14 @@ export interface AuthorizedUserInfo {
43
52
  app_user_id: string;
44
53
  /** `profile` 已授权时返回昵称与头像;当前 Heybox Runtime 在无网络模式下隐式授予该 scope。 */
45
54
  profile: { nickname: string; avatar: string } | null;
55
+ /**
56
+ * `steam_account` 已授权且当前已绑定 Steam 时返回 canonical SteamID64。
57
+ *
58
+ * @remarks
59
+ * 始终表示为 string,禁止作为 JSON number 使用;未绑定时省略该字段,不返回空字符串或
60
+ * `null`。只返回主绑定 SteamID64,不包含 Steam 昵称、头像、好友码、公开状态或绑定来源。
61
+ */
62
+ steam_id?: string;
46
63
  }
47
64
 
48
65
  /**
@@ -1,5 +1,5 @@
1
- /** 当前用户信息与登录能力支持的完整 scope 目录。 */
2
- export declare const USER_INFO_AUTHORIZATION_SCOPES: readonly ["identity", "profile"];
1
+ /** 当前用户信息与登录能力支持的完整 scope 目录(canonical 顺序)。 */
2
+ export declare const USER_INFO_AUTHORIZATION_SCOPES: readonly ["identity", "profile", "steam_account"];
3
3
  /** 用户信息授权 scope。 */
4
4
  export type UserInfoAuthorizationScope = (typeof USER_INFO_AUTHORIZATION_SCOPES)[number];
5
5
  /** 登录请求使用与用户信息授权相同的 canonical scope。 */
@@ -14,9 +14,18 @@ export interface LoginResult {
14
14
  }
15
15
  /** 用户资料授权状态。 */
16
16
  export type UserInfoAuthorizationStatus = 'not_required' | 'not_requested' | 'granted' | 'denied';
17
- type CanonicalUserInfoAuthorization = Record<UserInfoAuthorizationScope, UserInfoAuthorizationStatus>;
18
- /** 当前小程序对 canonical 用户信息 scope 的授权状态。 */
19
- export interface UserInfoAuthorization extends CanonicalUserInfoAuthorization {
17
+ /**
18
+ * 当前小程序对 canonical 用户信息 scope 的授权状态。
19
+ *
20
+ * @remarks
21
+ * `steam_account` 是可选键:新能力版本的 Runtime 必定返回,legacy Runtime/Version 可以
22
+ * 缺失。已授权不代表当前一定已绑定 Steam,只有 {@link AuthorizedUserInfo.steam_id}
23
+ * 存在才表示当前有主绑定。
24
+ */
25
+ export interface UserInfoAuthorization {
26
+ identity: UserInfoAuthorizationStatus;
27
+ profile: UserInfoAuthorizationStatus;
28
+ steam_account?: UserInfoAuthorizationStatus;
20
29
  }
21
30
  /**
22
31
  * 已获准向当前小程序披露的用户资料。
@@ -43,6 +52,14 @@ export interface AuthorizedUserInfo {
43
52
  nickname: string;
44
53
  avatar: string;
45
54
  } | null;
55
+ /**
56
+ * `steam_account` 已授权且当前已绑定 Steam 时返回 canonical SteamID64。
57
+ *
58
+ * @remarks
59
+ * 始终表示为 string,禁止作为 JSON number 使用;未绑定时省略该字段,不返回空字符串或
60
+ * `null`。只返回主绑定 SteamID64,不包含 Steam 昵称、头像、好友码、公开状态或绑定来源。
61
+ */
62
+ steam_id?: string;
46
63
  }
47
64
  /**
48
65
  * 当前黑盒 APP 登录态、授权状态和已获准披露的用户资料。