avo 2.6.1.pre.2 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -3
  3. data/app/assets/svgs/heroicons/solid/user-remove.svg +1 -1
  4. data/app/components/avo/fields/has_one_field/show_component.html.erb +2 -2
  5. data/app/components/avo/fields/tags_field/index_component.html.erb +1 -1
  6. data/app/components/avo/index/resource_controls_component.rb +2 -1
  7. data/app/components/avo/resource_component.rb +7 -0
  8. data/app/components/avo/views/resource_edit_component.html.erb +5 -0
  9. data/app/components/avo/views/resource_edit_component.rb +9 -3
  10. data/app/components/avo/views/resource_show_component.html.erb +7 -2
  11. data/app/components/avo/views/resource_show_component.rb +5 -2
  12. data/app/views/avo/partials/_custom_tools_alert.html.erb +16 -5
  13. data/app/views/layouts/avo/application.html.erb +1 -1
  14. data/lib/avo/app.rb +2 -0
  15. data/lib/avo/base_resource.rb +1 -0
  16. data/lib/avo/base_resource_tool.rb +34 -0
  17. data/lib/avo/concerns/has_tools.rb +47 -0
  18. data/lib/avo/engine.rb +2 -1
  19. data/lib/avo/licensing/pro_license.rb +1 -0
  20. data/lib/avo/version.rb +1 -1
  21. data/lib/generators/avo/install_generator.rb +3 -0
  22. data/lib/generators/avo/resource_tool_generator.rb +40 -0
  23. data/lib/generators/avo/templates/resource_tools/partial.tt +37 -0
  24. data/lib/generators/avo/templates/resource_tools/resource_tool.tt +4 -0
  25. metadata +9 -9
  26. data/app/assets/builds/action_cable.js +0 -2
  27. data/app/assets/builds/action_cable.js.map +0 -7
  28. data/app/assets/builds/avo.css +0 -9610
  29. data/app/assets/builds/avo.js +0 -512
  30. data/app/assets/builds/avo.js.map +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6092c1d2a6387c2db15064a1a84f63f350ed5114ef0ef53e0ff91a2be89ceae2
4
- data.tar.gz: 2beb06098bfc84847f3f014a4ae1bdf12c11e20651f4e7a870081798b2bcfa01
3
+ metadata.gz: c49705a72c31381fe9a133a58b1953d56513fda407157b4c92a17f933424b3e5
4
+ data.tar.gz: 6680ac6be68f89e9ecdbce81f3ee2ecd18915369509c27914835f824f8da550e
5
5
  SHA512:
6
- metadata.gz: d7cef4581454971f0997f55a5e3e7f895fa72d6d75e0c7f367d1e2a6069a338732d0c0b528fccd4acadb35dbf62c7e9c29934f5e7ce2844b88c9ca4e4ad080d1
7
- data.tar.gz: 76a3d85bf4b95cae53cb54e2d43b3ad0c62bbf8723f3471c041803747e4d14b3fdad4d97b0092cfc1147e06d89ea44ebc4f114daf8a819033ff278c58e1c084d
6
+ metadata.gz: b34915f9540a2e057df9cde8c228077eec22bafee204cb076399a1eb2b3ee36834aff7fb50b9fb57060c3271cb31387d7fcbd27642fca8222a245db04cc70182
7
+ data.tar.gz: 0a3ce0cad78f3fd6b3cde3534d879e9729569e3e3ac8ea595fd4266c77b6025227bad0154a2f69263c1e8858337906c788d63f635976e2678a94f95d5419d72b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.6.1.pre.2)
4
+ avo (2.7.0)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -251,8 +251,6 @@ GEM
251
251
  nokogiri (1.13.4)
252
252
  mini_portile2 (~> 2.8.0)
253
253
  racc (~> 1.4)
254
- nokogiri (1.13.4-x86_64-linux)
255
- racc (~> 1.4)
256
254
  orm_adapter (0.5.0)
257
255
  pagy (5.10.1)
258
256
  activesupport
@@ -1,3 +1,3 @@
1
- or<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
2
2
  <path d="M11 6a3 3 0 11-6 0 3 3 0 016 0zM14 17a6 6 0 00-12 0h12zM13 8a1 1 0 100 2h4a1 1 0 100-2h-4z"/>
3
3
  </svg>
@@ -3,11 +3,11 @@
3
3
  <%= render(Avo::LoadingComponent.new(title: @field.name)) %>
4
4
  </turbo-frame>
5
5
  <% else %>
6
- <%= render Avo::PanelComponent.new(title: @field.id.capitalize) do |c| %>
6
+ <%= render Avo::PanelComponent.new(title: @field.name) do |c| %>
7
7
  <% c.tools do %>
8
8
  <% if !@field.readonly && can_attach? %>
9
9
  <%= a_link attach_path, icon: 'heroicons/outline/link', color: :primary, 'data-turbo-frame': 'attach_modal' do %>
10
- <%= t('avo.attach_item', item: @field.id).capitalize %>
10
+ <%= t('avo.attach_item', item: @field.name) %>
11
11
  <% end %>
12
12
  <% end %>
13
13
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= index_field_wrapper field: @field do %>
1
+ <%= index_field_wrapper field: @field, flush: true do %>
2
2
  <div class="flex gap-1 items-center flex-nowrap">
3
3
  <% value.take(3).each do |item| %>
4
4
  <%= render Avo::Fields::TagsField::TagComponent.new(label: label_from_item(item)) %>
@@ -41,7 +41,8 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
41
41
  end
42
42
 
43
43
  def edit_path
44
- args = {}
44
+ #Add the `view` param to let Avo know where to redirect back when the user clicks the `Cancel` button.
45
+ args = {via_view: 'index'}
45
46
 
46
47
  if @parent_model.present?
47
48
  args = {
@@ -1,4 +1,10 @@
1
1
  class Avo::ResourceComponent < Avo::BaseComponent
2
+ attr_reader :fields_by_panel
3
+ attr_reader :has_one_panels
4
+ attr_reader :has_many_panels
5
+ attr_reader :has_as_belongs_to_many_panels
6
+ attr_reader :resource_tools
7
+
2
8
  def can_create?
3
9
  return authorize_association_for(:create) if @reflection.present?
4
10
 
@@ -75,6 +81,7 @@ class Avo::ResourceComponent < Avo::BaseComponent
75
81
  @has_one_panels = []
76
82
  @has_many_panels = []
77
83
  @has_as_belongs_to_many_panels = []
84
+ @resource_tools = @resource.tools
78
85
  end
79
86
 
80
87
  def via_resource?
@@ -64,5 +64,10 @@
64
64
  <%= render field.component_for_view(:show).new(field: field, resource: @resource, index: index) %>
65
65
  <% end %>
66
66
  <% end %>
67
+ <% if resource_tools.present? %>
68
+ <% resource_tools.each do |tool, index| %>
69
+ <%= render tool.partial, tool: tool %>
70
+ <% end %>
71
+ <% end %>
67
72
  <% end %>
68
73
  </div>
@@ -4,8 +4,6 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
4
4
  include Avo::ResourcesHelper
5
5
  include Avo::ApplicationHelper
6
6
 
7
- attr_reader :fields_by_panel, :has_one_panels, :has_many_panels, :has_as_belongs_to_many_panels
8
-
9
7
  def initialize(resource: nil)
10
8
  @resource = resource
11
9
 
@@ -15,7 +13,9 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
15
13
  def back_path
16
14
  if via_resource?
17
15
  helpers.resource_path(model: params[:via_resource_class].safe_constantize, resource: relation_resource, resource_id: params[:via_resource_id])
18
- else
16
+ elsif via_index?
17
+ helpers.resources_path(resource: @resource)
18
+ else # via resource show page
19
19
  helpers.resource_path(model: @resource.model, resource: @resource)
20
20
  end
21
21
  end
@@ -25,4 +25,10 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
25
25
  def can_see_the_save_button?
26
26
  @resource.authorization.authorize_action :edit, raise_exception: false
27
27
  end
28
+
29
+ private
30
+
31
+ def via_index?
32
+ params[:via_view] == 'index'
33
+ end
28
34
  end
@@ -15,9 +15,9 @@
15
15
  form_class: 'flex flex-col sm:flex-row sm:inline-flex',
16
16
  style: :text,
17
17
  data: {
18
- confirm: "Are you sure you want to detach this #{@reflection.name.to_s}."
18
+ confirm: "Are you sure you want to detach this #{title}."
19
19
  } do %>
20
- <%= t('avo.detach_item', item: @reflection.name.to_s).capitalize %>
20
+ <%= t('avo.detach_item', item: title).capitalize %>
21
21
  <% end %>
22
22
  <%= render Avo::ActionsComponent.new actions: @actions, resource: @resource %>
23
23
  <% end %>
@@ -93,6 +93,11 @@
93
93
  <%= render field.component_for_view(:show).new(field: field, resource: @resource, index: index) %>
94
94
  <% end %>
95
95
  <% end %>
96
+ <% if resource_tools.present? %>
97
+ <% resource_tools.each do |tool, index| %>
98
+ <%= render tool.partial, tool: tool %>
99
+ <% end %>
100
+ <% end %>
96
101
  <% end %>
97
102
 
98
103
  <% if should_display_invalid_fields_errors? %>
@@ -4,8 +4,6 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
4
4
  include Avo::ResourcesHelper
5
5
  include Avo::ApplicationHelper
6
6
 
7
- attr_reader :fields_by_panel, :has_one_panels, :has_many_panels, :has_as_belongs_to_many_panels
8
-
9
7
  def initialize(resource: nil, reflection: nil, parent_model: nil, resource_panel: nil, actions: [])
10
8
  @resource = resource
11
9
  @reflection = reflection
@@ -17,6 +15,7 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
17
15
 
18
16
  def title
19
17
  if @reflection.present?
18
+ return field.name if has_one_field?
20
19
  reflection_resource.name
21
20
  else
22
21
  @resource.panels.first[:name]
@@ -50,4 +49,8 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
50
49
  def should_display_invalid_fields_errors?
51
50
  (Rails.env.development? || Rails.env.test?) && @resource.invalid_fields.present?
52
51
  end
52
+
53
+ def has_one_field?
54
+ field.present? and field.class == Avo::Fields::HasOneField
55
+ end
53
56
  end
@@ -1,6 +1,17 @@
1
- <div class="w-full inset-auto bottom-0 z-50 mb-4 opacity-75 hover:opacity-100 transition-opacity duration-150">
2
- <a href="https://avohq.io/pricing" target="_blank" class="rounded bg-orange-700 text-white py-2 px-4 text-sm block items-center flex leading-tight">
3
- <%= svg "exclamation", class: "h-6 inline mr-2 text-bold flex-shrink-0 mr-1" %> Warning. <%= @custom_tools_alert_visible %> This page will not be visible in a production environment.
4
- </a>
5
- </div>
1
+ <% if @custom_tools_alert_visible %>
2
+ <div class="w-full inset-auto bottom-0 z-50 mb-4 opacity-75 hover:opacity-100 transition-opacity duration-150">
3
+ <a href="https://avohq.io/pricing" target="_blank" class="rounded bg-orange-700 text-white py-2 px-4 text-sm block items-center flex leading-tight">
4
+ <%= svg "exclamation", class: "h-6 inline mr-2 text-bold flex-shrink-0 mr-1" %> Warning. <%= @custom_tools_alert_visible %> This page will not be visible in a production environment.
5
+ </a>
6
+ </div>
7
+ <% end %>
6
8
 
9
+ <% if Avo::App.error_messages.present? %>
10
+ <% Avo::App.error_messages.each do |message| %>
11
+ <div class="w-full inset-auto bottom-0 z-50 mb-4 opacity-75 hover:opacity-100 transition-opacity duration-150">
12
+ <a href="https://avohq.io/pricing" target="_blank" class="rounded bg-orange-700 text-white py-2 px-4 text-sm block items-center flex leading-tight">
13
+ <%= svg "exclamation", class: "h-6 inline mr-2 text-bold flex-shrink-0 mr-1" %> <%= message %>
14
+ </a>
15
+ </div>
16
+ <% end %>
17
+ <% end %>
@@ -26,7 +26,7 @@
26
26
  <%= render Avo::SidebarComponent.new %>
27
27
  <div class="lg:pl-64 flex-1 flex flex-col min-h-full max-w-full">
28
28
  <div class="content p-4 lg:p-6 flex-1 flex flex-col justify-between items-stretch <%= @container_classes %>">
29
- <%= render partial: "avo/partials/custom_tools_alert" if @custom_tools_alert_visible %>
29
+ <%= render partial: "avo/partials/custom_tools_alert" %>
30
30
  <div class="flex flex-1 flex-col justify-between items-stretch space-y-8">
31
31
  <%= yield %>
32
32
  <%= render partial: "avo/partials/footer" %>
data/lib/avo/app.rb CHANGED
@@ -14,6 +14,7 @@ module Avo
14
14
  class_attribute :view_context, default: nil
15
15
  class_attribute :params, default: {}
16
16
  class_attribute :translation_enabled, default: false
17
+ class_attribute :error_messages, default: []
17
18
 
18
19
  class << self
19
20
  def boot
@@ -29,6 +30,7 @@ module Avo
29
30
  end
30
31
 
31
32
  def init(request:, context:, current_user:, root_path:, view_context:, params:)
33
+ self.error_messages = []
32
34
  self.request = request
33
35
  self.context = context
34
36
  self.current_user = current_user
@@ -5,6 +5,7 @@ module Avo
5
5
  extend HasContext
6
6
 
7
7
  include ActionView::Helpers::UrlHelper
8
+ include Avo::Concerns::HasTools
8
9
 
9
10
  delegate :view_context, to: "Avo::App"
10
11
  delegate :main_app, to: :view_context
@@ -0,0 +1,34 @@
1
+ module Avo
2
+ class BaseResourceTool
3
+ include Avo::Fields::FieldExtensions::VisibleInDifferentViews
4
+
5
+ class_attribute :name
6
+ class_attribute :partial
7
+
8
+ attr_accessor :params
9
+ attr_accessor :resource
10
+ attr_accessor :view
11
+
12
+ def initialize(**args)
13
+ # Set the visibility
14
+ show_on :show
15
+
16
+ show_on args[:show_on] if args[:show_on].present?
17
+ hide_on args[:hide_on] if args[:hide_on].present?
18
+ only_on args[:only_on] if args[:only_on].present?
19
+ except_on args[:except_on] if args[:except_on].present?
20
+ end
21
+
22
+ def hydrate(view: nil)
23
+ @view = view
24
+
25
+ self
26
+ end
27
+
28
+ def partial
29
+ return self.class.partial if self.class.partial.present?
30
+
31
+ "avo/resource_tools/#{self.class.to_s.underscore}"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,47 @@
1
+ module Avo
2
+ module Concerns
3
+ module HasTools
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ class_attribute :tools_holder
8
+
9
+ def tools
10
+ check_license
11
+
12
+ return [] if App.license.lacks_with_trial :resource_tools
13
+ return [] if self.class.tools.blank?
14
+
15
+ self.class.tools
16
+ .map do |tool|
17
+ tool.hydrate view: view
18
+ end
19
+ .select do |field|
20
+ field.send("show_on_#{view}")
21
+ end
22
+ end
23
+ end
24
+
25
+ class_methods do
26
+ def tool(klass, **args)
27
+ self.tools_holder ||= []
28
+
29
+ self.tools_holder << klass.new(**args)
30
+ end
31
+
32
+ def tools
33
+ self.tools_holder
34
+ end
35
+ end
36
+
37
+ private
38
+
39
+ def check_license
40
+ if !Rails.env.production? && App.license.lacks(:resource_tools)
41
+ # Add error message to let the developer know the resource tool will not be available in a production environment.
42
+ Avo::App.error_messages.push "Warning: Your license is invalid or doesn't support resource tools. The resource tools will not be visible in a production environment."
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
data/lib/avo/engine.rb CHANGED
@@ -26,7 +26,8 @@ module Avo
26
26
  ["app", "avo", "actions"],
27
27
  ["app", "avo", "resources"],
28
28
  ["app", "avo", "dashboards"],
29
- ["app", "avo", "cards"]
29
+ ["app", "avo", "cards"],
30
+ ["app", "avo", "resource_tools"]
30
31
  ].each do |path_params|
