chore: add basic config

This commit is contained in:
Muhsin Keloth
2025-04-21 19:43:11 +05:30
parent cce1b874c1
commit b2a1e3282c
13 changed files with 118 additions and 1 deletions
@@ -45,6 +45,8 @@ class SuperAdmin::AppConfigsController < SuperAdmin::ApplicationController
%w[LINEAR_CLIENT_ID LINEAR_CLIENT_SECRET]
when 'instagram'
%w[INSTAGRAM_APP_ID INSTAGRAM_APP_SECRET INSTAGRAM_VERIFY_TOKEN INSTAGRAM_API_VERSION ENABLE_INSTAGRAM_CHANNEL_HUMAN_AGENT]
when 'github'
%w[GITHUB_CLIENT_ID GITHUB_CLIENT_SECRET]
else
%w[ENABLE_ACCOUNT_SIGNUP FIREBASE_PROJECT_ID FIREBASE_CREDENTIALS]
end
@@ -15,6 +15,14 @@
},
"ERROR": "There was an error connecting to Shopify. Please try again or contact support if the issue persists."
},
"GITHUB": {
"TITLE": "Connect Github",
"LABEL": "Github Client ID",
"PLACEHOLDER": "Enter your Github Client ID",
"HELP": "Enter your Github Client ID",
"CANCEL": "Cancel",
"SUBMIT": "Connect"
},
"HEADER": "Integrations",
"DESCRIPTION": "Chatwoot integrates with multiple tools and services to improve your team's efficiency. Explore the list below to configure your favorite apps.",
"LEARN_MORE": "Learn more about integrations",
@@ -0,0 +1,57 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import {
useFunctionGetter,
useMapGetter,
useStore,
} from 'dashboard/composables/store';
import Integration from './Integration.vue';
import Spinner from 'shared/components/Spinner.vue';
const store = useStore();
const integrationLoaded = ref(false);
const integration = useFunctionGetter('integrations/getIntegration', 'github');
const uiFlags = useMapGetter('integrations/getUIFlags');
const integrationAction = computed(() => {
if (integration.value.enabled) {
return 'disconnect';
}
return integration.value.action;
});
const initializeGithubIntegration = async () => {
await store.dispatch('integrations/get', 'github');
integrationLoaded.value = true;
};
onMounted(() => {
initializeGithubIntegration();
});
</script>
<template>
<div class="flex-grow flex-shrink max-w-6xl p-4 mx-auto overflow-auto">
<div v-if="integrationLoaded && !uiFlags.isCreatingGithub">
<Integration
:integration-id="integration.id"
:integration-logo="integration.logo"
:integration-name="integration.name"
:integration-description="integration.description"
:integration-enabled="integration.enabled"
:integration-action="integrationAction"
:delete-confirmation-text="{
title: $t('INTEGRATION_SETTINGS.GITHUB.DELETE.TITLE'),
message: $t('INTEGRATION_SETTINGS.GITHUB.DELETE.MESSAGE'),
}"
/>
</div>
<div v-else class="flex items-center justify-center flex-1">
<Spinner size="" color-scheme="primary" />
</div>
</div>
</template>
@@ -9,7 +9,7 @@ import Slack from './Slack.vue';
import SettingsContent from '../Wrapper.vue';
import Linear from './Linear.vue';
import Shopify from './Shopify.vue';
import Github from './Github.vue';
export default {
routes: [
{
@@ -90,6 +90,16 @@ export default {
},
props: route => ({ code: route.query.code }),
},
{
path: 'github',
name: 'settings_integrations_github',
component: Github,
meta: {
featureFlag: FEATURE_FLAGS.INTEGRATIONS,
permissions: ['administrator'],
},
props: route => ({ code: route.query.code }),
},
{
path: 'shopify',
name: 'settings_integrations_shopify',
+2
View File
@@ -51,6 +51,8 @@ class Integrations::App
GlobalConfigService.load('LINEAR_CLIENT_ID', nil).present?
when 'shopify'
account.feature_enabled?('shopify_integration') && GlobalConfigService.load('SHOPIFY_CLIENT_ID', nil).present?
when 'github'
account.feature_enabled?('github_integration') && GlobalConfigService.load('GITHUB_CLIENT_ID', nil).present?
else
true
end
@@ -159,4 +159,9 @@
<symbol id="icon-shopify" viewBox="0 0 32 32">
<path fill="currentColor" d="m20.448 31.974l9.625-2.083s-3.474-23.484-3.5-23.641s-.156-.255-.281-.255c-.13 0-2.573-.182-2.573-.182s-1.703-1.698-1.922-1.88a.4.4 0 0 0-.161-.099l-1.219 28.141zm-4.833-16.901s-1.083-.563-2.365-.563c-1.932 0-2.005 1.203-2.005 1.521c0 1.641 4.318 2.286 4.318 6.172c0 3.057-1.922 5.01-4.542 5.01c-3.141 0-4.719-1.953-4.719-1.953l.859-2.781s1.661 1.422 3.042 1.422c.901 0 1.302-.724 1.302-1.245c0-2.156-3.542-2.255-3.542-5.807c-.047-2.984 2.094-5.891 6.438-5.891c1.677 0 2.5.479 2.5.479l-1.26 3.625zm-.719-13.969c.177 0 .359.052.536.182c-1.313.62-2.75 2.188-3.344 5.323a76 76 0 0 1-2.516.771c.688-2.38 2.359-6.26 5.323-6.26zm1.646 3.932v.182c-1.005.307-2.115.646-3.193.979c.62-2.37 1.776-3.526 2.781-3.958c.255.667.411 1.568.411 2.797zm.718-2.973c.922.094 1.521 1.151 1.901 2.339c-.464.151-.979.307-1.542.484v-.333c0-1.005-.13-1.828-.359-2.495zm3.99 1.718c-.031 0-.083.026-.104.026c-.026 0-.385.099-.953.281C19.63 2.442 18.625.927 16.849.927h-.156C16.183.281 15.558 0 15.021 0c-4.141 0-6.12 5.172-6.74 7.797c-1.594.484-2.75.844-2.88.896c-.901.286-.927.313-1.031 1.161c-.099.615-2.438 18.75-2.438 18.75L20.01 32z"/>
</symbol>
<symbol id="icon-github" viewBox="0 0 24 24">
<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5c.08-1.25-.27-2.48-1-3.5c.28-1.15.28-2.35 0-3.5c0 0-1 0-3 1.5c-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5c-.39.49-.68 1.05-.85 1.65S8.93 17.38 9 18v4"/>
<path d="M9 18c-4.51 2-5-2-7-2"/>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

+3
View File
@@ -166,3 +166,6 @@
- name: channel_instagram
display_name: Instagram Channel
enabled: true
- name: github_integration
display_name: Github Integration
enabled: false
+14
View File
@@ -319,3 +319,17 @@
value: 'v22.0'
locked: true
# ------- End of Instagram Channel Related Config ------- #
# ------- Github Integration Config ------- #
- name: GITHUB_CLIENT_ID
display_title: 'Github Client ID'
value:
locked: false
description: 'Github client ID'
- name: GITHUB_CLIENT_SECRET
display_title: 'Github Client Secret'
value:
locked: false
description: 'Github client secret'
type: secret
## ------ End of Github Integration Config ------- #
+7
View File
@@ -186,3 +186,10 @@ shopify:
i18n_key: shopify
hook_type: account
allow_multiple_hooks: false
github:
id: github
logo: github.png
i18n_key: github
action: /github
hook_type: account
allow_multiple_hooks: false
+3
View File
@@ -234,6 +234,9 @@ en:
shopify:
name: 'Shopify'
description: 'Connect your Shopify store to access order details, customer information, and product data directly within your conversations and helps your support team provide faster, more contextual assistance to your customers.'
github:
name: 'Github'
description: 'Connect your Github account to access your repositories, issues, and pull requests directly within your conversations and helps your support team provide faster, more contextual assistance to your customers.'
captain:
copilot_error: 'Please connect an assistant to this inbox to use Copilot'
copilot_limit: 'You are out of Copilot credits. You can buy more credits from the billing section.'
@@ -97,3 +97,9 @@ shopify:
enabled: true
icon: 'icon-shopify'
config_key: 'shopify'
github:
name: 'Github'
description: 'Configuration for setting up Github'
enabled: true
icon: 'icon-github'
config_key: 'github'
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB