Skip to content

Commit f057b2a

Browse files
fix(hubspot): integration buton issue
1 parent e67f8f2 commit f057b2a

1 file changed

Lines changed: 28 additions & 22 deletions

File tree

src/content/hubspot.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,62 @@
33
* @urlAlias hubspot.com
44
* @urlRegex *://app.hubspot.com/*
55
*/
6-
'use strict';
6+
'use strict'
77

88
// This generic implementation works for most objects details page
99
togglbutton.render(
10-
'div[data-selenium-component="ProfileHighlightContainer"] [data-selenium-test="highlightTitle"]:not(.toggl)',
10+
'[data-card-type="OBJECT_HIGHLIGHT"]:not(.toggl)',
1111
{ observe: true },
12-
$container => {
12+
($container) => {
1313
try {
1414
function descriptionSelector() {
15-
const $description = $('div[data-selenium-test$="-highlight-details"] h3') ?? $('[data-selenium-test="highlightTitle"]');
16-
return $description.textContent.trim();
15+
const $description =
16+
$('div[data-selenium-test$="-highlight-details"] h3') ??
17+
$('[data-selenium-test="highlightTitle"]')
18+
return $description.textContent.trim()
1719
}
1820

1921
const link = togglbutton.createTimerLink({
2022
className: 'hubspot',
2123
description: descriptionSelector,
2224
autoTrackable: true,
23-
});
24-
const rowContainer = document.createElement('div');
25-
rowContainer.setAttribute('class', 'flex-row align-center');
26-
rowContainer.appendChild(link);
25+
})
26+
const rowContainer = document.createElement('div')
27+
rowContainer.setAttribute('class', 'flex-row align-center')
28+
rowContainer.appendChild(link)
2729
const cardContainer = $('[data-selenium-test="highlightTitle"]')
28-
cardContainer.parentNode.parentNode.appendChild(rowContainer);
30+
const parent = cardContainer.parentNode.parentNode.parentNode
31+
parent.insertAdjacentElement('afterend', rowContainer)
2932
} catch (e) {
3033
console.error(e)
3134
}
32-
}
33-
);
35+
},
36+
)
3437

3538
// This generic implementation works for most objects details page
3639
togglbutton.render(
3740
'td[data-table-external-id*="name-"]:not(.toggl)',
3841
{ observe: true },
39-
$container => {
42+
($container) => {
4043
try {
4144
function descriptionSelector() {
42-
return $('[data-test-id="truncated-object-label"]', $container).textContent.trim();
45+
return $(
46+
'[data-test-id="truncated-object-label"]',
47+
$container,
48+
).textContent.trim()
4349
}
4450

4551
const link = togglbutton.createTimerLink({
4652
className: 'hubspot-list-item',
4753
description: descriptionSelector,
48-
buttonType: 'minimal'
49-
});
50-
const rowContainer = document.createElement('div');
51-
rowContainer.setAttribute('class', 'flex-row align-center');
52-
rowContainer.appendChild(link);
53-
$('.media', $container).prepend(rowContainer);
54+
buttonType: 'minimal',
55+
})
56+
const rowContainer = document.createElement('div')
57+
rowContainer.setAttribute('class', 'flex-row align-center')
58+
rowContainer.appendChild(link)
59+
$('.media', $container).prepend(rowContainer)
5460
} catch (e) {
5561
console.error(e)
5662
}
57-
}
58-
);
63+
},
64+
)

0 commit comments

Comments
 (0)