Skip to content

Commit

Permalink
Merge branch 'develop' into admin-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored May 5, 2020
2 parents 2848317 + eef240e commit e009ec8
Show file tree
Hide file tree
Showing 20 changed files with 241 additions and 200 deletions.
9 changes: 0 additions & 9 deletions app/livechat/client/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ TabBar.addGroup('uploaded-files-list', ['live']);
TabBar.addGroup('push-notifications', ['live']);
TabBar.addGroup('video', ['live']);

TabBar.addButton({
groups: ['live'],
id: 'external-search',
i18nTitle: 'Knowledge_Base',
icon: 'book',
template: 'externalSearch',
order: 10,
});

MessageTypes.registerType({
id: 'livechat-close',
system: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,36 @@ <h2>{{_ "Webhooks"}}</h2>
</label>
</div>
</div>
<div class="input-line">
<label for="sendOnStart">
<input type="checkbox" name="sendOnStart" id="sendOnStart" value="1" checked="{{sendOnStartChecked}}">
{{_ "Send_request_on_chat_start"}}
</label>
</div>
<div class="input-line">
<label for="sendOnClose">
<input type="checkbox" name="sendOnClose" id="sendOnClose" value="1" checked="{{sendOnCloseChecked}}">
{{_ "Send_request_on_chat_close"}}
</label>
</div>
<div class="input-line">
<label for="sendOnChatTaken">
<input type="checkbox" name="sendOnChatTaken" id="sendOnChatTaken" value="1" checked="{{sendOnChatTakenChecked}}">
{{_ "Send_request_on_chat_taken"}}
</label>
</div>
<div class="input-line">
<label for="sendOnChatQueued">
<input type="checkbox" name="sendOnChatQueued" id="sendOnChatQueued" value="1" checked="{{sendOnChatQueuedChecked}}">
{{_ "Send_request_on_chat_queued"}}
</label>
</div>
<div class="input-line">
<label for="sendOnForward">
<input type="checkbox" name="sendOnForward" id="sendOnForward" value="1" checked="{{sendOnForwardChecked}}">
{{_ "Send_request_on_forwarding"}}
</label>
</div>
<div class="input-line">
<label for="sendOnOffline">
<input type="checkbox" name="sendOnOffline" id="sendOnOffline" value="1" checked="{{sendOnOfflineChecked}}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,26 @@ Template.livechatIntegrationWebhook.helpers({
disableTest() {
return Template.instance().disableTest.get();
},
sendOnStartChecked() {
const setting = getIntegrationSettingById(Template.instance().settings.get(), 'Livechat_webhook_on_start');
return setting && setting.value;
},
sendOnCloseChecked() {
const setting = getIntegrationSettingById(Template.instance().settings.get(), 'Livechat_webhook_on_close');
return setting && setting.value;
},
sendOnChatTakenChecked() {
const setting = getIntegrationSettingById(Template.instance().settings.get(), 'Livechat_webhook_on_chat_taken');
return setting && setting.value;
},
sendOnChatQueuedChecked() {
const setting = getIntegrationSettingById(Template.instance().settings.get(), 'Livechat_webhook_on_chat_queued');
return setting && setting.value;
},
sendOnForwardChecked() {
const setting = getIntegrationSettingById(Template.instance().settings.get(), 'Livechat_webhook_on_forward');
return setting && setting.value;
},
sendOnOfflineChecked() {
const setting = getIntegrationSettingById(Template.instance().settings.get(), 'Livechat_webhook_on_offline_msg');
return setting && setting.value;
Expand Down Expand Up @@ -78,14 +94,22 @@ Template.livechatIntegrationWebhook.events({

const webhookUrl = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhookUrl');
const secretToken = getIntegrationSettingById(instance.settings.get(), 'Livechat_secret_token');
const webhookOnStart = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_start');
const webhookOnClose = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_close');
const webhookOnChatTaken = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_chat_taken');
const webhookOnChatQueued = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_chat_queued');
const webhookOnForward = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_forward');
const webhookOnOfflineMsg = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_offline_msg');
const webhookOnVisitorMessage = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_visitor_message');
const webhookOnAgentMessage = getIntegrationSettingById(instance.settings.get(), 'Livechat_webhook_on_agent_message');

instance.$('#webhookUrl').val(webhookUrl && webhookUrl.value);
instance.$('#secretToken').val(secretToken && secretToken.value);
instance.$('#sendOnStart').get(0).checked = webhookOnStart && webhookOnStart.value;
instance.$('#sendOnClose').get(0).checked = webhookOnClose && webhookOnClose.value;
instance.$('#sendOnChatTaken').get(0).checked = webhookOnChatTaken && webhookOnChatTaken.value;
instance.$('#sendOnChatQueued').get(0).checked = webhookOnChatQueued && webhookOnChatQueued.value;
instance.$('#sendOnForward').get(0).checked = webhookOnForward && webhookOnForward.value;
instance.$('#sendOnOffline').get(0).checked = webhookOnOfflineMsg && webhookOnOfflineMsg.value;
instance.$('#sendOnVisitorMessage').get(0).checked = webhookOnVisitorMessage && webhookOnVisitorMessage.value;
instance.$('#sendOnAgentMessage').get(0).checked = webhookOnAgentMessage && webhookOnAgentMessage.value;
Expand All @@ -98,7 +122,11 @@ Template.livechatIntegrationWebhook.events({
const settings = {
Livechat_webhookUrl: s.trim(instance.$('#webhookUrl').val()),
Livechat_secret_token: s.trim(instance.$('#secretToken').val()),
Livechat_webhook_on_start: instance.$('#sendOnStart').get(0).checked,
Livechat_webhook_on_close: instance.$('#sendOnClose').get(0).checked,
Livechat_webhook_on_chat_taken: instance.$('#sendOnChatTaken').get(0).checked,
Livechat_webhook_on_chat_queued: instance.$('#sendOnChatQueued').get(0).checked,
Livechat_webhook_on_forward: instance.$('#sendOnForward').get(0).checked,
Livechat_webhook_on_offline_msg: instance.$('#sendOnOffline').get(0).checked,
Livechat_webhook_on_visitor_message: instance.$('#sendOnVisitorMessage').get(0).checked,
Livechat_webhook_on_agent_message: instance.$('#sendOnAgentMessage').get(0).checked,
Expand Down
18 changes: 0 additions & 18 deletions app/livechat/client/views/app/tabbar/externalSearch.html

This file was deleted.

57 changes: 0 additions & 57 deletions app/livechat/client/views/app/tabbar/externalSearch.js

This file was deleted.

1 change: 0 additions & 1 deletion app/livechat/client/views/regular.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import './app/livechatNotSubscribed.html';
import './app/livechatRoomTagSelector';
import './app/tabbar/agentEdit';
import './app/tabbar/agentInfo';
import './app/tabbar/externalSearch';
import './app/tabbar/visitorEdit';
import './app/tabbar/visitorForward';
import './app/tabbar/visitorHistory';
Expand Down
2 changes: 1 addition & 1 deletion app/livechat/server/api/lib/integrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function findIntegrationSettings({ userId }) {
throw new Error('error-not-authorized');
}

const settings = await Settings.findByIds(['Livechat_webhookUrl', 'Livechat_secret_token', 'Livechat_webhook_on_close', 'Livechat_webhook_on_offline_msg', 'Livechat_webhook_on_visitor_message', 'Livechat_webhook_on_agent_message']).toArray();
const settings = await Settings.findByIds(['Livechat_webhookUrl', 'Livechat_secret_token', 'Livechat_webhook_on_start', 'Livechat_webhook_on_close', 'Livechat_webhook_on_chat_taken', 'Livechat_webhook_on_chat_queued', 'Livechat_webhook_on_forward', 'Livechat_webhook_on_offline_msg', 'Livechat_webhook_on_visitor_message', 'Livechat_webhook_on_agent_message']).toArray();

return { settings };
}
53 changes: 28 additions & 25 deletions app/livechat/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,41 @@ Meteor.startup(function() {
secret: true,
});

settings.add('Livechat_webhook_on_start', false, {
type: 'boolean',
group: 'Omnichannel',
section: 'CRM_Integration',
i18nLabel: 'Send_request_on_chat_start',
});

settings.add('Livechat_webhook_on_close', false, {
type: 'boolean',
group: 'Omnichannel',
section: 'CRM_Integration',
i18nLabel: 'Send_request_on_chat_close',
});

settings.add('Livechat_webhook_on_chat_taken', false, {
type: 'boolean',
group: 'Omnichannel',
section: 'CRM_Integration',
i18nLabel: 'Send_request_on_chat_taken',
});

settings.add('Livechat_webhook_on_chat_queued', false, {
type: 'boolean',
group: 'Omnichannel',
section: 'CRM_Integration',
i18nLabel: 'Send_request_on_chat_queued',
});

settings.add('Livechat_webhook_on_forward', false, {
type: 'boolean',
group: 'Omnichannel',
section: 'CRM_Integration',
i18nLabel: 'Send_request_on_forwarding',
});

settings.add('Livechat_webhook_on_offline_msg', false, {
type: 'boolean',
group: 'Omnichannel',
Expand Down Expand Up @@ -250,31 +278,6 @@ Meteor.startup(function() {
i18nLabel: 'Lead_capture_phone_regex',
});

settings.add('Livechat_Knowledge_Enabled', false, {
type: 'boolean',
group: 'Omnichannel',
section: 'Knowledge_Base',
public: true,
i18nLabel: 'Enabled',
});

settings.add('Livechat_Knowledge_Apiai_Key', '', {
type: 'string',
group: 'Omnichannel',
section: 'Knowledge_Base',
public: true,
i18nLabel: 'Apiai_Key',
secret: true,
});

settings.add('Livechat_Knowledge_Apiai_Language', 'en', {
type: 'string',
group: 'Omnichannel',
section: 'Knowledge_Base',
public: true,
i18nLabel: 'Apiai_Language',
});

settings.add('Livechat_history_monitor_type', 'url', {
type: 'select',
group: 'Omnichannel',
Expand Down
72 changes: 0 additions & 72 deletions app/livechat/server/hooks/externalMessage.js

This file was deleted.

Loading

0 comments on commit e009ec8

Please sign in to comment.