Merge branch 'develop' into feat-macros-frontend

This commit is contained in:
fayazara 2022-10-12 11:30:35 +05:30
commit ae304bc88e
49 changed files with 893 additions and 357 deletions

View file

@ -11,7 +11,7 @@ class DeviseOverrides::PasswordsController < Devise::PasswordsController
@recoverable = User.find_by(reset_password_token: reset_password_token) @recoverable = User.find_by(reset_password_token: reset_password_token)
if @recoverable && reset_password_and_confirmation(@recoverable) if @recoverable && reset_password_and_confirmation(@recoverable)
send_auth_headers(@recoverable) send_auth_headers(@recoverable)
render partial: 'devise/auth.json', locals: { resource: @recoverable } render partial: 'devise/auth', formats: [:json], locals: { resource: @recoverable }
else else
render json: { message: 'Invalid token', redirect_url: '/' }, status: :unprocessable_entity render json: { message: 'Invalid token', redirect_url: '/' }, status: :unprocessable_entity
end end

View file

@ -0,0 +1,9 @@
import ApiClient from './ApiClient';
class AgentBotsAPI extends ApiClient {
constructor() {
super('agent_bots', { accountScoped: true });
}
}
export default new AgentBotsAPI();

View file

@ -6,10 +6,6 @@ class MacrosAPI extends ApiClient {
super('macros', { accountScoped: true }); super('macros', { accountScoped: true });
} }
getSingleMacro(macroId) {
return axios.get(`${this.url}/${macroId}`);
}
executeMacro({ macroId, conversationIds }) { executeMacro({ macroId, conversationIds }) {
return axios.post(`${this.url}/${macroId}/execute`, { return axios.post(`${this.url}/${macroId}/execute`, {
conversation_ids: conversationIds, conversation_ids: conversationIds,

View file

@ -0,0 +1,13 @@
import AgentBotsAPI from '../agentBots';
import ApiClient from '../ApiClient';
describe('#AgentBotsAPI', () => {
it('creates correct instance', () => {
expect(AgentBotsAPI).toBeInstanceOf(ApiClient);
expect(AgentBotsAPI).toHaveProperty('get');
expect(AgentBotsAPI).toHaveProperty('show');
expect(AgentBotsAPI).toHaveProperty('create');
expect(AgentBotsAPI).toHaveProperty('update');
expect(AgentBotsAPI).toHaveProperty('delete');
});
});

View file

@ -8,6 +8,7 @@ describe('#macrosAPI', () => {
expect(macros).toHaveProperty('create'); expect(macros).toHaveProperty('create');
expect(macros).toHaveProperty('update'); expect(macros).toHaveProperty('update');
expect(macros).toHaveProperty('delete'); expect(macros).toHaveProperty('delete');
expect(macros).toHaveProperty('show');
expect(macros.url).toBe('/api/v1/macros'); expect(macros.url).toBe('/api/v1/macros');
}); });
}); });

View file

