Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nestordavalos committed Sep 22, 2024
1 parent 934b0f0 commit 476125c
Show file tree
Hide file tree
Showing 17 changed files with 597 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/accounts/inboxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def update_channel_feature_flags
def inbox_attributes
[:name, :avatar, :greeting_enabled, :greeting_message, :enable_email_collect, :csat_survey_enabled, :csat_response_visible,
:enable_auto_assignment, :working_hours_enabled, :out_of_office_message, :timezone, :allow_messages_after_resolved,
:lock_to_single_conversation, :portal_id, :sender_name_type, :business_name, :allow_agent_to_delete_message]
:lock_to_single_conversation, :portal_id, :sender_name_type, :business_name, :allow_agent_to_delete_message, :external_token]
end

def permitted_params(channel_attributes = [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export default {
watch: {
inboxes(newInboxes) {
newInboxes.forEach(inbox => {
//console.log('calling startd wavoip', inbox.external_token);
if (inbox.external_token) {
this.startWavoip(inbox.name, inbox.external_token);
}
Expand Down
10 changes: 6 additions & 4 deletions app/javascript/dashboard/i18n/locale/en/inboxMgmt.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"body": "Add agents to the created inbox."
},
{
"title": "Voilà!",
"title": "Voil�!",
"route": "settings_inbox_finish",
"body": "You are all set to go!"
}
Expand Down Expand Up @@ -305,7 +305,7 @@
"LABEL": "Show profile picture",
"PLACEHOLDER": "Select to show profile picture.",
"ERROR": "Select to show profile picture."
},
},
"URL": {
"LABEL": "Unoapi URL",
"PLACEHOLDER": "Please enter an Unoapi URL",
Expand Down Expand Up @@ -591,7 +591,7 @@
"BUSINESS_HOURS": "Business Hours",
"WIDGET_BUILDER": "Widget Builder",
"BOT_CONFIGURATION": "Bot Configuration",
"UNOAPI_CONFIGURATION": "Unoapi Configuration"
"UNOAPI_CONFIGURATION": "Unoapi Configuration"
},
"SETTINGS": "Settings",
"FEATURES": {
Expand Down Expand Up @@ -650,7 +650,9 @@
"AGENT_PERMISSIONS": "Agent Permissions",
"AGENT_PERMISSIONS_SUB_TEXT": "Update agent permissions for this inbox",
"AGENT_ALLOW_TO_DELETE_MESSAGE": "Allow an agent to delete a message",
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation."
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation.",
"EXTERNAL_TOKEN": "Token Wavoip",
"EXTERNAL_TOKEN_PLACEHOLDER": "Enter the token"
},
"HELP_CENTER": {
"LABEL": "Help Center",
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/dashboard/i18n/locale/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import settings from './settings.json';
import signup from './signup.json';
import teamsSettings from './teamsSettings.json';
import whatsappTemplates from './whatsappTemplates.json';
import webphone from './webphone.json';
import sla from './sla.json';
import inbox from './inbox.json';
import general from './general.json';
Expand Down Expand Up @@ -72,4 +73,5 @@ export default {
...general,
...datePicker,
...customRole,
...webphone,
};
6 changes: 4 additions & 2 deletions app/javascript/dashboard/i18n/locale/es/inboxMgmt.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
"BUSINESS_HOURS": "Horarios",
"WIDGET_BUILDER": "Constructor de Widget",
"BOT_CONFIGURATION": "Configuración del bot",
"UNOAPI_CONFIGURATION": "Unoapi Configuration"
"UNOAPI_CONFIGURATION": "Unoapi Configuration"
},
"SETTINGS": "Ajustes",
"FEATURES": {
Expand Down Expand Up @@ -583,7 +583,9 @@
"AGENT_PERMISSIONS": "Agent Permissions",
"AGENT_PERMISSIONS_SUB_TEXT": "Update agent permissions for this inbox",
"AGENT_ALLOW_TO_DELETE_MESSAGE": "Allow an agent to delete a message",
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation."
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation.",
"EXTERNAL_TOKEN": "Token Wavoip",
"EXTERNAL_TOKEN_PLACEHOLDER": "Introduzca el token de Wavoip"
},
"HELP_CENTER": {
"LABEL": "Centro de ayuda",
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/dashboard/i18n/locale/es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import settings from './settings.json';
import signup from './signup.json';
import teamsSettings from './teamsSettings.json';
import whatsappTemplates from './whatsappTemplates.json';
import webphone from './webphone.json';
import sla from './sla.json';
import inbox from './inbox.json';
import general from './general.json';
Expand Down Expand Up @@ -70,4 +71,5 @@ export default {
...inbox,
...general,
...datePicker,
...webphone,
};
6 changes: 4 additions & 2 deletions app/javascript/dashboard/i18n/locale/pt/inboxMgmt.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
"BUSINESS_HOURS": "Horário comercial",
"WIDGET_BUILDER": "Construtor de Widgets",
"BOT_CONFIGURATION": "Configuração do bot",
"UNOAPI_CONFIGURATION": "Unoapi Configuration"
"UNOAPI_CONFIGURATION": "Unoapi Configuration"
},
"SETTINGS": "Configurações",
"FEATURES": {
Expand Down Expand Up @@ -583,7 +583,9 @@
"AGENT_PERMISSIONS": "Agent Permissions",
"AGENT_PERMISSIONS_SUB_TEXT": "Update agent permissions for this inbox",
"AGENT_ALLOW_TO_DELETE_MESSAGE": "Allow an agent to delete a message",
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation."
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation.",
"EXTERNAL_TOKEN": "Token Wavoip",
"EXTERNAL_TOKEN_PLACEHOLDER": "Enter the token here"
},
"HELP_CENTER": {
"LABEL": "Centro de Suporte",
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/dashboard/i18n/locale/pt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import settings from './settings.json';
import signup from './signup.json';
import teamsSettings from './teamsSettings.json';
import whatsappTemplates from './whatsappTemplates.json';
import webphone from './webphone.json';
import sla from './sla.json';
import inbox from './inbox.json';
import general from './general.json';
Expand Down Expand Up @@ -70,4 +71,5 @@ export default {
...inbox,
...general,
...datePicker,
...webphone,
};
4 changes: 3 additions & 1 deletion app/javascript/dashboard/i18n/locale/pt_BR/inboxMgmt.json
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,9 @@
"AGENT_PERMISSIONS": "Agent Permissions",
"AGENT_PERMISSIONS_SUB_TEXT": "Update agent permissions for this inbox",
"AGENT_ALLOW_TO_DELETE_MESSAGE": "Allow an agent to delete a message",
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation."
"AGENT_ALLOW_TO_DELETE_MESSAGE_SUB_TEXT": "Allow an agent to delete a message from a conversation.",
"EXTERNAL_TOKEN": "Token Wavoip",
"EXTERNAL_TOKEN_PLACEHOLDER": "Digite o token Wavoip"
},
"HELP_CENTER": {
"LABEL": "Centro de Ajuda",
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/dashboard/i18n/locale/pt_BR/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import settings from './settings.json';
import signup from './signup.json';
import teamsSettings from './teamsSettings.json';
import whatsappTemplates from './whatsappTemplates.json';
import webphone from './webphone.json';
import sla from './sla.json';
import inbox from './inbox.json';
import general from './general.json';
Expand Down Expand Up @@ -70,4 +71,5 @@ export default {
...inbox,
...general,
...datePicker,
...webphone,
};
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default {
selectedTabIndex: 0,
selectedPortalSlug: '',
showBusinessNameInput: false,
externalToken: '',
};
},
computed: {
Expand Down Expand Up @@ -262,6 +263,7 @@ export default {
this.avatarUrl = this.inbox.avatar_url;
this.selectedInboxName = this.inbox.name;
this.webhookUrl = this.inbox.webhook_url;
this.externalToken = this.inbox.external_token;
this.greetingEnabled = this.inbox.greeting_enabled || false;
this.greetingMessage = this.inbox.greeting_message || '';
this.emailCollectEnabled = this.inbox.enable_email_collect;
Expand Down Expand Up @@ -302,6 +304,7 @@ export default {
lock_to_single_conversation: this.locktoSingleConversation,
sender_name_type: this.senderNameType,
business_name: this.businessName || null,
external_token: this.externalToken || '',
channel: {
widget_color: this.inbox.widget_color,
website_url: this.channelWebsiteUrl,
Expand All @@ -311,6 +314,7 @@ export default {
selectedFeatureFlags: this.selectedFeatureFlags,
reply_time: this.replyTime || 'in_a_few_minutes',
continuity_via_email: this.continuityViaEmail,
external_token: this.externalToken || '',
},
};
if (this.avatarFile) {
Expand Down Expand Up @@ -360,6 +364,7 @@ export default {
shouldBeUrl,
},
selectedInboxName: {},
externalToken: {},
},
};
</script>
Expand Down Expand Up @@ -435,6 +440,15 @@ export default {
"
@blur="v$.webhookUrl.$touch"
/>
<woot-input
v-if="isAPIInbox"
v-model.trim="externalToken"
class="w-3/4 pb-4"
:label="$t('INBOX_MGMT.SETTINGS_POPUP.EXTERNAL_TOKEN')"
:placeholder="
$t('INBOX_MGMT.SETTINGS_POPUP.EXTERNAL_TOKEN_PLACEHOLDER')
"
/>
<woot-input
v-if="isAWebWidgetInbox"
v-model.trim="channelWebsiteUrl"
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/dashboard/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import userNotificationSettings from './modules/userNotificationSettings';
import webhooks from './modules/webhooks';
import draftMessages from './modules/draftMessages';
import SLAReports from './modules/SLAReports';
import webphone from './modules/webphone';

const plugins = [];

Expand Down Expand Up @@ -97,6 +98,7 @@ export default new Vuex.Store({
draftMessages,
sla,
slaReports: SLAReports,
webphone,
},
plugins,
});
2 changes: 2 additions & 0 deletions app/javascript/dashboard/store/modules/webphone.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export const actions = {
}
const WAV = new Wavoip();
const whatsapp_instance = WAV.connect(token);

//console.log('startWavoip', whatsapp_instance, token);
commit(types.default.ADD_WAVOIP, {
token: token,
whatsapp_instance: whatsapp_instance,
Expand Down
2 changes: 1 addition & 1 deletion app/models/inbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# email_address :string
# enable_auto_assignment :boolean default(TRUE)
# enable_email_collect :boolean default(TRUE)
# external_token :string
# external_token :string default(""), not null
# greeting_enabled :boolean default(FALSE)
# greeting_message :string
# lock_to_single_conversation :boolean default(FALSE), not null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddAllowAgentToDeleteMessageToInboxes < ActiveRecord::Migration[7.0]
def change
add_column :inboxes, :allow_agent_to_delete_message, :boolean, default: true, null: false
end
end
class AddAllowAgentToDeleteMessageToInboxes < ActiveRecord::Migration[7.0]
def change
add_column :inboxes, :allow_agent_to_delete_message, :boolean, default: true, null: false
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@
t.bigint "portal_id"
t.integer "sender_name_type", default: 0, null: false
t.string "business_name"
t.string "external_token"
t.string "external_token", default: "", null: false
t.boolean "csat_response_visible", default: false, null: false
t.boolean "allow_agent_to_delete_message", default: true, null: false
t.index ["account_id"], name: "index_inboxes_on_account_id"
Expand Down
Loading

0 comments on commit 476125c

Please sign in to comment.