@harborclient/sdk 1.4.4 → 1.5.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 +12 -0
- package/dist/components/SidebarItem/SidebarWebsiteItem.d.ts +11 -2
- package/dist/components/SidebarItem/SidebarWebsiteItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarWebsiteItem.js +6 -3
- package/dist/components/TabBar/index.d.ts +11 -1
- package/dist/components/TabBar/index.d.ts.map +1 -1
- package/dist/components/TabBar/index.js +51 -8
- package/dist/components/VariableInput/index.d.ts +10 -1
- package/dist/components/VariableInput/index.d.ts.map +1 -1
- package/dist/components/VariableInput/index.js +19 -2
- package/dist/runtime/createBridgedPluginContext.js +76 -19
- package/dist/runtime/livePageHandle.d.ts +50 -0
- package/dist/runtime/{webpageHandle.js → livePageHandle.js} +125 -47
- package/dist/snippets.d.ts +34 -12
- package/dist/types.d.ts +521 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/runtime/webpageHandle.d.ts +0 -50
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Throws when a
|
|
2
|
+
* Throws when a live-page bridge result is an `{ error }` object.
|
|
3
3
|
*
|
|
4
4
|
* @param {unknown} result - Raw bridge result.
|
|
5
5
|
* @returns {unknown} The result when it is not an error.
|
|
6
6
|
* @throws {Error} When the bridge returned `{ error: string }`.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function unwrapLivePageBridgeResult(result) {
|
|
9
9
|
if (
|
|
10
10
|
result != null &&
|
|
11
11
|
typeof result === 'object' &&
|
|
@@ -20,54 +20,54 @@ export function unwrapWebpageBridgeResult(result) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Normalizes the optional second argument to `hc.
|
|
23
|
+
* Normalizes the optional second argument to `hc.livePage(url, options)`.
|
|
24
24
|
*
|
|
25
25
|
* @param {unknown} [options] - User-provided options.
|
|
26
26
|
* @returns {{ reuse?: boolean }} Normalized open options.
|
|
27
27
|
*/
|
|
28
|
-
export function
|
|
28
|
+
export function normalizeLivePageOpenOptions(options) {
|
|
29
29
|
if (options == null) {
|
|
30
30
|
return {};
|
|
31
31
|
}
|
|
32
32
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
33
|
-
throw new Error('hc.
|
|
33
|
+
throw new Error('hc.livePage options must be an object');
|
|
34
34
|
}
|
|
35
35
|
const raw = /** @type {Record<string, unknown>} */ (options);
|
|
36
36
|
if (!('reuse' in raw) || raw.reuse === undefined) {
|
|
37
37
|
return {};
|
|
38
38
|
}
|
|
39
39
|
if (typeof raw.reuse !== 'boolean') {
|
|
40
|
-
throw new Error('hc.
|
|
40
|
+
throw new Error('hc.livePage options.reuse must be a boolean');
|
|
41
41
|
}
|
|
42
42
|
return { reuse: raw.reuse };
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* Normalizes optional `hc.
|
|
46
|
+
* Normalizes optional `hc.livePage().screenshot` options.
|
|
47
47
|
*
|
|
48
48
|
* @param {unknown} [options] - User-provided options (`fullPage` optional).
|
|
49
49
|
* @returns {{ fullPage: boolean }} Normalized options (default `fullPage: false`).
|
|
50
50
|
* @throws {Error} When options is present but not a plain object, or `fullPage` is not a boolean.
|
|
51
51
|
*/
|
|
52
|
-
export function
|
|
52
|
+
export function normalizeLivePageScreenshotOptions(options) {
|
|
53
53
|
if (options == null) {
|
|
54
54
|
return { fullPage: false };
|
|
55
55
|
}
|
|
56
56
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
57
|
-
throw new Error('hc.
|
|
57
|
+
throw new Error('hc.livePage().screenshot options must be an object');
|
|
58
58
|
}
|
|
59
59
|
const raw = /** @type {Record<string, unknown>} */ (options);
|
|
60
60
|
if (!('fullPage' in raw) || raw.fullPage === undefined) {
|
|
61
61
|
return { fullPage: false };
|
|
62
62
|
}
|
|
63
63
|
if (typeof raw.fullPage !== 'boolean') {
|
|
64
|
-
throw new Error('hc.
|
|
64
|
+
throw new Error('hc.livePage().screenshot options.fullPage must be a boolean');
|
|
65
65
|
}
|
|
66
66
|
return { fullPage: raw.fullPage };
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
* Builds a
|
|
70
|
+
* Builds a live-page handle whose methods call the host live page bridge.
|
|
71
71
|
*
|
|
72
72
|
* @param {{
|
|
73
73
|
* tabId: string;
|
|
@@ -76,14 +76,15 @@ export function normalizeWebpageScreenshotOptions(options) {
|
|
|
76
76
|
* canGoBack?: boolean;
|
|
77
77
|
* canGoForward?: boolean;
|
|
78
78
|
* }} tab - Opened tab metadata from the bridge.
|
|
79
|
-
* @param {(req: Record<string, unknown>) => Promise<unknown>}
|
|
79
|
+
* @param {(req: Record<string, unknown>) => Promise<unknown>} callLivePage - Bridge transport.
|
|
80
80
|
* @param {(path: string, pngBase64: string) => Promise<string>} [writeScreenshotBytes] - Optional
|
|
81
81
|
* writer that saves PNG base64 under an allowlisted path and returns the absolute path.
|
|
82
|
-
* @returns {import('../types').
|
|
82
|
+
* @returns {import('../types').PluginLivePageHandle} Plain-object handle for the plugin world.
|
|
83
83
|
*/
|
|
84
|
-
export function
|
|
84
|
+
export function createLivePageHandle(tab, callLivePage, writeScreenshotBytes) {
|
|
85
85
|
const tabId = tab.tabId;
|
|
86
|
-
|
|
86
|
+
/** @type {import('../types').PluginLivePageHandle} */
|
|
87
|
+
const handle = {
|
|
87
88
|
tabId,
|
|
88
89
|
url: tab.url,
|
|
89
90
|
title: tab.title,
|
|
@@ -95,7 +96,7 @@ export function createWebpageHandle(tab, callWebpage, writeScreenshotBytes) {
|
|
|
95
96
|
* @returns {Promise<void>} Resolves when the tab is focused.
|
|
96
97
|
*/
|
|
97
98
|
focus: async () => {
|
|
98
|
-
|
|
99
|
+
unwrapLivePageBridgeResult(await callLivePage({ op: 'focus', tabId }));
|
|
99
100
|
},
|
|
100
101
|
/**
|
|
101
102
|
* Closes this browser tab, honoring page leave prompts.
|
|
@@ -104,10 +105,59 @@ export function createWebpageHandle(tab, callWebpage, writeScreenshotBytes) {
|
|
|
104
105
|
*/
|
|
105
106
|
close: async () => {
|
|
106
107
|
const result = /** @type {{ closed: boolean }} */ (
|
|
107
|
-
|
|
108
|
+
unwrapLivePageBridgeResult(await callLivePage({ op: 'close', tabId }))
|
|
108
109
|
);
|
|
109
110
|
return result.closed === true;
|
|
110
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* Navigates history back one entry and waits for load.
|
|
114
|
+
*
|
|
115
|
+
* @returns {Promise<void>} Resolves when load finishes.
|
|
116
|
+
*/
|
|
117
|
+
goBack: async () => {
|
|
118
|
+
applyLivePageNavSnapshot(
|
|
119
|
+
handle,
|
|
120
|
+
unwrapLivePageBridgeResult(await callLivePage({ op: 'goBack', tabId }))
|
|
121
|
+
);
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* Navigates history forward one entry and waits for load.
|
|
125
|
+
*
|
|
126
|
+
* @returns {Promise<void>} Resolves when load finishes.
|
|
127
|
+
*/
|
|
128
|
+
goForward: async () => {
|
|
129
|
+
applyLivePageNavSnapshot(
|
|
130
|
+
handle,
|
|
131
|
+
unwrapLivePageBridgeResult(await callLivePage({ op: 'goForward', tabId }))
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Reloads the current page and waits for load.
|
|
136
|
+
*
|
|
137
|
+
* @returns {Promise<void>} Resolves when load finishes.
|
|
138
|
+
*/
|
|
139
|
+
reload: async () => {
|
|
140
|
+
applyLivePageNavSnapshot(
|
|
141
|
+
handle,
|
|
142
|
+
unwrapLivePageBridgeResult(await callLivePage({ op: 'reload', tabId }))
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Loads a URL in this tab and waits for load.
|
|
147
|
+
*
|
|
148
|
+
* @param {unknown} url - Absolute http(s) or about:blank URL.
|
|
149
|
+
* @returns {Promise<void>} Resolves when load finishes.
|
|
150
|
+
*/
|
|
151
|
+
navigate: async (url) => {
|
|
152
|
+
const urlText = String(url ?? '').trim();
|
|
153
|
+
if (!urlText) {
|
|
154
|
+
throw new Error('hc.livePage().navigate requires a non-empty url');
|
|
155
|
+
}
|
|
156
|
+
applyLivePageNavSnapshot(
|
|
157
|
+
handle,
|
|
158
|
+
unwrapLivePageBridgeResult(await callLivePage({ op: 'navigate', tabId, url: urlText }))
|
|
159
|
+
);
|
|
160
|
+
},
|
|
111
161
|
/**
|
|
112
162
|
* Captures the visible viewport (or full page) as PNG and writes it via the filesystem bridge.
|
|
113
163
|
*
|
|
@@ -116,19 +166,19 @@ export function createWebpageHandle(tab, callWebpage, writeScreenshotBytes) {
|
|
|
116
166
|
* @returns {Promise<{ path: string }>} Absolute path of the written file.
|
|
117
167
|
*/
|
|
118
168
|
screenshot: async (path, screenshotOptions) => {
|
|
119
|
-
const { fullPage } =
|
|
169
|
+
const { fullPage } = normalizeLivePageScreenshotOptions(screenshotOptions);
|
|
120
170
|
const pathText = String(path ?? '').trim();
|
|
121
171
|
if (!pathText) {
|
|
122
|
-
throw new Error('hc.
|
|
172
|
+
throw new Error('hc.livePage().screenshot requires a path');
|
|
123
173
|
}
|
|
124
174
|
if (!writeScreenshotBytes) {
|
|
125
|
-
throw new Error('hc.
|
|
175
|
+
throw new Error('hc.livePage().screenshot requires hc.fs.writeBytes');
|
|
126
176
|
}
|
|
127
177
|
const capture = /** @type {{ pngBase64?: string }} */ (
|
|
128
|
-
|
|
178
|
+
unwrapLivePageBridgeResult(await callLivePage({ op: 'screenshot', tabId, fullPage }))
|
|
129
179
|
);
|
|
130
180
|
if (!capture || typeof capture.pngBase64 !== 'string' || !capture.pngBase64) {
|
|
131
|
-
throw new Error('hc.
|
|
181
|
+
throw new Error('hc.livePage().screenshot did not return image data');
|
|
132
182
|
}
|
|
133
183
|
const absolutePath = await writeScreenshotBytes(pathText, capture.pngBase64);
|
|
134
184
|
return { path: absolutePath };
|
|
@@ -144,31 +194,33 @@ export function createWebpageHandle(tab, callWebpage, writeScreenshotBytes) {
|
|
|
144
194
|
query: async (selector, queryOptions) => {
|
|
145
195
|
const selectorText = String(selector ?? '').trim();
|
|
146
196
|
if (!selectorText) {
|
|
147
|
-
throw new Error('hc.
|
|
197
|
+
throw new Error('hc.livePage().dom.query requires a selector');
|
|
148
198
|
}
|
|
149
199
|
let all;
|
|
150
200
|
let maxElements;
|
|
151
201
|
if (queryOptions != null) {
|
|
152
202
|
if (typeof queryOptions !== 'object' || Array.isArray(queryOptions)) {
|
|
153
|
-
throw new Error('hc.
|
|
203
|
+
throw new Error('hc.livePage().dom.query options must be an object');
|
|
154
204
|
}
|
|
155
205
|
const raw = /** @type {Record<string, unknown>} */ (queryOptions);
|
|
156
206
|
if ('all' in raw && raw.all !== undefined) {
|
|
157
207
|
if (typeof raw.all !== 'boolean') {
|
|
158
|
-
throw new Error('hc.
|
|
208
|
+
throw new Error('hc.livePage().dom.query options.all must be a boolean');
|
|
159
209
|
}
|
|
160
210
|
all = raw.all;
|
|
161
211
|
}
|
|
162
212
|
if ('maxElements' in raw && raw.maxElements !== undefined) {
|
|
163
213
|
if (typeof raw.maxElements !== 'number' || !Number.isFinite(raw.maxElements)) {
|
|
164
|
-
throw new Error(
|
|
214
|
+
throw new Error(
|
|
215
|
+
'hc.livePage().dom.query options.maxElements must be a finite number'
|
|
216
|
+
);
|
|
165
217
|
}
|
|
166
218
|
maxElements = raw.maxElements;
|
|
167
219
|
}
|
|
168
220
|
}
|
|
169
221
|
return /** @type {{ selector: string; matchCount: number; elements: unknown[] }} */ (
|
|
170
|
-
|
|
171
|
-
await
|
|
222
|
+
unwrapLivePageBridgeResult(
|
|
223
|
+
await callLivePage({ op: 'query', tabId, selector: selectorText, all, maxElements })
|
|
172
224
|
)
|
|
173
225
|
);
|
|
174
226
|
},
|
|
@@ -181,11 +233,11 @@ export function createWebpageHandle(tab, callWebpage, writeScreenshotBytes) {
|
|
|
181
233
|
evaluate: async (expression) => {
|
|
182
234
|
const expressionText = String(expression ?? '').trim();
|
|
183
235
|
if (!expressionText) {
|
|
184
|
-
throw new Error('hc.
|
|
236
|
+
throw new Error('hc.livePage().dom.evaluate requires an expression');
|
|
185
237
|
}
|
|
186
238
|
const result = /** @type {{ value: unknown }} */ (
|
|
187
|
-
|
|
188
|
-
await
|
|
239
|
+
unwrapLivePageBridgeResult(
|
|
240
|
+
await callLivePage({ op: 'evaluate', tabId, expression: expressionText })
|
|
189
241
|
)
|
|
190
242
|
);
|
|
191
243
|
return result.value;
|
|
@@ -199,11 +251,11 @@ export function createWebpageHandle(tab, callWebpage, writeScreenshotBytes) {
|
|
|
199
251
|
injectScript: async (source) => {
|
|
200
252
|
const sourceText = String(source ?? '');
|
|
201
253
|
if (!sourceText.trim()) {
|
|
202
|
-
throw new Error('hc.
|
|
254
|
+
throw new Error('hc.livePage().dom.injectScript requires source');
|
|
203
255
|
}
|
|
204
256
|
const result = /** @type {{ value: unknown }} */ (
|
|
205
|
-
|
|
206
|
-
await
|
|
257
|
+
unwrapLivePageBridgeResult(
|
|
258
|
+
await callLivePage({ op: 'injectScript', tabId, source: sourceText })
|
|
207
259
|
)
|
|
208
260
|
);
|
|
209
261
|
return result.value;
|
|
@@ -217,37 +269,63 @@ export function createWebpageHandle(tab, callWebpage, writeScreenshotBytes) {
|
|
|
217
269
|
injectStylesheet: async (css) => {
|
|
218
270
|
const cssText = String(css ?? '');
|
|
219
271
|
if (!cssText.trim()) {
|
|
220
|
-
throw new Error('hc.
|
|
272
|
+
throw new Error('hc.livePage().dom.injectStylesheet requires css');
|
|
221
273
|
}
|
|
222
274
|
const result = /** @type {{ key: string }} */ (
|
|
223
|
-
|
|
224
|
-
await
|
|
275
|
+
unwrapLivePageBridgeResult(
|
|
276
|
+
await callLivePage({ op: 'injectStylesheet', tabId, css: cssText })
|
|
225
277
|
)
|
|
226
278
|
);
|
|
227
279
|
return result.key;
|
|
228
280
|
}
|
|
229
281
|
}
|
|
230
282
|
};
|
|
283
|
+
return handle;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Copies navigation fields from a bridge result onto a live-page handle.
|
|
288
|
+
*
|
|
289
|
+
* @param {import('../types').PluginLivePageHandle} handle - Mutable handle to update.
|
|
290
|
+
* @param {unknown} result - Bridge result with url/title/history flags.
|
|
291
|
+
*/
|
|
292
|
+
function applyLivePageNavSnapshot(handle, result) {
|
|
293
|
+
if (result == null || typeof result !== 'object' || Array.isArray(result)) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const snapshot = /** @type {Record<string, unknown>} */ (result);
|
|
297
|
+
if (typeof snapshot.url === 'string') {
|
|
298
|
+
handle.url = snapshot.url;
|
|
299
|
+
}
|
|
300
|
+
if (typeof snapshot.title === 'string') {
|
|
301
|
+
handle.title = snapshot.title;
|
|
302
|
+
}
|
|
303
|
+
if (typeof snapshot.canGoBack === 'boolean') {
|
|
304
|
+
handle.canGoBack = snapshot.canGoBack;
|
|
305
|
+
}
|
|
306
|
+
if (typeof snapshot.canGoForward === 'boolean') {
|
|
307
|
+
handle.canGoForward = snapshot.canGoForward;
|
|
308
|
+
}
|
|
231
309
|
}
|
|
232
310
|
|
|
233
311
|
/**
|
|
234
312
|
* Opens or reuses an embedded browser tab and returns a control handle.
|
|
235
313
|
*
|
|
236
|
-
* @param {(req: Record<string, unknown>) => Promise<unknown>}
|
|
237
|
-
* that accepts
|
|
314
|
+
* @param {(req: Record<string, unknown>) => Promise<unknown>} callLivePage - Bridge transport
|
|
315
|
+
* that accepts ScriptLivePageRequest-shaped payloads (`op` plus fields).
|
|
238
316
|
* @param {unknown} [url] - Optional URL; omit to bind the active browser tab.
|
|
239
317
|
* @param {unknown} [openOptions] - Optional `{ reuse }` (default true).
|
|
240
318
|
* @param {(path: string, pngBase64: string) => Promise<string>} [writeScreenshotBytes] - Optional
|
|
241
319
|
* writer used by `page.screenshot`.
|
|
242
|
-
* @returns {Promise<import('../types').
|
|
320
|
+
* @returns {Promise<import('../types').PluginLivePageHandle>} Live-page handle.
|
|
243
321
|
*/
|
|
244
|
-
export async function
|
|
245
|
-
const normalizedOptions =
|
|
322
|
+
export async function openLivePage(callLivePage, url, openOptions, writeScreenshotBytes) {
|
|
323
|
+
const normalizedOptions = normalizeLivePageOpenOptions(openOptions);
|
|
246
324
|
let openUrl;
|
|
247
325
|
if (url !== undefined && url !== null) {
|
|
248
326
|
const trimmed = String(url).trim();
|
|
249
327
|
if (!trimmed) {
|
|
250
|
-
throw new Error('hc.
|
|
328
|
+
throw new Error('hc.livePage requires a non-empty url when provided');
|
|
251
329
|
}
|
|
252
330
|
openUrl = trimmed;
|
|
253
331
|
}
|
|
@@ -258,8 +336,8 @@ export async function openWebpage(callWebpage, url, openOptions, writeScreenshot
|
|
|
258
336
|
canGoBack?: boolean;
|
|
259
337
|
canGoForward?: boolean;
|
|
260
338
|
}} */ (
|
|
261
|
-
|
|
262
|
-
await
|
|
339
|
+
unwrapLivePageBridgeResult(
|
|
340
|
+
await callLivePage({
|
|
263
341
|
op: 'open',
|
|
264
342
|
url: openUrl,
|
|
265
343
|
reuse: normalizedOptions.reuse
|
|
@@ -267,7 +345,7 @@ export async function openWebpage(callWebpage, url, openOptions, writeScreenshot
|
|
|
267
345
|
)
|
|
268
346
|
);
|
|
269
347
|
if (!opened || typeof opened.tabId !== 'string') {
|
|
270
|
-
throw new Error('hc.
|
|
348
|
+
throw new Error('hc.livePage open did not return a tab');
|
|
271
349
|
}
|
|
272
|
-
return
|
|
350
|
+
return createLivePageHandle(opened, callLivePage, writeScreenshotBytes);
|
|
273
351
|
}
|
package/dist/snippets.d.ts
CHANGED
|
@@ -271,9 +271,9 @@ interface HcSendRequestResponse {
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
|
-
* Live DOM helpers on a
|
|
274
|
+
* Live DOM helpers on a live-page handle from hc.livePage.
|
|
275
275
|
*/
|
|
276
|
-
interface
|
|
276
|
+
interface HcLivePageDom {
|
|
277
277
|
/**
|
|
278
278
|
* Queries the live page DOM with a CSS selector.
|
|
279
279
|
*/
|
|
@@ -299,15 +299,19 @@ interface HcWebpageDom {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
|
-
* Handle returned by hc.
|
|
302
|
+
* Handle returned by hc.livePage for an embedded browser tab.
|
|
303
303
|
*/
|
|
304
|
-
interface
|
|
304
|
+
interface HcLivePageHandle {
|
|
305
305
|
readonly tabId: string;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
/** Current page URL. Updated after navigate / goBack / goForward / reload. */
|
|
307
|
+
url: string;
|
|
308
|
+
/** Document title. Updated after navigate / goBack / goForward / reload. */
|
|
309
|
+
title: string;
|
|
310
|
+
/** Whether history can go back. Updated after navigation helpers. */
|
|
311
|
+
canGoBack: boolean;
|
|
312
|
+
/** Whether history can go forward. Updated after navigation helpers. */
|
|
313
|
+
canGoForward: boolean;
|
|
314
|
+
readonly dom: HcLivePageDom;
|
|
311
315
|
/**
|
|
312
316
|
* Focuses this browser tab in the tab bar.
|
|
313
317
|
*/
|
|
@@ -316,6 +320,24 @@ interface HcWebpageHandle {
|
|
|
316
320
|
* Closes this browser tab. Returns false when the user cancels a leave prompt.
|
|
317
321
|
*/
|
|
318
322
|
close(): Promise<boolean>;
|
|
323
|
+
/**
|
|
324
|
+
* Navigates history back one entry and waits for load. Updates url/title/history flags.
|
|
325
|
+
*/
|
|
326
|
+
goBack(): Promise<void>;
|
|
327
|
+
/**
|
|
328
|
+
* Navigates history forward one entry and waits for load. Updates url/title/history flags.
|
|
329
|
+
*/
|
|
330
|
+
goForward(): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Reloads the current page and waits for load. Updates url/title/history flags.
|
|
333
|
+
*/
|
|
334
|
+
reload(): Promise<void>;
|
|
335
|
+
/**
|
|
336
|
+
* Loads a URL in this tab and waits for load. Updates url/title/history flags.
|
|
337
|
+
*
|
|
338
|
+
* @param url - Absolute http(s) or about:blank URL.
|
|
339
|
+
*/
|
|
340
|
+
navigate(url: string): Promise<void>;
|
|
319
341
|
/**
|
|
320
342
|
* Captures the visible viewport as PNG and writes it under the script file access root.
|
|
321
343
|
*
|
|
@@ -465,13 +487,13 @@ interface HcScriptApi {
|
|
|
465
487
|
ask(prompt: string, options?: HcAskOptions): Promise<string | null>;
|
|
466
488
|
/**
|
|
467
489
|
* Opens or reuses an embedded browser tab and returns a control handle.
|
|
468
|
-
* Requires Settings → General → Allow script
|
|
490
|
+
* Requires Settings → General → Allow script live page access.
|
|
469
491
|
*
|
|
470
492
|
* @param url - Optional URL to open or reuse; omit to bind the active browser tab.
|
|
471
493
|
* @param options - Optional `{ reuse }` (default true).
|
|
472
|
-
* @throws When
|
|
494
|
+
* @throws When live-page access is disabled or unavailable in this context.
|
|
473
495
|
*/
|
|
474
|
-
|
|
496
|
+
livePage(url?: string, options?: { reuse?: boolean }): Promise<HcLivePageHandle>;
|
|
475
497
|
/**
|
|
476
498
|
* Resolves after the given delay. Use for pacing between script steps.
|
|
477
499
|
*
|