livechat 1.8.1 → 1.9.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.
- checksums.yaml +4 -4
- data/AGENTS.md +1 -0
- data/CHANGELOG.md +13 -1
- data/README.md +10 -2
- data/app/mailers/livechat/mailer.rb +10 -4
- data/app/views/livechat/mailer/new_agent_reply.html.erb +19 -0
- data/lib/generators/livechat/install/templates/initializer.rb +4 -0
- data/lib/livechat/configuration.rb +6 -0
- data/lib/livechat/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c8e5072249574d57a320eecb080c7d1ced36be1375b42221b6cbf172ac04eb5
|
|
4
|
+
data.tar.gz: e23e75a74d0bf06a1e192f84766bb7e8048c3d7698e8feafb0f9b0400d9a8509
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eac1a401d641134ff69f4d01edd9bee372c35235609535b9614cf75fb642dc436b0971ac867389e41cb8795bc157a35978ee6af04e4fb5e5b7859d2d69a9eab5
|
|
7
|
+
data.tar.gz: fdef0c716aee7e19a3d7bf1b387af85ed34f64033d28bbf6cb534e605274dab638ac0906942cfdf84ae601d12a73a99cf09417981dd9586d795f046bb0488c6a
|
data/AGENTS.md
CHANGED
|
@@ -174,6 +174,7 @@ Everything is optional; a fresh install works with zero config. Full list with c
|
|
|
174
174
|
| `allowed_embed_origins` | `[]` | Origins that may embed the widget on a page this app does not render |
|
|
175
175
|
| `mailer_from` | `nil` | **Required for any email at all** |
|
|
176
176
|
| `agent_emails` | `nil` | Array or callable |
|
|
177
|
+
| `mailer_layout` | `nil` | A host layout; the visitor's reply email gains an HTML part inside it. The team's stays plain text |
|
|
177
178
|
| `attach_files` | `true` | Needs Active Storage; inert without it |
|
|
178
179
|
| `storage_service` | app default | A `storage.yml` key for a dedicated bucket |
|
|
179
180
|
| `max_attachments`, `max_attachment_size` | `5`, `10.megabytes` | Enforced server-side |
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.9.0 - 2026-12-05
|
|
4
|
+
|
|
5
|
+
- `config.mailer_layout` sends the visitor's reply email as HTML too, inside
|
|
6
|
+
a layout of the host's, so it can look like the rest of the host's customer
|
|
7
|
+
email. The plain-text part is unchanged, and the team's email stays plain
|
|
8
|
+
text: it is an internal nudge.
|
|
9
|
+
- Costs: off until a host sets it. Once set, every reply email renders a
|
|
10
|
+
second template inside the host's layout, which then has to work without a
|
|
11
|
+
request and with only the helpers Action Mailer gives it. Messages are
|
|
12
|
+
escaped and only the chat link is a link, so a URL a visitor or agent typed
|
|
13
|
+
stays text. Like the text part, the HTML copy is English apart from the link.
|
|
14
|
+
|
|
15
|
+
## 1.8.1 - 2026-12-03
|
|
4
16
|
|
|
5
17
|
- Add Slovenian text for the support widget, inbox, and emails. Translate the
|
|
6
18
|
recording controls, microphone messages, and widget typing indicator in 12
|
data/README.md
CHANGED
|
@@ -176,6 +176,7 @@ Everything is optional — a fresh install works with zero config. In
|
|
|
176
176
|
| `agent_display_name` | the full label | What **visitors** see — trim it or anonymise it |
|
|
177
177
|
| `mailer_from` | `nil` | Required for any email |
|
|
178
178
|
| `agent_emails` | `nil` | Who gets notified of new visitor messages |
|
|
179
|
+
| `mailer_layout` | `nil` | Your mail layout, to send the visitor's reply email as HTML too |
|
|
179
180
|
| `on_visitor_message` | no-op | Runs after a visitor writes — Slack, etc. |
|
|
180
181
|
| `on_agent_message` | no-op | Runs after an agent replies |
|
|
181
182
|
| `attach_files` | `true` | File attachments (needs Active Storage) |
|
|
@@ -248,8 +249,15 @@ unread stretch, not one per message. When an agent replies and the visitor is
|
|
|
248
249
|
away, the visitor gets one email (signed-in visitors automatically, guests once
|
|
249
250
|
they leave an address — the widget asks, gently).
|
|
250
251
|
|
|
251
|
-
Requires `mailer_from`; team notifications also need `agent_emails`.
|
|
252
|
-
|
|
252
|
+
Requires `mailer_from`; team notifications also need `agent_emails`. Both are
|
|
253
|
+
plain text. To brand the visitor's email like the rest of your customer email,
|
|
254
|
+
name your mail layout and it gains an HTML part rendered inside it:
|
|
255
|
+
|
|
256
|
+
```ruby
|
|
257
|
+
config.mailer_layout = "mailer"
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
For anything else, hook in:
|
|
253
261
|
|
|
254
262
|
```ruby
|
|
255
263
|
config.on_visitor_message = ->(message) { SlackNotifier.ping(message) }
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Livechat
|
|
4
4
|
# The two built-in notification emails. Plain text, no branding — they are
|
|
5
|
-
# nudges back into the conversation, not newsletters.
|
|
6
|
-
#
|
|
7
|
-
#
|
|
5
|
+
# nudges back into the conversation, not newsletters. A host that brands its
|
|
6
|
+
# customer email can wrap the visitor's in its own layout with
|
|
7
|
+
# config.mailer_layout. Both require config.mailer_from; the callers in
|
|
8
|
+
# Livechat::Notifications enforce the rest of the conditions (recipients
|
|
9
|
+
# present, first unread message).
|
|
8
10
|
class Mailer < ActionMailer::Base
|
|
9
11
|
MAX_MESSAGES = 5
|
|
10
12
|
|
|
@@ -37,7 +39,11 @@ module Livechat
|
|
|
37
39
|
I18n.t('livechat.mail.reply_subject', name: message.public_label, app: Livechat.app_name,
|
|
38
40
|
default: '%{name} replied to you on %{app}')
|
|
39
41
|
end
|
|
40
|
-
|
|
42
|
+
layout = Livechat.config.mailer_layout
|
|
43
|
+
mail(from: Livechat.config.mailer_from, to: @conversation.visitor_email, subject: subject) do |format|
|
|
44
|
+
format.text
|
|
45
|
+
format.html { render layout: layout } if layout
|
|
46
|
+
end
|
|
41
47
|
end
|
|
42
48
|
|
|
43
49
|
private
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<% noun = @first_contact ? 'message' : 'reply' -%>
|
|
2
|
+
<p><%= @message.public_label %> sent <%= @message_count %> unread <%= @message_count == 1 ? noun : noun.pluralize %>:</p>
|
|
3
|
+
|
|
4
|
+
<% @messages.each do |message| %>
|
|
5
|
+
<blockquote style="margin: 0 0 16px; padding-left: 12px; border-left: 3px solid #e4e4e7;">
|
|
6
|
+
<%= simple_format(h(message.body.presence || '(no text)'), {}, sanitize: false) %>
|
|
7
|
+
<% if @attachment_names[message].any? %>
|
|
8
|
+
<p>Attachments: <%= @attachment_names[message].join(', ') %></p>
|
|
9
|
+
<% end %>
|
|
10
|
+
</blockquote>
|
|
11
|
+
<% end %>
|
|
12
|
+
|
|
13
|
+
<% if @more_count.positive? %>
|
|
14
|
+
<p>...and <%= @more_count %> more unread <%= @more_count == 1 ? noun : noun.pluralize %>.</p>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<% if @chat_url.present? %>
|
|
18
|
+
<p><%= link_to t('livechat.mail.continue', default: 'Continue the conversation'), @chat_url %></p>
|
|
19
|
+
<% end %>
|
|
@@ -77,6 +77,10 @@ Livechat.configure do |config|
|
|
|
77
77
|
# config.agent_emails = ["support@example.com"]
|
|
78
78
|
# config.agent_emails = -> { User.where(admin: true).pluck(:email) }
|
|
79
79
|
|
|
80
|
+
# Send the visitor's reply email as HTML too, inside one of your layouts.
|
|
81
|
+
# Plain text only by default; the team's email stays plain text.
|
|
82
|
+
# config.mailer_layout = "mailer"
|
|
83
|
+
|
|
80
84
|
# Called with each saved Livechat::Message — notify Slack, push…
|
|
81
85
|
# config.on_visitor_message = ->(message) {}
|
|
82
86
|
# config.on_agent_message = ->(message) {}
|
|
@@ -111,6 +111,11 @@ module Livechat
|
|
|
111
111
|
# email to be sent.
|
|
112
112
|
attr_accessor :mailer_from
|
|
113
113
|
|
|
114
|
+
# A layout of the host's, e.g. "mailer", to send the visitor's reply email
|
|
115
|
+
# as HTML inside it, alongside the plain text. nil sends plain text only.
|
|
116
|
+
# The team's email stays plain text either way.
|
|
117
|
+
attr_accessor :mailer_layout
|
|
118
|
+
|
|
114
119
|
# Called with each saved Livechat::Message — wire up Slack, Noticed,
|
|
115
120
|
# push… Runs inline after save; keep it fast or hand off to a job.
|
|
116
121
|
attr_accessor :on_visitor_message, :on_agent_message
|
|
@@ -194,6 +199,7 @@ module Livechat
|
|
|
194
199
|
@allowed_embed_origins = []
|
|
195
200
|
@agent_emails = nil
|
|
196
201
|
@mailer_from = nil
|
|
202
|
+
@mailer_layout = nil
|
|
197
203
|
@on_visitor_message = ->(_message) {}
|
|
198
204
|
@on_agent_message = ->(_message) {}
|
|
199
205
|
@rate_limit = { to: 30, within: 60 }
|
data/lib/livechat/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: livechat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yaroslav Shmarov
|
|
@@ -71,6 +71,7 @@ files:
|
|
|
71
71
|
- app/views/livechat/conversations/index.html.erb
|
|
72
72
|
- app/views/livechat/conversations/new.html.erb
|
|
73
73
|
- app/views/livechat/conversations/show.html.erb
|
|
74
|
+
- app/views/livechat/mailer/new_agent_reply.html.erb
|
|
74
75
|
- app/views/livechat/mailer/new_agent_reply.text.erb
|
|
75
76
|
- app/views/livechat/mailer/new_visitor_message.text.erb
|
|
76
77
|
- app/views/livechat/shared/_dashboard.html.erb
|