Copy the Chatwoot (v4.14.0) frontend runnable subset into frontend/ for customization: - app/javascript/ (Vue SPA: dashboard, widget, sdk, portal, superadmin) - app/views/ (ERB templates for vite-plugin-ruby entrypoint resolution) - app/helpers/, app/assets/ (Rails view helpers, static assets) - enterprise/ (Enterprise edition frontend overlay) - config/vite.json, vite.config.ts, bin/vite (Vite-Rails toolchain) - package.json, pnpm-lock.yaml, tailwind/postcss/eslint configs - Gemfile, Gemfile.lock (vite_rails gem for bin/vite binstub) Excluded Rails backend: controllers, models, services, jobs, mailers, policies, db, lib, spec, public, node_modules. Update references to the new frontend location: - .gitignore: exclude frontend build artifacts (node_modules, tmp, packs), keep frontend/bin/ and frontend/vendor/ via negation - backend/scripts/parity_frontend_smoke.sh: CHATWOOT_DIR default reference/chatwoot -> ../frontend - backend/scripts/parity_frontend_browser_smoke.mjs: same default update - AGENTS.md: add frontend section with Rails/Vite coupling notes - README: architecture tree includes frontend/
77 lines
1.9 KiB
Vue
77 lines
1.9 KiB
Vue
<script>
|
|
import { useBranding } from 'shared/composables/useBranding';
|
|
|
|
const {
|
|
LOGO_THUMBNAIL: logoThumbnail,
|
|
BRAND_NAME: brandName,
|
|
WIDGET_BRAND_URL: widgetBrandURL,
|
|
} = window.globalConfig || {};
|
|
|
|
export default {
|
|
props: {
|
|
disableBranding: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
setup() {
|
|
const { replaceInstallationName } = useBranding();
|
|
return {
|
|
replaceInstallationName,
|
|
};
|
|
},
|
|
data() {
|
|
return {
|
|
globalConfig: {
|
|
brandName,
|
|
logoThumbnail,
|
|
widgetBrandURL,
|
|
},
|
|
};
|
|
},
|
|
computed: {
|
|
brandRedirectURL() {
|
|
try {
|
|
const referrerHost = this.$store.getters['appConfig/getReferrerHost'];
|
|
const url = new URL(this.globalConfig.widgetBrandURL);
|
|
if (referrerHost) {
|
|
url.searchParams.set('utm_source', referrerHost);
|
|
url.searchParams.set('utm_medium', 'widget');
|
|
} else {
|
|
url.searchParams.set('utm_medium', 'survey');
|
|
}
|
|
url.searchParams.set('utm_campaign', 'branding');
|
|
return url.toString();
|
|
} catch (e) {
|
|
// Suppressing the error as getter is not defined in some cases
|
|
}
|
|
return '';
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div
|
|
v-if="globalConfig.brandName && !disableBranding"
|
|
class="px-0 py-3 flex justify-center"
|
|
>
|
|
<a
|
|
:href="brandRedirectURL"
|
|
rel="noreferrer noopener nofollow"
|
|
target="_blank"
|
|
class="branding--link text-n-slate-11 hover:text-n-slate-12 cursor-pointer text-xs inline-flex grayscale-[1] hover:grayscale-0 hover:opacity-100 opacity-90 no-underline justify-center items-center leading-3"
|
|
>
|
|
<img
|
|
class="ltr:mr-1 rtl:ml-1 max-w-3 max-h-3"
|
|
:alt="globalConfig.brandName"
|
|
:src="globalConfig.logoThumbnail"
|
|
/>
|
|
<span>
|
|
{{ replaceInstallationName($t('POWERED_BY')) }}
|
|
</span>
|
|
</a>
|
|
</div>
|
|
<div v-else class="p-3" />
|
|
</template>
|