31
32
  path = Rails.root.join(*path_params)
32
33
 
@@ -7,6 +7,7 @@ module Avo
7
7
  :localization,
8
8
  :custom_tools,
9
9
  :custom_fields,
10
+ :resource_tools,
10
11
  :global_search,
11
12
  :enhanced_search_results,
12
13
  :searchable_associations,
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.6.1.pre.2" unless const_defined?(:VERSION)
2
+ VERSION = "2.7.0" unless const_defined?(:VERSION)
3
3
  end
@@ -14,6 +14,9 @@ module Generators
14
14
 
15
15
  template "initializer/avo.tt", "config/initializers/avo.rb"
16
16
  template "locales/avo.en.yml", "config/locales/avo.en.yml"
17
+ template "locales/avo.nb-NO.yml", "config/locales/avo.nb-NO.yml"
18
+ template "locales/avo.pt-BR.yml", "config/locales/avo.pt-BR.yml"
19
+ template "locales/avo.ro.yml", "config/locales/avo.ro.yml"
17
20
  end
18
21
  end
19
22
  end
@@ -0,0 +1,40 @@
1
+ require "rails/generators"
2
+ require "fileutils"
3
+
4
+ module Generators
5
+ module Avo
6
+ class ResourceToolGenerator < ::Rails::Generators::NamedBase
7
+ argument :name, type: :string, required: true
8
+
9
+ source_root File.expand_path("templates", __dir__)
10
+
11
+ namespace "avo:resource_tool"
12
+
13
+ def handle
14
+ # Add configuration file
15
+ template "resource_tools/resource_tool.tt", "app/avo/resource_tools/#{file_name}.rb"
16
+
17
+ # Add view file
18
+ template "resource_tools/partial.tt", "app/views/avo/resource_tools/_#{file_name}.html.erb"
19
+ end
20
+
21
+ no_tasks do
22
+ def file_name
23
+ name.to_s.underscore
24
+ end
25
+
26
+ def controller_name
27
+ file_name.to_s
28
+ end
29
+
30
+ def human_name
31
+ file_name.humanize
32
+ end
33
+
34
+ def in_code(text)
35
+ "<code class='p-1 rounded bg-gray-500 text-white text-sm'>#{text}</code>"
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,37 @@
1
+ <div class="flex flex-col">
2
+ <%%= render Avo::PanelComponent.new title: "<%= human_name %>" do |c| %>
3
+ <%% c.tools do %>
4
+ <%%= a_link('/avo', icon: 'heroicons/solid/academic-cap', style: :primary) do %>
5
+ Dummy link
6
+ <%% end %>
7
+ <%% end %>
8
+
9
+ <%% c.body do %>
10
+ <div class="flex flex-col p-4 min-h-24">
11
+ <div class="space-y-4">
12
+ <h3>🪧 This partial is waiting to be updated</h3>
13
+
14
+ <p>
15
+ You can edit this file here <%= in_code "app/views/avo/resource_tools/#{file_name}.html.erb" %>.
16
+ </p>
17
+
18
+ <p>
19
+ The resource tool configuration file should be here <%= in_code "app/avo/resource_tools/#{file_name}.rb" %>.
20
+ </p>
21
+
22
+ <%%
23
+ # In this partial you have access to the following variables:
24
+ # tool
25
+ # @resource
26
+ # @resource.model
27
+ # params
28
+ # Avo::App.context
29
+ # current_user
30
+ %>
31
+ </div>
32
+ </div>
33
+ <%% end %>
34
+ <%% end %>
35
+ </div>
36
+
37
+
@@ -0,0 +1,4 @@
1
+ class <%= class_name %> < Avo::BaseResourceTool
2
+ self.name = "<%= human_name %>"
3
+ # self.partial = "avo/resource_tools/<%= file_name %>"
4
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1.pre.2
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-05-17 00:00:00.000000000 Z
12
+ date: 2022-05-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -248,11 +248,6 @@ files:
248
248
  - Gemfile.lock
