n8n/packages/editor-ui/src/main.ts
Ricardo Espinoza 725393dae6
feat(editor): Add user activation survey (#5677)
*  Add user activation survey

* Fix typo

* Avoid showing the modal when there is a modal view

* Allow to redirect to specific execution

* Improve structure

* Handle errors when sharing feedback

* update withFeatureFlag function

* Fix linting issue

* Set user activation flag on workflowExecutionCompleted event

* Revert update user settings functionality

* Remove unnecessary changes

* fix linting issue

* account for new functionality in tests

* Small improvements

* keep once instace of the model open between tabs

* Add sorting to GET /executions

* type parameters for GET /executions


a

* Add constant for local store key

* Add execution mode filtering

* fix linting issue

* Do not override settings when setting isOnboarded true

* Add update user settings endpoint

* improvements

* revert changes to /GET executions

* Fix typo

* Add userActivated flag to user store

* Add E2E test

* Fix linting issue

* Update pnpm-lock

* Revert unnecessary change

* Centralize user's settings update

* Remove unused ref in userActivationSurvey modal

* Use aliased imports

* Use createEventBus function in component

* Fix tests
2023-04-11 12:43:47 -04:00

72 lines
2.2 KiB
TypeScript

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import './plugins';
import 'prismjs';
import 'prismjs/themes/prism.css';
import 'vue-prism-editor/dist/VuePrismEditor.css';
import 'vue-json-pretty/lib/styles.css';
import '@jsplumb/browser-ui/css/jsplumbtoolkit.css';
import 'n8n-design-system/css/index.scss';
import './n8n-theme.scss';
import './styles/autocomplete-theme.scss';
import '@fontsource/open-sans/latin-400.css';
import '@fontsource/open-sans/latin-600.css';
import '@fontsource/open-sans/latin-700.css';
import App from '@/App.vue';
import router from './router';
import { runExternalHook } from '@/mixins/externalHooks';
import { TelemetryPlugin } from './plugins/telemetry';
import { I18nPlugin, i18nInstance } from './plugins/i18n';
import { createPinia, PiniaVuePlugin } from 'pinia';
import { useWebhooksStore } from './stores/webhooks';
import { useUsersStore } from './stores/users';
import { VIEWS } from '@/constants';
import { useUIStore } from './stores/ui';
Vue.config.productionTip = false;
Vue.use(TelemetryPlugin);
Vue.use((vue) => I18nPlugin(vue));
Vue.use(PiniaVuePlugin);
const pinia = createPinia();
new Vue({
i18n: i18nInstance,
router,
pinia,
render: (h) => h(App),
}).$mount('#app');
router.afterEach((to, from) => {
runExternalHook('main.routeChange', useWebhooksStore(), { from, to });
const userStore = useUsersStore();
if (userStore.currentUser && to.name && to.name !== VIEWS.SIGNOUT && !to.name.includes('Modal')) {
setTimeout(() => {
userStore.showUserActivationSurveyModal();
}, 500);
}
});
if (!import.meta.env.PROD) {
// Make sure that we get all error messages properly displayed
// as long as we are not in production mode
window.onerror = (message, source, lineno, colno, error) => {
if (message.toString().includes('ResizeObserver')) {
// That error can apparently be ignored and can probably
// not do anything about it anyway
return;
}
console.error('error caught in main.ts'); // eslint-disable-line no-console
console.error(message); // eslint-disable-line no-console
console.error(error); // eslint-disable-line no-console
};
}