chore: More mixins migration to single use composables

This commit is contained in:
Fayaz Ahmed
2024-08-07 01:29:11 +05:30
parent 0bd62cf33f
commit 107852b4d9
6 changed files with 415 additions and 0 deletions
@@ -0,0 +1,52 @@
// export default {
// computed: {
// hostURL() {
// return window.chatwootConfig.hostURL;
// },
// vapidPublicKey() {
// return window.chatwootConfig.vapidPublicKey;
// },
// enabledLanguages() {
// return window.chatwootConfig.enabledLanguages;
// },
// isEnterprise() {
// return window.chatwootConfig.isEnterprise === 'true';
// },
// enterprisePlanName() {
// // returns "community" or "enterprise"
// return window.chatwootConfig?.enterprisePlanName;
// },
// },
// };
import { computed } from 'vue';
/**
* Composable for accessing Chatwoot configuration values.
* @returns {Object} An object containing computed properties for various Chatwoot configuration values.
*/
export function useConfig() {
const hostURL = computed(() => window.chatwootConfig.hostURL);
const vapidPublicKey = computed(() => window.chatwootConfig.vapidPublicKey);
const enabledLanguages = computed(
() => window.chatwootConfig.enabledLanguages
);
const isEnterprise = computed(
() => window.chatwootConfig.isEnterprise === 'true'
);
const enterprisePlanName = computed(
() => window.chatwootConfig?.enterprisePlanName
);
return {
hostURL,
vapidPublicKey,
enabledLanguages,
isEnterprise,
enterprisePlanName,
};
}