@uxbertlabs/reportly 1.0.20 → 1.0.21
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/components/ReportlyProvider.d.ts.map +1 -1
- package/dist/features/export.d.ts.map +1 -1
- package/dist/index.cjs.js +47 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +48 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useReducer, useCallback, createContext, useContext, forwardRef, createElement, useState, useRef, useEffect } from 'react';
|
|
1
|
+
import React, { useReducer, useMemo, useCallback, createContext, useContext, forwardRef, createElement, useState, useRef, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
class DeviceInfo {
|
|
4
4
|
constructor() {
|
|
@@ -294,29 +294,40 @@ class N8nIntegration {
|
|
|
294
294
|
|
|
295
295
|
class Export {
|
|
296
296
|
constructor(n8nConfig) {
|
|
297
|
-
this.savedIssues =
|
|
297
|
+
this.savedIssues = [];
|
|
298
298
|
this.n8nIntegration = new N8nIntegration(n8nConfig);
|
|
299
|
+
// Defer localStorage access to avoid SSR issues
|
|
300
|
+
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
|
|
301
|
+
this.savedIssues = this.loadSavedIssues();
|
|
302
|
+
}
|
|
299
303
|
}
|
|
300
304
|
exportToJSON(issueData) {
|
|
301
305
|
const json = JSON.stringify(issueData, null, 2);
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
306
|
+
// Check if we're in a browser environment
|
|
307
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
308
|
+
const blob = new Blob([json], {
|
|
309
|
+
type: 'application/json'
|
|
310
|
+
});
|
|
311
|
+
const url = URL.createObjectURL(blob);
|
|
312
|
+
// Create download link
|
|
313
|
+
const link = document.createElement('a');
|
|
314
|
+
link.href = url;
|
|
315
|
+
link.download = `issue-${Date.now()}.json`;
|
|
316
|
+
document.body.appendChild(link);
|
|
317
|
+
link.click();
|
|
318
|
+
document.body.removeChild(link);
|
|
319
|
+
// Clean up
|
|
320
|
+
URL.revokeObjectURL(url);
|
|
321
|
+
// Save to localStorage
|
|
322
|
+
this.saveIssue(issueData);
|
|
323
|
+
}
|
|
317
324
|
return json;
|
|
318
325
|
}
|
|
319
326
|
saveIssue(issueData) {
|
|
327
|
+
// Check if we're in a browser environment
|
|
328
|
+
if (typeof window === 'undefined' || typeof localStorage === 'undefined') {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
320
331
|
try {
|
|
321
332
|
this.savedIssues.push({
|
|
322
333
|
...issueData,
|
|
@@ -333,6 +344,10 @@ class Export {
|
|
|
333
344
|
}
|
|
334
345
|
}
|
|
335
346
|
loadSavedIssues() {
|
|
347
|
+
// Check if we're in a browser environment
|
|
348
|
+
if (typeof window === 'undefined' || typeof localStorage === 'undefined') {
|
|
349
|
+
return [];
|
|
350
|
+
}
|
|
336
351
|
try {
|
|
337
352
|
const saved = localStorage.getItem('uxbert-saved-issues');
|
|
338
353
|
return saved ? JSON.parse(saved) : [];
|
|
@@ -346,13 +361,23 @@ class Export {
|
|
|
346
361
|
}
|
|
347
362
|
deleteSavedIssue(issueId) {
|
|
348
363
|
this.savedIssues = this.savedIssues.filter(issue => issue.id !== issueId);
|
|
349
|
-
|
|
364
|
+
// Check if we're in a browser environment
|
|
365
|
+
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
|
|
366
|
+
localStorage.setItem('uxbert-saved-issues', JSON.stringify(this.savedIssues));
|
|
367
|
+
}
|
|
350
368
|
}
|
|
351
369
|
clearSavedIssues() {
|
|
352
370
|
this.savedIssues = [];
|
|
353
|
-
|
|
371
|
+
// Check if we're in a browser environment
|
|
372
|
+
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
|
|
373
|
+
localStorage.removeItem('uxbert-saved-issues');
|
|
374
|
+
}
|
|
354
375
|
}
|
|
355
376
|
exportAllIssues() {
|
|
377
|
+
// Check if we're in a browser environment
|
|
378
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
356
381
|
const json = JSON.stringify(this.savedIssues, null, 2);
|
|
357
382
|
const blob = new Blob([json], {
|
|
358
383
|
type: 'application/json'
|
|
@@ -9575,10 +9600,10 @@ function ReportlyProvider({
|
|
|
9575
9600
|
});
|
|
9576
9601
|
// Annotation manager state - will be set by Reportly component
|
|
9577
9602
|
const [annotationManager, setAnnotationManagerState] = React.useState(null);
|
|
9578
|
-
// Initialize services
|
|
9579
|
-
const deviceInfo = new DeviceInfo();
|
|
9580
|
-
const exportService = new Export(config.integrations?.n8n);
|
|
9581
|
-
const screenshot = new Screenshot();
|
|
9603
|
+
// Initialize services with useMemo to ensure they're only created once and support SSR
|
|
9604
|
+
const deviceInfo = useMemo(() => new DeviceInfo(), []);
|
|
9605
|
+
const exportService = useMemo(() => new Export(config.integrations?.n8n), [config.integrations?.n8n]);
|
|
9606
|
+
const screenshot = useMemo(() => new Screenshot(), []);
|
|
9582
9607
|
const openModal = useCallback(() => {
|
|
9583
9608
|
dispatch({
|
|
9584
9609
|
type: 'OPEN_MODAL'
|