249
249
  - README.md
250
250
  - Rakefile
251
- - app/assets/builds/action_cable.js
252
- - app/assets/builds/action_cable.js.map
253
- - app/assets/builds/avo.css
254
- - app/assets/builds/avo.js
255
- - app/assets/builds/avo.js.map
256
251
  - app/assets/config/avo_manifest.js
257
252
  - app/assets/stylesheets/avo.css
258
253
  - app/assets/stylesheets/css/active-storage.css
@@ -1164,8 +1159,10 @@ files:
1164
1159
  - lib/avo/base_action.rb
1165
1160
  - lib/avo/base_card.rb
1166
1161
  - lib/avo/base_resource.rb
1162
+ - lib/avo/base_resource_tool.rb
1167
1163
  - lib/avo/concerns/fetches_things.rb
1168
1164
  - lib/avo/concerns/handles_field_args.rb
1165
+ - lib/avo/concerns/has_tools.rb
1169
1166
  - lib/avo/configuration.rb
1170
1167
  - lib/avo/dashboards/base_dashboard.rb
1171
1168
  - lib/avo/dashboards/base_divider.rb
@@ -1261,6 +1258,7 @@ files:
1261
1258
  - lib/generators/avo/metric_card_generator.rb
1262
1259
  - lib/generators/avo/partial_card_generator.rb
