2019-11-01 07:23:01 +00:00
|
|
|
class WidgetTestsController < ActionController::Base
|
2022-02-25 10:48:18 +00:00
|
|
|
before_action :ensure_web_widget
|
|
|
|
before_action :ensure_widget_position
|
|
|
|
before_action :ensure_widget_type
|
|
|
|
before_action :ensure_widget_style
|
2022-04-01 15:29:03 +00:00
|
|
|
before_action :ensure_dark_mode
|
2019-11-01 07:23:01 +00:00
|
|
|
|
|
|
|
def index
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-02-25 10:48:18 +00:00
|
|
|
def ensure_widget_style
|
|
|
|
@widget_style = params[:widget_style] || 'standard'
|
|
|
|
end
|
|
|
|
|
2022-04-01 15:29:03 +00:00
|
|
|
def ensure_dark_mode
|
|
|
|
@dark_mode = params[:dark_mode] || 'light'
|
|
|
|
end
|
|
|
|
|
2022-02-25 10:48:18 +00:00
|
|
|
def ensure_widget_position
|
|
|
|
@widget_position = params[:position] || 'left'
|
|
|
|
end
|
|
|
|
|
|
|
|
def ensure_widget_type
|
|
|
|
@widget_type = params[:type] || 'expanded_bubble'
|
|
|
|
end
|
|
|
|
|
|
|
|
def inbox_id
|
|
|
|
@inbox_id ||= params[:inbox_id] || Channel::WebWidget.first.inbox.id
|
|
|
|
end
|
|
|
|
|
|
|
|
def ensure_web_widget
|
|
|
|
@inbox = Inbox.find(inbox_id)
|
|
|
|
@web_widget = @inbox.channel
|
2019-11-01 07:23:01 +00:00
|
|
|
end
|
|
|
|
end
|