From 7805c4220343e7e4a8a12534bc7b0c8e43a8fbbc Mon Sep 17 00:00:00 2001 From: Shrey Gupta Date: Mon, 7 Oct 2024 16:49:28 +0530 Subject: [PATCH] fix(autotrack): Fix for asana zendesk todoist --- src/content/asana.js | 1 + src/content/todoist.js | 6 ++++-- src/content/zendesk.js | 14 +++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/content/asana.js b/src/content/asana.js index 9c40ccb10..62d152d70 100644 --- a/src/content/asana.js +++ b/src/content/asana.js @@ -181,6 +181,7 @@ togglbutton.render('.TaskPane:not(.toggl)', { observe: true }, (taskPaneEl) => { projectName: projectSelector, buttonType: 'minimal', tags: tagsSelector, + autoTrackable: true, }) const injectContainer = taskPaneEl.querySelector( diff --git a/src/content/todoist.js b/src/content/todoist.js index 953e115a1..169599563 100644 --- a/src/content/todoist.js +++ b/src/content/todoist.js @@ -32,7 +32,8 @@ togglbutton.render( projectName: project, buttonType: "minimal", tags: tags, - container: '[data-testid="button-container"]' + container: '[data-testid="button-container"]', + autoTrackable: true }); const existingTogglWrapper = $('.toggl-button-todoist-wrapper'); @@ -71,7 +72,8 @@ togglbutton.render('[data-item-detail-root] [data-item-actions-root]:not(.toggl) description: description, projectName: project, tags: tags, - buttonType: 'minimal' + buttonType: 'minimal', + autoTrackable: true }); const wrapper = document.createElement('div'); diff --git a/src/content/zendesk.js b/src/content/zendesk.js index 25f91171e..859cd971d 100644 --- a/src/content/zendesk.js +++ b/src/content/zendesk.js @@ -87,7 +87,13 @@ setTimeout(() => { '.ticket-panes-grid-layout.active', { observe: true }, function (elem) { - if (elem.querySelector('.toggl-button')) return + const elements = document.querySelectorAll('.ticket-panes-grid-layout:not(.active) .toggl-button') + if(elements.length > 0) { + elements.forEach(element => element.remove()) + } + const activeButtonExists = document.querySelector('.ticket-panes-grid-layout.active .toggl-button') + if(activeButtonExists) return + let description; const projectName = $('title').textContent; @@ -108,12 +114,14 @@ setTimeout(() => { const link = togglbutton.createTimerLink({ className: 'zendesk-button', description: titleFunc, - projectName: projectName && projectName.split(' – ').shift() + projectName: projectName && projectName.split(' – ').shift(), + buttonType: 'minimal' }); elem.querySelector('[data-support-suite-trial-onboarding-id="conversationPane"] > div:nth-child(1)').lastChild.prepend(link); - } + }, + '' ); }, 1000);