1263
1260
  - lib/generators/avo/resource_generator.rb
1261
+ - lib/generators/avo/resource_tool_generator.rb
1264
1262
  - lib/generators/avo/templates/action.tt
1265
1263
  - lib/generators/avo/templates/cards/chartkick_card.tt
1266
1264
  - lib/generators/avo/templates/cards/chartkick_card_sample.tt
@@ -1288,6 +1286,8 @@ files:
1288
1286
  - lib/generators/avo/templates/locales/avo.ro.yml
1289
1287
  - lib/generators/avo/templates/resource/controller.tt
1290
1288
  - lib/generators/avo/templates/resource/resource.tt
1289
+ - lib/generators/avo/templates/resource_tools/partial.tt
1290
+ - lib/generators/avo/templates/resource_tools/resource_tool.tt
1291
1291
  - lib/generators/avo/templates/standalone_action.tt
1292
1292
  - lib/generators/avo/templates/tool/controller.tt
1293
1293
  - lib/generators/avo/templates/tool/sidebar_item.tt
@@ -1339,9 +1339,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1339
1339
  version: 2.4.0
1340
1340
  required_rubygems_version: !ruby/object:Gem::Requirement
1341
1341
  requirements:
1342
- - - ">"
1342
+ - - ">="
1343
1343
  - !ruby/object:Gem::Version
1344
- version: 1.3.1
1344
+ version: '0'
1345
1345
  requirements: []
1346
1346
  rubygems_version: 3.3.3
1347
1347
  signing_key:
