feat: Vite + vue 3 💚 (#10047)
Fixes https://github.com/chatwoot/chatwoot/issues/8436 Fixes https://github.com/chatwoot/chatwoot/issues/9767 Fixes https://github.com/chatwoot/chatwoot/issues/10156 Fixes https://github.com/chatwoot/chatwoot/issues/6031 Fixes https://github.com/chatwoot/chatwoot/issues/5696 Fixes https://github.com/chatwoot/chatwoot/issues/9250 Fixes https://github.com/chatwoot/chatwoot/issues/9762 --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue';
|
||||
import { defaultPortalFlags } from './index';
|
||||
|
||||
export const types = {
|
||||
@@ -24,9 +23,12 @@ export const mutations = {
|
||||
},
|
||||
|
||||
[types.ADD_PORTAL_ENTRY]($state, portal) {
|
||||
Vue.set($state.portals.byId, portal.slug, {
|
||||
...portal,
|
||||
});
|
||||
$state.portals.byId = {
|
||||
...$state.portals.byId,
|
||||
[portal.slug]: {
|
||||
...portal,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
[types.ADD_MANY_PORTALS_ENTRY]($state, portals) {
|
||||
@@ -34,13 +36,13 @@ export const mutations = {
|
||||
portals.forEach(portal => {
|
||||
allPortals[portal.slug] = portal;
|
||||
});
|
||||
Vue.set($state.portals, 'byId', allPortals);
|
||||
$state.portals.byId = allPortals;
|
||||
},
|
||||
|
||||
[types.CLEAR_PORTALS]: $state => {
|
||||
Vue.set($state.portals, 'byId', {});
|
||||
Vue.set($state.portals, 'allIds', []);
|
||||
Vue.set($state.portals.uiFlags, 'byId', {});
|
||||
$state.portals.byId = {};
|
||||
$state.portals.allIds = [];
|
||||
$state.portals.uiFlags.byId = {};
|
||||
},
|
||||
|
||||
[types.SET_PORTALS_META]: ($state, data) => {
|
||||
@@ -50,10 +52,13 @@ export const mutations = {
|
||||
draft_articles_count: draftArticlesCount = 0,
|
||||
archived_articles_count: archivedArticlesCount = 0,
|
||||
} = data;
|
||||
Vue.set($state.meta, 'allArticlesCount', allArticlesCount);
|
||||
Vue.set($state.meta, 'archivedArticlesCount', archivedArticlesCount);
|
||||
Vue.set($state.meta, 'mineArticlesCount', mineArticlesCount);
|
||||
Vue.set($state.meta, 'draftArticlesCount', draftArticlesCount);
|
||||
$state.meta = {
|
||||
...$state.meta,
|
||||
allArticlesCount,
|
||||
archivedArticlesCount,
|
||||
mineArticlesCount,
|
||||
draftArticlesCount,
|
||||
};
|
||||
},
|
||||
|
||||
[types.ADD_PORTAL_ID]($state, portalSlug) {
|
||||
@@ -68,16 +73,19 @@ export const mutations = {
|
||||
const portalSlug = portal.slug;
|
||||
if (!$state.portals.allIds.includes(portalSlug)) return;
|
||||
|
||||
Vue.set($state.portals.byId, portalSlug, {
|
||||
...portal,
|
||||
});
|
||||
$state.portals.byId = {
|
||||
...$state.portals.byId,
|
||||
[portalSlug]: {
|
||||
...portal,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
[types.REMOVE_PORTAL_ENTRY]($state, portalSlug) {
|
||||
if (!portalSlug) return;
|
||||
|
||||
const { [portalSlug]: toBeRemoved, ...newById } = $state.portals.byId;
|
||||
Vue.set($state.portals, 'byId', newById);
|
||||
$state.portals.byId = newById;
|
||||
},
|
||||
|
||||
[types.REMOVE_PORTAL_ID]($state, portalSlug) {
|
||||
@@ -88,10 +96,13 @@ export const mutations = {
|
||||
|
||||
[types.SET_HELP_PORTAL_UI_FLAG]($state, { portalSlug, uiFlags }) {
|
||||
const flags = $state.portals.uiFlags.byId[portalSlug];
|
||||
Vue.set($state.portals.uiFlags.byId, portalSlug, {
|
||||
...defaultPortalFlags,
|
||||
...flags,
|
||||
...uiFlags,
|
||||
});
|
||||
$state.portals.uiFlags.byId = {
|
||||
...$state.portals.uiFlags.byId,
|
||||
[portalSlug]: {
|
||||
...defaultPortalFlags,
|
||||
...flags,
|
||||
...uiFlags,
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user