Chatwoot/app/javascript/widget/store/modules/appConfig.js

45 lines
829 B
JavaScript
Raw Normal View History

import { SET_WIDGET_COLOR } from '../types';
const state = {
widgetColor: '',
2021-09-29 08:58:32 +00:00
widgetSettings: {
showPopoutButton: false,
widgetPosition: 'right',
isChatTriggerHidden: false,
},
};
const getters = {
getWidgetColor: $state => $state.widgetColor,
2021-09-29 08:58:32 +00:00
getWidgetSettings: $state => $state.widgetSettings,
};
const actions = {
setWidgetColor({ commit }, data) {
commit(SET_WIDGET_COLOR, data);
},
2021-09-29 08:58:32 +00:00
setWidgetSettings({ commit }, settings) {
commit('widgetSettings', settings);
},
};
const mutations = {
[SET_WIDGET_COLOR]($state, data) {
$state.widgetColor = data.widgetColor;
},
2021-09-29 08:58:32 +00:00
widgetSettings($state, settings) {
$state.uiFlags = {
...$state.widgetSettings,
...settings,
};
},
};
export default {
namespaced: true,
state,
getters,
actions,
mutations,
};