feat: Add help URLs for features in features.yml (#9134)

Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
Shivam Mishra
2024-03-21 23:00:46 +05:30
committed by GitHub
parent c51492c674
commit e94b276f64
5 changed files with 34 additions and 1 deletions

View File

@@ -2,4 +2,11 @@ module ApplicationHelper
def available_locales_with_name
LANGUAGES_CONFIG.map { |_key, val| val.slice(:name, :iso_639_1_code) }
end
def feature_help_urls
features = YAML.safe_load(Rails.root.join('config/features.yml').read).freeze
features.each_with_object({}) do |feature, hash|
hash[feature['name']] = feature['help_url'] if feature['help_url']
end
end
end

View File

@@ -20,4 +20,14 @@ export const FEATURE_FLAGS = {
INBOX_VIEW: 'inbox_view',
SLA: 'sla',
RESPONSE_BOT: 'response_bot',
CHANNEL_EMAIL: 'channel_email',
CHANNEL_FACEBOOK: 'channel_facebook',
CHANNEL_TWITTER: 'channel_twitter',
CHANNEL_WEBSITE: 'channel_website',
CUSTOM_REPLY_DOMAIN: 'custom_reply_domain',
CUSTOM_REPLY_EMAIL: 'custom_reply_email',
DISABLE_BRANDING: 'disable_branding',
EMAIL_CONTINUITY_ON_API_CHANNEL: 'email_continuity_on_api_channel',
INBOUND_EMAILS: 'inbound_emails',
IP_LOOKUP: 'ip_lookup',
};

View File

@@ -0,0 +1,4 @@
export function getHelpUrlForFeature(featureName) {
const { helpUrls } = window.chatwootConfig;
return helpUrls[featureName];
}

View File

@@ -44,6 +44,7 @@
vapidPublicKey: new Uint8Array(<%= Base64.urlsafe_decode64(@global_config['VAPID_PUBLIC_KEY']).bytes %>),
<% end %>
enabledLanguages: <%= available_locales_with_name.to_json.html_safe %>,
helpUrls: <%= feature_help_urls.to_json.html_safe %>,
selectedLocale: '<%= I18n.locale %>'
}
window.globalConfig = <%= raw @global_config.to_json %>

View File

@@ -3,37 +3,45 @@
enabled: true
- name: channel_email
enabled: true
help_url: https://chwt.app/hc/email
- name: channel_facebook
enabled: true
help_url: https://chwt.app/hc/fb
- name: channel_twitter
enabled: true
- name: ip_lookup
enabled: false
- name: disable_branding
enabled: false
premium: true
premium: true
- name: email_continuity_on_api_channel
enabled: false
- name: help_center
enabled: true
help_url: https://chwt.app/hc/help-center
- name: agent_bots
enabled: false
help_url: https://chwt.app/hc/agent-bots
- name: macros
enabled: true
- name: agent_management
enabled: true
- name: team_management
enabled: true
help_url: https://chwt.app/hc/teams
- name: inbox_management
enabled: true
- name: labels
enabled: true
help_url: https://chwt.app/hc/labels
- name: custom_attributes
enabled: true
help_url: https://chwt.app/hc/custom-attributes
- name: automations
enabled: true
- name: canned_responses
enabled: true
help_url: https://chwt.app/hc/canned
- name: integrations
enabled: true
- name: voice_recorder
@@ -44,8 +52,10 @@
enabled: true
- name: campaigns
enabled: true
help_url: https://chwt.app/hc/campaigns
- name: reports
enabled: true
help_url: https://chwt.app/hc/reports
- name: crm
enabled: true
- name: auto_resolve_conversations
@@ -62,6 +72,7 @@
premium: true
- name: message_reply_to
enabled: false
help_url: https://chwt.app/hc/reply-to
- name: insert_article_in_reply
enabled: false
- name: inbox_view