diff --git a/app/controllers/widget_tests_controller.rb b/app/controllers/widget_tests_controller.rb index fff47d907..6d6742cf4 100644 --- a/app/controllers/widget_tests_controller.rb +++ b/app/controllers/widget_tests_controller.rb @@ -3,6 +3,7 @@ class WidgetTestsController < ActionController::Base before_action :ensure_widget_position before_action :ensure_widget_type before_action :ensure_widget_style + before_action :ensure_dark_mode def index render @@ -14,6 +15,10 @@ class WidgetTestsController < ActionController::Base @widget_style = params[:widget_style] || 'standard' end + def ensure_dark_mode + @dark_mode = params[:dark_mode] || 'light' + end + def ensure_widget_position @widget_position = params[:position] || 'left' end diff --git a/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue index c3a75b0f6..5714582d5 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue @@ -35,7 +35,9 @@ - {{ agent.name }} + + {{ agent.name }} + {{ agent.email }} diff --git a/app/javascript/packs/sdk.js b/app/javascript/packs/sdk.js index 76e1a2cd8..b77b682dd 100755 --- a/app/javascript/packs/sdk.js +++ b/app/javascript/packs/sdk.js @@ -1,6 +1,10 @@ import Cookies from 'js-cookie'; import { IFrameHelper } from '../sdk/IFrameHelper'; -import { getBubbleView } from '../sdk/settingsHelper'; +import { + getBubbleView, + getDarkMode, + getWidgetStyle, +} from '../sdk/settingsHelper'; import { computeHashForUserData, getUserCookieName, @@ -24,8 +28,9 @@ const runSDK = ({ baseUrl, websiteToken }) => { type: getBubbleView(chatwootSettings.type), launcherTitle: chatwootSettings.launcherTitle || '', showPopoutButton: chatwootSettings.showPopoutButton || false, - widgetStyle: chatwootSettings.widgetStyle || 'standard', + widgetStyle: getWidgetStyle(chatwootSettings.widgetStyle) || 'standard', resetTriggered: false, + darkMode: getDarkMode(chatwootSettings.darkMode), toggle(state) { IFrameHelper.events.toggleBubble(state); diff --git a/app/javascript/sdk/IFrameHelper.js b/app/javascript/sdk/IFrameHelper.js index df36d8e0d..3bc0973fe 100644 --- a/app/javascript/sdk/IFrameHelper.js +++ b/app/javascript/sdk/IFrameHelper.js @@ -145,6 +145,7 @@ export const IFrameHelper = { hideMessageBubble: window.$chatwoot.hideMessageBubble, showPopoutButton: window.$chatwoot.showPopoutButton, widgetStyle: window.$chatwoot.widgetStyle, + darkMode: window.$chatwoot.darkMode, }); IFrameHelper.onLoad({ widgetColor: message.config.channelConfig.widgetColor, diff --git a/app/javascript/sdk/constants.js b/app/javascript/sdk/constants.js index 52faf1540..7bf84d430 100644 --- a/app/javascript/sdk/constants.js +++ b/app/javascript/sdk/constants.js @@ -1,2 +1,3 @@ export const BUBBLE_DESIGN = ['standard', 'expanded_bubble']; export const WIDGET_DESIGN = ['standard', 'flat']; +export const DARK_MODE = ['light', 'auto']; diff --git a/app/javascript/sdk/settingsHelper.js b/app/javascript/sdk/settingsHelper.js index 4e256b53a..657db1fe0 100644 --- a/app/javascript/sdk/settingsHelper.js +++ b/app/javascript/sdk/settingsHelper.js @@ -1,4 +1,4 @@ -import { BUBBLE_DESIGN, WIDGET_DESIGN } from './constants'; +import { BUBBLE_DESIGN, DARK_MODE, WIDGET_DESIGN } from './constants'; export const getBubbleView = type => BUBBLE_DESIGN.includes(type) ? type : BUBBLE_DESIGN[0]; @@ -9,3 +9,6 @@ export const getWidgetStyle = style => WIDGET_DESIGN.includes(style) ? style : WIDGET_DESIGN[0]; export const isFlatWidgetStyle = style => style === 'flat'; + +export const getDarkMode = darkMode => + DARK_MODE.includes(darkMode) ? darkMode : DARK_MODE[0]; diff --git a/app/javascript/shared/components/ChatCard.vue b/app/javascript/shared/components/ChatCard.vue index 4e856bb6b..eb6e13364 100644 --- a/app/javascript/shared/components/ChatCard.vue +++ b/app/javascript/shared/components/ChatCard.vue @@ -1,11 +1,14 @@