diff --git a/app/livechat/server/api/lib/livechat.js b/app/livechat/server/api/lib/livechat.js index b374e5139a99a..a8abb9115851c 100644 --- a/app/livechat/server/api/lib/livechat.js +++ b/app/livechat/server/api/lib/livechat.js @@ -111,8 +111,9 @@ export async function settings() { forceAcceptDataProcessingConsent: initSettings.Livechat_force_accept_data_processing_consent, showConnecting: initSettings.Livechat_Show_Connecting, agentHiddenInfo: initSettings.Livechat_show_agent_info === false, + clearLocalStorageWhenChatEnded: initSettings.Livechat_clear_local_storage_when_chat_ended, limitTextLength: initSettings.Livechat_enable_message_character_limit - && (initSettings.Livechat_message_character_limit || initSettings.Message_MaxAllowedSize), + && (initSettings.Livechat_message_character_limit || initSettings.Message_MaxAllowedSize), }, theme: { title: initSettings.Livechat_title, diff --git a/app/livechat/server/config.ts b/app/livechat/server/config.ts index d8b2d124c15aa..7adadc1089689 100644 --- a/app/livechat/server/config.ts +++ b/app/livechat/server/config.ts @@ -56,6 +56,15 @@ Meteor.startup(function() { enableQuery: omnichannelEnabledQuery, }); + this.add('Livechat_clear_local_storage_when_chat_ended', false, { + type: 'boolean', + group: 'Omnichannel', + public: true, + section: 'Livechat', + i18nLabel: 'Clear_livechat_session_when_chat_ended', + enableQuery: omnichannelEnabledQuery, + }); + this.add('Livechat_validate_offline_email', true, { type: 'boolean', group: 'Omnichannel', diff --git a/app/livechat/server/lib/Livechat.js b/app/livechat/server/lib/Livechat.js index 78d54cd5f1e61..7110fadf8310a 100644 --- a/app/livechat/server/lib/Livechat.js +++ b/app/livechat/server/lib/Livechat.js @@ -529,6 +529,7 @@ export const Livechat = { 'Livechat_force_accept_data_processing_consent', 'Livechat_data_processing_consent_text', 'Livechat_show_agent_info', + 'Livechat_clear_local_storage_when_chat_ended', ]).forEach((setting) => { rcSettings[setting._id] = setting.value; }); diff --git a/app/livechat/server/methods/getInitialData.js b/app/livechat/server/methods/getInitialData.js index bac76ce8d49a6..1243a3360ec24 100644 --- a/app/livechat/server/methods/getInitialData.js +++ b/app/livechat/server/methods/getInitialData.js @@ -3,6 +3,7 @@ import _ from 'underscore'; import { LivechatRooms, Users, LivechatDepartment, LivechatTrigger, LivechatVisitors } from '../../../models'; import { Livechat } from '../lib/Livechat'; +import { deprecationWarning } from '../../../api/server/helpers/deprecationWarning'; Meteor.methods({ 'livechat:getInitialData'(visitorToken, departmentId) { @@ -98,6 +99,7 @@ Meteor.methods({ info.allowSwitchingDepartments = initSettings.Livechat_allow_switching_departments; info.online = Users.findOnlineAgents().count() > 0; - return info; + + return deprecationWarning({ endpoint: 'livechat:getInitialData', versionWillBeRemoved: '5.0', response: info }); }, }); diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 7e4aa128245d2..30a099f40d39b 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -866,6 +866,7 @@ "clear_cache_now": "Clear Cache Now", "Clear_filters": "Clear filters", "clear_history": "Clear History", + "Clear_livechat_session_when_chat_ended": "Clear guest session when chat ended", "Click_here": "Click here", "Click_here_for_more_details_or_contact_sales_for_a_new_license": "Click here for more details or contact __email__ for a new license.", "Click_here_for_more_info": "Click here for more info",