chore: Replace globalConfig Mixin with useGlobalConfig Composable

This commit is contained in:
Fayaz Ahmed
2024-08-20 07:53:21 +05:30
parent 8473e72a7e
commit c798474f2b
18 changed files with 142 additions and 42 deletions
@@ -3,7 +3,7 @@ import WidgetHead from './WidgetHead.vue';
import WidgetBody from './WidgetBody.vue';
import WidgetFooter from './WidgetFooter.vue';
import InputRadioGroup from 'dashboard/routes/dashboard/settings/inbox/components/InputRadioGroup.vue';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
import { mapGetters } from 'vuex';
export default {
@@ -14,7 +14,6 @@ export default {
WidgetFooter,
InputRadioGroup,
},
mixins: [globalConfigMixin],
props: {
welcomeHeading: {
type: String,
@@ -57,6 +56,12 @@ export default {
default: '',
},
},
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
data() {
return {
widgetScreens: [
@@ -1,12 +1,17 @@
<script>
import { mapGetters } from 'vuex';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
import SettingsHeader from 'dashboard/routes/dashboard/settings/SettingsHeader.vue';
export default {
components: {
SettingsHeader,
},
mixins: [globalConfigMixin],
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
computed: {
...mapGetters({
globalConfig: 'globalConfig/get',
@@ -3,14 +3,19 @@ import ChannelItem from 'dashboard/components/widgets/ChannelItem.vue';
import router from '../../../index';
import PageHeader from '../SettingsSubPageHeader.vue';
import { mapGetters } from 'vuex';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
export default {
components: {
ChannelItem,
PageHeader,
},
mixins: [globalConfigMixin],
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
data() {
return {
enabledFeatures: {},
@@ -1,9 +1,14 @@
<script>
import { mapGetters } from 'vuex';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
export default {
mixins: [globalConfigMixin],
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
computed: {
...mapGetters({
globalConfig: 'globalConfig/get',
@@ -4,19 +4,20 @@ import { useAlert } from 'dashboard/composables';
import { useAdmin } from 'dashboard/composables/useAdmin';
import { useAccount } from 'dashboard/composables/useAccount';
import Settings from './Settings.vue';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
export default {
components: {
Settings,
},
mixins: [globalConfigMixin],
setup() {
const { isAdmin } = useAdmin();
const { accountScopedUrl } = useAccount();
const { useInstallationName } = useGlobalConfig();
return {
isAdmin,
accountScopedUrl,
useInstallationName,
};
},
data() {
@@ -10,7 +10,7 @@ import { mapGetters } from 'vuex';
import ChannelApi from '../../../../../api/channels';
import PageHeader from '../../SettingsSubPageHeader.vue';
import router from '../../../../index';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
import { loadScript } from 'dashboard/helper/DOMHelpers';
import * as Sentry from '@sentry/browser';
@@ -20,10 +20,11 @@ export default {
LoadingState,
PageHeader,
},
mixins: [globalConfigMixin],
setup() {
const { useInstallationName } = useGlobalConfig();
const { accountId } = useAccount();
return {
useInstallationName,
accountId,
v$: useVuelidate(),
};
@@ -2,10 +2,9 @@
import { mapGetters } from 'vuex';
import { frontendURL } from '../../../../helper/URLHelper';
import { useAlert } from 'dashboard/composables';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
export default {
mixins: [globalConfigMixin],
props: {
integrationId: {
type: [String, Number],
@@ -18,6 +17,12 @@ export default {
actionButtonText: { type: String, default: '' },
deleteConfirmationText: { type: Object, default: () => ({}) },
},
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
data() {
return {
showDeleteConfirmationPopup: false,
@@ -3,7 +3,7 @@ import { computed } from 'vue';
import { useStoreGetters } from 'dashboard/composables/store';
import { useI18n } from 'dashboard/composables/useI18n';
import { frontendURL } from 'dashboard/helper/URLHelper';
import { useInstallationName } from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
const props = defineProps({
id: {
@@ -24,6 +24,7 @@ const props = defineProps({
},
});
const { useInstallationName } = useGlobalConfig();
const getters = useStoreGetters();
const accountId = getters.getCurrentAccountId;
const globalConfig = getters['globalConfig/get'];
@@ -1,17 +1,23 @@
<script>
import { mapGetters } from 'vuex';
import { useAlert } from 'dashboard/composables';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
export default {
mixins: [globalConfigMixin, messageFormatterMixin],
mixins: [messageFormatterMixin],
props: {
hasConnectedAChannel: {
type: Boolean,
default: true,
},
},
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
data() {
return { selectedChannelId: '', availableChannels: [] };
},
@@ -3,7 +3,7 @@ import { mapGetters } from 'vuex';
import { useAlert } from 'dashboard/composables';
import NewWebhook from './NewWebHook.vue';
import EditWebhook from './EditWebHook.vue';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
import WebhookRow from './WebhookRow.vue';
export default {
@@ -12,7 +12,12 @@ export default {
EditWebhook,
WebhookRow,
},
mixins: [globalConfigMixin],
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
data() {
return {
loading: {},
@@ -1,18 +1,23 @@
<script>
import { useAlert } from 'dashboard/composables';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
import { mapGetters } from 'vuex';
import WebhookForm from './WebhookForm.vue';
export default {
components: { WebhookForm },
mixins: [globalConfigMixin],
props: {
onClose: {
type: Function,
required: true,
},
},
setup() {
const { useInstallationName } = useGlobalConfig();
return {
useInstallationName,
};
},
computed: {
...mapGetters({
globalConfig: 'globalConfig/get',
@@ -4,7 +4,7 @@ import { useAlert } from 'dashboard/composables';
import { useUISettings } from 'dashboard/composables/useUISettings';
import { clearCookiesOnLogout } from 'dashboard/store/utils/api.js';
import { copyTextToClipboard } from 'shared/helpers/clipboard';
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
import UserProfilePicture from './UserProfilePicture.vue';
import UserBasicDetails from './UserBasicDetails.vue';
import MessageSignature from './MessageSignature.vue';
@@ -27,8 +27,8 @@ export default {
AudioNotifications,
AccessToken,
},
mixins: [globalConfigMixin],
setup() {
const { useInstallationName } = useGlobalConfig();
const { uiSettings, updateUISettings, isEditorHotKeyEnabled } =
useUISettings();
@@ -36,6 +36,7 @@ export default {
uiSettings,
updateUISettings,
isEditorHotKeyEnabled,
useInstallationName,
};
},
data() {