Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions dist/doboard-widget-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8793,7 +8793,7 @@ async function getAllTasks(params, nonRequesting = false) {
const sessionId = localStorage.getItem('spotfix_session_id') || '';
let tasksData = await spotfixIndexedDB.getAll(SPOTFIX_TABLE_TASKS);

if ((nonRequesting && (!tasksData || !tasksData.length)) || (!nonRequesting && (!tasksData || !tasksData.length) && !wsSpotfix.isActive())) {
if (!nonRequesting || (!tasksData || !tasksData.length) || !wsSpotfix.isActive()) {
await getTasksDoboard(projectToken, sessionId, params.accountId, params.projectId);
tasksData = await spotfixIndexedDB.getAll(SPOTFIX_TABLE_TASKS);
}
Expand Down Expand Up @@ -10239,16 +10239,13 @@ class CleanTalkWidgetDoboard {
}

if (!this?.nonRequesting && this?.fileUploader?.makeScreenshot && typeof this?.fileUploader?.makeScreenshot === 'function') {
const originalDisplay = widgetContainer.style.display;
widgetContainer.style.display = 'none';

try {
await this.fileUploader.makeScreenshot();
} catch (screenshotError) {
console.error('SpotFix: Failed to capture automatic screenshot on open:', screenshotError);
} finally {
widgetContainer.style.display = originalDisplay;
}
setTimeout(() => {
this.fileUploader.makeScreenshot().catch((screenshotError) => {
console.error('SpotFix: Failed to capture automatic screenshot on open:', screenshotError);
});
}, 300);

}

const savedDescription = localStorage.getItem('spotfix-description-ls') || '';
Expand Down Expand Up @@ -10801,7 +10798,7 @@ class CleanTalkWidgetDoboard {

const currentSessionId = localStorage.getItem('spotfix_session_id') || '';
const isSessionStateValid = taskCache && (taskCache.sessionId === currentSessionId);
const isConcreteCacheValid = taskCache && (nowCI - taskCache.timestamp < 30000) && !this.nonRequesting && isSessionStateValid;
const isConcreteCacheValid = taskCache && (nowCI - taskCache.timestamp < 15000) && !this.nonRequesting && isSessionStateValid;

if (isConcreteCacheValid) {
widgetContainer.innerHTML = taskCache.widgetHTML;
Expand Down
8 changes: 4 additions & 4 deletions dist/doboard-widget-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/doboard-widget-bundle.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async function getAllTasks(params, nonRequesting = false) {
const sessionId = localStorage.getItem('spotfix_session_id') || '';
let tasksData = await spotfixIndexedDB.getAll(SPOTFIX_TABLE_TASKS);

if ((nonRequesting && (!tasksData || !tasksData.length)) || (!nonRequesting && (!tasksData || !tasksData.length) && !wsSpotfix.isActive())) {
if (!nonRequesting || (!tasksData || !tasksData.length) || !wsSpotfix.isActive()) {
await getTasksDoboard(projectToken, sessionId, params.accountId, params.projectId);
tasksData = await spotfixIndexedDB.getAll(SPOTFIX_TABLE_TASKS);
}
Comment thread
veronika-tseleva-cleantalk marked this conversation as resolved.
Expand Down
17 changes: 7 additions & 10 deletions js/src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,16 +947,13 @@ class CleanTalkWidgetDoboard {
}

if (!this?.nonRequesting && this?.fileUploader?.makeScreenshot && typeof this?.fileUploader?.makeScreenshot === 'function') {
const originalDisplay = widgetContainer.style.display;
widgetContainer.style.display = 'none';

try {
await this.fileUploader.makeScreenshot();
} catch (screenshotError) {
console.error('SpotFix: Failed to capture automatic screenshot on open:', screenshotError);
} finally {
widgetContainer.style.display = originalDisplay;
}
setTimeout(() => {
this.fileUploader.makeScreenshot().catch((screenshotError) => {
console.error('SpotFix: Failed to capture automatic screenshot on open:', screenshotError);
});
}, 300);

}

const savedDescription = localStorage.getItem('spotfix-description-ls') || '';
Expand Down Expand Up @@ -1509,7 +1506,7 @@ class CleanTalkWidgetDoboard {

const currentSessionId = localStorage.getItem('spotfix_session_id') || '';
const isSessionStateValid = taskCache && (taskCache.sessionId === currentSessionId);
const isConcreteCacheValid = taskCache && (nowCI - taskCache.timestamp < 30000) && !this.nonRequesting && isSessionStateValid;
const isConcreteCacheValid = taskCache && (nowCI - taskCache.timestamp < 15000) && !this.nonRequesting && isSessionStateValid;

if (isConcreteCacheValid) {
widgetContainer.innerHTML = taskCache.widgetHTML;
Expand Down
Loading