import { getSessionStorage } from "../service/sessionStorage";

const createWidgetState = (elements) => {
  const getIsWidgetHidden = () =>
    elements.widget?.classList.contains("firevert-widget--hidden") ?? true;

  const getIsPowerWidgetOpen = () =>
    elements.powerWidgetContainer?.classList.contains(
      "firevert-powerwidget__container--active"
    ) ?? false;

  const getIsDesktopInit = () =>
    elements.powerWidget?.classList.contains(
      "firevert-powerwidget--init-desktop-position"
    ) ?? false;

  const getIsBubbleOpen = () => getSessionStorage("firevert-bubble-open");

  return {
    getIsWidgetHidden,
    getIsPowerWidgetOpen,
    getIsDesktopInit,
    getIsBubbleOpen,
  };
};

export default createWidgetState;
