livechat 1.1.0 → 1.3.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/CHANGELOG.md +45 -0
- data/README.md +25 -0
- data/Rakefile +9 -1
- data/app/controllers/livechat/visitor_controller.rb +1 -1
- data/app/models/livechat/conversation.rb +2 -3
- data/app/models/livechat/message.rb +5 -5
- data/app/views/livechat/conversations/_thread_panel.html.erb +7 -6
- data/config/locales/livechat.ar.yml +1 -1
- data/config/locales/livechat.bg.yml +1 -1
- data/config/locales/livechat.bn.yml +1 -1
- data/config/locales/livechat.de.yml +1 -1
- data/config/locales/livechat.el.yml +1 -1
- data/config/locales/livechat.en.yml +1 -1
- data/config/locales/livechat.es.yml +1 -1
- data/config/locales/livechat.fr.yml +1 -1
- data/config/locales/livechat.hi.yml +1 -1
- data/config/locales/livechat.hr.yml +1 -1
- data/config/locales/livechat.id.yml +1 -1
- data/config/locales/livechat.it.yml +1 -1
- data/config/locales/livechat.ja.yml +1 -1
- data/config/locales/livechat.ko.yml +1 -1
- data/config/locales/livechat.lb.yml +1 -1
- data/config/locales/livechat.nl.yml +1 -1
- data/config/locales/livechat.pl.yml +1 -1
- data/config/locales/livechat.pt.yml +1 -1
- data/config/locales/livechat.ro.yml +1 -1
- data/config/locales/livechat.ru.yml +1 -1
- data/config/locales/livechat.th.yml +1 -1
- data/config/locales/livechat.tr.yml +1 -1
- data/config/locales/livechat.uk.yml +1 -1
- data/config/locales/livechat.ur.yml +1 -1
- data/config/locales/livechat.vi.yml +1 -1
- data/config/locales/livechat.zh-CN.yml +1 -1
- data/docs/ractors.md +123 -0
- data/docs/screenshots/01-widget.png +0 -0
- data/docs/screenshots/03-inbox.png +0 -0
- data/docs/screenshots/04-conversation.png +0 -0
- data/lib/livechat/dashboard.js +15 -4
- data/lib/livechat/engine.rb +11 -0
- data/lib/livechat/ractor_support.rb +534 -0
- data/lib/livechat/version.rb +1 -1
- data/lib/livechat/widget.js +6 -2
- data/lib/livechat/widget.rb +4 -4
- data/lib/livechat.rb +1 -0
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7fa5188b3a4e41efad9925ecc22275862474505bc2696355b2977c7ecb7ba71
|
|
4
|
+
data.tar.gz: 6759505e2ccc14288b08227e050a3e7a13057193e3ed4551c1722f309a22fd2f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58d2d11a943b96a323d40b92e76e0ad1082231c9a8643559e53f15605e104311498d4a9630b691192759c0a26a4eab6acb9dabeee28604a5f2073918a9938ce7
|
|
7
|
+
data.tar.gz: 64b85177dbece4ac7a7a728ff45c1c8297d646f211471fbabd1a6d9367aab5b1bdf8dc28ace34423959d8423cf04919c52a8daa2a38907fd0a366620f83bb4f0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.0 - 2026-11-14
|
|
4
|
+
|
|
5
|
+
- Add `data-livechat-badge-class` to `data-livechat-open` elements. The unread
|
|
6
|
+
badge on that opener gets the host's classes and none of the built-in style,
|
|
7
|
+
so a Tailwind or daisyUI app can use its own badge without overriding ours.
|
|
8
|
+
The built-in style is injected outside any cascade layer, so before this a
|
|
9
|
+
host had to outrank it with a more specific selector of its own. Openers
|
|
10
|
+
without the attribute look and behave as before.
|
|
11
|
+
|
|
12
|
+
## 1.2.2 - 2026-10-18
|
|
13
|
+
|
|
14
|
+
- Clarify the widget's resolved message in all 26 locales: visitors can send
|
|
15
|
+
another message whenever they need help. Follow-ups keep the same thread
|
|
16
|
+
and history; different questions still share one open/resolved status.
|
|
17
|
+
The longer guidance can wrap across more than one line in the timeline.
|
|
18
|
+
|
|
19
|
+
## 1.2.1 - 2026-10-18
|
|
20
|
+
|
|
21
|
+
- Bind the inbox status form's CSRF token to the actual resolve or reopen
|
|
22
|
+
destination. Status changes and replies use local forms so older host apps
|
|
23
|
+
do not require Rails UJS to supply their tokens; CSRF checks stay enabled.
|
|
24
|
+
- Return focus to the agent composer after a reply, including Ctrl/Cmd+Enter
|
|
25
|
+
in the split-pane inbox. One form-destination marker is kept in per-tab
|
|
26
|
+
session storage for the next navigation; message bodies are not stored.
|
|
27
|
+
Ordinary inbox visits keep their existing focus behavior.
|
|
28
|
+
|
|
29
|
+
## 1.2.0 - 2026-10-18
|
|
30
|
+
|
|
31
|
+
- Add Rails edge CI and experimental Ruby 4.0+ Ractor request support. The host
|
|
32
|
+
must opt into `Rails.application.ractorize!` and use the upstream Rack/I18n
|
|
33
|
+
dependencies documented in `docs/ractors.md`.
|
|
34
|
+
- Exercise actual multipart uploads and private downloads in worker Ractors
|
|
35
|
+
when Active Storage is installed, alongside the optional-dependency-free host.
|
|
36
|
+
- Exercise signed Action Cable stream tokens and worker-originated broadcasts;
|
|
37
|
+
broadcasts are coordinated with the main Cable server.
|
|
38
|
+
- Prepare immutable widget assets and a frozen configuration snapshot at
|
|
39
|
+
Ractorization. Callbacks still run for each request, with isolated captures;
|
|
40
|
+
callbacks that capture mutable state fail at boot with the setting name.
|
|
41
|
+
Normal Rails boots retain mutable configuration and lazy asset loading.
|
|
42
|
+
- Bridge framework operations that are not yet Ractor safe (mounted URL
|
|
43
|
+
generation, digests/key derivation and attribute factories) to the main
|
|
44
|
+
Ractor. This adds dispatch overhead in Ractor mode; it is compatibility
|
|
45
|
+
support, not a claim of improved throughput. Existing Rails 7.1–8.1 installs
|
|
46
|
+
need no migration or initializer changes.
|
|
47
|
+
|
|
3
48
|
## 1.1.0 - 2026-09-25
|
|
4
49
|
|
|
5
50
|
- **The widget can now live on a site this app does not render.** A static
|
data/README.md
CHANGED
|
@@ -96,6 +96,11 @@ the things it should not do. It ships inside the gem, so
|
|
|
96
96
|
resolve it when done. A visitor writing again reopens it.
|
|
97
97
|
4. The visitor sees the reply in the widget, or by email when they're gone.
|
|
98
98
|
|
|
99
|
+
Each visitor has one ongoing conversation. Resolving it marks the current
|
|
100
|
+
exchange as handled; the visitor can send another message at any time to
|
|
101
|
+
reopen that same thread, with the history intact. Different questions share
|
|
102
|
+
one open/resolved status.
|
|
103
|
+
|
|
99
104
|
**Realtime is polling, on purpose:** ~4s while the panel is open, ~30s in the
|
|
100
105
|
background, nothing at all for visitors who never wrote. No Action Cable, no
|
|
101
106
|
Redis, no infrastructure. At support-chat volume you will not notice; your ops
|
|
@@ -367,6 +372,7 @@ to a stream the server signed for it. Under a strict CSP, allow the socket with
|
|
|
367
372
|
| `window.Livechat.open()` / `.close()` | `open("Hi, I need help with…")` prefills the box — never over a visitor's draft |
|
|
368
373
|
| `data-livechat-open` | Any element opens the panel on click |
|
|
369
374
|
| `data-livechat-message="…"` | Prefill from that element — great for contextual buttons |
|
|
375
|
+
| `data-livechat-badge-class="…"` | Classes for that element's unread badge, in place of the built-in style |
|
|
370
376
|
| `<%= livechat_button %>` | A plain, unstyled opener button |
|
|
371
377
|
| `<%= livechat_button("Ask about this order", message: "I need help with order ##{@order.id}") %>` | Open and prefill in one helper |
|
|
372
378
|
| `config.show_launcher = false` | Hide the bubble entirely |
|
|
@@ -374,6 +380,15 @@ to a stream the server signed for it. Under a strict CSP, allow the socket with
|
|
|
374
380
|
While replies are unread, every `data-livechat-open` element carries a small
|
|
375
381
|
count badge — so hiding the launcher never hides the answer.
|
|
376
382
|
|
|
383
|
+
The badge has a plain red style of its own. To match your design system, name
|
|
384
|
+
your own classes on the opener; the built-in style then steps aside:
|
|
385
|
+
|
|
386
|
+
```erb
|
|
387
|
+
<button data-livechat-open data-livechat-badge-class="badge badge-error badge-xs ms-auto">
|
|
388
|
+
Contact support
|
|
389
|
+
</button>
|
|
390
|
+
```
|
|
391
|
+
|
|
377
392
|
Contextual buttons are where a Rails app beats a generic support widget:
|
|
378
393
|
|
|
379
394
|
```erb
|
|
@@ -465,6 +480,16 @@ the same host hooks (`base_controller_class` to inherit your admin's controller,
|
|
|
465
480
|
two-pane layout, colour tokens and components in all five, scoped so it cannot
|
|
466
481
|
touch your own CSS — and migrations that follow your app's `primary_key_type`.
|
|
467
482
|
|
|
483
|
+
## Affiliation
|
|
484
|
+
|
|
485
|
+
An independent open-source Rails engine. Not affiliated with or endorsed by the company behind livechat.com.
|
|
486
|
+
|
|
468
487
|
## License
|
|
469
488
|
|
|
470
489
|
MIT.
|
|
490
|
+
|
|
491
|
+
## Rails edge and Ractors
|
|
492
|
+
|
|
493
|
+
Rails edge is tested alongside Rails 7.1–8.1. Experimental Ruby 4.0+ Ractor hosting
|
|
494
|
+
requires additional upstream dependencies and freezes configuration at startup.
|
|
495
|
+
See [the Ractor hosting guide](docs/ractors.md) for callbacks, requirements and checks.
|
data/Rakefile
CHANGED
|
@@ -5,7 +5,7 @@ require 'rake/testtask'
|
|
|
5
5
|
|
|
6
6
|
Rake::TestTask.new(:test) do |t|
|
|
7
7
|
t.libs << 'test'
|
|
8
|
-
t.test_files = FileList['test/**/*_test.rb'].exclude('test/system/**/*')
|
|
8
|
+
t.test_files = FileList['test/**/*_test.rb'].exclude('test/system/**/*', 'test/ractor/**/*')
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
namespace :test do
|
|
@@ -17,3 +17,11 @@ namespace :test do
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
task default: :test
|
|
20
|
+
|
|
21
|
+
namespace :test do
|
|
22
|
+
desc 'Run isolated configuration and Rails edge Ractor request tests (Ruby 4.0+)'
|
|
23
|
+
task :ractor do
|
|
24
|
+
ruby '-Itest', 'test/ractor/configuration_test.rb'
|
|
25
|
+
ruby '-Itest', 'test/ractor/requests_test.rb'
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -9,7 +9,7 @@ module Livechat
|
|
|
9
9
|
before_action :claim_guest_conversations
|
|
10
10
|
|
|
11
11
|
if respond_to?(:rate_limit) && Livechat.config.rate_limit
|
|
12
|
-
rate_limit(**Livechat.config.rate_limit,
|
|
12
|
+
Livechat::RactorSupport.rate_limit(self, **Livechat.config.rate_limit,
|
|
13
13
|
only: %i[create email],
|
|
14
14
|
with: -> { render_rate_limited })
|
|
15
15
|
end
|
|
@@ -33,9 +33,8 @@ module Livechat
|
|
|
33
33
|
destroyed
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
end
|
|
36
|
+
def open? = status == 'open'
|
|
37
|
+
def resolved? = status == 'resolved'
|
|
39
38
|
|
|
40
39
|
# The visitor's ongoing thread. Signed-in identity wins; guests are found
|
|
41
40
|
# by their cookie token (only unclaimed threads — a token that has been
|
|
@@ -35,9 +35,9 @@ module Livechat
|
|
|
35
35
|
|
|
36
36
|
after_create_commit :on_created
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
def visitor? = author_type == 'visitor'
|
|
39
|
+
def agent? = author_type == 'agent'
|
|
40
|
+
def system? = author_type == 'system'
|
|
41
41
|
|
|
42
42
|
def read? = read_at.present?
|
|
43
43
|
|
|
@@ -154,8 +154,8 @@ module Livechat
|
|
|
154
154
|
def broadcast_new_message
|
|
155
155
|
return unless Livechat.action_cable_enabled?
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
RactorSupport.broadcast("livechat:conversation:#{conversation_id}", { nudge: id })
|
|
158
|
+
RactorSupport.broadcast('livechat:inbox', { nudge: id })
|
|
159
159
|
rescue StandardError => e
|
|
160
160
|
Rails.logger.error("[livechat] cable broadcast failed: #{e.class}: #{e.message}")
|
|
161
161
|
end
|
|
@@ -13,18 +13,19 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
</div>
|
|
15
15
|
<%# The shared status switch: the state it is in is lit and inert, the other
|
|
16
|
-
one submits to its own route
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
one submits to its own route. The form action must match that route
|
|
17
|
+
so Rails binds its per-form CSRF token to the actual submission. %>
|
|
18
|
+
<% status_path = conversation.open? ? resolve_conversation_path(conversation) : reopen_conversation_path(conversation) %>
|
|
19
|
+
<%= form_with url: status_path, method: :post, local: true, class: 'status-switch' do %>
|
|
19
20
|
<% if conversation.open? %>
|
|
20
21
|
<button type="button" class="status-open current" aria-current="true">
|
|
21
22
|
<%= t('livechat.statuses.open', default: 'Open') %>
|
|
22
23
|
</button>
|
|
23
|
-
<button
|
|
24
|
+
<button type="submit" class="status-resolved">
|
|
24
25
|
<%= t('livechat.statuses.resolved', default: 'Resolved') %>
|
|
25
26
|
</button>
|
|
26
27
|
<% else %>
|
|
27
|
-
<button
|
|
28
|
+
<button type="submit" class="status-open">
|
|
28
29
|
<%= t('livechat.statuses.open', default: 'Open') %>
|
|
29
30
|
</button>
|
|
30
31
|
<button type="button" class="status-resolved current" aria-current="true">
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
<%# One bordered composer box (matches the visitor widget): the reply on top,
|
|
71
72
|
a toolbar row below with tools on the left and send on the right. %>
|
|
72
73
|
<%= form_with url: conversation_messages_path(conversation), method: :post,
|
|
73
|
-
multipart: true, class: 'reply',
|
|
74
|
+
multipart: true, local: true, class: 'reply',
|
|
74
75
|
data: {
|
|
75
76
|
record_audio: t('livechat.dashboard.record_audio', default: 'Record audio'),
|
|
76
77
|
stop_recording: t('livechat.dashboard.stop_recording', default: 'Stop recording'),
|
|
@@ -12,7 +12,7 @@ ar:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "حفظ"
|
|
14
14
|
email_saved: "سنرد أيضًا عبر البريد الإلكتروني."
|
|
15
|
-
event_resolved: "تم
|
|
15
|
+
event_resolved: "تم الحل حاليًا. أرسل رسالة أخرى متى احتجت إلى مساعدة."
|
|
16
16
|
event_reopened: "تمت إعادة فتح المحادثة"
|
|
17
17
|
error_send: "تعذر الإرسال. يرجى المحاولة مرة أخرى."
|
|
18
18
|
error_rate_limited: "رسائل كثيرة جدًا. يرجى الانتظار قليلًا والمحاولة مرة أخرى."
|
|
@@ -12,7 +12,7 @@ bg:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Запази"
|
|
14
14
|
email_saved: "Ще отговорим и по имейл."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Засега въпросът е решен. Изпратете ново съобщение, когато имате нужда от помощ."
|
|
16
16
|
event_reopened: "Разговорът е отворен отново"
|
|
17
17
|
error_send: "Изпращането не бе успешно. Моля, опитайте отново."
|
|
18
18
|
error_rate_limited: "Твърде много съобщения. Моля, изчакайте малко и опитайте отново."
|
|
@@ -12,7 +12,7 @@ bn:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "সংরক্ষণ করুন"
|
|
14
14
|
email_saved: "আমরা ইমেইলেও উত্তর দেব।"
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "আপাতত সমাধান হয়েছে। সাহায্যের প্রয়োজন হলে আবার বার্তা পাঠান।"
|
|
16
16
|
event_reopened: "কথোপকথন আবার খোলা হয়েছে"
|
|
17
17
|
error_send: "পাঠানো যায়নি। অনুগ্রহ করে আবার চেষ্টা করুন।"
|
|
18
18
|
error_rate_limited: "অনেক বেশি বার্তা। একটু অপেক্ষা করে আবার চেষ্টা করুন।"
|
|
@@ -12,7 +12,7 @@ de:
|
|
|
12
12
|
email_placeholder: "sie@beispiel.de"
|
|
13
13
|
email_save: "Speichern"
|
|
14
14
|
email_saved: "Wir antworten auch per E-Mail."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Vorerst erledigt. Schreib uns jederzeit wieder, wenn du Hilfe brauchst."
|
|
16
16
|
event_reopened: "Unterhaltung wieder geöffnet"
|
|
17
17
|
error_send: "Senden fehlgeschlagen. Bitte versuchen Sie es erneut."
|
|
18
18
|
error_rate_limited: "Zu viele Nachrichten. Bitte warten Sie einen Moment und versuchen Sie es erneut."
|
|
@@ -12,7 +12,7 @@ el:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Αποθήκευση"
|
|
14
14
|
email_saved: "Θα απαντήσουμε επίσης μέσω email."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Το θέμα λύθηκε προς το παρόν. Στείλτε νέο μήνυμα όποτε χρειαστείτε βοήθεια."
|
|
16
16
|
event_reopened: "Η συνομιλία άνοιξε ξανά"
|
|
17
17
|
error_send: "Δεν ήταν δυνατή η αποστολή. Δοκιμάστε ξανά."
|
|
18
18
|
error_rate_limited: "Πάρα πολλά μηνύματα. Περιμένετε λίγο και δοκιμάστε ξανά."
|
|
@@ -12,7 +12,7 @@ en:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Save"
|
|
14
14
|
email_saved: "We will also reply by email."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Resolved for now. Send another message whenever you need help."
|
|
16
16
|
event_reopened: "Conversation reopened"
|
|
17
17
|
error_send: "Could not send. Please try again."
|
|
18
18
|
error_rate_limited: "Too many messages. Please wait a moment and try again."
|
|
@@ -12,7 +12,7 @@ es:
|
|
|
12
12
|
email_placeholder: "tu@ejemplo.com"
|
|
13
13
|
email_save: "Guardar"
|
|
14
14
|
email_saved: "También te responderemos por correo."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Resuelto por ahora. Envía otro mensaje cuando necesites ayuda."
|
|
16
16
|
event_reopened: "Conversación reabierta"
|
|
17
17
|
error_send: "No se pudo enviar. Inténtalo de nuevo."
|
|
18
18
|
error_rate_limited: "Demasiados mensajes. Espera un momento e inténtalo de nuevo."
|
|
@@ -12,7 +12,7 @@ fr:
|
|
|
12
12
|
email_placeholder: "vous@exemple.fr"
|
|
13
13
|
email_save: "Enregistrer"
|
|
14
14
|
email_saved: "Nous répondrons également par e-mail."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Résolu pour le moment. Envoyez un autre message dès que vous avez besoin d’aide."
|
|
16
16
|
event_reopened: "Conversation rouverte"
|
|
17
17
|
error_send: "Échec de l'envoi. Veuillez réessayer."
|
|
18
18
|
error_rate_limited: "Trop de messages. Veuillez patienter un instant et réessayer."
|
|
@@ -12,7 +12,7 @@ hi:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "सहेजें"
|
|
14
14
|
email_saved: "हम ईमेल से भी जवाब देंगे।"
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "फ़िलहाल समस्या हल हो गई है। जब भी मदद चाहिए, फिर से संदेश भेजें।"
|
|
16
16
|
event_reopened: "बातचीत फिर से खोली गई"
|
|
17
17
|
error_send: "भेजा नहीं जा सका। कृपया फिर से कोशिश करें।"
|
|
18
18
|
error_rate_limited: "बहुत सारे संदेश। कृपया थोड़ी देर रुककर फिर से कोशिश करें।"
|
|
@@ -12,7 +12,7 @@ hr:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Spremi"
|
|
14
14
|
email_saved: "Odgovorit ćemo i e-poštom."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Zasad je riješeno. Pošaljite novu poruku kad god trebate pomoć."
|
|
16
16
|
event_reopened: "Razgovor je ponovno otvoren"
|
|
17
17
|
error_send: "Slanje nije uspjelo. Pokušajte ponovno."
|
|
18
18
|
error_rate_limited: "Previše poruka. Pričekajte trenutak i pokušajte ponovno."
|
|
@@ -12,7 +12,7 @@ id:
|
|
|
12
12
|
email_placeholder: "anda@contoh.com"
|
|
13
13
|
email_save: "Simpan"
|
|
14
14
|
email_saved: "Kami juga akan membalas melalui email."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Selesai untuk saat ini. Kirim pesan lagi kapan pun Anda membutuhkan bantuan."
|
|
16
16
|
event_reopened: "Percakapan dibuka kembali"
|
|
17
17
|
error_send: "Tidak dapat mengirim. Silakan coba lagi."
|
|
18
18
|
error_rate_limited: "Terlalu banyak pesan. Mohon tunggu sebentar dan coba lagi."
|
|
@@ -12,7 +12,7 @@ it:
|
|
|
12
12
|
email_placeholder: "tu@esempio.com"
|
|
13
13
|
email_save: "Salva"
|
|
14
14
|
email_saved: "Ti risponderemo anche via e-mail."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Risolto per il momento. Invia un altro messaggio quando hai bisogno di aiuto."
|
|
16
16
|
event_reopened: "Conversazione riaperta"
|
|
17
17
|
error_send: "Invio non riuscito. Riprova."
|
|
18
18
|
error_rate_limited: "Troppi messaggi. Attendi un momento e riprova."
|
|
@@ -12,7 +12,7 @@ ja:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "保存"
|
|
14
14
|
email_saved: "メールでも返信いたします。"
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "ひとまず解決しました。またお困りの際は、いつでもメッセージをお送りください。"
|
|
16
16
|
event_reopened: "会話が再開されました"
|
|
17
17
|
error_send: "送信できませんでした。もう一度お試しください。"
|
|
18
18
|
error_rate_limited: "メッセージが多すぎます。少し待ってからもう一度お試しください。"
|
|
@@ -12,7 +12,7 @@ ko:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "저장"
|
|
14
14
|
email_saved: "이메일로도 답변드리겠습니다."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "일단 해결되었습니다. 도움이 필요하면 언제든 다시 메시지를 보내 주세요."
|
|
16
16
|
event_reopened: "대화가 다시 열렸습니다"
|
|
17
17
|
error_send: "전송하지 못했습니다. 다시 시도해 주세요."
|
|
18
18
|
error_rate_limited: "메시지가 너무 많습니다. 잠시 후 다시 시도해 주세요."
|
|
@@ -12,7 +12,7 @@ lb:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Späicheren"
|
|
14
14
|
email_saved: "Mir äntweren och per E-Mail."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Fir de Moment geléist. Schéckt eng nei Noriicht, wann Dir Hëllef braucht."
|
|
16
16
|
event_reopened: "Gespréich nees opgemaach"
|
|
17
17
|
error_send: "Konnt net geschéckt ginn. Probéiert w.e.g. nach eng Kéier."
|
|
18
18
|
error_rate_limited: "Ze vill Noriichten. Waart w.e.g. e Moment a probéiert nach eng Kéier."
|
|
@@ -12,7 +12,7 @@ nl:
|
|
|
12
12
|
email_placeholder: "jij@voorbeeld.nl"
|
|
13
13
|
email_save: "Opslaan"
|
|
14
14
|
email_saved: "We antwoorden ook per e-mail."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Voor nu opgelost. Stuur gerust een nieuw bericht als je hulp nodig hebt."
|
|
16
16
|
event_reopened: "Gesprek heropend"
|
|
17
17
|
error_send: "Versturen is niet gelukt. Probeer het opnieuw."
|
|
18
18
|
error_rate_limited: "Te veel berichten. Wacht even en probeer het opnieuw."
|
|
@@ -12,7 +12,7 @@ pl:
|
|
|
12
12
|
email_placeholder: "ty@przyklad.pl"
|
|
13
13
|
email_save: "Zapisz"
|
|
14
14
|
email_saved: "Odpowiemy również e-mailem."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Na razie sprawa jest rozwiązana. Napisz ponownie, gdy potrzebujesz pomocy."
|
|
16
16
|
event_reopened: "Rozmowa wznowiona"
|
|
17
17
|
error_send: "Nie udało się wysłać. Spróbuj ponownie."
|
|
18
18
|
error_rate_limited: "Zbyt wiele wiadomości. Poczekaj chwilę i spróbuj ponownie."
|
|
@@ -12,7 +12,7 @@ pt:
|
|
|
12
12
|
email_placeholder: "voce@exemplo.com"
|
|
13
13
|
email_save: "Salvar"
|
|
14
14
|
email_saved: "Também responderemos por e-mail."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Resolvido por enquanto. Envie outra mensagem sempre que precisar de ajuda."
|
|
16
16
|
event_reopened: "Conversa reaberta"
|
|
17
17
|
error_send: "Não foi possível enviar. Tente novamente."
|
|
18
18
|
error_rate_limited: "Muitas mensagens. Aguarde um momento e tente novamente."
|
|
@@ -12,7 +12,7 @@ ro:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Salvează"
|
|
14
14
|
email_saved: "Vom răspunde și pe e-mail."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Rezolvat pentru moment. Trimiteți un alt mesaj când aveți nevoie de ajutor."
|
|
16
16
|
event_reopened: "Conversație redeschisă"
|
|
17
17
|
error_send: "Nu s-a putut trimite. Vă rugăm să încercați din nou."
|
|
18
18
|
error_rate_limited: "Prea multe mesaje. Așteptați puțin și încercați din nou."
|
|
@@ -12,7 +12,7 @@ ru:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Сохранить"
|
|
14
14
|
email_saved: "Мы также ответим по электронной почте."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Пока вопрос решён. Напишите снова, когда понадобится помощь."
|
|
16
16
|
event_reopened: "Диалог возобновлён"
|
|
17
17
|
error_send: "Не удалось отправить. Пожалуйста, попробуйте ещё раз."
|
|
18
18
|
error_rate_limited: "Слишком много сообщений. Подождите немного и попробуйте ещё раз."
|
|
@@ -12,7 +12,7 @@ th:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "บันทึก"
|
|
14
14
|
email_saved: "เราจะตอบกลับทางอีเมลด้วย"
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "แก้ไขเรียบร้อยแล้วในตอนนี้ ส่งข้อความมาได้อีกเมื่อคุณต้องการความช่วยเหลือ"
|
|
16
16
|
event_reopened: "เปิดการสนทนาอีกครั้งแล้ว"
|
|
17
17
|
error_send: "ส่งไม่สำเร็จ โปรดลองอีกครั้ง"
|
|
18
18
|
error_rate_limited: "ข้อความมากเกินไป โปรดรอสักครู่แล้วลองอีกครั้ง"
|
|
@@ -12,7 +12,7 @@ tr:
|
|
|
12
12
|
email_placeholder: "siz@ornek.com"
|
|
13
13
|
email_save: "Kaydet"
|
|
14
14
|
email_saved: "Ayrıca e-postayla da yanıtlayacağız."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Şimdilik çözüldü. Yardıma ihtiyacınız olduğunda tekrar mesaj gönderin."
|
|
16
16
|
event_reopened: "Görüşme yeniden açıldı"
|
|
17
17
|
error_send: "Gönderilemedi. Lütfen tekrar deneyin."
|
|
18
18
|
error_rate_limited: "Çok fazla mesaj. Lütfen biraz bekleyip tekrar deneyin."
|
|
@@ -12,7 +12,7 @@ uk:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Зберегти"
|
|
14
14
|
email_saved: "Ми також відповімо електронною поштою."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Наразі питання вирішено. Напишіть знову, коли знадобиться допомога."
|
|
16
16
|
event_reopened: "Розмову відновлено"
|
|
17
17
|
error_send: "Не вдалося надіслати. Будь ласка, спробуйте ще раз."
|
|
18
18
|
error_rate_limited: "Забагато повідомлень. Зачекайте трохи та спробуйте ще раз."
|
|
@@ -12,7 +12,7 @@ ur:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "محفوظ کریں"
|
|
14
14
|
email_saved: "ہم ای میل پر بھی جواب دیں گے۔"
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "فی الحال مسئلہ حل ہو گیا ہے۔ جب بھی مدد کی ضرورت ہو، دوبارہ پیغام بھیجیں۔"
|
|
16
16
|
event_reopened: "گفتگو دوبارہ کھول دی گئی"
|
|
17
17
|
error_send: "بھیجا نہیں جا سکا۔ براہ کرم دوبارہ کوشش کریں۔"
|
|
18
18
|
error_rate_limited: "بہت زیادہ پیغامات۔ براہ کرم تھوڑا انتظار کریں اور دوبارہ کوشش کریں۔"
|
|
@@ -12,7 +12,7 @@ vi:
|
|
|
12
12
|
email_placeholder: "you@example.com"
|
|
13
13
|
email_save: "Lưu"
|
|
14
14
|
email_saved: "Chúng tôi cũng sẽ trả lời qua email."
|
|
15
|
-
event_resolved: "
|
|
15
|
+
event_resolved: "Tạm thời đã giải quyết xong. Hãy nhắn tin lại bất cứ khi nào bạn cần trợ giúp."
|
|
16
16
|
event_reopened: "Cuộc trò chuyện đã được mở lại"
|
|
17
17
|
error_send: "Không thể gửi. Vui lòng thử lại."
|
|
18
18
|
error_rate_limited: "Quá nhiều tin nhắn. Vui lòng đợi một lát rồi thử lại."
|
data/docs/ractors.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Rails edge and experimental Ractor hosting
|
|
2
|
+
|
|
3
|
+
The regular CI matrix covers Rails 7.1, 7.2, 8.0 and 8.1. A required Rails
|
|
4
|
+
edge job runs the same suite against `rails/rails` main. A separate job boots
|
|
5
|
+
an eager-loaded host, calls `Rails.application.ractorize!`, and sends real
|
|
6
|
+
Rack requests through the mounted engine in non-main Ractors, including
|
|
7
|
+
simultaneous requests. The Ractor checks run in separate processes because
|
|
8
|
+
Ractorization freezes Rails; they never freeze the ordinary test application.
|
|
9
|
+
|
|
10
|
+
## Host prerequisites
|
|
11
|
+
|
|
12
|
+
Ractor hosting currently requires Ruby 4.0+, Rails main, Rack main's
|
|
13
|
+
`rack/ractorize`, and the unreleased [I18n Ractor support](https://github.com/ruby-i18n/i18n/pull/741).
|
|
14
|
+
`gemfiles/rails_ractor.gemfile` records the exact I18n revision tested. These
|
|
15
|
+
are development/test dependencies, not new runtime dependencies for released
|
|
16
|
+
Rails. The gem's supported dependency range remains Rails >= 7.1 and < 9.
|
|
17
|
+
|
|
18
|
+
For a host experimenting with Ractor hosting, the tested upstream overrides are:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
gem "rails", github: "rails/rails", branch: "main"
|
|
22
|
+
gem "rack", github: "rack/rack", branch: "main"
|
|
23
|
+
gem "i18n", github: "Shopify/i18n", ref: "58aa1dcd3e04c34831e1c2ec06c83391559c7c91"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Follow Rails' own Ractor hosting requirements: disable reloading, eager-load
|
|
27
|
+
application code, use a shareable logger/cache and a Ractor-compatible job
|
|
28
|
+
adapter. Before application classes load, enable Rails' callback isolation:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
require "active_support/ractors"
|
|
32
|
+
ActiveSupport::Ractors.unshareable_proc_action = :raise
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Our isolated fixture uses `ActiveSupport::Ractors::Logger`, a null
|
|
36
|
+
cache, and (where jobs are loaded) `:inline`. Its separate shared counter proves
|
|
37
|
+
that public submission limits remain effective across worker Ractors. The
|
|
38
|
+
ordinary dummy application's `:test` job adapter is unchanged.
|
|
39
|
+
|
|
40
|
+
The engine prepares itself automatically on `before_ractorize`; ordinary Rails
|
|
41
|
+
boots do not freeze its configuration or load the experimental I18n extension.
|
|
42
|
+
An unavailable I18n Ractor extension produces a startup error explaining the
|
|
43
|
+
prerequisite. Rails edge and Ractor hosting remain experimental: this is not a
|
|
44
|
+
promise that every third-party host middleware, database driver, storage
|
|
45
|
+
service, mail adapter or Action Cable adapter is Ractor safe.
|
|
46
|
+
|
|
47
|
+
## Configuration and callbacks
|
|
48
|
+
|
|
49
|
+
Finish configuring Livechat before calling `ractorize!`. The engine publishes
|
|
50
|
+
a frozen copy of the configuration and warms/freezes widget JS, CSS and content
|
|
51
|
+
fingerprints. Changes after Ractorization require a process restart. Arrays and
|
|
52
|
+
hashes supplied by the host are copied before freezing.
|
|
53
|
+
|
|
54
|
+
Callbacks are isolated with Ruby's `Ractor.shareable_lambda` or
|
|
55
|
+
`Ractor.shareable_proc`, preserving lambda/proc arity. They continue to receive
|
|
56
|
+
the same request, user, record or event arguments and run on each request.
|
|
57
|
+
Isolated callbacks use arguments and constants; their implicit initializer
|
|
58
|
+
`self` becomes nil, following Rails' isolated callback convention.
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
Livechat.configure do |config|
|
|
62
|
+
config.enabled = ->(request) { request.get_header("HTTP_X_WIDGET") != "off" }
|
|
63
|
+
end
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Immutable captured values must already be shareable:
|
|
67
|
+
|
|
68
|
+
```ruby
|
|
69
|
+
expected_host = "app.example.com".freeze
|
|
70
|
+
Livechat.configure do |config|
|
|
71
|
+
config.enabled = ->(request) { request.host == expected_host }
|
|
72
|
+
end
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Mutable captures (an array collecting notifications, an unfrozen captured
|
|
76
|
+
string, or reassigned outer locals) cannot be shared. The engine fails at
|
|
77
|
+
startup with `Livechat.config.<setting>` in the error rather than failing on
|
|
78
|
+
a visitor's request. Use request-local state and external persistence for
|
|
79
|
+
side effects. A pre-isolated callback made with an explicit shareable `self:`
|
|
80
|
+
keeps that receiver. Stateful callable objects must be copyable/shareable;
|
|
81
|
+
custom objects remain subject to Ruby's Ractor rules.
|
|
82
|
+
|
|
83
|
+
## Scope and cost
|
|
84
|
+
|
|
85
|
+
Some Rails main paths are still being converted to Ractors. The engine warms
|
|
86
|
+
model attributes and controller names, prepares ETag callbacks, and supplies
|
|
87
|
+
narrow bridges for mounted URL generation, cache freshness, digest/key
|
|
88
|
+
operations, GlobalID URI decoding and boot-time attribute decorators. Those bridges preserve the
|
|
89
|
+
original operation on the main Ractor; requests, authorization callbacks,
|
|
90
|
+
rendering and persistence orchestration execute in their worker Ractors.
|
|
91
|
+
Adapter name quoting delegates to its original implementation on the main Ractor,
|
|
92
|
+
which preserves escaping and avoids process-global mutable caches in workers.
|
|
93
|
+
Disk-backed uploads use Ractor-local storage clients and plain temporary files
|
|
94
|
+
with explicit cleanup, because Tempfile's generated delegation methods cannot
|
|
95
|
+
be called from another Ractor. MIME registrations must finish before
|
|
96
|
+
Ractorization, when Marcel's MIME tables become immutable. Eager model schema
|
|
97
|
+
preparation adds startup database work.
|
|
98
|
+
The bridges are internal compatibility code, add coordination overhead, and
|
|
99
|
+
must be reviewed as upstream Rails evolves. No throughput improvement is claimed.
|
|
100
|
+
|
|
101
|
+
## Run the checks
|
|
102
|
+
|
|
103
|
+
Use the Ruby configured in `mise.toml`, never macOS's system Ruby.
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
BUNDLE_GEMFILE=gemfiles/rails_edge.gemfile bundle install
|
|
107
|
+
BUNDLE_GEMFILE=gemfiles/rails_edge.gemfile bundle exec rake test
|
|
108
|
+
BUNDLE_GEMFILE=gemfiles/rails_ractor.gemfile bundle install
|
|
109
|
+
BUNDLE_GEMFILE=gemfiles/rails_ractor.gemfile bundle exec rake test:ractor
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The request fixture creates and removes its own temporary database and host;
|
|
113
|
+
it does not reuse or freeze `test/dummy`. The shared schema lives in
|
|
114
|
+
`test/support/schema.rb` so the ordinary and Ractor suites exercise the same
|
|
115
|
+
record shape. Successful checks establish the tested SQLite host and explicit
|
|
116
|
+
request paths, not all combinations of host integrations.
|
|
117
|
+
|
|
118
|
+
The media job also runs with `RACTOR_MEDIA=1`, exercising private disk-backed
|
|
119
|
+
Active Storage downloads through the engine's authorization gate. Storage
|
|
120
|
+
services are initialized per Ractor, and streamed responses use a thread local
|
|
121
|
+
to that Ractor. Livechat additionally runs with `RACTOR_CABLE=1`, checking the
|
|
122
|
+
signed stream token and broadcasts delegated to the main Action Cable server.
|
|
123
|
+
Other storage services and production Cable adapters need host-specific QA.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|