diff --git a/app/controllers/api/v1/accounts/inboxes_controller.rb b/app/controllers/api/v1/accounts/inboxes_controller.rb
index bb2024d50..9360b700f 100644
--- a/app/controllers/api/v1/accounts/inboxes_controller.rb
+++ b/app/controllers/api/v1/accounts/inboxes_controller.rb
@@ -4,7 +4,7 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
before_action :check_authorization
def index
- @inboxes = policy_scope(Current.account.inboxes.includes(:channel, :avatar_attachment))
+ @inboxes = policy_scope(Current.account.inboxes.order_by_id.includes(:channel, :avatar_attachment))
end
def create
@@ -23,7 +23,10 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
def update
@inbox.update(inbox_update_params.except(:channel))
- @inbox.channel.update!(inbox_update_params[:channel]) if @inbox.channel.is_a?(Channel::WebWidget) && inbox_update_params[:channel].present?
+ return unless @inbox.channel.is_a?(Channel::WebWidget) && inbox_update_params[:channel].present?
+
+ @inbox.channel.update!(inbox_update_params[:channel])
+ update_channel_feature_flags
end
def set_agent_bot
@@ -67,6 +70,13 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
end
end
+ def update_channel_feature_flags
+ return unless inbox_update_params[:channel].key? :selected_feature_flags
+
+ @inbox.channel.selected_feature_flags = inbox_update_params[:channel][:selected_feature_flags]
+ @inbox.channel.save!
+ end
+
def permitted_params
params.permit(:id, :avatar, :name, :greeting_message, :greeting_enabled, channel:
[:type, :website_url, :widget_color, :welcome_title, :welcome_tagline, :webhook_url, :email])
@@ -74,6 +84,14 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
def inbox_update_params
params.permit(:enable_auto_assignment, :name, :avatar, :greeting_message, :greeting_enabled,
- channel: [:website_url, :widget_color, :welcome_title, :welcome_tagline, :webhook_url, :email])
+ channel: [
+ :website_url,
+ :widget_color,
+ :welcome_title,
+ :welcome_tagline,
+ :webhook_url,
+ :email,
+ selected_feature_flags: []
+ ])
end
end
diff --git a/app/javascript/dashboard/assets/scss/_layout.scss b/app/javascript/dashboard/assets/scss/_layout.scss
index cdb81c76a..7be546b01 100644
--- a/app/javascript/dashboard/assets/scss/_layout.scss
+++ b/app/javascript/dashboard/assets/scss/_layout.scss
@@ -1,11 +1,11 @@
html,
body {
- height: 100%;
- width: 100%;
- padding: 0;
- margin: 0;
- -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
+ -webkit-font-smoothing: antialiased;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ width: 100%;
}
.app-wrapper {
@@ -26,36 +26,40 @@ body {
.view-box {
@include full-height;
- height: 100vh;
@include margin(0);
@include space-between-column;
+
+ height: 100vh;
}
.view-panel {
- flex-direction: column;
@include margin($zero);
@include padding($space-normal);
+
+ flex-direction: column;
overflow-y: auto;
}
.content-box {
- overflow: auto;
@include padding($space-normal);
+
+ overflow: auto;
}
.back-button {
@include flex;
+
align-items: center;
color: $color-woot;
+ cursor: pointer;
font-size: $font-size-default;
font-weight: $font-weight-normal;
margin-right: $space-normal;
- cursor: pointer;
- &:before {
- vertical-align: text-bottom;
- margin-right: $space-smaller;
+ &::before {
font-size: $font-size-large;
+ margin-right: $space-small;
+ vertical-align: text-bottom;
}
}
@@ -66,12 +70,14 @@ body {
.no-items-error-message {
@include flex;
@include full-height;
- justify-content: center;
+
align-items: center;
flex-direction: column;
+ justify-content: center;
img {
- max-width: $space-mega;
@include padding($space-one);
+
+ max-width: $space-mega;
}
}
diff --git a/app/javascript/dashboard/assets/scss/views/settings/inbox.scss b/app/javascript/dashboard/assets/scss/views/settings/inbox.scss
index 05cfb9b9e..27ff6fb1f 100644
--- a/app/javascript/dashboard/assets/scss/views/settings/inbox.scss
+++ b/app/javascript/dashboard/assets/scss/views/settings/inbox.scss
@@ -202,7 +202,7 @@
}
.settings--content {
- @include margin($space-small $space-larger);
+ @include margin($space-small $space-large);
.title {
font-weight: $font-weight-medium;
diff --git a/app/javascript/dashboard/components/ModalHeader.vue b/app/javascript/dashboard/components/ModalHeader.vue
index 9f930f983..9b80220a5 100644
--- a/app/javascript/dashboard/components/ModalHeader.vue
+++ b/app/javascript/dashboard/components/ModalHeader.vue
@@ -7,15 +7,25 @@
{{ headerContent }}
+
diff --git a/app/javascript/dashboard/components/layout/SidebarItem.vue b/app/javascript/dashboard/components/layout/SidebarItem.vue
index 7a305fbd3..e75b40619 100644
--- a/app/javascript/dashboard/components/layout/SidebarItem.vue
+++ b/app/javascript/dashboard/components/layout/SidebarItem.vue
@@ -57,15 +57,8 @@ import { mapGetters } from 'vuex';
import router from '../../routes';
import adminMixin from '../../mixins/isAdmin';
+import { INBOX_TYPES } from 'shared/mixins/inboxMixin';
-const INBOX_TYPES = {
- WEB: 'Channel::WebWidget',
- FB: 'Channel::FacebookPage',
- TWITTER: 'Channel::TwitterProfile',
- TWILIO: 'Channel::TwilioSms',
- API: 'Channel::Api',
- EMAIL: 'Channel::Email',
-};
const getInboxClassByType = type => {
switch (type) {
case INBOX_TYPES.WEB:
diff --git a/app/javascript/dashboard/components/widgets/ChannelItem.vue b/app/javascript/dashboard/components/widgets/ChannelItem.vue
index 21c0aaf91..39fa2e028 100644
--- a/app/javascript/dashboard/components/widgets/ChannelItem.vue
+++ b/app/javascript/dashboard/components/widgets/ChannelItem.vue
@@ -1,43 +1,43 @@
- {{ channel }}
+ {{ channel.name }}
@@ -45,7 +45,7 @@
export default {
props: {
channel: {
- type: String,
+ type: Object,
required: true,
},
enabledFeatures: {
@@ -53,25 +53,28 @@ export default {
required: true,
},
},
- methods: {
- isActive(channel) {
+ computed: {
+ isActive() {
+ const { key } = this.channel;
if (Object.keys(this.enabledFeatures) === 0) {
return false;
}
- if (channel === 'facebook') {
+ if (key === 'facebook') {
return this.enabledFeatures.channel_facebook;
}
- if (channel === 'twitter') {
+ if (key === 'twitter') {
return this.enabledFeatures.channel_twitter;
}
- if (channel === 'email') {
+ if (key === 'email') {
return this.enabledFeatures.channel_email;
}
- return ['website', 'twilio', 'api'].includes(channel);
+ return ['website', 'twilio', 'api'].includes(key);
},
+ },
+ methods: {
onItemClick() {
- if (this.isActive(this.channel)) {
- this.$emit('channel-item-click', this.channel);
+ if (this.isActive) {
+ this.$emit('channel-item-click', this.channel.key);
}
},
},
diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
index 00d5d5dff..fd9fd26f7 100644
--- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
+++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
@@ -96,6 +96,7 @@ import {
hasPressedShift,
} from 'shared/helpers/KeyboardHelpers';
import { MESSAGE_MAX_LENGTH } from 'shared/helpers/MessageTypeHelper';
+import inboxMixin from 'shared/mixins/inboxMixin';
export default {
components: {
@@ -104,7 +105,7 @@ export default {
FileUpload,
ResizableTextArea,
},
- mixins: [clickaway],
+ mixins: [clickaway, inboxMixin],
data() {
return {
message: '',
@@ -148,9 +149,6 @@ export default {
this.message.length > this.maxLength
);
},
- channelType() {
- return this.inbox.channel_type;
- },
conversationType() {
const { additional_attributes: additionalAttributes } = this.currentChat;
const type = additionalAttributes ? additionalAttributes.type : '';
@@ -174,29 +172,6 @@ export default {
}
return MESSAGE_MAX_LENGTH.GENERAL;
},
- isATwitterInbox() {
- return this.channelType === 'Channel::TwitterProfile';
- },
- isAFacebookInbox() {
- return this.channelType === 'Channel::FacebookPage';
- },
- isAWebWidgetInbox() {
- return this.channelType === 'Channel::WebWidget';
- },
- isATwilioSMSChannel() {
- const { phone_number: phoneNumber = '' } = this.inbox;
- return (
- this.channelType === 'Channel::TwilioSms' &&
- !phoneNumber.startsWith('whatsapp')
- );
- },
- isATwilioWhatsappChannel() {
- const { phone_number: phoneNumber = '' } = this.inbox;
- return (
- this.channelType === 'Channel::TwilioSms' &&
- phoneNumber.startsWith('whatsapp')
- );
- },
showFileUpload() {
return (
this.isAWebWidgetInbox ||
diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json
index 2f0230402..fb4c71134 100644
--- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json
+++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json
@@ -117,16 +117,16 @@
},
"API_CHANNEL": {
"TITLE": "API Channel",
- "DESC": "Integrate with API channel and start supporting your customers via chatwoot.",
+ "DESC": "Integrate with API channel and start supporting your customers.",
"CHANNEL_NAME": {
"LABEL": "Channel Name",
"PLACEHOLDER": "Please enter a channel name",
"ERROR": "This field is required"
},
"WEBHOOK_URL": {
- "LABEL": "Webhook Url",
- "SUBTITLE": "Configure the url where you want to recieve callbacks from chatwoot on events.",
- "PLACEHOLDER": "Webhook Url"
+ "LABEL": "Webhook URL",
+ "SUBTITLE": "Configure the URL where you want to recieve callbacks on events.",
+ "PLACEHOLDER": "Webhook URL"
},
"SUBMIT_BUTTON": "Create API Channel",
"API": {
@@ -135,7 +135,7 @@
},
"EMAIL_CHANNEL": {
"TITLE": "Email Channel",
- "DESC": "Integrate you email inbox with chatwoot.",
+ "DESC": "Integrate you email inbox.",
"CHANNEL_NAME": {
"LABEL": "Channel Name",
"PLACEHOLDER": "Please enter a channel name",
@@ -150,7 +150,7 @@
"API": {
"ERROR_MESSAGE": "We were not able to save the email channel"
},
- "FINISH_MESSAGE" : "Start forwarding your emails to the following email address."
+ "FINISH_MESSAGE": "Start forwarding your emails to the following email address."
},
"AUTH": {
"TITLE": "Channels",
@@ -212,7 +212,17 @@
"ERROR_MESSAGE": "Could not delete inbox. Please try again later."
}
},
+ "TABS": {
+ "SETTINGS": "Settings",
+ "COLLABORATORS": "Collaborators",
+ "CONFIGURATION": "Configuration"
+ },
"SETTINGS": "Settings",
+ "FEATURES": {
+ "LABEL": "Features",
+ "DISPLAY_FILE_PICKER": "Display file picker on the widget",
+ "DISPLAY_EMOJI_PICKER": "Display emoji picker on the widget"
+ },
"SETTINGS_POPUP": {
"MESSENGER_HEADING": "Messenger Script",
"MESSENGER_SUB_HEAD": "Place this button inside your body tag",
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/AddAgents.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/AddAgents.vue
index 237b9f94e..7491732e4 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/AddAgents.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/AddAgents.vue
@@ -15,7 +15,7 @@
v-model="selectedAgents"
:options="agentList"
track-by="id"
- label="name"
+ label="available_name"
:multiple="true"
:close-on-select="false"
:clear-on-select="false"
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue
index 4a0ba07ec..deaf91183 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/ChannelList.vue
@@ -30,14 +30,14 @@ export default {
data() {
return {
channelList: [
- 'website',
- 'facebook',
- 'twitter',
- 'twilio',
- 'email',
- 'api',
- 'telegram',
- 'line',
+ { key: 'website', name: 'Website' },
+ { key: 'facebook', name: 'Facebook' },
+ { key: 'twitter', name: 'Twitter' },
+ { key: 'twilio', name: 'Twilio' },
+ { key: 'email', name: 'Email' },
+ { key: 'api', name: 'API' },
+ { key: 'telegram', name: 'Telegram' },
+ { key: 'line', name: 'Line' },
],
enabledFeatures: {},
};
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue
index 10f5ff5a0..3b322a680 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue
@@ -3,9 +3,18 @@
+ >
+
+
+
+
-
+
-
-
+
+
+ {{ $t('INBOX_MGMT.FEATURES.LABEL') }}
+
+
+
+
+ {{ $t('INBOX_MGMT.FEATURES.DISPLAY_FILE_PICKER') }}
+
+
+
+
+
+ {{ $t('INBOX_MGMT.FEATURES.DISPLAY_EMOJI_PICKER') }}
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-