@thetypefounders/continue-with-google 1.4.3 → 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/dist/index.d.ts +3 -2
- package/dist/index.js +4 -4
- package/package.json +4 -4
- package/src/index.ts +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ElementHandle, Page, WaitForSelectorOptions } from 'puppeteer';
|
|
2
2
|
export interface Logger {
|
|
3
|
-
info(
|
|
4
|
-
warn(
|
|
3
|
+
info(value: any): void;
|
|
4
|
+
warn(value: any): void;
|
|
5
|
+
error(value: any): void;
|
|
5
6
|
}
|
|
6
7
|
export type Options = {
|
|
7
8
|
challengeCount?: number;
|
package/dist/index.js
CHANGED
|
@@ -72,8 +72,8 @@ async function takeContent(page, logger) {
|
|
|
72
72
|
try {
|
|
73
73
|
return await page.evaluate(() => document.body.innerText);
|
|
74
74
|
}
|
|
75
|
-
catch (
|
|
76
|
-
logger.
|
|
75
|
+
catch (cause) {
|
|
76
|
+
logger.error(new Error(`Failed to take the content.`, { cause }));
|
|
77
77
|
return undefined;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -83,8 +83,8 @@ async function takeImage(page, logger) {
|
|
|
83
83
|
await page.addStyleTag({ content });
|
|
84
84
|
return await page.screenshot({ encoding: 'base64' });
|
|
85
85
|
}
|
|
86
|
-
catch (
|
|
87
|
-
logger.
|
|
86
|
+
catch (cause) {
|
|
87
|
+
logger.error(new Error(`Failed to take a screenshot.`, { cause }));
|
|
88
88
|
return undefined;
|
|
89
89
|
}
|
|
90
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thetypefounders/continue-with-google",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Ivan Ukhov <ivan.ukhov@gmail.com>",
|
|
6
6
|
"description": "Two-factor authentication with Google via Puppeteer",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"authenticator": "^1.1.5",
|
|
16
|
-
"puppeteer": "^24.
|
|
16
|
+
"puppeteer": "^24.25.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
20
20
|
"@types/authenticator": "^1.1.4",
|
|
21
|
-
"prettier": "^3.
|
|
22
|
-
"typescript": "^5.
|
|
21
|
+
"prettier": "^3.6.2",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc",
|
package/src/index.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { setTimeout } from 'node:timers/promises';
|
|
|
4
4
|
import { type ElementHandle, Page, WaitForSelectorOptions } from 'puppeteer';
|
|
5
5
|
|
|
6
6
|
export interface Logger {
|
|
7
|
-
info(
|
|
8
|
-
warn(
|
|
7
|
+
info(value: any): void;
|
|
8
|
+
warn(value: any): void;
|
|
9
|
+
error(value: any): void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export type Options = {
|
|
@@ -119,8 +120,8 @@ async function takeContent(
|
|
|
119
120
|
): Promise<string | undefined> {
|
|
120
121
|
try {
|
|
121
122
|
return await page.evaluate(() => document.body.innerText);
|
|
122
|
-
} catch (
|
|
123
|
-
logger.
|
|
123
|
+
} catch (cause) {
|
|
124
|
+
logger.error(new Error(`failed to take the content`, { cause }));
|
|
124
125
|
return undefined;
|
|
125
126
|
}
|
|
126
127
|
}
|
|
@@ -133,8 +134,8 @@ async function takeImage(
|
|
|
133
134
|
const content = '* { caret-color: transparent !important; }';
|
|
134
135
|
await page.addStyleTag({ content });
|
|
135
136
|
return await page.screenshot({ encoding: 'base64' });
|
|
136
|
-
} catch (
|
|
137
|
-
logger.
|
|
137
|
+
} catch (cause) {
|
|
138
|
+
logger.error(new Error(`failed to take a screenshot`, { cause }));
|
|
138
139
|
return undefined;
|
|
139
140
|
}
|
|
140
141
|
}
|