2019-08-14 09:48:44 +00:00
|
|
|
/* eslint no-console: 0 */
|
|
|
|
/* eslint-env browser */
|
|
|
|
/* eslint-disable no-new */
|
|
|
|
/* Vue Core */
|
|
|
|
|
|
|
|
import Vue from 'vue';
|
|
|
|
import VueI18n from 'vue-i18n';
|
|
|
|
import VueRouter from 'vue-router';
|
|
|
|
import axios from 'axios';
|
|
|
|
// Global Components
|
2020-12-04 19:52:16 +00:00
|
|
|
import hljs from 'highlight.js';
|
2019-08-14 09:48:44 +00:00
|
|
|
import Multiselect from 'vue-multiselect';
|
2021-06-06 11:29:05 +00:00
|
|
|
import VueFormulate from '@braid/vue-formulate';
|
2019-08-14 09:48:44 +00:00
|
|
|
import WootSwitch from 'components/ui/Switch';
|
|
|
|
import WootWizard from 'components/ui/Wizard';
|
|
|
|
import { sync } from 'vuex-router-sync';
|
|
|
|
import Vuelidate from 'vuelidate';
|
|
|
|
import VTooltip from 'v-tooltip';
|
2019-10-16 09:06:17 +00:00
|
|
|
import WootUiKit from '../dashboard/components';
|
|
|
|
import App from '../dashboard/App';
|
|
|
|
import i18n from '../dashboard/i18n';
|
|
|
|
import createAxios from '../dashboard/helper/APIHelper';
|
2021-06-06 11:29:05 +00:00
|
|
|
import commonHelpers, { isJSONValid } from '../dashboard/helper/commons';
|
2021-03-04 13:54:03 +00:00
|
|
|
import { getAlertAudio } from '../shared/helpers/AudioNotificationHelper';
|
2021-04-13 13:55:19 +00:00
|
|
|
import { initFaviconSwitcher } from '../shared/helpers/faviconHelper';
|
2019-10-16 09:06:17 +00:00
|
|
|
import router from '../dashboard/routes';
|
|
|
|
import store from '../dashboard/store';
|
2019-10-24 20:07:01 +00:00
|
|
|
import vueActionCable from '../dashboard/helper/actionCable';
|
2019-10-16 09:06:17 +00:00
|
|
|
import constants from '../dashboard/constants';
|
2020-05-05 18:40:56 +00:00
|
|
|
import {
|
|
|
|
verifyServiceWorkerExistence,
|
|
|
|
registerSubscription,
|
|
|
|
} from '../dashboard/helper/pushHelper';
|
2021-02-06 07:29:19 +00:00
|
|
|
import * as Sentry from '@sentry/vue';
|
2021-03-01 16:58:15 +00:00
|
|
|
import 'vue-easytable/libs/theme-default/index.css';
|
2021-05-25 08:40:09 +00:00
|
|
|
import { Integrations } from '@sentry/tracing';
|
2021-09-07 17:41:01 +00:00
|
|
|
import posthog from 'posthog-js';
|
|
|
|
import {
|
|
|
|
initializeAnalyticsEvents,
|
|
|
|
initializeChatwootEvents,
|
|
|
|
} from '../dashboard/helper/scriptHelpers';
|
2021-12-01 05:03:18 +00:00
|
|
|
import FluentIcon from 'shared/components/FluentIcon/DashboardIcon';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
Vue.config.env = process.env;
|
|
|
|
|
2021-02-06 07:29:19 +00:00
|
|
|
if (window.errorLoggingConfig) {
|
2021-05-25 08:40:09 +00:00
|
|
|
Sentry.init({
|
|
|
|
Vue,
|
|
|
|
dsn: window.errorLoggingConfig,
|
|
|
|
integrations: [new Integrations.BrowserTracing()],
|
|
|
|
});
|
2021-02-06 07:29:19 +00:00
|
|
|
}
|
|
|
|
|
2021-09-07 17:41:01 +00:00
|
|
|
if (window.analyticsConfig) {
|
|
|
|
posthog.init(window.analyticsConfig.token, {
|
|
|
|
api_host: window.analyticsConfig.host,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
Vue.use(VueRouter);
|
|
|
|
Vue.use(VueI18n);
|
|
|
|
Vue.use(WootUiKit);
|
|
|
|
Vue.use(Vuelidate);
|
2021-06-06 11:29:05 +00:00
|
|
|
Vue.use(VueFormulate, {
|
|
|
|
rules: {
|
|
|
|
JSON: ({ value }) => isJSONValid(value),
|
|
|
|
},
|
|
|
|
});
|
2021-04-19 05:59:54 +00:00
|
|
|
Vue.use(VTooltip, {
|
|
|
|
defaultHtml: false,
|
|
|
|
});
|
2020-12-04 19:52:16 +00:00
|
|
|
Vue.use(hljs.vuePlugin);
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
Vue.component('multiselect', Multiselect);
|
|
|
|
Vue.component('woot-switch', WootSwitch);
|
|
|
|
Vue.component('woot-wizard', WootWizard);
|
2021-12-01 05:03:18 +00:00
|
|
|
Vue.component('fluent-icon', FluentIcon);
|
2019-08-14 09:48:44 +00:00
|
|
|
|
2020-12-12 06:38:36 +00:00
|
|
|
const i18nConfig = new VueI18n({
|
|
|
|
locale: 'en',
|
|
|
|
messages: i18n,
|
2019-08-14 09:48:44 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
sync(store, router);
|
|
|
|
// load common helpers into js
|
|
|
|
commonHelpers();
|
|
|
|
|
|
|
|
window.WootConstants = constants;
|
|
|
|
window.axios = createAxios(axios);
|
|
|
|
window.bus = new Vue();
|
2021-09-07 17:41:01 +00:00
|
|
|
initializeChatwootEvents();
|
|
|
|
initializeAnalyticsEvents();
|
|
|
|
|
2019-08-21 04:57:57 +00:00
|
|
|
window.onload = () => {
|
2019-08-14 09:48:44 +00:00
|
|
|
window.WOOT = new Vue({
|
|
|
|
router,
|
|
|
|
store,
|
2020-12-12 06:38:36 +00:00
|
|
|
i18n: i18nConfig,
|
2019-08-14 09:48:44 +00:00
|
|
|
components: { App },
|
2019-08-25 05:34:33 +00:00
|
|
|
template: '<App/>',
|
2019-08-14 09:48:44 +00:00
|
|
|
}).$mount('#app');
|
2019-10-24 20:07:01 +00:00
|
|
|
vueActionCable.init();
|
2019-08-21 04:57:57 +00:00
|
|
|
};
|
2021-09-07 17:41:01 +00:00
|
|
|
|
2020-05-05 18:40:56 +00:00
|
|
|
window.addEventListener('load', () => {
|
|
|
|
verifyServiceWorkerExistence(registration =>
|
|
|
|
registration.pushManager.getSubscription().then(subscription => {
|
|
|
|
if (subscription) {
|
|
|
|
registerSubscription();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
2021-03-04 13:54:03 +00:00
|
|
|
getAlertAudio();
|
2021-04-13 13:55:19 +00:00
|
|
|
initFaviconSwitcher();
|
2020-05-05 18:40:56 +00:00
|
|
|
});
|