import setupBubbleListener from "./widget/setupBubbleListener";
import setupWidgetCloseListener from "./widget/setupWidgetCloseListener";
import setupAccordionListener from "./widget/setupAccordionListener";
import setupOutsideClickListener from "./widget/setupOutsideClickListener";
import setupInfinityScroll from "./widget/setupInfinityScroll";

export default function initializeListeners(
  containerElement,
  shadowRoot,
  theme,
  paginationState,
  expandOnMobile
) {
  setupBubbleListener(containerElement, expandOnMobile);
  setupWidgetCloseListener(containerElement);
  setupAccordionListener(containerElement);
  setupOutsideClickListener(containerElement, expandOnMobile);

  if (shadowRoot && theme && paginationState) {
    setupInfinityScroll(shadowRoot, theme, paginationState);
  }
}
