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/
102 lines
2.2 KiB
Vue
102 lines
2.2 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import ChannelSelector from '../ChannelSelector.vue';
|
|
|
|
const props = defineProps({
|
|
channel: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
enabledFeatures: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
const emit = defineEmits(['channelItemClick']);
|
|
|
|
const hasFbConfigured = computed(() => {
|
|
return window.chatwootConfig?.fbAppId;
|
|
});
|
|
|
|
const hasInstagramConfigured = computed(() => {
|
|
return window.chatwootConfig?.instagramAppId;
|
|
});
|
|
|
|
const hasTiktokConfigured = computed(() => {
|
|
return window.chatwootConfig?.tiktokAppId;
|
|
});
|
|
|
|
const isActive = computed(() => {
|
|
const { key } = props.channel;
|
|
if (Object.keys(props.enabledFeatures).length === 0) {
|
|
return false;
|
|
}
|
|
if (key === 'website') {
|
|
return props.enabledFeatures.channel_website;
|
|
}
|
|
if (key === 'facebook') {
|
|
return props.enabledFeatures.channel_facebook && hasFbConfigured.value;
|
|
}
|
|
if (key === 'email') {
|
|
return props.enabledFeatures.channel_email;
|
|
}
|
|
|
|
if (key === 'instagram') {
|
|
return (
|
|
props.enabledFeatures.channel_instagram && hasInstagramConfigured.value
|
|
);
|
|
}
|
|
|
|
if (key === 'tiktok') {
|
|
return props.enabledFeatures.channel_tiktok && hasTiktokConfigured.value;
|
|
}
|
|
|
|
if (key === 'voice') {
|
|
return props.enabledFeatures.channel_voice;
|
|
}
|
|
|
|
return [
|
|
'website',
|
|
'twilio',
|
|
'api',
|
|
'whatsapp',
|
|
'sms',
|
|
'telegram',
|
|
'line',
|
|
'instagram',
|
|
'tiktok',
|
|
'voice',
|
|
].includes(key);
|
|
});
|
|
|
|
const isComingSoon = computed(() => {
|
|
const { key } = props.channel;
|
|
// Show "Coming Soon" only if the channel is marked as coming soon
|
|
// and the corresponding feature flag is not enabled yet.
|
|
return ['voice'].includes(key) && !isActive.value;
|
|
});
|
|
|
|
const isBeta = computed(() => {
|
|
return ['tiktok', 'voice'].includes(props.channel.key);
|
|
});
|
|
|
|
const onItemClick = () => {
|
|
if (isActive.value) {
|
|
emit('channelItemClick', props.channel.key);
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<ChannelSelector
|
|
:title="channel.title"
|
|
:description="channel.description"
|
|
:icon="channel.icon"
|
|
:is-coming-soon="isComingSoon"
|
|
:is-beta="isBeta"
|
|
:disabled="!isActive"
|
|
@click="onItemClick"
|
|
/>
|
|
</template>
|