@heybox/hb-sdk 0.7.2-alpha.0 → 0.7.3-alpha.0
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/CHANGELOG.md +8 -0
- package/README.md +10 -10
- package/dist/cli-chunks/{build-DbQt0LIs.cjs → build-CIZIWLmV.cjs} +2 -2
- package/dist/cli-chunks/{context-Cmrhge3Y.cjs → context-DdKKaf1o.cjs} +1 -1
- package/dist/cli-chunks/{create-5ZLxb2p_.cjs → create-C5CW72BF.cjs} +1 -1
- package/dist/cli-chunks/{dev-CWSJ0YIw.cjs → dev-CH2yODBH.cjs} +5 -5
- package/dist/cli-chunks/{doctor-CpFYiqK9.cjs → doctor-SHwm6xSx.cjs} +1 -1
- package/dist/cli-chunks/{index-DomfJMuO.cjs → index-DIwi_FPa.cjs} +1 -1
- package/dist/cli-chunks/{index-BV8DdyEP.cjs → index-DiGjTruv.cjs} +14 -14
- package/dist/cli-chunks/{login-DhD2o29N.cjs → login-BrtCvOEN.cjs} +2 -2
- package/dist/cli-chunks/{project-vite-8IkVMyPu.cjs → project-vite-BoMy-fAP.cjs} +1 -1
- package/dist/cli-chunks/{remote-BZ6rfyuZ.cjs → remote-BDj3TcU7.cjs} +4 -4
- package/dist/cli-chunks/{session-DnqyIY87.cjs → session-DyEpQQ67.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/mock-host/main.js +78 -60
- package/dist/index.cjs.js +3 -11
- package/dist/index.esm.js +3 -11
- package/dist/protocol.cjs.js +0 -10
- package/dist/protocol.esm.js +1 -10
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.esm.js +1 -1
- package/package.json +2 -2
- package/skill/SKILL.md +4 -4
- package/skill/references/api-protocol.md +2 -5
- package/skill/references/api-root.md +9 -18
- package/skill/references/cli.md +2 -2
- package/skill/references/examples.md +5 -11
- package/skill/references/recipes.md +16 -33
- package/skill/references/safety-boundaries.md +2 -2
- package/skill/scripts/sync-references.mjs +6 -12
- package/skill/scripts/validate-skill.mjs +7 -1
- package/skill/skill.json +4 -4
- package/types/index.d.ts +1 -1
- package/types/modules/user/get-info.d.ts +2 -2
- package/types/modules/user/index.d.ts +1 -5
- package/types/modules/user/types.d.ts +5 -3
- package/types/protocol/capabilities.d.ts +2 -12
- package/types/protocol.d.ts +2 -2
- package/types/modules/user/get-local-identity.d.ts +0 -9
package/dist/index.cjs.js
CHANGED
|
@@ -640,7 +640,7 @@ function createMessageId() {
|
|
|
640
640
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
641
641
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
642
642
|
? undefined
|
|
643
|
-
: '0.7.
|
|
643
|
+
: '0.7.3-alpha.0';
|
|
644
644
|
|
|
645
645
|
/**
|
|
646
646
|
* 判断未知数据是否符合小程序 bridge 消息信封。
|
|
@@ -1019,8 +1019,6 @@ class MiniProgramBridgeClient {
|
|
|
1019
1019
|
const AUTH_LOGIN_METHOD = 'auth.login';
|
|
1020
1020
|
/** 读取当前登录态、授权状态和已获准披露资料的 bridge method 标识。 */
|
|
1021
1021
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
1022
|
-
/** 读取当前用户小程序隔离身份的 bridge method 标识。 */
|
|
1023
|
-
const USER_GET_LOCAL_IDENTITY_METHOD = 'user.getLocalIdentity';
|
|
1024
1022
|
/** 撤销当前用户授予本小程序授权的 bridge method 标识。 */
|
|
1025
1023
|
const USER_REVOKE_AUTHORIZATION_METHOD = 'user.revokeAuthorization';
|
|
1026
1024
|
/** 读取当前已登录用户 Steam 游戏库的 bridge method 标识。 */
|
|
@@ -1450,8 +1448,8 @@ function createViewportModule(requester) {
|
|
|
1450
1448
|
*
|
|
1451
1449
|
* @returns 当前用户的登录态与公开基础资料。
|
|
1452
1450
|
*
|
|
1453
|
-
*
|
|
1454
|
-
* 授权后返回昵称与头像。未登录时返回
|
|
1451
|
+
* 未开通网络权限且当前黑盒 APP 用户已登录时,该能力会静默建立或读取按小程序隔离的
|
|
1452
|
+
* `app_user_id`,不展示授权 UI;仅在 profile 授权后返回昵称与头像。未登录时返回
|
|
1455
1453
|
* `{ isHeyboxAppLoggedIn: false, authorization: null, userInfo: null }`。
|
|
1456
1454
|
*
|
|
1457
1455
|
* @throws {HbMiniProgramSDKError} 当 SDK 调用失败时抛出。
|
|
@@ -1460,10 +1458,6 @@ function getInfo(requester) {
|
|
|
1460
1458
|
return requester.request(USER_GET_INFO_METHOD);
|
|
1461
1459
|
}
|
|
1462
1460
|
|
|
1463
|
-
function getLocalIdentity(requester) {
|
|
1464
|
-
return requester.request(USER_GET_LOCAL_IDENTITY_METHOD);
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
1461
|
function revokeAuthorization(requester) {
|
|
1468
1462
|
return requester.request(USER_REVOKE_AUTHORIZATION_METHOD);
|
|
1469
1463
|
}
|
|
@@ -1482,7 +1476,6 @@ function getSteamGameList(requester, options) {
|
|
|
1482
1476
|
function createUserModule(requester) {
|
|
1483
1477
|
return {
|
|
1484
1478
|
getInfo: () => getInfo(requester),
|
|
1485
|
-
getLocalIdentity: () => getLocalIdentity(requester),
|
|
1486
1479
|
revokeAuthorization: () => revokeAuthorization(requester),
|
|
1487
1480
|
getSteamGameList: (options) => getSteamGameList(requester, options),
|
|
1488
1481
|
};
|
|
@@ -1785,7 +1778,6 @@ const auth = {
|
|
|
1785
1778
|
/** 默认 SDK 实例的用户资料模块。 */
|
|
1786
1779
|
const user = {
|
|
1787
1780
|
getInfo: () => getDefaultSDK().user.getInfo(),
|
|
1788
|
-
getLocalIdentity: () => getDefaultSDK().user.getLocalIdentity(),
|
|
1789
1781
|
revokeAuthorization: () => getDefaultSDK().user.revokeAuthorization(),
|
|
1790
1782
|
getSteamGameList: (options) => getDefaultSDK().user.getSteamGameList(options),
|
|
1791
1783
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -636,7 +636,7 @@ function createMessageId() {
|
|
|
636
636
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
637
637
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
638
638
|
? undefined
|
|
639
|
-
: '0.7.
|
|
639
|
+
: '0.7.3-alpha.0';
|
|
640
640
|
|
|
641
641
|
/**
|
|
642
642
|
* 判断未知数据是否符合小程序 bridge 消息信封。
|
|
@@ -1015,8 +1015,6 @@ class MiniProgramBridgeClient {
|
|
|
1015
1015
|
const AUTH_LOGIN_METHOD = 'auth.login';
|
|
1016
1016
|
/** 读取当前登录态、授权状态和已获准披露资料的 bridge method 标识。 */
|
|
1017
1017
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
1018
|
-
/** 读取当前用户小程序隔离身份的 bridge method 标识。 */
|
|
1019
|
-
const USER_GET_LOCAL_IDENTITY_METHOD = 'user.getLocalIdentity';
|
|
1020
1018
|
/** 撤销当前用户授予本小程序授权的 bridge method 标识。 */
|
|
1021
1019
|
const USER_REVOKE_AUTHORIZATION_METHOD = 'user.revokeAuthorization';
|
|
1022
1020
|
/** 读取当前已登录用户 Steam 游戏库的 bridge method 标识。 */
|
|
@@ -1446,8 +1444,8 @@ function createViewportModule(requester) {
|
|
|
1446
1444
|
*
|
|
1447
1445
|
* @returns 当前用户的登录态与公开基础资料。
|
|
1448
1446
|
*
|
|
1449
|
-
*
|
|
1450
|
-
* 授权后返回昵称与头像。未登录时返回
|
|
1447
|
+
* 未开通网络权限且当前黑盒 APP 用户已登录时,该能力会静默建立或读取按小程序隔离的
|
|
1448
|
+
* `app_user_id`,不展示授权 UI;仅在 profile 授权后返回昵称与头像。未登录时返回
|
|
1451
1449
|
* `{ isHeyboxAppLoggedIn: false, authorization: null, userInfo: null }`。
|
|
1452
1450
|
*
|
|
1453
1451
|
* @throws {HbMiniProgramSDKError} 当 SDK 调用失败时抛出。
|
|
@@ -1456,10 +1454,6 @@ function getInfo(requester) {
|
|
|
1456
1454
|
return requester.request(USER_GET_INFO_METHOD);
|
|
1457
1455
|
}
|
|
1458
1456
|
|
|
1459
|
-
function getLocalIdentity(requester) {
|
|
1460
|
-
return requester.request(USER_GET_LOCAL_IDENTITY_METHOD);
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
1457
|
function revokeAuthorization(requester) {
|
|
1464
1458
|
return requester.request(USER_REVOKE_AUTHORIZATION_METHOD);
|
|
1465
1459
|
}
|
|
@@ -1478,7 +1472,6 @@ function getSteamGameList(requester, options) {
|
|
|
1478
1472
|
function createUserModule(requester) {
|
|
1479
1473
|
return {
|
|
1480
1474
|
getInfo: () => getInfo(requester),
|
|
1481
|
-
getLocalIdentity: () => getLocalIdentity(requester),
|
|
1482
1475
|
revokeAuthorization: () => revokeAuthorization(requester),
|
|
1483
1476
|
getSteamGameList: (options) => getSteamGameList(requester, options),
|
|
1484
1477
|
};
|
|
@@ -1781,7 +1774,6 @@ const auth = {
|
|
|
1781
1774
|
/** 默认 SDK 实例的用户资料模块。 */
|
|
1782
1775
|
const user = {
|
|
1783
1776
|
getInfo: () => getDefaultSDK().user.getInfo(),
|
|
1784
|
-
getLocalIdentity: () => getDefaultSDK().user.getLocalIdentity(),
|
|
1785
1777
|
revokeAuthorization: () => getDefaultSDK().user.revokeAuthorization(),
|
|
1786
1778
|
getSteamGameList: (options) => getDefaultSDK().user.getSteamGameList(options),
|
|
1787
1779
|
};
|
package/dist/protocol.cjs.js
CHANGED
|
@@ -188,8 +188,6 @@ function normalizeDecodedNetworkPathname(decoded) {
|
|
|
188
188
|
const AUTH_LOGIN_METHOD = 'auth.login';
|
|
189
189
|
/** 读取当前登录态、授权状态和已获准披露资料的 bridge method 标识。 */
|
|
190
190
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
191
|
-
/** 读取当前用户小程序隔离身份的 bridge method 标识。 */
|
|
192
|
-
const USER_GET_LOCAL_IDENTITY_METHOD = 'user.getLocalIdentity';
|
|
193
191
|
/** 撤销当前用户授予本小程序授权的 bridge method 标识。 */
|
|
194
192
|
const USER_REVOKE_AUTHORIZATION_METHOD = 'user.revokeAuthorization';
|
|
195
193
|
/** 读取当前已登录用户 Steam 游戏库的 bridge method 标识。 */
|
|
@@ -290,13 +288,6 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
290
288
|
permission: 'user.getInfo',
|
|
291
289
|
risk: 'medium',
|
|
292
290
|
},
|
|
293
|
-
{
|
|
294
|
-
method: USER_GET_LOCAL_IDENTITY_METHOD,
|
|
295
|
-
module: 'user',
|
|
296
|
-
capability: USER_GET_LOCAL_IDENTITY_METHOD,
|
|
297
|
-
permission: 'user.getLocalIdentity',
|
|
298
|
-
risk: 'medium',
|
|
299
|
-
},
|
|
300
291
|
{
|
|
301
292
|
method: USER_REVOKE_AUTHORIZATION_METHOD,
|
|
302
293
|
module: 'user',
|
|
@@ -482,7 +473,6 @@ exports.UI_HIDE_LOADING_METHOD = UI_HIDE_LOADING_METHOD;
|
|
|
482
473
|
exports.UI_SHOW_LOADING_METHOD = UI_SHOW_LOADING_METHOD;
|
|
483
474
|
exports.UI_SHOW_TOAST_METHOD = UI_SHOW_TOAST_METHOD;
|
|
484
475
|
exports.USER_GET_INFO_METHOD = USER_GET_INFO_METHOD;
|
|
485
|
-
exports.USER_GET_LOCAL_IDENTITY_METHOD = USER_GET_LOCAL_IDENTITY_METHOD;
|
|
486
476
|
exports.USER_GET_STEAM_GAME_LIST_METHOD = USER_GET_STEAM_GAME_LIST_METHOD;
|
|
487
477
|
exports.USER_REVOKE_AUTHORIZATION_METHOD = USER_REVOKE_AUTHORIZATION_METHOD;
|
|
488
478
|
exports.VIEWPORT_GET_WINDOW_INFO_METHOD = VIEWPORT_GET_WINDOW_INFO_METHOD;
|
package/dist/protocol.esm.js
CHANGED
|
@@ -186,8 +186,6 @@ function normalizeDecodedNetworkPathname(decoded) {
|
|
|
186
186
|
const AUTH_LOGIN_METHOD = 'auth.login';
|
|
187
187
|
/** 读取当前登录态、授权状态和已获准披露资料的 bridge method 标识。 */
|
|
188
188
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
189
|
-
/** 读取当前用户小程序隔离身份的 bridge method 标识。 */
|
|
190
|
-
const USER_GET_LOCAL_IDENTITY_METHOD = 'user.getLocalIdentity';
|
|
191
189
|
/** 撤销当前用户授予本小程序授权的 bridge method 标识。 */
|
|
192
190
|
const USER_REVOKE_AUTHORIZATION_METHOD = 'user.revokeAuthorization';
|
|
193
191
|
/** 读取当前已登录用户 Steam 游戏库的 bridge method 标识。 */
|
|
@@ -288,13 +286,6 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
288
286
|
permission: 'user.getInfo',
|
|
289
287
|
risk: 'medium',
|
|
290
288
|
},
|
|
291
|
-
{
|
|
292
|
-
method: USER_GET_LOCAL_IDENTITY_METHOD,
|
|
293
|
-
module: 'user',
|
|
294
|
-
capability: USER_GET_LOCAL_IDENTITY_METHOD,
|
|
295
|
-
permission: 'user.getLocalIdentity',
|
|
296
|
-
risk: 'medium',
|
|
297
|
-
},
|
|
298
289
|
{
|
|
299
290
|
method: USER_REVOKE_AUTHORIZATION_METHOD,
|
|
300
291
|
module: 'user',
|
|
@@ -451,4 +442,4 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
451
442
|
},
|
|
452
443
|
];
|
|
453
444
|
|
|
454
|
-
export { AUTH_LOGIN_METHOD, CLOUD_LEADERBOARD_DELETE_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_INFO_METHOD, CLOUD_LEADERBOARD_GET_LIST_METHOD, CLOUD_LEADERBOARD_SUBMIT_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_NETWORK_PROTECTED_PATHS, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, RUNTIME_LOCATION_PROBE_METHOD, SDK_CSP_VIOLATION_METHOD, SDK_HANDSHAKE_METHOD, SDK_LOCATION_REPORT_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_GET_INFO_METHOD,
|
|
445
|
+
export { AUTH_LOGIN_METHOD, CLOUD_LEADERBOARD_DELETE_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_INFO_METHOD, CLOUD_LEADERBOARD_GET_LIST_METHOD, CLOUD_LEADERBOARD_SUBMIT_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_NETWORK_PROTECTED_PATHS, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, RUNTIME_LOCATION_PROBE_METHOD, SDK_CSP_VIOLATION_METHOD, SDK_HANDSHAKE_METHOD, SDK_LOCATION_REPORT_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_GET_INFO_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, computeTrustedIframeUserGesture, isManagedMiniProgramRuntimePermissionKey, isMiniProgramBridgeMessage, isOfficialMiniProgramNetworkUrl, isProtectedMiniProgramNetworkPath, normalizeMiniProgramNetworkPathname, parseMiniProgramRuntimePermissions };
|
package/dist/vite.cjs.js
CHANGED
package/dist/vite.esm.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heybox/hb-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3-alpha.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"./src/index.ts",
|
|
6
6
|
"./src/core/singleton.ts",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"vue": "^2.7.16",
|
|
96
96
|
"vite": "^8.0.12",
|
|
97
97
|
"vitest": "^3.2.4",
|
|
98
|
-
"@heybox/hb-api": "~1.25.
|
|
98
|
+
"@heybox/hb-api": "~1.25.18"
|
|
99
99
|
},
|
|
100
100
|
"publishConfig": {
|
|
101
101
|
"registry": "https://registry.npmjs.org/",
|
package/skill/SKILL.md
CHANGED
|
@@ -41,14 +41,14 @@ Apply these instructions when writing, reviewing, or debugging code that consume
|
|
|
41
41
|
1. Import the root package eagerly; the SDK starts its handshake automatically and capability calls wait for it internally.
|
|
42
42
|
2. For a network-enabled mini-program, use `auth.login({ scopes? })` to obtain `{ code, expiresIn: 300, scopes }`. Identity is always implicit; request only optional scopes the business actually needs.
|
|
43
43
|
3. Send the code only to the developer's backend. That backend follows the backend OpenAPI documentation to exchange it for a token; mini-program code must never exchange application credentials itself.
|
|
44
|
-
4. For a network-disabled mini-program, call `user.
|
|
44
|
+
4. For a network-disabled mini-program, call `user.getInfo()` to read the current login state and `userInfo.app_user_id`. This read is silent and does not require a trusted user action. It cannot obtain a code or call OpenAPI.
|
|
45
45
|
5. Handle `HbMiniProgramSDKError` for SDK initialization and capability failures.
|
|
46
46
|
6. Handle `HbMiniProgramNetworkError` separately when HTTP completed but `validateStatus` rejected the status.
|
|
47
47
|
7. Use `getHandshakeState()` for the current persistent handshake state and `onHandshakeStateChange()` for an immediate replay plus future changes. Cancel the returned subscription when the page or component unmounts.
|
|
48
48
|
8. Treat the non-replayed `ready` lifecycle event only as an edge notification. After a duplicate handshake it may repeat, so never use it as state or as the source for enabling a late-mounted control.
|
|
49
49
|
9. Use the default SDK instance exposed by the root package. For gesture-gated controls, initialize from the current handshake state, subscribe to changes, and enable the control only when `status === 'ready'`. Keep calls such as `auth.login()` in the original user-action callback; do not wait for handshake inside that callback.
|
|
50
|
-
10. When authorization UI is required, call `auth.login()`
|
|
51
|
-
11. `user.getSteamGameList()` is available only to network-disabled mini-programs. In a network-enabled mini-program it returns `SERVER_API_REQUIRED`, and there is no Steam library authorization scope or OpenAPI resource. Treat `user.getInfo()`
|
|
50
|
+
10. When authorization UI is required, call `auth.login()` from a trusted user action. Missing gesture returns `USER_GESTURE_REQUIRED`; cancelling, rejecting, or closing returns `AUTHORIZATION_CANCELLED` and does not confirm or change authorization. An already-authorized `auth.login()` request may return a new code silently.
|
|
51
|
+
11. `user.getSteamGameList()` is available only to network-disabled mini-programs. In a network-enabled mini-program it returns `SERVER_API_REQUIRED`, and there is no Steam library authorization scope or OpenAPI resource. Treat `user.getInfo()` returning `SERVER_API_REQUIRED` as a server-boundary signal, not as logged-out state.
|
|
52
52
|
12. Use `share.showShareMenu({ post })` or `share.screenshot({ post })` to preset editable community destinations and topics. Pass partition IDs through `topicIds` and topic text without surrounding `#` through `topics`; do not construct the underlying client post protocol.
|
|
53
53
|
|
|
54
54
|
## Step 5: Use CLI workflows
|
|
@@ -60,7 +60,7 @@ Apply these instructions when writing, reviewing, or debugging code that consume
|
|
|
60
60
|
5. Keep `miniappManifest()` explicitly enabled in `vite.config.ts`; `hb-sdk build` must fail when the required Manifest or Runtime gate output is missing.
|
|
61
61
|
6. Keep project typechecking in `scripts.build`, for example `vue-tsc --noEmit && hb-sdk build`; `hb-sdk build` does not run typechecking or invoke `scripts.build` itself.
|
|
62
62
|
7. Existing projects may continue to use `vite build`; do not auto-migrate them. Do not invent `--mode`, `--json`, config, or output-directory flags for `hb-sdk build`.
|
|
63
|
-
8. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` only for development and publishing commands. This login does not change `auth.login()`, `user.
|
|
63
|
+
8. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` only for development and publishing commands. This login does not change `auth.login()`, `user.getInfo()`, or the mini-program user's authorization state.
|
|
64
64
|
9. Use `hb-sdk remote entity current` to confirm the current developer account and `hb-sdk remote entity switch <entity-id>` to change it before remote operations.
|
|
65
65
|
10. Use `hb-sdk remote create` to create and bind a mini-program; use `hb-sdk remote bind <mini-program-id>` to bind an existing manageable mini-program.
|
|
66
66
|
11. Use `hb-sdk remote info`, `hb-sdk remote list`, `hb-sdk remote access`, `hb-sdk remote versions`, `hb-sdk remote preview <version>`, and `hb-sdk remote allowlist ...` for remote inspection and preview management.
|
|
@@ -73,7 +73,6 @@ export {
|
|
|
73
73
|
UI_HIDE_LOADING_METHOD,
|
|
74
74
|
UI_SHOW_LOADING_METHOD,
|
|
75
75
|
UI_SHOW_TOAST_METHOD,
|
|
76
|
-
USER_GET_LOCAL_IDENTITY_METHOD,
|
|
77
76
|
USER_REVOKE_AUTHORIZATION_METHOD,
|
|
78
77
|
USER_GET_STEAM_GAME_LIST_METHOD,
|
|
79
78
|
USER_GET_INFO_METHOD,
|
|
@@ -117,8 +116,6 @@ export type {
|
|
|
117
116
|
} from './modules/cloud';
|
|
118
117
|
export type {
|
|
119
118
|
AuthorizedUserInfo,
|
|
120
|
-
GetLocalIdentityPayload,
|
|
121
|
-
GetLocalIdentityResult,
|
|
122
119
|
GetUserInfoPayload,
|
|
123
120
|
GetUserInfoResult,
|
|
124
121
|
RevokeAuthorizationPayload,
|
|
@@ -211,7 +208,7 @@ Reference 由 `@heybox/hb-sdk` 的公开导出与源码注释自动生成,不
|
|
|
211
208
|
|
|
212
209
|
| 导出面 | Classes | Functions | Interfaces | Types | Constants |
|
|
213
210
|
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
214
|
-
| Root API | 2 | 4 |
|
|
215
|
-
| Protocol API | 0 | 7 |
|
|
211
|
+
| Root API | 2 | 4 | 50 | 53 | 0 |
|
|
212
|
+
| Protocol API | 0 | 7 | 46 | 64 | 30 |
|
|
216
213
|
| Miniapp Publish API | 0 | 5 | 2 | 0 | 0 |
|
|
217
214
|
| Vite API | 0 | 1 | 0 | 0 | 0 |
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
## Package metadata
|
|
25
25
|
|
|
26
26
|
- Package: `@heybox/hb-sdk`
|
|
27
|
-
- Version at generation time: `0.7.2
|
|
27
|
+
- Version at generation time: `0.7.2`
|
|
28
28
|
- Public root export: `@heybox/hb-sdk`
|
|
29
29
|
- Protocol export: `@heybox/hb-sdk/protocol`
|
|
30
30
|
- Vite plugin export: `@heybox/hb-sdk/vite`
|
|
@@ -70,8 +70,6 @@ export type {
|
|
|
70
70
|
} from './modules/cloud';
|
|
71
71
|
export type {
|
|
72
72
|
AuthorizedUserInfo,
|
|
73
|
-
GetLocalIdentityPayload,
|
|
74
|
-
GetLocalIdentityResult,
|
|
75
73
|
GetUserInfoPayload,
|
|
76
74
|
GetUserInfoResult,
|
|
77
75
|
RevokeAuthorizationPayload,
|
|
@@ -396,7 +394,7 @@ hb-sdk build [--env <name>] [--verbose]
|
|
|
396
394
|
|
|
397
395
|
## 交互控件与握手状态
|
|
398
396
|
|
|
399
|
-
`auth.login()
|
|
397
|
+
`auth.login()` 等可能展示授权 UI 的能力必须保留原始可信用户手势。不要在点击回调中等待握手;页面加载时读取并订阅持久握手状态,只在 `status === 'ready'` 时启用按钮:
|
|
400
398
|
|
|
401
399
|
```ts
|
|
402
400
|
import hbSDK, { type MiniProgramSDKHandshakeState } from '@heybox/hb-sdk'
|
|
@@ -415,25 +413,18 @@ onUnmounted(stopHandshakeState)
|
|
|
415
413
|
|
|
416
414
|
## 未开通网络权限
|
|
417
415
|
|
|
418
|
-
无网络小程序可以在本地能力中使用按小程序隔离的 `
|
|
416
|
+
无网络小程序可以在本地能力中使用按小程序隔离的 `app_user_id`:
|
|
419
417
|
|
|
420
418
|
```ts
|
|
421
|
-
import hbSDK
|
|
419
|
+
import hbSDK from '@heybox/hb-sdk'
|
|
422
420
|
|
|
423
|
-
async function
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
return appUserId
|
|
427
|
-
} catch (error) {
|
|
428
|
-
if (error instanceof HbMiniProgramSDKError && error.code === 'AUTHORIZATION_CANCELLED') {
|
|
429
|
-
return undefined
|
|
430
|
-
}
|
|
431
|
-
throw error
|
|
432
|
-
}
|
|
421
|
+
async function getCurrentUser() {
|
|
422
|
+
const result = await hbSDK.user.getInfo()
|
|
423
|
+
return result.userInfo?.app_user_id
|
|
433
424
|
}
|
|
434
425
|
```
|
|
435
426
|
|
|
436
|
-
|
|
427
|
+
`user.getInfo()` 不展示授权弹窗,也不要求可信用户手势。未登录时返回未登录状态;已登录时静默返回 `userInfo.app_user_id`。这条路径不能获取授权码或调用 OpenAPI,也不要把 `app_user_id` 发送到外部服务。
|
|
437
428
|
|
|
438
429
|
## 已开通网络权限
|
|
439
430
|
|
|
@@ -562,7 +553,7 @@ SDK 还提供 `getHandshakeState()` / `onHandshakeStateChange()` 管理持久握
|
|
|
562
553
|
| 模块 | 用途 |
|
|
563
554
|
| ------------ | ------------------------------------------------------------ |
|
|
564
555
|
| `auth` | 获取交给开发者服务端交换的短期授权码 |
|
|
565
|
-
| `user` |
|
|
556
|
+
| `user` | 读取 Host 当前用户资料、隔离身份或撤销授权 |
|
|
566
557
|
| `share` | 打开分享或截图分享流程 |
|
|
567
558
|
| `ui` | 展示 Toast 和 Loading |
|
|
568
559
|
| `device` | 调用振动和剪贴板能力 |
|
package/skill/references/cli.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
Use the bundled `hb-sdk` CLI to create a workshop mini-program, open the local debugging page, test in the Heybox Mac or mobile App, or manage and publish a remote mini-program.
|
|
31
31
|
|
|
32
|
-
`hb-sdk login` is for development and publishing commands only. It does not authorize mini-program users and does not change `auth.login()`, `user.
|
|
32
|
+
`hb-sdk login` is for development and publishing commands only. It does not authorize mini-program users and does not change `auth.login()`, `user.getInfo()`, or `network.request()` inside a mini-program.
|
|
33
33
|
|
|
34
34
|
## Command surface
|
|
35
35
|
|
|
@@ -250,7 +250,7 @@ Agent rules:
|
|
|
250
250
|
|
|
251
251
|
## CLI 登录态
|
|
252
252
|
|
|
253
|
-
CLI 登录态只用于开发工具和远端管理,不等同于小程序内的用户登录态,也不会改变 `auth.login()`、`user.
|
|
253
|
+
CLI 登录态只用于开发工具和远端管理,不等同于小程序内的用户登录态,也不会改变 `auth.login()`、`user.getInfo()` 或开发者服务端会话。
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
256
|
hb-sdk login status
|
|
@@ -34,20 +34,14 @@ function setLoginButtonDisabled(disabled: boolean) {
|
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Current user for a network-disabled mini-program
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
import { user
|
|
40
|
+
import { user } from '@heybox/hb-sdk';
|
|
41
41
|
|
|
42
|
-
export async function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} catch (error) {
|
|
46
|
-
if (error instanceof HbMiniProgramSDKError && error.code === 'AUTHORIZATION_CANCELLED') {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
42
|
+
export async function getCurrentUser() {
|
|
43
|
+
const result = await user.getInfo();
|
|
44
|
+
return result.userInfo?.app_user_id;
|
|
51
45
|
}
|
|
52
46
|
```
|
|
53
47
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
## 交互控件与握手状态
|
|
32
32
|
|
|
33
|
-
`auth.login()
|
|
33
|
+
`auth.login()` 等可能展示授权 UI 的能力必须保留原始可信用户手势。不要在点击回调中等待握手;页面加载时读取并订阅持久握手状态,只在 `status === 'ready'` 时启用按钮:
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
36
|
import hbSDK, { type MiniProgramSDKHandshakeState } from '@heybox/hb-sdk'
|
|
@@ -49,25 +49,18 @@ onUnmounted(stopHandshakeState)
|
|
|
49
49
|
|
|
50
50
|
## 未开通网络权限
|
|
51
51
|
|
|
52
|
-
无网络小程序可以在本地能力中使用按小程序隔离的 `
|
|
52
|
+
无网络小程序可以在本地能力中使用按小程序隔离的 `app_user_id`:
|
|
53
53
|
|
|
54
54
|
```ts
|
|
55
|
-
import hbSDK
|
|
55
|
+
import hbSDK from '@heybox/hb-sdk'
|
|
56
56
|
|
|
57
|
-
async function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return appUserId
|
|
61
|
-
} catch (error) {
|
|
62
|
-
if (error instanceof HbMiniProgramSDKError && error.code === 'AUTHORIZATION_CANCELLED') {
|
|
63
|
-
return undefined
|
|
64
|
-
}
|
|
65
|
-
throw error
|
|
66
|
-
}
|
|
57
|
+
async function getCurrentUser() {
|
|
58
|
+
const result = await hbSDK.user.getInfo()
|
|
59
|
+
return result.userInfo?.app_user_id
|
|
67
60
|
}
|
|
68
61
|
```
|
|
69
62
|
|
|
70
|
-
|
|
63
|
+
`user.getInfo()` 不展示授权弹窗,也不要求可信用户手势。未登录时返回未登录状态;已登录时静默返回 `userInfo.app_user_id`。这条路径不能获取授权码或调用 OpenAPI,也不要把 `app_user_id` 发送到外部服务。
|
|
71
64
|
|
|
72
65
|
## 已开通网络权限
|
|
73
66
|
|
|
@@ -116,7 +109,7 @@ async function loginFromUserAction() {
|
|
|
116
109
|
| 小程序类型 | 身份入口 | 结果用途 |
|
|
117
110
|
| -------------- | ------------------------- | ------------------------------------------------------ |
|
|
118
111
|
| 已开通网络权限 | `auth.login({ scopes? })` | 获取短期授权码,由开发者服务端换取 OpenAPI token |
|
|
119
|
-
| 未开通网络权限 | `user.
|
|
112
|
+
| 未开通网络权限 | `user.getInfo()` | 静默读取当前小程序隔离的 `userInfo.app_user_id` |
|
|
120
113
|
|
|
121
114
|
不要混用两条路径。SDK 不向小程序页面提供 token、cookie、黑盒用户 ID 或平台私有凭据。
|
|
122
115
|
|
|
@@ -160,7 +153,7 @@ async function loginFromUserAction() {
|
|
|
160
153
|
|
|
161
154
|
`identity` 始终隐式包含,不需要也不能通过省略它来申请匿名授权。`scopes` 只填写业务确实需要的可选资料,例如 `profile`;不需要额外资料时直接调用 `auth.login()`。
|
|
162
155
|
|
|
163
|
-
小程序页面只把 `code` 发送到自己的服务端。开发者服务端再按后端 OpenAPI 文档,用服务端保存的应用凭据交换 token;页面不得自行交换,也不得持有应用私密凭据。`auth.login()` 不返回 user、profile、`
|
|
156
|
+
小程序页面只把 `code` 发送到自己的服务端。开发者服务端再按后端 OpenAPI 文档,用服务端保存的应用凭据交换 token;页面不得自行交换,也不得持有应用私密凭据。`auth.login()` 不返回 user、profile、`app_user_id` 或 token。
|
|
164
157
|
|
|
165
158
|
开发者服务端用 access token 调用 `GET /user_miniprogram/openapi/v1/user` 读取当前用户。响应始终包含 `app_user_id`;token 含 `profile` 时还会返回 `nickname` 和 `avatar`。不要再请求已下线的 `/user/identity` 或 `/user/profile`。
|
|
166
159
|
|
|
@@ -188,7 +181,7 @@ async function revokeAuthorizationFromUserAction() {
|
|
|
188
181
|
|
|
189
182
|
`user.revokeAuthorization()` 不接收参数。小程序页面不能提交小程序 ID、黑盒用户 ID 或手势标记;Runtime 从 Host 启动上下文和用户操作状态注入可信值。调用缺少可信用户手势时返回 `USER_GESTURE_REQUIRED`。
|
|
190
183
|
|
|
191
|
-
撤销成功后,后续 `auth.login()`
|
|
184
|
+
撤销成功后,后续 `auth.login()` 会重新进入授权流程;无网络小程序再次调用 `user.getInfo()` 时会重新建立隔离身份。业务必须立即停止使用并清理此前保存的 `app_user_id`、用户资料和开发者服务端会话;SDK 不会删除业务自己的 localStorage、数据库或 cookie。
|
|
192
185
|
|
|
193
186
|
## 当前用户资料由服务端读取
|
|
194
187
|
|
|
@@ -196,7 +189,6 @@ async function revokeAuthorizationFromUserAction() {
|
|
|
196
189
|
|
|
197
190
|
- `user.getInfo()`
|
|
198
191
|
- `user.getSteamGameList(options)`
|
|
199
|
-
- `user.getLocalIdentity()`
|
|
200
192
|
|
|
201
193
|
其他 Host current-user capabilities 属于 Host/runtime 集成边界,不是小程序可从 SDK 根包调用的方法。需要对应数据时,先取得授权码,再由开发者服务端按后端 OpenAPI 文档换取 token 并调用对应接口。不要把 `SERVER_API_REQUIRED` 当作未登录或权限弹窗失败。
|
|
202
194
|
|
|
@@ -207,24 +199,15 @@ async function revokeAuthorizationFromUserAction() {
|
|
|
207
199
|
未开通网络权限的小程序不走授权码流程。需要当前用户在本小程序内的稳定隔离身份时调用:
|
|
208
200
|
|
|
209
201
|
```ts
|
|
210
|
-
import hbSDK
|
|
202
|
+
import hbSDK from '@heybox/hb-sdk'
|
|
211
203
|
|
|
212
|
-
async function
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return appUserId
|
|
216
|
-
} catch (error) {
|
|
217
|
-
if (error instanceof HbMiniProgramSDKError && error.code === 'AUTHORIZATION_CANCELLED') {
|
|
218
|
-
return undefined
|
|
219
|
-
}
|
|
220
|
-
throw error
|
|
221
|
-
}
|
|
204
|
+
async function getCurrentUser() {
|
|
205
|
+
const result = await hbSDK.user.getInfo()
|
|
206
|
+
return result.userInfo?.app_user_id
|
|
222
207
|
}
|
|
223
208
|
```
|
|
224
209
|
|
|
225
|
-
`user.
|
|
226
|
-
|
|
227
|
-
首次登录或尚未授予 identity 时,该调用可能展示 UI,因此 `getLocalIdentityFromUserAction` 必须绑定到按钮点击等可信用户操作;缺少可信手势时返回 `USER_GESTURE_REQUIRED`。用户取消、拒绝或关闭时返回 `AUTHORIZATION_CANCELLED`,不会确认或改变授权状态;业务应正常结束当前操作并允许稍后重试。
|
|
210
|
+
`user.getInfo()` 是静默身份接口,不展示授权弹窗,也不要求可信用户手势。未登录时返回 `isHeyboxAppLoggedIn: false`;已登录时默认建立并返回当前小程序隔离的 `app_user_id`。调用该接口即表示允许平台为当前小程序建立隔离身份;每次成功调用都会广播一次 `user_info_authorization_change`,其中 `identity` 为 `granted`,即使授权状态没有发生变化。撤销授权后再次调用仍会静默建立新的隔离身份。
|
|
228
211
|
|
|
229
212
|
这类小程序无法获取授权码,也无法调用 OpenAPI;在未开通网络权限时调用 `auth.login()` 同样返回 `SERVER_API_REQUIRED`。Host 提供的 current-user APIs 与平台代管能力继续按各自权限工作,但页面不能把其中的身份或资料发送到外部服务。
|
|
230
213
|
|
|
@@ -234,7 +217,7 @@ async function getLocalIdentityFromUserAction() {
|
|
|
234
217
|
|
|
235
218
|
## CLI 登录与用户登录
|
|
236
219
|
|
|
237
|
-
`hb-sdk login` 只给本地开发和远端管理命令建立 CLI 登录态,与小程序页面的 `auth.login()`、`user.
|
|
220
|
+
`hb-sdk login` 只给本地开发和远端管理命令建立 CLI 登录态,与小程序页面的 `auth.login()`、`user.getInfo()` 和用户授权完全无关。
|
|
238
221
|
|
|
239
222
|
## Lifecycle events
|
|
240
223
|
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
- `auth.login({ scopes? })` 只返回 `{ code, expiresIn: 300, scopes }`;identity 隐式强制包含,code 只能提交给开发者服务端。
|
|
17
17
|
- 需要授权 UI 时,`auth.login()` 必须来自可信用户手势,否则返回 `USER_GESTURE_REQUIRED`;用户取消或关闭时返回 `AUTHORIZATION_CANCELLED`。已授权时可以静默返回新 code。
|
|
18
18
|
- `user.getSteamGameList()` 仅供未开通网络权限的小程序通过 Host 读取;已开通网络权限时返回 `SERVER_API_REQUIRED`,且授权码与 OpenAPI 不提供 Steam 游戏库 scope 或资源接口。
|
|
19
|
-
- 已开通网络权限时,公开的 `user.getInfo()`
|
|
20
|
-
-
|
|
19
|
+
- 已开通网络权限时,公开的 `user.getInfo()` 返回 `SERVER_API_REQUIRED`;对应身份和资料数据应由开发者服务端通过 OpenAPI 获取。
|
|
20
|
+
- 未开通网络权限时,使用 `user.getInfo()` 静默读取 `userInfo.app_user_id`,不能获取 code 或调用 OpenAPI。
|
|
21
21
|
- `user.revokeAuthorization()` 在两种网络模式下都要求可信用户手势;成功后必须停止使用并清理业务缓存的旧身份、资料和服务端会话。
|
|
22
22
|
- `on()` 返回取消监听函数,组件卸载或页面销毁时需要调用。
|
|
23
23
|
- 业务网络请求使用 `network.request()`,不要依赖浏览器原生网络出口。
|
|
@@ -404,7 +404,7 @@ files.set(
|
|
|
404
404
|
|
|
405
405
|
Use the bundled \`hb-sdk\` CLI to create a workshop mini-program, open the local debugging page, test in the Heybox Mac or mobile App, or manage and publish a remote mini-program.
|
|
406
406
|
|
|
407
|
-
\`hb-sdk login\` is for development and publishing commands only. It does not authorize mini-program users and does not change \`auth.login()\`, \`user.
|
|
407
|
+
\`hb-sdk login\` is for development and publishing commands only. It does not authorize mini-program users and does not change \`auth.login()\`, \`user.getInfo()\`, or \`network.request()\` inside a mini-program.
|
|
408
408
|
|
|
409
409
|
## Command surface
|
|
410
410
|
|
|
@@ -636,21 +636,15 @@ function setLoginButtonDisabled(disabled: boolean) {
|
|
|
636
636
|
}`,
|
|
637
637
|
)}
|
|
638
638
|
|
|
639
|
-
###
|
|
639
|
+
### Current user for a network-disabled mini-program
|
|
640
640
|
|
|
641
641
|
${fenced(
|
|
642
642
|
'ts',
|
|
643
|
-
`import { user
|
|
643
|
+
`import { user } from '@heybox/hb-sdk';
|
|
644
644
|
|
|
645
|
-
export async function
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
} catch (error) {
|
|
649
|
-
if (error instanceof HbMiniProgramSDKError && error.code === 'AUTHORIZATION_CANCELLED') {
|
|
650
|
-
return undefined;
|
|
651
|
-
}
|
|
652
|
-
throw error;
|
|
653
|
-
}
|
|
645
|
+
export async function getCurrentUser() {
|
|
646
|
+
const result = await user.getInfo();
|
|
647
|
+
return result.userInfo?.app_user_id;
|
|
654
648
|
}`,
|
|
655
649
|
)}
|
|
656
650
|
|
|
@@ -191,6 +191,7 @@ const positiveCredentialPattern =
|
|
|
191
191
|
const unsupportedStoragePattern = /\b(removeStorage|clearStorage|getStorageInfo|getStorageV2|delete storage|clear storage)\b/i;
|
|
192
192
|
const rawProtocolPattern = /\b(raw postMessage|construct bridge|bridge envelope|nonce handling|mutate bridge|sdk\.handshake)\b/i;
|
|
193
193
|
const removedUserLoginPattern = /\b(?:hbSDK\.)?user\.login\s*\(/;
|
|
194
|
+
const removedLocalIdentityPattern = /\b(?:hbSDK\.)?user\.getLocalIdentity\s*\(/;
|
|
194
195
|
|
|
195
196
|
for (const file of textFiles) {
|
|
196
197
|
const relative = skillRel(file);
|
|
@@ -198,7 +199,12 @@ for (const file of textFiles) {
|
|
|
198
199
|
if (file.endsWith('.md')) validateLocalMarkdownLinks(file, content);
|
|
199
200
|
if (removedUserLoginPattern.test(content)) {
|
|
200
201
|
fail(
|
|
201
|
-
`Removed API guidance found in ${relative}: use auth.login() for network-enabled server authentication or user.
|
|
202
|
+
`Removed API guidance found in ${relative}: use auth.login() for network-enabled server authentication or user.getInfo() for network-disabled local identity instead of user.login().`,
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
if (removedLocalIdentityPattern.test(content)) {
|
|
206
|
+
fail(
|
|
207
|
+
`Removed API guidance found in ${relative}: use user.getInfo() and read userInfo.app_user_id for network-disabled local identity.`,
|
|
202
208
|
);
|
|
203
209
|
}
|
|
204
210
|
|
package/skill/skill.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.7.2
|
|
3
|
+
"skillVersion": "0.7.2+skill.4dbf3cd47129",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.7.2
|
|
7
|
-
"compatibility": "0.7.2
|
|
6
|
+
"version": "0.7.2",
|
|
7
|
+
"compatibility": "0.7.2"
|
|
8
8
|
},
|
|
9
9
|
"source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
|
|
10
|
-
"integrity": "sha256-
|
|
10
|
+
"integrity": "sha256-4dbf3cd471293ade5b4b2cfe0f156d1365adffee4e7da36c6a30cb7dbb37319a"
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { MiniProgramSDKHandshakeState, MiniProgramSDKHandshakeStateHandler
|
|
|
4
4
|
export type { MiniProgramEventHandler, MiniProgramEventName, MiniProgramEventPayloadMap } from './protocol/types';
|
|
5
5
|
export type { LoginOptions, LoginPayload, LoginResult, LoginScope, MiniProgramAuthModule } from './modules/auth';
|
|
6
6
|
export type { DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, LeaderboardEntry, LeaderboardOrder, MiniProgramCloudLeaderboardModule, MiniProgramCloudModule, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, } from './modules/cloud';
|
|
7
|
-
export type { AuthorizedUserInfo,
|
|
7
|
+
export type { AuthorizedUserInfo, GetUserInfoPayload, GetUserInfoResult, RevokeAuthorizationPayload, RevokeAuthorizationResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, MiniProgramUserInfoResult, MiniProgramUserModule, UserInfoAuthorization, UserInfoAuthorizationStatus, SteamGameListData, SteamGameListItem, SteamGamePrice, SteamGameListSort, } from './modules/user';
|
|
8
8
|
export type { MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShareModule, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, ScreenshotPayload, ScreenshotResult, ShowShareMenuPayload, ShowShareMenuResult, } from './modules/share';
|
|
9
9
|
export type { GetWindowInfoPayload, GetWindowInfoResult, MiniProgramNavigationBarForegroundStyle, MiniProgramSafeArea, MiniProgramSetNavigationBarStyleOptions, MiniProgramViewportModule, MiniProgramWindowInfoResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, } from './modules/viewport';
|
|
10
10
|
export type { GetStoragePayload, GetStorageResult, MiniProgramStorageModule, SetStoragePayload } from './modules/storage';
|
|
@@ -14,8 +14,8 @@ export type GetUserInfoResult = MiniProgramUserInfoResult;
|
|
|
14
14
|
*
|
|
15
15
|
* @returns 当前用户的登录态与公开基础资料。
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
* 授权后返回昵称与头像。未登录时返回
|
|
17
|
+
* 未开通网络权限且当前黑盒 APP 用户已登录时,该能力会静默建立或读取按小程序隔离的
|
|
18
|
+
* `app_user_id`,不展示授权 UI;仅在 profile 授权后返回昵称与头像。未登录时返回
|
|
19
19
|
* `{ isHeyboxAppLoggedIn: false, authorization: null, userInfo: null }`。
|
|
20
20
|
*
|
|
21
21
|
* @throws {HbMiniProgramSDKError} 当 SDK 调用失败时抛出。
|