@heybox/hb-sdk 0.5.0 → 0.5.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/README.md +13 -0
- package/dist/cli-chunks/{create-BiCyOEAv.cjs → create-Bh4kJDVt.cjs} +1 -1
- package/dist/cli-chunks/{dev-D4XRqzz1.cjs → dev-BYgFjQRn.cjs} +1 -1
- package/dist/cli-chunks/{doctor-CmHZYQ2I.cjs → doctor-BqbJqCW_.cjs} +1 -1
- package/dist/cli-chunks/{index-DXS0s9d7.cjs → index-DflbDKpY.cjs} +2 -2
- package/dist/cli-chunks/{index-kv8oOmFw.cjs → index-JgAMdKYi.cjs} +13 -13
- package/dist/cli-chunks/{login-F9AEL3cF.cjs → login-BgPUbxW7.cjs} +2 -2
- package/dist/cli-chunks/{remote-BRktlraB.cjs → remote-C8Sr29mG.cjs} +7 -4
- package/dist/cli-chunks/{session-DItg0094.cjs → session-DNEf3FBW.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/mock-host/main.js +184 -1
- package/dist/index.cjs.js +83 -0
- package/dist/index.esm.js +83 -0
- package/dist/protocol.cjs.js +10 -0
- package/dist/protocol.esm.js +10 -1
- package/package.json +1 -1
- package/skill/references/api-protocol.md +5 -0
- package/skill/references/api-root.md +24 -1
- package/skill/skill.json +4 -4
- package/types/index.d.ts +1 -1
- package/types/modules/navigation/app-pages/index.d.ts +4 -0
- package/types/modules/navigation/app-pages/types.d.ts +43 -0
- package/types/modules/navigation/index.d.ts +7 -1
- package/types/protocol/capabilities.d.ts +12 -2
- package/types/protocol.d.ts +2 -2
package/README.md
CHANGED
|
@@ -185,10 +185,23 @@ import { navigation } from '@heybox/hb-sdk';
|
|
|
185
185
|
|
|
186
186
|
await navigation.reload();
|
|
187
187
|
await navigation.close();
|
|
188
|
+
|
|
189
|
+
await navigation.openAppPage({
|
|
190
|
+
target: 'game_detail',
|
|
191
|
+
appId: 578080,
|
|
192
|
+
gameType: 'pc',
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
await navigation.openAppPage({
|
|
196
|
+
target: 'user_detail',
|
|
197
|
+
userId: '239040',
|
|
198
|
+
});
|
|
188
199
|
```
|
|
189
200
|
|
|
190
201
|
`navigation.close()` 请求宿主关闭当前小程序容器,`navigation.reload()` 请求宿主重载当前小程序页面/容器。调用后 JS 上下文可能被宿主销毁,不保证后续代码继续执行;这两个能力不接受 `reason`、`force`、`confirm` 或 `fallbackUrl` 等扩展参数。
|
|
191
202
|
|
|
203
|
+
`navigation.openAppPage()` 请求宿主打开受 SDK 白名单约束的黑盒 App 页面。当前支持 `target: 'game_detail'`,必填 `appId` 与 `gameType`;`gameType` 支持 `pc`、`console`、`mobile`,可选 `page: 'game' | 'wiki'`、`hSrc`、`skuId`。也支持 `target: 'user_detail'`,必填 `userId`。
|
|
204
|
+
|
|
192
205
|
### 窗口信息
|
|
193
206
|
|
|
194
207
|
```ts
|
|
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var require$$0 = require('fs');
|
|
7
7
|
var require$$1 = require('path');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-JgAMdKYi.cjs');
|
|
9
9
|
require('node:module');
|
|
10
10
|
require('os');
|
|
11
11
|
require('readline');
|
|
@@ -9,7 +9,7 @@ var node_url = require('node:url');
|
|
|
9
9
|
var net = require('node:net');
|
|
10
10
|
var node_http = require('node:http');
|
|
11
11
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
12
|
-
var index = require('./index-
|
|
12
|
+
var index = require('./index-JgAMdKYi.cjs');
|
|
13
13
|
require('node:process');
|
|
14
14
|
require('node:buffer');
|
|
15
15
|
require('node:util');
|
|
@@ -4,7 +4,7 @@ var fs$1 = require('node:fs');
|
|
|
4
4
|
var fs = require('node:fs/promises');
|
|
5
5
|
var os = require('node:os');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-JgAMdKYi.cjs');
|
|
8
8
|
require('node:module');
|
|
9
9
|
require('path');
|
|
10
10
|
require('os');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$2 = require('./index-
|
|
3
|
+
var index$2 = require('./index-JgAMdKYi.cjs');
|
|
4
4
|
var require$$0$2 = require('fs');
|
|
5
5
|
var require$$2$1 = require('crypto');
|
|
6
6
|
var require$$1$2 = require('path');
|
|
7
7
|
var require$$0$3 = require('assert');
|
|
8
8
|
var require$$4$2 = require('events');
|
|
9
9
|
var require$$1$1 = require('util');
|
|
10
|
-
var remote = require('./remote-
|
|
10
|
+
var remote = require('./remote-C8Sr29mG.cjs');
|
|
11
11
|
var require$$0$5 = require('net');
|
|
12
12
|
var require$$0$4 = require('url');
|
|
13
13
|
var require$$2$2 = require('http');
|
|
@@ -234,19 +234,19 @@ function requireArgument () {
|
|
|
234
234
|
|
|
235
235
|
var command = {};
|
|
236
236
|
|
|
237
|
-
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
237
|
+
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-JgAMdKYi.cjs', document.baseURI).href)));
|
|
238
238
|
function __require$4() { return require$5("node:events"); }
|
|
239
239
|
|
|
240
|
-
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
240
|
+
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-JgAMdKYi.cjs', document.baseURI).href)));
|
|
241
241
|
function __require$3() { return require$4("node:child_process"); }
|
|
242
242
|
|
|
243
|
-
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
243
|
+
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-JgAMdKYi.cjs', document.baseURI).href)));
|
|
244
244
|
function __require$2() { return require$3("node:path"); }
|
|
245
245
|
|
|
246
|
-
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
246
|
+
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-JgAMdKYi.cjs', document.baseURI).href)));
|
|
247
247
|
function __require$1() { return require$2("node:fs"); }
|
|
248
248
|
|
|
249
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
249
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-JgAMdKYi.cjs', document.baseURI).href)));
|
|
250
250
|
function __require() { return require$1("node:process"); }
|
|
251
251
|
|
|
252
252
|
var help = {};
|
|
@@ -13094,7 +13094,7 @@ function readErrorMessage(error, options = {}) {
|
|
|
13094
13094
|
}
|
|
13095
13095
|
|
|
13096
13096
|
const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
|
|
13097
|
-
const BUILT_CLI_VERSION = '0.5.
|
|
13097
|
+
const BUILT_CLI_VERSION = '0.5.2';
|
|
13098
13098
|
const PACKAGE_JSON_CANDIDATES = [
|
|
13099
13099
|
path.resolve(__dirname, '..', '..', 'package.json'),
|
|
13100
13100
|
path.resolve(__dirname, '..', 'package.json'),
|
|
@@ -13377,31 +13377,31 @@ function createCommandLoggerResolver(options) {
|
|
|
13377
13377
|
};
|
|
13378
13378
|
}
|
|
13379
13379
|
const defaultClearLoginStatus = async (...args) => {
|
|
13380
|
-
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13380
|
+
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-BgPUbxW7.cjs'); });
|
|
13381
13381
|
return clearLoginStatus(...args);
|
|
13382
13382
|
};
|
|
13383
13383
|
const defaultLoginToHeybox = async (...args) => {
|
|
13384
|
-
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-
|
|
13384
|
+
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-BgPUbxW7.cjs'); });
|
|
13385
13385
|
return loginToHeybox(...args);
|
|
13386
13386
|
};
|
|
13387
13387
|
const defaultPrintLoginStatus = async (...args) => {
|
|
13388
|
-
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13388
|
+
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-BgPUbxW7.cjs'); });
|
|
13389
13389
|
return printLoginStatus(...args);
|
|
13390
13390
|
};
|
|
13391
13391
|
const defaultRunCreateCommand = async (...args) => {
|
|
13392
|
-
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-
|
|
13392
|
+
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-Bh4kJDVt.cjs'); });
|
|
13393
13393
|
return runCreateCommand(...args);
|
|
13394
13394
|
};
|
|
13395
13395
|
const defaultRunDevCommand = async (...args) => {
|
|
13396
|
-
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-
|
|
13396
|
+
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-BYgFjQRn.cjs'); });
|
|
13397
13397
|
return runDevCommand(...args);
|
|
13398
13398
|
};
|
|
13399
13399
|
const defaultRunDoctorCommand = async (...args) => {
|
|
13400
|
-
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-
|
|
13400
|
+
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-BqbJqCW_.cjs'); });
|
|
13401
13401
|
return runDoctorCommand(...args);
|
|
13402
13402
|
};
|
|
13403
13403
|
const defaultRunRemoteCommand = async (...args) => {
|
|
13404
|
-
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-
|
|
13404
|
+
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-C8Sr29mG.cjs'); }).then(function (n) { return n.remote; });
|
|
13405
13405
|
return runRemoteCommand(...args);
|
|
13406
13406
|
};
|
|
13407
13407
|
function resolveStandaloneLogger(options, verbose) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var node_http = require('node:http');
|
|
6
|
-
var session = require('./session-
|
|
6
|
+
var session = require('./session-DNEf3FBW.cjs');
|
|
7
7
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-JgAMdKYi.cjs');
|
|
9
9
|
require('node:path');
|
|
10
10
|
require('fs');
|
|
11
11
|
require('constants');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
|
-
var session = require('./session-
|
|
4
|
+
var session = require('./session-DNEf3FBW.cjs');
|
|
5
5
|
var childProcess = require('node:child_process');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
7
|
var fs$1 = require('node:fs/promises');
|
|
8
8
|
var path = require('node:path');
|
|
9
|
-
var index = require('./index-
|
|
9
|
+
var index = require('./index-JgAMdKYi.cjs');
|
|
10
10
|
|
|
11
11
|
var re = {exports: {}};
|
|
12
12
|
|
|
@@ -3113,7 +3113,7 @@ async function createDefaultCosClient(uploadToken) {
|
|
|
3113
3113
|
};
|
|
3114
3114
|
}
|
|
3115
3115
|
async function loadCosConstructor() {
|
|
3116
|
-
const cosModule = await Promise.resolve().then(function () { return require('./index-
|
|
3116
|
+
const cosModule = await Promise.resolve().then(function () { return require('./index-DflbDKpY.cjs'); }).then(function (n) { return n.index; });
|
|
3117
3117
|
return cosModule.default;
|
|
3118
3118
|
}
|
|
3119
3119
|
function formatSize(bytes) {
|
|
@@ -3596,7 +3596,10 @@ async function submitUserMiniprogramAudit(options, runtime) {
|
|
|
3596
3596
|
}, runtime);
|
|
3597
3597
|
}
|
|
3598
3598
|
async function getVersionPreviewInfo(options, runtime) {
|
|
3599
|
-
return remoteGet(USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH,
|
|
3599
|
+
return remoteGet(USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH, {
|
|
3600
|
+
mini_program_id: options.mini_program_id,
|
|
3601
|
+
preview_version: options.version,
|
|
3602
|
+
}, runtime);
|
|
3600
3603
|
}
|
|
3601
3604
|
async function withdrawUserMiniprogramVersion(options, runtime) {
|
|
3602
3605
|
return remotePostForm(WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH, options, runtime);
|
package/dist/cli.cjs
CHANGED
|
@@ -92,6 +92,8 @@ const DEVICE_SET_CLIPBOARD_METHOD = 'device.setClipboard';
|
|
|
92
92
|
const NAVIGATION_CLOSE_METHOD = 'navigation.close';
|
|
93
93
|
/** 重载当前小程序容器能力方法名。 */
|
|
94
94
|
const NAVIGATION_RELOAD_METHOD = 'navigation.reload';
|
|
95
|
+
/** 打开黑盒 App 页面能力方法名。 */
|
|
96
|
+
const NAVIGATION_OPEN_APP_PAGE_METHOD = 'navigation.openAppPage';
|
|
95
97
|
/**
|
|
96
98
|
* 小程序开放能力目录。
|
|
97
99
|
*
|
|
@@ -246,6 +248,13 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
246
248
|
permission: 'navigation.reload',
|
|
247
249
|
risk: 'medium',
|
|
248
250
|
},
|
|
251
|
+
{
|
|
252
|
+
method: NAVIGATION_OPEN_APP_PAGE_METHOD,
|
|
253
|
+
module: 'navigation',
|
|
254
|
+
capability: NAVIGATION_OPEN_APP_PAGE_METHOD,
|
|
255
|
+
permission: 'navigation.openAppPage',
|
|
256
|
+
risk: 'medium',
|
|
257
|
+
},
|
|
249
258
|
];
|
|
250
259
|
|
|
251
260
|
var browser = {};
|
|
@@ -3438,6 +3447,105 @@ function stringifyMiniProgramRuntimeJsonData(data, options) {
|
|
|
3438
3447
|
return value;
|
|
3439
3448
|
}
|
|
3440
3449
|
|
|
3450
|
+
const GAME_DETAIL_GAME_TYPES = ['pc', 'console', 'mobile'];
|
|
3451
|
+
const GAME_DETAIL_PAGES = ['game', 'wiki'];
|
|
3452
|
+
function toOpenAppPagePlatformOptions(payload) {
|
|
3453
|
+
const appPagePayload = readOpenAppPagePayload(payload);
|
|
3454
|
+
switch (appPagePayload.target) {
|
|
3455
|
+
case 'game_detail':
|
|
3456
|
+
return {
|
|
3457
|
+
target: appPagePayload.target,
|
|
3458
|
+
protocol: createGameDetailOpenRouterPathProtocol(appPagePayload),
|
|
3459
|
+
};
|
|
3460
|
+
case 'user_detail':
|
|
3461
|
+
return {
|
|
3462
|
+
target: appPagePayload.target,
|
|
3463
|
+
protocol: createUserDetailOpenRouterPathProtocol(appPagePayload),
|
|
3464
|
+
};
|
|
3465
|
+
default:
|
|
3466
|
+
throw createMiniProgramRuntimeBridgeError('INVALID_PARAMS', 'navigation.openAppPage target 不支持');
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
function readOpenAppPagePayload(payload) {
|
|
3470
|
+
if (!isMiniProgramRuntimeRecord(payload)) {
|
|
3471
|
+
throw createMiniProgramRuntimeBridgeError('INVALID_PARAMS', 'navigation.openAppPage options 必须是对象');
|
|
3472
|
+
}
|
|
3473
|
+
switch (payload.target) {
|
|
3474
|
+
case 'game_detail':
|
|
3475
|
+
return readOpenGameDetailAppPagePayload(payload);
|
|
3476
|
+
case 'user_detail':
|
|
3477
|
+
return readOpenUserDetailAppPagePayload(payload);
|
|
3478
|
+
default:
|
|
3479
|
+
throw createMiniProgramRuntimeBridgeError('INVALID_PARAMS', 'navigation.openAppPage target 不支持');
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
function readOpenGameDetailAppPagePayload(payload) {
|
|
3483
|
+
const appId = readRequiredString(payload.appId, 'navigation.openAppPage appId 必须是非空字符串');
|
|
3484
|
+
const gameType = readStringEnum(payload.gameType, GAME_DETAIL_GAME_TYPES, 'navigation.openAppPage gameType 必须是 pc、console 或 mobile');
|
|
3485
|
+
const result = {
|
|
3486
|
+
target: 'game_detail',
|
|
3487
|
+
appId,
|
|
3488
|
+
gameType,
|
|
3489
|
+
};
|
|
3490
|
+
if (payload.page !== undefined) {
|
|
3491
|
+
result.page = readStringEnum(payload.page, GAME_DETAIL_PAGES, 'navigation.openAppPage page 必须是 game 或 wiki');
|
|
3492
|
+
}
|
|
3493
|
+
if (payload.hSrc !== undefined) {
|
|
3494
|
+
result.hSrc = readRequiredString(payload.hSrc, 'navigation.openAppPage hSrc 必须是非空字符串');
|
|
3495
|
+
}
|
|
3496
|
+
if (payload.skuId !== undefined) {
|
|
3497
|
+
result.skuId = readRequiredString(payload.skuId, 'navigation.openAppPage skuId 必须是非空字符串');
|
|
3498
|
+
}
|
|
3499
|
+
return result;
|
|
3500
|
+
}
|
|
3501
|
+
function readOpenUserDetailAppPagePayload(payload) {
|
|
3502
|
+
return {
|
|
3503
|
+
target: 'user_detail',
|
|
3504
|
+
userId: readRequiredString(payload.userId, 'navigation.openAppPage userId 必须是非空字符串'),
|
|
3505
|
+
};
|
|
3506
|
+
}
|
|
3507
|
+
function createGameDetailOpenRouterPathProtocol(payload) {
|
|
3508
|
+
const params = {
|
|
3509
|
+
app_id: payload.appId,
|
|
3510
|
+
game_type: payload.gameType,
|
|
3511
|
+
};
|
|
3512
|
+
if (payload.page !== undefined) {
|
|
3513
|
+
params.page = payload.page;
|
|
3514
|
+
}
|
|
3515
|
+
if (payload.hSrc !== undefined) {
|
|
3516
|
+
params.h_src = payload.hSrc;
|
|
3517
|
+
}
|
|
3518
|
+
if (payload.skuId !== undefined) {
|
|
3519
|
+
params.sku_id = payload.skuId;
|
|
3520
|
+
}
|
|
3521
|
+
return {
|
|
3522
|
+
protocol_type: 'openRouterPath',
|
|
3523
|
+
path: '/game/detail',
|
|
3524
|
+
params,
|
|
3525
|
+
};
|
|
3526
|
+
}
|
|
3527
|
+
function createUserDetailOpenRouterPathProtocol(payload) {
|
|
3528
|
+
return {
|
|
3529
|
+
protocol_type: 'openRouterPath',
|
|
3530
|
+
path: '/user_home',
|
|
3531
|
+
params: {
|
|
3532
|
+
userid: payload.userId,
|
|
3533
|
+
},
|
|
3534
|
+
};
|
|
3535
|
+
}
|
|
3536
|
+
function readRequiredString(value, message) {
|
|
3537
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
3538
|
+
throw createMiniProgramRuntimeBridgeError('INVALID_PARAMS', message);
|
|
3539
|
+
}
|
|
3540
|
+
return value.trim();
|
|
3541
|
+
}
|
|
3542
|
+
function readStringEnum(value, allowedValues, message) {
|
|
3543
|
+
if (typeof value !== 'string' || !allowedValues.includes(value)) {
|
|
3544
|
+
throw createMiniProgramRuntimeBridgeError('INVALID_PARAMS', message);
|
|
3545
|
+
}
|
|
3546
|
+
return value;
|
|
3547
|
+
}
|
|
3548
|
+
|
|
3441
3549
|
const NETWORK_REQUEST_ALLOWED_KEYS = new Set([
|
|
3442
3550
|
'url',
|
|
3443
3551
|
'method',
|
|
@@ -4581,6 +4689,7 @@ const MINI_PROGRAM_MOCK_RUNTIME_METHOD_HANDLERS = {
|
|
|
4581
4689
|
[DEVICE_SET_CLIPBOARD_METHOD]: (runtime, payload) => runtime.setClipboard(payload),
|
|
4582
4690
|
[NAVIGATION_CLOSE_METHOD]: (runtime, payload) => runtime.close(payload),
|
|
4583
4691
|
[NAVIGATION_RELOAD_METHOD]: (runtime, payload) => runtime.reload(payload),
|
|
4692
|
+
[NAVIGATION_OPEN_APP_PAGE_METHOD]: (runtime, payload) => runtime.openAppPage(payload),
|
|
4584
4693
|
};
|
|
4585
4694
|
function createBrowserMockRuntimePlatformAdapter(options) {
|
|
4586
4695
|
return {
|
|
@@ -4687,6 +4796,9 @@ function createBrowserMockRuntimePlatformAdapter(options) {
|
|
|
4687
4796
|
async reload() {
|
|
4688
4797
|
return undefined;
|
|
4689
4798
|
},
|
|
4799
|
+
async openAppPage() {
|
|
4800
|
+
return undefined;
|
|
4801
|
+
},
|
|
4690
4802
|
},
|
|
4691
4803
|
storage: {
|
|
4692
4804
|
getStorage: options.getStorage,
|
|
@@ -4710,6 +4822,7 @@ class MiniProgramMockRuntime {
|
|
|
4710
4822
|
this.records = [];
|
|
4711
4823
|
this.toasts = [];
|
|
4712
4824
|
this.vibrates = [];
|
|
4825
|
+
this.openAppPages = [];
|
|
4713
4826
|
}
|
|
4714
4827
|
async runMethod(method, payload) {
|
|
4715
4828
|
if (!isMiniProgramMockRuntimeMethod(method)) {
|
|
@@ -4726,6 +4839,7 @@ class MiniProgramMockRuntime {
|
|
|
4726
4839
|
clipboardText: this.clipboardText,
|
|
4727
4840
|
closed: this.closed,
|
|
4728
4841
|
loading: { ...this.loading },
|
|
4842
|
+
openAppPages: [...this.openAppPages],
|
|
4729
4843
|
records: [...this.records],
|
|
4730
4844
|
toasts: [...this.toasts],
|
|
4731
4845
|
vibrates: [...this.vibrates],
|
|
@@ -4885,6 +4999,22 @@ class MiniProgramMockRuntime {
|
|
|
4885
4999
|
reloadMockIframe();
|
|
4886
5000
|
}
|
|
4887
5001
|
}
|
|
5002
|
+
async openAppPage(payload) {
|
|
5003
|
+
const options = toOpenAppPagePlatformOptions(payload);
|
|
5004
|
+
await this.adapter.navigation.openAppPage(options);
|
|
5005
|
+
const action = {
|
|
5006
|
+
options,
|
|
5007
|
+
timestamp: Date.now(),
|
|
5008
|
+
};
|
|
5009
|
+
this.openAppPages.unshift(action);
|
|
5010
|
+
this.openAppPages.splice(10);
|
|
5011
|
+
this.record(NAVIGATION_OPEN_APP_PAGE_METHOD, {
|
|
5012
|
+
payload,
|
|
5013
|
+
protocol: options.protocol,
|
|
5014
|
+
});
|
|
5015
|
+
renderMockOpenAppPage(action);
|
|
5016
|
+
await this.options.onOpenAppPage?.(action);
|
|
5017
|
+
}
|
|
4888
5018
|
record(method, payload) {
|
|
4889
5019
|
this.records.unshift({
|
|
4890
5020
|
method,
|
|
@@ -5259,6 +5389,37 @@ function renderMockLoading(state) {
|
|
|
5259
5389
|
'pointer-events:none',
|
|
5260
5390
|
].join(';');
|
|
5261
5391
|
}
|
|
5392
|
+
function renderMockOpenAppPage(action) {
|
|
5393
|
+
const document = readDocument();
|
|
5394
|
+
if (!document) {
|
|
5395
|
+
return;
|
|
5396
|
+
}
|
|
5397
|
+
const element = findOrCreateMockElement(document, 'hb-sdk-mock-runtime-open-app-page');
|
|
5398
|
+
const protocol = action.options.protocol;
|
|
5399
|
+
element.innerHTML = [
|
|
5400
|
+
'<strong>已模拟打开 App 页面</strong>',
|
|
5401
|
+
`<span>${escapeMockHtml(protocol.path)}</span>`,
|
|
5402
|
+
`<pre>${escapeMockHtml(JSON.stringify(protocol.params, null, 2))}</pre>`,
|
|
5403
|
+
].join('');
|
|
5404
|
+
element.style.cssText = [
|
|
5405
|
+
'position:fixed',
|
|
5406
|
+
'right:16px',
|
|
5407
|
+
'bottom:16px',
|
|
5408
|
+
'z-index:2147483647',
|
|
5409
|
+
'max-width:360px',
|
|
5410
|
+
'padding:12px 14px',
|
|
5411
|
+
'border-radius:8px',
|
|
5412
|
+
'background:rgba(17,24,39,.94)',
|
|
5413
|
+
'color:#fff',
|
|
5414
|
+
'font:13px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif',
|
|
5415
|
+
'box-shadow:0 12px 30px rgba(0,0,0,.24)',
|
|
5416
|
+
'pointer-events:none',
|
|
5417
|
+
'white-space:normal',
|
|
5418
|
+
].join(';');
|
|
5419
|
+
setTimeout(() => {
|
|
5420
|
+
element.remove();
|
|
5421
|
+
}, 4000);
|
|
5422
|
+
}
|
|
5262
5423
|
function reloadMockIframe() {
|
|
5263
5424
|
const iframe = readMockIframe();
|
|
5264
5425
|
if (!iframe) {
|
|
@@ -5312,6 +5473,14 @@ function readDocument() {
|
|
|
5312
5473
|
function readWindow() {
|
|
5313
5474
|
return typeof window === 'undefined' ? undefined : window;
|
|
5314
5475
|
}
|
|
5476
|
+
function escapeMockHtml(value) {
|
|
5477
|
+
return String(value)
|
|
5478
|
+
.replace(/&/g, '&')
|
|
5479
|
+
.replace(/</g, '<')
|
|
5480
|
+
.replace(/>/g, '>')
|
|
5481
|
+
.replace(/"/g, '"')
|
|
5482
|
+
.replace(/'/g, ''');
|
|
5483
|
+
}
|
|
5315
5484
|
function isPlainRecord(value) {
|
|
5316
5485
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5317
5486
|
}
|
|
@@ -5453,7 +5622,7 @@ async function handleRequest(message) {
|
|
|
5453
5622
|
try {
|
|
5454
5623
|
const payload = await runtime.runMethod(message.method, message.payload);
|
|
5455
5624
|
postResponse(message, payload);
|
|
5456
|
-
pushLog(message.method,
|
|
5625
|
+
pushLog(message.method, createRequestLogDetail(message.method, message.payload, payload));
|
|
5457
5626
|
}
|
|
5458
5627
|
catch (error) {
|
|
5459
5628
|
const bridgeError = toMockBridgeError(error);
|
|
@@ -5462,6 +5631,20 @@ async function handleRequest(message) {
|
|
|
5462
5631
|
pushLog(message.method, { payload: message.payload, error: bridgeError });
|
|
5463
5632
|
}
|
|
5464
5633
|
}
|
|
5634
|
+
function createRequestLogDetail(method, payload, result) {
|
|
5635
|
+
if (method === NAVIGATION_OPEN_APP_PAGE_METHOD) {
|
|
5636
|
+
const latestOpenAppPage = runtime.getState().openAppPages[0];
|
|
5637
|
+
return {
|
|
5638
|
+
payload,
|
|
5639
|
+
result,
|
|
5640
|
+
protocol: latestOpenAppPage?.options.protocol,
|
|
5641
|
+
};
|
|
5642
|
+
}
|
|
5643
|
+
return {
|
|
5644
|
+
payload,
|
|
5645
|
+
result,
|
|
5646
|
+
};
|
|
5647
|
+
}
|
|
5465
5648
|
async function requestNetwork(config) {
|
|
5466
5649
|
const response = await fetch(NETWORK_PROXY_PATH, {
|
|
5467
5650
|
method: 'POST',
|
package/dist/index.cjs.js
CHANGED
|
@@ -497,6 +497,8 @@ const DEVICE_SET_CLIPBOARD_METHOD = 'device.setClipboard';
|
|
|
497
497
|
const NAVIGATION_CLOSE_METHOD = 'navigation.close';
|
|
498
498
|
/** 重载当前小程序容器能力方法名。 */
|
|
499
499
|
const NAVIGATION_RELOAD_METHOD = 'navigation.reload';
|
|
500
|
+
/** 打开黑盒 App 页面能力方法名。 */
|
|
501
|
+
const NAVIGATION_OPEN_APP_PAGE_METHOD = 'navigation.openAppPage';
|
|
500
502
|
|
|
501
503
|
/**
|
|
502
504
|
* 唤起登录授权,并在流程返回后刷新用户公开基础资料。
|
|
@@ -825,6 +827,76 @@ function createDeviceModule(requester) {
|
|
|
825
827
|
};
|
|
826
828
|
}
|
|
827
829
|
|
|
830
|
+
const GAME_DETAIL_GAME_TYPES = new Set(['pc', 'console', 'mobile']);
|
|
831
|
+
const GAME_DETAIL_PAGES = new Set(['game', 'wiki']);
|
|
832
|
+
/** 校验并规范化打开黑盒 App 页面参数。 */
|
|
833
|
+
function normalizeOpenAppPageOptions(options) {
|
|
834
|
+
if (!isRecord(options)) {
|
|
835
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage options 必须是对象');
|
|
836
|
+
}
|
|
837
|
+
switch (options.target) {
|
|
838
|
+
case 'game_detail':
|
|
839
|
+
return normalizeGameDetailOptions(options);
|
|
840
|
+
case 'user_detail':
|
|
841
|
+
return normalizeUserDetailOptions(options);
|
|
842
|
+
default:
|
|
843
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage target 不支持');
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
function normalizeGameDetailOptions(options) {
|
|
847
|
+
const appId = readRequiredStringLike(options.appId, 'navigation.openAppPage appId 必须是非空字符串或数字');
|
|
848
|
+
if (!GAME_DETAIL_GAME_TYPES.has(options.gameType)) {
|
|
849
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage gameType 必须是 pc、console 或 mobile');
|
|
850
|
+
}
|
|
851
|
+
const payload = {
|
|
852
|
+
target: 'game_detail',
|
|
853
|
+
appId,
|
|
854
|
+
gameType: options.gameType,
|
|
855
|
+
};
|
|
856
|
+
if (options.page !== undefined) {
|
|
857
|
+
if (!GAME_DETAIL_PAGES.has(options.page)) {
|
|
858
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage page 必须是 game 或 wiki');
|
|
859
|
+
}
|
|
860
|
+
payload.page = options.page;
|
|
861
|
+
}
|
|
862
|
+
if (options.hSrc !== undefined) {
|
|
863
|
+
payload.hSrc = readRequiredStringLike(options.hSrc, 'navigation.openAppPage hSrc 必须是非空字符串');
|
|
864
|
+
}
|
|
865
|
+
if (options.skuId !== undefined) {
|
|
866
|
+
payload.skuId = readRequiredStringLike(options.skuId, 'navigation.openAppPage skuId 必须是非空字符串或数字');
|
|
867
|
+
}
|
|
868
|
+
return payload;
|
|
869
|
+
}
|
|
870
|
+
function normalizeUserDetailOptions(options) {
|
|
871
|
+
return {
|
|
872
|
+
target: 'user_detail',
|
|
873
|
+
userId: readRequiredString(options.userId, 'navigation.openAppPage userId 必须是非空字符串'),
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
function readRequiredString(value, message) {
|
|
877
|
+
if (typeof value !== 'string') {
|
|
878
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
879
|
+
}
|
|
880
|
+
const stringValue = value.trim();
|
|
881
|
+
if (!stringValue) {
|
|
882
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
883
|
+
}
|
|
884
|
+
return stringValue;
|
|
885
|
+
}
|
|
886
|
+
function readRequiredStringLike(value, message) {
|
|
887
|
+
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
888
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
889
|
+
}
|
|
890
|
+
const stringValue = String(value).trim();
|
|
891
|
+
if (!stringValue) {
|
|
892
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
893
|
+
}
|
|
894
|
+
return stringValue;
|
|
895
|
+
}
|
|
896
|
+
function isRecord(value) {
|
|
897
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
898
|
+
}
|
|
899
|
+
|
|
828
900
|
/** 请求宿主关闭当前小程序容器。 */
|
|
829
901
|
function close(requester) {
|
|
830
902
|
return requester.request(NAVIGATION_CLOSE_METHOD);
|
|
@@ -833,11 +905,21 @@ function close(requester) {
|
|
|
833
905
|
function reload(requester) {
|
|
834
906
|
return requester.request(NAVIGATION_RELOAD_METHOD);
|
|
835
907
|
}
|
|
908
|
+
/** 请求宿主打开受 SDK 白名单约束的黑盒 App 页面。 */
|
|
909
|
+
function openAppPage(requester, options) {
|
|
910
|
+
try {
|
|
911
|
+
return requester.request(NAVIGATION_OPEN_APP_PAGE_METHOD, normalizeOpenAppPageOptions(options));
|
|
912
|
+
}
|
|
913
|
+
catch (error) {
|
|
914
|
+
return Promise.reject(error);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
836
917
|
/** 创建导航能力模块。 */
|
|
837
918
|
function createNavigationModule(requester) {
|
|
838
919
|
return {
|
|
839
920
|
close: () => close(requester),
|
|
840
921
|
reload: () => reload(requester),
|
|
922
|
+
openAppPage: options => openAppPage(requester, options),
|
|
841
923
|
};
|
|
842
924
|
}
|
|
843
925
|
|
|
@@ -1038,6 +1120,7 @@ const device = {
|
|
|
1038
1120
|
const navigation = {
|
|
1039
1121
|
close: () => getDefaultSDK().navigation.close(),
|
|
1040
1122
|
reload: () => getDefaultSDK().navigation.reload(),
|
|
1123
|
+
openAppPage: options => getDefaultSDK().navigation.openAppPage(options),
|
|
1041
1124
|
};
|
|
1042
1125
|
|
|
1043
1126
|
const hbSDK = {
|
package/dist/index.esm.js
CHANGED
|
@@ -493,6 +493,8 @@ const DEVICE_SET_CLIPBOARD_METHOD = 'device.setClipboard';
|
|
|
493
493
|
const NAVIGATION_CLOSE_METHOD = 'navigation.close';
|
|
494
494
|
/** 重载当前小程序容器能力方法名。 */
|
|
495
495
|
const NAVIGATION_RELOAD_METHOD = 'navigation.reload';
|
|
496
|
+
/** 打开黑盒 App 页面能力方法名。 */
|
|
497
|
+
const NAVIGATION_OPEN_APP_PAGE_METHOD = 'navigation.openAppPage';
|
|
496
498
|
|
|
497
499
|
/**
|
|
498
500
|
* 唤起登录授权,并在流程返回后刷新用户公开基础资料。
|
|
@@ -821,6 +823,76 @@ function createDeviceModule(requester) {
|
|
|
821
823
|
};
|
|
822
824
|
}
|
|
823
825
|
|
|
826
|
+
const GAME_DETAIL_GAME_TYPES = new Set(['pc', 'console', 'mobile']);
|
|
827
|
+
const GAME_DETAIL_PAGES = new Set(['game', 'wiki']);
|
|
828
|
+
/** 校验并规范化打开黑盒 App 页面参数。 */
|
|
829
|
+
function normalizeOpenAppPageOptions(options) {
|
|
830
|
+
if (!isRecord(options)) {
|
|
831
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage options 必须是对象');
|
|
832
|
+
}
|
|
833
|
+
switch (options.target) {
|
|
834
|
+
case 'game_detail':
|
|
835
|
+
return normalizeGameDetailOptions(options);
|
|
836
|
+
case 'user_detail':
|
|
837
|
+
return normalizeUserDetailOptions(options);
|
|
838
|
+
default:
|
|
839
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage target 不支持');
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
function normalizeGameDetailOptions(options) {
|
|
843
|
+
const appId = readRequiredStringLike(options.appId, 'navigation.openAppPage appId 必须是非空字符串或数字');
|
|
844
|
+
if (!GAME_DETAIL_GAME_TYPES.has(options.gameType)) {
|
|
845
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage gameType 必须是 pc、console 或 mobile');
|
|
846
|
+
}
|
|
847
|
+
const payload = {
|
|
848
|
+
target: 'game_detail',
|
|
849
|
+
appId,
|
|
850
|
+
gameType: options.gameType,
|
|
851
|
+
};
|
|
852
|
+
if (options.page !== undefined) {
|
|
853
|
+
if (!GAME_DETAIL_PAGES.has(options.page)) {
|
|
854
|
+
throw createSDKError('INVALID_PARAMS', 'navigation.openAppPage page 必须是 game 或 wiki');
|
|
855
|
+
}
|
|
856
|
+
payload.page = options.page;
|
|
857
|
+
}
|
|
858
|
+
if (options.hSrc !== undefined) {
|
|
859
|
+
payload.hSrc = readRequiredStringLike(options.hSrc, 'navigation.openAppPage hSrc 必须是非空字符串');
|
|
860
|
+
}
|
|
861
|
+
if (options.skuId !== undefined) {
|
|
862
|
+
payload.skuId = readRequiredStringLike(options.skuId, 'navigation.openAppPage skuId 必须是非空字符串或数字');
|
|
863
|
+
}
|
|
864
|
+
return payload;
|
|
865
|
+
}
|
|
866
|
+
function normalizeUserDetailOptions(options) {
|
|
867
|
+
return {
|
|
868
|
+
target: 'user_detail',
|
|
869
|
+
userId: readRequiredString(options.userId, 'navigation.openAppPage userId 必须是非空字符串'),
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
function readRequiredString(value, message) {
|
|
873
|
+
if (typeof value !== 'string') {
|
|
874
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
875
|
+
}
|
|
876
|
+
const stringValue = value.trim();
|
|
877
|
+
if (!stringValue) {
|
|
878
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
879
|
+
}
|
|
880
|
+
return stringValue;
|
|
881
|
+
}
|
|
882
|
+
function readRequiredStringLike(value, message) {
|
|
883
|
+
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
884
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
885
|
+
}
|
|
886
|
+
const stringValue = String(value).trim();
|
|
887
|
+
if (!stringValue) {
|
|
888
|
+
throw createSDKError('INVALID_PARAMS', message);
|
|
889
|
+
}
|
|
890
|
+
return stringValue;
|
|
891
|
+
}
|
|
892
|
+
function isRecord(value) {
|
|
893
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
894
|
+
}
|
|
895
|
+
|
|
824
896
|
/** 请求宿主关闭当前小程序容器。 */
|
|
825
897
|
function close(requester) {
|
|
826
898
|
return requester.request(NAVIGATION_CLOSE_METHOD);
|
|
@@ -829,11 +901,21 @@ function close(requester) {
|
|
|
829
901
|
function reload(requester) {
|
|
830
902
|
return requester.request(NAVIGATION_RELOAD_METHOD);
|
|
831
903
|
}
|
|
904
|
+
/** 请求宿主打开受 SDK 白名单约束的黑盒 App 页面。 */
|
|
905
|
+
function openAppPage(requester, options) {
|
|
906
|
+
try {
|
|
907
|
+
return requester.request(NAVIGATION_OPEN_APP_PAGE_METHOD, normalizeOpenAppPageOptions(options));
|
|
908
|
+
}
|
|
909
|
+
catch (error) {
|
|
910
|
+
return Promise.reject(error);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
832
913
|
/** 创建导航能力模块。 */
|
|
833
914
|
function createNavigationModule(requester) {
|
|
834
915
|
return {
|
|
835
916
|
close: () => close(requester),
|
|
836
917
|
reload: () => reload(requester),
|
|
918
|
+
openAppPage: options => openAppPage(requester, options),
|
|
837
919
|
};
|
|
838
920
|
}
|
|
839
921
|
|
|
@@ -1034,6 +1116,7 @@ const device = {
|
|
|
1034
1116
|
const navigation = {
|
|
1035
1117
|
close: () => getDefaultSDK().navigation.close(),
|
|
1036
1118
|
reload: () => getDefaultSDK().navigation.reload(),
|
|
1119
|
+
openAppPage: options => getDefaultSDK().navigation.openAppPage(options),
|
|
1037
1120
|
};
|
|
1038
1121
|
|
|
1039
1122
|
const hbSDK = {
|
package/dist/protocol.cjs.js
CHANGED
|
@@ -113,6 +113,8 @@ const DEVICE_SET_CLIPBOARD_METHOD = 'device.setClipboard';
|
|
|
113
113
|
const NAVIGATION_CLOSE_METHOD = 'navigation.close';
|
|
114
114
|
/** 重载当前小程序容器能力方法名。 */
|
|
115
115
|
const NAVIGATION_RELOAD_METHOD = 'navigation.reload';
|
|
116
|
+
/** 打开黑盒 App 页面能力方法名。 */
|
|
117
|
+
const NAVIGATION_OPEN_APP_PAGE_METHOD = 'navigation.openAppPage';
|
|
116
118
|
/**
|
|
117
119
|
* 小程序开放能力目录。
|
|
118
120
|
*
|
|
@@ -267,6 +269,13 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
267
269
|
permission: 'navigation.reload',
|
|
268
270
|
risk: 'medium',
|
|
269
271
|
},
|
|
272
|
+
{
|
|
273
|
+
method: NAVIGATION_OPEN_APP_PAGE_METHOD,
|
|
274
|
+
module: 'navigation',
|
|
275
|
+
capability: NAVIGATION_OPEN_APP_PAGE_METHOD,
|
|
276
|
+
permission: 'navigation.openAppPage',
|
|
277
|
+
risk: 'medium',
|
|
278
|
+
},
|
|
270
279
|
];
|
|
271
280
|
|
|
272
281
|
exports.AUTH_LOGIN_METHOD = AUTH_LOGIN_METHOD;
|
|
@@ -277,6 +286,7 @@ exports.MINI_PROGRAM_MESSAGE_NAMESPACE = MINI_PROGRAM_MESSAGE_NAMESPACE;
|
|
|
277
286
|
exports.MINI_PROGRAM_MESSAGE_VERSION = MINI_PROGRAM_MESSAGE_VERSION;
|
|
278
287
|
exports.MINI_PROGRAM_PROTOCOL_CAPABILITIES = MINI_PROGRAM_PROTOCOL_CAPABILITIES;
|
|
279
288
|
exports.NAVIGATION_CLOSE_METHOD = NAVIGATION_CLOSE_METHOD;
|
|
289
|
+
exports.NAVIGATION_OPEN_APP_PAGE_METHOD = NAVIGATION_OPEN_APP_PAGE_METHOD;
|
|
280
290
|
exports.NAVIGATION_RELOAD_METHOD = NAVIGATION_RELOAD_METHOD;
|
|
281
291
|
exports.NETWORK_REQUEST_METHOD = NETWORK_REQUEST_METHOD;
|
|
282
292
|
exports.SDK_HANDSHAKE_METHOD = SDK_HANDSHAKE_METHOD;
|
package/dist/protocol.esm.js
CHANGED
|
@@ -111,6 +111,8 @@ const DEVICE_SET_CLIPBOARD_METHOD = 'device.setClipboard';
|
|
|
111
111
|
const NAVIGATION_CLOSE_METHOD = 'navigation.close';
|
|
112
112
|
/** 重载当前小程序容器能力方法名。 */
|
|
113
113
|
const NAVIGATION_RELOAD_METHOD = 'navigation.reload';
|
|
114
|
+
/** 打开黑盒 App 页面能力方法名。 */
|
|
115
|
+
const NAVIGATION_OPEN_APP_PAGE_METHOD = 'navigation.openAppPage';
|
|
114
116
|
/**
|
|
115
117
|
* 小程序开放能力目录。
|
|
116
118
|
*
|
|
@@ -265,6 +267,13 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
265
267
|
permission: 'navigation.reload',
|
|
266
268
|
risk: 'medium',
|
|
267
269
|
},
|
|
270
|
+
{
|
|
271
|
+
method: NAVIGATION_OPEN_APP_PAGE_METHOD,
|
|
272
|
+
module: 'navigation',
|
|
273
|
+
capability: NAVIGATION_OPEN_APP_PAGE_METHOD,
|
|
274
|
+
permission: 'navigation.openAppPage',
|
|
275
|
+
risk: 'medium',
|
|
276
|
+
},
|
|
268
277
|
];
|
|
269
278
|
|
|
270
|
-
export { AUTH_LOGIN_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, SDK_HANDSHAKE_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_CURRENT_USER_DETAIL_METHOD, USER_GET_CURRENT_USER_PROFILE_METHOD, USER_GET_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, isMiniProgramBridgeMessage };
|
|
279
|
+
export { AUTH_LOGIN_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, SDK_HANDSHAKE_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_CURRENT_USER_DETAIL_METHOD, USER_GET_CURRENT_USER_PROFILE_METHOD, USER_GET_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, isMiniProgramBridgeMessage };
|
package/package.json
CHANGED
|
@@ -42,6 +42,7 @@ export {
|
|
|
42
42
|
DEVICE_VIBRATE_METHOD,
|
|
43
43
|
MINI_PROGRAM_PROTOCOL_CAPABILITIES,
|
|
44
44
|
NAVIGATION_CLOSE_METHOD,
|
|
45
|
+
NAVIGATION_OPEN_APP_PAGE_METHOD,
|
|
45
46
|
NAVIGATION_RELOAD_METHOD,
|
|
46
47
|
NETWORK_REQUEST_METHOD,
|
|
47
48
|
SHARE_SCREENSHOT_METHOD,
|
|
@@ -153,6 +154,10 @@ export type {
|
|
|
153
154
|
export type {
|
|
154
155
|
ClosePayload,
|
|
155
156
|
CloseResult,
|
|
157
|
+
OpenAppPagePayload,
|
|
158
|
+
OpenAppPageResult,
|
|
159
|
+
OpenGameDetailAppPagePayload,
|
|
160
|
+
OpenUserDetailAppPagePayload,
|
|
156
161
|
ReloadPayload,
|
|
157
162
|
ReloadResult,
|
|
158
163
|
} from './modules/navigation';
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Package metadata
|
|
20
20
|
|
|
21
21
|
- Package: `@heybox/hb-sdk`
|
|
22
|
-
- Version at generation time: `0.5.
|
|
22
|
+
- Version at generation time: `0.5.2`
|
|
23
23
|
- Public root export: `@heybox/hb-sdk`
|
|
24
24
|
- Protocol export: `@heybox/hb-sdk/protocol`
|
|
25
25
|
- Vite plugin export: `@heybox/hb-sdk/vite`
|
|
@@ -140,7 +140,17 @@ export type {
|
|
|
140
140
|
export type {
|
|
141
141
|
ClosePayload,
|
|
142
142
|
CloseResult,
|
|
143
|
+
MiniProgramAppPageTarget,
|
|
144
|
+
MiniProgramGameDetailGameType,
|
|
145
|
+
MiniProgramGameDetailPage,
|
|
143
146
|
MiniProgramNavigationModule,
|
|
147
|
+
OpenAppPageOptions,
|
|
148
|
+
OpenAppPagePayload,
|
|
149
|
+
OpenAppPageResult,
|
|
150
|
+
OpenGameDetailAppPagePayload,
|
|
151
|
+
OpenGameDetailAppPageOptions,
|
|
152
|
+
OpenUserDetailAppPagePayload,
|
|
153
|
+
OpenUserDetailAppPageOptions,
|
|
144
154
|
ReloadPayload,
|
|
145
155
|
ReloadResult,
|
|
146
156
|
} from './modules/navigation';
|
|
@@ -466,10 +476,23 @@ import { navigation } from '@heybox/hb-sdk';
|
|
|
466
476
|
|
|
467
477
|
await navigation.reload();
|
|
468
478
|
await navigation.close();
|
|
479
|
+
|
|
480
|
+
await navigation.openAppPage({
|
|
481
|
+
target: 'game_detail',
|
|
482
|
+
appId: 578080,
|
|
483
|
+
gameType: 'pc',
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
await navigation.openAppPage({
|
|
487
|
+
target: 'user_detail',
|
|
488
|
+
userId: '239040',
|
|
489
|
+
});
|
|
469
490
|
```
|
|
470
491
|
|
|
471
492
|
`navigation.close()` 请求宿主关闭当前小程序容器,`navigation.reload()` 请求宿主重载当前小程序页面/容器。调用后 JS 上下文可能被宿主销毁,不保证后续代码继续执行;这两个能力不接受 `reason`、`force`、`confirm` 或 `fallbackUrl` 等扩展参数。
|
|
472
493
|
|
|
494
|
+
`navigation.openAppPage()` 请求宿主打开受 SDK 白名单约束的黑盒 App 页面。当前支持 `target: 'game_detail'`,必填 `appId` 与 `gameType`;`gameType` 支持 `pc`、`console`、`mobile`,可选 `page: 'game' | 'wiki'`、`hSrc`、`skuId`。也支持 `target: 'user_detail'`,必填 `userId`。
|
|
495
|
+
|
|
473
496
|
### 窗口信息
|
|
474
497
|
|
|
475
498
|
```ts
|
package/skill/skill.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.5.
|
|
3
|
+
"skillVersion": "0.5.2+skill.6596fdf246b8",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.5.
|
|
7
|
-
"compatibility": "0.5.
|
|
6
|
+
"version": "0.5.2",
|
|
7
|
+
"compatibility": "0.5.2"
|
|
8
8
|
},
|
|
9
9
|
"source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
|
|
10
|
-
"integrity": "sha256-
|
|
10
|
+
"integrity": "sha256-6596fdf246b8e8d17436f5d3ada8fb82c4ddd2be935fe0c923e42b7cbc867437"
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { GetStoragePayload, GetStorageResult, MiniProgramStorageModule, Set
|
|
|
11
11
|
export type { MiniProgramNetworkHeaders, MiniProgramNetworkModule, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, NetworkRequestPayload, NetworkResponsePayload, } from './modules/network';
|
|
12
12
|
export type { HideLoadingPayload, HideLoadingResult, MiniProgramToastStatus, MiniProgramUiModule, ShowLoadingPayload, ShowLoadingResult, ShowToastPayload, ShowToastResult, } from './modules/ui';
|
|
13
13
|
export type { MiniProgramDeviceModule, MiniProgramVibrateIntensity, SetClipboardPayload, SetClipboardResult, VibratePayload, VibrateResult, } from './modules/device';
|
|
14
|
-
export type { ClosePayload, CloseResult, MiniProgramNavigationModule, ReloadPayload, ReloadResult, } from './modules/navigation';
|
|
14
|
+
export type { ClosePayload, CloseResult, MiniProgramAppPageTarget, MiniProgramGameDetailGameType, MiniProgramGameDetailPage, MiniProgramNavigationModule, OpenAppPageOptions, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPagePayload, OpenGameDetailAppPageOptions, OpenUserDetailAppPagePayload, OpenUserDetailAppPageOptions, ReloadPayload, ReloadResult, } from './modules/navigation';
|
|
15
15
|
import { off, on, ready } from './core/singleton';
|
|
16
16
|
declare const hbSDK: {
|
|
17
17
|
ready: typeof ready;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OpenAppPageOptions, OpenAppPagePayload } from './types';
|
|
2
|
+
export type { MiniProgramAppPageTarget, MiniProgramGameDetailGameType, MiniProgramGameDetailPage, OpenAppPageOptions, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPagePayload, OpenGameDetailAppPageOptions, OpenUserDetailAppPagePayload, OpenUserDetailAppPageOptions, } from './types';
|
|
3
|
+
/** 校验并规范化打开黑盒 App 页面参数。 */
|
|
4
|
+
export declare function normalizeOpenAppPageOptions(options: OpenAppPageOptions): OpenAppPagePayload;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** 小程序可请求打开的黑盒 App 页面目标。 */
|
|
2
|
+
export type MiniProgramAppPageTarget = 'game_detail' | 'user_detail';
|
|
3
|
+
/** 游戏详情支持的平台类型,与客户端 openGameDetail / RouterPath 文档保持一致。 */
|
|
4
|
+
export type MiniProgramGameDetailGameType = 'pc' | 'console' | 'mobile';
|
|
5
|
+
/** 游戏详情支持的首屏页面。 */
|
|
6
|
+
export type MiniProgramGameDetailPage = 'game' | 'wiki';
|
|
7
|
+
/** 打开游戏详情页的公共参数。 */
|
|
8
|
+
export interface OpenGameDetailAppPageOptions {
|
|
9
|
+
/** 目标页面。 */
|
|
10
|
+
target: 'game_detail';
|
|
11
|
+
/** 游戏 app id。 */
|
|
12
|
+
appId: string | number;
|
|
13
|
+
/** 游戏平台类型。 */
|
|
14
|
+
gameType: MiniProgramGameDetailGameType;
|
|
15
|
+
/** 可选,打开的详情页子页面,默认由客户端决定。 */
|
|
16
|
+
page?: MiniProgramGameDetailPage;
|
|
17
|
+
/** 可选,追踪来源。 */
|
|
18
|
+
hSrc?: string;
|
|
19
|
+
/** 可选,弹出商品购买默认选中的 SKU。 */
|
|
20
|
+
skuId?: string | number;
|
|
21
|
+
}
|
|
22
|
+
/** 打开用户详情页的公共参数。 */
|
|
23
|
+
export interface OpenUserDetailAppPageOptions {
|
|
24
|
+
/** 目标页面。 */
|
|
25
|
+
target: 'user_detail';
|
|
26
|
+
/** 用户 heybox_id。 */
|
|
27
|
+
userId: string;
|
|
28
|
+
}
|
|
29
|
+
/** 打开黑盒 App 页面公共参数。 */
|
|
30
|
+
export type OpenAppPageOptions = OpenGameDetailAppPageOptions | OpenUserDetailAppPageOptions;
|
|
31
|
+
/** `navigation.openAppPage` bridge payload。 */
|
|
32
|
+
export type OpenGameDetailAppPagePayload = Omit<OpenGameDetailAppPageOptions, 'appId' | 'skuId'> & {
|
|
33
|
+
appId: string;
|
|
34
|
+
skuId?: string;
|
|
35
|
+
};
|
|
36
|
+
/** `navigation.openAppPage` 打开用户详情页的 bridge payload。 */
|
|
37
|
+
export type OpenUserDetailAppPagePayload = Omit<OpenUserDetailAppPageOptions, 'userId'> & {
|
|
38
|
+
userId: string;
|
|
39
|
+
};
|
|
40
|
+
/** `navigation.openAppPage` bridge payload。 */
|
|
41
|
+
export type OpenAppPagePayload = OpenGameDetailAppPagePayload | OpenUserDetailAppPagePayload;
|
|
42
|
+
/** `navigation.openAppPage` 无稳定返回值。 */
|
|
43
|
+
export type OpenAppPageResult = void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { MiniProgramRequester } from '../../core/client';
|
|
2
|
-
|
|
2
|
+
import { type OpenAppPageOptions } from './app-pages';
|
|
3
|
+
export { NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, } from '../../protocol/capabilities';
|
|
4
|
+
export type { MiniProgramAppPageTarget, MiniProgramGameDetailGameType, MiniProgramGameDetailPage, OpenAppPageOptions, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPagePayload, OpenGameDetailAppPageOptions, OpenUserDetailAppPagePayload, OpenUserDetailAppPageOptions, } from './app-pages';
|
|
3
5
|
/** `navigation.close` 不需要入参。 */
|
|
4
6
|
export type ClosePayload = void;
|
|
5
7
|
/** `navigation.close` 无稳定返回值。 */
|
|
@@ -15,10 +17,14 @@ export interface MiniProgramNavigationModule {
|
|
|
15
17
|
close(): Promise<void>;
|
|
16
18
|
/** 请求宿主重载当前小程序容器。 */
|
|
17
19
|
reload(): Promise<void>;
|
|
20
|
+
/** 请求宿主打开受 SDK 白名单约束的黑盒 App 页面。 */
|
|
21
|
+
openAppPage(options: OpenAppPageOptions): Promise<void>;
|
|
18
22
|
}
|
|
19
23
|
/** 请求宿主关闭当前小程序容器。 */
|
|
20
24
|
export declare function close(requester: MiniProgramRequester): Promise<void>;
|
|
21
25
|
/** 请求宿主重载当前小程序容器。 */
|
|
22
26
|
export declare function reload(requester: MiniProgramRequester): Promise<void>;
|
|
27
|
+
/** 请求宿主打开受 SDK 白名单约束的黑盒 App 页面。 */
|
|
28
|
+
export declare function openAppPage(requester: MiniProgramRequester, options: OpenAppPageOptions): Promise<void>;
|
|
23
29
|
/** 创建导航能力模块。 */
|
|
24
30
|
export declare function createNavigationModule(requester: MiniProgramRequester): MiniProgramNavigationModule;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoginPayload, LoginResult } from '../modules/auth';
|
|
2
2
|
import type { SetClipboardPayload, SetClipboardResult, VibratePayload, VibrateResult } from '../modules/device';
|
|
3
|
-
import type { ClosePayload, CloseResult, ReloadPayload, ReloadResult } from '../modules/navigation';
|
|
3
|
+
import type { ClosePayload, CloseResult, OpenAppPagePayload, OpenAppPageResult, ReloadPayload, ReloadResult } from '../modules/navigation';
|
|
4
4
|
import type { NetworkRequestPayload, NetworkResponsePayload } from '../modules/network';
|
|
5
5
|
import type { ScreenshotPayload, ScreenshotResult, ShowShareMenuPayload, ShowShareMenuResult } from '../modules/share';
|
|
6
6
|
import type { GetStoragePayload, GetStorageResult, SetStoragePayload } from '../modules/storage';
|
|
@@ -94,6 +94,8 @@ export declare const DEVICE_SET_CLIPBOARD_METHOD: "device.setClipboard";
|
|
|
94
94
|
export declare const NAVIGATION_CLOSE_METHOD: "navigation.close";
|
|
95
95
|
/** 重载当前小程序容器能力方法名。 */
|
|
96
96
|
export declare const NAVIGATION_RELOAD_METHOD: "navigation.reload";
|
|
97
|
+
/** 打开黑盒 App 页面能力方法名。 */
|
|
98
|
+
export declare const NAVIGATION_OPEN_APP_PAGE_METHOD: "navigation.openAppPage";
|
|
97
99
|
/** 授权模块开放的方法名。 */
|
|
98
100
|
export type MiniProgramAuthMethod = typeof AUTH_LOGIN_METHOD;
|
|
99
101
|
/** 用户模块开放的方法名。 */
|
|
@@ -111,7 +113,7 @@ export type MiniProgramUiMethod = typeof UI_SHOW_TOAST_METHOD | typeof UI_SHOW_L
|
|
|
111
113
|
/** Device 模块开放的方法名。 */
|
|
112
114
|
export type MiniProgramDeviceMethod = typeof DEVICE_VIBRATE_METHOD | typeof DEVICE_SET_CLIPBOARD_METHOD;
|
|
113
115
|
/** Navigation 模块开放的方法名。 */
|
|
114
|
-
export type MiniProgramNavigationMethod = typeof NAVIGATION_CLOSE_METHOD | typeof NAVIGATION_RELOAD_METHOD;
|
|
116
|
+
export type MiniProgramNavigationMethod = typeof NAVIGATION_CLOSE_METHOD | typeof NAVIGATION_RELOAD_METHOD | typeof NAVIGATION_OPEN_APP_PAGE_METHOD;
|
|
115
117
|
/** 父容器开放给小程序调用的 bridge method。 */
|
|
116
118
|
export type MiniProgramBridgeMethod = MiniProgramAuthMethod | MiniProgramUserMethod | MiniProgramShareMethod | MiniProgramViewportMethod | MiniProgramStorageMethod | MiniProgramNetworkMethod | MiniProgramUiMethod | MiniProgramDeviceMethod | MiniProgramNavigationMethod;
|
|
117
119
|
/** 小程序开放能力所属模块。 */
|
|
@@ -269,6 +271,12 @@ export declare const MINI_PROGRAM_PROTOCOL_CAPABILITIES: readonly [{
|
|
|
269
271
|
readonly capability: "navigation.reload";
|
|
270
272
|
readonly permission: "navigation.reload";
|
|
271
273
|
readonly risk: "medium";
|
|
274
|
+
}, {
|
|
275
|
+
readonly method: "navigation.openAppPage";
|
|
276
|
+
readonly module: "navigation";
|
|
277
|
+
readonly capability: "navigation.openAppPage";
|
|
278
|
+
readonly permission: "navigation.openAppPage";
|
|
279
|
+
readonly risk: "medium";
|
|
272
280
|
}];
|
|
273
281
|
/** bridge method 到请求 payload 的映射。 */
|
|
274
282
|
export interface MiniProgramCapabilityPayloadMap {
|
|
@@ -293,6 +301,7 @@ export interface MiniProgramCapabilityPayloadMap {
|
|
|
293
301
|
[DEVICE_SET_CLIPBOARD_METHOD]: SetClipboardPayload;
|
|
294
302
|
[NAVIGATION_CLOSE_METHOD]: ClosePayload;
|
|
295
303
|
[NAVIGATION_RELOAD_METHOD]: ReloadPayload;
|
|
304
|
+
[NAVIGATION_OPEN_APP_PAGE_METHOD]: OpenAppPagePayload;
|
|
296
305
|
}
|
|
297
306
|
/** bridge method 到标准化响应 payload 的映射。 */
|
|
298
307
|
export interface MiniProgramCapabilityResultMap {
|
|
@@ -317,6 +326,7 @@ export interface MiniProgramCapabilityResultMap {
|
|
|
317
326
|
[DEVICE_SET_CLIPBOARD_METHOD]: SetClipboardResult;
|
|
318
327
|
[NAVIGATION_CLOSE_METHOD]: CloseResult;
|
|
319
328
|
[NAVIGATION_RELOAD_METHOD]: ReloadResult;
|
|
329
|
+
[NAVIGATION_OPEN_APP_PAGE_METHOD]: OpenAppPageResult;
|
|
320
330
|
}
|
|
321
331
|
/** 指定 bridge method 的请求 payload。 */
|
|
322
332
|
export type MiniProgramCapabilityPayload<T extends MiniProgramBridgeMethod> = MiniProgramCapabilityPayloadMap[T];
|
package/types/protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, SDK_HANDSHAKE_METHOD, } from './protocol/constants';
|
|
2
2
|
export { isMiniProgramBridgeMessage } from './protocol/guards';
|
|
3
3
|
export type { MiniProgramBridgeError, MiniProgramBridgeMessage, MiniProgramBridgeMessageType, MiniProgramEventHandler, MiniProgramEventName, MiniProgramEventPayloadMap, } from './protocol/types';
|
|
4
|
-
export { AUTH_LOGIN_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_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_CURRENT_USER_DETAIL_METHOD, USER_GET_CURRENT_USER_PROFILE_METHOD, USER_GET_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, } from './protocol/capabilities';
|
|
4
|
+
export { AUTH_LOGIN_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_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_CURRENT_USER_DETAIL_METHOD, USER_GET_CURRENT_USER_PROFILE_METHOD, USER_GET_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, } from './protocol/capabilities';
|
|
5
5
|
export type { MiniProgramDeviceMethod, MiniProgramAuthMethod, MiniProgramBridgeMethod, MiniProgramCapabilityDefinition, MiniProgramCapabilityModule, MiniProgramCapabilityPayload, MiniProgramCapabilityPayloadMap, MiniProgramCapabilityResult, MiniProgramCapabilityResultMap, MiniProgramCapabilityRisk, MiniProgramNavigationMethod, MiniProgramNetworkMethod, MiniProgramShareMethod, MiniProgramStorageMethod, MiniProgramUiMethod, MiniProgramUserMethod, MiniProgramViewportMethod, } from './protocol/capabilities';
|
|
6
6
|
export type { LoginPayload, LoginResult } from './modules/auth';
|
|
7
7
|
export type { GetCurrentUserDetailPayload, GetCurrentUserDetailResult, GetCurrentUserProfilePayload, GetCurrentUserProfileResult, GetPlatformAccountInfoPayload, GetPlatformAccountInfoResult, GetPlatformAccountOverviewPayload, GetPlatformAccountOverviewResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetUserInfoPayload, GetUserInfoResult, MiniProgramUserInfo, MiniProgramUserInfoResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SteamGamePrice, } from './modules/user';
|
|
@@ -13,4 +13,4 @@ export type { GetWindowInfoPayload, GetWindowInfoResult, MiniProgramNavigationBa
|
|
|
13
13
|
export type { MiniProgramNetworkHeaders, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, NetworkRequestPayload, NetworkResponsePayload, } from './modules/network';
|
|
14
14
|
export type { HideLoadingPayload, HideLoadingResult, MiniProgramToastStatus, ShowLoadingPayload, ShowLoadingResult, ShowToastPayload, ShowToastResult, } from './modules/ui';
|
|
15
15
|
export type { MiniProgramVibrateIntensity, SetClipboardPayload, SetClipboardResult, VibratePayload, VibrateResult, } from './modules/device';
|
|
16
|
-
export type { ClosePayload, CloseResult, ReloadPayload, ReloadResult, } from './modules/navigation';
|
|
16
|
+
export type { ClosePayload, CloseResult, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPagePayload, OpenUserDetailAppPagePayload, ReloadPayload, ReloadResult, } from './modules/navigation';
|