From 25876993ff840534995cf0f5e367f3b0fa0d6218 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Tue, 15 Mar 2022 14:30:33 +0530 Subject: [PATCH 001/461] fix: NoMethodError: undefined method `id' for nil:NilClass (#4172) fixes: #4171 --- app/channels/room_channel.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/channels/room_channel.rb b/app/channels/room_channel.rb index b3c597770..05bff5d86 100644 --- a/app/channels/room_channel.rb +++ b/app/channels/room_channel.rb @@ -1,5 +1,8 @@ class RoomChannel < ApplicationCable::Channel def subscribed + # TODO: should we only do ensure stream if current account is present? + # for now going ahead with guard clauses in update_subscription and broadcast_presence + ensure_stream current_user current_account @@ -15,6 +18,8 @@ class RoomChannel < ApplicationCable::Channel private def broadcast_presence + return if @current_account.blank? + data = { account_id: @current_account.id, users: ::OnlineStatusTracker.get_available_users(@current_account.id) } data[:contacts] = ::OnlineStatusTracker.get_available_contacts(@current_account.id) if @current_user.is_a? User ActionCable.server.broadcast(@pubsub_token, { event: 'presence.update', data: data }) @@ -26,6 +31,8 @@ class RoomChannel < ApplicationCable::Channel end def update_subscription + return if @current_account.blank? + ::OnlineStatusTracker.update_presence(@current_account.id, @current_user.class.name, @current_user.id) end From f405572e5c9fcac4d609517730c2896945aeed07 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Tue, 15 Mar 2022 16:54:33 +0530 Subject: [PATCH 002/461] Revert "feat: Custom fields in pre-chat form (#4135)" (#4182) This reverts commit e730804b4888fa0fc21fb1681f4e2a53d752e645. --- .../api/v1/accounts/inboxes_controller.rb | 1 + .../api/v1/widget/base_controller.rb | 6 +- .../api/v1/widget/conversations_controller.rb | 3 +- .../components/buttons/ToggleButton.vue | 65 -------- .../dashboard/i18n/locale/en/inboxMgmt.json | 10 +- .../dashboard/settings/automation/Index.vue | 54 ++++++- .../settings/inbox/PreChatForm/Settings.vue | 115 ++++--------- .../FluentIcon/dashboard-icons.json | 3 +- app/javascript/widget/api/endPoints.js | 1 - .../widget/components/PreChat/Form.vue | 152 +++++------------- app/javascript/widget/i18n/locale/en.json | 11 +- app/javascript/widget/mixins/configMixin.js | 3 - app/javascript/widget/views/PreChatForm.vue | 10 +- app/models/channel/web_widget.rb | 3 +- ...3742_add_custom_fields_to_pre_chat_form.rb | 28 ---- db/schema.rb | 2 +- 16 files changed, 138 insertions(+), 329 deletions(-) delete mode 100644 app/javascript/dashboard/components/buttons/ToggleButton.vue delete mode 100644 db/migrate/20220309103742_add_custom_fields_to_pre_chat_form.rb diff --git a/app/controllers/api/v1/accounts/inboxes_controller.rb b/app/controllers/api/v1/accounts/inboxes_controller.rb index d60e4c3e8..2bda5c07a 100644 --- a/app/controllers/api/v1/accounts/inboxes_controller.rb +++ b/app/controllers/api/v1/accounts/inboxes_controller.rb @@ -49,6 +49,7 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController return if permitted_params(channel_attributes)[:channel].blank? validate_email_channel(channel_attributes) if @inbox.inbox_type == 'Email' + @inbox.channel.update!(permitted_params(channel_attributes)[:channel]) update_channel_feature_flags end diff --git a/app/controllers/api/v1/widget/base_controller.rb b/app/controllers/api/v1/widget/base_controller.rb index ad555fc22..38c880526 100644 --- a/app/controllers/api/v1/widget/base_controller.rb +++ b/app/controllers/api/v1/widget/base_controller.rb @@ -68,7 +68,7 @@ class Api::V1::Widget::BaseController < ApplicationController mergee_contact: @contact ).perform else - @contact.update!(email: email, name: contact_name, phone_number: contact_phone_number) + @contact.update!(email: email, name: contact_name) end end @@ -80,10 +80,6 @@ class Api::V1::Widget::BaseController < ApplicationController params[:contact][:name] || contact_email.split('@')[0] end - def contact_phone_number - params[:contact][:phone_number] - end - def browser_params { browser_name: browser.name, diff --git a/app/controllers/api/v1/widget/conversations_controller.rb b/app/controllers/api/v1/widget/conversations_controller.rb index 8cfb65be6..8d28345d4 100644 --- a/app/controllers/api/v1/widget/conversations_controller.rb +++ b/app/controllers/api/v1/widget/conversations_controller.rb @@ -51,7 +51,6 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController end def permitted_params - params.permit(:id, :typing_status, :website_token, :email, contact: [:name, :email, :phone_number], - message: [:content, :referer_url, :timestamp, :echo_id]) + params.permit(:id, :typing_status, :website_token, :email, contact: [:name, :email], message: [:content, :referer_url, :timestamp, :echo_id]) end end diff --git a/app/javascript/dashboard/components/buttons/ToggleButton.vue b/app/javascript/dashboard/components/buttons/ToggleButton.vue deleted file mode 100644 index 37328aba5..000000000 --- a/app/javascript/dashboard/components/buttons/ToggleButton.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - - diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index 6111b90fd..538d6d5f0 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -187,7 +187,7 @@ } } }, - "WHATSAPP": { + "WHATSAPP": { "TITLE": "WhatsApp Channel", "DESC": "Start supporting your customers via WhatsApp.", "PROVIDERS": { @@ -211,6 +211,7 @@ "PLACEHOLDER": "API key", "APPLY_FOR_ACCESS": "Don't have any API key? Apply for access here", "ERROR": "Please enter a valid value." + }, "SUBMIT_BUTTON": "Create WhatsApp Channel", "API": { @@ -431,11 +432,6 @@ }, "PRE_CHAT_FORM": { "DESCRIPTION": "Pre chat forms enable you to capture user information before they start conversation with you.", - "SET_FIELDS": "Pre chat form fields", - "SET_FIELDS_HEADER": { - "FIELDS": "Fields", - "REQUIRED": "Required" - }, "ENABLE": { "LABEL": "Enable pre chat form", "OPTIONS": { @@ -468,7 +464,7 @@ "VALIDATION_ERROR": "Starting time should be before closing time.", "CHOOSE": "Choose" }, - "ALL_DAY": "All-Day" + "ALL_DAY":"All-Day" }, "IMAP": { "TITLE": "IMAP", diff --git a/app/javascript/dashboard/routes/dashboard/settings/automation/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/automation/Index.vue index b3a4ce9d7..811fc95c6 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/automation/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/automation/Index.vue @@ -34,10 +34,19 @@ {{ automation.name }} {{ automation.description }} - + > + + {{ readableTime(automation.created_on) }} @@ -131,13 +140,11 @@ import AddAutomationRule from './AddAutomationRule.vue'; import EditAutomationRule from './EditAutomationRule.vue'; import alertMixin from 'shared/mixins/alertMixin'; import timeMixin from 'dashboard/mixins/time'; -import ToggleButton from 'dashboard/components/buttons/ToggleButton'; export default { components: { AddAutomationRule, EditAutomationRule, - ToggleButton, }, mixins: [alertMixin, timeMixin], data() { @@ -283,4 +290,41 @@ export default { .automation__status-checkbox { margin: 0; } +.toggle-button { + background-color: var(--s-200); + position: relative; + display: inline-flex; + height: 19px; + width: 34px; + border: 2px solid transparent; + border-radius: var(--border-radius-large); + cursor: pointer; + transition-property: background-color; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 200ms; + flex-shrink: 0; +} + +.toggle-button.active { + background-color: var(--w-500); +} + +.toggle-button span { + --space-one-point-five: 1.5rem; + height: var(--space-one-point-five); + width: var(--space-one-point-five); + display: inline-block; + background-color: var(--white); + box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px, + rgba(59, 130, 246, 0.5) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, + rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; + transform: translate(0, 0); + border-radius: 100%; + transition-property: transform; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 200ms; +} +.toggle-button span.active { + transform: translate(var(--space-one-point-five), var(--space-zero)); +} diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue index bf0c22515..6c01bc3dd 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/PreChatForm/Settings.vue @@ -15,57 +15,28 @@ -
-
+ +
+ +
+
+ +
+