diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index b247b9715..c610dc846 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -92,7 +92,7 @@ class Api::V1::AccountsController < Api::BaseController end def settings_params - params.permit(:auto_resolve_after, :auto_resolve_message) + params.permit(:auto_resolve_after, :auto_resolve_message, :auto_resolve_ignore_waiting) end def check_signup_enabled diff --git a/app/javascript/dashboard/i18n/locale/en/generalSettings.json b/app/javascript/dashboard/i18n/locale/en/generalSettings.json index e586fe761..e6800820b 100644 --- a/app/javascript/dashboard/i18n/locale/en/generalSettings.json +++ b/app/javascript/dashboard/i18n/locale/en/generalSettings.json @@ -46,7 +46,7 @@ }, "AUTO_RESOLVE": { "TITLE": "Auto-resolve conversations", - "NOTE": "This configuration would allow you to automatically end the conversation after a certain period. Set the duration and customize the message to the user below." + "NOTE": "This configuration would allow you to automatically resolve the conversation after a certain period. Set the duration and customize the message to the user below." }, "NAME": { "LABEL": "Account name", @@ -68,16 +68,20 @@ "PLACEHOLDER": "Your company's support email", "ERROR": "" }, + "AUTO_RESOLVE_IGNORE_WAITING": { + "LABEL": "Exclude unattended conversations", + "HELP": "If toggled, the system will not resolve conversations that have been waiting for an agent reply." + }, "AUTO_RESOLVE_DURATION": { "LABEL": "Inactivity duration for resolution", "HELP": "Duration after a conversation should auto resolve if there is no activity", "PLACEHOLDER": "30", - "ERROR": "Please enter a valid auto resolve duration (minimum 1 day and maximum 999 days)", + "ERROR": "Auto resolve duration should be between 10 minutes and 999 days", "API": { "SUCCESS": "Auto resolve settings updated successfully", "ERROR": "Failed to update auto resolve settings" }, - "UPDATE_BUTTON": "Update Auto-resolve", + "UPDATE_BUTTON": "Update", "MESSAGE_LABEL": "Custom resolution message", "MESSAGE_PLACEHOLDER": "Conversation was marked resolved by system due to 15 days of inactivity", "MESSAGE_HELP": "This message is sent to the customer when a conversation is automatically resolved by the system due to inactivity." diff --git a/app/javascript/dashboard/routes/dashboard/settings/account/components/AutoResolve.vue b/app/javascript/dashboard/routes/dashboard/settings/account/components/AutoResolve.vue index e3fb424ca..9816fc7e0 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/account/components/AutoResolve.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/account/components/AutoResolve.vue @@ -13,6 +13,7 @@ import NextButton from 'dashboard/components-next/button/Button.vue'; const { t } = useI18n(); const duration = ref(0); const message = ref(''); +const ignoreWaiting = ref(false); const isEnabled = ref(false); const { currentAccount, updateAccount } = useAccount(); @@ -20,11 +21,15 @@ const { currentAccount, updateAccount } = useAccount(); watch( currentAccount, () => { - const { auto_resolve_after, auto_resolve_message } = - currentAccount.value?.settings || {}; + const { + auto_resolve_after, + auto_resolve_message, + auto_resolve_ignore_waiting, + } = currentAccount.value?.settings || {}; duration.value = auto_resolve_after; message.value = auto_resolve_message; + ignoreWaiting.value = auto_resolve_ignore_waiting; if (duration.value) { isEnabled.value = true; @@ -43,9 +48,15 @@ const updateAccountSettings = async settings => { }; const handleSubmit = async () => { + if (duration.value < 10) { + useAlert(t('GENERAL_SETTINGS.FORM.AUTO_RESOLVE_DURATION.ERROR')); + return Promise.resolve(); + } + return updateAccountSettings({ auto_resolve_after: duration.value, auto_resolve_message: message.value, + auto_resolve_ignore_waiting: ignoreWaiting.value, }); }; @@ -56,6 +67,7 @@ const handleDisable = async () => { return updateAccountSettings({ auto_resolve_after: null, auto_resolve_message: '', + auto_resolve_ignore_waiting: false, }); }; @@ -76,7 +88,7 @@ const toggleAutoResolve = async () => { -