Restructure omni services and add Chatwoot research snapshot
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
json.array! @campaigns do |campaign|
|
||||
json.id campaign.display_id
|
||||
json.trigger_rules campaign.trigger_rules
|
||||
json.trigger_only_during_business_hours campaign.trigger_only_during_business_hours
|
||||
json.message campaign.message
|
||||
json.sender campaign.sender&.push_event_data
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
json.website_channel_config do
|
||||
json.allow_messages_after_resolved @web_widget.inbox.allow_messages_after_resolved
|
||||
json.api_host ENV.fetch('FRONTEND_URL', nil)
|
||||
json.auth_token @token
|
||||
json.avatar_url @web_widget.inbox.avatar_url
|
||||
json.csat_survey_enabled @web_widget.inbox.csat_survey_enabled
|
||||
json.disable_branding @web_widget.inbox.account.feature_enabled?('disable_branding')
|
||||
json.enabled_features @web_widget.selected_feature_flags
|
||||
json.enabled_languages available_locales_with_name
|
||||
json.locale @web_widget.account.locale
|
||||
json.out_of_office_message @web_widget.inbox.out_of_office_message
|
||||
json.portal @web_widget.inbox.portal
|
||||
json.pre_chat_form_enabled @web_widget.pre_chat_form_enabled
|
||||
json.pre_chat_form_options @web_widget.pre_chat_form_options
|
||||
json.reply_time @web_widget.reply_time
|
||||
json.timezone @web_widget.inbox.timezone
|
||||
json.utc_off_set ActiveSupport::TimeZone[@web_widget.inbox.timezone].now.formatted_offset
|
||||
json.website_name @web_widget.inbox.name
|
||||
json.website_token @web_widget.website_token
|
||||
json.welcome_tagline @web_widget.welcome_tagline
|
||||
json.welcome_title @web_widget.welcome_title
|
||||
json.widget_color @web_widget.widget_color
|
||||
json.working_hours @web_widget.inbox.working_hours
|
||||
json.working_hours_enabled @web_widget.inbox.working_hours_enabled
|
||||
end
|
||||
|
||||
json.contact do
|
||||
json.email @contact.email
|
||||
json.id @contact.id
|
||||
json.identifier @contact.identifier
|
||||
json.name @contact.name
|
||||
json.phone_number @contact.phone_number
|
||||
json.pubsub_token @contact_inbox.pubsub_token
|
||||
end
|
||||
|
||||
json.global_config @global_config
|
||||
@@ -0,0 +1,5 @@
|
||||
json.id @contact.id
|
||||
json.has_email @contact.email.present?
|
||||
json.has_name @contact.name.present?
|
||||
json.has_phone_number @contact.phone_number.present?
|
||||
json.widget_auth_token @widget_auth_token if @widget_auth_token.present?
|
||||
@@ -0,0 +1,5 @@
|
||||
json.id @contact.id
|
||||
json.has_email @contact.email.present?
|
||||
json.has_name @contact.name.present?
|
||||
json.has_phone_number @contact.phone_number.present?
|
||||
json.identifier @contact.identifier
|
||||
@@ -0,0 +1,4 @@
|
||||
json.id @contact.id
|
||||
json.has_email @contact.email.present?
|
||||
json.has_name @contact.name.present?
|
||||
json.has_phone_number @contact.phone_number.present?
|
||||
@@ -0,0 +1,11 @@
|
||||
json.id @conversation.display_id
|
||||
json.inbox_id @conversation.inbox_id
|
||||
json.contact_last_seen_at @conversation.contact_last_seen_at.to_i
|
||||
json.status @conversation.status
|
||||
json.messages do
|
||||
json.array! @conversation.messages do |message|
|
||||
json.partial! 'api/v1/models/widget_message', resource: message
|
||||
end
|
||||
end
|
||||
json.custom_attributes @conversation.custom_attributes
|
||||
json.contact @conversation.contact
|
||||
@@ -0,0 +1,6 @@
|
||||
if @conversation
|
||||
json.id @conversation.display_id
|
||||
json.inbox_id @conversation.inbox_id
|
||||
json.contact_last_seen_at @conversation.contact_last_seen_at.to_i
|
||||
json.status @conversation.status
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
json.payload do
|
||||
json.array! @inbox_members do |inbox_member|
|
||||
next if inbox_member.user.blank?
|
||||
|
||||
json.id inbox_member.user.id
|
||||
json.name inbox_member.user.available_name
|
||||
json.avatar_url inbox_member.user.avatar_url
|
||||
json.availability_status inbox_member.user.account_users.find_by(account_id: @current_account.id)&.availability_status
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
json.id @message.id
|
||||
json.content @message.content
|
||||
json.inbox_id @message.inbox_id
|
||||
json.conversation_id @message.conversation.display_id
|
||||
json.message_type @message.message_type_before_type_cast
|
||||
json.created_at @message.created_at.to_i
|
||||
json.private @message.private
|
||||
json.source_id @message.source_id
|
||||
json.content_attributes @message.content_attributes
|
||||
json.attachments @message.attachments.map(&:push_event_data) if @message.attachments.present?
|
||||
json.sender @message.sender.push_event_data if @message.sender
|
||||
@@ -0,0 +1,16 @@
|
||||
json.payload do
|
||||
json.array! @messages do |message|
|
||||
json.id message.id
|
||||
json.content message.content
|
||||
json.message_type message.message_type_before_type_cast
|
||||
json.content_type message.content_type
|
||||
json.content_attributes message.content_attributes
|
||||
json.created_at message.created_at.to_i
|
||||
json.conversation_id message.conversation.display_id
|
||||
json.attachments message.attachments.map(&:push_event_data) if message.attachments.present?
|
||||
json.sender message.sender.push_event_data if message.sender
|
||||
end
|
||||
end
|
||||
json.meta do
|
||||
json.contact_last_seen_at @conversation.contact_last_seen_at.to_i if @conversation.present?
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
json.contact @contact if @contact
|
||||
Reference in New Issue
Block a user