2021-02-07 07:24:32 +00:00
|
|
|
import { mapGetters } from 'vuex';
|
2021-11-13 07:02:53 +00:00
|
|
|
export const DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER = [
|
2021-11-15 05:04:57 +00:00
|
|
|
{ name: 'conversation_actions' },
|
2021-11-13 07:02:53 +00:00
|
|
|
{ name: 'conversation_info' },
|
|
|
|
{ name: 'contact_attributes' },
|
|
|
|
{ name: 'previous_conversation' },
|
|
|
|
];
|
|
|
|
export const DEFAULT_CONTACT_SIDEBAR_ITEMS_ORDER = [
|
|
|
|
{ name: 'contact_attributes' },
|
|
|
|
{ name: 'contact_labels' },
|
|
|
|
{ name: 'previous_conversation' },
|
|
|
|
];
|
2021-02-07 07:24:32 +00:00
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
|
|
|
uiSettings: 'getUISettings',
|
|
|
|
}),
|
2021-11-13 07:02:53 +00:00
|
|
|
conversationSidebarItemsOrder() {
|
|
|
|
const { conversation_sidebar_items_order: itemsOrder } = this.uiSettings;
|
|
|
|
return itemsOrder || DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER;
|
|
|
|
},
|
|
|
|
contactSidebarItemsOrder() {
|
|
|
|
const { contact_sidebar_items_order: itemsOrder } = this.uiSettings;
|
|
|
|
return itemsOrder || DEFAULT_CONTACT_SIDEBAR_ITEMS_ORDER;
|
|
|
|
},
|
2021-02-07 07:24:32 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
updateUISettings(uiSettings = {}) {
|
|
|
|
this.$store.dispatch('updateUISettings', {
|
|
|
|
uiSettings: {
|
|
|
|
...this.uiSettings,
|
|
|
|
...uiSettings,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
2021-09-13 12:38:58 +00:00
|
|
|
isContactSidebarItemOpen(key) {
|
|
|
|
const { [key]: isOpen } = this.uiSettings;
|
|
|
|
return !!isOpen;
|
|
|
|
},
|
|
|
|
toggleSidebarUIState(key) {
|
|
|
|
this.updateUISettings({ [key]: !this.isContactSidebarItemOpen(key) });
|
|
|
|
},
|
2021-02-07 07:24:32 +00:00
|
|
|
},
|
|
|
|
};
|