diff --git a/app/javascript/dashboard/modules/widget-preview/components/Widget.vue b/app/javascript/dashboard/modules/widget-preview/components/Widget.vue
index 81f44a5eb..d07ae9f13 100644
--- a/app/javascript/dashboard/modules/widget-preview/components/Widget.vue
+++ b/app/javascript/dashboard/modules/widget-preview/components/Widget.vue
@@ -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 { useGlobalConfig } from 'shared/composables/useGlobalConfig';
+import { useInstallationName } from 'shared/helpers/installationHelper';
import { mapGetters } from 'vuex';
export default {
@@ -56,12 +56,6 @@ export default {
default: '',
},
},
- setup() {
- const { useInstallationName } = useGlobalConfig();
- return {
- useInstallationName,
- };
- },
data() {
return {
widgetScreens: [
@@ -149,6 +143,7 @@ export default {
this.isWidgetVisible = !this.isWidgetVisible;
this.isDefaultScreen = true;
},
+ useInstallationName,
},
};
diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/NewPortal.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/NewPortal.vue
index 7c16a8625..921ea5baf 100644
--- a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/NewPortal.vue
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/NewPortal.vue
@@ -1,17 +1,11 @@
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue
index d603f3e16..3a4b1623e 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue
@@ -3,19 +3,13 @@ import ChannelItem from 'dashboard/components/widgets/ChannelItem.vue';
import router from '../../../index';
import PageHeader from '../SettingsSubPageHeader.vue';
import { mapGetters } from 'vuex';
-import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
+import { useInstallationName } from 'shared/helpers/installationHelper';
export default {
components: {
ChannelItem,
PageHeader,
},
- setup() {
- const { useInstallationName } = useGlobalConfig();
- return {
- useInstallationName,
- };
- },
data() {
return {
enabledFeatures: {},
@@ -61,6 +55,7 @@ export default {
};
router.push({ name: 'settings_inboxes_page_channel', params });
},
+ useInstallationName,
},
};
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/InboxChannels.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/InboxChannels.vue
index f58708826..aa8f56bd6 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/InboxChannels.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/InboxChannels.vue
@@ -1,14 +1,8 @@
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Index.vue
index a21a54e44..fe3c8265a 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Index.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Index.vue
@@ -4,7 +4,7 @@ import { useAlert } from 'dashboard/composables';
import { useAdmin } from 'dashboard/composables/useAdmin';
import { useAccount } from 'dashboard/composables/useAccount';
import Settings from './Settings.vue';
-import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
+import { useInstallationName } from 'shared/helpers/installationHelper';
export default {
components: {
@@ -13,11 +13,9 @@ export default {
setup() {
const { isAdmin } = useAdmin();
const { accountScopedUrl } = useAccount();
- const { useInstallationName } = useGlobalConfig();
return {
isAdmin,
accountScopedUrl,
- useInstallationName,
};
},
data() {
@@ -56,6 +54,7 @@ export default {
},
},
methods: {
+ useInstallationName,
twilioChannelName(item) {
const { medium = '' } = item;
if (medium === 'whatsapp') return 'WhatsApp';
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Facebook.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Facebook.vue
index f813f1727..2c332c01e 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Facebook.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Facebook.vue
@@ -10,7 +10,7 @@ import { mapGetters } from 'vuex';
import ChannelApi from '../../../../../api/channels';
import PageHeader from '../../SettingsSubPageHeader.vue';
import router from '../../../../index';
-import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
+import { useInstallationName } from 'shared/helpers/installationHelper';
import { loadScript } from 'dashboard/helper/DOMHelpers';
import * as Sentry from '@sentry/browser';
@@ -21,10 +21,8 @@ export default {
PageHeader,
},
setup() {
- const { useInstallationName } = useGlobalConfig();
const { accountId } = useAccount();
return {
- useInstallationName,
accountId,
v$: useVuelidate(),
};
@@ -75,6 +73,7 @@ export default {
},
methods: {
+ useInstallationName,
async startLogin() {
this.hasLoginStarted = true;
try {
diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Integration.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/Integration.vue
index 6bb55596a..faedfdddb 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Integration.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Integration.vue
@@ -2,7 +2,7 @@
import { mapGetters } from 'vuex';
import { frontendURL } from '../../../../helper/URLHelper';
import { useAlert } from 'dashboard/composables';
-import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
+import { useInstallationName } from 'shared/helpers/installationHelper';
export default {
props: {
@@ -17,12 +17,6 @@ export default {
actionButtonText: { type: String, default: '' },
deleteConfirmationText: { type: Object, default: () => ({}) },
},
- setup() {
- const { useInstallationName } = useGlobalConfig();
- return {
- useInstallationName,
- };
- },
data() {
return {
showDeleteConfirmationPopup: false,
@@ -35,6 +29,7 @@ export default {
}),
},
methods: {
+ useInstallationName,
frontendURL,
openDeletePopup() {
this.showDeleteConfirmationPopup = true;
diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/IntegrationItem.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/IntegrationItem.vue
index 0cd9189d6..2c9f17d3f 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/integrations/IntegrationItem.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/IntegrationItem.vue
@@ -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 { useGlobalConfig } from 'shared/composables/useGlobalConfig';
+import { useInstallationName } from 'shared/helpers/installationHelper';
const props = defineProps({
id: {
@@ -24,7 +24,6 @@ const props = defineProps({
},
});
-const { useInstallationName } = useGlobalConfig();
const getters = useStoreGetters();
const accountId = getters.getCurrentAccountId;
const globalConfig = getters['globalConfig/get'];
diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Slack/SelectChannelWarning.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/Slack/SelectChannelWarning.vue
index d3cc2ef62..585d7d209 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Slack/SelectChannelWarning.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Slack/SelectChannelWarning.vue
@@ -1,7 +1,7 @@
diff --git a/app/javascript/shared/composables/useGlobalConfig.js b/app/javascript/shared/composables/useGlobalConfig.js
deleted file mode 100644
index 7869437a2..000000000
--- a/app/javascript/shared/composables/useGlobalConfig.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Composable for using the installation name in the application.
- * @param {string} str - The string to be processed.
- * @param {string} installationName - The installation name.
- * @returns {string} The processed string with the installation name.
- */
-
-export const useGlobalConfig = () => {
- const useInstallationName = (str, installationName) => {
- if (str && installationName) {
- return str.replace(/Chatwoot/g, installationName);
- }
- return str;
- };
- return {
- useInstallationName,
- };
-};
diff --git a/app/javascript/shared/helpers/installationNameHelper.js b/app/javascript/shared/helpers/installationNameHelper.js
new file mode 100644
index 000000000..8fa25dfeb
--- /dev/null
+++ b/app/javascript/shared/helpers/installationNameHelper.js
@@ -0,0 +1,14 @@
+/**
+ * Replaces occurrences of "Chatwoot" with the provided installation name in a given string.
+ *
+ * @param {string} str - The original string that may contain "Chatwoot".
+ * @param {string} installationName - The name to replace "Chatwoot" with.
+ * @returns {string} The modified string with "Chatwoot" replaced by the installation name,
+ * or the original string if either input is falsy.
+ */
+export const useInstallationName = (str, installationName) => {
+ if (str && installationName) {
+ return str.replace(/Chatwoot/g, installationName);
+ }
+ return str;
+};
diff --git a/app/javascript/shared/composables/specs/useGlobalConfig.spec.js b/app/javascript/shared/helpers/specs/installanationNameHelper.spec.js
similarity index 76%
rename from app/javascript/shared/composables/specs/useGlobalConfig.spec.js
rename to app/javascript/shared/helpers/specs/installanationNameHelper.spec.js
index 304db96a4..571547d35 100644
--- a/app/javascript/shared/composables/specs/useGlobalConfig.spec.js
+++ b/app/javascript/shared/helpers/specs/installanationNameHelper.spec.js
@@ -1,10 +1,9 @@
-import { useGlobalConfig } from '../useGlobalConfig';
+import { useInstallationName } from '../installationNameHelper';
-describe('useGlobalConfig', () => {
+describe('installationNameHelper', () => {
it('should return the string with the installation name', () => {
const str = 'Chatwoot is awesome';
const installationName = 'Acme Inc';
- const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Acme Inc is awesome'
);
@@ -13,7 +12,6 @@ describe('useGlobalConfig', () => {
it('should return the string without the installation name', () => {
const str = 'Chatwoot is awesome';
const installationName = '';
- const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Chatwoot is awesome'
);
@@ -22,7 +20,6 @@ describe('useGlobalConfig', () => {
it('should handle null installation name properly', () => {
const str = 'Chatwoot is super cool';
const installationName = null;
- const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Chatwoot is super cool'
);
@@ -31,7 +28,6 @@ describe('useGlobalConfig', () => {
it('should handle undefined installation name properly', () => {
const str = 'Chatwoot is super cool';
const installationName = undefined;
- const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Chatwoot is super cool'
);
diff --git a/app/javascript/v3/views/auth/reset/password/Index.vue b/app/javascript/v3/views/auth/reset/password/Index.vue
index a07f46f5b..663302bb8 100644
--- a/app/javascript/v3/views/auth/reset/password/Index.vue
+++ b/app/javascript/v3/views/auth/reset/password/Index.vue
@@ -3,7 +3,7 @@ import { useVuelidate } from '@vuelidate/core';
import { mapGetters } from 'vuex';
import { useAlert } from 'dashboard/composables';
import { required, minLength, email } from '@vuelidate/validators';
-import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
+import { useInstallationName } from 'shared/helpers/installationHelper';
import FormInput from '../../../../components/Form/Input.vue';
import { resetPassword } from '../../../../api/auth';
import SubmitButton from '../../../../components/Button/SubmitButton.vue';
@@ -11,8 +11,7 @@ import SubmitButton from '../../../../components/Button/SubmitButton.vue';
export default {
components: { FormInput, SubmitButton },
setup() {
- const { useInstallationName } = useGlobalConfig();
- return { v$: useVuelidate(), useInstallationName };
+ return { v$: useVuelidate() };
},
data() {
return {
@@ -37,6 +36,7 @@ export default {
},
},
methods: {
+ useInstallationName,
showAlertMessage(message) {
// Reset loading, current selected agent
this.resetPassword.showLoading = false;
diff --git a/app/javascript/v3/views/auth/signup/Index.vue b/app/javascript/v3/views/auth/signup/Index.vue
index 09898765d..3da99ee29 100644
--- a/app/javascript/v3/views/auth/signup/Index.vue
+++ b/app/javascript/v3/views/auth/signup/Index.vue
@@ -1,6 +1,6 @@