import { defineComponent } from '@vue/composition-api';
import { configApp, configLayout } from '@/config/app';
import { configAppApi } from '@/config/api';
import {
  openExternalUrl, getTabCurrent, reloadTabCurrent, createPopupUrl, openPopupUrl,
} from '@/browser/tab';
import { useOpenPopup } from '@/browser/api';
import { isDevMode } from '@/config/env';
import { loggerVue } from '@/plugins/logger';
import { SHOPEE_SPY_ENABLED } from '@/constant/shopee';

export default defineComponent({
  data() {
    return {
      isUsePopup: useOpenPopup(),
      configApp,
      configAppApi,
      isDevMode,
      loggerVue,
      loggerApi: loggerVue,
      shopeeSpyEnabled: SHOPEE_SPY_ENABLED,
    };
  },
  methods: {
    openPopupUrl,
    createPopupUrl,
    getTabCurrent,
    reloadTabCurrent,
    openExternalUrl,
  },
  computed: {
    layoutBox() {
      return {
        height: configLayout.heightBox,
        overflowY: 'auto',
      };
    },
    layoutFooter() {
      return {
        height: configLayout.heightWithFooter,
        overflowY: 'auto',
      };
    },
  },
});
