From c1a2e67c9e55b1be4f1173301069d7dee1ebae9c Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Fri, 10 Nov 2023 09:44:59 +0530 Subject: [PATCH 01/23] fix: Change the route change logic based on bus events, after creating a new conversation in the widget. (#8328) --- .../widget/constants/widgetBusEvents.js | 1 + .../store/modules/conversation/actions.js | 3 +++ app/javascript/widget/views/PreChatForm.vue | 18 ++++++------------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/javascript/widget/constants/widgetBusEvents.js b/app/javascript/widget/constants/widgetBusEvents.js index 769b941ee..1ffcd3d51 100644 --- a/app/javascript/widget/constants/widgetBusEvents.js +++ b/app/javascript/widget/constants/widgetBusEvents.js @@ -1,3 +1,4 @@ export const ON_AGENT_MESSAGE_RECEIVED = 'ON_AGENT_MESSAGE_RECEIVED'; export const ON_UNREAD_MESSAGE_CLICK = 'ON_UNREAD_MESSAGE_CLICK'; export const ON_CAMPAIGN_MESSAGE_CLICK = 'ON_CAMPAIGN_MESSAGE_CLICK'; +export const ON_CONVERSATION_CREATED = 'ON_CONVERSATION_CREATED'; diff --git a/app/javascript/widget/store/modules/conversation/actions.js b/app/javascript/widget/store/modules/conversation/actions.js index 73a0da91f..e1862ea84 100644 --- a/app/javascript/widget/store/modules/conversation/actions.js +++ b/app/javascript/widget/store/modules/conversation/actions.js @@ -10,6 +10,7 @@ import { deleteCustomAttribute, } from 'widget/api/conversation'; +import { ON_CONVERSATION_CREATED } from 'widget/constants/widgetBusEvents'; import { createTemporaryMessage, getNonDeletedMessages } from './helpers'; export const actions = { @@ -21,6 +22,8 @@ export const actions = { const [message = {}] = messages; commit('pushMessageToConversation', message); dispatch('conversationAttributes/getAttributes', {}, { root: true }); + // Emit event to notify that conversation is created and show the chat screen + bus.$emit(ON_CONVERSATION_CREATED); } catch (error) { // Ignore error } finally { diff --git a/app/javascript/widget/views/PreChatForm.vue b/app/javascript/widget/views/PreChatForm.vue index 58cad04b9..2f03521ba 100644 --- a/app/javascript/widget/views/PreChatForm.vue +++ b/app/javascript/widget/views/PreChatForm.vue @@ -4,28 +4,22 @@ diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/EditPortalBasic.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/EditPortalBasic.vue index c6d9f8b15..8e3579f02 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/EditPortalBasic.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/EditPortalBasic.vue @@ -7,6 +7,7 @@ $t('HELP_CENTER.PORTAL.EDIT.EDIT_BASIC_INFO.BUTTON_TEXT') " @submit="updatePortalSettings" + @delete-logo="deleteLogo" /> @@ -70,6 +71,19 @@ export default { this.showAlert(this.alertMessage); } }, + async deleteLogo() { + try { + const portalSlug = this.lastPortalSlug; + await this.$store.dispatch('portals/deleteLogo', { + portalSlug, + }); + } catch (error) { + this.alertMessage = + error?.message || + this.$t('HELP_CENTER.PORTAL.ADD.LOGO.IMAGE_DELETE_ERROR'); + this.showAlert(this.alertMessage); + } + }, }, }; diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/PortalDetails.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/PortalDetails.vue index 98aaf544f..2857867bb 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/PortalDetails.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/PortalDetails.vue @@ -40,9 +40,12 @@ export default { methods: { async createPortal(portal) { try { + const { blob_id: blobId } = portal; await this.$store.dispatch('portals/create', { portal, + blob_id: blobId, }); + this.alertMessage = this.$t( 'HELP_CENTER.PORTAL.ADD.API.SUCCESS_MESSAGE_FOR_BASIC' ); diff --git a/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue index f44ceedfb..4a1c81bda 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue @@ -128,6 +128,7 @@ import { required, minLength, email } from 'vuelidate/lib/validators'; import { mapGetters } from 'vuex'; import { clearCookiesOnLogout } from '../../../../store/utils/api'; +import { hasValidAvatarUrl } from 'dashboard/helper/URLHelper'; import NotificationSettings from './NotificationSettings.vue'; import alertMixin from 'shared/mixins/alertMixin'; import ChangePassword from './ChangePassword.vue'; @@ -198,6 +199,9 @@ export default { currentUserId: 'getCurrentUserID', globalConfig: 'globalConfig/get', }), + showDeleteButton() { + return hasValidAvatarUrl(this.avatarUrl); + }, }, watch: { currentUserId(newCurrentUserId, prevCurrentUserId) { @@ -265,9 +269,6 @@ export default { this.showAlert(this.$t('PROFILE_SETTINGS.AVATAR_DELETE_FAILED')); } }, - showDeleteButton() { - return this.avatarUrl && !this.avatarUrl.includes('www.gravatar.com'); - }, toggleEditorMessageKey(key) { this.updateUISettings({ editor_message_key: key }); this.showAlert( diff --git a/app/javascript/dashboard/store/modules/helpCenterPortals/actions.js b/app/javascript/dashboard/store/modules/helpCenterPortals/actions.js index bfae85d27..60ccf9d25 100644 --- a/app/javascript/dashboard/store/modules/helpCenterPortals/actions.js +++ b/app/javascript/dashboard/store/modules/helpCenterPortals/actions.js @@ -2,6 +2,7 @@ import PortalAPI from 'dashboard/api/helpCenter/portals'; import { throwErrorMessage } from 'dashboard/store/utils/api'; import { types } from './mutations'; const portalAPIs = new PortalAPI(); + export const actions = { index: async ({ commit }) => { try { @@ -89,6 +90,23 @@ export const actions = { } }, + deleteLogo: async ({ commit }, { portalSlug }) => { + commit(types.SET_HELP_PORTAL_UI_FLAG, { + uiFlags: { isUpdating: true }, + portalSlug, + }); + try { + await portalAPIs.deleteLogo(portalSlug); + } catch (error) { + throwErrorMessage(error); + } finally { + commit(types.SET_HELP_PORTAL_UI_FLAG, { + uiFlags: { isUpdating: false }, + portalSlug, + }); + } + }, + updatePortal: async ({ commit }, portal) => { commit(types.UPDATE_PORTAL_ENTRY, portal); }, From 146e46d79f46768d53fb0faa49f46331e82ccfd9 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Fri, 17 Nov 2023 20:10:46 -0800 Subject: [PATCH 20/23] fix: Disable AI Assist CTA if not required (#8375) - Show CTAs only on production --- .../dashboard/components/widgets/AIAssistanceButton.vue | 4 +++- app/javascript/shared/store/globalConfig.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue b/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue index ab4047a1e..2d7951b05 100644 --- a/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue +++ b/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue @@ -61,6 +61,7 @@ export default { computed: { ...mapGetters({ currentChat: 'getSelectedChat', + isAChatwootInstance: 'globalConfig/isAChatwootInstance', }), isAICTAModalDismissed() { return this.uiSettings.is_open_ai_cta_modal_dismissed; @@ -70,7 +71,8 @@ export default { return ( this.isAdmin && !this.isAIIntegrationEnabled && - !this.isAICTAModalDismissed + !this.isAICTAModalDismissed && + this.isAChatwootInstance ); }, // Display a AI CTA button for agents and other admins who have not yet opened the AI assistance modal. diff --git a/app/javascript/shared/store/globalConfig.js b/app/javascript/shared/store/globalConfig.js index 60326dce5..5a266bd21 100644 --- a/app/javascript/shared/store/globalConfig.js +++ b/app/javascript/shared/store/globalConfig.js @@ -50,6 +50,7 @@ export const getters = { get: $state => $state, isOnChatwootCloud: $state => $state.deploymentEnv === 'cloud', isACustomBrandedInstance: $state => $state.installationName !== 'Chatwoot', + isAChatwootInstance: $state => $state.installationName === 'Chatwoot', }; export const actions = {}; From 6e22695b8597eb3e562d75191447197a887d608f Mon Sep 17 00:00:00 2001 From: Sojan Date: Fri, 17 Nov 2023 20:34:39 -0800 Subject: [PATCH 21/23] Bump version to 3.3.0 --- config/app.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/app.yml b/config/app.yml index 6e03f1355..60f5cd50a 100644 --- a/config/app.yml +++ b/config/app.yml @@ -1,5 +1,5 @@ shared: &shared - version: '3.2.0' + version: '3.3.0' development: <<: *shared diff --git a/package.json b/package.json index af05f3db0..1e778b206 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chatwoot/chatwoot", - "version": "3.2.0", + "version": "3.3.0", "license": "MIT", "scripts": { "eslint": "eslint app/**/*.{js,vue}", From 17725e4dd051471d14425b8fff264ecee92cc4fb Mon Sep 17 00:00:00 2001 From: Clairton Rodrigo Heinzen Date: Sat, 18 Nov 2023 15:18:55 -0300 Subject: [PATCH 22/23] fix: Breakage of message pane when Openai integration isn't enabled (#8381) Error when the Openai integration isn't enabled fixes: https://github.com/chatwoot/chatwoot/issues/8379 --- app/javascript/dashboard/mixins/aiMixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/dashboard/mixins/aiMixin.js b/app/javascript/dashboard/mixins/aiMixin.js index f3558a6c7..54bde3ffb 100644 --- a/app/javascript/dashboard/mixins/aiMixin.js +++ b/app/javascript/dashboard/mixins/aiMixin.js @@ -18,7 +18,7 @@ export default { aiIntegration() { return this.appIntegrations.find( integration => integration.id === 'openai' && !!integration.hooks.length - ).hooks[0]; + )?.hooks[0]; }, isAIIntegrationEnabled() { return !!this.aiIntegration; From 4244945e7b6bbedd02c756cb44f829f6749ec7c3 Mon Sep 17 00:00:00 2001 From: Sojan Date: Sat, 18 Nov 2023 10:23:18 -0800 Subject: [PATCH 23/23] Bump version to 3.3.1 --- config/app.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/app.yml b/config/app.yml index 60f5cd50a..93e0bcbed 100644 --- a/config/app.yml +++ b/config/app.yml @@ -1,5 +1,5 @@ shared: &shared - version: '3.3.0' + version: '3.3.1' development: <<: *shared diff --git a/package.json b/package.json index 1e778b206..f2efcdc3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chatwoot/chatwoot", - "version": "3.3.0", + "version": "3.3.1", "license": "MIT", "scripts": { "eslint": "eslint app/**/*.{js,vue}",