HH-530: replace user-facing Chatwoot branding with GoChat (#117)

* fix(HH-530): replace user-facing Chatwoot branding

* fix(HH-530): close branding review blockers

* test(HH-530): cover update banner binding

---------

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-23 18:14:02 +08:00
committed by GitHub
co-authored by rogee
parent a635be6dc8
commit 867092fd99
107 changed files with 343 additions and 237 deletions
@@ -24,38 +24,46 @@ describe('useBranding', () => {
});
describe('replaceInstallationName', () => {
it('should replace "Chatwoot" with installation name when both text and installation name are provided', () => {
it('should replace "GoChat" with the installation name', () => {
const { replaceInstallationName } = useBranding();
const result = replaceInstallationName('Welcome to Chatwoot');
const result = replaceInstallationName('Welcome to GoChat');
expect(result).toBe('Welcome to MyCompany');
});
it('should replace multiple occurrences of "Chatwoot"', () => {
it('should replace multiple occurrences of "GoChat"', () => {
const { replaceInstallationName } = useBranding();
const result = replaceInstallationName(
'Chatwoot is great! Use Chatwoot today.'
'GoChat is great! Use GoChat today.'
);
expect(result).toBe('MyCompany is great! Use MyCompany today.');
});
it('should preserve legacy Chatwoot placeholders for custom branding', () => {
const { replaceInstallationName } = useBranding();
expect(replaceInstallationName('Welcome to Chatwoot')).toBe(
'Welcome to MyCompany'
);
});
it('should return original text when installation name is not provided', () => {
mockGlobalConfig.value = {};
const { replaceInstallationName } = useBranding();
const result = replaceInstallationName('Welcome to Chatwoot');
const result = replaceInstallationName('Welcome to GoChat');
expect(result).toBe('Welcome to Chatwoot');
expect(result).toBe('Welcome to GoChat');
});
it('should return original text when globalConfig is not available', () => {
mockGlobalConfig.value = undefined;
const { replaceInstallationName } = useBranding();
const result = replaceInstallationName('Welcome to Chatwoot');
const result = replaceInstallationName('Welcome to GoChat');
expect(result).toBe('Welcome to Chatwoot');
expect(result).toBe('Welcome to GoChat');
});
it('should return original text when text is empty or null', () => {
@@ -88,7 +96,7 @@ describe('useBranding', () => {
};
const { replaceInstallationName } = useBranding();
const result = replaceInstallationName('Welcome to Chatwoot');
const result = replaceInstallationName('Welcome to GoChat');
expect(result).toBe('Welcome to My-Company & Co.');
});
@@ -7,9 +7,9 @@ import { useMapGetter } from 'dashboard/composables/store.js';
export function useBranding() {
const globalConfig = useMapGetter('globalConfig/get');
/**
* Replaces "Chatwoot" in text with the installation name from global config
* Replaces the default product name in text with the configured installation name
* @param {string} text - The text to process
* @returns {string} - Text with "Chatwoot" replaced by installation name
* @returns {string} - Text with the default product name replaced
*/
const replaceInstallationName = text => {
if (!text) return text;
@@ -17,7 +17,7 @@ export function useBranding() {
const installationName = globalConfig.value?.installationName;
if (!installationName) return text;
return text.replace(/Chatwoot/g, installationName);
return text.replace(/GoChat|Chatwoot/g, installationName);
};
return {