lookout-ahoy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +99 -0
  4. data/Rakefile +24 -0
  5. data/app/assets/images/lookout/apple-touch-icon.png +0 -0
  6. data/app/assets/images/lookout/favicon-16x16.png +0 -0
  7. data/app/assets/images/lookout/favicon-32x32.png +0 -0
  8. data/app/assets/images/lookout/logo.png +0 -0
  9. data/app/assets/images/lookout/safari-pinned-tab.png +0 -0
  10. data/app/assets/images/lookout/safari-pinned-tab.svg +199 -0
  11. data/app/assets/javascript/lookout/application.js +2 -0
  12. data/app/assets/javascript/lookout/controllers/application.js +9 -0
  13. data/app/assets/javascript/lookout/controllers/application_controller.js +33 -0
  14. data/app/assets/javascript/lookout/controllers/combobox_controller.js +371 -0
  15. data/app/assets/javascript/lookout/controllers/details_modal_controller.js +18 -0
  16. data/app/assets/javascript/lookout/controllers/dropdown_label_controller.js +39 -0
  17. data/app/assets/javascript/lookout/controllers/filter/item_controller.js +12 -0
  18. data/app/assets/javascript/lookout/controllers/filter_form_controller.js +13 -0
  19. data/app/assets/javascript/lookout/controllers/filter_modal_controller.js +45 -0
  20. data/app/assets/javascript/lookout/controllers/frame_link_controller.js +20 -0
  21. data/app/assets/javascript/lookout/controllers/funnel_chart_controller.js +159 -0
  22. data/app/assets/javascript/lookout/controllers/index.js +4 -0
  23. data/app/assets/javascript/lookout/controllers/interval_controller.js +15 -0
  24. data/app/assets/javascript/lookout/controllers/line_chart_controller.js +251 -0
  25. data/app/assets/javascript/lookout/controllers/predicate_select_controller.js +10 -0
  26. data/app/assets/javascript/lookout/controllers/properties_controller.js +8 -0
  27. data/app/assets/javascript/lookout/controllers/property_filter_controller.js +45 -0
  28. data/app/assets/javascript/lookout/controllers/realtime_controller.js +30 -0
  29. data/app/assets/javascript/lookout/controllers/sparkline_controller.js +64 -0
  30. data/app/assets/javascript/lookout/controllers/tile_controller.js +33 -0
  31. data/app/assets/javascript/lookout/controllers/toggle_controller.js +17 -0
  32. data/app/assets/javascript/lookout/helpers/chart_utils.js +156 -0
  33. data/app/assets/javascript/lookout/helpers/countries.js +2261 -0
  34. data/app/assets/javascript/lookout/helpers/number_formatters.js +55 -0
  35. data/app/assets/manifest/lookout/manifest.js +2 -0
  36. data/app/components/lookout/combobox_component.html.erb +33 -0
  37. data/app/components/lookout/combobox_component.rb +13 -0
  38. data/app/components/lookout/comparison_link_component.html.erb +17 -0
  39. data/app/components/lookout/comparison_link_component.rb +44 -0
  40. data/app/components/lookout/dropdown_button_component.html.erb +16 -0
  41. data/app/components/lookout/dropdown_button_component.rb +14 -0
  42. data/app/components/lookout/dropdown_link_component.html.erb +17 -0
  43. data/app/components/lookout/dropdown_link_component.rb +19 -0
  44. data/app/components/lookout/filter/dropdown_component.html.erb +50 -0
  45. data/app/components/lookout/filter/dropdown_component.rb +51 -0
  46. data/app/components/lookout/filter/modal_component.html.erb +16 -0
  47. data/app/components/lookout/filter/modal_component.rb +13 -0
  48. data/app/components/lookout/filter/select_component.html.erb +25 -0
  49. data/app/components/lookout/filter/select_component.rb +64 -0
  50. data/app/components/lookout/filter/tag_component.html.erb +13 -0
  51. data/app/components/lookout/filter/tag_component.rb +14 -0
  52. data/app/components/lookout/filter/tag_container_component.html.erb +4 -0
  53. data/app/components/lookout/filter/tag_container_component.rb +6 -0
  54. data/app/components/lookout/previous_next_component.html.erb +8 -0
  55. data/app/components/lookout/previous_next_component.rb +11 -0
  56. data/app/components/lookout/stats/comparable_container_component.html.erb +25 -0
  57. data/app/components/lookout/stats/comparable_container_component.rb +103 -0
  58. data/app/components/lookout/stats/container_component.html.erb +23 -0
  59. data/app/components/lookout/stats/container_component.rb +28 -0
  60. data/app/components/lookout/sticky_nav_component.html.erb +32 -0
  61. data/app/components/lookout/sticky_nav_component.rb +24 -0
  62. data/app/components/lookout/table_component.html.erb +16 -0
  63. data/app/components/lookout/table_component.rb +48 -0
  64. data/app/components/lookout/tables/devices_table_component.rb +11 -0
  65. data/app/components/lookout/tables/dynamic_table.rb +13 -0
  66. data/app/components/lookout/tables/dynamic_table_component.rb +207 -0
  67. data/app/components/lookout/tables/goals_table_component.rb +17 -0
  68. data/app/components/lookout/tables/header_component.html.erb +6 -0
  69. data/app/components/lookout/tables/header_component.rb +18 -0
  70. data/app/components/lookout/tables/headers/header_component.html.erb +5 -0
  71. data/app/components/lookout/tables/headers/header_component.rb +16 -0
  72. data/app/components/lookout/tables/properties_table_component.rb +27 -0
  73. data/app/components/lookout/tables/row_component.html.erb +4 -0
  74. data/app/components/lookout/tables/rows/row_component.html.erb +6 -0
  75. data/app/components/lookout/tables/rows/row_component.rb +40 -0
  76. data/app/components/lookout/tile_component.html.erb +24 -0
  77. data/app/components/lookout/tile_component.rb +24 -0
  78. data/app/components/lookout/tooltip_component.html.erb +3 -0
  79. data/app/components/lookout/tooltip_component.rb +18 -0
  80. data/app/controllers/lookout/application_controller.rb +83 -0
  81. data/app/controllers/lookout/campaigns_controller.rb +19 -0
  82. data/app/controllers/lookout/devices_controller.rb +20 -0
  83. data/app/controllers/lookout/entry_pages_controller.rb +19 -0
  84. data/app/controllers/lookout/exit_pages_controller.rb +19 -0
  85. data/app/controllers/lookout/exports_controller.rb +14 -0
  86. data/app/controllers/lookout/filters/base_controller.rb +15 -0
  87. data/app/controllers/lookout/filters/goals_controller.rb +9 -0
  88. data/app/controllers/lookout/filters/locations_controller.rb +11 -0
  89. data/app/controllers/lookout/filters/operating_systems/names_controller.rb +13 -0
  90. data/app/controllers/lookout/filters/operating_systems/versions_controller.rb +13 -0
  91. data/app/controllers/lookout/filters/pages/actions_controller.rb +13 -0
  92. data/app/controllers/lookout/filters/pages/entry_pages_controller.rb +14 -0
  93. data/app/controllers/lookout/filters/pages/exit_pages_controller.rb +15 -0
  94. data/app/controllers/lookout/filters/properties/names_controller.rb +29 -0
  95. data/app/controllers/lookout/filters/properties/values_controller.rb +15 -0
  96. data/app/controllers/lookout/filters/screens_controller.rb +11 -0
  97. data/app/controllers/lookout/filters/sources_controller.rb +11 -0
  98. data/app/controllers/lookout/filters/utms_controller.rb +10 -0
  99. data/app/controllers/lookout/funnels_controller.rb +8 -0
  100. data/app/controllers/lookout/goals_controller.rb +7 -0
  101. data/app/controllers/lookout/locations/cities_controller.rb +22 -0
  102. data/app/controllers/lookout/locations/countries_controller.rb +22 -0
  103. data/app/controllers/lookout/locations/maps_controller.rb +24 -0
  104. data/app/controllers/lookout/locations/regions_controller.rb +22 -0
  105. data/app/controllers/lookout/properties_controller.rb +73 -0
  106. data/app/controllers/lookout/realtimes_controller.rb +7 -0
  107. data/app/controllers/lookout/roots_controller.rb +6 -0
  108. data/app/controllers/lookout/sources_controller.rb +21 -0
  109. data/app/controllers/lookout/stats/base_controller.rb +148 -0
  110. data/app/controllers/lookout/stats/bounce_rates_controller.rb +12 -0
  111. data/app/controllers/lookout/stats/total_pageviews_controller.rb +10 -0
  112. data/app/controllers/lookout/stats/total_visits_controller.rb +10 -0
  113. data/app/controllers/lookout/stats/unique_visitors_controller.rb +11 -0
  114. data/app/controllers/lookout/stats/views_per_visits_controller.rb +11 -0
  115. data/app/controllers/lookout/stats/visit_durations_controller.rb +10 -0
  116. data/app/controllers/lookout/stats_controller.rb +7 -0
  117. data/app/controllers/lookout/top_pages_controller.rb +20 -0
  118. data/app/decorators/lookout/application_decorator.rb +58 -0
  119. data/app/decorators/lookout/campaign_decorator.rb +27 -0
  120. data/app/decorators/lookout/city_decorator.rb +24 -0
  121. data/app/decorators/lookout/country_decorator.rb +38 -0
  122. data/app/decorators/lookout/device_decorator.rb +27 -0
  123. data/app/decorators/lookout/entry_page_decorator.rb +7 -0
  124. data/app/decorators/lookout/exit_page_decorator.rb +7 -0
  125. data/app/decorators/lookout/page_decorator.rb +27 -0
  126. data/app/decorators/lookout/region_decorator.rb +28 -0
  127. data/app/decorators/lookout/source_decorator.rb +27 -0
  128. data/app/decorators/lookout/top_page_decorator.rb +7 -0
  129. data/app/helpers/lookout/application_helper.rb +124 -0
  130. data/app/models/concerns/lookout/compare_mode.rb +19 -0
  131. data/app/models/concerns/lookout/limitable.rb +17 -0
  132. data/app/models/concerns/lookout/range_options.rb +8 -0
  133. data/app/models/lookout/comparison_mode.rb +72 -0
  134. data/app/models/lookout/export.rb +48 -0
  135. data/app/models/lookout/filter_parser.rb +82 -0
  136. data/app/models/lookout/range_from_params.rb +78 -0
  137. data/app/models/lookout/rangeable.rb +7 -0
  138. data/app/models/lookout/widget.rb +15 -0
  139. data/app/presenters/lookout/dashboard_presenter.rb +53 -0
  140. data/app/presenters/lookout/funnel_presenter.rb +75 -0
  141. data/app/presenters/lookout/goals_presenter.rb +72 -0
  142. data/app/queries/concerns/lookout/comparable_queries.rb +25 -0
  143. data/app/queries/concerns/lookout/comparable_query.rb +152 -0
  144. data/app/queries/concerns/lookout/lazy_comparable_query.rb +42 -0
  145. data/app/queries/lookout/application_query.rb +186 -0
  146. data/app/queries/lookout/campaign_query.rb +14 -0
  147. data/app/queries/lookout/city_query.rb +14 -0
  148. data/app/queries/lookout/country_query.rb +10 -0
  149. data/app/queries/lookout/device_query.rb +10 -0
  150. data/app/queries/lookout/entry_pages_query.rb +18 -0
  151. data/app/queries/lookout/event_query.rb +42 -0
  152. data/app/queries/lookout/exit_pages_query.rb +19 -0
  153. data/app/queries/lookout/region_query.rb +14 -0
  154. data/app/queries/lookout/source_query.rb +11 -0
  155. data/app/queries/lookout/stats/average_views_per_visit_query.rb +20 -0
  156. data/app/queries/lookout/stats/average_visit_duration_query.rb +34 -0
  157. data/app/queries/lookout/stats/base_query.rb +18 -0
  158. data/app/queries/lookout/stats/bounce_rates_query.rb +33 -0
  159. data/app/queries/lookout/stats/total_pageviews_query.rb +9 -0
  160. data/app/queries/lookout/stats/total_visitors_query.rb +9 -0
  161. data/app/queries/lookout/stats/unique_visitors_query.rb +9 -0
  162. data/app/queries/lookout/stats/views_per_visit_query.rb +17 -0
  163. data/app/queries/lookout/stats/visit_duration_query.rb +19 -0
  164. data/app/queries/lookout/top_page_query.rb +13 -0
  165. data/app/queries/lookout/visit_query.rb +42 -0
  166. data/app/views/lookout/campaigns/index.html+details.erb +4 -0
  167. data/app/views/lookout/campaigns/index.html.erb +3 -0
  168. data/app/views/lookout/devices/_table.html.erb +2 -0
  169. data/app/views/lookout/devices/index.html+details.erb +4 -0
  170. data/app/views/lookout/devices/index.html.erb +3 -0
  171. data/app/views/lookout/entry_pages/index.html+details.erb +4 -0
  172. data/app/views/lookout/entry_pages/index.html.erb +3 -0
  173. data/app/views/lookout/exit_pages/index.html+details.erb +4 -0
  174. data/app/views/lookout/exit_pages/index.html.erb +3 -0
  175. data/app/views/lookout/funnels/index.html.erb +7 -0
  176. data/app/views/lookout/funnels/show.html.erb +15 -0
  177. data/app/views/lookout/goals/index.html.erb +4 -0
  178. data/app/views/lookout/layouts/application.html.erb +144 -0
  179. data/app/views/lookout/layouts/shared/_tile_loader.html.erb +5 -0
  180. data/app/views/lookout/layouts/shared/_widget_disabled.html+details.erb +3 -0
  181. data/app/views/lookout/layouts/shared/_widget_disabled.html.erb +3 -0
  182. data/app/views/lookout/locations/cities/index.html+details.erb +4 -0
  183. data/app/views/lookout/locations/cities/index.html.erb +3 -0
  184. data/app/views/lookout/locations/countries/index.html+details.erb +5 -0
  185. data/app/views/lookout/locations/countries/index.html.erb +3 -0
  186. data/app/views/lookout/locations/maps/_simple_map.html.erb +26 -0
  187. data/app/views/lookout/locations/maps/show.html.erb +106 -0
  188. data/app/views/lookout/locations/regions/index.html+details.erb +4 -0
  189. data/app/views/lookout/locations/regions/index.html.erb +3 -0
  190. data/app/views/lookout/properties/_form.html.erb +6 -0
  191. data/app/views/lookout/properties/index.html.erb +3 -0
  192. data/app/views/lookout/properties/show.html.erb +6 -0
  193. data/app/views/lookout/realtimes/show.html.erb +9 -0
  194. data/app/views/lookout/roots/_filters.html.erb +80 -0
  195. data/app/views/lookout/roots/show.html.erb +191 -0
  196. data/app/views/lookout/sources/index.html+details.erb +4 -0
  197. data/app/views/lookout/sources/index.html.erb +3 -0
  198. data/app/views/lookout/stats/base/index.html.erb +40 -0
  199. data/app/views/lookout/stats/show.html.erb +15 -0
  200. data/app/views/lookout/top_pages/index.html+details.erb +4 -0
  201. data/app/views/lookout/top_pages/index.html.erb +3 -0
  202. data/config/routes.rb +69 -0
  203. data/lib/generators/lookout/install_generator.rb +31 -0
  204. data/lib/generators/lookout/migration_generator.rb +21 -0
  205. data/lib/generators/lookout/templates/config.rb.tt +185 -0
  206. data/lib/generators/lookout/templates/migration.rb.tt +7 -0
  207. data/lib/lookout/active_record.rb +108 -0
  208. data/lib/lookout/ahoy/event_methods.rb +75 -0
  209. data/lib/lookout/ahoy/visit_methods.rb +24 -0
  210. data/lib/lookout/configuration.rb +58 -0
  211. data/lib/lookout/database_adapter.rb +168 -0
  212. data/lib/lookout/engine.rb +47 -0
  213. data/lib/lookout/filter_configuration/filter.rb +16 -0
  214. data/lib/lookout/filter_configuration/filter_collection.rb +48 -0
  215. data/lib/lookout/filters_configuration.rb +77 -0
  216. data/lib/lookout/funnels.rb +44 -0
  217. data/lib/lookout/goals.rb +51 -0
  218. data/lib/lookout/period_collection.rb +115 -0
  219. data/lib/lookout/predicate_label.rb +7 -0
  220. data/lib/lookout/railtie.rb +9 -0
  221. data/lib/lookout/version.rb +3 -0
  222. data/lib/lookout.rb +78 -0
  223. metadata +673 -0
