@intuned/browser-dev 2.2.3-unify-sdks.21 → 2.2.3-unify-sdks.22

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.
@@ -3,11 +3,14 @@
3
3
  import type { Locator, Page, ElementHandle } from "playwright-core";
4
4
  import type { ReadStream } from "fs";
5
5
  import { Download } from "playwright-core";
6
+ import { SUPPORTED_MODELS } from "../ai/export";
6
7
 
7
8
  /**
8
9
  * Configuration options for sanitizing HTML content.
9
10
  */
10
11
  export interface SanitizeHtmlOptions {
12
+ /** The HTML content to sanitize */
13
+ html: string;
11
14
  /** Remove all <script> elements. Defaults to true. */
12
15
  removeScripts?: boolean;
13
16
  /** Remove all <style> elements. Defaults to true. */
@@ -34,13 +37,23 @@ export interface SanitizeHtmlOptions {
34
37
  * Sanitizes and cleans HTML content by removing unwanted elements, attributes, and whitespace.
35
38
  * Provides fine-grained control over each cleaning operation through configurable options.
36
39
  *
37
- * @param {string} htmlString - The HTML content to sanitize
38
40
  * @param {SanitizeHtmlOptions} options - Configuration options for sanitization
41
+ * @param {string} options.html - The HTML content to sanitize
42
+ * @param {boolean} [options.removeScripts=true] - Remove all <script> elements. Defaults to true.
43
+ * @param {boolean} [options.removeStyles=true] - Remove all <style> elements. Defaults to true.
44
+ * @param {boolean} [options.removeSvgs=true] - Remove all <svg> elements. Defaults to true.
45
+ * @param {boolean} [options.removeComments=true] - Remove HTML comments. Defaults to true.
46
+ * @param {boolean} [options.removeLongAttributes=true] - Remove attributes longer than maxAttributeLength. Defaults to true.
47
+ * @param {number} [options.maxAttributeLength=500] - Maximum length for attributes before removal. Defaults to 500.
48
+ * @param {string[]} [options.preserveAttributes=["class", "src"]] - List of attribute names to always preserve. Defaults to ["class", "src"].
49
+ * @param {boolean} [options.removeEmptyTags=true] - Remove empty tags (except preserved ones). Defaults to true.
50
+ * @param {string[]} [options.preserveEmptyTags=["img"]] - List of tag names to preserve even when empty. Defaults to ["img"].
51
+ * @param {boolean} [options.minifyWhitespace=true] - Remove extra whitespace between tags and empty lines. Defaults to true.
39
52
  * @returns {string} The sanitized HTML string
40
53
  *
41
54
  * @example
42
55
  * ```typescript Basic HTML Sanitization
43
- * import { sanitizeHtml } from "@intuned/sdk/helpers";
56
+ * import { sanitizeHtml } from "@intuned/browser";
44
57
  *
45
58
  * const dirtyHtml = `
46
59
  * <div>
@@ -50,13 +63,13 @@ export interface SanitizeHtmlOptions {
50
63
  * </div>
51
64
  * `;
52
65
  *
53
- * const sanitizedHtml = sanitizeHtml(dirtyHtml);
66
+ * const sanitizedHtml = sanitizeHtml({ html: dirtyHtml });
54
67
  * // Returns: '<div><p>Hello World</p></div>'
55
68
  * ```
56
69
  *
57
70
  * @example
58
71
  * ```typescript Custom Sanitization Options
59
- * import { sanitizeHtml } from "@intuned/sdk/helpers";
72
+ * import { sanitizeHtml } from "@intuned/browser";
60
73
  *
61
74
  * const html = `
62
75
  * <div data-long-attr="${'x'.repeat(600)}">
@@ -68,7 +81,7 @@ export interface SanitizeHtmlOptions {
68
81
  * `;
69
82
  *
70
83
  * // Keep styles but remove scripts and comments
71
- * const result = sanitizeHtml(html, {
84
+ * const result = sanitizeHtml({ html,
72
85
  * removeScripts: true,
73
86
  * removeStyles: false,
74
87
  * removeComments: true,
@@ -79,7 +92,7 @@ export interface SanitizeHtmlOptions {
79
92
  *
80
93
  * @example
81
94
  * ```typescript Preserve Specific Elements
82
- * import { sanitizeHtml } from "@intuned/sdk/helpers";
95
+ * import { sanitizeHtml } from "@intuned/browser";
83
96
  *
84
97
  * const html = `
85
98
  * <div>
@@ -90,17 +103,15 @@ export interface SanitizeHtmlOptions {
90
103
  * `;
91
104
  *
92
105
  * // Keep SVGs and empty spans
93
- * const result = sanitizeHtml(html, {
106
+ * const result = sanitizeHtml({
107
+ * html,
94
108
  * removeSvgs: false,
95
109
  * preserveEmptyTags: ["img", "span"]
96
110
  * });
97
111
  * ```
98
112
  */
99
113
 
100
- export declare function sanitizeHtml(
101
- htmlString: string,
102
- options?: SanitizeHtmlOptions
103
- ): string;
114
+ export declare function sanitizeHtml(options: SanitizeHtmlOptions): string;
104
115
 
105
116
  /**
106
117
  * Download a file from a web page using a trigger
@@ -108,47 +119,48 @@ export declare function sanitizeHtml(
108
119
  * 1. By URL
109
120
  * 2. By clicking on a playwright locator
110
121
  * 3. By executing a callback function that takes a page object as an argument and uses it to initiate the download.
111
- * @param {Page} page - The Playwright Page object.
112
- * @param {Trigger} trigger - [Trigger](../type-aliases/Trigger) to use for downloading the file.
113
- * @param {number} [options.timeoutInMs=5000] - Optional. The maximum time in milliseconds to wait for the download to complete. Default = 5000
122
+ * @param {Object} input - Configuration options
123
+ * @param {Page} input.page - The Playwright Page object.
124
+ * @param {Trigger} input.trigger - [Trigger](../type-aliases/Trigger) to use for downloading the file.
125
+ * @param {number} [input.timeoutInMs=5000] - Optional. The maximum time in milliseconds to wait for the download to complete. Default = 5000
114
126
  * @returns {Promise<Download >} A promise that resolves to a playwright Download object.
115
127
  *
116
128
  * @example
117
129
  * ```typescript URL Download
118
- * import { downloadFile } from "@intuned/sdk/helpers";
130
+ * import { downloadFile } from "@intuned/browser";
119
131
  *
120
- * const download = await downloadFile(page, "https://sandbox.intuned.dev/pdfs");
132
+ * const download = await downloadFile({ page, trigger: "https://sandbox.intuned.dev/pdfs" });
121
133
  * console.log(await download.path());
122
134
  * ```
123
135
  *
124
136
  * @example
125
137
  * ```typescript Locator Download - Link
126
- * import { downloadFile } from "@intuned/sdk/helpers";
138
+ * import { downloadFile } from "@intuned/browser";
127
139
  *
128
- * const download = await downloadFile(page, page.locator("[href='/download/file.pdf']"));
140
+ * const download = await downloadFile({ page, trigger: page.locator("[href='/download/file.pdf']") });
129
141
  * console.log(await download.path());
130
142
  * ```
131
143
  *
132
144
  * @example
133
145
  * ```typescript Locator Download - Button
134
- * import { downloadFile } from "@intuned/sdk/helpers";
146
+ * import { downloadFile } from "@intuned/browser";
135
147
  *
136
- * const download = await downloadFile(page, page.locator("button:has-text('Download')"));
148
+ * const download = await downloadFile({ page, trigger: page.locator("button:has-text('Download')") });
137
149
  * console.log(await download.path());
138
150
  * ```
139
151
  *
140
152
  * @example
141
153
  * ```typescript Callback Function Download
142
- * import { downloadFile } from "@intuned/sdk/helpers";
154
+ * import { downloadFile } from "@intuned/browser";
143
155
  *
144
- * const download = await downloadFile(page, (page) => page.locator("button:has-text('Download')").click());
156
+ * const download = await downloadFile({ page, trigger: (page) => page.locator("button:has-text('Download')").click() });
145
157
  * console.log(await download.path());
146
158
  * ```
147
159
  * - If a URL is provided as the trigger, a new page will be created and closed after the download is complete.
148
160
  * - If a locator is provided as the trigger, the page will be used to click the element and initiate the download.
149
161
  * - If a callback function is provided as the trigger, the function will be called with the page object as an argument and will be responsible for initiating the download.
150
162
  */
151
- export declare function downloadFile(options: {
163
+ export declare function downloadFile(input: {
152
164
  page: Page;
153
165
  trigger: Trigger;
154
166
  timeoutInMs?: number;
@@ -164,45 +176,47 @@ export declare function downloadFile(options: {
164
176
  * - Empty objects
165
177
  * - Arrays/objects that become empty after filtering their contents
166
178
  *
167
- * @param {T} data - The data structure to filter (object, array, or any other type)
179
+ * @param {Object} input - Configuration options
180
+ * @param {T} input.data - The data structure to filter (object, array, or any other type)
168
181
  * @returns {T} Filtered data structure with empty values removed
169
182
  *
170
183
  * @example
171
184
  * ```typescript Basic usage
172
- * filterEmptyValues({ a: "", b: "hello", c: null }) // Returns { b: "hello" }
173
- * filterEmptyValues([1, "", null, [2, ""]]) // Returns [1, [2]]
174
- * filterEmptyValues({ users: [{ name: "" }, { name: "John" }] }) // Returns { users: [{ name: "John" }] }
185
+ * filterEmptyValues({ data: { a: "", b: "hello", c: null } }) // Returns { b: "hello" }
186
+ * filterEmptyValues({ data: [1, "", null, [2, ""]] }) // Returns [1, [2]]
187
+ * filterEmptyValues({ data: { users: [{ name: "" }, { name: "John" }] } }) // Returns { users: [{ name: "John" }] }
175
188
  * ```
176
189
  */
177
190
  export declare function filterEmptyValues<T>(input: { data: T }): T;
178
191
 
179
192
  /**
180
193
  * Navigates to a specified URL on the provided playwright page.
181
- *
182
- * @param {Page} page - The Playwright page object to navigate.
183
- * @param {string} url - The URL to navigate to.
184
- * @param {number} [options.retries] - Referer header value. If provided, it will take preference over the referer header value set by `page.setExtraHTTPHeaders(headers)`.
185
- * @param {number} [options.timeoutInMs=30000] - Maximum operation time in milliseconds. This can be configured via various timeout settings on the page or browser context. default 30000.
194
+ *
195
+ * @param {Page} input.page - The Playwright page object to navigate.
196
+ * @param {string} input.url - The URL to navigate to.
197
+ * @param {number} [input.retries] - Referer header value. If provided, it will take preference over the referer header value set by `page.setExtraHTTPHeaders(headers)`.
198
+ * @param {number} [input.timeoutInMs=30000] - Maximum operation time in milliseconds. This can be configured via various timeout settings on the page or browser context. default 30000.
186
199
 
187
- * @param {string} [options.waitUntil=networkidle] - When to consider the operation succeeded. Default = networkidle
188
- * @param {boolean} [options.throwOnTimeout=False] - Whether to throw if the `page.goto` times out. By default, it ignores the error. default = false.
189
- * @param {boolean} [options.waitForLoadingStateUsingAi=False] - If true, it will perform an AI Check to determine if the page is fully loaded and idle. default = false.
190
- * @param {ModelType} [options.model] - [ModelType](../type-aliases/modelType) to use for the AI Check. default claude-3-haiku-20240307
191
- * @param {string} [options.apiKey] - The API key for the AI service. If not provided, it will use the default API key.
200
+ * @param {string} [input.waitUntil=networkidle] - When to consider the operation succeeded. Default = networkidle
201
+ * @param {boolean} [input.throwOnTimeout=False] - Whether to throw if the `page.goto` times out. By default, it ignores the error. default = false.
202
+ * @param {boolean} [input.waitForLoadingStateUsingAi=False] - If true, it will perform an AI Check to determine if the page is fully loaded and idle. default = false.
203
+ * @param {SUPPORTED_MODELS} [input.model] - [SUPPORTED_MODELS](../type-aliases/SUPPORTED_MODELS) to use for the AI Check. default claude-3-haiku-20240307
204
+ * @param {string} [input.apiKey] - The API key for the AI service. If not provided, it will use the default API key.
192
205
  * @returns {void} - Returns nothing. If the operation fails, it will throw an error unless `throwOnTimeout` is set to false.
193
206
  *
194
207
  * @example
195
208
  * ```typescript without options
196
- * import { goto } from "@intuned/sdk/helpers";
209
+ * import { goto } from "@intuned/browser";
197
210
  *
198
- * await goto(page, 'https://example.com');
211
+ * await goto({ page, url: 'https://example.com' });
199
212
  *
200
213
  * ```
201
214
  *
202
215
  * ```typescript with options
203
- * import { goto } from "@intuned/sdk/helpers";
216
+ * import { goto } from "@intuned/browser";
204
217
  *
205
- * await goto(page, 'https://example.com', {
218
+ * await goto({ page,
219
+ * url: 'https://example.com',
206
220
  * waitUntil: "load",
207
221
  * throwOnTimeout: true,
208
222
  * timeoutInMs: 10_000,
@@ -221,7 +235,7 @@ export declare function goToUrl(input: {
221
235
  throwOnTimeout?: boolean;
222
236
  waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
223
237
  waitForLoadingStateUsingAi?: boolean;
224
- model?: ModelType;
238
+ model?: SUPPORTED_MODELS;
225
239
  apiKey?: string;
226
240
  }): Promise<void>;
227
241
 
@@ -229,18 +243,18 @@ export declare function goToUrl(input: {
229
243
  * Automatically scrolls through infinite scroll content by repeatedly scrolling to the bottom
230
244
  * until no new content loads or maximum scroll limit is reached.
231
245
  *
232
- * @param {Object} [options] - Configuration options
233
- * @param {Page | Locator} [ptions.page] - The Playwright page object
234
- * @param {Function} [options.onScrollProgress] - Optional callback function to call during each scroll iteration
235
- * @param {Locator} [options.scrollableContainer] - Specific element to scroll.
236
- * @param {number} [options.maxScrolls=50] - Maximum number of scroll attempts before stopping, default = 50
237
- * @param {number} [options.delay=100] - Delay in milliseconds between scroll attempts, default = 100
238
- * @param {number} [options.minHeightChange=100] - Minimum height change required to continue scrolling, default = 100
246
+ * @param {Object} [input] - Configuration options
247
+ * @param {Page | Locator} input.source - The Playwright page object
248
+ * @param {Function} [input.onScrollProgress] - Optional callback function to call during each scroll iteration
249
+ * @param {Locator} [input.scrollableContainer] - Specific element to scroll.
250
+ * @param {number} [input.maxScrolls=50] - Maximum number of scroll attempts before stopping, default = 50
251
+ * @param {number} [input.delay=100] - Delay in milliseconds between scroll attempts, default = 100
252
+ * @param {number} [input.minHeightChange=100] - Minimum height change required to continue scrolling, default = 100
239
253
  * @returns {Promise<void>} Promise that resolves when scrolling is complete
240
254
  *
241
255
  * @example
242
256
  * ```typescript Basic Infinite Scroll
243
- * import { scrollToLoadContent } from "@intuned/sdk/helpers";
257
+ * import { scrollToLoadContent } from "@intuned/browser";
244
258
  *
245
259
  * // Scroll through entire page content
246
260
  * await scrollToLoadContent(page);
@@ -251,7 +265,7 @@ export declare function goToUrl(input: {
251
265
  *
252
266
  * @example
253
267
  * ```typescript Scroll Specific Container
254
- * import { scrollToLoadContent } from "@intuned/sdk/helpers";
268
+ * import { scrollToLoadContent } from "@intuned/browser";
255
269
  *
256
270
  * // Scroll through a specific scrollable div
257
271
  * const container = page.locator('.scrollable-feed');
@@ -263,7 +277,7 @@ export declare function goToUrl(input: {
263
277
  *
264
278
  * @example
265
279
  * ```typescript With Progress Tracking
266
- * import { scrollToLoadContent } from "@intuned/sdk/helpers";
280
+ * import { scrollToLoadContent } from "@intuned/browser";
267
281
  *
268
282
  * let scrollCount = 0;
269
283
  * await scrollToLoadContent(
@@ -277,8 +291,8 @@ export declare function goToUrl(input: {
277
291
  * ```
278
292
  */
279
293
 
280
- export declare function scrollToLoadContent(options: {
281
- page: Page | Locator;
294
+ export declare function scrollToLoadContent(input: {
295
+ source: Page | Locator;
282
296
  onScrollProgress?: CallableFunction;
283
297
  scrollableContainer?: Locator | null;
284
298
  maxScrolls?: number;
@@ -300,12 +314,12 @@ export declare function scrollToLoadContent(options: {
300
314
  * - Full month name formats (e.g., "November 14, 2024", "January 31, 2025, 5:00 pm")
301
315
  * - 24-hour time format (e.g., "22/11/2024 19:45:00", "09/01/2025 15:00:00")
302
316
  *
303
- * @param {string} dateString - A string containing a date in various possible formats
317
+ * @param {string} input.date - A string containing a date in various possible formats
304
318
  * @returns Date object with only date components if parsing successful, null if parsing fails
305
319
  *
306
320
  * @example
307
321
  * ```typescript Basic Date Processing
308
- * import { processDate } from "@intuned/sdk/helpers";
322
+ * import { processDate } from "@intuned/browser";
309
323
  * processDate("22/11/2024 21:19:05") // Returns Date with 2024-11-22 00:00:00
310
324
  * processDate("5 Dec 2024 8:00 AM PST") // Returns Date with 2024-12-05 00:00:00
311
325
  * ```
@@ -315,18 +329,18 @@ export declare function processDate(input: { date: string }): Date | null;
315
329
  /**
316
330
  * Uploads a downloaded file to S3 storage.
317
331
  * @param {S3UploadableFile} file - The file to upload, it can be a downloaded file by the downloadFile function or another content, the file is of type [S3UploadableFile](../type-aliases/S3UploadableFile.md)
318
- * @param {Object} options - The options for uploading the file.
319
- * @param {S3Configs} [options.s3Configs] - Optional [S3Configs](../interfaces/S3Configs) configuration options.
320
- * @param {string} [options.fileNameOverride] - Optional. Override for the file name.
321
- * @param {string} [options.contentType] - Optional. The MIME type of the file, used to specify the type of content being uploaded to S3.
332
+ * @param {Object} input - The options for uploading the file.
333
+ * @param {S3Configs} [input.s3Configs] - Optional [S3Configs](../interfaces/S3Configs) configuration options.
334
+ * @param {string} [input.fileNameOverride] - Optional. Override for the file name.
335
+ * @param {string} [input.contentType] - Optional. The MIME type of the file, used to specify the type of content being uploaded to S3.
322
336
  * @returns {Promise<Attachment>} A promise that resolves to an [Attachment](../interfaces/Attachment) object containing the uploaded file's details.
323
337
  *
324
338
  *
325
339
  * @example
326
340
  * ```typescript Download
327
- * import { downloadFile, uploadFileToS3 } from "@intuned/sdk/helpers";
341
+ * import { downloadFile, uploadFileToS3 } from "@intuned/browser";
328
342
  *
329
- * const download = await downloadFile(page, {
343
+ * const download = await downloadFile({ page, trigger: (page) => page.locator(".download_button").click() });
330
344
  * type: "DownloadByOpeningNewTab",
331
345
  * downloadTrigger: (page) => page.locator(".download_button").click(),
332
346
  * });
@@ -338,7 +352,7 @@ export declare function processDate(input: { date: string }): Date | null;
338
352
  * secretAccessKey: '....'
339
353
  * };
340
354
  *
341
- * const uploadedFile = await uploadFileToS3(download, { s3Configs });
355
+ * const uploadedFile = await uploadFileToS3({ file: download, s3Configs });
342
356
  * console.log(uploadedFile.urlDescriptor());
343
357
  * ```
344
358
  */
@@ -351,13 +365,13 @@ export declare function uploadFileToS3(input: {
351
365
  /**
352
366
  * Validates data against a JSON schema using AJV validator.
353
367
  * The function automatically cleans the input data before validation by removing empty strings, null values, and undefined properties (recursively for nested objects and arrays), then throws a detailed ValidationError if the cleaned data doesn't match the schema requirements.
354
- * @param {DataInput} data - [DataInput](../interfaces/DataInput) is the data to validate (will be cleaned before validation)
355
- * @param {Record<string, any>} schema - JSON schema object defining validation rules
368
+ * @param {DataInput} input.data - [DataInput](../interfaces/DataInput) is the data to validate (will be cleaned before validation)
369
+ * @param {Record<string, any>} input.schema - JSON schema object defining validation rules
356
370
  * @returns {Promise<void>} Promise that resolves if validation passes, throws ValidationError if it fails
357
371
  *
358
372
  * @example
359
373
  * ```typescript Basic User Data Validation
360
- * import { validateDataUsingSchema } from "@intuned/sdk/helpers";
374
+ * import { validateDataUsingSchema } from "@intuned/browser";
361
375
  *
362
376
  * const userData = {
363
377
  * name: "John Doe",
@@ -375,13 +389,13 @@ export declare function uploadFileToS3(input: {
375
389
  * }
376
390
  * };
377
391
  *
378
- * await validateDataUsingSchema(userData, userSchema);
392
+ * await validateDataUsingSchema({ data: userData, schema: userSchema });
379
393
  * // Validation passes, no error thrown
380
394
  * ```
381
395
  *
382
396
  * @example
383
397
  * ```typescript API Response Validation
384
- * import { validateDataUsingSchema } from "@intuned/sdk/helpers";
398
+ * import { validateDataUsingSchema } from "@intuned/browser";
385
399
  *
386
400
  * const apiResponse = {
387
401
  * success: true,
@@ -421,13 +435,13 @@ export declare function uploadFileToS3(input: {
421
435
  * }
422
436
  * };
423
437
  *
424
- * await validateDataUsingSchema(apiResponse, responseSchema);
438
+ * await validateDataUsingSchema({ data: apiResponse, schema: responseSchema });
425
439
  * // Validates complex nested API response structure
426
440
  * ```
427
441
  *
428
442
  * @example
429
443
  * ```typescript Form Data Validation with Error Handling
430
- * import { validateDataUsingSchema, ValidationError } from "@intuned/sdk/helpers";
444
+ * import { validateDataUsingSchema, ValidationError } from "@intuned/browser";
431
445
  *
432
446
  * const formData = {
433
447
  * username: "", // Invalid: empty string
@@ -447,7 +461,7 @@ export declare function uploadFileToS3(input: {
447
461
  * };
448
462
  *
449
463
  * try {
450
- * await validateDataUsingSchema(formData, formSchema);
464
+ * await validateDataUsingSchema({ data: formData, schema: formSchema });
451
465
  * } catch (error) {
452
466
  * if (error instanceof ValidationError) {
453
467
  * console.error('Validation failed:', error.message);
@@ -459,7 +473,7 @@ export declare function uploadFileToS3(input: {
459
473
  *
460
474
  * @example
461
475
  * ```typescript Configuration Validation
462
- * import { validateDataUsingSchema } from "@intuned/sdk/helpers";
476
+ * import { validateDataUsingSchema } from "@intuned/browser";
463
477
  *
464
478
  * const config = {
465
479
  * database: {
@@ -498,7 +512,7 @@ export declare function uploadFileToS3(input: {
498
512
  * }
499
513
  * };
500
514
  *
501
- * await validateDataUsingSchema(config, configSchema);
515
+ * await validateDataUsingSchema({ data: config, schema: configSchema });
502
516
  * // Ensures configuration meets requirements before app startup
503
517
  * ```
504
518
  *
@@ -521,7 +535,7 @@ export declare function validateDataUsingSchema(input: {
521
535
  *
522
536
  * @example
523
537
  * ```typescript Simple Decorator Usage
524
- * import { waitForNetworkIdle } from "@intuned/sdk/helpers";
538
+ * import { waitForNetworkIdle } from "@intuned/browser";
525
539
  *
526
540
  * // Wrap any async function that takes a Page as first argument
527
541
  * const clickAndWait = waitForNetworkIdle(async (page: Page, selector: string) => {
@@ -535,7 +549,7 @@ export declare function validateDataUsingSchema(input: {
535
549
  *
536
550
  * @example
537
551
  * ```typescript Parameterized Decorator Usage
538
- * import { waitForNetworkIdle } from "@intuned/sdk/helpers";
552
+ * import { waitForNetworkIdle } from "@intuned/browser";
539
553
  *
540
554
  * // Create a decorator with custom timeout and max inflight requests
541
555
  * const scrollByAmount = waitForNetworkIdle({
@@ -551,7 +565,7 @@ export declare function validateDataUsingSchema(input: {
551
565
  *
552
566
  * @example
553
567
  * ```typescript Direct Async Call Usage
554
- * import { waitForNetworkIdle } from "@intuned/sdk/helpers";
568
+ * import { waitForNetworkIdle } from "@intuned/browser";
555
569
  *
556
570
  * // Direct execution with all parameters provided
557
571
  * const result = await waitForNetworkIdle({
@@ -570,7 +584,7 @@ export declare function validateDataUsingSchema(input: {
570
584
  *
571
585
  * @example
572
586
  * ```typescript Real-world Usage in Tests
573
- * import { waitForNetworkIdle } from "@intuned/sdk/helpers";
587
+ * import { waitForNetworkIdle } from "@intuned/browser";
574
588
  *
575
589
  * // Test with network-heavy interactions
576
590
  * const clickElement = waitForNetworkIdle({ timeoutInMs: 10000 })(
@@ -709,31 +723,25 @@ export async function waitForDomSettled(options: {
709
723
  timeoutInMs?: number;
710
724
  }): Promise<boolean>;
711
725
 
712
- export async function waitForDomSettled(options: {
713
- locator: Locator;
714
- settleDuration?: number;
715
- timeoutInMs?: number;
716
- }): Promise<boolean>;
717
-
718
726
  /**
719
727
  * Convert HTML content or a Playwright locator to semantic markdown.
720
- *
721
- * @param {string | Locator} source - The source of the HTML content, can be a string of HTML or a Playwright Locator.
728
+ * @param {Object} input - Configuration options
729
+ * @param {string | Locator} input.source - The source of the HTML content, can be a string of HTML or a Playwright Locator.
722
730
  * @returns {Promise<string>} A promise that resolves to the markdown representation of the HTML content.
723
731
  * @example
724
732
  * ```typescript locator source
725
- * import { extractMarkdown } from "@intuned/sdk/helpers";
733
+ * import { extractMarkdown } from "@intuned/browser";
726
734
  * import { Page, Locator } from "playwright";
727
735
  * headerLocator = page.locator('h1')
728
- * markdown = await extractMarkdown(headerLocator)
736
+ * markdown = await extractMarkdown({ source: headerLocator })
729
737
  * console.log(markdown); // Outputs the markdown representation of the header
730
738
  * ```
731
739
  * @example
732
740
  * ```typescript string source
733
- * import { extractMarkdown } from "@intuned/sdk/helpers";
741
+ * import { extractMarkdown } from "@intuned/browser";
734
742
  * import { Page } from "playwright";
735
743
  * const htmlString = "<h1>Hello World</h1>";
736
- * markdown = await extractMarkdown(htmlString);
744
+ * markdown = await extractMarkdown({ source: htmlString });
737
745
  * console.log(markdown); // Outputs "# Hello World"
738
746
  * ```
739
747
  *
@@ -749,15 +757,15 @@ export declare function extractMarkdown(input: {
749
757
  * string URLs (relative or absolute), Playwright Locators pointing to anchor elements,
750
758
  * or Locator objects representing anchor elements.
751
759
  *
752
- * @param options - Configuration object with different properties based on the overload
753
- * @param {string | Locator} options.url - The URL source to resolve.
760
+ * @param {Object} input - Configuration object with different properties based on the overload
761
+ * @param {string | Locator} input.url - The URL source to resolve.
754
762
  * - If string: A relative or absolute URL string
755
763
  * - If Locator: Must point to an anchor element
756
764
  * - If ElementHandle: Must represent an anchor element
757
- * @param {string} [options.baseUrl] - Base URL string to resolve relative URLs against.
765
+ * @param {string} [input.baseUrl] - Base URL string to resolve relative URLs against.
758
766
  * Required when url is a string and page is not provided.
759
767
  * Cannot be used with Locator url.
760
- * @param {Page} [options.page] - Playwright Page object to extract base URL from.
768
+ * @param {Page} [input.page] - Playwright Page object to extract base URL from.
761
769
  * Required when url is a string and baseUrl is not provided.
762
770
  * Cannot be used with Locator url.
763
771
  *
@@ -834,7 +842,7 @@ export declare function extractMarkdown(input: {
834
842
  * ```
835
843
  */
836
844
 
837
- export declare function resolveUrl(options: {
845
+ export declare function resolveUrl(input: {
838
846
  url: string | Locator;
839
847
  baseUrl?: string;
840
848
  page?: Page;
@@ -1075,18 +1083,6 @@ export interface S3UploadOptions {
1075
1083
  */
1076
1084
  export type S3UploadableFile = Download | Uint8Array | Buffer | ReadStream;
1077
1085
 
1078
- /**
1079
- * ModelType is a string representing the model type.
1080
- * Current supported models are:
1081
- * - "gpt-4o"
1082
- * - "gpt-4o-mini"
1083
- * - "gpt-4o-turbo"
1084
- * - "gpt-4o-turbo-preview"
1085
- * - "gpt-4o-turbo-preview-2024-07-18"
1086
- * - "gpt-4o-turbo-preview-2024-07-18"
1087
- */
1088
- export type ModelType = string;
1089
-
1090
1086
  /**
1091
1087
  * Downloads a file from a web page and uploads it to S3 storage.
1092
1088
  * This function supports three different ways to trigger a download:
@@ -1101,7 +1097,7 @@ export type ModelType = string;
1101
1097
  *
1102
1098
  * @example
1103
1099
  * ```typescript URL Download and Upload
1104
- * import { downloadFromPageToS3 } from "@intuned/sdk/helpers";
1100
+ * import { downloadFromPageToS3 } from "@intuned/browser";
1105
1101
  * import { S3UploadOptions } from "@intuned/sdk/types";
1106
1102
  *
1107
1103
  * const uploadOptions: S3UploadOptions = {
@@ -1116,7 +1112,7 @@ export type ModelType = string;
1116
1112
  *
1117
1113
  * @example
1118
1114
  * ```typescript Locator Download and Upload
1119
- * import { downloadFromPageToS3 } from "@intuned/sdk/helpers";
1115
+ * import { downloadFromPageToS3 } from "@intuned/browser";
1120
1116
  * import { S3UploadOptions } from "@intuned/sdk/types";
1121
1117
  * const uploadOptions: S3UploadOptions = {
1122
1118
  * s3Configs: {
@@ -1130,7 +1126,7 @@ export type ModelType = string;
1130
1126
  *
1131
1127
  * @example
1132
1128
  * ```typescript Callback Function Download and Upload
1133
- * import { downloadFromPageToS3 } from "@intuned/sdk/helpers";
1129
+ * import { downloadFromPageToS3 } from "@intuned/browser";
1134
1130
  * import { S3UploadOptions } from "@intuned/sdk/types";
1135
1131
  * const uploadOptions: S3UploadOptions = {
1136
1132
  * s3Configs: {
@@ -1168,7 +1164,7 @@ export declare function downloadFromPageToS3(
1168
1164
  *
1169
1165
  * @example
1170
1166
  * ```typescript URL Download and Upload
1171
- * import { saveFileToS3 } from "@intuned/sdk/helpers";
1167
+ * import { saveFileToS3 } from "@intuned/browser";
1172
1168
  * import { S3UploadOptions } from "@intuned/sdk/types";
1173
1169
  *
1174
1170
  * const uploadOptions: S3UploadOptions = {
@@ -1183,7 +1179,7 @@ export declare function downloadFromPageToS3(
1183
1179
  *
1184
1180
  * @example
1185
1181
  * ```typescript Locator Download and Upload
1186
- * import { saveFileToS3 } from "@intuned/sdk/helpers";
1182
+ * import { saveFileToS3 } from "@intuned/browser";
1187
1183
  * import { S3UploadOptions } from "@intuned/sdk/types";
1188
1184
  * const uploadOptions: S3UploadOptions = {
1189
1185
  * s3Configs: {
@@ -1197,7 +1193,7 @@ export declare function downloadFromPageToS3(
1197
1193
  *
1198
1194
  * @example
1199
1195
  * ```typescript Callback Function Download and Upload
1200
- * import { saveFileToS3 } from "@intuned/sdk/helpers";
1196
+ * import { saveFileToS3 } from "@intuned/browser";
1201
1197
  * import { S3UploadOptions } from "@intuned/sdk/types";
1202
1198
  * const uploadOptions: S3UploadOptions = {
1203
1199
  * s3Configs: {
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.sanitizeHtml = sanitizeHtml;
6
+ exports.sanitizeHtml = void 0;
7
7
  var _nodeHtmlParser = require("node-html-parser");
8
8
  var _isGenerateCodeMode = require("./utils/isGenerateCodeMode");
9
- function sanitizeHtml(options = {
9
+ const sanitizeHtml = (options = {
10
10
  html: ""
11
- }) {
11
+ }) => {
12
12
  const {
13
13
  html,
14
14
  removeScripts = true,
@@ -70,4 +70,5 @@ function sanitizeHtml(options = {
70
70
  sanitizedHtml = sanitizedHtml.replace(/\s+/g, " ");
71
71
  }
72
72
  return sanitizedHtml;
73
- }
73
+ };
74
+ exports.sanitizeHtml = sanitizeHtml;
@@ -33,7 +33,7 @@ const scrollToLoadContent = async input => {
33
33
  delay = 100,
34
34
  minHeightChange = 100
35
35
  } = input || {};
36
- const scrollable = scrollableContainer || input.page;
36
+ const scrollable = scrollableContainer || input.source;
37
37
  let previousHeight = -1;
38
38
  let scrollCount = 0;
39
39
  while (scrollCount < maxScrolls) {
@@ -99,8 +99,8 @@ var _ = require("..");
99
99
  (0, _extendedTest.expect)(result).toContain("- Apples");
100
100
  (0, _extendedTest.expect)(result).toContain("- Bananas");
101
101
  (0, _extendedTest.expect)(result).toContain("- Oranges");
102
- (0, _extendedTest.expect)(result).toContain("1. First item");
103
- (0, _extendedTest.expect)(result).toContain("2. Second item");
102
+ (0, _extendedTest.expect)(result).toContain("1. First item");
103
+ (0, _extendedTest.expect)(result).toContain("2. Second item");
104
104
  });
105
105
  (0, _extendedTest.test)("extract markdown with links and images", async ({
106
106
  page
@@ -156,8 +156,8 @@ var _ = require("..");
156
156
  source: locator
157
157
  });
158
158
  (0, _extendedTest.expect)(result).toContain("| Name | Age |");
159
- (0, _extendedTest.expect)(result).toContain("| John | 25 |");
160
- (0, _extendedTest.expect)(result).toContain("| Jane | 30 |");
159
+ (0, _extendedTest.expect)(result).toContain("| John | 25 |");
160
+ (0, _extendedTest.expect)(result).toContain("| Jane | 30 |");
161
161
  });
162
162
  (0, _extendedTest.test)("extract markdown with blockquotes", async ({
163
163
  page
@@ -200,7 +200,6 @@ var _ = require("..");
200
200
  const result = await (0, _.extractMarkdown)({
201
201
  source: locator
202
202
  });
203
- (0, _extendedTest.expect)(result).toContain("```");
204
203
  (0, _extendedTest.expect)(result).toContain("function hello()");
205
204
  (0, _extendedTest.expect)(result).toContain("console.log('Hello, world!');");
206
205
  (0, _extendedTest.expect)(result).toContain("Some inline `code` here.");
@@ -284,7 +283,6 @@ var _ = require("..");
284
283
  (0, _extendedTest.expect)(result).toContain("## Introduction");
285
284
  (0, _extendedTest.expect)(result).toContain("**introduction**");
286
285
  (0, _extendedTest.expect)(result).toContain("- Point one");
287
- (0, _extendedTest.expect)(result).toContain("[link](#link)");
288
286
  (0, _extendedTest.expect)(result).toContain("## Details");
289
287
  (0, _extendedTest.expect)(result).toContain("> Important quote here.");
290
288
  (0, _extendedTest.expect)(result).toContain("`inline code`");
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });