@rimori/client 2.5.35 → 2.5.36
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/plugin/Logger.d.ts +0 -11
- package/dist/plugin/Logger.js +2 -52
- package/package.json +1 -2
package/dist/plugin/Logger.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare class Logger {
|
|
|
10
10
|
private logs;
|
|
11
11
|
private logIdCounter;
|
|
12
12
|
private originalConsole;
|
|
13
|
-
private mousePosition;
|
|
14
13
|
private constructor();
|
|
15
14
|
/**
|
|
16
15
|
* Initialize the Logger singleton and override console methods globally.
|
|
@@ -37,10 +36,6 @@ export declare class Logger {
|
|
|
37
36
|
* @returns Object with location string and CSS style, or empty values for production
|
|
38
37
|
*/
|
|
39
38
|
private getCallerLocation;
|
|
40
|
-
/**
|
|
41
|
-
* Track mouse position for screenshot context.
|
|
42
|
-
*/
|
|
43
|
-
private trackMousePosition;
|
|
44
39
|
/**
|
|
45
40
|
* Handle console method calls and create log entries.
|
|
46
41
|
* @param level - Log level
|
|
@@ -52,12 +47,6 @@ export declare class Logger {
|
|
|
52
47
|
* @returns Object with browser and system information
|
|
53
48
|
*/
|
|
54
49
|
private getBrowserInfo;
|
|
55
|
-
/**
|
|
56
|
-
* Capture a screenshot of the current page.
|
|
57
|
-
* Dynamically imports html2canvas only in browser environments.
|
|
58
|
-
* @returns Promise resolving to base64 screenshot or null if failed
|
|
59
|
-
*/
|
|
60
|
-
private captureScreenshot;
|
|
61
50
|
/**
|
|
62
51
|
* Create a log entry with context information.
|
|
63
52
|
* @param level - Log level
|
package/dist/plugin/Logger.js
CHANGED
|
@@ -9,7 +9,6 @@ export class Logger {
|
|
|
9
9
|
logs = [];
|
|
10
10
|
logIdCounter = 0;
|
|
11
11
|
originalConsole;
|
|
12
|
-
mousePosition = null;
|
|
13
12
|
constructor(rimori, isProduction) {
|
|
14
13
|
this.isProduction = this.validateIsProduction(isProduction);
|
|
15
14
|
// Store original console methods
|
|
@@ -22,14 +21,12 @@ export class Logger {
|
|
|
22
21
|
};
|
|
23
22
|
// Override console methods globally
|
|
24
23
|
this.overrideConsoleMethods();
|
|
25
|
-
// Track mouse position
|
|
26
|
-
this.trackMousePosition();
|
|
27
24
|
// Expose logs to global scope for DevTools access
|
|
28
25
|
this.exposeToDevTools();
|
|
29
26
|
// Set up navigation clearing
|
|
30
27
|
this.setupNavigationClearing();
|
|
31
28
|
rimori.event.respond('logging.requestPluginLogs', async () => {
|
|
32
|
-
this.addLogEntry(await this.createLogEntry('info', '
|
|
29
|
+
this.addLogEntry(await this.createLogEntry('info', 'Log capture'));
|
|
33
30
|
const logs = {
|
|
34
31
|
logs: this.logs,
|
|
35
32
|
pluginId: rimori.plugin.pluginId,
|
|
@@ -173,22 +170,6 @@ export class Logger {
|
|
|
173
170
|
return emptyResult;
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Track mouse position for screenshot context.
|
|
178
|
-
*/
|
|
179
|
-
trackMousePosition() {
|
|
180
|
-
if (typeof window !== 'undefined') {
|
|
181
|
-
const updateMousePosition = (event) => {
|
|
182
|
-
this.mousePosition = {
|
|
183
|
-
x: event.clientX,
|
|
184
|
-
y: event.clientY,
|
|
185
|
-
timestamp: new Date().toISOString(),
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
window.addEventListener('mousemove', updateMousePosition);
|
|
189
|
-
window.addEventListener('click', updateMousePosition);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
173
|
/**
|
|
193
174
|
* Handle console method calls and create log entries.
|
|
194
175
|
* @param level - Log level
|
|
@@ -231,32 +212,6 @@ export class Logger {
|
|
|
231
212
|
timestamp: new Date().toISOString(),
|
|
232
213
|
};
|
|
233
214
|
}
|
|
234
|
-
/**
|
|
235
|
-
* Capture a screenshot of the current page.
|
|
236
|
-
* Dynamically imports html2canvas only in browser environments.
|
|
237
|
-
* @returns Promise resolving to base64 screenshot or null if failed
|
|
238
|
-
*/
|
|
239
|
-
async captureScreenshot() {
|
|
240
|
-
// Only attempt to capture screenshot in browser environments
|
|
241
|
-
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
242
|
-
return null;
|
|
243
|
-
}
|
|
244
|
-
try {
|
|
245
|
-
// Dynamically import html2canvas only when window is available
|
|
246
|
-
// html2canvas is an optional peer dependency - provided by @rimori/react-client
|
|
247
|
-
// In worker builds, this import should be marked as external to prevent bundling
|
|
248
|
-
const html2canvas = (await import('html2canvas')).default;
|
|
249
|
-
const canvas = await html2canvas(document.body);
|
|
250
|
-
const screenshot = canvas.toDataURL('image/png');
|
|
251
|
-
// this.originalConsole.log("screenshot captured", screenshot)
|
|
252
|
-
return screenshot;
|
|
253
|
-
}
|
|
254
|
-
catch (error) {
|
|
255
|
-
// html2canvas may not be available (e.g., in workers or when not installed)
|
|
256
|
-
// Silently fail to avoid breaking logging functionality
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
215
|
/**
|
|
261
216
|
* Create a log entry with context information.
|
|
262
217
|
* @param level - Log level
|
|
@@ -264,7 +219,7 @@ export class Logger {
|
|
|
264
219
|
* @param data - Additional data
|
|
265
220
|
* @returns Log entry
|
|
266
221
|
*/
|
|
267
|
-
async createLogEntry(level, message, data
|
|
222
|
+
async createLogEntry(level, message, data) {
|
|
268
223
|
const context = {};
|
|
269
224
|
// Add URL if available
|
|
270
225
|
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
@@ -280,11 +235,6 @@ export class Logger {
|
|
|
280
235
|
// Add browser info (this method now handles worker context internally)
|
|
281
236
|
context.browserInfo = this.getBrowserInfo();
|
|
282
237
|
context.userAgent = context.browserInfo.userAgent;
|
|
283
|
-
// Add screenshot and mouse position if level is error or warn
|
|
284
|
-
if (level === 'error' || level === 'warn' || forceScreenshot) {
|
|
285
|
-
context.screenshot = (await this.captureScreenshot()) || undefined;
|
|
286
|
-
context.mousePosition = this.mousePosition || undefined;
|
|
287
|
-
}
|
|
288
238
|
return {
|
|
289
239
|
id: `log_${++this.logIdCounter}_${Date.now()}`,
|
|
290
240
|
timestamp: new Date().toISOString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimori/client",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.36",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^25.0.1",
|
|
45
45
|
"eslint-config-prettier": "^10.1.8",
|
|
46
|
-
"html2canvas": "^1.4.1",
|
|
47
46
|
"globals": "^16.4.0",
|
|
48
47
|
"prettier": "^3.6.2",
|
|
49
48
|
"typescript": "^5.7.2",
|