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
@@ -29,9 +29,13 @@ window.chatwootConfig = Object.assign(
window.globalConfig = Object.assign(
{
INSTALLATION_NAME: 'GoChat',
BRAND_NAME: 'GoChat',
CREATE_NEW_ACCOUNT_FROM_DASHBOARD: false,
DISPLAY_MANIFEST: false,
LOGO_THUMBNAIL: '/favicon-32x32.png',
LOGO: '/brand-assets/logo.svg',
LOGO_DARK: '/brand-assets/logo_dark.svg',
LOGO_THUMBNAIL: '/brand-assets/logo_thumbnail.svg',
WIDGET_BRAND_URL: '/',
},
config.globalConfig || {}
);
@@ -0,0 +1,38 @@
import { readFileSync } from 'node:fs';
import { runInNewContext } from 'node:vm';
const customBrand = {
INSTALLATION_NAME: 'Acme Support',
BRAND_NAME: 'Acme',
LOGO: '/acme/logo.svg',
LOGO_DARK: '/acme/logo-dark.svg',
LOGO_THUMBNAIL: '/acme/icon.svg',
};
const initializeEntrypoint = filename => {
const html = readFileSync(filename, 'utf8');
const inlineScript = html.match(/<script>\s*([\s\S]*?)<\/script>/);
const runtimeConfigIndex = html.indexOf('/runtime-config.js');
expect(runtimeConfigIndex).toBeGreaterThan(-1);
expect(runtimeConfigIndex).toBeLessThan(inlineScript.index);
const entrypointWindow = {
__GOCHAT_CONFIG__: { globalConfig: customBrand },
location: { search: '' },
};
runInNewContext(inlineScript[1], {
window: entrypointWindow,
navigator: { userAgent: 'test' },
URLSearchParams,
localStorage: { getItem: () => null, setItem: () => {} },
});
return entrypointWindow.globalConfig;
};
it.each(['widget.html', 'super_admin.html'])(
'applies custom runtime branding in %s',
filename => {
expect(initializeEntrypoint(filename)).toMatchObject(customBrand);
}
);