From c469d451550c8fe6be554a77fac8612b56555910 Mon Sep 17 00:00:00 2001 From: Shrey Gupta Date: Thu, 24 Oct 2024 16:14:15 +0200 Subject: [PATCH] fix(zendesk): Fix broken integration --- src/content/zendesk.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/content/zendesk.js b/src/content/zendesk.js index 859cd971d..993831a4e 100644 --- a/src/content/zendesk.js +++ b/src/content/zendesk.js @@ -73,10 +73,14 @@ setTimeout(() => { if (document.querySelector('.toggl-button')) { document.removeChild(elem.querySelector('.toggl-button')); } - elem.querySelector('[data-side-conversations-anchor-id="1"]').firstChild - .firstChild - .firstChild - .appendChild(link); + try { + elem.querySelector('[data-side-conversations-anchor-id="1"]').firstChild + .firstChild + .firstChild + .appendChild(link); + } catch (error) { + console.error('Toggl Button: Error in rendering', error); + } } ); }, 1000); @@ -84,14 +88,14 @@ setTimeout(() => { // Zendesk new UI Sept 2023 setTimeout(() => { togglbutton.render( - '.ticket-panes-grid-layout.active', + '.ticket-panes-grid-layout[data-is-active="true"]', { observe: true }, function (elem) { - const elements = document.querySelectorAll('.ticket-panes-grid-layout:not(.active) .toggl-button') + const elements = document.querySelectorAll('.ticket-panes-grid-layout:not([data-is-active="true"]) .toggl-button') if(elements.length > 0) { elements.forEach(element => element.remove()) } - const activeButtonExists = document.querySelector('.ticket-panes-grid-layout.active .toggl-button') + const activeButtonExists = document.querySelector('.ticket-panes-grid-layout[data-is-active="true"] .toggl-button') if(activeButtonExists) return let description;