@@ -1,2 +0,0 @@
1
- (()=>{var a={logger:self.console,WebSocket:self.WebSocket},i={log(...n){this.enabled&&(n.push(Date.now()),a.logger.log("[ActionCable]",...n))}},l=()=>new Date().getTime(),h=n=>(l()-n)/1e3,d=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=l(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),i.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=l(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),i.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=l()}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,i.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=l(),i.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,s=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),r=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*s*(1+r)}reconnectIfStale(){this.connectionIsStale()&&(i.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${h(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?i.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${h(this.disconnectedAt)} s`):(i.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return h(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&h(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(i.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};d.staleThreshold=6;d.reconnectionBackoffRate=.15;var m={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},{message_types:c,protocols:u}=m,w=u.slice(0,u.length-1),f=[].indexOf,p=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new d(this),this.disconnected=!0}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){return this.isActive()?(i.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1):(i.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${u}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new a.WebSocket(this.consumer.url,u),this.installEventHandlers(),this.monitor.start(),!0)}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isActive())return this.webSocket.close()}reopen(){if(i.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){i.log("Failed to reopen WebSocket",t)}finally{i.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}isProtocolSupported(){return f.call(w,this.getProtocol())>=0}isState(...t){return f.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in a.WebSocket)if(a.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}};p.reopenDelay=500;p.prototype.events={message(n){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:s,reconnect:o,type:r}=JSON.parse(n.data);switch(r){case c.welcome:return this.monitor.recordConnect(),this.subscriptions.reload();case c.disconnect:return i.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:o});case c.ping:return this.monitor.recordPing();case c.confirmation:return this.subscriptions.confirmSubscription(t),this.subscriptions.notify(t,"connected");case c.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(i.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return i.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(n){if(i.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){i.log("WebSocket onerror event")}};var k=function(n,t){if(t!=null)for(let e in t){let s=t[e];n[e]=s}return n},b=class{constructor(t,e={},s){this.consumer=t,this.identifier=JSON.stringify(e),k(this,s)}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}},S=class{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(i.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):i.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){i.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==t)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(t=>{i.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)})},500)}},v=class{constructor(t){this.consumer=t,this.guarantor=new S(this),this.subscriptions=[]}create(t,e){let s=t,o=typeof s=="object"?s:{channel:s},r=new b(this.consumer,o,e);return this.add(r)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(e=>(this.forget(e),this.notify(e,"rejected"),e))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(s=>this.notify(s,t,...e))}notify(t,e,...s){let o;return typeof t=="string"?o=this.findAll(t):o=[t],o.map(r=>typeof r[e]=="function"?r[e](...s):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){i.log(`Subscription confirmed ${t}`),this.findAll(t).map(e=>this.guarantor.forget(e))}sendCommand(t,e){let{identifier:s}=t;return this.consumer.send({command:e,identifier:s})}},y=class{constructor(t){this._url=t,this.subscriptions=new v(this),this.connection=new p(this)}get url(){return C(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}};function C(n){if(typeof n=="function"&&(n=n()),n&&!/^wss?:/i.test(n)){let t=document.createElement("a");return t.href=n,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return n}function A(n=$("url")||m.default_mount_path){return new y(n)}function $(n){let t=document.head.querySelector(`meta[name='action-cable-${n}']`);if(t)return t.getAttribute("content")}var g;window.Avo.configuration.action_cable.enabled&&(g=A(),window.Avo.consumer=g);var P=g;})();
2
- //# sourceMappingURL=action_cable.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../node_modules/@rails/actioncable/app/assets/javascripts/actioncable.esm.js", "../../javascript/action_cable.js"],
4
- "sourcesContent": ["var adapters = {\n logger: self.console,\n WebSocket: self.WebSocket\n};\n\nvar logger = {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now());\n adapters.logger.log(\"[ActionCable]\", ...messages);\n }\n }\n};\n\nconst now = () => (new Date).getTime();\n\nconst secondsSince = time => (now() - time) / 1e3;\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this);\n this.connection = connection;\n this.reconnectAttempts = 0;\n }\n start() {\n if (!this.isRunning()) {\n this.startedAt = now();\n delete this.stoppedAt;\n this.startPolling();\n addEventListener(\"visibilitychange\", this.visibilityDidChange);\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`);\n }\n }\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now();\n this.stopPolling();\n removeEventListener(\"visibilitychange\", this.visibilityDidChange);\n logger.log(\"ConnectionMonitor stopped\");\n }\n }\n isRunning() {\n return this.startedAt && !this.stoppedAt;\n }\n recordPing() {\n this.pingedAt = now();\n }\n recordConnect() {\n this.reconnectAttempts = 0;\n this.recordPing();\n delete this.disconnectedAt;\n logger.log(\"ConnectionMonitor recorded connect\");\n }\n recordDisconnect() {\n this.disconnectedAt = now();\n logger.log(\"ConnectionMonitor recorded disconnect\");\n }\n startPolling() {\n this.stopPolling();\n this.poll();\n }\n stopPolling() {\n clearTimeout(this.pollTimeout);\n }\n poll() {\n this.pollTimeout = setTimeout((() => {\n this.reconnectIfStale();\n this.poll();\n }), this.getPollInterval());\n }\n getPollInterval() {\n const {staleThreshold: staleThreshold, reconnectionBackoffRate: reconnectionBackoffRate} = this.constructor;\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10));\n const jitterMax = this.reconnectAttempts === 0 ? 1 : reconnectionBackoffRate;\n const jitter = jitterMax * Math.random();\n return staleThreshold * 1e3 * backoff * (1 + jitter);\n }\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`);\n this.reconnectAttempts++;\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`);\n } else {\n logger.log(\"ConnectionMonitor reopening\");\n this.connection.reopen();\n }\n }\n }\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt;\n }\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold;\n }\n disconnectedRecently() {\n return this.disconnectedAt && secondsSince(this.disconnectedAt) < this.constructor.staleThreshold;\n }\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout((() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`);\n this.connection.reopen();\n }\n }), 200);\n }\n }\n}\n\nConnectionMonitor.staleThreshold = 6;\n\nConnectionMonitor.reconnectionBackoffRate = .15;\n\nvar INTERNAL = {\n message_types: {\n welcome: \"welcome\",\n disconnect: \"disconnect\",\n ping: \"ping\",\n confirmation: \"confirm_subscription\",\n rejection: \"reject_subscription\"\n },\n disconnect_reasons: {\n unauthorized: \"unauthorized\",\n invalid_request: \"invalid_request\",\n server_restart: \"server_restart\"\n },\n default_mount_path: \"/cable\",\n protocols: [ \"actioncable-v1-json\", \"actioncable-unsupported\" ]\n};\n\nconst {message_types: message_types, protocols: protocols} = INTERNAL;\n\nconst supportedProtocols = protocols.slice(0, protocols.length - 1);\n\nconst indexOf = [].indexOf;\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this);\n this.consumer = consumer;\n this.subscriptions = this.consumer.subscriptions;\n this.monitor = new ConnectionMonitor(this);\n this.disconnected = true;\n }\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data));\n return true;\n } else {\n return false;\n }\n }\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`);\n return false;\n } else {\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${protocols}`);\n if (this.webSocket) {\n this.uninstallEventHandlers();\n }\n this.webSocket = new adapters.WebSocket(this.consumer.url, protocols);\n this.installEventHandlers();\n this.monitor.start();\n return true;\n }\n }\n close({allowReconnect: allowReconnect} = {\n allowReconnect: true\n }) {\n if (!allowReconnect) {\n this.monitor.stop();\n }\n if (this.isActive()) {\n return this.webSocket.close();\n }\n }\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`);\n if (this.isActive()) {\n try {\n return this.close();\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error);\n } finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`);\n setTimeout(this.open, this.constructor.reopenDelay);\n }\n } else {\n return this.open();\n }\n }\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol;\n }\n }\n isOpen() {\n return this.isState(\"open\");\n }\n isActive() {\n return this.isState(\"open\", \"connecting\");\n }\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0;\n }\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0;\n }\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase();\n }\n }\n }\n return null;\n }\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this);\n this.webSocket[`on${eventName}`] = handler;\n }\n }\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {};\n }\n }\n}\n\nConnection.reopenDelay = 500;\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) {\n return;\n }\n const {identifier: identifier, message: message, reason: reason, reconnect: reconnect, type: type} = JSON.parse(event.data);\n switch (type) {\n case message_types.welcome:\n this.monitor.recordConnect();\n return this.subscriptions.reload();\n\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`);\n return this.close({\n allowReconnect: reconnect\n });\n\n case message_types.ping:\n return this.monitor.recordPing();\n\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier);\n return this.subscriptions.notify(identifier, \"connected\");\n\n case message_types.rejection:\n return this.subscriptions.reject(identifier);\n\n default:\n return this.subscriptions.notify(identifier, \"received\", message);\n }\n },\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`);\n this.disconnected = false;\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\");\n return this.close({\n allowReconnect: false\n });\n }\n },\n close(event) {\n logger.log(\"WebSocket onclose event\");\n if (this.disconnected) {\n return;\n }\n this.disconnected = true;\n this.monitor.recordDisconnect();\n return this.subscriptions.notifyAll(\"disconnected\", {\n willAttemptReconnect: this.monitor.isRunning()\n });\n },\n error() {\n logger.log(\"WebSocket onerror event\");\n }\n};\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key];\n object[key] = value;\n }\n }\n return object;\n};\n\nclass Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer;\n this.identifier = JSON.stringify(params);\n extend(this, mixin);\n }\n perform(action, data = {}) {\n data.action = action;\n return this.send(data);\n }\n send(data) {\n return this.consumer.send({\n command: \"message\",\n identifier: this.identifier,\n data: JSON.stringify(data)\n });\n }\n unsubscribe() {\n return this.consumer.subscriptions.remove(this);\n }\n}\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions;\n this.pendingSubscriptions = [];\n }\n guarantee(subscription) {\n if (this.pendingSubscriptions.indexOf(subscription) == -1) {\n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`);\n this.pendingSubscriptions.push(subscription);\n } else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`);\n }\n this.startGuaranteeing();\n }\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`);\n this.pendingSubscriptions = this.pendingSubscriptions.filter((s => s !== subscription));\n }\n startGuaranteeing() {\n this.stopGuaranteeing();\n this.retrySubscribing();\n }\n stopGuaranteeing() {\n clearTimeout(this.retryTimeout);\n }\n retrySubscribing() {\n this.retryTimeout = setTimeout((() => {\n if (this.subscriptions && typeof this.subscriptions.subscribe === \"function\") {\n this.pendingSubscriptions.map((subscription => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`);\n this.subscriptions.subscribe(subscription);\n }));\n }\n }), 500);\n }\n}\n\nclass Subscriptions {\n constructor(consumer) {\n this.consumer = consumer;\n this.guarantor = new SubscriptionGuarantor(this);\n this.subscriptions = [];\n }\n create(channelName, mixin) {\n const channel = channelName;\n const params = typeof channel === \"object\" ? channel : {\n channel: channel\n };\n const subscription = new Subscription(this.consumer, params, mixin);\n return this.add(subscription);\n }\n add(subscription) {\n this.subscriptions.push(subscription);\n this.consumer.ensureActiveConnection();\n this.notify(subscription, \"initialized\");\n this.subscribe(subscription);\n return subscription;\n }\n remove(subscription) {\n this.forget(subscription);\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\");\n }\n return subscription;\n }\n reject(identifier) {\n return this.findAll(identifier).map((subscription => {\n this.forget(subscription);\n this.notify(subscription, \"rejected\");\n return subscription;\n }));\n }\n forget(subscription) {\n this.guarantor.forget(subscription);\n this.subscriptions = this.subscriptions.filter((s => s !== subscription));\n return subscription;\n }\n findAll(identifier) {\n return this.subscriptions.filter((s => s.identifier === identifier));\n }\n reload() {\n return this.subscriptions.map((subscription => this.subscribe(subscription)));\n }\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription => this.notify(subscription, callbackName, ...args)));\n }\n notify(subscription, callbackName, ...args) {\n let subscriptions;\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription);\n } else {\n subscriptions = [ subscription ];\n }\n return subscriptions.map((subscription => typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined));\n }\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription);\n }\n }\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`);\n this.findAll(identifier).map((subscription => this.guarantor.forget(subscription)));\n }\n sendCommand(subscription, command) {\n const {identifier: identifier} = subscription;\n return this.consumer.send({\n command: command,\n identifier: identifier\n });\n }\n}\n\nclass Consumer {\n constructor(url) {\n this._url = url;\n this.subscriptions = new Subscriptions(this);\n this.connection = new Connection(this);\n }\n get url() {\n return createWebSocketURL(this._url);\n }\n send(data) {\n return this.connection.send(data);\n }\n connect() {\n return this.connection.open();\n }\n disconnect() {\n return this.connection.close({\n allowReconnect: false\n });\n }\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open();\n }\n }\n}\n\nfunction createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url();\n }\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\");\n a.href = url;\n a.href = a.href;\n a.protocol = a.protocol.replace(\"http\", \"ws\");\n return a.href;\n } else {\n return url;\n }\n}\n\nfunction createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url);\n}\n\nfunction getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`);\n if (element) {\n return element.getAttribute(\"content\");\n }\n}\n\nexport { Connection, ConnectionMonitor, Consumer, INTERNAL, Subscription, SubscriptionGuarantor, Subscriptions, adapters, createConsumer, createWebSocketURL, getConfig, logger };\n", "import { createConsumer } from '@rails/actioncable'\n\n// eslint-disable-next-line import/no-mutable-exports\nlet consumer\n\nif (window.Avo.configuration.action_cable.enabled) {\n consumer = createConsumer()\n\n window.Avo.consumer = consumer\n}\n\nexport default consumer\n"],
5
- "mappings": "MAAA,GAAI,GAAW,CACb,OAAQ,KAAK,QACb,UAAW,KAAK,SAClB,EAEI,EAAS,CACX,OAAO,EAAU,CACf,AAAI,KAAK,SACP,GAAS,KAAK,KAAK,IAAI,CAAC,EACxB,EAAS,OAAO,IAAI,gBAAiB,GAAG,CAAQ,EAEpD,CACF,EAEM,EAAM,IAAO,GAAI,QAAM,QAAQ,EAE/B,EAAe,GAAS,GAAI,EAAI,GAAQ,IAE9C,OAAwB,CACtB,YAAY,EAAY,CACtB,KAAK,oBAAsB,KAAK,oBAAoB,KAAK,IAAI,EAC7D,KAAK,WAAa,EAClB,KAAK,kBAAoB,CAC3B,CACA,OAAQ,CACN,AAAK,KAAK,UAAU,GAClB,MAAK,UAAY,EAAI,EACrB,MAAO,MAAK,UACZ,KAAK,aAAa,EAClB,iBAAiB,mBAAoB,KAAK,mBAAmB,EAC7D,EAAO,IAAI,gDAAgD,KAAK,YAAY,kBAAkB,EAElG,CACA,MAAO,CACL,AAAI,KAAK,UAAU,GACjB,MAAK,UAAY,EAAI,EACrB,KAAK,YAAY,EACjB,oBAAoB,mBAAoB,KAAK,mBAAmB,EAChE,EAAO,IAAI,2BAA2B,EAE1C,CACA,WAAY,CACV,MAAO,MAAK,WAAa,CAAC,KAAK,SACjC,CACA,YAAa,CACX,KAAK,SAAW,EAAI,CACtB,CACA,e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