Skip to content

Commit

Permalink
fix(zendesk): Fix broken integration
Browse files Browse the repository at this point in the history
  • Loading branch information
with-shrey committed Oct 29, 2024
1 parent 9d28b50 commit b4e7f36
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/content/zendesk.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,29 @@ 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);

// 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;
Expand Down

0 comments on commit b4e7f36

Please sign in to comment.