From 1706199a0e7e080ce4dcab6b83396b31969d9019 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Tue, 16 Feb 2021 00:58:57 +0530 Subject: [PATCH] feat: Add pre_chat_form_settings in inbox settings page (#1776) --- .../api/v1/accounts/inboxes_controller.rb | 2 + .../dashboard/i18n/locale/en/inboxMgmt.json | 20 ++- .../settings/inbox/PreChatForm/Settings.vue | 128 ++++++++++++++++++ .../dashboard/settings/inbox/Settings.vue | 21 ++- .../dashboard/store/modules/inboxes.js | 7 +- .../widget/components/PreChat/Form.vue | 2 +- app/javascript/widget/views/Home.vue | 2 +- app/views/api/v1/models/_inbox.json.jbuilder | 6 +- app/views/widget_tests/index.html.erb | 12 +- 9 files changed, 188 insertions(+), 12 deletions(-) create mode 100644 app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue diff --git a/app/controllers/api/v1/accounts/inboxes_controller.rb b/app/controllers/api/v1/accounts/inboxes_controller.rb index 0f573bbb9..6c078d28f 100644 --- a/app/controllers/api/v1/accounts/inboxes_controller.rb +++ b/app/controllers/api/v1/accounts/inboxes_controller.rb @@ -89,6 +89,8 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController :webhook_url, :email, :reply_time, + :pre_chat_form_enabled, + { pre_chat_form_options: [:pre_chat_message, :require_email] }, { selected_feature_flags: [] } ]) end diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index 8c3f5624b..55ba4a0ff 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -224,7 +224,8 @@ "TABS": { "SETTINGS": "Settings", "COLLABORATORS": "Collaborators", - "CONFIGURATION": "Configuration" + "CONFIGURATION": "Configuration", + "PRE_CHAT_FORM": "Pre Chat Form" }, "SETTINGS": "Settings", "FEATURES": { @@ -250,6 +251,23 @@ "SUBTITLE": "Your Facebook connection has expired, please reconnect your Facebook page to continue services", "MESSAGE_SUCCESS": "Reconnection successful", "MESSAGE_ERROR": "There was an error, please try again" + }, + "PRE_CHAT_FORM": { + "DESCRIPTION": "Pre chat forms enable you to capture user information before they start conversation with you.", + "ENABLE": { + "LABEL": "Enable pre chat form", + "OPTIONS": { + "ENABLED": "Yes", + "DISABLED": "No" + } + }, + "PRE_CHAT_MESSAGE": { + "LABEL": "Pre Chat Message", + "PLACEHOLDER": "This message would be visible to the users along with the form" + }, + "REQUIRE_EMAIL": { + "LABEL": "Visitors should provide their name and email address before starting the chat" + } } } } diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue new file mode 100644 index 000000000..6c01bc3dd --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue @@ -0,0 +1,128 @@ +