Module: Testimonials::Widget
- Defined in:
- lib/testimonials/widget.rb
Overview
Serves the self-contained browser widget. The JavaScript is plain ES (no framework, no build step) and styles itself inline, so it drops into any Rails app regardless of its CSS or JS setup. It is inlined into the page rather than served as a separate asset to avoid any dependency on the host's asset pipeline — and it lives under lib/ (not app/assets/) so a host that does run a pipeline never ingests it either.
Constant Summary collapse
- SOURCE =
File.('widget.js', __dir__)
- DASHBOARD_SOURCE =
File.('dashboard.js', __dir__)
- RTL_LANGUAGES =
Right-to-left scripts, so the form renders mirrored for those locales. Matched on the language subtag, so region variants ("ar-EG") count too.
%w[ar arc ckb dv fa ha he ks ku ps sd ug ur yi].freeze
Class Method Summary collapse
- .config_json(locale:, authenticated:, auto_open:, mode:, existing: nil) ⇒ Object
- .dashboard_fingerprint ⇒ Object
- .dashboard_javascript ⇒ Object
-
.fingerprint ⇒ Object
Content fingerprints for cache-busting script URLs: a changed file is a changed URL, so no browser can ever run stale widget code — Safari has been caught ignoring must-revalidate on same-URL scripts.
- .javascript ⇒ Object
-
.snippet(locale:, authenticated:, auto_open: nil, mode: 'widget', existing: nil, nonce: nil) ⇒ Object
The two