@ -3,6 +3,7 @@ import { frontendURL } from '../../../../helper/URLHelper';
const settings = accountId => ({ const settings = accountId => ({
parentNav: 'settings', parentNav: 'settings',
routes: [ routes: [
'agent_bots',
'agent_list', 'agent_list',
'canned_list', 'canned_list',
'labels_list', 'labels_list',
@ -77,6 +78,7 @@ const settings = accountId => ({
{ {
icon: 'automation', icon: 'automation',
label: 'AUTOMATION', label: 'AUTOMATION',
beta: true,
hasSubMenu: false, hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/automation/list`), toState: frontendURL(`accounts/${accountId}/settings/automation/list`),
toStateName: 'automation_list', toStateName: 'automation_list',
@ -88,6 +90,15 @@ const settings = accountId => ({
toState: frontendURL(`accounts/${accountId}/settings/macros`), toState: frontendURL(`accounts/${accountId}/settings/macros`),
toStateName: 'macros_wrapper', toStateName: 'macros_wrapper',
}, },
{
icon: 'bot',
label: 'AGENT_BOTS',
beta: true,
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/agent-bots`),
toStateName: 'agent_bots',
featureFlagKey: 'agent_bots',
},
{ {
icon: 'chat-multiple', icon: 'chat-multiple',
label: 'CANNED_RESPONSES', label: 'CANNED_RESPONSES',

View file

@ -1,5 +1,5 @@
<template> <template>
<li class="sidebar-item"> <li v-show="isMenuItemVisible" class="sidebar-item">
<div v-if="hasSubMenu" class="secondary-menu--wrap"> <div v-if="hasSubMenu" class="secondary-menu--wrap">
<span class="secondary-menu--header fs-small"> <span class="secondary-menu--header fs-small">
{{ $t(`SIDEBAR.${menuItem.label}`) }} {{ $t(`SIDEBAR.${menuItem.label}`) }}
@ -36,7 +36,7 @@
{{ `${menuItem.count}` }} {{ `${menuItem.count}` }}
</span> </span>
<span <span
v-if="menuItem.label === 'AUTOMATION'" v-if="menuItem.beta"
data-view-component="true" data-view-component="true"
label="Beta" label="Beta"
class="beta" class="beta"
@ -114,10 +114,23 @@ export default {
}, },
}, },
computed: { computed: {
...mapGetters({ activeInbox: 'getSelectedInbox' }), ...mapGetters({
activeInbox: 'getSelectedInbox',
accountId: 'getCurrentAccountId',
isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount',
}),
hasSubMenu() { hasSubMenu() {
return !!this.menuItem.children; return !!this.menuItem.children;
}, },
isMenuItemVisible() {
if (!this.menuItem.featureFlagKey) {
return true;
}
return this.isFeatureEnabledonAccount(
this.accountId,
this.menuItem.featureFlagKey
);
},
isInboxConversation() { isInboxConversation() {
return ( return (
this.$store.state.route.name === 'inbox_conversation' && this.$store.state.route.name === 'inbox_conversation' &&

View file

@ -141,9 +141,19 @@ export default {
assignableAgentsUiFlags: 'inboxAssignableAgents/getUIFlags', assignableAgentsUiFlags: 'inboxAssignableAgents/getUIFlags',
}), }),
assignableAgents() { assignableAgents() {
return this.$store.getters['inboxAssignableAgents/getAssignableAgents']( return [
this.inboxId {
); confirmed: true,
name: 'None',
id: null,
role: 'agent',
account_id: 0,
email: 'None',
},
...this.$store.getters['inboxAssignableAgents/getAssignableAgents'](
this.inboxId
),
];
}, },
}, },
mounted() { mounted() {

View file

@ -57,7 +57,7 @@
</li> </li>
</ul> </ul>
<div v-else class="agent-confirmation-container"> <div v-else class="agent-confirmation-container">
<p> <p v-if="selectedAgent.id">
{{ {{
$t('BULK_ACTION.ASSIGN_CONFIRMATION_LABEL', { $t('BULK_ACTION.ASSIGN_CONFIRMATION_LABEL', {
conversationCount, conversationCount,
@ -67,6 +67,15 @@
<strong> <strong>
{{ selectedAgent.name }} {{ selectedAgent.name }}
</strong> </strong>
<span>?</span>
</p>
<p v-else>
{{
$t('BULK_ACTION.UNASSIGN_CONFIRMATION_LABEL', {
conversationCount,
conversationLabel,
})
}}
</p> </p>
<div class="agent-confirmation-actions"> <div class="agent-confirmation-actions">
<woot-button <woot-button
@ -82,7 +91,7 @@
:is-loading="uiFlags.isUpdating" :is-loading="uiFlags.isUpdating"
@click="submit" @click="submit"
> >
{{ $t('BULK_ACTION.ASSIGN_LABEL') }} {{ $t('BULK_ACTION.YES') }}
</woot-button> </woot-button>
</div> </div>
</div> </div>
@ -131,7 +140,17 @@ export default {
agent.name.toLowerCase().includes(this.query.toLowerCase()) agent.name.toLowerCase().includes(this.query.toLowerCase())
); );
} }
return this.assignableAgents; return [
{
confirmed: true,
name: 'None',
id: null,
role: 'agent',
account_id: 0,
email: 'None',
},
...this.assignableAgents,
];
}, },
assignableAgents() { assignableAgents() {
return this.$store.getters['inboxAssignableAgents/getAssignableAgents']( return this.$store.getters['inboxAssignableAgents/getAssignableAgents'](

View file

@ -2,8 +2,8 @@
"CONVERSATION": { "CONVERSATION": {
"SELECT_A_CONVERSATION": "الرجاء اختيار محادثة من قائمة المحادثات", "SELECT_A_CONVERSATION": "الرجاء اختيار محادثة من قائمة المحادثات",
"CSAT_REPLY_MESSAGE": "الرجاء تقييم المحادثة", "CSAT_REPLY_MESSAGE": "الرجاء تقييم المحادثة",
"404": "Sorry, we cannot find the conversation. Please try again", "404": "عذراً، لا يمكننا العثور على المحادثة. الرجاء المحاولة مرة أخرى",
"SWITCH_VIEW_LAYOUT": "Switch the layout", "SWITCH_VIEW_LAYOUT": "تبديل التصميم",
"DASHBOARD_APP_TAB_MESSAGES": "الرسائل", "DASHBOARD_APP_TAB_MESSAGES": "الرسائل",
"UNVERIFIED_SESSION": "لم يتم التحقق من هوية هذا المستخدم", "UNVERIFIED_SESSION": "لم يتم التحقق من هوية هذا المستخدم",
"NO_MESSAGE_1": "لا توجد رسائل بعد من العملاء في صندوق الوارد الخاص بك.", "NO_MESSAGE_1": "لا توجد رسائل بعد من العملاء في صندوق الوارد الخاص بك.",
@ -63,30 +63,30 @@
}, },
"CARD_CONTEXT_MENU": { "CARD_CONTEXT_MENU": {
"PENDING": "تحديد كمعلق", "PENDING": "تحديد كمعلق",
"RESOLVED": "Mark as resolved", "RESOLVED": "تحديد كمحلولة",
"REOPEN": "إعادة فتح المحادثة", "REOPEN": "إعادة فتح المحادثة",
"SNOOZE": { "SNOOZE": {
"TITLE": "Snooze", "TITLE": "غفوة",
"NEXT_REPLY": "حتى الرد القادم", "NEXT_REPLY": "حتى الرد القادم",
"TOMORROW": "حتى الغد", "TOMORROW": "حتى الغد",
"NEXT_WEEK": "حتى الأسبوع القادم" "NEXT_WEEK": "حتى الأسبوع القادم"
}, },
"ASSIGN_AGENT": "Assign agent", "ASSIGN_AGENT": "تعيين وكيل",
"ASSIGN_LABEL": "Assign label", "ASSIGN_LABEL": "إضافة وسم",
"AGENTS_LOADING": "Loading agents...", "AGENTS_LOADING": "جاري تحميل الوكلاء...",
"ASSIGN_TEAM": "Assign team", "ASSIGN_TEAM": "تعيين فريق",
"API": { "API": {
"AGENT_ASSIGNMENT": { "AGENT_ASSIGNMENT": {
"SUCCESFUL": "Conversation id %{conversationId} assigned to \"%{agentName}\"", "SUCCESFUL": "معرف المحادثة %{conversationId} تم تعيينه ل \"%{agentName}\"",
"FAILED": "Couldn't assign agent. Please try again." "FAILED": "تعذر تعيين الوكيل. الرجاء المحاولة مرة أخرى."
}, },
"LABEL_ASSIGNMENT": { "LABEL_ASSIGNMENT": {
"SUCCESFUL": "Assigned label #%{labelName} to conversation id %{conversationId}", "SUCCESFUL": "تعيين تسمية #%{labelName} لمعرف المحادثة %{conversationId}",
"FAILED": "Couldn't assign label. Please try again." "FAILED": "تعذر تعيين التسمية. الرجاء المحاولة مرة أخرى."
}, },
"TEAM_ASSIGNMENT": { "TEAM_ASSIGNMENT": {
"SUCCESFUL": "Assigned team \"%{team}\" to conversation id %{conversationId}", "SUCCESFUL": "الفريق المعين \"%{team}\" لمعرف المحادثة %{conversationId}",
"FAILED": "Couldn't assign team. Please try again." "FAILED": "تعذر تعيين الفريق. الرجاء المحاولة مرة أخرى."
} }
} }
}, },
@ -131,13 +131,13 @@
}, },
"VISIBLE_TO_AGENTS": "ملاحظة خاصة: مرئية فقط لأعضاء فريق العمل والموظفين", "VISIBLE_TO_AGENTS": "ملاحظة خاصة: مرئية فقط لأعضاء فريق العمل والموظفين",
"CHANGE_STATUS": "تم تغيير حالة المحادثة", "CHANGE_STATUS": "تم تغيير حالة المحادثة",
"CHANGE_STATUS_FAILED": "Conversation status change failed", "CHANGE_STATUS_FAILED": "فشل تغيير حالة المحادثة",
"CHANGE_AGENT": "تم تغيير الموظف الذي تم إحالة المحادثة إليه", "CHANGE_AGENT": "تم تغيير الموظف الذي تم إحالة المحادثة إليه",
"CHANGE_AGENT_FAILED": "Assignee change failed", "CHANGE_AGENT_FAILED": "فشل تغيير المحال إليه",
"ASSIGN_LABEL_SUCCESFUL": "Label assigned successfully", "ASSIGN_LABEL_SUCCESFUL": "تم تعيين الوسم بنجاح",
"ASSIGN_LABEL_FAILED": "Label assignment failed", "ASSIGN_LABEL_FAILED": "فشل تعيين الوسم",
"CHANGE_TEAM": "تم تغيير فريق المحادثة", "CHANGE_TEAM": "تم تغيير فريق المحادثة",
"FILE_SIZE_LIMIT": "File exceeds the {MAXIMUM_SUPPORTED_FILE_UPLOAD_SIZE} MB attachment limit", "FILE_SIZE_LIMIT": "الملف يتجاوز حد المرفق {MAXIMUM_SUPPORTED_FILE_UPLOAD_SIZE} ميغابايت",
"MESSAGE_ERROR": "غير قادر على إرسال هذه الرسالة، الرجاء المحاولة مرة أخرى لاحقاً", "MESSAGE_ERROR": "غير قادر على إرسال هذه الرسالة، الرجاء المحاولة مرة أخرى لاحقاً",
"SENT_BY": "أرسلت بواسطة:", "SENT_BY": "أرسلت بواسطة:",
"BOT": "رد آلي", "BOT": "رد آلي",
@ -151,7 +151,7 @@
"CONTEXT_MENU": { "CONTEXT_MENU": {
"COPY": "نسخ", "COPY": "نسخ",
"DELETE": "حذف", "DELETE": "حذف",
"CREATE_A_CANNED_RESPONSE": "Add to canned responses" "CREATE_A_CANNED_RESPONSE": "إضافة إلى الردود السريعة"
} }
}, },
"EMAIL_TRANSCRIPT": { "EMAIL_TRANSCRIPT": {

View file

@ -6,98 +6,98 @@
"SETTINGS_BUTTON": "الإعدادات", "SETTINGS_BUTTON": "الإعدادات",
"NEW_BUTTON": "مقالة جديدة", "NEW_BUTTON": "مقالة جديدة",
"DROPDOWN_OPTIONS": { "DROPDOWN_OPTIONS": {
"PUBLISHED": "Published", "PUBLISHED": "نُشرت",
"DRAFT": "Draft", "DRAFT": "مسودة",
"ARCHIVED": "Archived" "ARCHIVED": "أرشفة"
}, },
"TITLES": { "TITLES": {
"ALL_ARTICLES": "All Articles", "ALL_ARTICLES": "جميع المقالات",
"MINE": "My Articles", "MINE": "مقالاتي",
"DRAFT": "Draft Articles", "DRAFT": "مقالات مسودة",
"ARCHIVED": "Archived Articles" "ARCHIVED": "المقالات المؤرشفة"
} }
}, },
"EDIT_HEADER": { "EDIT_HEADER": {
"ALL_ARTICLES": "All Articles", "ALL_ARTICLES": "جميع المقالات",
"PUBLISH_BUTTON": "نشر", "PUBLISH_BUTTON": "نشر",
"MOVE_TO_ARCHIVE_BUTTON": "Move to archived", "MOVE_TO_ARCHIVE_BUTTON": "نقل إلى الأرشيف",
"PREVIEW": "معاينة", "PREVIEW": "معاينة",
"ADD_TRANSLATION": "إضافة ترجمة", "ADD_TRANSLATION": "إضافة ترجمة",
"OPEN_SIDEBAR": "فتح الشريط الجانبي", "OPEN_SIDEBAR": "فتح الشريط الجانبي",
"CLOSE_SIDEBAR": "إغلاق الشريط الجانبي", "CLOSE_SIDEBAR": "إغلاق الشريط الجانبي",
"SAVING": "Saving...", "SAVING": "جاري الحفظ...",
"SAVED": "Saved" "SAVED": "تم الحفظ"
}, },
"ARTICLE_SETTINGS": { "ARTICLE_SETTINGS": {
"TITLE": "Article Settings", "TITLE": "إعدادات المقالة",
"FORM": { "FORM": {
"CATEGORY": { "CATEGORY": {
"LABEL": "الفئة", "LABEL": "الفئة",
"TITLE": "Select category", "TITLE": "اختر الفئة",
"PLACEHOLDER": "Select category", "PLACEHOLDER": "اختر الفئة",
"NO_RESULT": "No category found", "NO_RESULT": "لم يتم العثور على فئة",
"SEARCH_PLACEHOLDER": "Search category" "SEARCH_PLACEHOLDER": "البحث عن فئة"
}, },
"AUTHOR": { "AUTHOR": {
"LABEL": "Author", "LABEL": "المؤلف",
"TITLE": "Select author", "TITLE": "اختر المؤلف",
"PLACEHOLDER": "Select author", "PLACEHOLDER": "اختر المؤلف",
"NO_RESULT": "No authors found", "NO_RESULT": "لم يتم العثور على مؤلفين",
"SEARCH_PLACEHOLDER": "Search author" "SEARCH_PLACEHOLDER": "البحث عن المؤلف"
}, },
"META_TITLE": { "META_TITLE": {
"LABEL": "Meta title", "LABEL": "العنوان الوصفي",
"PLACEHOLDER": "Add a meta title" "PLACEHOLDER": "اضافة عنوان وصفي"
}, },
"META_DESCRIPTION": { "META_DESCRIPTION": {
"LABEL": "Meta description", "LABEL": "وصف التعريف",
"PLACEHOLDER": "Add your meta description for better SEO results..." "PLACEHOLDER": "أضف وصفك للحصول على أفضل نتائج SEO..."
}, },
"META_TAGS": { "META_TAGS": {
"LABEL": "Meta tags", "LABEL": "علامات الوصف",
"PLACEHOLDER": "Add meta tags separated by comma..." "PLACEHOLDER": "إضافة وسوم ميتا مفصولة بفاصلة..."
} }
}, },
"BUTTONS": { "BUTTONS": {
"ARCHIVE": "Archive article", "ARCHIVE": "المقالات المؤرشفة",
"DELETE": "Delete article" "DELETE": "حذف المقال"
} }
}, },
"PORTAL": { "PORTAL": {
"HEADER": "Portals", "HEADER": "الصفحات",
"DEFAULT": "Default", "DEFAULT": "افتراضي",
"NEW_BUTTON": "New Portal", "NEW_BUTTON": "بوابة جديدة",
"ACTIVE_BADGE": "مفعل", "ACTIVE_BADGE": "مفعل",
"CHOOSE_LOCALE_LABEL": "Choose a locale", "CHOOSE_LOCALE_LABEL": "اختر لغة محلية",
"LOADING_MESSAGE": "Loading portals...", "LOADING_MESSAGE": "جاري تحميل البوابات ...",
"ARTICLES_LABEL": "articles", "ARTICLES_LABEL": "المقالات",
"NO_PORTALS_MESSAGE": "There are no available portals", "NO_PORTALS_MESSAGE": "لا توجد بوابات متاحة",
"ADD_NEW_LOCALE": "Add a new locale", "ADD_NEW_LOCALE": "إضافة لغة جديدة",
"POPOVER": { "POPOVER": {
"TITLE": "Portals", "TITLE": "الصفحات",
"PORTAL_SETTINGS": "Portal settings", "PORTAL_SETTINGS": "إعدادات البوابة",
"SUBTITLE": "You have multiple portals and can have different locales for each portal.", "SUBTITLE": "لديك بوابات متعددة ويمكن أن تحتوي على مواقع مختلفة لكل بوابة.",
"CANCEL_BUTTON_LABEL": "إلغاء", "CANCEL_BUTTON_LABEL": "إلغاء",
"CHOOSE_LOCALE_BUTTON": "Choose Locale" "CHOOSE_LOCALE_BUTTON": "اختر لغة محلية"
}, },
"PORTAL_SETTINGS": { "PORTAL_SETTINGS": {
"LIST_ITEM": { "LIST_ITEM": {
"HEADER": { "HEADER": {
"COUNT_LABEL": "articles", "COUNT_LABEL": "المقالات",
"ADD": "Add locale", "ADD": "إضافة لغة",
"VISIT": "Visit site", "VISIT": "زيارة الموقع",
"SETTINGS": "الإعدادات", "SETTINGS": "الإعدادات",
"DELETE": "حذف" "DELETE": "حذف"
}, },
"PORTAL_CONFIG": { "PORTAL_CONFIG": {
"TITLE": "Portal Configurations", "TITLE": "اعدادات البوابة",
"ITEMS": { "ITEMS": {
"NAME": "الاسم", "NAME": "الاسم",
"DOMAIN": "Custom domain", "DOMAIN": "نطاق مخصص",
"SLUG": "Slug", "SLUG": "وصف مختصر",
"TITLE": "Portal title", "TITLE": "عنوان البوابة",
"THEME": "Theme color", "THEME": "لون القالب",
"SUB_TEXT": "Portal sub text" "SUB_TEXT": "النص الفرعي للبوابة"
} }
}, },
"AVAILABLE_LOCALES": { "AVAILABLE_LOCALES": {
@ -109,7 +109,7 @@
"CATEGORIES": "No. of categories", "CATEGORIES": "No. of categories",
"SWAP": "Swap", "SWAP": "Swap",
"DELETE": "حذف", "DELETE": "حذف",
"DEFAULT_LOCALE": "Default" "DEFAULT_LOCALE": "افتراضي"
} }
} }
}, },
@ -152,7 +152,7 @@
"EDIT": "Edit category", "EDIT": "Edit category",
"DELETE": "Delete category" "DELETE": "Delete category"
}, },
"EMPTY_TEXT": "No categories found" "EMPTY_TEXT": "لم يتم العثور على فئات"
} }
}, },
"EDIT_BASIC_INFO": { "EDIT_BASIC_INFO": {
@ -206,113 +206,113 @@
"NAME": { "NAME": {
"LABEL": "الاسم", "LABEL": "الاسم",
"PLACEHOLDER": "Portal name", "PLACEHOLDER": "Portal name",
"HELP_TEXT": "The name will be used in the public facing portal internally.", "HELP_TEXT": "الاسم سيتم مشاهدتة من جميع من جميع زوار الصفحة.",
"ERROR": "الاسم مطلوب" "ERROR": "الاسم مطلوب"
}, },
"SLUG": { "SLUG": {
"LABEL": "Slug", "LABEL": "وصف مختصر",
"PLACEHOLDER": "Portal slug for urls", "PLACEHOLDER": "وصف مختصر لرابط البوابة",
"ERROR": "Slug is required" "ERROR": "الوصف مطلوب"
}, },
"DOMAIN": { "DOMAIN": {
"LABEL": "Custom Domain", "LABEL": "نطاق مخصص",
"PLACEHOLDER": "Portal custom domain", "PLACEHOLDER": "نطاق البوابة المخصص",
"HELP_TEXT": "Add only If you want to use a custom domain for your portals.", "HELP_TEXT": "أضف فقط إذا كنت ترغب في استخدام نطاق مخصص للبوابات الخاصة بك.",
"ERROR": "Custom Domain is required" "ERROR": "النطاق المخصص مطلوب"
}, },
"HOME_PAGE_LINK": { "HOME_PAGE_LINK": {
"LABEL": "Home Page Link", "LABEL": "رابط الصفحة الرئيسية",
"PLACEHOLDER": "Portal home page link", "PLACEHOLDER": "رابط الصفحة الرئيسية للبوابة",
"HELP_TEXT": "The link used to return from the portal to the home page.", "HELP_TEXT": "الرابط المستخدم للعودة من البوابة إلى الصفحة الرئيسية.",
"ERROR": "Home Page Link is required" "ERROR": "رابط الصفحة الرئيسية مطلوب"
}, },
"THEME_COLOR": { "THEME_COLOR": {
"LABEL": "Portal theme color", "LABEL": "لون قالب البوابة",
"HELP_TEXT": "This color will show as the theme color for the portal." "HELP_TEXT": "هذا اللون سيظهر كلون للبوابة."
}, },
"PAGE_TITLE": { "PAGE_TITLE": {
"LABEL": "Page Title", "LABEL": "عنوان الصفحة",
"PLACEHOLDER": "Portal page title", "PLACEHOLDER": "عنوان البوابة",
"HELP_TEXT": "The page title will be used in the public facing portal.", "HELP_TEXT": "سيتم استخدام عنوان الصفحة في البوابة التي تواجه الجمهور.",
"ERROR": "Page title is required" "ERROR": "العنوان مطلوب"
}, },
"HEADER_TEXT": { "HEADER_TEXT": {
"LABEL": "Header Text", "LABEL": "نص رأس الصفحة",
"PLACEHOLDER": "Portal header text", "PLACEHOLDER": "نص رأس البوابة",
"HELP_TEXT": "The Portal header text will be used in the public facing portal.", "HELP_TEXT": "سيتم استخدام عنوان الصفحة في البوابة التي تواجه الجمهور.",
"ERROR": "Portal header text is required" "ERROR": "نص رأس البوابة مطلوب"
}, },
"API": { "API": {
"SUCCESS_MESSAGE_FOR_BASIC": "Portal created successfully.", "SUCCESS_MESSAGE_FOR_BASIC": "تم إنشاء البوابة بنجاح.",
"ERROR_MESSAGE_FOR_BASIC": "Couldn't create the portal. Try again.", "ERROR_MESSAGE_FOR_BASIC": "تعذر إنشاء البوابة. حاول مرة أخرى.",
"SUCCESS_MESSAGE_FOR_UPDATE": "Portal updated successfully.", "SUCCESS_MESSAGE_FOR_UPDATE": "تم تحديث البوابة بنجاح.",
"ERROR_MESSAGE_FOR_UPDATE": "Couldn't update the portal. Try again." "ERROR_MESSAGE_FOR_UPDATE": "تعذر تحديث البوابة. حاول مرة أخرى."
} }
}, },
"ADD_LOCALE": { "ADD_LOCALE": {
"TITLE": "Add a new locale", "TITLE": "إضافة لغة جديدة",
"SUB_TITLE": "This adds a new locale to your available translation list.", "SUB_TITLE": "هذا يضيف لغة جديدة إلى قائمة الترجمة المتاحة لديك.",
"PORTAL": "Portal", "PORTAL": "البوابة",
"LOCALE": { "LOCALE": {
"LABEL": "Locale", "LABEL": "اللغة",
"PLACEHOLDER": "Choose a locale", "PLACEHOLDER": "اختر لغة محلية",
"ERROR": "Locale is required" "ERROR": "اللغة مطلوبة"
}, },
"BUTTONS": { "BUTTONS": {
"CREATE": "Create locale", "CREATE": "إنشاء لغة",
"CANCEL": "إلغاء" "CANCEL": "إلغاء"
}, },
"API": { "API": {
"SUCCESS_MESSAGE": "Locale added successfully", "SUCCESS_MESSAGE": "تمت إضافة اللغة بنجاح",
"ERROR_MESSAGE": "Unable to add locale. Try again." "ERROR_MESSAGE": "غير قادر على إضافة اللغة . حاول مرة أخرى."
} }
}, },
"CHANGE_DEFAULT_LOCALE": { "CHANGE_DEFAULT_LOCALE": {
"API": { "API": {
"SUCCESS_MESSAGE": "Default locale updated successfully", "SUCCESS_MESSAGE": "تم تحديث اللغة الغة الإفتراضية بنجاح",
"ERROR_MESSAGE": "Unable to update default locale. Try again." "ERROR_MESSAGE": "غير قادر على تحديث اللغة الافتراضية. حاول مرة أخرى."
} }
}, },
"DELETE_LOCALE": { "DELETE_LOCALE": {
"API": { "API": {
"SUCCESS_MESSAGE": "Locale removed from portal successfully", "SUCCESS_MESSAGE": "تم إزالة اللغة من البوابة بنجاح",
"ERROR_MESSAGE": "Unable to remove locale from portal. Try again." "ERROR_MESSAGE": "غير قادر على إزالة اللغة من البوابة. حاول مرة أخرى."
} }
} }
}, },
"TABLE": { "TABLE": {
"LOADING_MESSAGE": "Loading articles...", "LOADING_MESSAGE": "جاري تحميل المقالات...",
"404": "No articles matches your search 🔍", "404": "لا توجد مقالات تطابق بحثك 🔍",
"NO_ARTICLES": "There are no available articles", "NO_ARTICLES": "لا توجد مقالات متوفرة",
"HEADERS": { "HEADERS": {
"TITLE": "العنوان", "TITLE": "العنوان",
"CATEGORY": "الفئة", "CATEGORY": "الفئة",
"READ_COUNT": "Read count", "READ_COUNT": "عدد القراءات",
"STATUS": "الحالة", "STATUS": "الحالة",
"LAST_EDITED": "Last edited" "LAST_EDITED": "آخر تعديل"
}, },
"COLUMNS": { "COLUMNS": {
"BY": "بواسطة" "BY": "بواسطة"
} }
}, },
"EDIT_ARTICLE": { "EDIT_ARTICLE": {
"LOADING": "Loading article...", "LOADING": "جاري تحميل المقالات...",
"TITLE_PLACEHOLDER": "Article title goes here", "TITLE_PLACEHOLDER": "عنوان المقالة يذهب هنا",
"CONTENT_PLACEHOLDER": "Write your article here", "CONTENT_PLACEHOLDER": "اكتب مقالك هنا",
"API": { "API": {
"ERROR": "Error while saving article" "ERROR": "حدث خطأ أثناء حفظ المقالة"
} }
}, },
"PUBLISH_ARTICLE": { "PUBLISH_ARTICLE": {
"API": { "API": {
"ERROR": "Error while publishing article", "ERROR": "حدث خطأ أثناء نشر المقالة",
"SUCCESS": "Article publishied successfully" "SUCCESS": "تم نشر المقالة بنجاح"
} }
}, },
"ARCHIVE_ARTICLE": { "ARCHIVE_ARTICLE": {
"API": { "API": {
"ERROR": "Error while archiving article", "ERROR": "حدث خطأ أثناء نشر المقالة",
"SUCCESS": "Article archived successfully" "SUCCESS": "تم أرشفة المقالة بنجاح"
} }
}, },
"DELETE_ARTICLE": { "DELETE_ARTICLE": {

View file

@ -414,7 +414,7 @@
"CAMPAIGN": "الحملات", "CAMPAIGN": "الحملات",
"PRE_CHAT_FORM": "نموذج ما قبل الدردشة", "PRE_CHAT_FORM": "نموذج ما قبل الدردشة",
"BUSINESS_HOURS": "ساعات العمل", "BUSINESS_HOURS": "ساعات العمل",
"WIDGET_BUILDER": "Widget Builder" "WIDGET_BUILDER": "منشئ اللايف شات"
}, },
"SETTINGS": "الإعدادات", "SETTINGS": "الإعدادات",
"FEATURES": { "FEATURES": {
@ -579,10 +579,10 @@
"WIDGET_BUILDER": { "WIDGET_BUILDER": {
"WIDGET_OPTIONS": { "WIDGET_OPTIONS": {
"AVATAR": { "AVATAR": {
"LABEL": "Website Avatar", "LABEL": "صورة الموقع",
"DELETE": { "DELETE": {
"API": { "API": {
"SUCCESS_MESSAGE": "Avatar deleted successfully", "SUCCESS_MESSAGE": "الصورة الرمزية حذفت بنجاح",
"ERROR_MESSAGE": "حدث خطأ، الرجاء المحاولة مرة أخرى" "ERROR_MESSAGE": "حدث خطأ، الرجاء المحاولة مرة أخرى"
} }
} }
@ -590,53 +590,53 @@
"WEBSITE_NAME": { "WEBSITE_NAME": {
"LABEL": "اسم الموقع", "LABEL": "اسم الموقع",
"PLACE_HOLDER": "أدخل اسم موقع الويب الخاص بك (مثال: Acme Inc)", "PLACE_HOLDER": "أدخل اسم موقع الويب الخاص بك (مثال: Acme Inc)",
"ERROR": "Please enter a valid website name" "ERROR": "الرجاء إدخال اسم موقع صالح"
}, },
"WELCOME_HEADING": { "WELCOME_HEADING": {
"LABEL": "العنوان الترحيبي", "LABEL": "العنوان الترحيبي",
"PLACE_HOLDER": "Hi there!" "PLACE_HOLDER": "مرحبا بك!"
}, },
"WELCOME_TAGLINE": { "WELCOME_TAGLINE": {
"LABEL": "افتتاحية الترحيب", "LABEL": "افتتاحية الترحيب",
"PLACE_HOLDER": "نحن نجعل من السهل عليك التواصل معنا. اسألنا أي شيء، أو قم بمشاركتنا ملاحظاتك." "PLACE_HOLDER": "نحن نجعل من السهل عليك التواصل معنا. اسألنا أي شيء، أو قم بمشاركتنا ملاحظاتك."
}, },
"REPLY_TIME": { "REPLY_TIME": {
"LABEL": "Reply Time", "LABEL": "وقت الرد",
"IN_A_FEW_MINUTES": "في غضون دقائق قليلة", "IN_A_FEW_MINUTES": "في غضون دقائق قليلة",
"IN_A_FEW_HOURS": "في غضون ساعات قليلة", "IN_A_FEW_HOURS": "في غضون ساعات قليلة",
"IN_A_DAY": "خلال يوم" "IN_A_DAY": "خلال يوم"
}, },
"WIDGET_COLOR_LABEL": "لون صندوق الدردشة", "WIDGET_COLOR_LABEL": "لون صندوق الدردشة",
"WIDGET_BUBBLE_POSITION_LABEL": "Widget Bubble Position", "WIDGET_BUBBLE_POSITION_LABEL": "موقع شعار اللايف شات",
"WIDGET_BUBBLE_TYPE_LABEL": "Widget Bubble Type", "WIDGET_BUBBLE_TYPE_LABEL": "شكل عرض اللايف شات",
"WIDGET_BUBBLE_LAUNCHER_TITLE": { "WIDGET_BUBBLE_LAUNCHER_TITLE": {
"DEFAULT": "تحدث الينا", "DEFAULT": "تحدث الينا",
"LABEL": "Widget Bubble Launcher Title", "LABEL": "عنوان ايقونة اللايف شات",
"PLACE_HOLDER": "تحدث الينا" "PLACE_HOLDER": "تحدث الينا"
}, },
"UPDATE": { "UPDATE": {
"BUTTON_TEXT": "Update Widget Settings", "BUTTON_TEXT": "تحديث إعدادات اللايف شات",
"API": { "API": {
"SUCCESS_MESSAGE": "Widget settings updated successfully", "SUCCESS_MESSAGE": "تم تحديث إعدادت اللايف شات بنجاح",
"ERROR_MESSAGE": "Unable to update widget settings" "ERROR_MESSAGE": "غير قادر على تحديث إعدادات اللايف شات"
} }
}, },
"WIDGET_VIEW_OPTION": { "WIDGET_VIEW_OPTION": {
"PREVIEW": "معاينة", "PREVIEW": "معاينة",
"SCRIPT": "Script" "SCRIPT": "النص"
}, },
"WIDGET_BUBBLE_POSITION": { "WIDGET_BUBBLE_POSITION": {
"LEFT": "Left", "LEFT": "يسار",
"RIGHT": "Right" "RIGHT": "يمين"
}, },
"WIDGET_BUBBLE_TYPE": { "WIDGET_BUBBLE_TYPE": {
"STANDARD": "Standard", "STANDARD": "عادي",
"EXPANDED_BUBBLE": "Expanded Bubble" "EXPANDED_BUBBLE": "ايقونت اللايف شات العرضية"
} }
}, },
"WIDGET_SCREEN": { "WIDGET_SCREEN": {
"DEFAULT": "Default", "DEFAULT": "افتراضي",
"CHAT": "Chat" "CHAT": "محادثة"
}, },
"REPLY_TIME": { "REPLY_TIME": {
"IN_A_FEW_MINUTES": "عادة نقوم بالرد خلال بضع دقائق", "IN_A_FEW_MINUTES": "عادة نقوم بالرد خلال بضع دقائق",
@ -649,11 +649,11 @@
}, },
"BODY": { "BODY": {
"TEAM_AVAILABILITY": { "TEAM_AVAILABILITY": {
"ONLINE": "We are Online", "ONLINE": "متواجدون لخدمتك",
"OFFLINE": "نحن بعيدون في الوقت الحالي" "OFFLINE": "نحن بعيدون في الوقت الحالي"
}, },
"USER_MESSAGE": "Hi", "USER_MESSAGE": "مرحبا",
"AGENT_MESSAGE": "Hello" "AGENT_MESSAGE": "مرحبا"
}, },
"BRANDING_TEXT": "مدعوم بواسطة Chatwoot", "BRANDING_TEXT": "مدعوم بواسطة Chatwoot",
"SCRIPT_SETTINGS": "\n window.chatwootSettings = {options};" "SCRIPT_SETTINGS": "\n window.chatwootSettings = {options};"

View file

@ -20,17 +20,17 @@
"NOTE": "عنوان بريدك الإلكتروني هو المعرف الخاص بك الذي ستستخدمه لتسجيل الدخول." "NOTE": "عنوان بريدك الإلكتروني هو المعرف الخاص بك الذي ستستخدمه لتسجيل الدخول."
}, },
"SEND_MESSAGE": { "SEND_MESSAGE": {
"TITLE": "Hotkey to send messages", "TITLE": "المفتاح الرئيسي لإرسال الرسائل",
"NOTE": "You can select a hotkey (either Enter or Cmd/Ctrl+Enter) based on your preference of writing.", "NOTE": "يمكنك تحديد مفتاح سريع (إما Enter أو Cmd/Ctrl+Enter) استنادًا إلى تفضيلك للكتابة.",
"UPDATE_SUCCESS": "Your settings have been updated successfully", "UPDATE_SUCCESS": "تم تحديث الإعدادات الخاصة بك بنجاح",
"CARD": { "CARD": {
"ENTER_KEY": { "ENTER_KEY": {
"HEADING": "Enter (↵)", "HEADING": "Enter (↵)",
"CONTENT": "Send messages by pressing Enter key instead of clicking the send button." "CONTENT": "إرسال الرسائل بالضغط على مفتاح الإدخال بدلاً من النقر على زر الإرسال."
}, },
"CMD_ENTER_KEY": { "CMD_ENTER_KEY": {
"HEADING": "Cmd/Ctrl + Enter (⌘ + ↵)", "HEADING": "Cmd/Ctrl + Enter (<unk> + <unk> )",
"CONTENT": "Send messages by pressing Cmd/Ctrl + enter key instead of clicking the send button." "CONTENT": "إرسال الرسائل بالضغط على Cmd/Ctrl + إدخال المفتاح بدلاً من النقر على زر الإرسال."
} }
} }
}, },
@ -141,8 +141,8 @@
"TRAIL_BUTTON": "اشترك الآن", "TRAIL_BUTTON": "اشترك الآن",
"DELETED_USER": "حذف المستخدم", "DELETED_USER": "حذف المستخدم",
"ACCOUNT_SUSPENDED": { "ACCOUNT_SUSPENDED": {
"TITLE": "Account Suspended", "TITLE": "تم تعليق الحساب",
"MESSAGE": "Your account is suspended. Please reach out to the support team for more information." "MESSAGE": "تم تعليق حسابك. يرجى الاتصال بفريق الدعم للمزيد من المعلومات."
} }
}, },
"COMPONENTS": { "COMPONENTS": {
@ -190,7 +190,7 @@
"CUSTOM_ATTRIBUTES": "سمات مخصصة", "CUSTOM_ATTRIBUTES": "سمات مخصصة",
"AUTOMATION": "الأتمتة", "AUTOMATION": "الأتمتة",
"TEAMS": "الفرق", "TEAMS": "الفرق",
"BILLING": "Billing", "BILLING": "الفواتير",
"CUSTOM_VIEWS_FOLDER": "المجلدات", "CUSTOM_VIEWS_FOLDER": "المجلدات",
"CUSTOM_VIEWS_SEGMENTS": "الأجزاء", "CUSTOM_VIEWS_SEGMENTS": "الأجزاء",
"ALL_CONTACTS": "جميع جهات الاتصال", "ALL_CONTACTS": "جميع جهات الاتصال",
@ -212,33 +212,33 @@
"REPORTS_OVERVIEW": "نظرة عامة", "REPORTS_OVERVIEW": "نظرة عامة",
"FACEBOOK_REAUTHORIZE": "انتهت صلاحية اتصال الفيسبوك الخاص بك، يرجى إعادة الاتصال بصفحة الفيسبوك الخاصة بك لمواصلة الخدمات", "FACEBOOK_REAUTHORIZE": "انتهت صلاحية اتصال الفيسبوك الخاص بك، يرجى إعادة الاتصال بصفحة الفيسبوك الخاصة بك لمواصلة الخدمات",
"HELP_CENTER": { "HELP_CENTER": {
"TITLE": "Help Center (Beta)", "TITLE": "مركز المساعدة (نسخة تجريبية)",
"ALL_ARTICLES": "All Articles", "ALL_ARTICLES": "جميع المقالات",
"MY_ARTICLES": "My Articles", "MY_ARTICLES": "مقالاتي",
"DRAFT": "Draft", "DRAFT": "مسودة",
"ARCHIVED": "Archived", "ARCHIVED": "مؤرشفة",
"CATEGORY": "الفئة", "CATEGORY": "الفئة",
"CATEGORY_EMPTY_MESSAGE": "No categories found" "CATEGORY_EMPTY_MESSAGE": "لم يتم العثور على فئات"
}, },
"DOCS": "Read docs" "DOCS": "قراءة المستندات"
}, },
"BILLING_SETTINGS": { "BILLING_SETTINGS": {
"TITLE": "Billing", "TITLE": "الفواتير",
"CURRENT_PLAN": { "CURRENT_PLAN": {
"TITLE": "Current Plan", "TITLE": "الباقة الحالية",
"PLAN_NOTE": "You are currently subscribed to the **%{plan}** plan with **%{quantity}** licenses" "PLAN_NOTE": "أنت مشترك حاليا في باقة**%{plan}** مع تراخيص **%{quantity}**"
}, },
"MANAGE_SUBSCRIPTION": { "MANAGE_SUBSCRIPTION": {
"TITLE": "Manage your subscription", "TITLE": "إدارة الاشتراك الخاص بك",
"DESCRIPTION": "View your previous invoices, edit your billing details, or cancel your subscription.", "DESCRIPTION": "عرض فواتيرك السابقة، تحرير تفاصيل الفوترة الخاصة بك، أو إلغاء اشتراكك.",
"BUTTON_TXT": "Go to the billing portal" "BUTTON_TXT": "الذهاب إلى بوابة الفوترة"
}, },
"CHAT_WITH_US": { "CHAT_WITH_US": {
"TITLE": "Need help?", "TITLE": "تحتاج مساعدة؟",
"DESCRIPTION": "Do you face any issues in billing? We are here to help.", "DESCRIPTION": "هل تواجه أي مشاكل في الفواتير؟ نحن هنا للمساعدة.",
"BUTTON_TXT": "تحدث الينا" "BUTTON_TXT": "تحدث الينا"
}, },
"NO_BILLING_USER": "Your billing account is being configured. Please refresh the page and try again." "NO_BILLING_USER": "حساب الفوترة الخاص بك قيد الإعداد. الرجاء تحديث الصفحة وحاول مرة أخرى."
}, },
"CREATE_ACCOUNT": { "CREATE_ACCOUNT": {
"NO_ACCOUNT_WARNING": "أوه! لم نتمكن من العثور على الحساب. الرجاء إنشاء حساب جديد للمتابعة.", "NO_ACCOUNT_WARNING": "أوه! لم نتمكن من العثور على الحساب. الرجاء إنشاء حساب جديد للمتابعة.",

View file

@ -0,0 +1,5 @@
{
"AGENT_BOTS": {
"HEADER": "Bots"
}
}

View file

@ -2,9 +2,11 @@
"BULK_ACTION": { "BULK_ACTION": {
"CONVERSATIONS_SELECTED": "%{conversationCount} conversations selected", "CONVERSATIONS_SELECTED": "%{conversationCount} conversations selected",
"AGENT_SELECT_LABEL": "Select Agent", "AGENT_SELECT_LABEL": "Select Agent",
"ASSIGN_CONFIRMATION_LABEL": "Are you sure you want to assign %{conversationCount} %{conversationLabel} to", "ASSIGN_CONFIRMATION_LABEL": "Are you sure to assign %{conversationCount} %{conversationLabel} to",
"UNASSIGN_CONFIRMATION_LABEL": "Are you sure to unassign %{conversationCount} %{conversationLabel}?",
"GO_BACK_LABEL": "Go back", "GO_BACK_LABEL": "Go back",
"ASSIGN_LABEL": "Assign", "ASSIGN_LABEL": "Assign",
"YES": "Yes",
"ASSIGN_AGENT_TOOLTIP": "Assign Agent", "ASSIGN_AGENT_TOOLTIP": "Assign Agent",
"ASSIGN_SUCCESFUL": "Conversations assigned successfully", "ASSIGN_SUCCESFUL": "Conversations assigned successfully",
"ASSIGN_FAILED": "Failed to assign conversations, please try again", "ASSIGN_FAILED": "Failed to assign conversations, please try again",

View file

@ -239,7 +239,9 @@
}, },
"API_CALLBACK": { "API_CALLBACK": {
"TITLE": "Callback URL", "TITLE": "Callback URL",
"SUBTITLE": "You have to configure the webhook URL in facebook developer portal with the URL mentioned here." "SUBTITLE": "You have to configure the webhook URL and the verification token in the Facebook Developer portal with the values shown below.",
"WEBHOOK_URL": "Webhook URL",
"WEBHOOK_VERIFICATION_TOKEN": "Webhook Verification Token"
}, },
"SUBMIT_BUTTON": "Create WhatsApp Channel", "SUBMIT_BUTTON": "Create WhatsApp Channel",
"API": { "API": {
@ -357,7 +359,7 @@
}, },
"FINISH": { "FINISH": {
"TITLE": "Your Inbox is ready!", "TITLE": "Your Inbox is ready!",
"MESSAGE": "You can now engage with your customers through your new Channel. Happy supporting ", "MESSAGE": "You can now engage with your customers through your new Channel. Happy supporting",
"BUTTON_TEXT": "Take me there", "BUTTON_TEXT": "Take me there",
"MORE_SETTINGS": "More settings", "MORE_SETTINGS": "More settings",
"WEBSITE_SUCCESS": "You have successfully finished creating a website channel. Copy the code shown below and paste it on your website. Next time a customer use the live chat, the conversation will automatically appear on your inbox." "WEBSITE_SUCCESS": "You have successfully finished creating a website channel. Copy the code shown below and paste it on your website. Next time a customer use the live chat, the conversation will automatically appear on your inbox."

View file

@ -1,57 +1,59 @@
import { default as _advancedFilters } from './advancedFilters.json'; import advancedFilters from './advancedFilters.json';
import { default as _agentMgmt } from './agentMgmt.json'; import agentBots from './agentBots.json';
import { default as _attributesMgmt } from './attributesMgmt.json'; import agentMgmt from './agentMgmt.json';
import { default as _automation } from './automation.json'; import attributesMgmt from './attributesMgmt.json';
import { default as _macros } from './macros.json'; import automation from './automation.json';
import { default as _bulkActions } from './bulkActions.json'; import bulkActions from './bulkActions.json';
import { default as _campaign } from './campaign.json'; import campaign from './campaign.json';
import { default as _cannedMgmt } from './cannedMgmt.json'; import cannedMgmt from './cannedMgmt.json';
import { default as _chatlist } from './chatlist.json'; import chatlist from './chatlist.json';
import { default as _contact } from './contact.json'; import contact from './contact.json';
import { default as _contactFilters } from './contactFilters.json'; import contactFilters from './contactFilters.json';
import { default as _conversation } from './conversation.json'; import conversation from './conversation.json';
import { default as _csatMgmtMgmt } from './csatMgmt.json'; import csatMgmtMgmt from './csatMgmt.json';
import { default as _generalSettings } from './generalSettings.json'; import generalSettings from './generalSettings.json';
import { default as _inboxMgmt } from './inboxMgmt.json'; import helpCenter from './helpCenter.json';
import { default as _integrationApps } from './integrationApps.json'; import inboxMgmt from './inboxMgmt.json';
import { default as _integrations } from './integrations.json'; import integrationApps from './integrationApps.json';
import { default as _labelsMgmt } from './labelsMgmt.json'; import integrations from './integrations.json';
import { default as _login } from './login.json'; import labelsMgmt from './labelsMgmt.json';
import { default as _report } from './report.json'; import login from './login.json';
import { default as _resetPassword } from './resetPassword.json'; import macros from './macros.json';
import { default as _setNewPassword } from './setNewPassword.json'; import report from './report.json';
import { default as _settings } from './settings.json'; import resetPassword from './resetPassword.json';
import { default as _signup } from './signup.json'; import setNewPassword from './setNewPassword.json';
import { default as _teamsSettings } from './teamsSettings.json'; import settings from './settings.json';
import { default as _whatsappTemplates } from './whatsappTemplates.json'; import signup from './signup.json';
import { default as _helpCenter } from './helpCenter.json'; import teamsSettings from './teamsSettings.json';
import whatsappTemplates from './whatsappTemplates.json';
export default { export default {
..._advancedFilters, ...advancedFilters,
..._agentMgmt, ...agentBots,
..._attributesMgmt, ...agentMgmt,
..._automation, ...attributesMgmt,
..._campaign, ...automation,
..._cannedMgmt, ...bulkActions,
..._chatlist, ...campaign,
..._contact, ...cannedMgmt,
..._contactFilters, ...chatlist,
..._conversation, ...contact,
..._csatMgmtMgmt, ...contactFilters,
..._generalSettings, ...conversation,
..._inboxMgmt, ...csatMgmtMgmt,
..._integrationApps, ...generalSettings,
..._integrations, ...helpCenter,
..._labelsMgmt, ...inboxMgmt,
..._login, ...integrationApps,
..._report, ...integrations,
..._resetPassword, ...labelsMgmt,
..._setNewPassword, ...login,
..._settings, ...macros,
..._signup, ...report,
..._teamsSettings, ...resetPassword,
..._whatsappTemplates, ...setNewPassword,
..._bulkActions, ...settings,
..._helpCenter, ...signup,
..._macros, ...teamsSettings,
...whatsappTemplates,
}; };

View file

@ -175,6 +175,7 @@
"CONTACTS": "Contacts", "CONTACTS": "Contacts",
"HOME": "Home", "HOME": "Home",
"AGENTS": "Agents", "AGENTS": "Agents",
"AGENT_BOTS": "Bots",
"INBOXES": "Inboxes", "INBOXES": "Inboxes",
"NOTIFICATIONS": "Notifications", "NOTIFICATIONS": "Notifications",
"CANNED_RESPONSES": "Canned Responses", "CANNED_RESPONSES": "Canned Responses",

View file

@ -0,0 +1,18 @@
<template>
<div>Agent Bot list</div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
computed: {
...mapGetters({
agentBots: 'agentBots/getBots',
uiFlags: 'agentBots/getUIFlags',
}),
},
mounted() {
this.$store.dispatch('agentBots/get');
},
};
</script>

View file

@ -0,0 +1,40 @@
import SettingsContent from '../Wrapper';
const Bot = () => import('./Index.vue');
const CsmlEditBot = () => import('./csml/Edit.vue');
const CsmlNewBot = () => import('./csml/New.vue');
import { frontendURL } from '../../../../helper/URLHelper';
export default {
routes: [
{
path: frontendURL('accounts/:accountId/settings/agent-bots'),
roles: ['administrator'],
component: SettingsContent,
props: {
headerTitle: 'AGENT_BOTS.HEADER',
icon: 'bot',
showNewButton: false,
},
children: [
{
path: '',
name: 'agent_bots',
component: Bot,
roles: ['administrator'],
},
{
path: 'csml/new',
name: 'agent_bots_csml_new',
component: CsmlNewBot,
roles: ['administrator'],
},
{
path: 'csml/:botId',
name: 'agent_bots_csml_edit',
component: CsmlEditBot,
roles: ['administrator'],
},
],
},
],
};

View file

@ -0,0 +1,6 @@
<template>
<div>Component to edit CSML Bots</div>
</template>
<script>
export default {};
</script>

View file

@ -0,0 +1,6 @@
<template>
<div>Component to create CSML Bots</div>
</template>
<script>
export default {};
</script>

View file

@ -20,11 +20,26 @@
/> />
</div> </div>
<div class="medium-6 small-offset-3"> <div class="medium-6 small-offset-3">
<p class="config--label">
{{ $t('INBOX_MGMT.ADD.WHATSAPP.API_CALLBACK.WEBHOOK_URL') }}
</p>
<woot-code <woot-code
v-if="isAWhatsappWhatsappCloudInbox" v-if="isWhatsAppCloudInbox"
lang="html" lang="html"
:script="currentInbox.callback_webhook_url" :script="currentInbox.callback_webhook_url"
/> />
<p class="config--label">
{{
$t(
'INBOX_MGMT.ADD.WHATSAPP.API_CALLBACK.WEBHOOK_VERIFICATION_TOKEN'
)
}}
</p>
<woot-code
v-if="isWhatsAppCloudInbox"
lang="html"
:script="currentInbox.provider_config.webhook_verify_token"
/>
</div> </div>
<div class="medium-6 small-offset-3"> <div class="medium-6 small-offset-3">
<woot-code <woot-code
@ -99,7 +114,7 @@ export default {
isASmsInbox() { isASmsInbox() {
return this.currentInbox.channel_type === 'Channel::Sms'; return this.currentInbox.channel_type === 'Channel::Sms';
}, },
isAWhatsappWhatsappCloudInbox() { isWhatsAppCloudInbox() {
return ( return (
this.currentInbox.channel_type === 'Channel::Whatsapp' && this.currentInbox.channel_type === 'Channel::Whatsapp' &&
this.currentInbox.provider === 'whatsapp_cloud' this.currentInbox.provider === 'whatsapp_cloud'
@ -124,7 +139,7 @@ export default {
)}`; )}`;
} }
if (this.isAWhatsappWhatsappCloudInbox) { if (this.isWhatsAppCloudInbox) {
return `${this.$t('INBOX_MGMT.FINISH.MESSAGE')}. ${this.$t( return `${this.$t('INBOX_MGMT.FINISH.MESSAGE')}. ${this.$t(
'INBOX_MGMT.ADD.WHATSAPP.API_CALLBACK.SUBTITLE' 'INBOX_MGMT.ADD.WHATSAPP.API_CALLBACK.SUBTITLE'
)}`; )}`;
@ -159,4 +174,10 @@ export default {
.settings-button { .settings-button {
margin-right: var(--space-small); margin-right: var(--space-small);
} }
.config--label {
color: var(--b-600);
font-weight: var(--font-weight-medium);
margin-top: var(--space-large);
}
</style> </style>

View file

@ -85,25 +85,6 @@
</label> </label>
</div> </div>
<div class="medium-8 columns">
<label :class="{ error: $v.webhookVerifyToken.$error }">
<span>
{{ $t('INBOX_MGMT.ADD.WHATSAPP.WEBHOOK_VERIFY_TOKEN.LABEL') }}
</span>
<input
v-model.trim="webhookVerifyToken"
type="text"
:placeholder="
$t('INBOX_MGMT.ADD.WHATSAPP.WEBHOOK_VERIFY_TOKEN.PLACEHOLDER')
"
@blur="$v.webhookVerifyToken.$touch"
/>
<span v-if="$v.webhookVerifyToken.$error" class="message">
{{ $t('INBOX_MGMT.ADD.WHATSAPP.WEBHOOK_VERIFY_TOKEN.ERROR') }}
</span>
</label>
</div>
<div class="medium-12 columns"> <div class="medium-12 columns">
<woot-submit-button <woot-submit-button
:loading="uiFlags.isCreating" :loading="uiFlags.isCreating"
@ -130,7 +111,6 @@ export default {
apiKey: '', apiKey: '',
phoneNumberId: '', phoneNumberId: '',
businessAccountId: '', businessAccountId: '',
webhookVerifyToken: '',
}; };
}, },
computed: { computed: {
@ -142,7 +122,6 @@ export default {
apiKey: { required }, apiKey: { required },
phoneNumberId: { required }, phoneNumberId: { required },
businessAccountId: { required }, businessAccountId: { required },
webhookVerifyToken: { required },
}, },
methods: { methods: {
async createChannel() { async createChannel() {
@ -164,7 +143,6 @@ export default {
api_key: this.apiKey, api_key: this.apiKey,
phone_number_id: this.phoneNumberId, phone_number_id: this.phoneNumberId,
business_account_id: this.businessAccountId, business_account_id: this.businessAccountId,
webhook_verify_token: this.webhookVerifyToken,
}, },
}, },
} }

View file

@ -1,20 +1,21 @@
import { frontendURL } from '../../../helper/URLHelper'; import { frontendURL } from '../../../helper/URLHelper';
import account from './account/account.routes'; import account from './account/account.routes';
import agent from './agents/agent.routes'; import agent from './agents/agent.routes';
import canned from './canned/canned.routes'; import agentBot from './agentBots/agentBot.routes';
import inbox from './inbox/inbox.routes';
import integrations from './integrations/integrations.routes';
import integrationapps from './integrationapps/integrations.routes';
import labels from './labels/labels.routes';
import profile from './profile/profile.routes';
import reports from './reports/reports.routes';
import campaigns from './campaigns/campaigns.routes';
import teams from './teams/teams.routes';
import attributes from './attributes/attributes.routes'; import attributes from './attributes/attributes.routes';
import automation from './automation/automation.routes'; import automation from './automation/automation.routes';
import macros from './macros/macros.routes';
import store from '../../../store';
import billing from './billing/billing.routes'; import billing from './billing/billing.routes';
import campaigns from './campaigns/campaigns.routes';
import canned from './canned/canned.routes';
import inbox from './inbox/inbox.routes';
import integrationapps from './integrationapps/integrations.routes';
import integrations from './integrations/integrations.routes';
import labels from './labels/labels.routes';
import macros from './macros/macros.routes';
import profile from './profile/profile.routes';
import reports from './reports/reports.routes';
import teams from './teams/teams.routes';
import store from '../../../store';
export default { export default {
routes: [ routes: [
@ -31,6 +32,7 @@ export default {
}, },
...account.routes, ...account.routes,
...agent.routes, ...agent.routes,
...agentBot.routes,
...attributes.routes, ...attributes.routes,
...automation.routes, ...automation.routes,
...billing.routes, ...billing.routes,

View file

@ -3,6 +3,7 @@ import Vuex from 'vuex';
import accounts from './modules/accounts'; import accounts from './modules/accounts';
import agents from './modules/agents'; import agents from './modules/agents';
import agentBots from './modules/agentBots';
import attributes from './modules/attributes'; import attributes from './modules/attributes';
import auth from './modules/auth'; import auth from './modules/auth';
import automations from './modules/automations'; import automations from './modules/automations';
@ -45,6 +46,7 @@ export default new Vuex.Store({
modules: { modules: {
accounts, accounts,
agents, agents,
agentBots,
attributes, attributes,
auth, auth,
automations, automations,

View file

@ -0,0 +1,107 @@
import * as MutationHelpers from 'shared/helpers/vuex/mutationHelpers';
import types from '../mutation-types';
import AgentBotsAPI from '../../api/agentBots';
import { throwErrorMessage } from '../utils/api';
export const state = {
records: [],
uiFlags: {
isFetching: false,
isFetchingItem: false,
isCreating: false,
isDeleting: false,
isUpdating: false,
},
};
export const getters = {
getBots($state) {
return $state.records;
},
getUIFlags($state) {
return $state.uiFlags;
},
getBot: $state => botId => {
const [bot] = $state.records.filter(record => record.id === Number(botId));
return bot || {};
},
};
export const actions = {
get: async ({ commit }) => {
commit(types.SET_AGENT_BOT_UI_FLAG, { isFetching: true });
try {
const response = await AgentBotsAPI.get();
commit(types.SET_AGENT_BOTS, response.data);
} catch (error) {
// Ignore error
} finally {
commit(types.SET_AGENT_BOT_UI_FLAG, { isFetching: false });
}
},
create: async ({ commit }, agentBotObj) => {
commit(types.SET_AGENT_BOT_UI_FLAG, { isCreating: true });
try {
const response = await AgentBotsAPI.create(agentBotObj);
commit(types.ADD_AGENT_BOT, response.data);
} catch (error) {
throwErrorMessage(error);
} finally {
commit(types.SET_AGENT_BOT_UI_FLAG, { isCreating: false });
}
},
update: async ({ commit }, { id, ...agentBotObj }) => {
commit(types.SET_AGENT_BOT_UI_FLAG, { isUpdating: true });
try {
const response = await AgentBotsAPI.update(id, agentBotObj);
commit(types.EDIT_AGENT_BOT, response.data);
} catch (error) {
throwErrorMessage(error);
} finally {
commit(types.SET_AGENT_BOT_UI_FLAG, { isUpdating: false });
}
},
delete: async ({ commit }, id) => {
commit(types.SET_AGENT_BOT_UI_FLAG, { isDeleting: true });
try {
await AgentBotsAPI.delete(id);
commit(types.DELETE_AGENT_BOT, id);
} catch (error) {
throwErrorMessage(error);
} finally {
commit(types.SET_AGENT_BOT_UI_FLAG, { isDeleting: false });
}
},
show: async ({ commit }, id) => {
commit(types.SET_AGENT_BOT_UI_FLAG, { isFetchingItem: true });
try {
const { data } = await AgentBotsAPI.show(id);
commit(types.DELETE_AGENT_BOT, data);
} catch (error) {
throwErrorMessage(error);
} finally {
commit(types.SET_AGENT_BOT_UI_FLAG, { isFetchingItem: false });
}
},
};
export const mutations = {
[types.SET_AGENT_BOT_UI_FLAG]($state, data) {
$state.uiFlags = {
...$state.uiFlags,
...data,
};
},
[types.ADD_AGENT_BOT]: MutationHelpers.create,
[types.SET_AGENT_BOTS]: MutationHelpers.set,
[types.EDIT_AGENT_BOT]: MutationHelpers.update,
[types.DELETE_AGENT_BOT]: MutationHelpers.destroy,
};
export default {
namespaced: true,
actions,
state,
getters,
mutations,
};

View file

@ -1,10 +1,12 @@
import * as MutationHelpers from 'shared/helpers/vuex/mutationHelpers'; import * as MutationHelpers from 'shared/helpers/vuex/mutationHelpers';
import types from '../mutation-types'; import types from '../mutation-types';
import MacrosAPI from '../../api/macros'; import MacrosAPI from '../../api/macros';
import { throwErrorMessage } from '../utils/api';
export const state = { export const state = {
records: [], records: [],
uiFlags: { uiFlags: {
isFetchingItem: false,
isFetching: false, isFetching: false,
isCreating: false, isCreating: false,
isDeleting: false, isDeleting: false,
@ -14,14 +16,14 @@ export const state = {
}; };
export const getters = { export const getters = {
getMacros(_state) { getMacros($state) {
return _state.records; return $state.records;
}, },
getMacro: $state => id => { getMacro: $state => id => {
return $state.records.find(record => record.id === Number(id)); return $state.records.find(record => record.id === Number(id));
}, },
getUIFlags(_state) { getUIFlags($state) {
return _state.uiFlags; return $state.uiFlags;
}, },
}; };
@ -37,16 +39,15 @@ export const actions = {
commit(types.SET_MACROS_UI_FLAG, { isFetching: false }); commit(types.SET_MACROS_UI_FLAG, { isFetching: false });
} }
}, },
// eslint-disable-next-line consistent-return
getSingleMacro: async function getMacroById({ commit }, macroId) { getSingleMacro: async function getMacroById({ commit }, macroId) {
commit(types.SET_MACROS_UI_FLAG, { isFetching: true }); commit(types.SET_MACROS_UI_FLAG, { isFetchingItem: true });
try { try {
const response = await MacrosAPI.getSingleMacro(macroId); const response = await MacrosAPI.show(macroId);
return response.data.payload; commit(types.ADD_MACRO, response.data.payload);
} catch (error) { } catch (error) {
// Ignore error // Ignore error
} finally { } finally {
commit(types.SET_MACROS_UI_FLAG, { isFetching: false }); commit(types.SET_MACROS_UI_FLAG, { isFetchingItem: false });
} }
}, },
create: async function createMacro({ commit }, macrosObj) { create: async function createMacro({ commit }, macrosObj) {
@ -55,7 +56,7 @@ export const actions = {
const response = await MacrosAPI.create(macrosObj); const response = await MacrosAPI.create(macrosObj);
commit(types.ADD_MACRO, response.data.payload); commit(types.ADD_MACRO, response.data.payload);
} catch (error) { } catch (error) {
throw new Error(error); throwErrorMessage(error);
} finally { } finally {
commit(types.SET_MACROS_UI_FLAG, { isCreating: false }); commit(types.SET_MACROS_UI_FLAG, { isCreating: false });
} }
@ -65,7 +66,7 @@ export const actions = {
try { try {
await MacrosAPI.executeMacro(macrosObj); await MacrosAPI.executeMacro(macrosObj);
} catch (error) { } catch (error) {
throw new Error(error); throwErrorMessage(error);
} finally { } finally {
commit(types.SET_MACROS_UI_FLAG, { isExecuting: false }); commit(types.SET_MACROS_UI_FLAG, { isExecuting: false });
} }
@ -76,7 +77,7 @@ export const actions = {
const response = await MacrosAPI.update(id, updateObj); const response = await MacrosAPI.update(id, updateObj);
commit(types.EDIT_MACRO, response.data.payload); commit(types.EDIT_MACRO, response.data.payload);
} catch (error) { } catch (error) {
throw new Error(error); throwErrorMessage(error);
} finally { } finally {
commit(types.SET_MACROS_UI_FLAG, { isUpdating: false }); commit(types.SET_MACROS_UI_FLAG, { isUpdating: false });
} }
@ -87,39 +88,21 @@ export const actions = {
await MacrosAPI.delete(id); await MacrosAPI.delete(id);
commit(types.DELETE_MACRO, id); commit(types.DELETE_MACRO, id);
} catch (error) { } catch (error) {
throw new Error(error); throwErrorMessage(error);
} finally { } finally {
commit(types.SET_MACROS_UI_FLAG, { isDeleting: false }); commit(types.SET_MACROS_UI_FLAG, { isDeleting: false });
} }
}, },
clone: async ({ commit }, id) => {
commit(types.SET_MACROS_UI_FLAG, { isCloning: true });
try {
await MacrosAPI.clone(id);
} catch (error) {
throw new Error(error);
} finally {
commit(types.SET_MACROS_UI_FLAG, { isCloning: false });
}
},
uploadAttachment: async (_, file) => {
try {
const { data } = await MacrosAPI.attachment(file);
return data.blob_id;
} catch (error) {
throw new Error(error);
}
},
}; };
export const mutations = { export const mutations = {
[types.SET_MACROS_UI_FLAG](_state, data) { [types.SET_MACROS_UI_FLAG]($state, data) {
_state.uiFlags = { $state.uiFlags = {
..._state.uiFlags, ...$state.uiFlags,
...data, ...data,
}; };
}, },
[types.ADD_MACRO]: MutationHelpers.create, [types.ADD_MACRO]: MutationHelpers.setSingleRecord,
[types.SET_MACROS]: MutationHelpers.set, [types.SET_MACROS]: MutationHelpers.set,
[types.EDIT_MACRO]: MutationHelpers.update, [types.EDIT_MACRO]: MutationHelpers.update,
[types.DELETE_MACRO]: MutationHelpers.destroy, [types.DELETE_MACRO]: MutationHelpers.destroy,

View file

@ -0,0 +1,93 @@
import axios from 'axios';
import { actions } from '../../agentBots';
import types from '../../../mutation-types';
import { agentBotRecords } from './fixtures';
const commit = jest.fn();
global.axios = axios;
jest.mock('axios');
describe('#actions', () => {
describe('#get', () => {
it('sends correct actions if API is success', async () => {
axios.get.mockResolvedValue({ data: agentBotRecords });
await actions.get({ commit });
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isFetching: true }],
[types.SET_AGENT_BOTS, agentBotRecords],
[types.SET_AGENT_BOT_UI_FLAG, { isFetching: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.get.mockRejectedValue({ message: 'Incorrect header' });
await actions.get({ commit });
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isFetching: true }],
[types.SET_AGENT_BOT_UI_FLAG, { isFetching: false }],
]);
});
});
describe('#create', () => {
it('sends correct actions if API is success', async () => {
axios.post.mockResolvedValue({ data: agentBotRecords[0] });
await actions.create({ commit }, agentBotRecords[0]);
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isCreating: true }],
[types.ADD_AGENT_BOT, agentBotRecords[0]],
[types.SET_AGENT_BOT_UI_FLAG, { isCreating: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.post.mockRejectedValue({ message: 'Incorrect header' });
await expect(actions.create({ commit })).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isCreating: true }],
[types.SET_AGENT_BOT_UI_FLAG, { isCreating: false }],
]);
});
});
describe('#update', () => {
it('sends correct actions if API is success', async () => {
axios.patch.mockResolvedValue({ data: agentBotRecords[0] });
await actions.update({ commit }, agentBotRecords[0]);
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isUpdating: true }],
[types.EDIT_AGENT_BOT, agentBotRecords[0]],
[types.SET_AGENT_BOT_UI_FLAG, { isUpdating: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.patch.mockRejectedValue({ message: 'Incorrect header' });
await expect(
actions.update({ commit }, agentBotRecords[0])
).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isUpdating: true }],
[types.SET_AGENT_BOT_UI_FLAG, { isUpdating: false }],
]);
});
});
describe('#delete', () => {
it('sends correct actions if API is success', async () => {
axios.delete.mockResolvedValue({ data: agentBotRecords[0] });
await actions.delete({ commit }, agentBotRecords[0].id);
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isDeleting: true }],
[types.DELETE_AGENT_BOT, agentBotRecords[0].id],
[types.SET_AGENT_BOT_UI_FLAG, { isDeleting: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.delete.mockRejectedValue({ message: 'Incorrect header' });
await expect(
actions.delete({ commit }, agentBotRecords[0].id)
).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[types.SET_AGENT_BOT_UI_FLAG, { isDeleting: true }],
[types.SET_AGENT_BOT_UI_FLAG, { isDeleting: false }],
]);
});
});
});

View file

@ -0,0 +1,15 @@
export const agentBotRecords = [
{
id: 11,
name: 'Agent Bot 11',
description: 'Agent Bot Description',
type: 'csml',
},
{
id: 12,
name: 'Agent Bot 12',
description: 'Agent Bot Description 12',
type: 'csml',
},
];

View file

@ -0,0 +1,31 @@
import { getters } from '../../agentBots';
import { agentBotRecords } from './fixtures';
describe('#getters', () => {
it('getBots', () => {
const state = { records: agentBotRecords };
expect(getters.getBots(state)).toEqual(agentBotRecords);
});
it('getBot', () => {
const state = { records: agentBotRecords };
expect(getters.getBot(state)(11)).toEqual(agentBotRecords[0]);
});
it('getUIFlags', () => {
const state = {
uiFlags: {
isFetching: true,
isCreating: false,
isUpdating: false,
isDeleting: false,
},
};
expect(getters.getUIFlags(state)).toEqual({
isFetching: true,
isCreating: false,
isUpdating: false,
isDeleting: false,
});
});
});

View file

@ -0,0 +1,44 @@
import types from '../../../mutation-types';
import { mutations } from '../../agentBots';
import { agentBotRecords } from './fixtures';
describe('#mutations', () => {
describe('#SET_AGENT_BOT_UI_FLAG', () => {
it('set uiFlags', () => {
const state = { uiFlags: { isFetchingItem: false } };
mutations[types.SET_AGENT_BOT_UI_FLAG](state, { isFetchingItem: true });
expect(state.uiFlags.isFetchingItem).toEqual(true);
});
});
describe('#SET_AGENT_BOTS', () => {
it('set agent bot records', () => {
const state = { records: [] };
mutations[types.SET_AGENT_BOTS](state, agentBotRecords);
expect(state.records).toEqual(agentBotRecords);
});
});
describe('#ADD_AGENT_BOT', () => {
it('push newly created bot to the store', () => {
const state = { records: [agentBotRecords[0]] };
mutations[types.ADD_AGENT_BOT](state, agentBotRecords[1]);
expect(state.records).toEqual([agentBotRecords[0], agentBotRecords[1]]);
});
});
describe('#EDIT_AGENT_BOT', () => {
it('update agent bot record', () => {
const state = { records: [agentBotRecords[0]] };
mutations[types.EDIT_AGENT_BOT](state, {
id: 11,
name: 'agent-bot-11',
});
expect(state.records[0].name).toEqual('agent-bot-11');
});
});
describe('#DELETE_AGENT_BOT', () => {
it('delete agent bot record', () => {
const state = { records: [agentBotRecords[0]] };
mutations[types.DELETE_AGENT_BOT](state, agentBotRecords[0]);
expect(state.records).toEqual([agentBotRecords[0]]);
});
});
});

View file

@ -31,19 +31,19 @@ describe('#actions', () => {
describe('#getMacroById', () => { describe('#getMacroById', () => {
it('sends correct actions if API is success', async () => { it('sends correct actions if API is success', async () => {
axios.get.mockResolvedValue({ data: { payload: macrosList[0] } }); axios.get.mockResolvedValue({ data: { payload: macrosList[0] } });
const data = await actions.getSingleMacro({ commit }, 22); await actions.getSingleMacro({ commit }, 22);
expect(data).toEqual(macrosList[0]);
expect(commit.mock.calls).toEqual([ expect(commit.mock.calls).toEqual([
[types.default.SET_MACROS_UI_FLAG, { isFetching: true }], [types.default.SET_MACROS_UI_FLAG, { isFetchingItem: true }],
[types.default.SET_MACROS_UI_FLAG, { isFetching: false }], [types.default.ADD_MACRO, macrosList[0]],
[types.default.SET_MACROS_UI_FLAG, { isFetchingItem: false }],
]); ]);
}); });
it('sends correct actions if API is error', async () => { it('sends correct actions if API is error', async () => {
axios.get.mockRejectedValue({ message: 'Incorrect header' }); axios.get.mockRejectedValue({ message: 'Incorrect header' });
await actions.getSingleMacro({ commit }, 22); await actions.getSingleMacro({ commit }, 22);
expect(commit.mock.calls).toEqual([ expect(commit.mock.calls).toEqual([
[types.default.SET_MACROS_UI_FLAG, { isFetching: true }], [types.default.SET_MACROS_UI_FLAG, { isFetchingItem: true }],
[types.default.SET_MACROS_UI_FLAG, { isFetching: false }], [types.default.SET_MACROS_UI_FLAG, { isFetchingItem: false }],
]); ]);
}); });
}); });

View file

@ -246,6 +246,13 @@ export default {
REMOVE_CATEGORY: 'REMOVE_CATEGORY', REMOVE_CATEGORY: 'REMOVE_CATEGORY',
REMOVE_CATEGORY_ID: 'REMOVE_CATEGORY_ID', REMOVE_CATEGORY_ID: 'REMOVE_CATEGORY_ID',
// Agent Bots
SET_AGENT_BOT_UI_FLAG: 'SET_AGENT_BOT_UI_FLAG',
SET_AGENT_BOTS: 'SET_AGENT_BOTS',
ADD_AGENT_BOT: 'ADD_AGENT_BOT',
EDIT_AGENT_BOT: 'EDIT_AGENT_BOT',
DELETE_AGENT_BOT: 'DELETE_AGENT_BOT',
// MACROS // MACROS
SET_MACROS_UI_FLAG: 'SET_MACROS_UI_FLAG', SET_MACROS_UI_FLAG: 'SET_MACROS_UI_FLAG',
SET_MACROS: 'SET_MACROS', SET_MACROS: 'SET_MACROS',

View file

@ -29,6 +29,7 @@
"M6.5 2A2.5 2.5 0 0 0 4 4.5v15A2.5 2.5 0 0 0 6.5 22h13.25a.75.75 0 0 0 0-1.5H6.5a1 1 0 0 1-1-1h14.25a.75.75 0 0 0 .75-.75V4.5A2.5 2.5 0 0 0 18 2H6.5ZM19 18H5.5V4.5a1 1 0 0 1 1-1H18a1 1 0 0 1 1 1V18Z" "M6.5 2A2.5 2.5 0 0 0 4 4.5v15A2.5 2.5 0 0 0 6.5 22h13.25a.75.75 0 0 0 0-1.5H6.5a1 1 0 0 1-1-1h14.25a.75.75 0 0 0 .75-.75V4.5A2.5 2.5 0 0 0 18 2H6.5ZM19 18H5.5V4.5a1 1 0 0 1 1-1H18a1 1 0 0 1 1 1V18Z"
], ],
"book-open-globe-outline": "M3.5 5.75a.25.25 0 0 1 .25-.25H10c.69 0 1.25.56 1.25 1.25v8.959a6.49 6.49 0 0 1 1.5-2.646V6.75c0-.69.56-1.25 1.25-1.25h6.25a.25.25 0 0 1 .25.25v5.982A6.518 6.518 0 0 1 22 12.81V5.75A1.75 1.75 0 0 0 20.25 4H14c-.788 0-1.499.331-2 .863A2.742 2.742 0 0 0 10 4H3.75A1.75 1.75 0 0 0 2 5.75v12.5c0 .966.784 1.75 1.75 1.75H10c.495 0 .96-.13 1.36-.36a6.473 6.473 0 0 1-.343-1.663A1.248 1.248 0 0 1 10 18.5H3.75a.25.25 0 0 1-.25-.25V5.75ZM16.007 17c.04-1.415.248-2.669.553-3.585.171-.513.364-.893.554-1.134.195-.247.329-.281.386-.281.057 0 .192.034.386.281.19.241.383.62.554 1.134.305.916.513 2.17.553 3.585h-2.986Zm-.396-3.9c.108-.323.23-.622.368-.887A5.504 5.504 0 0 0 12.023 17h2.984c.04-1.5.26-2.866.604-3.9Zm3.778 0a6.133 6.133 0 0 0-.368-.887A5.504 5.504 0 0 1 22.978 17h-2.985c-.04-1.5-.26-2.866-.604-3.9Zm.604 4.9h2.985a5.504 5.504 0 0 1-3.957 4.787c.138-.265.26-.564.368-.886.345-1.035.564-2.4.604-3.901Zm-2.107 4.719c-.194.247-.329.281-.386.281-.057 0-.191-.034-.386-.281-.19-.241-.383-.62-.554-1.135-.305-.915-.513-2.17-.553-3.584h2.986c-.04 1.415-.248 2.669-.553 3.584-.171.514-.364.894-.554 1.135ZM12.023 18a5.504 5.504 0 0 0 3.956 4.787 6.133 6.133 0 0 1-.367-.886c-.346-1.035-.565-2.4-.605-3.901h-2.984Z", "book-open-globe-outline": "M3.5 5.75a.25.25 0 0 1 .25-.25H10c.69 0 1.25.56 1.25 1.25v8.959a6.49 6.49 0 0 1 1.5-2.646V6.75c0-.69.56-1.25 1.25-1.25h6.25a.25.25 0 0 1 .25.25v5.982A6.518 6.518 0 0 1 22 12.81V5.75A1.75 1.75 0 0 0 20.25 4H14c-.788 0-1.499.331-2 .863A2.742 2.742 0 0 0 10 4H3.75A1.75 1.75 0 0 0 2 5.75v12.5c0 .966.784 1.75 1.75 1.75H10c.495 0 .96-.13 1.36-.36a6.473 6.473 0 0 1-.343-1.663A1.248 1.248 0 0 1 10 18.5H3.75a.25.25 0 0 1-.25-.25V5.75ZM16.007 17c.04-1.415.248-2.669.553-3.585.171-.513.364-.893.554-1.134.195-.247.329-.281.386-.281.057 0 .192.034.386.281.19.241.383.62.554 1.134.305.916.513 2.17.553 3.585h-2.986Zm-.396-3.9c.108-.323.23-.622.368-.887A5.504 5.504 0 0 0 12.023 17h2.984c.04-1.5.26-2.866.604-3.9Zm3.778 0a6.133 6.133 0 0 0-.368-.887A5.504 5.504 0 0 1 22.978 17h-2.985c-.04-1.5-.26-2.866-.604-3.9Zm.604 4.9h2.985a5.504 5.504 0 0 1-3.957 4.787c.138-.265.26-.564.368-.886.345-1.035.564-2.4.604-3.901Zm-2.107 4.719c-.194.247-.329.281-.386.281-.057 0-.191-.034-.386-.281-.19-.241-.383-.62-.554-1.135-.305-.915-.513-2.17-.553-3.584h2.986c-.04 1.415-.248 2.669-.553 3.584-.171.514-.364.894-.554 1.135ZM12.023 18a5.504 5.504 0 0 0 3.956 4.787 6.133 6.133 0 0 1-.367-.886c-.346-1.035-.565-2.4-.605-3.901h-2.984Z",
"bot-outline": "M17.753 14a2.25 2.25 0 0 1 2.25 2.25v.905a3.75 3.75 0 0 1-1.307 2.846C17.13 21.345 14.89 22 12 22c-2.89 0-5.128-.656-6.691-2a3.75 3.75 0 0 1-1.306-2.843v-.908A2.25 2.25 0 0 1 6.253 14h11.5Zm0 1.5h-11.5a.75.75 0 0 0-.75.75v.908c0 .655.286 1.278.784 1.706C7.545 19.945 9.44 20.502 12 20.502c2.56 0 4.458-.557 5.719-1.64a2.25 2.25 0 0 0 .784-1.706v-.906a.75.75 0 0 0-.75-.75ZM11.898 2.008 12 2a.75.75 0 0 1 .743.648l.007.102V3.5h3.5a2.25 2.25 0 0 1 2.25 2.25v4.505a2.25 2.25 0 0 1-2.25 2.25h-8.5a2.25 2.25 0 0 1-2.25-2.25V5.75A2.25 2.25 0 0 1 7.75 3.5h3.5v-.749a.75.75 0 0 1 .648-.743L12 2l-.102.007ZM16.25 5h-8.5a.75.75 0 0 0-.75.75v4.505c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75V5.75a.75.75 0 0 0-.75-.75Zm-6.5 1.5a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm4.492 0a1.25 1.25 0 1 1 0 2.499 1.25 1.25 0 0 1 0-2.499Z",
"building-bank-outline": "M13.032 2.325a1.75 1.75 0 0 0-2.064 0L3.547 7.74c-.978.713-.473 2.26.736 2.26H4.5v5.8A2.75 2.75 0 0 0 3 18.25v1.5c0 .413.336.75.75.75h16.5a.75.75 0 0 0 .75-.75v-1.5a2.75 2.75 0 0 0-1.5-2.45V10h.217c1.21 0 1.713-1.547.736-2.26l-7.421-5.416Zm-1.18 1.211a.25.25 0 0 1 .295 0L18.95 8.5H5.05l6.803-4.964ZM18 10v5.5h-2V10h2Zm-3.5 0v5.5h-1.75V10h1.75Zm-3.25 0v5.5H9.5V10h1.75Zm-5.5 7h12.5c.69 0 1.25.56 1.25 1.25V19h-15v-.75c0-.69.56-1.25 1.25-1.25ZM6 15.5V10h2v5.5H6Z", "building-bank-outline": "M13.032 2.325a1.75 1.75 0 0 0-2.064 0L3.547 7.74c-.978.713-.473 2.26.736 2.26H4.5v5.8A2.75 2.75 0 0 0 3 18.25v1.5c0 .413.336.75.75.75h16.5a.75.75 0 0 0 .75-.75v-1.5a2.75 2.75 0 0 0-1.5-2.45V10h.217c1.21 0 1.713-1.547.736-2.26l-7.421-5.416Zm-1.18 1.211a.25.25 0 0 1 .295 0L18.95 8.5H5.05l6.803-4.964ZM18 10v5.5h-2V10h2Zm-3.5 0v5.5h-1.75V10h1.75Zm-3.25 0v5.5H9.5V10h1.75Zm-5.5 7h12.5c.69 0 1.25.56 1.25 1.25V19h-15v-.75c0-.69.56-1.25 1.25-1.25ZM6 15.5V10h2v5.5H6Z",
"calendar-clock-outline": [ "calendar-clock-outline": [
"M21 6.25A3.25 3.25 0 0 0 17.75 3H6.25A3.25 3.25 0 0 0 3 6.25v11.5A3.25 3.25 0 0 0 6.25 21h5.772a6.471 6.471 0 0 1-.709-1.5H6.25a1.75 1.75 0 0 1-1.75-1.75V8.5h15v2.813a6.471 6.471 0 0 1 1.5.709V6.25ZM6.25 4.5h11.5c.966 0 1.75.784 1.75 1.75V7h-15v-.75c0-.966.784-1.75 1.75-1.75Z", "M21 6.25A3.25 3.25 0 0 0 17.75 3H6.25A3.25 3.25 0 0 0 3 6.25v11.5A3.25 3.25 0 0 0 6.25 21h5.772a6.471 6.471 0 0 1-.709-1.5H6.25a1.75 1.75 0 0 1-1.75-1.75V8.5h15v2.813a6.471 6.471 0 0 1 1.5.709V6.25ZM6.25 4.5h11.5c.966 0 1.75.784 1.75 1.75V7h-15v-.75c0-.966.784-1.75 1.75-1.75Z",

View file

@ -5,21 +5,21 @@
<li <li
v-for="category in Object.keys(emojis)" v-for="category in Object.keys(emojis)"
:key="category" :key="category"
:class="{ active: selectedKey === category }"
@click="changeCategory(category)" @click="changeCategory(category)"
> >
<button <button
v-dompurify-html="emojis[category][0]" v-dompurify-html="emojis[category][0]"
class="emoji--item" class="emoji--item"
:class="{ active: selectedKey === category }"
@click="changeCategory(category)" @click="changeCategory(category)"
/> />
</li> </li>
</ul> </ul>
</header> </header>
<h5 class="emoji-category--title">
{{ selectedKey }}
</h5>
<div class="emoji--row"> <div class="emoji--row">
<h5 class="emoji-category--title">
{{ selectedKey }}
</h5>
<button <button
v-for="emoji in emojis[selectedKey]" v-for="emoji in emojis[selectedKey]"
:key="emoji" :key="emoji"
@ -64,16 +64,18 @@ export default {
$space-smaller: 4px; $space-smaller: 4px;
$space-small: 8px; $space-small: 8px;
$space-one: 10px;
$space-slab: 12px; $space-slab: 12px;
$space-normal: 16px; $space-normal: 16px;
$space-two: 20px; $space-two: 20px;
$space-medium: 24px; $space-medium: 24px;
$font-size-tiny: 12px;
$font-size-small: 14px; $font-size-small: 14px;
$font-size-default: 16px; $font-size-default: 16px;
$font-size-medium: 18px; $font-size-medium: 18px;
$color-bg: #ebf0f5;
.emoji-dialog { .emoji-dialog {
@include elegant-card; @include elegant-card;
background: $color-white; background: $color-white;
@ -81,8 +83,8 @@ $font-size-medium: 18px;
box-sizing: content-box; box-sizing: content-box;
position: absolute; position: absolute;
right: 0; right: 0;
top: -22 * $space-one; top: -220px;
width: 32 * $space-one; width: 332px;
z-index: 1; z-index: 1;
&::before { &::before {
@ -97,35 +99,44 @@ $font-size-medium: 18px;
background: transparent; background: transparent;
border: 0; border: 0;
font-size: $font-size-medium; font-size: $font-size-medium;
height: $space-medium;
border-radius: $space-smaller;
margin: 0; margin: 0;
padding: 0; padding: 0 $space-smaller;
&:hover {
background: $color-bg;
}
} }
.emoji--row { .emoji--row {
display: flex;
box-sizing: border-box; box-sizing: border-box;
height: $space-one * 18; height: 200px;
overflow-y: auto; overflow-y: auto;
padding: $space-smaller $space-normal; padding: $space-smaller;
flex-wrap: wrap;
.emoji--item { .emoji--item {
float: left;
margin: $space-smaller; margin: $space-smaller;
line-height: 1.5; line-height: 1.5;
} }
} }
}
.emoji-category--title { .emoji-category--title {
color: $color-heading; color: $color-heading;
font-size: $font-size-small; font-size: $font-size-small;
font-weight: 500; font-weight: 500;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0;
text-transform: capitalize; padding: $space-smaller $space-small;
} margin-top: $space-smaller;
text-transform: capitalize;
} }
.emoji-dialog--header { .emoji-dialog--header {
background-color: $color-body; background-color: $color-bg;
border-top-left-radius: $space-small; border-top-left-radius: $space-small;
border-top-right-radius: $space-small; border-top-right-radius: $space-small;
padding: 0 $space-smaller; padding: 0 $space-smaller;
@ -135,21 +146,25 @@ $font-size-medium: 18px;
list-style: none; list-style: none;
overflow: auto; overflow: auto;
margin: 0; margin: 0;
padding: $space-smaller 0 0; padding: $space-smaller 0;
> li { > li {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
display: flex; display: flex;
height: 2.4 * $space-one;
justify-content: center; justify-content: center;
padding: $space-smaller $space-small; padding: $space-smaller;
} }
> .active { li .active {
background: $color-white; background: $color-white;
border-top-left-radius: $space-smaller; }
border-top-right-radius: $space-smaller; .emoji--item {
font-size: $font-size-small;
&:hover {
background: $color-bg;
}
} }
} }
} }

View file

@ -189,7 +189,8 @@ export default {
} }
.emoji-dialog { .emoji-dialog {
right: space-smaller; right: $space-smaller;
top: -278px;
&::before { &::before {
right: $space-one; right: $space-one;

View file

@ -36,7 +36,7 @@ class BulkActionsJob < ApplicationJob
def available_params(params) def available_params(params)
return unless params[:fields] return unless params[:fields]
params[:fields].delete_if { |_k, v| v.nil? } params[:fields].delete_if { |key, value| value.nil? && key == 'status' }
end end
def bulk_add_labels(conversation) def bulk_add_labels(conversation)

View file

@ -14,6 +14,11 @@
# account_id :integer not null # account_id :integer not null
# message_id :integer not null # message_id :integer not null
# #
# Indexes
#
# index_attachments_on_account_id (account_id)
# index_attachments_on_message_id (message_id)
#
class Attachment < ApplicationRecord class Attachment < ApplicationRecord
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers

View file

@ -25,11 +25,12 @@ class Channel::Whatsapp < ApplicationRecord
# default at the moment is 360dialog lets change later. # default at the moment is 360dialog lets change later.
PROVIDERS = %w[default whatsapp_cloud].freeze PROVIDERS = %w[default whatsapp_cloud].freeze
before_validation :ensure_webhook_verify_token
validates :provider, inclusion: { in: PROVIDERS } validates :provider, inclusion: { in: PROVIDERS }
validates :phone_number, presence: true, uniqueness: true validates :phone_number, presence: true, uniqueness: true
validate :validate_provider_config validate :validate_provider_config
after_create :sync_templates after_create :sync_templates
def name def name
@ -56,6 +57,10 @@ class Channel::Whatsapp < ApplicationRecord
private private
def ensure_webhook_verify_token
provider_config['webhook_verify_token'] ||= SecureRandom.hex(16) if provider == 'whatsapp_cloud'
end
def validate_provider_config def validate_provider_config
errors.add(:provider_config, 'Invalid Credentials') unless provider_service.validate_provider_config? errors.add(:provider_config, 'Invalid Credentials') unless provider_service.validate_provider_config?
end end

View file

@ -31,8 +31,10 @@
# index_conversations_on_account_id_and_display_id (account_id,display_id) UNIQUE # index_conversations_on_account_id_and_display_id (account_id,display_id) UNIQUE
# index_conversations_on_assignee_id_and_account_id (assignee_id,account_id) # index_conversations_on_assignee_id_and_account_id (assignee_id,account_id)
# index_conversations_on_campaign_id (campaign_id) # index_conversations_on_campaign_id (campaign_id)
# index_conversations_on_contact_id (contact_id)
# index_conversations_on_contact_inbox_id (contact_inbox_id) # index_conversations_on_contact_inbox_id (contact_inbox_id)
# index_conversations_on_first_reply_created_at (first_reply_created_at) # index_conversations_on_first_reply_created_at (first_reply_created_at)
# index_conversations_on_inbox_id (inbox_id)
# index_conversations_on_last_activity_at (last_activity_at) # index_conversations_on_last_activity_at (last_activity_at)
# index_conversations_on_status_and_account_id (status,account_id) # index_conversations_on_status_and_account_id (status,account_id)
# index_conversations_on_team_id (team_id) # index_conversations_on_team_id (team_id)

View file

@ -15,3 +15,5 @@
enabled: false enabled: false
- name: help_center - name: help_center
enabled: true enabled: true
- name: agent_bots
enabled: false

View file

@ -0,0 +1,8 @@
class AddIndexToMessageAttachments < ActiveRecord::Migration[6.1]
def change
add_index :attachments, :account_id
add_index :attachments, :message_id
add_index :conversations, :contact_id
add_index :conversations, :inbox_id
end
end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_09_30_025317) do ActiveRecord::Schema.define(version: 2022_10_10_212946) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements" enable_extension "pg_stat_statements"
@ -148,6 +148,8 @@ ActiveRecord::Schema.define(version: 2022_09_30_025317) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "fallback_title" t.string "fallback_title"
t.string "extension" t.string "extension"
t.index ["account_id"], name: "index_attachments_on_account_id"
t.index ["message_id"], name: "index_attachments_on_message_id"
end end
create_table "automation_rules", force: :cascade do |t| create_table "automation_rules", force: :cascade do |t|
@ -410,8 +412,10 @@ ActiveRecord::Schema.define(version: 2022_09_30_025317) do
t.index ["account_id"], name: "index_conversations_on_account_id" t.index ["account_id"], name: "index_conversations_on_account_id"
t.index ["assignee_id", "account_id"], name: "index_conversations_on_assignee_id_and_account_id" t.index ["assignee_id", "account_id"], name: "index_conversations_on_assignee_id_and_account_id"
t.index ["campaign_id"], name: "index_conversations_on_campaign_id" t.index ["campaign_id"], name: "index_conversations_on_campaign_id"
t.index ["contact_id"], name: "index_conversations_on_contact_id"
t.index ["contact_inbox_id"], name: "index_conversations_on_contact_inbox_id" t.index ["contact_inbox_id"], name: "index_conversations_on_contact_inbox_id"
t.index ["first_reply_created_at"], name: "index_conversations_on_first_reply_created_at" t.index ["first_reply_created_at"], name: "index_conversations_on_first_reply_created_at"
t.index ["inbox_id"], name: "index_conversations_on_inbox_id"
t.index ["last_activity_at"], name: "index_conversations_on_last_activity_at" t.index ["last_activity_at"], name: "index_conversations_on_last_activity_at"
t.index ["status", "account_id"], name: "index_conversations_on_status_and_account_id" t.index ["status", "account_id"], name: "index_conversations_on_status_and_account_id"
t.index ["team_id"], name: "index_conversations_on_team_id" t.index ["team_id"], name: "index_conversations_on_team_id"

View file

@ -7,7 +7,7 @@ module RegexHelper
UNICODE_CHARACTER_NUMBER_HYPHEN_UNDERSCORE = Regexp.new('\A[\p{L}\p{N}]+[\p{L}\p{N}_-]+\Z') UNICODE_CHARACTER_NUMBER_HYPHEN_UNDERSCORE = Regexp.new('\A[\p{L}\p{N}]+[\p{L}\p{N}_-]+\Z')
MENTION_REGEX = Regexp.new('\[(@[\w_. ]+)\]\(mention://(?:user|team)/\d+/(.*?)+\)') MENTION_REGEX = Regexp.new('\[(@[\w_. ]+)\]\(mention://(?:user|team)/\d+/(.*?)+\)')
TWILIO_CHANNEL_SMS_REGEX = Regexp.new('^\+\d{1,14}\z') TWILIO_CHANNEL_SMS_REGEX = Regexp.new('^\+\d{1,15}\z')
TWILIO_CHANNEL_WHATSAPP_REGEX = Regexp.new('^whatsapp:\+\d{1,14}\z') TWILIO_CHANNEL_WHATSAPP_REGEX = Regexp.new('^whatsapp:\+\d{1,15}\z')
WHATSAPP_CHANNEL_REGEX = Regexp.new('^\d{1,14}\z') WHATSAPP_CHANNEL_REGEX = Regexp.new('^\d{1,14}\z')
end end

View file

@ -75,6 +75,46 @@ RSpec.describe 'Api::V1::Accounts::BulkActionsController', type: :request do
expect(Conversation.first.status).to eq('open') expect(Conversation.first.status).to eq('open')
end end
it 'Bulk remove assignee id from conversations' do
Conversation.first.update(assignee_id: agent_1.id)
Conversation.second.update(assignee_id: agent_2.id)
params = { type: 'Conversation', fields: { assignee_id: nil }, ids: Conversation.first(3).pluck(:display_id) }
expect(Conversation.first.status).to eq('open')
expect(Conversation.first.assignee_id).to eq(agent_1.id)
expect(Conversation.second.assignee_id).to eq(agent_2.id)
perform_enqueued_jobs do
post "/api/v1/accounts/#{account.id}/bulk_actions",
headers: agent.create_new_auth_token,
params: params
expect(response).to have_http_status(:success)
end
expect(Conversation.first.assignee_id).to be_nil
expect(Conversation.second.assignee_id).to be_nil
expect(Conversation.first.status).to eq('open')
end
it 'Do not bulk update status to nil' do
Conversation.first.update(assignee_id: agent_1.id)
Conversation.second.update(assignee_id: agent_2.id)
params = { type: 'Conversation', fields: { status: nil }, ids: Conversation.first(3).pluck(:display_id) }
expect(Conversation.first.status).to eq('open')
perform_enqueued_jobs do
post "/api/v1/accounts/#{account.id}/bulk_actions",
headers: agent.create_new_auth_token,
params: params
expect(response).to have_http_status(:success)
end
expect(Conversation.first.status).to eq('open')
end
it 'Bulk update conversation status and assignee id' do it 'Bulk update conversation status and assignee id' do
params = { type: 'Conversation', fields: { assignee_id: agent_1.id, status: 'snoozed' }, ids: Conversation.first(3).pluck(:display_id) } params = { type: 'Conversation', fields: { assignee_id: agent_1.id, status: 'snoozed' }, ids: Conversation.first(3).pluck(:display_id) }

View file

@ -44,8 +44,8 @@ FactoryBot.define do
channel_whatsapp.define_singleton_method(:sync_templates) { return } unless options.sync_templates channel_whatsapp.define_singleton_method(:sync_templates) { return } unless options.sync_templates
channel_whatsapp.define_singleton_method(:validate_provider_config) { return } unless options.validate_provider_config channel_whatsapp.define_singleton_method(:validate_provider_config) { return } unless options.validate_provider_config
if channel_whatsapp.provider == 'whatsapp_cloud' if channel_whatsapp.provider == 'whatsapp_cloud'
channel_whatsapp.provider_config = { 'api_key' => 'test_key', 'phone_number_id' => '123456789', 'business_account_id' => '123456789', channel_whatsapp.provider_config = channel_whatsapp.provider_config.merge({ 'api_key' => 'test_key', 'phone_number_id' => '123456789',
'webhook_verify_token': 'test_token' } 'business_account_id' => '123456789' })
end end
end end

View file

@ -20,4 +20,20 @@ RSpec.describe Channel::Whatsapp do
expect(channel.save).to be(true) expect(channel.save).to be(true)
end end
end end
describe 'webhook_verify_token' do
it 'generates webhook_verify_token if not present' do
channel = create(:channel_whatsapp, provider_config: { webhook_verify_token: nil }, provider: 'whatsapp_cloud', account: create(:account),
validate_provider_config: false, sync_templates: false)
expect(channel.provider_config['webhook_verify_token']).not_to be_nil
end
it 'does not generate webhook_verify_token if present' do
channel = create(:channel_whatsapp, provider: 'whatsapp_cloud', provider_config: { webhook_verify_token: '123' }, account: create(:account),
validate_provider_config: false, sync_templates: false)
expect(channel.provider_config['webhook_verify_token']).to eq '123'
end
end
end end

View file

@ -66,11 +66,11 @@ RSpec.describe ContactInbox do
expect(valid_source_id.valid?).to be(true) expect(valid_source_id.valid?).to be(true)
expect(ci_character_in_source_id.valid?).to be(false) expect(ci_character_in_source_id.valid?).to be(false)
expect(ci_character_in_source_id.errors.full_messages).to eq( expect(ci_character_in_source_id.errors.full_messages).to eq(
['Source invalid source id for twilio sms inbox. valid Regex (?-mix:^\\+\\d{1,14}\\z)'] ['Source invalid source id for twilio sms inbox. valid Regex (?-mix:^\\+\\d{1,15}\\z)']
) )
expect(ci_without_plus_in_source_id.valid?).to be(false) expect(ci_without_plus_in_source_id.valid?).to be(false)
expect(ci_without_plus_in_source_id.errors.full_messages).to eq( expect(ci_without_plus_in_source_id.errors.full_messages).to eq(
['Source invalid source id for twilio sms inbox. valid Regex (?-mix:^\\+\\d{1,14}\\z)'] ['Source invalid source id for twilio sms inbox. valid Regex (?-mix:^\\+\\d{1,15}\\z)']
) )
end end
@ -83,11 +83,11 @@ RSpec.describe ContactInbox do
expect(valid_source_id.valid?).to be(true) expect(valid_source_id.valid?).to be(true)
expect(ci_character_in_source_id.valid?).to be(false) expect(ci_character_in_source_id.valid?).to be(false)
expect(ci_character_in_source_id.errors.full_messages).to eq( expect(ci_character_in_source_id.errors.full_messages).to eq(
['Source invalid source id for twilio whatsapp inbox. valid Regex (?-mix:^whatsapp:\\+\\d{1,14}\\z)'] ['Source invalid source id for twilio whatsapp inbox. valid Regex (?-mix:^whatsapp:\\+\\d{1,15}\\z)']
) )
expect(ci_without_plus_in_source_id.valid?).to be(false) expect(ci_without_plus_in_source_id.valid?).to be(false)
expect(ci_without_plus_in_source_id.errors.full_messages).to eq( expect(ci_without_plus_in_source_id.errors.full_messages).to eq(
['Source invalid source id for twilio whatsapp inbox. valid Regex (?-mix:^whatsapp:\\+\\d{1,14}\\z)'] ['Source invalid source id for twilio whatsapp inbox. valid Regex (?-mix:^whatsapp:\\+\\d{1,15}\\z)']
) )
end end
end end