diff --git a/app/assets/stylesheets/administrate/application.scss b/app/assets/stylesheets/administrate/application.scss
index b8c5df794..66ac42405 100644
--- a/app/assets/stylesheets/administrate/application.scss
+++ b/app/assets/stylesheets/administrate/application.scss
@@ -25,7 +25,6 @@
@import 'components/flashes';
@import 'components/form-actions';
@import 'components/main-content';
-@import 'components/navigation';
@import 'components/pagination';
@import 'components/search';
@import 'components/reports';
diff --git a/app/assets/stylesheets/administrate/base/_layout.scss b/app/assets/stylesheets/administrate/base/_layout.scss
index c4c081a82..c2415122b 100644
--- a/app/assets/stylesheets/administrate/base/_layout.scss
+++ b/app/assets/stylesheets/administrate/base/_layout.scss
@@ -1,7 +1,7 @@
html {
background-color: $color-white;
box-sizing: border-box;
- font-size: 10px;
+ font-size: 16px;
-webkit-font-smoothing: antialiased;
}
diff --git a/app/assets/stylesheets/administrate/components/_attributes.scss b/app/assets/stylesheets/administrate/components/_attributes.scss
index 2b2936650..af6c27ac3 100644
--- a/app/assets/stylesheets/administrate/components/_attributes.scss
+++ b/app/assets/stylesheets/administrate/components/_attributes.scss
@@ -16,8 +16,8 @@
.attribute-data {
float: left;
margin-bottom: $base-spacing;
- margin-left: 2rem;
- width: calc(84% - 1rem);
+ margin-left: 1.25rem;
+ width: calc(84% - 0.625rem);
}
.attribute--nested {
diff --git a/app/assets/stylesheets/administrate/components/_field-unit.scss b/app/assets/stylesheets/administrate/components/_field-unit.scss
index 856c1872c..91b5153e4 100644
--- a/app/assets/stylesheets/administrate/components/_field-unit.scss
+++ b/app/assets/stylesheets/administrate/components/_field-unit.scss
@@ -9,22 +9,22 @@
.field-unit__label {
float: left;
- margin-left: 1rem;
+ margin-left: 0.625rem;
text-align: right;
- width: calc(15% - 1rem);
+ width: calc(15% - 0.625rem);
}
.field-unit__field {
float: left;
- margin-left: 2rem;
- max-width: 50rem;
+ margin-left: 1.25rem;
+ max-width: 31.15rem;
width: 100%;
}
.field-unit--nested {
border: $base-border;
margin-left: 7.5%;
- max-width: 60rem;
+ max-width: 37.5rem;
padding: $small-spacing;
width: 100%;
diff --git a/app/assets/stylesheets/administrate/components/_form-actions.scss b/app/assets/stylesheets/administrate/components/_form-actions.scss
index d87d17435..05ec352f2 100644
--- a/app/assets/stylesheets/administrate/components/_form-actions.scss
+++ b/app/assets/stylesheets/administrate/components/_form-actions.scss
@@ -1,3 +1,3 @@
.form-actions {
- margin-left: calc(15% + 2rem);
+ margin-left: calc(15% + 1.25rem);
}
diff --git a/app/assets/stylesheets/administrate/components/_main-content.scss b/app/assets/stylesheets/administrate/components/_main-content.scss
index 590bb0985..ab503dba8 100644
--- a/app/assets/stylesheets/administrate/components/_main-content.scss
+++ b/app/assets/stylesheets/administrate/components/_main-content.scss
@@ -13,6 +13,10 @@
table {
font-size: $font-size-small;
}
+
+ form {
+ margin-top: $space-two;
+ }
}
.main-content__header {
@@ -20,7 +24,7 @@
background-color: $color-white;
border-bottom: 1px solid $color-border;
display: flex;
- min-height: 5.6rem;
+ min-height: 3.5rem;
padding: $space-small $space-normal;
}
diff --git a/app/assets/stylesheets/administrate/components/_navigation.scss b/app/assets/stylesheets/administrate/components/_navigation.scss
deleted file mode 100644
index 4ffc42190..000000000
--- a/app/assets/stylesheets/administrate/components/_navigation.scss
+++ /dev/null
@@ -1,88 +0,0 @@
-.logo-brand {
- margin-bottom: $space-normal;
- padding: $space-normal $space-smaller $space-small;
- text-align: left;
-
- img {
- margin-bottom: $space-smaller;
- max-height: 3rem;
- }
-}
-
-.navigation {
- background: $white;
- border-right: 1px solid $color-border;
- display: flex;
- flex-direction: column;
- font-size: $font-size-default;
- font-weight: $font-weight-medium;
- height: 100%;
- justify-content: flex-start;
- left: 0;
- margin: 0;
- overflow: auto;
- padding: $space-normal;
- position: fixed;
- top: 0;
- width: 21rem;
- z-index: 1023;
-
- li {
- align-items: center;
- display: flex;
- font-size: $font-size-small;
-
- a {
- color: $color-gray;
- text-decoration: none;
- }
-
- i {
- min-width: $space-medium;
- }
- }
-
- hr {
- margin: $space-slab;
- }
-}
-
-.navigation__link {
- background-color: transparent;
- color: $color-gray;
- display: block;
- line-height: 1;
- margin-bottom: $space-smaller;
- padding: $space-small;
-
- &:hover {
- color: $blue;
-
- a {
- color: $blue;
- }
- }
-
-
- &.navigation__link--active {
- background-color: $color-background;
- border-radius: $base-border-radius;
- color: $blue;
-
- a {
- color: $blue;
- }
- }
-}
-
-.logout {
- bottom: $space-normal;
- left: $space-normal;
- position: fixed;
-}
-
-.app-version {
- color: $color-gray;
- font-size: $font-size-small;
- padding-top: $space-smaller;
-}
diff --git a/app/assets/stylesheets/administrate/components/_search.scss b/app/assets/stylesheets/administrate/components/_search.scss
index f3a259618..bd5c2eece 100644
--- a/app/assets/stylesheets/administrate/components/_search.scss
+++ b/app/assets/stylesheets/administrate/components/_search.scss
@@ -1,7 +1,7 @@
.search {
margin-left: auto;
- margin-right: 2rem;
- max-width: 44rem;
+ margin-right: 1.25rem;
+ max-width: 27.5rem;
position: relative;
width: 100%;
}
diff --git a/app/assets/stylesheets/administrate/library/_variables.scss b/app/assets/stylesheets/administrate/library/_variables.scss
index 086428556..2e424fb06 100644
--- a/app/assets/stylesheets/administrate/library/_variables.scss
+++ b/app/assets/stylesheets/administrate/library/_variables.scss
@@ -1,10 +1,10 @@
// Typography
-$base-font-family: PlusJakarta, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
+$base-font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif !default;
$heading-font-family: $base-font-family !default;
-$base-font-size: 14px !default;
+$base-font-size: 16px !default;
$base-line-height: 1.5 !default;
$heading-line-height: 1.2 !default;
diff --git a/app/assets/stylesheets/administrate/utilities/_variables.scss b/app/assets/stylesheets/administrate/utilities/_variables.scss
index 818f96e4c..3a1129c41 100644
--- a/app/assets/stylesheets/administrate/utilities/_variables.scss
+++ b/app/assets/stylesheets/administrate/utilities/_variables.scss
@@ -1,30 +1,30 @@
// Font sizes
-$font-size-nano: 0.8rem;
-$font-size-micro: 1.0rem;
-$font-size-mini: 1.2rem;
-$font-size-small: 1.4rem;
-$font-size-default: 1.6rem;
-$font-size-medium: 1.8rem;
-$font-size-large: 2.2rem;
-$font-size-big: 2.4rem;
-$font-size-bigger: 3.0rem;
-$font-size-mega: 3.4rem;
-$font-size-giga: 4.0rem;
+$font-size-nano: 0.5rem;
+$font-size-micro: 0.675rem;
+$font-size-mini: 0.75rem;
+$font-size-small: 0.875rem;
+$font-size-default: 1rem;
+$font-size-medium: 1.125rem;
+$font-size-large: 1.375rem;
+$font-size-big: 1.5rem;
+$font-size-bigger: 1.75rem;
+$font-size-mega: 2.125rem;
+$font-size-giga: 2.5rem;
// spaces
$zero: 0;
-$space-micro: 0.2rem;
-$space-smaller: 0.4rem;
-$space-small: 0.8rem;
-$space-one: 1rem;
-$space-slab: 1.2rem;
-$space-normal: 1.6rem;
-$space-two: 2.0rem;
-$space-medium: 2.4rem;
-$space-large: 3.2rem;
-$space-larger: 4.8rem;
-$space-jumbo: 6.4rem;
-$space-mega: 10.0rem;
+$space-micro: 0.125rem;
+$space-smaller: 0.25rem;
+$space-small: 0.5rem;
+$space-one: 0.675rem;
+$space-slab: 0.75rem;
+$space-normal: 1rem;
+$space-two: 1.25rem;
+$space-medium: 1.5rem;
+$space-large: 2rem;
+$space-larger: 3rem;
+$space-jumbo: 4rem;
+$space-mega: 6.25rem;
// font-weight
$font-weight-feather: 100;
diff --git a/app/controllers/super_admin/application_controller.rb b/app/controllers/super_admin/application_controller.rb
index 69b61b913..3b98a6e21 100644
--- a/app/controllers/super_admin/application_controller.rb
+++ b/app/controllers/super_admin/application_controller.rb
@@ -20,4 +20,13 @@ class SuperAdmin::ApplicationController < Administrate::ApplicationController
params.fetch(resource_name, {}).fetch(:direction, 'desc')
)
end
+
+ private
+
+ def invalid_action_perfomed
+ # rubocop:disable Rails/I18nLocaleTexts
+ flash[:error] = 'Invalid action performed'
+ # rubocop:enable Rails/I18nLocaleTexts
+ redirect_back(fallback_location: root_path)
+ end
end
diff --git a/app/controllers/super_admin/installation_configs_controller.rb b/app/controllers/super_admin/installation_configs_controller.rb
index 36a45f707..b1f15b518 100644
--- a/app/controllers/super_admin/installation_configs_controller.rb
+++ b/app/controllers/super_admin/installation_configs_controller.rb
@@ -1,4 +1,5 @@
class SuperAdmin::InstallationConfigsController < SuperAdmin::ApplicationController
+ rescue_from ActiveRecord::RecordNotUnique, :with => :invalid_action_perfomed
# Overwrite any of the RESTful controller actions to implement custom behavior
# For example, you may want to send an email after a foo is updated.
#
diff --git a/app/controllers/super_admin/settings_controller.rb b/app/controllers/super_admin/settings_controller.rb
new file mode 100644
index 000000000..685e6a8bd
--- /dev/null
+++ b/app/controllers/super_admin/settings_controller.rb
@@ -0,0 +1,10 @@
+class SuperAdmin::SettingsController < SuperAdmin::ApplicationController
+ def show; end
+
+ def refresh
+ Internal::CheckNewVersionsJob.perform_now
+ # rubocop:disable Rails/I18nLocaleTexts
+ redirect_to super_admin_settings_path, notice: 'Instance status refreshed'
+ # rubocop:enable Rails/I18nLocaleTexts
+ end
+end
diff --git a/app/dashboards/access_token_dashboard.rb b/app/dashboards/access_token_dashboard.rb
index d3f05a799..927aecadd 100644
--- a/app/dashboards/access_token_dashboard.rb
+++ b/app/dashboards/access_token_dashboard.rb
@@ -30,11 +30,7 @@ class AccessTokenDashboard < Administrate::BaseDashboard
# SHOW_PAGE_ATTRIBUTES
# an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = %i[
- owner
- id
token
- created_at
- updated_at
].freeze
# FORM_ATTRIBUTES
diff --git a/app/dashboards/agent_bot_dashboard.rb b/app/dashboards/agent_bot_dashboard.rb
index baeb6e814..a253b2406 100644
--- a/app/dashboards/agent_bot_dashboard.rb
+++ b/app/dashboards/agent_bot_dashboard.rb
@@ -46,6 +46,7 @@ class AgentBotDashboard < Administrate::BaseDashboard
name
description
outgoing_url
+ access_token
].freeze
# FORM_ATTRIBUTES
diff --git a/app/dashboards/platform_app_dashboard.rb b/app/dashboards/platform_app_dashboard.rb
index f5ed564ef..80fc7c5cd 100644
--- a/app/dashboards/platform_app_dashboard.rb
+++ b/app/dashboards/platform_app_dashboard.rb
@@ -32,6 +32,7 @@ class PlatformAppDashboard < Administrate::BaseDashboard
name
created_at
updated_at
+ access_token
].freeze
# FORM_ATTRIBUTES
diff --git a/app/dashboards/user_dashboard.rb b/app/dashboards/user_dashboard.rb
index e00d06a72..6b2129eed 100644
--- a/app/dashboards/user_dashboard.rb
+++ b/app/dashboards/user_dashboard.rb
@@ -36,7 +36,8 @@ class UserDashboard < Administrate::BaseDashboard
updated_at: Field::DateTime,
pubsub_token: Field::String,
type: Field::Select.with_options(collection: [nil, 'SuperAdmin']),
- accounts: CountField
+ accounts: CountField,
+ access_token: Field::HasOne
}.freeze
# COLLECTION_ATTRIBUTES
@@ -67,6 +68,7 @@ class UserDashboard < Administrate::BaseDashboard
updated_at
confirmed_at
account_users
+ access_token
].freeze
# FORM_ATTRIBUTES
diff --git a/app/javascript/dashboard/assets/scss/super_admin/index.scss b/app/javascript/dashboard/assets/scss/super_admin/index.scss
index f95f1303f..91f7835d0 100644
--- a/app/javascript/dashboard/assets/scss/super_admin/index.scss
+++ b/app/javascript/dashboard/assets/scss/super_admin/index.scss
@@ -1,39 +1,8 @@
-@import '../variables';
+@import 'shared/assets/fonts/inter';
+@import 'tailwindcss/base';
+@import 'tailwindcss/components';
+@import 'tailwindcss/utilities';
-.superadmin-body {
- background: var(--color-background);
-
- .hero--title {
- font-size: var(--font-size-mega);
- font-weight: var(--font-weight-light);
- margin-top: var(--space-large);
- }
-
- .update-subscription--checkbox {
- display: flex;
-
- input {
- line-height: 1.5;
- margin-right: var(--space-one);
- margin-top: var(--space-smaller);
- }
-
- label {
- font-size: var(--font-size-small);
- line-height: 1.5;
- margin-bottom: var(--space-normal);
- }
- }
+body {
+ font-family: Inter, -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
-
-.alert-box {
- background-color: var(--r-500);
- border-radius: 5px;
- color: var(--color-white);
- font-size: 14px;
- margin-bottom: 14px;
- padding: 10px;
- text-align: center;
-}
-
-
diff --git a/app/javascript/dashboard/assets/scss/super_admin/pages.scss b/app/javascript/dashboard/assets/scss/super_admin/pages.scss
deleted file mode 100644
index a33da2693..000000000
--- a/app/javascript/dashboard/assets/scss/super_admin/pages.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-@import 'shared/assets/fonts/plus-jakarta';
-@import '../variables';
-@import '~shared/assets/stylesheets/ionicons';
diff --git a/app/javascript/packs/superadmin.js b/app/javascript/packs/superadmin.js
index 90e58bd5e..bfad82f93 100644
--- a/app/javascript/packs/superadmin.js
+++ b/app/javascript/packs/superadmin.js
@@ -1,2 +1 @@
-import '../dashboard/assets/scss/app.scss';
import '../dashboard/assets/scss/super_admin/index.scss';
diff --git a/app/javascript/packs/superadmin_pages.js b/app/javascript/packs/superadmin_pages.js
index 7a3f33975..ef82fc261 100644
--- a/app/javascript/packs/superadmin_pages.js
+++ b/app/javascript/packs/superadmin_pages.js
@@ -1,2 +1 @@
-import '../dashboard/assets/scss/super_admin/pages.scss';
import 'chart.js';
diff --git a/app/jobs/internal/check_new_versions_job.rb b/app/jobs/internal/check_new_versions_job.rb
index 9f54b0ddd..a78d952e8 100644
--- a/app/jobs/internal/check_new_versions_job.rb
+++ b/app/jobs/internal/check_new_versions_job.rb
@@ -4,9 +4,20 @@ class Internal::CheckNewVersionsJob < ApplicationJob
def perform
return unless Rails.env.production?
- latest_version = ChatwootHub.latest_version
- return unless latest_version
+ instance_info = ChatwootHub.sync_with_hub
+ return unless instance_info
- ::Redis::Alfred.set(::Redis::Alfred::LATEST_CHATWOOT_VERSION, latest_version)
+ ::Redis::Alfred.set(::Redis::Alfred::LATEST_CHATWOOT_VERSION, instance_info['version'])
+ update_installation_config(key: 'INSTALLATION_PRICING_PLAN', value: instance_info['plan'])
+ update_installation_config(key: 'CHATWOOT_SUPPORT_WEBSITE_TOKEN', value: instance_info['chatwoot_support_website_token'])
+ update_installation_config(key: 'CHATWOOT_SUPPORT_IDENTIFIER_HASH', value: instance_info['chatwoot_support_identifier_hash'])
+ update_installation_config(key: 'CHATWOOT_SUPPORT_SCRIPT_URL', value: instance_info['chatwoot_support_script_url'])
+ end
+
+ def update_installation_config(key:, value:)
+ config = InstallationConfig.find_or_initialize_by(name: key)
+ config.value = value
+ config.locked = true
+ config.save!
end
end
diff --git a/app/views/installation/onboarding/index.html.erb b/app/views/installation/onboarding/index.html.erb
index aef0a52f8..a6eb40993 100644
--- a/app/views/installation/onboarding/index.html.erb
+++ b/app/views/installation/onboarding/index.html.erb
@@ -5,55 +5,73 @@
<%= javascript_pack_tag 'superadmin' %>
<%= stylesheet_pack_tag 'superadmin' %>
-
-
-
-
-

-
+
+
+
+
+
+
+
Howdy, Welcome to Chatwoot 👋
-
-
-
- <%= form_tag('/installation/onboarding', class: 'login-box column align-self-top') do %>
-
diff --git a/app/views/layouts/super_admin/application.html.erb b/app/views/layouts/super_admin/application.html.erb
index c52a40b9f..97ee0ef53 100644
--- a/app/views/layouts/super_admin/application.html.erb
+++ b/app/views/layouts/super_admin/application.html.erb
@@ -13,7 +13,7 @@ By default, it renders:
%>
-
+
@@ -22,20 +22,19 @@ By default, it renders:
<%= content_for(:title) %> - <%= application_title %>
<%= render "stylesheet" %>
+ <%= javascript_pack_tag 'superadmin' %>
+ <%= stylesheet_pack_tag 'superadmin' %>
<%= csrf_meta_tags %>
-
+
<%= render "icons" %>
-
-
+
<%= render "navigation" -%>
-
-
+
<%= render "flashes" -%>
<%= yield %>
-
<%= render "javascript" %>
diff --git a/app/views/super_admin/application/_icons.html.erb b/app/views/super_admin/application/_icons.html.erb
index d4ea86470..ac375193f 100644
--- a/app/views/super_admin/application/_icons.html.erb
+++ b/app/views/super_admin/application/_icons.html.erb
@@ -3,10 +3,123 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/super_admin/application/_javascript.html.erb b/app/views/super_admin/application/_javascript.html.erb
index 5197fe655..a179991ca 100644
--- a/app/views/super_admin/application/_javascript.html.erb
+++ b/app/views/super_admin/application/_javascript.html.erb
@@ -19,3 +19,33 @@ by providing a `content_for(:javascript)` block.
$.ajaxSetup({ async: false });
<% end %>
<% end %>
+
+
diff --git a/app/views/super_admin/application/_nav_item.html.erb b/app/views/super_admin/application/_nav_item.html.erb
new file mode 100644
index 000000000..a6366d8b5
--- /dev/null
+++ b/app/views/super_admin/application/_nav_item.html.erb
@@ -0,0 +1,9 @@
+
+ <% text_class_name = current_page?(url) ? 'text-woot-500 bg-slate-25' : 'text-slate-800' %>
+ <%= link_to(url, class: text_class_name + " -ml-1 focus:outline-none cursor-pointer flex items-center px-2 py-1.5 text-slate-800 cursor-pointer hover:text-woot-500 hover:bg-slate-25 rounded-lg") do %>
+
+ <%= label %>
+ <% end %>
+
diff --git a/app/views/super_admin/application/_navigation.html.erb b/app/views/super_admin/application/_navigation.html.erb
index b85c02623..f8fb474d2 100644
--- a/app/views/super_admin/application/_navigation.html.erb
+++ b/app/views/super_admin/application/_navigation.html.erb
@@ -6,88 +6,57 @@ By default, the navigation contains navigation links
for all resources in the admin dashboard,
as defined by the routes in the `admin/` namespace
%>
-
<%= javascript_pack_tag 'superadmin_pages' %>
<%= stylesheet_pack_tag 'superadmin_pages' %>
+
<%
sidebar_icons = {
- accounts: 'ion ion-briefcase',
- users: 'ion ion-person-stalker',
- super_admins: 'ion ion-unlocked',
- access_tokens: 'ion-key',
- platform_apps: 'ion ion-social-buffer',
- installation_configs: 'ion ion-settings',
- agent_bots: 'ion ion-social-android',
+ accounts: 'icon-building-4-line',
+ users: 'icon-user-follow-line',
+ platform_apps: 'icon-apps-2-line',
+ agent_bots: 'icon-robot-line',
}
%>
-
-
- <%= link_to image_tag('/brand-assets/logo.svg', alt: 'Chatwoot Admin Dashboard'), super_admin_root_url %>
-
v<%= Chatwoot.config[:version] %>
+
+
+
+ <%= link_to image_tag('/brand-assets/logo_thumbnail.svg', alt: 'Chatwoot Admin Dashboard', class: 'h-10'), super_admin_root_url %>
+
+
Chatwoot <%= Chatwoot.config[:version] %>
+
Super Admin Console
+
+
+
+
+ <%= render partial: "nav_item", locals: { icon: 'icon-grid-line', url: super_admin_root_url, label: 'Dashboard' } %>
+ <% Administrate::Namespace.new(namespace).resources.each do |resource| %>
+ <% next if ["account_users", "access_tokens", "installation_configs", "dashboard", "devise/sessions", "app_configs", "instance_statuses", "responses", "response_sources", "response_documents" , "settings"].include? resource.resource %>
+ <%= render partial: "nav_item", locals: {
+ icon: sidebar_icons[resource.resource.to_sym],
+ url: resource_index_route(resource),
+ label: display_resource_name(resource),
+ }
+ %>
+ <% end %>
+
+ <% if InstallationConfig.find_by(name: 'DEPLOYMENT_ENV')&.value == 'cloud' || Rails.env.development? %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-folder-3-line', url: super_admin_response_sources_url, label: 'Sources' } %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-draft-line', url: super_admin_response_documents_url, label: 'Documents' } %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-reply-line', url: super_admin_responses_url, label: 'Responses' } %>
+ <% end %>
+
+
+
+
+ <% if ChatwootApp.enterprise? %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-settings-2-line', url: super_admin_settings_url, label: 'Settings' } %>
+ <% end %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-mist-fill', url: sidekiq_web_url, label: 'Sidekiq Dashboard' } %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-health-book-line', url: super_admin_instance_status_url, label: 'Instance Health' } %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-dashboard-line', url: '/', label: 'Agent Dashboard' } %>
+ <%= render partial: "nav_item", locals: { icon: 'icon-logout-circle-r-line', url: super_admin_logout_url, label: 'Logout' } %>
+
-
-
- -
-
- <%= link_to "Dashboard", super_admin_root_url %>
-
-
- -
-
- <%= link_to "App Config", super_admin_app_config_url %>
-
-
- <% Administrate::Namespace.new(namespace).resources.each do |resource| %>
- <% next if ["account_users", "dashboard", "devise/sessions", "app_configs", "instance_statuses", "responses", "response_sources", "response_documents" ].include? resource.resource %>
- -
-
- <%= link_to(
- display_resource_name(resource),
- resource_index_route(resource)
- ) if existing_action? resource, :index %>
-
- <% end %>
-
- <% if InstallationConfig.find_by(name: 'DEPLOYMENT_ENV')&.value == 'cloud' || Rails.env.development? %>
-
- -
-
- <%= link_to "Sources", super_admin_response_sources_url %>
-
-
- -
-
- <%= link_to "Documents", super_admin_response_documents_url %>
-
-
- -
-
- <%= link_to "Responses", super_admin_responses_url %>
-
-
- <% end %>
-
- -
-
- <%= link_to "Instance Health", super_admin_instance_status_url %>
-
-
- -
-
- <%= link_to "Sidekiq", sidekiq_web_url, { target: "_blank" } %>
-
-
-
-
- -
-
- <%= link_to "Logout", super_admin_logout_url %>
-
- -
-
- <%= link_to "Agent Dashboard", '/' %>
-
-
diff --git a/app/views/super_admin/devise/sessions/new.html.erb b/app/views/super_admin/devise/sessions/new.html.erb
index b79cbe8b3..24672aee1 100644
--- a/app/views/super_admin/devise/sessions/new.html.erb
+++ b/app/views/super_admin/devise/sessions/new.html.erb
@@ -5,42 +5,45 @@
<%= javascript_pack_tag 'superadmin' %>
<%= stylesheet_pack_tag 'superadmin' %>
-
-
-
-
-
+
+
+
+
+
+
+
Howdy, admin 👋
-
-
-
- <%= form_for(resource, as: resource_name, url: '/super_admin/sign_in', html: { class: 'login-box column align-self-top'}) do |f| %>
-
+
+
diff --git a/app/views/super_admin/instance_statuses/show.html.erb b/app/views/super_admin/instance_statuses/show.html.erb
index d0d23f2a1..5474bff6a 100644
--- a/app/views/super_admin/instance_statuses/show.html.erb
+++ b/app/views/super_admin/instance_statuses/show.html.erb
@@ -1,5 +1,5 @@
<% content_for(:title) do %>
- Instance Health
+ Instance Status
<% end %>
@@ -15,7 +15,7 @@
<% @metrics.each do |key,value| %>
| <%= key %> |
- <%= value %> |
+ <%= value %> |
<% end %>
diff --git a/app/views/super_admin/settings/show.html.erb b/app/views/super_admin/settings/show.html.erb
new file mode 100644
index 000000000..b512c3137
--- /dev/null
+++ b/app/views/super_admin/settings/show.html.erb
@@ -0,0 +1,89 @@
+<% content_for(:title) do %>
+ Settings
+<% end %>
+
+
+
+
+
+
You are currently on the <%= ChatwootHub.pricing_plan %> edition plan.
+
+
Installation Identifier
+ <%= ChatwootHub.installation_identifier %>
+
+
+
+
+
Current plan
+
You are currently on the <%= ChatwootHub.pricing_plan %> edition plan.
+
+
+
+
+
+
+
+
Need help?
+
Do you face any issues? We are here to help.
+
+
+
+
+ <% if ChatwootHub.pricing_plan !='community' %>
+
+ <% end %>
+
+
+
Features
+
+
+ <% SuperAdmin::FeaturesHelper.available_features.each do |feature, attrs| %>
+
+
+
+
+
+
+
+ <% if !attrs[:enabled] %>
+
+ <% end %>
+
+
<%= attrs[:name] %>
+
+
<%= attrs[:description] %>
+
+ <% end %>
+
+
+
diff --git a/config/installation_config.yml b/config/installation_config.yml
index c1bbb299b..fae7051b7 100644
--- a/config/installation_config.yml
+++ b/config/installation_config.yml
@@ -74,3 +74,11 @@
value:
- name: LOGO_DARK
value: '/brand-assets/logo_dark.svg'
+- name: INSTALLATION_PRICING_PLAN
+ value: 'community'
+- name: CHATWOOT_SUPPORT_WEBSITE_TOKEN
+ value:
+- name: CHATWOOT_SUPPORT_SCRIPT_URL
+ value:
+- name: CHATWOOT_SUPPORT_IDENTIFIER_HASH
+ value:
diff --git a/config/routes.rb b/config/routes.rb
index fb071c91b..f8a138bb5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -444,6 +444,10 @@ Rails.application.routes.draw do
resources :platform_apps, only: [:index, :new, :create, :show, :edit, :update]
resource :instance_status, only: [:show]
+ resource :settings, only: [:show] do
+ get :refresh, on: :collection
+ end
+
# resources that doesn't appear in primary navigation in super admin
resources :account_users, only: [:new, :create, :destroy]
end
diff --git a/enterprise/app/helpers/super_admin/features.yml b/enterprise/app/helpers/super_admin/features.yml
new file mode 100644
index 000000000..dd7b556fb
--- /dev/null
+++ b/enterprise/app/helpers/super_admin/features.yml
@@ -0,0 +1,60 @@
+custom_branding:
+ name: 'Custom Branding'
+ description: 'Apply your own branding to this installation.'
+ enabled: <%= (ChatwootHub.pricing_plan != 'community') %>
+ icon: 'icon-paint-brush-line'
+agent_capacity:
+ name: 'Agent Capacity'
+ description: 'Set limits to auto-assigning conversations to your agents.'
+ enabled: <%= (ChatwootHub.pricing_plan != 'community') %>
+ icon: 'icon-hourglass-line'
+audit_logs:
+ name: 'Audit Logs'
+ description: 'Track and trace account activities with ease with detailed audit logs.'
+ enabled: <%= (ChatwootHub.pricing_plan != 'community') %>
+ icon: 'icon-menu-search-line'
+disable_branding:
+ name: 'Disable Branding'
+ description: 'Disable branding on live-chat widget and external emails.'
+ enabled: <%= (ChatwootHub.pricing_plan != 'community') %>
+ icon: 'icon-sailbot-fill'
+live_chat:
+ name: 'Live Chat'
+ description: 'Improve your customer experience using a live chat on your website.'
+ enabled: true
+ icon: 'icon-chat-smile-3-line'
+email:
+ name: 'Email'
+ description: 'Manage your email customer interactions from Chatwoot.'
+ enabled: true
+ icon: 'icon-mail-send-fill'
+messenger:
+ name: 'Messenger'
+ description: 'Stay connected with your customers on Facebook & Instagram.'
+ enabled: true
+ icon: 'icon-messenger-line'
+whatsapp:
+ name: 'WhatsApp'
+ description: 'Manage your WhatsApp business interactions from Chatwoot.'
+ enabled: true
+ icon: 'icon-whatsapp-line'
+telegram:
+ name: 'Telegram'
+ description: 'Manage your Telegram customer interactions from Chatwoot.'
+ enabled: true
+ icon: 'icon-telegram-line'
+line:
+ name: 'Line'
+ description: 'Manage your Line customer interactions from Chatwoot.'
+ enabled: true
+ icon: 'icon-line-line'
+sms:
+ name: 'SMS'
+ description: 'Manage your SMS customer interactions from Chatwoot.'
+ enabled: true
+ icon: 'icon-message-line'
+help_center:
+ name: 'Help Center'
+ description: 'Allow agents to create help center articles and publish them in a portal.'
+ enabled: true
+ icon: 'icon-book-2-line'
diff --git a/enterprise/app/helpers/super_admin/features_helper.rb b/enterprise/app/helpers/super_admin/features_helper.rb
new file mode 100644
index 000000000..365a93291
--- /dev/null
+++ b/enterprise/app/helpers/super_admin/features_helper.rb
@@ -0,0 +1,5 @@
+module SuperAdmin::FeaturesHelper
+ def self.available_features
+ YAML.load(ERB.new(Rails.root.join('enterprise/app/helpers/super_admin/features.yml').read).result).with_indifferent_access
+ end
+end
diff --git a/lib/chatwoot_hub.rb b/lib/chatwoot_hub.rb
index 68bae8267..44038145c 100644
--- a/lib/chatwoot_hub.rb
+++ b/lib/chatwoot_hub.rb
@@ -11,6 +11,18 @@ class ChatwootHub
identifier
end
+ def self.pricing_plan
+ InstallationConfig.find_by(name: 'INSTALLATION_PRICING_PLAN')&.value || 'community'
+ end
+
+ def self.support_config
+ {
+ support_website_token: InstallationConfig.find_by(name: 'CHATWOOT_SUPPORT_WEBSITE_TOKEN')&.value,
+ support_script_url: InstallationConfig.find_by(name: 'CHATWOOT_SUPPORT_SCRIPT_URL')&.value,
+ support_identifier_hash: InstallationConfig.find_by(name: 'CHATWOOT_SUPPORT_IDENTIFIER_HASH')&.value
+ }
+ end
+
def self.instance_config
{
installation_identifier: installation_identifier,
@@ -33,18 +45,18 @@ class ChatwootHub
}
end
- def self.latest_version
+ def self.sync_with_hub
begin
info = instance_config
info = info.merge(instance_metrics) unless ENV['DISABLE_TELEMETRY']
response = RestClient.post(PING_URL, info.to_json, { content_type: :json, accept: :json })
- version = JSON.parse(response)['version']
+ parsed_response = JSON.parse(response)
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS => e
Rails.logger.error "Exception: #{e.message}"
rescue StandardError => e
ChatwootExceptionTracker.new(e).capture_exception
end
- version
+ parsed_response
end
def self.register_instance(company_name, owner_name, owner_email)
diff --git a/spec/controllers/super_admin/instance_statuses_controller_spec.rb b/spec/controllers/super_admin/instance_statuses_controller_spec.rb
index b2b1237f9..c00ea5984 100644
--- a/spec/controllers/super_admin/instance_statuses_controller_spec.rb
+++ b/spec/controllers/super_admin/instance_statuses_controller_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'
-RSpec.describe 'Super Admin Instance health', type: :request do
+RSpec.describe 'Super Admin Instance status', type: :request do
let(:super_admin) { create(:super_admin) }
describe 'GET /super_admin/instance_status' do
diff --git a/spec/jobs/internal/check_new_versions_job_spec.rb b/spec/jobs/internal/check_new_versions_job_spec.rb
index 3253ce319..3d36c4ba7 100644
--- a/spec/jobs/internal/check_new_versions_job_spec.rb
+++ b/spec/jobs/internal/check_new_versions_job_spec.rb
@@ -4,11 +4,11 @@ RSpec.describe Internal::CheckNewVersionsJob do
subject(:job) { described_class.perform_now }
it 'updates the latest chatwoot version in redis' do
- version = '1.1.1'
+ data = { 'version' => '1.2.3' }.to_json
allow(Rails.env).to receive(:production?).and_return(true)
- allow(ChatwootHub).to receive(:latest_version).and_return(version)
+ allow(ChatwootHub).to receive(:sync_with_hub).and_return(data)
job
- expect(ChatwootHub).to have_received(:latest_version)
- expect(Redis::Alfred.get(Redis::Alfred::LATEST_CHATWOOT_VERSION)).to eq version
+ expect(ChatwootHub).to have_received(:sync_with_hub)
+ expect(Redis::Alfred.get(Redis::Alfred::LATEST_CHATWOOT_VERSION)).to eq data['version']
end
end
diff --git a/spec/lib/chatwoot_hub_spec.rb b/spec/lib/chatwoot_hub_spec.rb
index 99eaf19da..b5e0da4dd 100644
--- a/spec/lib/chatwoot_hub_spec.rb
+++ b/spec/lib/chatwoot_hub_spec.rb
@@ -7,11 +7,11 @@ describe ChatwootHub do
expect(described_class.installation_identifier).to eq installation_identifier
end
- context 'when fetching latest_version' do
+ context 'when fetching sync_with_hub' do
it 'get latest version from chatwoot hub' do
version = '1.1.1'
allow(RestClient).to receive(:post).and_return({ version: version }.to_json)
- expect(described_class.latest_version).to eq version
+ expect(described_class.sync_with_hub['version']).to eq version
expect(RestClient).to have_received(:post).with(described_class::PING_URL, described_class.instance_config
.merge(described_class.instance_metrics).to_json, { content_type: :json, accept: :json })
end
@@ -20,7 +20,7 @@ describe ChatwootHub do
version = '1.1.1'
with_modified_env DISABLE_TELEMETRY: 'true' do
allow(RestClient).to receive(:post).and_return({ version: version }.to_json)
- expect(described_class.latest_version).to eq version
+ expect(described_class.sync_with_hub['version']).to eq version
expect(RestClient).to have_received(:post).with(described_class::PING_URL,
described_class.instance_config.to_json, { content_type: :json, accept: :json })
end
@@ -28,7 +28,7 @@ describe ChatwootHub do
it 'returns nil when chatwoot hub is down' do
allow(RestClient).to receive(:post).and_raise(ExceptionList::REST_CLIENT_EXCEPTIONS.sample)
- expect(described_class.latest_version).to be_nil
+ expect(described_class.sync_with_hub).to be_nil
end
end