@@ -0,0 +1,51 @@
1
+ module Lookout
2
+ class Goal
3
+ attr_accessor :id
4
+ attr_reader :title, :event_query
5
+ def initialize
6
+ @id = nil
7
+ @title = nil
8
+ @event_query = nil
9
+ end
10
+
11
+ def label(value)
12
+ @title = value
13
+ end
14
+
15
+ def name(value)
16
+ @event_query = -> { ::Lookout.event.where(name: value) }
17
+ end
18
+
19
+ def event(value)
20
+ ActiveSupport::Deprecation.warn(
21
+ "event is deprecated. " \
22
+ "Use name instead."
23
+ )
24
+ name(value)
25
+ end
26
+
27
+ def query(&block)
28
+ @event_query = block
29
+ end
30
+ end
31
+
32
+ class GoalCollection
33
+ include Enumerable
34
+
35
+ def initialize
36
+ @goals = {}.with_indifferent_access
37
+ end
38
+
39
+ def register(goal)
40
+ @goals[goal.id] = goal
41
+ end
42
+
43
+ def each(&block)
44
+ @goals.values.each(&block)
45
+ end
46
+
47
+ def [](value)
48
+ @goals[value]
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,115 @@
1
+ module Lookout
2
+ class PeriodCollection
3
+ class Period
4
+ attr_reader :param, :label, :range
5
+ def initialize(param:, label:, range:)
6
+ @param = param
7
+ @label = label
8
+ @range = range
9
+ end
10
+ end
11
+
12
+ def self.load_default
13
+ instance = new
14
+ {
15
+ realtime: {
16
+ label: "Realtime",
17
+ range: -> { [1.minute.ago] },
18
+ },
19
+ day: {
20
+ label: "Day",
21
+ range: -> { [Time.current.beginning_of_day, Time.current] },
22
+ },
23
+ '7d': {
24
+ label: "7 Days",
25
+ range: -> { [7.days.ago, Time.current] },
26
+ },
27
+ '30d': {
28
+ label: "30 Days",
29
+ range: -> { [30.days.ago, Time.current] },
30
+ },
31
+ mtd: {
32
+ label: "Month-to-date",
33
+ range: -> { [Time.current.beginning_of_month, Time.current] },
34
+ },
35
+ lastmonth: {
36
+ label: "Last month",
37
+ range: -> { [1.month.ago.beginning_of_month, 1.month.ago.end_of_month] },
38
+ },
39
+ ytd: {
40
+ label: "This year",
41
+ range: -> { [Time.current.beginning_of_year, Time.current] },
42
+ },
43
+ '12mo': {
44
+ label: "12 months",
45
+ range: -> { [12.months.ago.to_datetime, Time.current] },
46
+ },
47
+ all: {
48
+ label: "All-time",
49
+ range: -> { [Date.new(2004, 8, 1).to_datetime, Time.current] },
50
+ },
51
+ }.each do |param, options|
52
+ instance.add(param, options[:label], options[:range])
53
+ end
54
+ instance.default = :'30d'
55
+ instance
56
+ end
57
+
58
+ attr_reader :default, :max
59
+ def initialize
60
+ @periods = {}
61
+ @default = nil
62
+ @max = nil
63
+ end
64
+
65
+ def add(param, label, range_proc)
66
+ raise ArgumentError, "range must be a proc, or respond to .call" unless range_proc.respond_to?(:call)
67
+ raise ArgumentError, "range.call must return a range or an array" unless range_proc.call.is_a?(Range) || range_proc.call.is_a?(Array)
68
+
69
+ @periods[param.to_sym] = Period.new(param: param, label: label, range: range_proc)
70
+ end
71
+
72
+ def delete(param)
73
+ @periods.delete(param.to_sym)
74
+ end
75
+
76
+ def reset
77
+ @periods = {}
78
+ @default = nil
79
+ end
80
+
81
+ def each(&block)
82
+ @periods.each(&block)
83
+ end
84
+
85
+ def find(value)
86
+ @periods[value.try(:to_sym)]
87
+ end
88
+
89
+ def all
90
+ @periods
91
+ end
92
+
93
+ def default=(val)
94
+ @default = val.to_sym
95
+ end
96
+
97
+ def max=(amount)
98
+ @max = amount
99
+ end
100
+
101
+ def for(value)
102
+ if value.nil?
103
+ period = @periods[@default]
104
+ else
105
+ period = (@periods[value.to_sym] || @periods[@default])
106
+ end
107
+
108
+ if period
109
+ period.range.call
110
+ else
111
+ nil
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,7 @@
1
+ module Lookout
2
+ class PredicateLabel
3
+ def self.[](value)
4
+ Lookout.config.predicate_labels[value.to_sym] || value.to_s.titleize
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Lookout
2
+ class Railtie < ::Rails::Railtie
3
+ initializer "lookout.assets.precompile" do |app|
4
+ if app.config.respond_to?(:assets)
5
+ app.config.assets.precompile += %w[lookout/manifest]
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Lookout
2
+ VERSION = "0.1.0"
3
+ end
data/lib/lookout.rb ADDED
@@ -0,0 +1,78 @@
1
+ require "lookout/version"
2
+ require "lookout/railtie"
3
+ require "lookout/engine"
4
+ require "lookout/goals"
5
+ require "lookout/funnels"
6
+ require "lookout/database_adapter"
7
+ require "lookout/configuration"
8
+ require "lookout/predicate_label"
9
+ require 'lookout/ahoy/visit_methods'
10
+ require 'lookout/ahoy/event_methods'
11
+
12
+ require 'importmap-rails'
13
+
14
+ module Lookout
15
+ class << self
16
+ attr_accessor :configuration
17
+
18
+ def cache
19
+ @cache ||= if config.cache[:enabled]
20
+ config.cache[:store]
21
+ else
22
+ ActiveSupport::Cache::NullStore.new
23
+ end
24
+ end
25
+
26
+ # Rails 8+ one-liner support:
27
+ # In a host app's config/importmap.rb you can now do:
28
+ # Lookout.importmap(self)
29
+ # This will draw all Lookout pins onto the host's map builder.
30
+ # If no builder is provided, this returns a standalone Importmap::Map (for inlining).
31
+ def importmap(builder = nil)
32
+ if builder
33
+ builder.pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
34
+ builder.pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
35
+ builder.pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
36
+ builder.pin "application", to: "lookout/application.js", preload: true
37
+ builder.pin "chartjs-plugin-datalabels", to: "https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2", preload: true
38
+ builder.pin "classnames", to: "https://cdnjs.cloudflare.com/ajax/libs/classnames/2.3.2/index.min.js", preload: true
39
+ builder.pin "chartjs-chart-geo", to: "https://cdn.jsdelivr.net/npm/chartjs-chart-geo@4.3.6/build/index.umd.min.js", preload: true
40
+ builder.pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/controllers"), under: "controllers", to: "lookout/controllers"
41
+ builder.pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/helpers"), under: "helpers", to: "lookout/helpers"
42
+ return builder
43
+ end
44
+
45
+ Importmap::Map.new.draw do
46
+ pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
47
+ pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
48
+ pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
49
+ pin "application", to: "lookout/application.js", preload: true
50
+ pin "chartjs-plugin-datalabels", to: "https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2", preload: true
51
+ pin "classnames", to: "https://cdnjs.cloudflare.com/ajax/libs/classnames/2.3.2/index.min.js", preload: true
52
+ pin "chartjs-chart-geo", to: "https://cdn.jsdelivr.net/npm/chartjs-chart-geo@4.3.6/build/index.umd.min.js", preload: true
53
+ pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/controllers"), under: "controllers", to: "lookout/controllers"
54
+ pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/helpers"), under: "helpers", to: "lookout/helpers"
55
+ end
56
+ end
57
+
58
+ def config
59
+ self.configuration ||= Configuration.new
60
+ end
61
+
62
+ def configure
63
+ yield config
64
+ end
65
+
66
+ def event
67
+ @event ||= config.models[:event].constantize
68
+ end
69
+
70
+ def visit
71
+ @visit ||= config.models[:visit].constantize
72
+ end
73
+
74
+ def none
75
+ @none ||= OpenStruct.new(text: "(none)", value: "!none!")
76
+ end
77
+ end
78
+ end