chore: Remove unnecessary methods and polyfills (#5614)

This commit is contained in:
David Kubeš 2022-10-12 23:42:06 +02:00 committed by GitHub
parent fca629a32a
commit 0c8f744c33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 73 deletions

View file

@ -1,9 +1,8 @@
import Cookies from 'js-cookie';
import {
wootOn,
addClass,
addClasses,
loadCSS,
removeClass,
removeClasses,
onLocationChangeListener,
} from './DOMHelpers';
import {
@ -68,7 +67,7 @@ export const IFrameHelper = {
holderClassName += ` woot-widget-holder--flat`;
}
addClass(widgetHolder, holderClassName);
addClasses(widgetHolder, holderClassName);
widgetHolder.appendChild(iframe);
body.appendChild(widgetHolder);
IFrameHelper.initPostMessageCommunication();
@ -99,7 +98,7 @@ export const IFrameHelper = {
};
},
initWindowSizeListener: () => {
wootOn(window, 'resize', () => IFrameHelper.toggleCloseButton());
window.addEventListener('resize', () => IFrameHelper.toggleCloseButton());
},
preventDefaultScroll: () => {
widgetHolder.addEventListener('wheel', event => {
@ -241,9 +240,9 @@ export const IFrameHelper = {
event.unreadMessageCount > 0 &&
!bubbleElement.classList.contains('unread-notification')
) {
addClass(bubbleElement, 'unread-notification');
addClasses(bubbleElement, 'unread-notification');
} else if (event.unreadMessageCount === 0) {
removeClass(bubbleElement, 'unread-notification');
removeClasses(bubbleElement, 'unread-notification');
}
},
@ -284,7 +283,7 @@ export const IFrameHelper = {
target: chatBubble,
});
addClass(closeBubble, closeBtnClassName);
addClasses(closeBubble, closeBtnClassName);
chatIcon.style.background = widgetColor;
closeBubble.style.background = widgetColor;